diff --git a/.travis.yml b/.travis.yml
index 71d6562106a7f7693f8a5ab8952c76848d69880d..82421e993c1e21a0a14dbc8c5045aff9f83a877a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -87,7 +87,9 @@ env:
- RTT_BSP='stm32/stm32f405-smdz-breadfruit' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32f407-atk-explorer' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32f407-st-discovery' RTT_TOOL_CHAIN='sourcery-arm'
+ - RTT_BSP='stm32/stm32f410-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32f411-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm'
+ - RTT_BSP='stm32/stm32f411-weact-MiniF4' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32f427-robomaster-a' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32f429-armfly-v6' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32f429-atk-apollo' RTT_TOOL_CHAIN='sourcery-arm'
@@ -103,6 +105,7 @@ env:
- RTT_BSP='stm32/stm32g431-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32h743-atk-apollo' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32h743-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm'
+ - RTT_BSP='stm32/stm32h747-st-discovery' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32l4r9-st-eval' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32l053-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32l432-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm'
@@ -110,6 +113,7 @@ env:
- RTT_BSP='stm32/stm32l475-st-discovery' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32l476-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32/stm32l496-ali-developer' RTT_TOOL_CHAIN='sourcery-arm'
+ - RTT_BSP='stm32/stm32l496-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='stm32f20x' RTT_TOOL_CHAIN='sourcery-arm'
- RTT_BSP='swm320-lq100' RTT_TOOL_CHAIN='sourcery-arm'
# - RTT_BSP='taihu' RTT_TOOL_CHAIN='sourcery-ppc'
diff --git a/ChangeLog.md b/ChangeLog.md
index 7b3e87e373c8bc5683465bb803d6e63166f55f0d..8ac4fc2ab89b6eb87adecfa758709c09cb4cf8f3 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,3 +1,155 @@
+# RT-Thread v4.0.2 Change Log
+
+Change log since v4.0.1
+
+## Kernel
+
+* Split the component automatic initialization to component automatic initialization and main funciton;
+* Add spin lock API in SMP mode;
+* Fix RT_IDLE_HOOK spelling issue;
+* Add thread waiting for message queue when queue is full;
+* Fix the issue of delete mq in `rt_mq_create` in some abnormal case;
+* Remove the C++ keywords in the`rt_console_set_device`function;
+* Remove the `suspend_thread_count` member from memory_pool structure;
+* Fix the issue when block = NULL in rt_mp_free;
+* Fix the issue of incorrect scheduling task sequence caused by rt_thread_yeild in system scheduling;
+* Fix the issue that the interrupt is opened too late and cause the signal handling delayed;
+* When disable SMP, `cpu.c` will not be added into project by default;
+* Fix the issue that `rt_thread_exit` turned on the interrupt prematurely in the SMP mode, so other cores might delete this task, causing the issue in subsequent function stacks;
+* Fix the issue of critical protection when `rt_thread_delete` change the status of thread;
+
+## Components
+
+* Fix the issue of mPool size in C++ / Queue;
+* Add the error status return in C++ / Thread task join/wait function;
+* Fix compilation warning in DFS/ELM FatFS;
+* Add support for Linux NFS Server in DFS/NFS;
+* Fix mkfs issue in DFS/UFFS;
+* Add ftruncate, flock, getuid, umask APIs;
+* Fix the display issue of fd with offset in list_fd command;
+* Add `dfs_mount_device` API to mount a file system on a device which is already in mount_table;
+* Rename the C++ keywords in DFS/rename function;
+* Connnect dfs/poll, select with RT_USING_POSIX in Kconfig;
+* Optimize the part of the code of finsh to make it more simple;
+* When RT_USING_DEVICE is not used, finsh can use the `rt_hw_console_getchar()` function which is simple to implement and not using the device framework;
+* Increase the line length of the finsh shell to more than 256 characters;
+* utest can support clang compiler and C++ compiler;
+* Fix possible cross-boundary issues in ulog;
+* Fix compilation warning in `ulog/ulog_console_backend_output`;
+* Add support for file sending and receiving feature in YModem;
+* CRC16 can be calculated without the lookup talbe to reduce code size in YModem component;
+* Fix the issue that stack may be wrongly released during pthread/destory;
+* Fix the possible memory leaks issue which caused by pthread_create abnormal case;
+* The timer-related APIs under different compiler of libc are moved to the `libc\compilers\common` folder;
+* Remove redundant definitions in `dlib/sys/unistd.h` (which will cause compilation warnings);
+* Add `sys/errno.h` and`sys/signal.h` header files under dlib;
+* Freemodbus is no longer in the kernel, and split it as a standalone softwre package;
+* AT socket updated to v1.3.0:
+ - Add multi-client and multi-device function support in AT Socket, and improve the dirty data handling when AT device hardware module reboot;
+ - Support netdev network card feature, which can manage and control AT device network connection through the network card interface;
+* Improve AT Server function support in AT components, add AT Server data sending and receiving interfaces `at_server_send ()` and `at_server_recv ()`;
+* Fix the issue of `closesocket()` in SAL component when socket closing failure after `shutdown()`;
+* Improve `sal_bind ()` network card binding related function in SAL component;
+* Add IPV6 related options configuration and function support to SAL and netdev;
+* Improve ping command error handling and log display in the netdev;
+* Add hostname configuration options and functions in lwIP component;
+* Fix the assertion issue of `sys_arch_mbox_fetch()` in lwIP which may occur when a socket is closed;
+* Add network card uninstallation function and support for dhcpd service stop function to the lwip component;
+* Fix lwIP component compilation failure caused by closing FinSH component;
+* Fix the issue that the socket may not be closed during the DHCPD task in the lwIP DHCP server;
+* Add `dhcpd_stop()` interface;
+* Change log in device driver framework:
+ * Refactor audio driver framework;
+ * Fix the issue that the receiving length is 0 in CAN and the issue of returning wrong values;
+ * Add hardware encryption and decryption driver framework;
+ * Fix the flag handling issue of `rt_i2c_master_send/rt_i2c_master_recv`;
+ * Add input capture and pulse encoding driver framework;
+ * Fix the issue that partition lock is deleted when `rt_mmcsd_blk_remove`;
+ * Fix the issue that the enumerated capacity of the large-capacity card in MMC/SD exceeded the data range;
+ * When the SDIO device is initialized, the function's manufacturer and product can also use the information in CIS;
+ * Improve the interrupt mode handling in the sensor framework, and fix the issue that the memory is not released when registering the sensor;
+ * More information are provided in command line of sensor framework;
+ * Add the checking for Rx buffer size in the serial port framework, and provide a notification when RX buffer full;
+ * Remove the old Nor SPI Flash driver in SPI framework, and replace with SFUD component;
+ * Fix some judgements issue in the return value of SFUD;
+ * Fix the definition warning of `SFUD_FLASH_DEVICE_TABLE` in SFUD;
+ * Add support for W25Q64DW devices in SFUD;
+ * Fix FiFo creation failure handling when creating a pipe;
+ * Fix the issue of releasing RBB in advance in `rt_rbb_destroy()` function;
+ * Rename the new keyword using of C++ in `rt_rbb_blk_alloc` function;
+ * Unify the `struct rt_delayed_work` in workqueue to `struct rt_work`;
+ * Add touch driver framework;
+ * Add USB Audio class;
+ * Fix RNDIS plug-in/out issue in USB device stack;
+ * Add the interface callback function in USB device stack;
+ * Improve wlan framework, including command line functions, handling of AP name, password length, support for netdev, better configurability, etc.
+
+## BSP and CPU porting
+
+* Add Clang compiler support in ARM-related CPU porting;
+* Fix SCB_AIRCR definition issue in ARM Cortex-M0;
+* Add ARM Cortex-M33 porting;
+* Add DMB/DSB related operations for cache operations in ARM Cortex-A porting;
+* Add FPU support in ARM Cortex-A porting;
+* Re-organize MIPS port. And XBurst related porting are moved to X1000 BSP;
+* The porting of loongson 1B and 1C CPU are combined into one GS232 porting;
+* Add support for RISC-V Hummingbird processor porting;
+* The context switch exit operation of risc-v is forced back to machine mode;
+* Fix the issue of switch interruption during TI C28x DSP porting;
+* Add _ffs like implementation in the TI C28x DSP porting;
+* Unify the .data .bss section to 8bytes alignment in GCC tool chain;
+* The es32f0334 BSP is moved to `bsp/essemi/es32f0334`;
+* Add `bsp/essemi/es8p508x` BSP, including UART and GPIO drivers;
+* Add GD32VF103V-EVAL (RISC-V MCU) BSP, including UART driver;
+* Rerange NXP i.MXRT BSP and add related BSP documents;
+* Add i.MXRT1052 ATK Commander, Fire Pro BSP and i.MXRT1064 EVK BSP to the new i.MXRT BSP;
+* Add BSP for NXP LPC55S6X series, and increase support for NXP official development board LPC55S69-EVK;
+* Fix I2C operation (master_xfer) in LPC54114-lite BSP;
+* Add Audio driver in LPC54114-lite BSP;
+* Update Loongson 1B BSP and use automatic component initialization in default;
+* Add Kconfig configuration for Loongson 1B BSP;
+* Add QEMU/mipssim BSP for simulate RT-Thread/MIPS without MIPS hardware;
+* Refactor qemu-vexpress-a9's Audio driver and fix the issue of OS Tick accuracy;
+* Add LPUART driver to RV32M1 VEGA BSP;
+* Remove old STM32 BSP: stm32f4xx-HAL, stm32f10x, stm32f10x-HAL, stm32f429-apollo, stm32f429-disco, stm32h743-nucleo;
+* Fix the issue of `rt_hw_sci_init()` for opening the global interrupt in tms320f28379d BSP;
+* Add support of soft I2C and hardware encryption module to WinnerMicro W60x BSP(AES/DES/3DES/RC/SHA1/MD3/CRC);
+* Add oneshot WiFi configuration support in WinnerMicro W60x BSP;
+* Add more STM32 BSP based on new STM32 BSP framework:
+ * stm32f072-st-nucleo
+ * stm32f103-gizwits-gokitv21
+ * stm32f103-yf-ufun
+ * stm32f412-st-nucleo
+ * stm32f427-robomaster-a
+ * stm32f429-st-disco
+ * stm32f769-st-disco
+ * stm32g431-st-nucleo
+ * stm32h743-st-nucleo
+ * stm32h750-armfly-h7-tool
+ * stm32l4r5-st-nucleo
+ * stm32l452-st-nucleo
+* For the new STM32 BSP framework:
+ * Add DMAMUX support to stm32l4+;
+ * Update F7 HAL library SConscript;
+ * Open the SWD port configuration on cubemx in stm32f103-atk-warshipv3 BSP;
+ * Add support for SD card in stm32f427-robomaster-a BSP;
+ * Add USBFS driver to stm32f412-nucleo BSP;
+ * Remove use of device user data on uart driver;
+ * Add QSPI FLASH support in stm32h743-atk-apollo BSP;
+ * Optimized Ethernet driver;
+ * Add hardware encryption and decryption driver;
+ * Add MIPI LCD driver;
+ * Add pulse encoding driver;
+ * Optimize hardware timer driver;
+ * Add support for UART 7/8 in serial driver;
+ * Optimize WDT driver;
+
+## Tools
+
+* Optimize scons script for eclipse in order to generate eclipse project better;
+* Improve rtconfig.h generator, PATH type configuration can be generated correctly;
+* Fix gcc path detection issue when using the default cross toolchain of the Linux distribution;
+
# RT-Thread v4.0.1 Change Log
## Kernel
@@ -674,7 +826,7 @@ RT-Thread v2.0.1是2.0这个系列的bug修正版,而v2.1.0 alpha则是当前
* 修正USB host代码的编译错误;
* 修正sensor框架回调函数的问题;
* 修正pin设备注册时的设备名称问题;
-
+
而v2.1.0 alpha这个技术预览版则沿着最初设定的roadmap技术路线进行,这其中主要包括:
* lwip更深度的集成:把它集成到RT-Thread的文件系统接口中,这样Linux/Unix下的一些socket网络应用能够更顺利的移植到RT-Thread上,也为以后可以应用到更多地方的select接口铺路。
@@ -687,7 +839,7 @@ RT-Thread v2.0.1是2.0这个系列的bug修正版,而v2.1.0 alpha则是当前
以下是自v2.0.0 RC版本以来的详细更改记录。后续我还会给出v2.0.0版本自v1.2.x版本的主要不同、看点,以及给出下一个版本的roadmap规划。
## 内核
-
+
* console以RT_DEVICE_FLAG_STREAM参数打开字符设备;
* 在rt_memheap_free中加入更多的断言检查;
@@ -707,7 +859,7 @@ RT-Thread v2.0.1是2.0这个系列的bug修正版,而v2.1.0 alpha则是当前
* 添加VBUS组件用于Linux与RT-Thread系统之间,RT-Thread与RT-Thread系统之间通信(睿赛德服务公司捐赠);
* 增加lwIP/NAT组件,可以做多个网口间的地址转换(Hicard);
* 增加lwIP/DHCP服务端,用于向客户端分配IP地址(睿赛德服务公司提供);
-
+
## BSP
* 修正LPC4357串口驱动初始化时过早打开中断的问题(nongxiaoming);
@@ -738,487 +890,4 @@ RT-Thread做为一个开源组织参与的CSDN开源夏令营结出了丰硕的
由wzyy2参与的GDB stub实现,也完美的支持BeagleBoneBlack开发板和STM32F4平台;
CSDN开源夏令营其他的成果,例如bluedroid移植也有了初步的成果,希望能够在后续的版本(可能会是2.1.0系列版本?)包含进来。CSDN开源夏令营是一次非常棒的活动,能够让学生提前进入实战,了解软件开发的初步知识。对开源社区来说,也是一次非常有益的社区互动活动。希望明年这个活动可以继续,关注RT-Thread、嵌入式开发的同学可以关注明年的动向。
-当前智能化设备是一个备受关注的领域,针对这一领域的特点,RT-Thread也相应的做出了积极的响应,所以这个版本开始加入sensor的应用框架(APP/算法 <--> sensor framework <--> RT-Thread device driver <--> 硬件外设)。希望在小型化的RT-Thread操作系统基础上融合智能化相关的技术,让RT-Thread成为这方面可选的OS系统之一。RT-Thread操作系统的sensor框架也尝试新的实现方式,即采用C++的方式来实现(当然也会考虑C方面的兼容,无疑C++的面向对象特性会更好,所以最终选择了C++),在这个基础上也可能融合其他的一些生态技术,例如ARM mbed平台上的一些社区组件技术。所以这个发布版本中既包括sensor框架,也包括了C++底层的一些基础支撑。
-
-这个版本是RT-Thread 2.0.0系列正式版本的候选版本,正式版本预计会在年底正式发布,距离正式版本还会加入更完善的一些支撑(例如各种传感器驱动)。也计划2014年11月22日,在上海浦东举行RT-Thread嵌入式系统沙龙活动,欢迎大家关注并参与进行RT-Thread方方面面的技术交流。
-
-以下是这个版本的更改记录:
-
-## 内核
-
-* 修正当采用高级别优化编译时,idle任务中查询是否有僵尸线程的潜在bug;
-
-* 修正memory pool中的竞争问题;
-
-* 在console中打开设备时,加入流标志进行打开;
-
-## 组件
-
-* 加入C++基础支撑组件。C++组件依赖于RT_USING_LIBC库,当使用GCC编译器时请注意查看其中的说明文档并更改ld script;
-* 修正DFS中NFS打开目录的bug;
-* 更改DFS ROMFS默认romfs_root为弱化符号;
-* 添加DFS中dfs_file_lseek接口中关于fs的检查;
-* 移除I2C core中无用的core lock锁;
-* 添加sensor framework(采用C++的方式支持各种sensor);
-* 修正serial框架中DMA发送的bug(heyuanjie87);
-* 移除SPI框架中不必要的device初始化代码;
-* 完善SPI Wi-Fi网卡RW009驱动并提供RSSI相关的命令;
-* 修正MSH中未定义DFS_USING_WORKDIR时更改当前目录的bug;
-* 修正MSH中未定义RT_LWIP_TCP时依然定义了netstat命令的bug;
-* 修正MSH中未定义RT_USING_HEAP时依然定义了free命令的bug;
-* 修正finsh中FINSH_USING_HISTORY相关的裁剪;
-* 加入gdb stub组件,当前支持ARM Cortex-A8和Cortex-M3/4(wzyy2);
-* 统一不同编译器下使用LIBC的宏为RT_USING_LIBC,原有的宏定义RT_USING_NEWLIB/RT_USING_ARM_LIBC需要从rtconfig.h中移除,并替换成RT_USING_LIBC;
-* 加入最新的lwIP分支:lwip-head,以提供IPv4/v6双栈的功能(hduffddybz);
-* YMode中打开串口设备时,添加open flag(armink);
-
-## bsp
-
-* 加入北京京微雅格的M7(华山)低功耗FPGA的ARM Cortex-M3移植(aozima);
-* 加入北京京微雅格的M7 EMAC以太网驱动(aozima);
-* AT91SAM9260分支中更改RT_USING_NEWLIB为RT_USING_LIBC;
-* BeagleBoneBlack分支中加入gdb stub支持(wzyy2);
-* LPC176x分支中加入C++支持;
-* LPC176x分支中修正SD卡驱动返回卡信息的bug;
-* 修正LPC408x分支中GCC编译时的问题;
-* LPC408x分支中加入C++支持;
-* 龙芯1B分支中加入UART3驱动;
-* 加入飞索半导体的MB9BF568 FM4分支移植(yangfasheng);
-* mini2440分支中更改RT_USING_NEWLIB为 RT_USING_LIBC;
-* stm32f0x分支中移除不同编译器下的LIBC定义,统一更改为RT_USING_LIBC;
-* stm32f0x分支中加入串口接收溢出中断处理(armink);
-* stm32f40x分支中加入gdb stub支持并添加UART6驱动(wzzy2);
-* zynq7000分支中更改RT_USING_NEWLIB为RT_USING_LIBC;
-* 加入ARM Cortex-M4芯片指令级的ffs实现;
-* 修正MB0BF618S分支中缺少timer初始化的bug(mike mao);
-
-## 工具
-
-* 移除Python 2.6中未支持的语法(xfguo);
-* 移除Windows平台中的startupinfo信息(对Python版本兼容性更好);
-* 修正CPPPATH被打乱的bug;
-
-# RT-Thread 2.0.0 Beta更改说明
-
-发布时间:2014/8/1
-
-v2.0.0这个版本系列是RT-Thread当前的开发分支,如果要上新项目,建议使用这个版本来进行,预计这个版本的正式版会在年底发布。欢迎对这个版本进行测试、并反馈问题,能够早日进入到稳定版。
-
-v2.0.0版本的开发相对活跃些,开源社区提供了强有力的支持:如Arda贡献的TM4C129x移植,Romeo贡献的frdm-k64f移植,xiaonong的LPC4300移植等,以及睿赛德服务公司捐赠的Zynq7000移植,MB9BF618S移植,以及SPI WiFi网卡的驱动代码等。
-
-更改记录
-
-## 内核
-
-* 移除rt_device_init_all()函数:在系统启动时不需要再调用这个函数来初始化驱动,而是由上层应用执行rt_device_open时自动进行设备初始化;
-* 修正设备对象引用计数在打开设备失败依然递增的问题;
-* 增加WEAK宏用于定义/声明弱符号;
-* 在执行静态内存块分配前,重置线程的errno;
-* 修正timer未打开调试选项时,无用的静态函数定义(导致编译警告);
-* 启动timer前,对timer进行强制移除;
-* 在执行soft timer超时函数时,打开调度器锁;
-* 新增块设备的自动刷新参数,RT_DEVICE_CTRL_BLK_AUTOREFRESH;
-
-## 工具
-
-* 修正scons命令编译时,选择keil mdk (armcc)编译器时,命令行太长编译失败的问题;
-
-## 移植
-
-* 移除rt_device_init_all()相关的调用;
-* 根据串口框架调整相关的驱动代码;
-* 新增frdm-k64f移植(FreeScale K64芯片);
-* 移除K60Fxxxx移植;
-* 新增LPC43xx移植(NXP LPC4357芯片);
-* 移除LPC176x中的组件初始化配置;
-* 修正龙芯1B移植(ls1bdev)中链接脚本关于组件初始化部分的配置;
-* 修正STM32F40x中UART3的配置;
-* 修正STM32F40x中GNU GCC连接脚本中ROM/RAM大小的配置;
-* 移除STM32F107中的组件初始化配置;
-* 增强STM32F107 EMAC驱动性能,同时加入自动查找PHY芯片地址功能;
-* 重写xplorer4330(NXP LPC4330芯片)移植(xiaonong完成);
-* 新增Zynq7000 ARM Dual Cortex-A9移植;
-* 新增MB9BF618S移植;
-* 新增tm4c129x移植,并加入相应的EMAC以太网驱动;
-
-## 组件
-
-* DFS: 新增根据设备对象获得其上装载文件系统路径的函数:dfs_filesystem_get_mounted_path(struct rt_device* device);
-* DFS: 修正readdir在GNU GCC下的编译警告;
-* DeviceDrivers:新增workqueue实现;
-* DeviceDrivers: 修正USB Device栈中的一些拼写错误;
-* DeviceDrivers: 重写serial框架,能够让串口设备驱动同时支持三种模式:poll、interrupt、DMA。模式选择需要在执行rt_device_open时,由open flags指定;
-* DeviceDrivers: 加入更多的SPI设备驱动,例如RW009的SPI WiFi网口驱动(2.4G 802.11 b/g/n,WEP/WPA/WPA2,SoftAP/Station),SPI NorFlash块设备驱动,ENC28J60以太网网卡驱动;
-* Finsh: list_device()命令中增加refcount的信息;
-* Finsh: 修正'0'零常量无法识别的错误;
-* Finsh: mv命令,实现把一个文件移动到一个目录中;
-* Finsh: ifconfig命令支持对一个网络接口的基本配置;
-* Finsh: 新增netstat命令,用于显示当前系统中TCP连接的状态;
-* Finsh: 修正当命令行太长导致的缓冲区移除的问题;
-* libc: 修正arm libc中未使用DFS时的编译警告;
-* libc: 修正newlib中使用DFS时的系统调用编译警告(GNU GCC下);
-* lwIP 1.4.1: 默认打开LWIP_SO_SNDTIMEO以支持连接发送超时;
-* lwIP 1.4.1: 修正MEMP_NUM_TCP_SEG定义错误的问题;
-* lwIP 1.4.1: 加入RT_LWIP_REASSEMBLY_FRAG选项定义以支持IP分组及合并;
-* lwIP 1.4.1: ethnet网络接口支持定义LWIP_NO_TX_THREAD/LWIP_NO_RX_THREAD,以关闭etx/erx线程;
-* lwIP 1.4.1: 用户可以重新定义RT_LWIP_ETH_MTU,以修改网络中的MTU值;
-* lwIP 1.4.1: 修正LWIP_NETIF_LINK_CALLBACK条件编译的问题;
-* lwIP 1.4.1: 完善移植相关的注释;
-* log trace: 增加log_session_lvl接口;
-* log trace: log trace中的session引用更改成常量形式;
-* ymodem: 增强数据接收的稳定性;
-
-# RT-Thread 2.0.0 Alpha更改说明
-
-发布时间:2014/4/8
-
-RT-Thread 2.0.0分支的第一个技术预览版本,仅用于展示2.0.0发展分支的演化动向(按照roadmap,2.0.0这个分支会有一部分RT-Thread和Linux互补性的技术,为Linux增加更好的实时性,为RT-Thread增加更多的功能性,这份技术预览版正是朝着这个目标而努力),欢迎反馈建议和问题。
-
-## 组件
-
-* msh: bugfix 和功能性增强。新的 msh 在调用外部模块方面更加方便。
-* DFS: nfs 的 bugfix 和内置命令的增强。ELM FatFS加入对扇区不匹配情况下的信息输出,这样能够及时定位问题。
-* JS:新添了轻量级Javascript引擎,可以在RT-Thread中直接运行javascript脚本。
-* VMM:可以在qemu中运行的 Virtual Machine Module 组件。暂时只支持 realview-pb-a8 的 bsp。
-* CMSIS:版本更新至 3.20
-* drivers:USB 协议栈的重构。新的框架中编写驱动变得更加容易了。
-
-## BSP
-
-* beaglebone:串口驱动更新
-* realview-a8:添加了 VMM 组件
-
-## 工具
-
-* 固件加入scons --target=ua -s,用于准备用户应用环境;
-
-[发布后记]
-
-RT-Thread 2.0.0. Alpha版本相比于RT-Thread 1.2.1,新的特性主要有两部分:
-- RT-Thread + Linux双系统,这部分以RealView-A8处理器(ARM Cortex-A8单核)为蓝本,给出一个简单的双系统并行运行的demo;在没有硬件的环境下,可以使用QEMU软件虚拟方式的执行。这个链接中包含一个编译好的Linux及RT-Thread二进制包,可以直接下载进行体验。
-
-目录中有 Linux 的内核镜像 zImage,ramdisk rootfs.cpio.gz。可以用
-qemu-system-arm -M realview-pb-a8 -kernel zImage -initrd rootfs.cpio.gz -serial vc -serial vc
-来启动。启动之后 Linux 的控制台在第一个串口上(Atl + Ctrl + 3),可以直接无密码以 root 用户登录。登录之后加载内核模块:
-insmod rtvmm.ko
-来启动 RT-Thread。RT-Thread 启动之后控制台在第二个串口上(Atl + Ctrl + 4)。第一个串口Linux shell依然可以使用,第二个串口则是RT-Thread的shell。
-- JavaScript解析器,这个是由牛头哥移植的,可以在一个非常小资料的MCU上以JavaScript脚本方式进行编程、开发。根据这种方式,也提供了RN001JS的以太网硬件模块:以JavaScript脚本语言作为二次开发,提供在线web(即WebIDE)进行编程并运行JavaScript程序。JavaScript作为一门轻量级、解释型的语言,更容易上手,配合WebIDE、及提供的一些example可以使得开发变得非常的轻松,也包括一些传感器的JavaScript例子,让做网页的人也可以玩硬件了!
-
-# RT-Thread 1.2.1更改说明
-
-发布时间: 2014/4/8
-
-在原有的1.2.0版本的bug修正版本,也是1.2.0系列的第一个修正版本,原则上不添加任何的新功能,我们尽量会按照每个季度一个修订版本的方式推进。大家在使用的过程中有什么问题还请反馈给我们,这些问题很可能会在下个版本中修正!
-
-以下是更改记录:
-
-## 内核
-
-* 用户应用,增加用户应用命令行参数支持;
-* 在挂起一个任务时,把相应的定时器也关闭;
-
-## BSP
-
-* BeagleBone,加入更多串口驱动支持;
-* 移除BSP中rt_device_init_all函数调用,改成打开设备时自动进行初始化;
-* LPC176x,移除components初始化管理器;
-* LPC4088,修正LED驱动的问题;
-* STM32F107,移除components初始化管理器;
-
-## 组件
-
-* 文件系统,ELM FatFS加入对扇区不匹配情况下的信息输出,这样能够及时定位问题;
-* 文件系统,NFS网络文件系统修正相关的一些编译警告信息;
-* 文件系统,copy命令加入文件夹方式复制功能;
-* 文件系统,RAMFS,加入到components初始化管理器中;
-* 文件系统,ROMFS,用于转换文件的工具mkromfs.py,增加Linux主机的支持;
-* CMSIS更新到3.2.0版本;
-* 串口驱动框架加入serial->ops->control的调用;
-* 命令行系统,优化msh,支持用户应用的命令行参数;
-* 命令行系统,当使用msh时,默认使用msh >的命令行提示符;
-* TCP/IP协议栈,导出更多的lwIP接口给用户应用;
-* POSIX thread,修正了同时使用lwIP组件时的编译警告;
-* 第三方组件,加入TJPGD的移植,加入libpng的移植;
-
-## 工具
-
-* 固件加入scons --target=ua -s,用于准备用户应用环境;
-
-[发布后记]
-* RT-Thread携带了众多的BSP,不一定能够一一保证每个分支上把RT-Thread上相应的功能使用起来。所以针对这种情况,我们有一款评估用的硬件开发板:RealBoard 4088,在上面力求把一些相关例程都添加上,这样在一个基本的BSP基础上,可以对照着把其他的组件、功能添加进去;
-* RealBoard 4088使用的RT-Thread版本主要以RT-Thread 1.2.1版本为主。
-
-# RT-Thread 1.2.0正式版本更改说明
-
-发布时间: 2014/1/6
-
-实现roadmap中提到的大部分内容
-
-1,文档方面已完成《RT-Thread编程手册》,同时还有论坛上jiezhi童鞋的《一起来学RT-Thread系列连载教程》
-2,BSP分支方面新增cortext-A8(beaglebone),cortext-R4(rm48x50),UNITY-2(SEP6200),lpc408x的移植
-3,组件方面:
-- 加入msh(类似linux shell的风格),能够直接执行应用程序
-- 新增freemodbus 1.6.0的移植
-- 新增开源的嵌入式关系数据库SQLite 3.8.1的移植
-- 新增Ymodem协议
-- 默认使用lwIP 1.4.1
-
-下面是自RT-Thread 1.2.0 RC版本发布以来具体的变更履历:
-
-## 内核
-
-* timer.c - 使用跳跃表(skip list)实现系统定时器链表,并在bsp中的startup.c中重新加入定时器初始化函数rt_system_timer_init()
-* rtdebug.h - 新增宏定义RT_DEBUG_IN_THREAD_CONTEXT
-* idle.c - 在函数rt_thread_idle_excute()中一次清除所有的死线程
-* scheduler.c - 新增API rt_critical_level()返回调度器上锁次数
-
-## 移植
-
-* cortex-m0 - 修正 cortex-m0 GCC移植中hardfault的问题点
-* cortex-r4 - 在startup后释放IRQ堆栈空间
-* cortex-r4 - 按字节长度分配堆栈空间
-
-## BSP分支
-
-* 新增lpc408x移植
-* bsp/stm32f0x - 增加USART1,USART2驱动,支持finsh,支持组件初始化
-* bsp/simulator - 当RTGUI配置无效时打印错误信息
-* bsp/simulator - 默认情况下关闭RTGUI选项
-* bsp/simulator - 增加createdef.py文件来生成VS的def文件
-* bsp/simulator - 当使用VC++编译时去除_TIME_T_DEFINED的定义
-* bsp/xplorer4330 - 重命名文件Retarget.c为retarget.c,否则linux系统中编译会报错
-* bsp/xplorer4330 - 修正GCC编译链接时关于ENTRY的警告
-* bsp/rm48x50 - 新增GCC的移植
-* bsp/K60Fxxxx - 修正一个编译错误
-
-## 组件
-
-* dfs - 正确处理mkfs未实现的情况
-* dfs - 使用指针代替index变量
-* dfs - 在函数dfs_filesystem_lookup()将含义模糊的指针变量名称empty重命名为fs
-* dfs - 修正dfs_unmount问题点
-* dfs - 在设备打开错误时令挂载失败
-* dfs/elmfat - 令elmfatfs每次都检查扇区大小
-* net - 新增freemodbus 1.6.0的移植
-* finsh - 新增FINSH_USING_MSH_ONLY选项
-* finsh - 只有当shell设备为空时调用rt_console_get_device()
-* finsh - 修正FINSH_USING_SYMTAB未定义的错误
-* finsh - 重构control按键的处理
-* msh - 增加文件和路径名称自动补全的功能
-* msh - msh内增加执行module的功能
-* msh - msh内增加更多的命令
-* libc - 修正 _sys_read()/_sys_write()问题点
-* external - 增加开源的嵌入式关系数据库SQLite 3.8.1的移植
-* pthreads - 避免ESHUTDOWN重复定义
-* mtd_nand - 在MTD nand中增加更多的调试措施
-* mtd_nand - 修正操作MTD nand时起始块错误的问题
-* lwip-1.4.1 - 在lwIP内加入更多的RT-Thread选项设置
-* log_trace - 修正函数memmove()参数使用错误的问题
-* drivers/pipe - 增加一个control命令来获得pipe剩余的空间
-* drivers/serial - 如果读写长度为0,则立即返回
-
-## 例程
-
-* examples - 用rt_sem_control()中的RT_IPC_CMD_RESET命令rt_sem_trytake()来清除信号量
-* examples - 始终打印输出测试结果
-* examples - 在所有的测试结束后打印输出简报
-* examples - 在TC线程中清除变量_tc_stat的TC_STAT_RUNNING状态
-* examples - 重新实现loop功能,并新增finsh命令tc_loop
-* examples - 在tc_stop中增加延时,由原来的延时RT_TICK_PER_SECOND/2调整为10 * RT_TICK_PER_SECOND
-* examples - 在SConscript中判断TC如果被使能,在CPPPATH中增加TC路径
-* examples - 新增一个in-mem-log的例子
-* semaphore_priority.c - 在cleanup时释放信号量
-* heap_realloc.c - 检查调用realloc(ptr, 0)是否成功
-* thread_delete.c - tc线程的延时应该比tid2的延时长,保证其测试过程中正常运行
-* thread_delay.c - 放宽超时判断条件,因为当RT_TICK_PER_SECOND为1000时,容易产生1个tick的误差
-* semaphore_static.c - 放宽超时判断条件,因为当RT_TICK_PER_SECOND为1000时,容易产生1个tick的误差
-* semaphore_dynamic.c - 放宽超时判断条件,因为当RT_TICK_PER_SECOND为1000时,容易产生1个tick的误差
-
-其他:
-* 更新README.md
-
-# RT-Thread 1.2.0RC更改说明
-
-发布时间: 2013/10/10/ 10:19
-
-主要说明: 该版本新增ARM Cortex-A8的支持(BeagleBone),新增UNITY-2内核的支持(SEP6200),新增Ymodem协议。
-
-变更履历
-========
-
-[内核]
-
-* 修正rtdef.h中的拼写错误(_MSC_VER_ -> _MSC_VER)
-* 修正scheduler.c中的调试打印输出错误
-* ipc - 在函数rt_event_recv()中增加对参数option有效性的检查
-* device - 增加统计设备引用次数的变量ref_count
-* memheap - 修正内存块分割问题点
-* memheap - 优化函数rt_memheap_realloc()
-* kservice - 函数声明使用rt_vsnprintf代替vsnprintf
-
-
-[组件]
-
-* dfs - 修正dfs_file.c中一处变量参数类型错误的问题
-* dfs - 增加mount table
-* dfs - 在building脚本中加入ramfs的支持
-* dfs - 修正ramfs中O_APPEND write的问题
-* dfs/elm - 在mkfs中加入device_open/close
-* dfs/jffs2 - 修正jffs2_opn/opendir中的f_flag初始化问题
-* dfs/jffs2 - 修正jffs2卸载问题
-* pthread - 修正一处编译警告
-* drivers/pipe - 增加rt_pipe_init/rt_pipe_detach
-* drivers/pipe - 增加非阻塞读写和强制写模式
-* drivers/pipe - 当恢复读的时候调用函数rx_indicate()
-* drivers/pipe - 增加一个设备类型(pipe类型)
-* drivers/portal - 实现portal设备类型
-* drivers/ringbuffer - 修改一些模糊不清的函数名称
-* drivers/ringbuffer - 新增put_force和putchar_force接口函数
-* finsh - 当set_device时增加设备检查
-* finsh - 在rx_ind中增加对shell设备的自动设置
-* finsh - 增加pipe和portal设备的描述
-* finsh - 在变量定义时使用别名
-* finsh - 当关闭设备时注销rx_indicate
-* finsh - 修正命令行太长的问题
-* finsh/msh - 只有当DFS_USING_WORKDIR使能时才声明cd/pwd
-* init - 为新的组件初始化机制更新连接脚本
-* init - 增加组件初始化调试代码
-* logtrace - 整理代码,去除编译警告
-* logtrace - 增加LOG_TRACE_VERBOSE
-* logtrace - 调整log values
-* logtrace - 只有当finsh使能的时候才声明cmd
-* libc/minilibc - 在sys/time.h中增加gettimeofday的声明
-* utilities - 新增ymodem
-
-工具:
-
-* building.py - 增加clang静态缝隙器的支持
-* building.py - 为Keil MDK增加buildlib功能
-* building.py - 在clang-analyze中执行'clang -Wall -fsyntas-only'
-* clang-analyze.py - 增加一个定制工具实现clang静态分析
-
-分支:
-
-* 新增BeagleBone的移植
-* 新增SEP6200的移植
-* 新增K60Fxxxx的移植
-* 修正Linux中的编译错误(lm4f232, stm32f40x, xplorer4330)
-* cortex-m3 - 加强hard fault的异常处理函数
-* at91sam9260 - 更新串口驱动,使用组件中的通用串口驱动
-* at91sam9260 - 更新工程目录结构
-* at91sam9260 - 修正编译错误
-* at91sam9260 - 内嵌GPLv2许可
-* stm32f10x - 删除无用的文件
-* stm32f10x - 更新工程目录结构
-* stm32f10x - 更新工程文件
-* stm32f10x - 为使用新的组件初始化更新连接脚本
-* stm32f10x - 为使用新的组件初始化更新SD card驱动
-* stm32f10x - 为使用新的组件初始化更新DM9000驱动
-* stm32f10x - 更新串口驱动,使用组件中的通用串口驱动
-* stm32f10x - 修正rtgui初始化问题
-* simulator - 为使用新的组件初始化更新代码,以便支持mingw
-* simulator - 支持Linux系统
-* simulator - 修正Linux系统中的SDL初始化问题
-* simulator - 在rt_components_init之后初始化SDL
-* simulator - 将对SDL设置的内容移入drivers/SConstruct
-* simulator - 在env中获得CORSS_TOOL和EXEC_PATH的值
-* simulator - 支持clang-analyze
-* simulator - 增加tap netif driver
-
-//----------------------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------------------
-
-
-版本: RT-Thread 1.2.0 Beta 版本
-
-发布时间: 2013/6/30
-
-进过开发人员三个月的努力,RT-Thread 1.2.0 Beta 版本如期发布。
-该版本默认采用lwIP 1.4.1协议栈,USB device stack也进一步完善。加入 log_trace 子系统,加入组件初始化升级版本,加入 ARM Cortex-R 的移植。
-
-主要变化:
-
-* 1,新增组件初始化功能
-- 详情请看论坛帖子[新功能] 组件初始化
-* 2,支持ARM Cortex-R系列处理器
-- Grissiom 完成 ARM Cortex-R 的移植,目前BSP中已有TI RM48x50分支(仅支持TI CCS开发环境)
-* 3,文件系统中新增 RAMFS
-* 4,加入 log_trace 子系统
-* 5,优化Cortex-M4线程上下文切换,使用了浮点运算的线程才保存及恢复FPU寄存器
-- 详情请看论坛帖子[优化]cortex-m4f线程切换,优化FPU寄存器
-* 6,新增API rt_memheap_realloc()
-* 7,重新实现ringbuffer,采用镜像的方法区分“满”和“空”,同时支持任意大小的buffer
-* 8,内核中加入RT_KERNEL_MALLOC/RT_KERNEL_FREE/RT_KERNEL_REALLOC宏。
-如果用户未定义这些宏,将默认指向rt_malloc/rt_free/rt_realloc。
-同时内核仅局限于使用这些宏来使用动态内存
-* 9,在 building.py 中新增生成 cscope database 的选项
-* 10,USB组件新增reset函数,支持热插拔
-* 11,scons编译系统支持CCS开发环境
-* 12,USB组件新增状态信息(USB_STATE_NOTATTACHED,USB_STATE_ATTACHED,USB_STATE_POWERED...)
-
-修复问题点:
-
-* 1,USB组件HOST可以挂起endpoints
-* 2,simulator分支,修复 serial_write 问题
-* 3,udisk可以被弹出
-* 4,iar.py中修复绝对路径的问题
-* 5,dfs_fs.h内增加dfs_mkfs()函数的申明
-* 6,生成MDK工程文件的时候加入library文件
-* 7,当PC不再接受数据的时候,重置VCOM相应的状态
-* 8,USB组件:返回正确的LangID字符串长度给HOST
-* 9,Cortex-M0,Cortex-M3,Cortex-M4上下文切换时,回收系统初始化时用到的栈空间
-
-//----------------------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------------------
-
-
-
-版本: RT-Thread 1.2.0 Alpha版本
-
-发布时间: 2013/4/10
-
-遵循2013年RT-Thread roadmap,RT-Thread 1.2.0 Alpha版本发布,Alpha意味着此版本为技术预览版,仅用于展示RT-Thread 1.2.0未来的发展方向,并不适合于开发正式产品。RT-Thread 1.2.0版本是1.1.x系列的下一个分支,这个分支主要体现的是RT-Thread 1.x系列的文档情况。当然也有一些功能、代码方面的增强。
-
-伴随着新版本的到来,RT-Thread有几个重大的转变:
-1,代码托管从google code(SVN)迁移到github(GIT)
-2,RT-Thread与RTGUI区分开来,并成为两个独立的开发分支
-3,重视文档,将文档建设作为1.2.0版本的首要任务来抓
-
-内核主要变化:
-1,加入__rt_ffs函数用于实现32位整数中获取第一个置1的位;同时调度器中位图相关算法直接使用__rt_ffs函数;CPU移植时,可定义RT_USING_CPU_FFS,使用芯片指令完成。
-
-2,新的中断注册机制
-weety加入interrupt description功能,用于为interrupt增加更多的信息,同时中断服务例程也可以携带用户自定义的参数类型。
-* 这部分对ARM7、ARM9、MIPS等影响很大,需要对CPU移植做相应的一些修改。
-* 这部分对ARM Cortex-M系列芯片没有影响。
-
-3,调整定时器插入位置,为相同超时定时的后面。
-
-组件主要变化:
-1,添加lwIP 1.4.1。
-2,在finsh shell中加入module shell功能。finsh shell本身是一个C语言表达式的shell命令行,而module shell更类似于一个传统的命令行,由命令,参数等方式构成。
-
-分支主要变化:
-1,完善simulator分支,支持RTGUI,支持应用模块。
-2,完善at91sam9260分支的移植及驱动更新。
-
-编译系统主要变化:
-1,开启省略编译时长命令特性,如果需要查看编译时命令行,可以使用scons --verbose查看。
-2,加入生成CodeBlocks工程特性。
-3,修正当系统安装使用Keil MDK 4.6+版本的问题。
-
-github主要提交履历:
-5646189b29: elm fatfs支持mkfs,并且无需提前执行dfs_mount; mount/umount/mkfs操作也不会引起reset
-22786f8817: 允许用户自定义PID和VID
-0001344105: 更明确的定时器运行机制,如果两个定时器在同一个时刻发生超时,那么先开始的定时器先处理
-5d68ef8ec1: 修正使用64位GCC时编译finsh过程中发生错误的问题
-a4d661dcf1: 修正dfs_elm.c中一处内存泄露,并且在mount fatfs失败时执行 umount fatfs操作
-43228aeb9c: 修正list_tcps问题:ipaddr_ntoa不是可重入的函数。
-3de4b92a68: 修正AT91SAM9260分支中PHY link状态错误的问题。
-1abaa0492d
+当前智能化设备是一个备受关注的领域,针对这一领域的特点,RT-Thread也相
diff --git a/README.md b/README.md
index 41824d6ca64db043b8cb361dae826b5fff3c47e7..09156b6ca420fad6c68ce45b205e31f4a61c05bd 100644
--- a/README.md
+++ b/README.md
@@ -9,76 +9,143 @@
[](https://github.com/RT-Thread/rt-thread/pulls)
[](https://github.com/RT-Thread/rt-thread/pulls)
-RT-Thread is an open source IoT operating system from China, which has strong scalability: from a tiny kernel running on a tiny core, for example ARM Cortex-M0, or Cortex-M3/4/7, to a rich feature system running on MIPS32, ARM Cortex-A8, ARM Cortex-A9 DualCore etc.
+# Introduction
-## Overview ##
+RT-Thread was born in 2006, it is an open source, neutral, and community-based real-time operating system (RTOS).
-RT-Thread RTOS like a traditional real-time operating system. The kernel has real-time multi-task scheduling, semaphore, mutex, mail box, message queue, signal etc. However, it has three different things:
+RT-Thread is mainly written in C language, easy to understand and easy to port(can be quickly port to a wide range of mainstream MCUs and module chips). It applies object-oriented programming methods to real-time system design, making the code elegant, structured, modular, and very tailorable.
-* Device Driver;
-* Component;
-* Dynamic Module
+RT-Thread has Standard version and Nano version. For resource-constrained microcontroller (MCU) systems, the NANO kernel version that requires only 3KB Flash and 1.2KB RAM memory resources can be tailored with easy-to-use tools; And for resource-rich IoT devices, RT-Thread can use the on-line software package management tool, together with system configuration tools, to achieve intuitive and rapid modular cutting, seamlessly import rich software packages, thus achieving complex functions like Android's graphical interface and touch sliding effects, smart voice interaction effects, and so on.
-The device driver is more like a driver framework, UART, IIC, SPI, SDIO, USB device/host, EMAC, MTD NAND etc. The developer can easily add low level driver and board configuration, then combined with the upper framework, he/she can use lots of features.
+## RT-Thread Architecture
-The Component is a software concept upon RT-Thread kernel, for example a shell (finsh/msh shell), virtual file system (FAT, YAFFS, UFFS, ROM/RAM file system etc), TCP/IP protocol stack (lwIP), POSIX (thread) interface etc. One component must be a directory under RT-Thread/Components and one component can be descripted by a SConscript file (then be compiled and linked into the system).
+RT-Thread has not only a real-time kernel, but also rich components. Its architecture is as follows:
-The Dynamic Module, formerly named as User Applicaion (UA) is a dynamic loaded module or library, it can be compiled standalone without Kernel. Each Dynamic Module has its own object list to manage thread/semaphore/kernel object which was created or initialized inside this UA. More information about UA, please visit another [git repo](https://github.com/RT-Thread/rtthread-apps).
-## Board Support Package ##
+
-RT-Thread RTOS can support many architectures:
-* ARM Cortex-M0
-* ARM Cortex-M3/M4/7
-* ARM Cortex-R4
-* ARM Cortex-A8/A9
-* ARM920T/ARM926 etc
-* MIPS32
-* x86
-* Andes
-* C-Sky
-* RISC-V
-* PowerPC
+It includes:
-## License ##
+- Kernel layer: RT-Thread kernel, the core part of RT-Thread, includes the implementation of objects in the kernel system, such as multi-threading and its scheduling, semaphore, mailbox, message queue, memory management, timer, etc.; libcpu/BSP (Chip Migration Related Files/Board Support Package) is closely related to hardware and consists of peripheral drivers and CPU porting.
-RT-Thread is Open Source software under the Apache License 2.0 since RT-Thread v3.1.1. License and copyright information can be found within the code.
+- Components and Service Layer: Components are based on upper-level software on top of the RT-Thread kernel, such as virtual file systems, FinSH command-line interfaces, network frameworks, device frameworks, and more. Its modular design allows for high internal cohesion inside the components and low coupling between components.
+
+- RT-Thread software package: A general-purpose software component running on the RT-Thread IoT operating system platform for different application areas, consisting of description information, source code or library files. RT-Thread provides an open package platform with officially available or developer-supplied packages that provide developers with a choice of reusable packages that are an important part of the RT-Thread ecosystem. The package ecosystem is critical to the choice of an operating system because these packages are highly reusable and modular, making it easy for application developers to build the system they want in the shortest amount of time. RT-Thread supports more than 180 software packages.
- /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- */
+## RT-Thread Features
-Since 9th of September 2018, PRs submitted by the community may be merged into the main line only after signing the Contributor License Agreement(CLA).
+- Designed for resource-constrained devices, the minimum kernel requires only 1.2KB of RAM and 3 KB of Flash.
-## Usage ##
+- Has rich components and a prosperous and fast growing package ecosystem.
-RT-Thread RTOS uses [scons](http://www.scons.org) as building system. Therefore, please install scons and Python 2.7 firstly.
-So far, the RT-Thread scons building system support the command line compile or generate some IDE's project. There are some option varaibles in the scons building script (rtconfig.py):
+- Elegant code style, easy to use, read and master.
-* ```CROSS_TOOL``` the compiler which you want to use, gcc/keil/iar.
-* ```EXEC_PATH``` the path of compiler.
+- High Scalability. RT-Thread has high-quality scalable software architecture, loose coupling, modularity, is easy to tailor and expand.
-In SConstruct file:
+- Supports high-performance applications.
-```RTT_ROOT``` This variable is the root directory of RT-Thread RTOS. If you build the porting in the bsp directory, you can use the default setting. Also, you can set the root directory in ```RTT_ROOT``` environment variable and not modify SConstruct files.
+- Supports cross-platform and a wide range of chips.
-When you set these variables correctly, you can use command:
+## Code Catalogue
- scons
+ RT-Thread source code catalog is shown as follow:
-under BSP directory to simplely compile RT-Thread RTOS.
+| Name | Description |
+| ------------- | ------------------------------------------------------- |
+| BSP | Board Support Package based on the porting of various development boards |
+| components | Components, such as finsh shell, file system, protocol stack etc. |
+| documentation | Related documents, like coding style, doxygen etc. |
+| examples | Related sample code |
+| include | Head files of RT-Thread kernel |
+| libcpu | CPU porting code such as ARM/MIPS/RISC-V etc. |
+| src | The source files for the RT-Thread kernel. |
+| tools | The script files for the RT-Thread command build tool. |
-If you want to generate the IDE's project file, you can use command:
+RT-Thread has now been ported for nearly 90 development boards, most BSPs support MDK, IAR development environment and GCC compiler, and have provided default MDK and IAR project, which allows users to add their own application code directly based on the project. Each BSP has a similar directory structure, and most BSPs provide a README.md file, which is a markdown-format file that contains the basic introduction of BSP, and introduces how to simply start using BSP.
- scons --target=mdk/mdk4/mdk5/iar/cb -s
+Env is a development tool developed by RT-Thread which provides a build environment, text graphical system configuration, and package management capabilities for project based on the RT-Thread operating system. Its built-in `menuconfig` provides an easy-to-use configuration tool. It can tailor the kernels, components and software packages freely, so that the system can be constructed by building blocks.
-to generate the project file.
+- [Download Env Tool](https://www.rt-thread.io/download.html?download=Env)
+- [User manual of Env](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/env/env.md)
-NOTE: RT-Thread scons building system will tailor the system according to your rtconfig.h configuration header file. For example, if you disable the lwIP in the rtconfig.h by commenting the ```#define RT_USING_LWIP```, the generated project file should have no lwIP related files.
+# Resources
-## Contribution ##
+## Supported Architectures
-Please refer the contributors in the github. Thank all of RT-Thread Developers.
+RT-Thread supports many architectures, and has covered the major architectures in current applications. Architecture and chip manufacturer involved:
+
+- **ARM Cortex-M0/M0+**:manufacturers like ST
+- **ARM Cortex-M3**:manufacturers like ST、Winner Micro、MindMotion, ect.
+- **ARM Cortex-M4**:manufacturers like ST、Nuvton、NXP、GigaDevice、Realtek、Ambiq Micro, ect.
+- **ARM Cortex-M7**:manufacturers like ST、NXP
+- **ARM Cortex-M23**:manufacturers like GigaDevice
+- **ARM Cortex-R4**
+- **ARM Cortex-A8/A9**:manufacturers like NXP
+- **ARM7**:manufacturers like Samsung
+- **ARM9**:manufacturers like Allwinner、Xilinx 、GOKE
+- **ARM11**:manufacturers like Fullhan
+- **MIPS32**:manufacturers like loongson、Ingenic
+- **RISC-V**:manufacturers like Hifive、Kendryte
+- **ARC**:manufacturers like SYNOPSYS
+- **DSP**:manufacturers like TI
+- **C-Sky**
+- **x86**
+
+## Supported IDE and Compiler
+
+The main IDE/compilers supported by RT-Thread are:
+
+- MDK KEIL
+- IAR
+- GCC
+- RT-Thread Studio
+
+Use Python-based [scons](http://www.scons.org/) for command-line builds.
+
+RT-Thread Studio Demonstration:
+
+
+
+## Getting Started
+
+RT-Thread BSP can be compiled directly and downloaded to the corresponding development board for use. In addition, RT-Thread also provides qemu-vexpress-a9 BSP, which can be used without hardware platform. See the getting started guide below for details.
+
+- [Getting Started of QEMU (Windows)](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/quick_start_qemu/quick_start_qemu.md)
+
+- [Getting Started of QEMU (Ubuntu)](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/quick_start_qemu/quick_start_qemu_linux.md)
+
+## Documentation
+
+[RT-Thread Programming Guide](https://github.com/RT-Thread/rtthread-manual-doc) | [RT-Thread Supported Chips & Boards](https://www.rt-thread.io/board.html) |
+[RT-Thread Software Package](https://github.com/RT-Thread/packages) | [RT-Thread Studio](https://www.rt-thread.io/studio.html)
+
+## Sample
+
+[Kernel Sample](https://github.com/RT-Thread-packages/kernel-sample) | [Device Sample Code](https://github.com/RT-Thread-packages/peripheral-sample) | [File System Sample Code](https://github.com/RT-Thread-packages/filesystem-sample ) | [Network Sample Code](https://github.com/RT-Thread-packages/network-sample ) |
+
+[Based on the STM32L475 IoT Board SDK](https://github.com/RT-Thread/IoT_Board) | [Based on the W601 IoT Board SDK](https://github.com/RT-Thread/W601_IoT_Board)
+
+# License
+
+RT-Thread is an open source software and has been licensed under Apache License Version 2.0 since v3.1.1. License information and copyright information can generally be seen at the beginning of the code:
+
+```c
+/* Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ...
+ */
+```
+
+To avoid possible future license conflicts, developers need to sign a Contributor License Agreement (CLA) when submitting PR to RT-Thread.
+
+# Community
+
+RT-Thread is very grateful for the support from all community developers, and if you have any ideas, suggestions or questions in the process of using RT-Thread, RT-Thread can be reached by the following means, and we are also updating RT-Thread in real time on these channels. At the same time, Any questions can be asked in the [issue section of rtthread-manual-doc](https://github.com/RT-Thread/rtthread-manual-doc/issues). By creating a new issue to describe your questions, community members will answer them.
+
+[Website](https://www.rt-thread.io) | [Twitter](https://twitter.com/rt_thread) | [Youtube]( https://www.youtube.com/channel/UCdDHtIfSYPq4002r27ffqPw?view_as=subscriber) | [Gitter]( https://gitter.im/RT-Thread) | [Facebook](https://www.facebook.com/RT-Thread-IoT-OS-110395723808463/?modal=admin_todo_tour) | [Medium](https://medium.com/@rt_thread)
+
+# Contribution
+
+If you are interested in RT-Thread and want to join in the development of RT-Thread and become a code contributor,please refer to the [Code Contribution Guide](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/contribution_guide/contribution_guide.md).
diff --git a/README_zh.md b/README_zh.md
index 56fe0969638b08090418648192e87aa4fc017310..4d1cc3e9e5088178efe35e58668b24d32413c411 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -1,97 +1,178 @@
-# RT-Thread #
+## 简介
-[](https://github.com/RT-Thread/rt-thread/releases)
-[](https://travis-ci.org/RT-Thread/rt-thread)
-[](https://gitter.im/RT-Thread/rt-thread?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-[](https://github.com/RT-Thread/rt-thread/pulls)
-[](https://github.com/RT-Thread/rt-thread/pulls)
+RT-Thread诞生于2006年,是一款以开源、中立、社区化发展起来的物联网操作系统。
+RT-Thread主要采用 C 语言编写,浅显易懂,且具有方便移植的特性(可快速移植到多种主流 MCU 及模组芯片上)。RT-Thread把面向对象的设计方法应用到实时系统设计中,使得代码风格优雅、架构清晰、系统模块化并且可裁剪性非常好。
-RT-Thread是一个来自中国的开源物联网操作系统,它提供了非常强的可伸缩能力:从一个可以运行在ARM Cortex-M0芯片上的极小内核,到中等的ARM Cortex-M3/4/7系统,甚至是运行于MIPS32、ARM Cortex-A系列处理器上功能丰富系统。
+RT-Thread有完整版和Nano版,对于资源受限的微控制器(MCU)系统,可通过简单易用的工具,裁剪出仅需要 3KB Flash、1.2KB RAM 内存资源的 NANO 内核版本;而相对资源丰富的物联网设备,可使用RT-Thread完整版,通过在线的软件包管理工具,配合系统配置工具实现直观快速的模块化裁剪,并且可以无缝地导入丰富的软件功能包,实现类似 Android 的图形界面及触摸滑动效果、智能语音交互效果等复杂功能。
-## 简介 ##
+## **RT-Thread架构**
-RT-Thread包含了一个自有的、传统的硬实时内核:可抢占的多任务实时调度器,信号量,互斥量,邮箱,消息队列,信号等。当然,它和传统的实时操作系统还存在着三种不同:
+RT-Thread是一个集实时操作系统(RTOS)内核、中间件组件的物联网操作系统,架构如下:
-* 设备驱动框架;
-* 软件组件;
-* 应用模块
+
-设备驱动框架更类似一套驱动框架,涉及到UART,IIC,SPI,SDIO,USB从设备/主设备,EMAC,NAND闪存设备等。它会把这些设备驱动中的共性抽象/抽取出来,而驱动工程师只需要按照固定的模式实现少量的底层硬件操作及板级配置。通过这样的方式,让一个硬件外设更容易地对接到RT-Thread系统中,并获得RT-Thread平台上的完整软件栈功能。
-软件组件是位于RT-Thread内核上的软件单元,例如命令行(finsh/msh shell),虚拟文件系统(FAT,YAFFS,UFFS,ROM/RAM文件系统等),TCP/IP网络协议栈(lwIP),Libc/POSIX标准层等。一般的,一个软件组件放置于一个目录下,例如RT-Thread/components目录下的文件夹,并且每个软件组件通过一个 SConscript文件来描述并被添加到RT-Thread的构建系统中。当系统配置中开启了这一软件组件时,这个组件将被编译并链接到最终的RT-Thread固件中。
-注:随着RT-Thread 3.0中的包管理器开启,越来越多的软件组件将以package方式出现在RT-Thread平台中。而RT-Thread平台更多的是指:
+- 内核层:RT-Thread内核,是 RT-Thread的核心部分,包括了内核系统中对象的实现,例如多线程及其调度、信号量、邮箱、消息队列、内存管理、定时器等;libcpu/BSP(芯片移植相关文件 / 板级支持包)与硬件密切相关,由外设驱动和 CPU 移植构成。
-* RT-Thread内核;
-* shell命令行;
-* 虚拟文件系统;
-* TCP/IP网络协议栈;
-* 设备驱动框架;
-* Libc/POSIX标准层。
+- 组件与服务层:组件是基于 RT-Thread内核之上的上层软件,例如虚拟文件系统、FinSH命令行界面、网络框架、设备框架等。采用模块化设计,做到组件内部高内聚,组件之间低耦合。
-更多的IoT软件包则以package方式被添加到RT-Thread系统中。
-应用模块,或者说用户应用(User Application,UA)是一个可动态加载的模块:它可以独立于RT-Thread固件而单独编译。一般的,每个UA都包含一个main函数入口;一个它自己的对象链表,用于管理这个应用的任务/信号量/消息队列等内核对象,创建、初始化、销毁等。更多关于UA的信息,请访问另外一个 [git 仓库](https://github.com/RT-Thread/rtthread-apps) 了解。
+- RT-Thread软件包:运行于 RT-Thread物联网操作系统平台上,面向不同应用领域的通用软件组件,由描述信息、源代码或库文件组成。RT-Thread提供了开放的软件包平台,这里存放了官方提供或开发者提供的软件包,该平台为开发者提供了众多可重用软件包的选择,这也是 RT-Thread生态的重要组成部分。软件包生态对于一个操作系统的选择至关重要,因为这些软件包具有很强的可重用性,模块化程度很高,极大的方便应用开发者在最短时间内,打造出自己想要的系统。RT-Thread已经支持的软件包数量已经达到 180+。
+
-## 支持的芯片架构 ##
-RT-Thread支持数种芯片体系架构,已经覆盖当前应用中的主流体系架构:
+## RT-Thread的特点
-* ARM Cortex-M0
-* ARM Cortex-M3/M4/7
-* ARM Cortex-R4
-* ARM Cortex-A8/A9
-* ARM920T/ARM926 etc
-* MIPS32
-* x86
-* Andes
-* C-Sky
-* RISC-V
-* PowerPC
+- 资源占用极低,超低功耗设计,最小内核(Nano版本)仅需1.2KB RAM,3KB Flash。
-## 许可证 ##
+- 组件丰富,繁荣发展的软件包生态 。
-RT-Thread从v3.1.1版本开始,是一个以Apache许可证2.0版本授权的开源软件,许可证信息以及版权信息一般的可以在代码首部看到:
+- 简单易用 ,优雅的代码风格,易于阅读、掌握。
- /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- */
+- 高度可伸缩,优质的可伸缩的软件架构,松耦合,模块化,易于裁剪和扩展。
-从2018/09/09开始,开发者提交PR需要签署贡献者许可协议(CLA)。
+- 强大,支持高性能应用。
-注意:
+- 跨平台、芯片支持广泛。
-以Apache许可协议v2.0版本授权仅在RT-Thread v3.1.1正式版发布之后才正式实施,当前依然在准备阶段(准备所有原有开发者签署CLA协议)。
-## 编译 ##
+## **代码目录**
-RT-Thread使用了[scons](http://www.scons.org)做为自身的编译构建系统,并进行一定的定制以满足自身的需求(可以通过scons --help查看RT-Thread中额外添加的命令)。在编译RT-Thread前,请先安装Python 2.7.x及scons。
+RT-Thread源代码目录结构如下图所示:
-截至目前,RT-Thread scons构建系统可以使用命令行方式编译代码,或者使用scons来生成不同IDE的工程文件。在使用scons时,需要对构建配置文件(rtconfig.py)中如下的变量进行配置:
+| 名称 | 描述 |
+| ------------- | ------------------------------------------------------- |
+| BSP | Board Support Package(板级支持包)基于各种开发板的移植 |
+| components | RT-Thread 的各个组件代码,例如 finsh,gui 等。 |
+| documentation | 相关文档,如编码规范等 |
+| examples | 相关示例代码 |
+| include | RT-Thread 内核的头文件。 |
+| libcpu | 各类芯片的移植代码。 |
+| src | RT-Thread 内核的源文件。 |
+| tools | RT-Thread 命令构建工具的脚本文件。 |
-* ```CROSS_TOOL``` 指定希望使用的工具链,例如gcc/keil/iar.
-* ```EXEC_PATH``` 工具链的路径.
+目前RT-Thread已经针对将近90种开发板做好了移植,大部分 BSP 都支持 MDK﹑IAR开发环境和GCC编译器,并且已经提供了默认的 MDK 和 IAR 工程,用户可以直接基于这个工程添加自己的应用代码。 每个 BSP 的目录结构高度统一,且都提供一个 README.md 文件,包含了对这个 BSP 的基本介绍,以及相应的说明,方便用户快速上手。
-注:在SConstruct文件中:
+Env 是RT-Thread推出的开发辅助工具,针对基于RT-Thread操作系统的项目工程,提供编译构建环境、图形化系统配置及软件包管理功能。其内置的 menuconfig 提供了简单易用的配置剪裁工具,可对内核、组件和软件包进行自由裁剪,使系统以搭积木的方式进行构建。
-```RTT_ROOT``` 这个变量指向了RT-Thread的发布源代码根目录。如果你仅计划编译bsp目录下的target,这个`RTT_ROOT`可以使用默认配置。另外,你也可以设置同名的环境变量来指向不同的RT-Thread源代码根目录。
+[下载 Env 工具](https://www.rt-thread.org/page/download.html)
-当你把相关的配置都配置正确后,你可以在具有目标目录下(这个目录应包括rtconfig.py、SContruct文件)执行以下命令:
+[Env 用户手册](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/env/env.md)
- scons
-从而简单地就编译好RT-Thread。
+# 资源文档
-如果你希望使用IDE来编译RT-Thread,你也可以使用命令行:
+## **硬件支持**
- scons --target=mdk/mdk4/mdk5/iar/cb -s
+RT-Thread RTOS 支持许多架构,并且已经涵盖了当前应用中的主要架构。涉及的架构和芯片制造商有:
-来生成mdk/iar等的工程文件。而后在IDE中打开project前缀的工程文件来编译RT-Thread。
+- ARM Cortex-M0/M0+:如芯片制造商 ST
-注意:RT-Thread的scons构建系统会根据配置头文件rtconfig.h来裁剪系统。例如,如果你关闭了rtconfig.h中的lwIP定义(通过注释掉```#define RT_USING_LWIP```的方式),则scons生成的IDE工程文件中将自动不包括lwIP相关的文件。而在RT-Thread 3.0版本中,可以通过menuconfig的方式来配置整个系统,而不需要再手工更改rtconfig.h配置头文件。
+- ARM Cortex-M3:如芯片制造商 ST、全志、灵动等.
-## 贡献者 ##
+- ARM Cortex-M4:如芯片制造商 ST、Nuvton、NXP、GigaDevice、Realtek、Ambiq Micro等
+
+- ARM Cortex-M7:如芯片制造商 ST、NXP
+
+- ARM Cortex-M23:如芯片制造商 GigaDevice
+
+- ARM Cortex-R4
+
+- ARM Cortex-A8/A9:如芯片制造商 NXP
+
+- ARM7:如芯片制造商Samsung
+
+- ARM9:如芯片制造商Allwinner、Xilinx 、GOKE
+
+- ARM11:如芯片制造商Fullhan
+
+- MIPS32:如芯片制造商loongson、Ingenic
+
+- RISC-V:如芯片制造商Hifive、Kendryte
+
+- ARC:如芯片制造商SYNOPSYS
+
+- DSP:如芯片制造商 TI
+
+- C-Sky
+
+- x86
+
+
+## **支持的 IDE 和编译器**
+
+RT-Thread主要支持的IDE/编译器包括:
+
+- MDK KEIL
+
+- IAR
+
+- Gcc
+
+- RT-Thread Studio
+
+使用基于 Python 的 [scons](http://www.scons.org/) 进行命令行生成。
+
+RT-Thread Studio演示:
+
+
+
+
+
+## **快速上手**
+
+RT-Thread BSP可以直接编译并下载到相应的开发板使用。此外,RT-Thread还提供 qemu-vexpress-a9 BSP,无需硬件平台即可使用。有关详细信息,请参阅下面的入门指南。
+
+[QEMU 入门指南(Windows)](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/quick_start_qemu/quick_start_qemu.md)
+
+[QEMU 入门指南(Ubuntu)](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/quick_start_qemu/quick_start_qemu_linux.md)
+
+
+## 文档
+
+[文档中心](https://www.rt-thread.org/document/site/ ) | [编程指南](https://www.rt-thread.org/document/site/programming-manual/basic/basic/ )
+
+[应用 RT-Thread 实现蜂鸣器播放器教程](https://www.rt-thread.org/document/site/tutorial/beep-player/) | [分布式温度监控系统教程](https://www.rt-thread.org/document/site/tutorial/temperature-system/ ) | [智能车连载教程](https://www.rt-thread.org/document/site/tutorial/smart-car/ )
+
+## 例程
+
+[内核示例](https://github.com/RT-Thread-packages/kernel-sample) | [设备示例代码](https://github.com/RT-Thread-packages/peripheral-sample ) | [文件系统示例代码](https://github.com/RT-Thread-packages/filesystem-sample ) | [网络示例代码](https://github.com/RT-Thread-packages/network-sample ) | [RT-Thread API参考手册](https://www.rt-thread.org/document/api/ )
+
+[基于STM32L475 IoT Board 开发板SDK](https://github.com/RT-Thread/IoT_Board) | [基于W601 IoT Board 开发板SDK](https://github.com/RT-Thread/W601_IoT_Board)
+
+## 视频
+
+RT-Thread视频中心提供了一系列RT-Thread相关教程及分享内容。
+
+如:内核入门系列 | Env系列 | 网络系列 | Nano移植系列 | RT-Thread Studio系列 | 柿饼UI系列 | 答疑直播系列 | 社区作品系列
+
+更多详情,请前往 [视频中心](https://www.rt-thread.org/page/video.html)
+
+# **许可协议**
+
+RT-Thread系统完全开源,3.1.0 及以前的版本遵循 GPL V2 + 开源许可协议。从 3.1.0 以后的版本遵循Apache License 2.0开源许可协议,可以免费在商业产品中使用,并且不需要公开私有代码。
+
+```
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+```
+
+# 社区支持
+
+RT-Thread非常感谢所有社区小伙伴的支持,在使用RT-Thread的过程中若您有任何的想法,建议或疑问都可通过以下方式联系到 RT-Thread,我们也实时在这些频道更新RT-Thread的最新讯息。同时,任何问题都可以在 [issue section](https://github.com/RT-Thread/rtthread-manual-doc/issues) 中提出。通过创建一个issue来描述您的问题,社区成员将回答这些问题。
+
+[官网]( https://www.rt-thread.org) | [论坛]( https://www.rt-thread.org/qa/forum.php) | [哔哩哔哩官方账号](https://space.bilibili.com/423462075?spm_id_from=333.788.b_765f7570696e666f.2) | [微博官方账号](https://weibo.com/rtthread?is_hot=1) | [知乎官方账号](https://www.zhihu.com/topic/19964581/hot)
+
+RT-Thread微信公众号:
+
+
+
+
+# 贡献代码
+
+如果您对RT-Thread感兴趣,并希望参与RT-Thread的开发并成为代码贡献者,请参阅[代码贡献指南](https://github.com/RT-Thread/rtthread-manual-doc/blob/master/documentation/contribution_guide/contribution_guide.md)。
-请访问github上RT-Thread项目上的contributors了解已经为RT-Thread提交过代码,PR的贡献者。感谢所有为RT-Thread付出的开发者们!
diff --git a/bsp/amebaz/libraries/Kconfig b/bsp/amebaz/libraries/Kconfig
index 935bb1fef9329eb76a3f700a54eb158e764178a9..59abf005c96ab21042e6378a0c81178bb16394b4 100644
--- a/bsp/amebaz/libraries/Kconfig
+++ b/bsp/amebaz/libraries/Kconfig
@@ -1,7 +1,7 @@
menu "External Libraries"
config RT_USING_SMARTCONFIG_LIB
- bool "Using RT-Thrad SmartConfig Library"
+ bool "Using RT-Thread SmartConfig Library"
default n
endmenu
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_acc.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_acc.h
new file mode 100644
index 0000000000000000000000000000000000000000..e17593879369e3f4e385437f0c98c3539ab479f8
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_acc.h
@@ -0,0 +1,95 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_acc.h
+ * Description : at32f4xx ACC header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+ /* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32f4xx_ACC_H
+#define __AT32f4xx_ACC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup ACC
+ * @{
+ */
+
+ /** @defgroup ACC_Exported_Constants
+ * @{
+ */
+#define ACC_CAL_Enable ((uint16_t)0x0001)
+
+#define ACC_CAL_ON ((uint16_t)0x0001)
+#define ACC_TRIM_ON ((uint16_t)0x0003)
+
+#define ACC_CAL_HSICAL ((uint16_t)0x0000)
+#define ACC_CAL_HSITRIM ((uint16_t)0x0002)
+
+#define ACC_FLAG_RSLOST ((uint16_t)0x0002)
+#define ACC_FLAG_CALRDY ((uint16_t)0x0001)
+
+#define ACC_IT_CALRDYIEN ((uint16_t)0x0020)
+#define ACC_IT_EIEN ((uint16_t)0x0010)
+/**
+ * @}
+ */
+
+/** @defgroup ACC_Exported_Functions
+ * @{
+ */
+
+void ACC_EnterCALMode(uint16_t ACC_ON, FunctionalState NewState);
+void ACC_ExitCALMode(void);
+void ACC_SetStep(uint8_t StepValue);
+void ACC_CAL_Choose(uint16_t ACC_Calibration_Choose);
+void ACC_ITConfig(uint16_t ACC_IT, FunctionalState NewState);
+
+uint8_t ACC_GetHSITRIM(void);
+uint8_t ACC_GetHSICAL(void);
+
+void ACC_WriteC1(uint16_t ACC_C1_Value);
+void ACC_WriteC2(uint16_t ACC_C2_Value);
+void ACC_WriteC3(uint16_t ACC_C3_Value);
+
+uint16_t ACC_ReadC1(void);
+uint16_t ACC_ReadC2(void);
+uint16_t ACC_ReadC3(void);
+
+FlagStatus ACC_GetFlagStatus(uint16_t ACC_FLAG);
+void ACC_ClearFlag(uint16_t ACC_FLAG);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_ACC_H */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+/**
+ * @}
+ */
+
+
+
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_adc.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_adc.h
new file mode 100644
index 0000000000000000000000000000000000000000..6e52e8d6ab062c0d7822becb3d4d1a0b7ac388b6
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_adc.h
@@ -0,0 +1,526 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_adc.h
+ * Description : at32f4xx ADC header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_ADC_H
+#define __AT32F4xx_ADC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup ADC
+ * @{
+ */
+
+/** @defgroup ADC_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief ADC Init structure definition
+ */
+
+typedef struct
+{
+ uint32_t ADC_Mode; /*!< Configures the ADC to operate in independent or
+ dual mode.
+ This parameter can be a value of @ref ADC_mode */
+
+ FunctionalState ADC_ScanMode; /*!< Specifies whether the conversion is performed in
+ Scan (multichannels) or Single (one channel) mode.
+ This parameter can be set to ENABLE or DISABLE */
+
+ FunctionalState ADC_ContinuousMode; /*!< Specifies whether the conversion is performed in
+ Continuous or Single mode.
+ This parameter can be set to ENABLE or DISABLE. */
+
+ uint32_t ADC_ExternalTrig; /*!< Defines the external trigger used to start the analog
+ to digital conversion of regular channels. This parameter
+ can be a value of @ref ADC_external_trigger_sources_for_regular_channels_conversion */
+
+ uint32_t ADC_DataAlign; /*!< Specifies whether the ADC data alignment is left or right.
+ This parameter can be a value of @ref ADC_data_align */
+
+ uint8_t ADC_NumOfChannel; /*!< Specifies the number of ADC channels that will be converted
+ using the sequencer for regular channel group.
+ This parameter must range from 1 to 16. */
+} ADC_InitType;
+/**
+ * @}
+ */
+
+/** @defgroup ADC_Exported_Constants
+ * @{
+ */
+
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+#define IS_ADC_ALL_PERIPH(PERIPH) (((PERIPH) == ADC1) || \
+ ((PERIPH) == ADC2) || \
+ ((PERIPH) == ADC3))
+#elif defined (AT32F413xx)
+#define IS_ADC_ALL_PERIPH(PERIPH) (((PERIPH) == ADC1) || \
+ ((PERIPH) == ADC2))
+#elif defined (AT32F415xx)
+#define IS_ADC_ALL_PERIPH(PERIPH) (((PERIPH) == ADC1))
+#endif
+
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+#define IS_ADC_DMA_PERIPH(PERIPH) (((PERIPH) == ADC1) || \
+ ((PERIPH) == ADC3))
+#elif defined (AT32F413xx) || defined (AT32F415xx)
+#define IS_ADC_DMA_PERIPH(PERIPH) (((PERIPH) == ADC1))
+#endif
+
+
+/** @defgroup ADC_mode
+ * @{
+ */
+
+#define ADC_Mode_Independent ((uint32_t)0x00000000)
+#define ADC_Mode_RegInjecSimult ((uint32_t)0x00010000)
+#define ADC_Mode_RegSimult_AlterTrig ((uint32_t)0x00020000)
+#define ADC_Mode_InjecSimult_FastInterl ((uint32_t)0x00030000)
+#define ADC_Mode_InjecSimult_SlowInterl ((uint32_t)0x00040000)
+#define ADC_Mode_InjecSimult ((uint32_t)0x00050000)
+#define ADC_Mode_RegSimult ((uint32_t)0x00060000)
+#define ADC_Mode_FastInterl ((uint32_t)0x00070000)
+#define ADC_Mode_SlowInterl ((uint32_t)0x00080000)
+#define ADC_Mode_AlterTrig ((uint32_t)0x00090000)
+
+#define IS_ADC_MODE(MODE) (((MODE) == ADC_Mode_Independent) || \
+ ((MODE) == ADC_Mode_RegInjecSimult) || \
+ ((MODE) == ADC_Mode_RegSimult_AlterTrig) || \
+ ((MODE) == ADC_Mode_InjecSimult_FastInterl) || \
+ ((MODE) == ADC_Mode_InjecSimult_SlowInterl) || \
+ ((MODE) == ADC_Mode_InjecSimult) || \
+ ((MODE) == ADC_Mode_RegSimult) || \
+ ((MODE) == ADC_Mode_FastInterl) || \
+ ((MODE) == ADC_Mode_SlowInterl) || \
+ ((MODE) == ADC_Mode_AlterTrig))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_external_trigger_sources_for_regular_channels_conversion
+ * @{
+ */
+
+#define ADC_ExternalTrig_TMR1_CC1_ADC12 ((uint32_t)0x00000000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrig_TMR1_CC2_ADC12 ((uint32_t)0x00020000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrig_TMR2_CC2_ADC12 ((uint32_t)0x00060000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrig_TMR3_TRGO_ADC12 ((uint32_t)0x00080000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrig_TMR4_CC4_ADC12 ((uint32_t)0x000A0000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrig_Ext_INT11_TMR8_TRGO_ADC12 ((uint32_t)0x000C0000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrig_TMR8_CC1_ADC12 ((uint32_t)0x020C0000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrig_TMR8_CC2_ADC12 ((uint32_t)0x020E0000) /*!< For ADC1 and ADC2 */
+
+#define ADC_ExternalTrig_TMR1_CC3 ((uint32_t)0x00040000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrig_None ((uint32_t)0x000E0000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrig_TMR15_CC1 ((uint32_t)0x02000000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrig_TMR15_CC2 ((uint32_t)0x02020000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrig_TMR15_CC3 ((uint32_t)0x02040000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrig_TMR15_CC4 ((uint32_t)0x02060000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrig_TMR15_TRGO ((uint32_t)0x02080000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrig_TMR1_TRGO ((uint32_t)0x020A0000) /*!< For ADC1, ADC2 and ADC3 */
+
+#define ADC_ExternalTrig_TMR3_CC1_ADC3 ((uint32_t)0x00000000) /*!< For ADC3 only */
+#define ADC_ExternalTrig_TMR2_CC3_ADC3 ((uint32_t)0x00020000) /*!< For ADC3 only */
+#define ADC_ExternalTrig_TMR8_CC1_ADC3 ((uint32_t)0x00060000) /*!< For ADC3 only */
+#define ADC_ExternalTrig_TMR8_TRGO_ADC3 ((uint32_t)0x00080000) /*!< For ADC3 only */
+#define ADC_ExternalTrig_TMR5_CC1_ADC3 ((uint32_t)0x000A0000) /*!< For ADC3 only */
+#define ADC_ExternalTrig_TMR5_CC3_ADC3 ((uint32_t)0x000C0000) /*!< For ADC3 only */
+#define ADC_ExternalTrig_TMR1_CC1_ADC3 ((uint32_t)0x020C0000) /*!< For ADC3 only */
+#define ADC_ExternalTrig_TMR8_CC3_ADC3 ((uint32_t)0x020E0000) /*!< For ADC3 only */
+
+#define IS_ADC_EXT_TRIG(REGTRIG) (((REGTRIG) == ADC_ExternalTrig_TMR1_CC1_ADC12) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR1_CC2_ADC12) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR2_CC2_ADC12) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR3_TRGO_ADC12) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR4_CC4_ADC12) || \
+ ((REGTRIG) == ADC_ExternalTrig_Ext_INT11_TMR8_TRGO_ADC12) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR8_CC1_ADC12) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR8_CC2_ADC12) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR1_CC3) || \
+ ((REGTRIG) == ADC_ExternalTrig_None) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR15_CC1) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR15_CC2) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR15_CC3) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR15_CC4) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR15_TRGO) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR1_TRGO) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR3_CC1_ADC3) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR2_CC3_ADC3) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR8_CC1_ADC3) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR8_TRGO_ADC3) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR5_CC1_ADC3) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR5_CC3_ADC3) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR1_CC1_ADC3) || \
+ ((REGTRIG) == ADC_ExternalTrig_TMR8_CC3_ADC3))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_data_align
+ * @{
+ */
+
+#define ADC_DataAlign_Right ((uint32_t)0x00000000)
+#define ADC_DataAlign_Left ((uint32_t)0x00000800)
+#define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DataAlign_Right) || \
+ ((ALIGN) == ADC_DataAlign_Left))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_channels
+ * @{
+ */
+
+#define ADC_Channel_0 ((uint8_t)0x00)
+#define ADC_Channel_1 ((uint8_t)0x01)
+#define ADC_Channel_2 ((uint8_t)0x02)
+#define ADC_Channel_3 ((uint8_t)0x03)
+#define ADC_Channel_4 ((uint8_t)0x04)
+#define ADC_Channel_5 ((uint8_t)0x05)
+#define ADC_Channel_6 ((uint8_t)0x06)
+#define ADC_Channel_7 ((uint8_t)0x07)
+#define ADC_Channel_8 ((uint8_t)0x08)
+#define ADC_Channel_9 ((uint8_t)0x09)
+#define ADC_Channel_10 ((uint8_t)0x0A)
+#define ADC_Channel_11 ((uint8_t)0x0B)
+#define ADC_Channel_12 ((uint8_t)0x0C)
+#define ADC_Channel_13 ((uint8_t)0x0D)
+#define ADC_Channel_14 ((uint8_t)0x0E)
+#define ADC_Channel_15 ((uint8_t)0x0F)
+#define ADC_Channel_16 ((uint8_t)0x10)
+#define ADC_Channel_17 ((uint8_t)0x11)
+
+#define ADC_Channel_TempSensor ((uint8_t)ADC_Channel_16)
+#define ADC_Channel_Vrefint ((uint8_t)ADC_Channel_17)
+
+#define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_Channel_0) || ((CHANNEL) == ADC_Channel_1) || \
+ ((CHANNEL) == ADC_Channel_2) || ((CHANNEL) == ADC_Channel_3) || \
+ ((CHANNEL) == ADC_Channel_4) || ((CHANNEL) == ADC_Channel_5) || \
+ ((CHANNEL) == ADC_Channel_6) || ((CHANNEL) == ADC_Channel_7) || \
+ ((CHANNEL) == ADC_Channel_8) || ((CHANNEL) == ADC_Channel_9) || \
+ ((CHANNEL) == ADC_Channel_10) || ((CHANNEL) == ADC_Channel_11) || \
+ ((CHANNEL) == ADC_Channel_12) || ((CHANNEL) == ADC_Channel_13) || \
+ ((CHANNEL) == ADC_Channel_14) || ((CHANNEL) == ADC_Channel_15) || \
+ ((CHANNEL) == ADC_Channel_16) || ((CHANNEL) == ADC_Channel_17))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_sampling_time
+ * @{
+ */
+
+#define ADC_SampleTime_1_5 ((uint8_t)0x00)
+#define ADC_SampleTime_7_5 ((uint8_t)0x01)
+#define ADC_SampleTime_13_5 ((uint8_t)0x02)
+#define ADC_SampleTime_28_5 ((uint8_t)0x03)
+#define ADC_SampleTime_41_5 ((uint8_t)0x04)
+#define ADC_SampleTime_55_5 ((uint8_t)0x05)
+#define ADC_SampleTime_71_5 ((uint8_t)0x06)
+#define ADC_SampleTime_239_5 ((uint8_t)0x07)
+#define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SampleTime_1_5) || \
+ ((TIME) == ADC_SampleTime_7_5) || \
+ ((TIME) == ADC_SampleTime_13_5) || \
+ ((TIME) == ADC_SampleTime_28_5) || \
+ ((TIME) == ADC_SampleTime_41_5) || \
+ ((TIME) == ADC_SampleTime_55_5) || \
+ ((TIME) == ADC_SampleTime_71_5) || \
+ ((TIME) == ADC_SampleTime_239_5))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_external_trigger_sources_for_injected_channels_conversion
+ * @{
+ */
+
+#define ADC_ExternalTrigInjec_TMR2_TRGO_ADC12 ((uint32_t)0x00002000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrigInjec_TMR2_CC1_ADC12 ((uint32_t)0x00003000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrigInjec_TMR3_CC4_ADC12 ((uint32_t)0x00004000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrigInjec_TMR4_TRGO_ADC12 ((uint32_t)0x00005000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrigInjec_Ext_INT15_TMR8_CC4_ADC12 ((uint32_t)0x00006000) /*!< For ADC1 and ADC2 */
+#define ADC_ExternalTrigInjec_TMR8_CC1_ADC12 ((uint32_t)0x01006000) /*!< For ADC1 and ADC2 */
+
+#define ADC_ExternalTrigInjec_TMR1_TRGO ((uint32_t)0x00000000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrigInjec_TMR1_CC4 ((uint32_t)0x00001000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrigInjec_None ((uint32_t)0x00007000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrigInjec_TMR15_CC1 ((uint32_t)0x01000000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrigInjec_TMR15_CC2 ((uint32_t)0x01001000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrigInjec_TMR15_CC3 ((uint32_t)0x01002000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrigInjec_TMR15_CC4 ((uint32_t)0x01003000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrigInjec_TMR15_TRGO ((uint32_t)0x01004000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrigInjec_TMR1_CC1 ((uint32_t)0x01005000) /*!< For ADC1, ADC2 and ADC3 */
+#define ADC_ExternalTrigInjec_TMR8_TRGO ((uint32_t)0x01007000) /*!< For ADC1, ADC2 and ADC3 */
+
+#define ADC_ExternalTrigInjec_TMR4_CC3_ADC3 ((uint32_t)0x00002000) /*!< For ADC3 only */
+#define ADC_ExternalTrigInjec_TMR8_CC2_ADC3 ((uint32_t)0x00003000) /*!< For ADC3 only */
+#define ADC_ExternalTrigInjec_TMR8_CC4_ADC3 ((uint32_t)0x00004000) /*!< For ADC3 only */
+#define ADC_ExternalTrigInjec_TMR5_TRGO_ADC3 ((uint32_t)0x00005000) /*!< For ADC3 only */
+#define ADC_ExternalTrigInjec_TMR5_CC4_ADC3 ((uint32_t)0x00006000) /*!< For ADC3 only */
+#define ADC_ExternalTrigInjec_TMR1_CC2_ADC3 ((uint32_t)0x01006000) /*!< For ADC3 only */
+
+#define IS_ADC_EXT_INJEC_TRIG(INJTRIG) (((INJTRIG) == ADC_ExternalTrigInjec_TMR2_TRGO_ADC12) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR2_CC1_ADC12) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR3_CC4_ADC12) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR4_TRGO_ADC12) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_Ext_INT15_TMR8_CC4_ADC12) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR8_CC1_ADC12) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR1_TRGO) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR1_CC4) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_None) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR15_CC1) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR15_CC2) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR15_CC3) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR15_CC4) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR15_TRGO) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR1_CC1) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR8_TRGO) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR4_CC3_ADC3) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR8_CC2_ADC3) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR8_CC4_ADC3) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR5_TRGO_ADC3) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR5_CC4_ADC3) || \
+ ((INJTRIG) == ADC_ExternalTrigInjec_TMR1_CC2_ADC3))
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_injected_channel_selection
+ * @{
+ */
+
+#define ADC_InjectedChannel_1 ((uint8_t)0x14)
+#define ADC_InjectedChannel_2 ((uint8_t)0x18)
+#define ADC_InjectedChannel_3 ((uint8_t)0x1C)
+#define ADC_InjectedChannel_4 ((uint8_t)0x20)
+#define IS_ADC_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) == ADC_InjectedChannel_1) || \
+ ((CHANNEL) == ADC_InjectedChannel_2) || \
+ ((CHANNEL) == ADC_InjectedChannel_3) || \
+ ((CHANNEL) == ADC_InjectedChannel_4))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_analog_watchdog_selection
+ * @{
+ */
+
+#define ADC_AnalogWDG_SingleRegEnable ((uint32_t)0x00800200)
+#define ADC_AnalogWDG_SingleInjecEnable ((uint32_t)0x00400200)
+#define ADC_AnalogWDG_SingleRegOrInjecEnable ((uint32_t)0x00C00200)
+#define ADC_AnalogWDG_AllRegEnable ((uint32_t)0x00800000)
+#define ADC_AnalogWDG_AllInjecEnable ((uint32_t)0x00400000)
+#define ADC_AnalogWDG_AllRegAllInjecEnable ((uint32_t)0x00C00000)
+#define ADC_AnalogWDG_None ((uint32_t)0x00000000)
+
+#define IS_ADC_ANALOG_WDG(WDG) (((WDG) == ADC_AnalogWDG_SingleRegEnable) || \
+ ((WDG) == ADC_AnalogWDG_SingleInjecEnable) || \
+ ((WDG) == ADC_AnalogWDG_SingleRegOrInjecEnable) || \
+ ((WDG) == ADC_AnalogWDG_AllRegEnable) || \
+ ((WDG) == ADC_AnalogWDG_AllInjecEnable) || \
+ ((WDG) == ADC_AnalogWDG_AllRegAllInjecEnable) || \
+ ((WDG) == ADC_AnalogWDG_None))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_interrupts_definition
+ * @{
+ */
+
+#define ADC_INT_EC ((uint16_t)0x0220)
+#define ADC_INT_AWD ((uint16_t)0x0140)
+#define ADC_INT_JEC ((uint16_t)0x0480)
+
+#define IS_ADC_INT(INT) ((((INT) & (uint16_t)0xF81F) == 0x00) && ((INT) != 0x00))
+
+#define IS_ADC_GET_INT(INT) (((INT) == ADC_INT_EC) || ((INT) == ADC_INT_AWD) || \
+ ((INT) == ADC_INT_JEC))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_flags_definition
+ * @{
+ */
+
+#define ADC_FLAG_AWD ((uint8_t)0x01)
+#define ADC_FLAG_EC ((uint8_t)0x02)
+#define ADC_FLAG_JEC ((uint8_t)0x04)
+#define ADC_FLAG_JSTR ((uint8_t)0x08)
+#define ADC_FLAG_RSTR ((uint8_t)0x10)
+#define IS_ADC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint8_t)0xE0) == 0x00) && ((FLAG) != 0x00))
+#define IS_ADC_GET_FLAG(FLAG) (((FLAG) == ADC_FLAG_AWD) || ((FLAG) == ADC_FLAG_EC) || \
+ ((FLAG) == ADC_FLAG_JEC) || ((FLAG)== ADC_FLAG_JSTR) || \
+ ((FLAG) == ADC_FLAG_RSTR))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_thresholds
+ * @{
+ */
+
+#define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= 0xFFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_injected_offset
+ * @{
+ */
+
+#define IS_ADC_OFFSET(OFFSET) ((OFFSET) <= 0xFFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_injected_length
+ * @{
+ */
+
+#define IS_ADC_INJECTED_LENGTH(LENGTH) (((LENGTH) >= 0x1) && ((LENGTH) <= 0x4))
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_injected_rank
+ * @{
+ */
+
+#define IS_ADC_INJECTED_RANK(RANK) (((RANK) >= 0x1) && ((RANK) <= 0x4))
+
+/**
+ * @}
+ */
+
+
+/** @defgroup ADC_regular_length
+ * @{
+ */
+
+#define IS_ADC_REGULAR_LENGTH(LENGTH) (((LENGTH) >= 0x1) && ((LENGTH) <= 0x10))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_regular_rank
+ * @{
+ */
+
+#define IS_ADC_REGULAR_RANK(RANK) (((RANK) >= 0x1) && ((RANK) <= 0x10))
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_regular_discontinuous_mode_number
+ * @{
+ */
+
+#define IS_ADC_REGULAR_DISC_NUMBER(NUMBER) (((NUMBER) >= 0x1) && ((NUMBER) <= 0x8))
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_Exported_Functions
+ * @{
+ */
+
+void ADC_Reset(ADC_Type* ADCx);
+void ADC_Init(ADC_Type* ADCx, ADC_InitType* ADC_InitStruct);
+void ADC_StructInit(ADC_InitType* ADC_InitStruct);
+void ADC_Ctrl(ADC_Type* ADCx, FunctionalState NewState);
+void ADC_DMACtrl(ADC_Type* ADCx, FunctionalState NewState);
+void ADC_INTConfig(ADC_Type* ADCx, uint16_t ADC_INT, FunctionalState NewState);
+void ADC_RstCalibration(ADC_Type* ADCx);
+FlagStatus ADC_GetResetCalibrationStatus(ADC_Type* ADCx);
+void ADC_StartCalibration(ADC_Type* ADCx);
+FlagStatus ADC_GetCalibrationStatus(ADC_Type* ADCx);
+void ADC_SoftwareStartConvCtrl(ADC_Type* ADCx, FunctionalState NewState);
+FlagStatus ADC_GetSoftwareStartConvStatus(ADC_Type* ADCx);
+void ADC_DiscModeChannelCountConfig(ADC_Type* ADCx, uint8_t Number);
+void ADC_DiscModeCtrl(ADC_Type* ADCx, FunctionalState NewState);
+void ADC_RegularChannelConfig(ADC_Type* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);
+void ADC_ExternalTrigConvCtrl(ADC_Type* ADCx, FunctionalState NewState);
+uint16_t ADC_GetConversionValue(ADC_Type* ADCx);
+uint32_t ADC_GetDualModeConversionValue(void);
+void ADC_AutoInjectedConvCtrl(ADC_Type* ADCx, FunctionalState NewState);
+void ADC_InjectedDiscModeCtrl(ADC_Type* ADCx, FunctionalState NewState);
+void ADC_ExternalTrigInjectedConvConfig(ADC_Type* ADCx, uint32_t ADC_ExternalTrigInjecConv);
+void ADC_ExternalTrigInjectedConvCtrl(ADC_Type* ADCx, FunctionalState NewState);
+void ADC_SoftwareStartInjectedConvCtrl(ADC_Type* ADCx, FunctionalState NewState);
+FlagStatus ADC_GetSoftwareStartInjectedConvCtrlStatus(ADC_Type* ADCx);
+void ADC_InjectedChannelConfig(ADC_Type* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);
+void ADC_InjectedSequencerLengthConfig(ADC_Type* ADCx, uint8_t Length);
+void ADC_SetInjectedOffset(ADC_Type* ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset);
+uint16_t ADC_GetInjectedConversionValue(ADC_Type* ADCx, uint8_t ADC_InjectedChannel);
+void ADC_AnalogWDGCtrl(ADC_Type* ADCx, uint32_t ADC_AnalogWatchdog);
+void ADC_AnalogWDGThresholdsConfig(ADC_Type* ADCx, uint16_t HighThreshold, uint16_t LowThreshold);
+void ADC_AnalogWDGSingleChannelConfig(ADC_Type* ADCx, uint8_t ADC_Channel);
+void ADC_TempSensorVrefintCtrl(FunctionalState NewState);
+FlagStatus ADC_GetFlagStatus(ADC_Type* ADCx, uint8_t ADC_FLAG);
+void ADC_ClearFlag(ADC_Type* ADCx, uint8_t ADC_FLAG);
+ITStatus ADC_GetINTStatus(ADC_Type* ADCx, uint16_t ADC_INT);
+void ADC_ClearINTPendingBit(ADC_Type* ADCx, uint16_t ADC_INT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__AT32F4xx_ADC_H */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_bkp.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_bkp.h
new file mode 100644
index 0000000000000000000000000000000000000000..095beb38397a441a4a1de958ce9b5d189191ea08
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_bkp.h
@@ -0,0 +1,198 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_bkp.h
+ * Description : at32f4xx BKP header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_BKP_H
+#define __AT32F4xx_BKP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup BKP
+ * @{
+ */
+
+/** @defgroup BKP_Exported_Types
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup BKP_Exported_Constants
+ * @{
+ */
+
+/** @defgroup Tamper_Pin_active_level
+ * @{
+ */
+
+#define BKP_TamperPinLv_H ((uint16_t)0x0000)
+#define BKP_TamperPinLv_L ((uint16_t)0x0001)
+
+#define IS_BKP_TAMPER_PIN_LV(LV) (((LV) == BKP_TamperPinLv_H) || \
+ ((LV) == BKP_TamperPinLv_L))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_output_source_to_output_on_the_Tamper_pin
+ * @{
+ */
+
+#define BKP_RTCOutput_None ((uint16_t)0x0000)
+#define BKP_RTCOutput_CalClk ((uint16_t)0x0080)
+#define BKP_RTCOutput_Alarm_Pulse ((uint16_t)0x0100)
+#define BKP_RTCOutput_Second_Pulse ((uint16_t)0x0300)
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+#define BKP_RTCOutput_Alarm_Toggle ((uint16_t)0x0900)
+#define BKP_RTCOutput_Second_Toggle ((uint16_t)0x0B00)
+#endif
+
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_BKP_RTC_OUTPUT_SEL(SEL) (((SEL) == BKP_RTCOutput_None) || \
+ ((SEL) == BKP_RTCOutput_CalClk) || \
+ ((SEL) == BKP_RTCOutput_Alarm_Pulse) || \
+ ((SEL) == BKP_RTCOutput_Second_Pulse) || \
+ ((SEL) == BKP_RTCOutput_Alarm_Toggle) || \
+ ((SEL) == BKP_RTCOutput_Second_Toggle))
+#elif defined (AT32F403xx) || defined (AT32F413xx)
+#define IS_BKP_RTC_OUTPUT_SEL(SEL) (((SEL) == BKP_RTCOutput_None) || \
+ ((SEL) == BKP_RTCOutput_CalClk) || \
+ ((SEL) == BKP_RTCOutput_Alarm_Pulse) || \
+ ((SEL) == BKP_RTCOutput_Second_Pulse))
+#endif
+/**
+ * @}
+ */
+
+/** @defgroup Data_Backup_Register
+ * @{
+ */
+
+#define BKP_DT1 ((uint16_t)0x0004)
+#define BKP_DT2 ((uint16_t)0x0008)
+#define BKP_DT3 ((uint16_t)0x000C)
+#define BKP_DT4 ((uint16_t)0x0010)
+#define BKP_DT5 ((uint16_t)0x0014)
+#define BKP_DT6 ((uint16_t)0x0018)
+#define BKP_DT7 ((uint16_t)0x001C)
+#define BKP_DT8 ((uint16_t)0x0020)
+#define BKP_DT9 ((uint16_t)0x0024)
+#define BKP_DT10 ((uint16_t)0x0028)
+#define BKP_DT11 ((uint16_t)0x0040)
+#define BKP_DT12 ((uint16_t)0x0044)
+#define BKP_DT13 ((uint16_t)0x0048)
+#define BKP_DT14 ((uint16_t)0x004C)
+#define BKP_DT15 ((uint16_t)0x0050)
+#define BKP_DT16 ((uint16_t)0x0054)
+#define BKP_DT17 ((uint16_t)0x0058)
+#define BKP_DT18 ((uint16_t)0x005C)
+#define BKP_DT19 ((uint16_t)0x0060)
+#define BKP_DT20 ((uint16_t)0x0064)
+#define BKP_DT21 ((uint16_t)0x0068)
+#define BKP_DT22 ((uint16_t)0x006C)
+#define BKP_DT23 ((uint16_t)0x0070)
+#define BKP_DT24 ((uint16_t)0x0074)
+#define BKP_DT25 ((uint16_t)0x0078)
+#define BKP_DT26 ((uint16_t)0x007C)
+#define BKP_DT27 ((uint16_t)0x0080)
+#define BKP_DT28 ((uint16_t)0x0084)
+#define BKP_DT29 ((uint16_t)0x0088)
+#define BKP_DT30 ((uint16_t)0x008C)
+#define BKP_DT31 ((uint16_t)0x0090)
+#define BKP_DT32 ((uint16_t)0x0094)
+#define BKP_DT33 ((uint16_t)0x0098)
+#define BKP_DT34 ((uint16_t)0x009C)
+#define BKP_DT35 ((uint16_t)0x00A0)
+#define BKP_DT36 ((uint16_t)0x00A4)
+#define BKP_DT37 ((uint16_t)0x00A8)
+#define BKP_DT38 ((uint16_t)0x00AC)
+#define BKP_DT39 ((uint16_t)0x00B0)
+#define BKP_DT40 ((uint16_t)0x00B4)
+#define BKP_DT41 ((uint16_t)0x00B8)
+#define BKP_DT42 ((uint16_t)0x00BC)
+
+#define IS_BKP_DT(DT) (((DT) == BKP_DT1) || ((DT) == BKP_DT2) || ((DT) == BKP_DT3) || \
+ ((DT) == BKP_DT4) || ((DT) == BKP_DT5) || ((DT) == BKP_DT6) || \
+ ((DT) == BKP_DT7) || ((DT) == BKP_DT8) || ((DT) == BKP_DT9) || \
+ ((DT) == BKP_DT10) || ((DT) == BKP_DT11) || ((DT) == BKP_DT12) || \
+ ((DT) == BKP_DT13) || ((DT) == BKP_DT14) || ((DT) == BKP_DT15) || \
+ ((DT) == BKP_DT16) || ((DT) == BKP_DT17) || ((DT) == BKP_DT18) || \
+ ((DT) == BKP_DT19) || ((DT) == BKP_DT20) || ((DT) == BKP_DT21) || \
+ ((DT) == BKP_DT22) || ((DT) == BKP_DT23) || ((DT) == BKP_DT24) || \
+ ((DT) == BKP_DT25) || ((DT) == BKP_DT26) || ((DT) == BKP_DT27) || \
+ ((DT) == BKP_DT28) || ((DT) == BKP_DT29) || ((DT) == BKP_DT30) || \
+ ((DT) == BKP_DT31) || ((DT) == BKP_DT32) || ((DT) == BKP_DT33) || \
+ ((DT) == BKP_DT34) || ((DT) == BKP_DT35) || ((DT) == BKP_DT36) || \
+ ((DT) == BKP_DT37) || ((DT) == BKP_DT38) || ((DT) == BKP_DT39) || \
+ ((DT) == BKP_DT40) || ((DT) == BKP_DT41) || ((DT) == BKP_DT42))
+
+#define IS_BKP_CAL_VAL(VAL) ((VAL) <= 0x7F)
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup BKP_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup BKP_Exported_Functions
+ * @{
+ */
+
+void BKP_Reset(void);
+void BKP_TamperPinLvConfig(uint16_t BKP_TamperPinLevel);
+void BKP_TamperPinCmd(FunctionalState NewState);
+void BKP_IntConfig(FunctionalState NewState);
+void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource);
+void BKP_SetRTCCalValue(uint8_t CalibrationValue);
+void BKP_WriteBackupReg(uint16_t BKP_DR, uint16_t Data);
+uint16_t BKP_ReadBackupReg(uint16_t BKP_DR);
+FlagStatus BKP_GetFlagStatus(void);
+void BKP_ClearFlag(void);
+ITStatus BKP_GetIntStatus(void);
+void BKP_ClearIntPendingBit(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_BKP_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_can.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_can.h
new file mode 100644
index 0000000000000000000000000000000000000000..8fbb1d60704084050408e51a66a51a391202c7f1
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_can.h
@@ -0,0 +1,689 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_can.h
+ * Description : at32f4xx CAN header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_CAN_H
+#define __AT32F4xx_CAN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup CAN
+ * @{
+ */
+
+/** @defgroup CAN_Exported_Types
+ * @{
+ */
+
+#if defined (AT32F403xx) || defined (AT32F415xx)
+#define IS_CAN_ALL_PERIPH(PERIPH) ((PERIPH) == CAN1)
+#elif defined (AT32F413xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+#if !defined (AT32FEBKCx_MD)
+#define IS_CAN_ALL_PERIPH(PERIPH) (((PERIPH) == CAN1) || ((PERIPH) == CAN2))
+#else
+#define IS_CAN_ALL_PERIPH(PERIPH) (((PERIPH) == CAN1))
+#endif
+#endif
+
+/**
+ * @brief CAN init structure definition
+ */
+
+typedef struct
+{
+ uint16_t CAN_Prescaler; /*!< Specifies the length of a time quantum.
+ It ranges from 1 to 1024. */
+
+ uint8_t CAN_Mode; /*!< Specifies the CAN operating mode.
+ This parameter can be a value of
+ @ref CAN_operating_mode */
+
+ uint8_t CAN_SJW; /*!< Specifies the maximum number of time quanta
+ the CAN hardware is allowed to lengthen or
+ shorten a bit to perform resynchronization.
+ This parameter can be a value of
+ @ref CAN_synchronisation_jump_width */
+
+ uint8_t CAN_BS1; /*!< Specifies the number of time quanta in Bit
+ Segment 1. This parameter can be a value of
+ @ref CAN_time_quantum_in_bit_segment_1 */
+
+ uint8_t CAN_BS2; /*!< Specifies the number of time quanta in Bit
+ Segment 2.
+ This parameter can be a value of
+ @ref CAN_time_quantum_in_bit_segment_2 */
+
+ FunctionalState CAN_TTC; /*!< Enable or disable the time triggered
+ communication mode. This parameter can be set
+ either to ENABLE or DISABLE. */
+
+ FunctionalState CAN_ABO; /*!< Enable or disable the automatic bus-off
+ management. This parameter can be set either
+ to ENABLE or DISABLE. */
+
+ FunctionalState CAN_AWU; /*!< Enable or disable the automatic wake-up mode.
+ This parameter can be set either to ENABLE or
+ DISABLE. */
+
+ FunctionalState CAN_NART; /*!< Enable or disable the no-automatic
+ retransmission mode. This parameter can be
+ set either to ENABLE or DISABLE. */
+
+ FunctionalState CAN_RFL; /*!< Enable or disable the Receive FIFO Locked mode.
+ This parameter can be set either to ENABLE
+ or DISABLE. */
+
+ FunctionalState CAN_TFP; /*!< Enable or disable the transmit FIFO priority.
+ This parameter can be set either to ENABLE
+ or DISABLE. */
+} CAN_InitType;
+
+/**
+ * @brief CAN filter init structure definition
+ */
+
+typedef struct
+{
+ uint16_t CAN_FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit
+ configuration, first one for a 16-bit configuration).
+ This parameter can be a value between 0x0000 and 0xFFFF */
+
+ uint16_t CAN_FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit
+ configuration, second one for a 16-bit configuration).
+ This parameter can be a value between 0x0000 and 0xFFFF */
+
+ uint16_t CAN_FilterMskIdHigh; /*!< Specifies the filter mask number or identification number,
+ according to the mode (MSBs for a 32-bit configuration,
+ first one for a 16-bit configuration).
+ This parameter can be a value between 0x0000 and 0xFFFF */
+
+ uint16_t CAN_FilterMskIdLow; /*!< Specifies the filter mask number or identification number,
+ according to the mode (LSBs for a 32-bit configuration,
+ second one for a 16-bit configuration).
+ This parameter can be a value between 0x0000 and 0xFFFF */
+
+ uint16_t CAN_FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter.
+ This parameter can be a value of @ref CAN_filter_FIFO */
+
+ uint8_t CAN_FilterNumber; /*!< Specifies the filter which will be initialized. It ranges from 0 to 13. */
+
+ uint8_t CAN_FilterMode; /*!< Specifies the filter mode to be initialized.
+ This parameter can be a value of @ref CAN_filter_mode */
+
+ uint8_t CAN_FilterScale; /*!< Specifies the filter scale.
+ This parameter can be a value of @ref CAN_filter_scale */
+
+ FunctionalState CAN_FilterActivation; /*!< Enable or disable the filter.
+ This parameter can be set either to ENABLE or DISABLE. */
+} CAN_FilterInitType;
+
+/**
+ * @brief CAN Tx message structure definition
+ */
+
+typedef struct
+{
+ uint32_t StdId; /*!< Specifies the standard identifier.
+ This parameter can be a value between 0 to 0x7FF. */
+
+ uint32_t ExtId; /*!< Specifies the extended identifier.
+ This parameter can be a value between 0 to 0x1FFFFFFF. */
+
+ uint8_t IDT; /*!< Specifies the type of identifier for the message that
+ will be transmitted. This parameter can be a value
+ of @ref CAN_identifier_type */
+
+ uint8_t RTR; /*!< Specifies the type of frame for the message that will
+ be transmitted. This parameter can be a value of
+ @ref CAN_remote_transmission_request */
+
+ uint8_t DLC; /*!< Specifies the length of the frame that will be
+ transmitted. This parameter can be a value between
+ 0 to 8 */
+
+ uint8_t Data[8]; /*!< Contains the data to be transmitted. It ranges from 0
+ to 0xFF. */
+} CanTxMsg;
+
+/**
+ * @brief CAN Rx message structure definition
+ */
+
+typedef struct
+{
+ uint32_t StdId; /*!< Specifies the standard identifier.
+ This parameter can be a value between 0 to 0x7FF. */
+
+ uint32_t ExtId; /*!< Specifies the extended identifier.
+ This parameter can be a value between 0 to 0x1FFFFFFF. */
+
+ uint8_t IDT; /*!< Specifies the type of identifier for the message that
+ will be received. This parameter can be a value of
+ @ref CAN_identifier_type */
+
+ uint8_t RTR; /*!< Specifies the type of frame for the received message.
+ This parameter can be a value of
+ @ref CAN_remote_transmission_request */
+
+ uint8_t DLC; /*!< Specifies the length of the frame that will be received.
+ This parameter can be a value between 0 to 8 */
+
+ uint8_t Data[8]; /*!< Contains the data to be received. It ranges from 0 to
+ 0xFF. */
+
+ uint8_t FID; /*!< Specifies the index of the filter the message stored in
+ the mailbox passes through. This parameter can be a
+ value between 0 to 0xFF */
+} CanRxMsg;
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Exported_Constants
+ * @{
+ */
+
+/** @defgroup CAN_sleep_constants
+ * @{
+ */
+
+#define CAN_InitStatus_Failed ((uint8_t)0x00) /*!< CAN initialization failed */
+#define CAN_InitStatus_Success ((uint8_t)0x01) /*!< CAN initialization OK */
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Mode
+ * @{
+ */
+
+#define CAN_Mode_Normal ((uint8_t)0x00) /*!< normal mode */
+#define CAN_Mode_LoopBack ((uint8_t)0x01) /*!< loopback mode */
+#define CAN_Mode_Silent ((uint8_t)0x02) /*!< silent mode */
+#define CAN_Mode_Silent_LoopBack ((uint8_t)0x03) /*!< loopback combined with silent mode */
+
+#define IS_CAN_MODE(MODE) (((MODE) == CAN_Mode_Normal) || \
+ ((MODE) == CAN_Mode_LoopBack)|| \
+ ((MODE) == CAN_Mode_Silent) || \
+ ((MODE) == CAN_Mode_Silent_LoopBack))
+/**
+ * @}
+ */
+
+
+/**
+ * @defgroup CAN_Operating_Mode
+ * @{
+ */
+#define CAN_OperatingMode_Initialization ((uint8_t)0x00) /*!< Initialization mode */
+#define CAN_OperatingMode_Normal ((uint8_t)0x01) /*!< Normal mode */
+#define CAN_OperatingMode_Sleep ((uint8_t)0x02) /*!< sleep mode */
+
+
+#define IS_CAN_OPERATING_MODE(MODE) (((MODE) == CAN_OperatingMode_Initialization) ||\
+ ((MODE) == CAN_OperatingMode_Normal)|| \
+ ((MODE) == CAN_OperatingMode_Sleep))
+/**
+ * @}
+ */
+
+/**
+ * @defgroup CAN_Mode_Status
+ * @{
+ */
+
+#define CAN_ModeStatus_Failed ((uint8_t)0x00) /*!< CAN entering the specific mode failed */
+#define CAN_ModeStatus_Success ((uint8_t)!CAN_ModeStatus_Failed) /*!< CAN entering the specific mode Succeed */
+
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_synchronisation_jump_width
+ * @{
+ */
+
+#define CAN_SJW_1tq ((uint8_t)0x00) /*!< 1 time quantum */
+#define CAN_SJW_2tq ((uint8_t)0x01) /*!< 2 time quantum */
+#define CAN_SJW_3tq ((uint8_t)0x02) /*!< 3 time quantum */
+#define CAN_SJW_4tq ((uint8_t)0x03) /*!< 4 time quantum */
+
+#define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1tq) || ((SJW) == CAN_SJW_2tq)|| \
+ ((SJW) == CAN_SJW_3tq) || ((SJW) == CAN_SJW_4tq))
+/**
+ * @}
+ */
+
+/** @defgroup CAN_time_quantum_in_bit_segment_1
+ * @{
+ */
+
+#define CAN_BS1_1tq ((uint8_t)0x00) /*!< 1 time quantum */
+#define CAN_BS1_2tq ((uint8_t)0x01) /*!< 2 time quantum */
+#define CAN_BS1_3tq ((uint8_t)0x02) /*!< 3 time quantum */
+#define CAN_BS1_4tq ((uint8_t)0x03) /*!< 4 time quantum */
+#define CAN_BS1_5tq ((uint8_t)0x04) /*!< 5 time quantum */
+#define CAN_BS1_6tq ((uint8_t)0x05) /*!< 6 time quantum */
+#define CAN_BS1_7tq ((uint8_t)0x06) /*!< 7 time quantum */
+#define CAN_BS1_8tq ((uint8_t)0x07) /*!< 8 time quantum */
+#define CAN_BS1_9tq ((uint8_t)0x08) /*!< 9 time quantum */
+#define CAN_BS1_10tq ((uint8_t)0x09) /*!< 10 time quantum */
+#define CAN_BS1_11tq ((uint8_t)0x0A) /*!< 11 time quantum */
+#define CAN_BS1_12tq ((uint8_t)0x0B) /*!< 12 time quantum */
+#define CAN_BS1_13tq ((uint8_t)0x0C) /*!< 13 time quantum */
+#define CAN_BS1_14tq ((uint8_t)0x0D) /*!< 14 time quantum */
+#define CAN_BS1_15tq ((uint8_t)0x0E) /*!< 15 time quantum */
+#define CAN_BS1_16tq ((uint8_t)0x0F) /*!< 16 time quantum */
+
+#define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16tq)
+/**
+ * @}
+ */
+
+/** @defgroup CAN_time_quantum_in_bit_segment_2
+ * @{
+ */
+
+#define CAN_BS2_1tq ((uint8_t)0x00) /*!< 1 time quantum */
+#define CAN_BS2_2tq ((uint8_t)0x01) /*!< 2 time quantum */
+#define CAN_BS2_3tq ((uint8_t)0x02) /*!< 3 time quantum */
+#define CAN_BS2_4tq ((uint8_t)0x03) /*!< 4 time quantum */
+#define CAN_BS2_5tq ((uint8_t)0x04) /*!< 5 time quantum */
+#define CAN_BS2_6tq ((uint8_t)0x05) /*!< 6 time quantum */
+#define CAN_BS2_7tq ((uint8_t)0x06) /*!< 7 time quantum */
+#define CAN_BS2_8tq ((uint8_t)0x07) /*!< 8 time quantum */
+
+#define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8tq)
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_clock_prescaler
+ * @{
+ */
+
+#define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 1024))
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_filter_number
+ * @{
+ */
+#define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 13)
+/**
+ * @}
+ */
+
+/** @defgroup CAN_filter_mode
+ * @{
+ */
+
+#define CAN_FilterMode_IdMask ((uint8_t)0x00) /*!< identifier/mask mode */
+#define CAN_FilterMode_IdList ((uint8_t)0x01) /*!< identifier list mode */
+
+#define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FilterMode_IdMask) || \
+ ((MODE) == CAN_FilterMode_IdList))
+/**
+ * @}
+ */
+
+/** @defgroup CAN_filter_scale
+ * @{
+ */
+
+#define CAN_FilterScale_16bit ((uint8_t)0x00) /*!< Two 16-bit filters */
+#define CAN_FilterScale_32bit ((uint8_t)0x01) /*!< One 32-bit filter */
+
+#define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FilterScale_16bit) || \
+ ((SCALE) == CAN_FilterScale_32bit))
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_filter_FIFO
+ * @{
+ */
+
+#define CAN_Filter_FIFO0 ((uint8_t)0x00) /*!< Filter FIFO 0 assignment for filter x */
+#define CAN_Filter_FIFO1 ((uint8_t)0x01) /*!< Filter FIFO 1 assignment for filter x */
+#define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FilterFIFO0) || \
+ ((FIFO) == CAN_FilterFIFO1))
+/**
+ * @}
+ */
+
+/** @defgroup Start_bank_filter_for_slave_CAN
+ * @{
+ */
+#define IS_CAN_BANKNUMBER(BANKNUMBER) (((BANKNUMBER) >= 1) && ((BANKNUMBER) <= 27))
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Tx
+ * @{
+ */
+
+#define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02))
+#define IS_CAN_STDID(STDID) ((STDID) <= ((uint32_t)0x7FF))
+#define IS_CAN_EXTID(EXTID) ((EXTID) <= ((uint32_t)0x1FFFFFFF))
+#define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08))
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_identifier_type
+ * @{
+ */
+
+#define CAN_Id_Standard ((uint32_t)0x00000000) /*!< Standard Id */
+#define CAN_Id_Extended ((uint32_t)0x00000004) /*!< Extended Id */
+#define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_Id_Standard) || \
+ ((IDTYPE) == CAN_Id_Extended))
+/**
+ * @}
+ */
+
+/** @defgroup CAN_remote_transmission_request
+ * @{
+ */
+
+#define CAN_RTR_Data ((uint32_t)0x00000000) /*!< Data frame */
+#define CAN_RTR_Remote ((uint32_t)0x00000002) /*!< Remote frame */
+#define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_Data) || ((RTR) == CAN_RTR_Remote))
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_transmit_constants
+ * @{
+ */
+
+#define CAN_TxStatus_Failed ((uint8_t)0x00)/*!< CAN transmission failed */
+#define CAN_TxStatus_Ok ((uint8_t)0x01) /*!< CAN transmission succeeded */
+#define CAN_TxStatus_Pending ((uint8_t)0x02) /*!< CAN transmission pending */
+#define CAN_TxStatus_NoMailBox ((uint8_t)0x04) /*!< CAN cell did not provide an empty mailbox */
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_receive_FIFO_number_constants
+ * @{
+ */
+
+#define CAN_FIFO0 ((uint8_t)0x00) /*!< CAN FIFO 0 used to receive */
+#define CAN_FIFO1 ((uint8_t)0x01) /*!< CAN FIFO 1 used to receive */
+
+#define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1))
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_sleep_constants
+ * @{
+ */
+
+#define CAN_Sleep_Failed ((uint8_t)0x00) /*!< CAN did not enter the sleep mode */
+#define CAN_Sleep_Ok ((uint8_t)0x01) /*!< CAN entered the sleep mode */
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_wake_up_constants
+ * @{
+ */
+
+#define CAN_WakeUp_Failed ((uint8_t)0x00) /*!< CAN did not leave the sleep mode */
+#define CAN_WakeUp_Ok ((uint8_t)0x01) /*!< CAN leaved the sleep mode */
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup CAN_Error_Code_constants
+ * @{
+ */
+
+#define CAN_ErrorCode_NoErr ((uint8_t)0x00) /*!< No Error */
+#define CAN_ErrorCode_StuffErr ((uint8_t)0x10) /*!< Stuff Error */
+#define CAN_ErrorCode_FormErr ((uint8_t)0x20) /*!< Form Error */
+#define CAN_ErrorCode_ACKErr ((uint8_t)0x30) /*!< Acknowledgment Error */
+#define CAN_ErrorCode_BitRecessiveErr ((uint8_t)0x40) /*!< Bit Recessive Error */
+#define CAN_ErrorCode_BitDominantErr ((uint8_t)0x50) /*!< Bit Dominant Error */
+#define CAN_ErrorCode_CRCErr ((uint8_t)0x60) /*!< CRC Error */
+#define CAN_ErrorCode_SoftwareSetErr ((uint8_t)0x70) /*!< Software Set Error */
+
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_flags
+ * @{
+ */
+/* If the flag is 0x3XXXXXXX, it means that it can be used with CAN_GetFlagStatus()
+ and CAN_ClearFlag() functions. */
+/* If the flag is 0x1XXXXXXX, it means that it can only be used with CAN_GetFlagStatus() function. */
+
+/* Transmit Flags */
+#define CAN_FLAG_RQCP0 ((uint32_t)0x38000001) /*!< Request MailBox0 Flag */
+#define CAN_FLAG_RQCP1 ((uint32_t)0x38000100) /*!< Request MailBox1 Flag */
+#define CAN_FLAG_RQCP2 ((uint32_t)0x38010000) /*!< Request MailBox2 Flag */
+
+/* Receive Flags */
+#define CAN_FLAG_RFP0 ((uint32_t)0x12000003) /*!< FIFO 0 Message Pending Flag */
+#define CAN_FLAG_RFFU0 ((uint32_t)0x32000008) /*!< FIFO 0 Full Flag */
+#define CAN_FLAG_RFOV0 ((uint32_t)0x32000010) /*!< FIFO 0 Overrun Flag */
+#define CAN_FLAG_RFP1 ((uint32_t)0x14000003) /*!< FIFO 1 Message Pending Flag */
+#define CAN_FLAG_RFFU1 ((uint32_t)0x34000008) /*!< FIFO 1 Full Flag */
+#define CAN_FLAG_RFOV1 ((uint32_t)0x34000010) /*!< FIFO 1 Overrun Flag */
+
+/* Operating Mode Flags */
+#define CAN_FLAG_WK ((uint32_t)0x31000008) /*!< Wake up Flag */
+#define CAN_FLAG_SAK ((uint32_t)0x31000012) /*!< Sleep acknowledge Flag */
+/* Note: When SLAK intterupt is disabled (SLKIE=0), no polling on SLAKI is possible.
+ In this case the SLAK bit can be polled.*/
+
+/* Error Flags */
+#define CAN_FLAG_ERG ((uint32_t)0x10F00001) /*!< Error Warning Flag */
+#define CAN_FLAG_ERP ((uint32_t)0x10F00002) /*!< Error Passive Flag */
+#define CAN_FLAG_BU ((uint32_t)0x10F00004) /*!< Bus-Off Flag */
+#define CAN_FLAG_ERC ((uint32_t)0x30F00070) /*!< Last error code Flag */
+
+#define IS_CAN_GET_FLAG(FLAG) (((FLAG) == CAN_FLAG_ERC) || ((FLAG) == CAN_FLAG_BU) || \
+ ((FLAG) == CAN_FLAG_ERP) || ((FLAG) == CAN_FLAG_ERG) || \
+ ((FLAG) == CAN_FLAG_WK) || ((FLAG) == CAN_FLAG_RFOV0) || \
+ ((FLAG) == CAN_FLAG_RFFU0) || ((FLAG) == CAN_FLAG_RFP0) || \
+ ((FLAG) == CAN_FLAG_RFOV1) || ((FLAG) == CAN_FLAG_RFFU1) || \
+ ((FLAG) == CAN_FLAG_RFP1) || ((FLAG) == CAN_FLAG_RQCP2) || \
+ ((FLAG) == CAN_FLAG_RQCP1) || ((FLAG) == CAN_FLAG_RQCP0) || \
+ ((FLAG) == CAN_FLAG_SAK ))
+
+#define IS_CAN_CLEAR_FLAG(FLAG) (((FLAG) == CAN_FLAG_ERC) || ((FLAG) == CAN_FLAG_RQCP2) || \
+ ((FLAG) == CAN_FLAG_RQCP1) || ((FLAG) == CAN_FLAG_RQCP0) || \
+ ((FLAG) == CAN_FLAG_RFFU0) || ((FLAG) == CAN_FLAG_RFOV0) ||\
+ ((FLAG) == CAN_FLAG_RFFU1) || ((FLAG) == CAN_FLAG_RFOV1) || \
+ ((FLAG) == CAN_FLAG_WK) || ((FLAG) == CAN_FLAG_SAK))
+/**
+ * @}
+ */
+
+
+/** @defgroup CAN_interrupts
+ * @{
+ */
+
+
+
+#define CAN_INT_TSME ((uint32_t)0x00000001) /*!< Transmit mailbox empty Interrupt*/
+
+/* Receive Interrupts */
+#define CAN_INT_RFP0 ((uint32_t)0x00000002) /*!< FIFO 0 message pending Interrupt*/
+#define CAN_INT_RFFU0 ((uint32_t)0x00000004) /*!< FIFO 0 full Interrupt*/
+#define CAN_INT_RFOV0 ((uint32_t)0x00000008) /*!< FIFO 0 overrun Interrupt*/
+#define CAN_INT_RFP1 ((uint32_t)0x00000010) /*!< FIFO 1 message pending Interrupt*/
+#define CAN_INT_RFFU1 ((uint32_t)0x00000020) /*!< FIFO 1 full Interrupt*/
+#define CAN_INT_RFOV1 ((uint32_t)0x00000040) /*!< FIFO 1 overrun Interrupt*/
+
+/* Operating Mode Interrupts */
+#define CAN_INT_WK ((uint32_t)0x00010000) /*!< Wake-up Interrupt*/
+#define CAN_INT_SAK ((uint32_t)0x00020000) /*!< Sleep acknowledge Interrupt*/
+
+/* Error Interrupts */
+#define CAN_INT_ERG ((uint32_t)0x00000100) /*!< Error warning Interrupt*/
+#define CAN_INT_ERP ((uint32_t)0x00000200) /*!< Error passive Interrupt*/
+#define CAN_INT_BU ((uint32_t)0x00000400) /*!< Bus-off Interrupt*/
+#define CAN_INT_LEC ((uint32_t)0x00000800) /*!< Last error code Interrupt*/
+#define CAN_INT_ERR ((uint32_t)0x00008000) /*!< Error Interrupt*/
+
+/* Flags named as Interrupts : kept only for FW compatibility */
+#define CAN_INT_RQCP0 CAN_INT_TSME
+#define CAN_INT_RQCP1 CAN_INT_TSME
+#define CAN_INT_RQCP2 CAN_INT_TSME
+
+
+#define IS_CAN_INT(INT) (((INT) == CAN_INT_TSME) || ((INT) == CAN_INT_RFP0) ||\
+ ((INT) == CAN_INT_RFFU0) || ((INT) == CAN_INT_RFOV0) ||\
+ ((INT) == CAN_INT_RFP1) || ((INT) == CAN_INT_RFFU1) ||\
+ ((INT) == CAN_INT_RFOV1) || ((INT) == CAN_INT_ERG) ||\
+ ((INT) == CAN_INT_ERP) || ((INT) == CAN_INT_BU) ||\
+ ((INT) == CAN_INT_LEC) || ((INT) == CAN_INT_ERR) ||\
+ ((INT) == CAN_INT_WK) || ((INT) == CAN_INT_SAK))
+
+#define IS_CAN_CLEAR_INT(INT) (((INT) == CAN_INT_TSME) || ((INT) == CAN_INT_RFFU0) ||\
+ ((INT) == CAN_INT_RFOV0) || ((INT) == CAN_INT_RFFU1) ||\
+ ((INT) == CAN_INT_RFOV1) || ((INT) == CAN_INT_ERG) ||\
+ ((INT) == CAN_INT_ERP) || ((INT) == CAN_INT_BU) ||\
+ ((INT) == CAN_INT_LEC) || ((INT) == CAN_INT_ERR) ||\
+ ((INT) == CAN_INT_WK) || ((INT) == CAN_INT_SAK))
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Legacy
+ * @{
+ */
+#define CANINITFAILED CAN_InitStatus_Failed
+#define CANINITOK CAN_InitStatus_Success
+#define CAN_FilterFIFO0 CAN_Filter_FIFO0
+#define CAN_FilterFIFO1 CAN_Filter_FIFO1
+#define CAN_ID_STD CAN_Id_Standard
+#define CAN_ID_EXT CAN_Id_Extended
+#define CAN_RTR_DATA CAN_RTR_Data
+#define CAN_RTR_REMOTE CAN_RTR_Remote
+#define CANTXFAILE CAN_TxStatus_Failed
+#define CANTXOK CAN_TxStatus_Ok
+#define CANTXPENDING CAN_TxStatus_Pending
+#define CAN_NO_MB CAN_TxStatus_NoMailBox
+#define CANSLEEPFAILED CAN_Sleep_Failed
+#define CANSLEEPOK CAN_Sleep_Ok
+#define CANWAKEUPFAILED CAN_WakeUp_Failed
+#define CANWAKEUPOK CAN_WakeUp_Ok
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Exported_Functions
+ * @{
+ */
+/* Function used to set the CAN configuration to the default reset state *****/
+void CAN_Reset(CAN_Type* CANx);
+
+/* Initialization and Configuration functions *********************************/
+uint8_t CAN_Init(CAN_Type* CANx, CAN_InitType* CAN_InitStruct);
+void CAN_FilterInit(CAN_Type* CANx, CAN_FilterInitType* CAN_FilterInitStruct);
+void CAN_StructInit(CAN_InitType* CAN_InitStruct);
+void CAN_SlaveStartBank(uint8_t CAN_BankNumber);
+void CAN_DBGFreeze(CAN_Type* CANx, FunctionalState NewState);
+void CAN_TTComModeCtrl(CAN_Type* CANx, FunctionalState NewState);
+
+/* Transmit functions *********************************************************/
+uint8_t CAN_Transmit(CAN_Type* CANx, CanTxMsg* TxMessage);
+uint8_t CAN_TransmitStatus(CAN_Type* CANx, uint8_t TransmitMailbox);
+void CAN_CancelTransmit(CAN_Type* CANx, uint8_t Mailbox);
+
+/* Receive functions **********************************************************/
+void CAN_Receive(CAN_Type* CANx, uint8_t FIFONumber, CanRxMsg* RxMessage);
+void CAN_FIFORelease(CAN_Type* CANx, uint8_t FIFONumber);
+uint8_t CAN_MessagePending(CAN_Type* CANx, uint8_t FIFONumber);
+
+
+/* Operation modes functions **************************************************/
+uint8_t CAN_OperatingModeRequest(CAN_Type* CANx, uint8_t CAN_OperatingMode);
+uint8_t CAN_Sleep(CAN_Type* CANx);
+uint8_t CAN_WakeUp(CAN_Type* CANx);
+
+/* Error management functions *************************************************/
+uint8_t CAN_GetLastErrorCode(CAN_Type* CANx);
+uint8_t CAN_GetReceiveErrorCounter(CAN_Type* CANx);
+uint8_t CAN_GetLSBTransmitErrorCounter(CAN_Type* CANx);
+
+/* Interrupts and flags management functions **********************************/
+void CAN_INTConfig(CAN_Type* CANx, uint32_t CAN_INT, FunctionalState NewState);
+FlagStatus CAN_GetFlagStatus(CAN_Type* CANx, uint32_t CAN_FLAG);
+void CAN_ClearFlag(CAN_Type* CANx, uint32_t CAN_FLAG);
+ITStatus CAN_GetINTStatus(CAN_Type* CANx, uint32_t CAN_INT);
+void CAN_ClearINTPendingBit(CAN_Type* CANx, uint32_t CAN_INT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_CAN_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_comp.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_comp.h
new file mode 100644
index 0000000000000000000000000000000000000000..a4c9c723a64c0271e1ea89c32407cff1d89a92e1
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_comp.h
@@ -0,0 +1,271 @@
+/**
+ ******************************************************************************
+ * @file at32f4xx_comp.h
+ * @author Artery
+ * @version V1.0.1
+ * @date 20-April-2012
+ * @brief This file contains all the functions prototypes for the COMP firmware
+ * library.
+ ******************************************************************************
+ * @attention
+ *
+ *
© COPYRIGHT 2012 Artery
+ *
+ * Licensed under Artery Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ *
+ * 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.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4XX_COMP_H
+#define __AT32F4XX_COMP_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup AT32F4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup COMP
+ * @{
+ */
+
+/* Exported types ------------------------------------------------------------*/
+
+/**
+ * @brief COMP Init structure definition
+ */
+
+typedef struct
+{
+
+ uint32_t COMP_INMInput; /*!< Selects the inverting input of the comparator.
+ This parameter can be a value of @ref COMP_INMInput */
+
+ uint32_t COMP_Output; /*!< Selects the output redirection of the comparator.
+ This parameter can be a value of @ref COMP_Output */
+
+ uint32_t COMP_OutPolarity; /*!< Selects the output polarity of the comparator.
+ This parameter can be a value of @ref COMP_OutputPolarity */
+
+ uint32_t COMP_Hysteresis; /*!< Selects the hysteresis voltage of the comparator.
+ This parameter can be a value of @ref COMP_Hysteresis */
+
+ uint32_t COMP_Mode; /*!< Selects the operating mode of the comparator
+ and allows to adjust the speed/consumption.
+ This parameter can be a value of @ref COMP_Mode */
+
+}COMP_InitType;
+
+/* Exported constants --------------------------------------------------------*/
+
+/** @defgroup COMP_Exported_Constants
+ * @{
+ */
+
+/** @defgroup COMP_Selection
+ * @{
+ */
+
+#define COMP1_Selection ((uint32_t)0x00000000) /*!< COMP1 Selection */
+#define COMP2_Selection ((uint32_t)0x00000010) /*!< COMP2 Selection */
+
+#define IS_COMP_ALL_PERIPH(PERIPH) (((PERIPH) == COMP1_Selection) || \
+ ((PERIPH) == COMP2_Selection))
+
+/**
+ * @}
+ */
+
+/** @defgroup COMP_NonInvertingInput
+ * @{
+ */
+
+#define COMP_INPInput_00 ((uint32_t)0x00000000) /*!< PA5/PA7 connected to comparator1/2 non-inverting input */
+#define COMP_INPInput_01 ((uint32_t)0x00000001) /*!< PA1/PA3 connected to comparator1/2 non-inverting input */
+#define COMP_INPInput_10 ((uint32_t)0x00000002) /*!< PA0/PA2 connected to comparator1/2 non-inverting input */
+
+#define IS_COMP_NONINVERTING_INPUT(INPUT) (((INPUT) == COMP_INPInput_00) || \
+ ((INPUT) == COMP_INPInput_01) || \
+ ((INPUT) == COMP_INPInput_10))
+
+/** @defgroup COMP_InvertingInput
+ * @{
+ */
+
+#define COMP_INMInput_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input */
+#define COMP_INMInput_1_2VREFINT ((uint32_t)0x00000010) /*!< 1/2 VREFINT connected to comparator inverting input */
+#define COMP_INMInput_3_4VREFINT ((uint32_t)0x00000020) /*!< 3/4 VREFINT connected to comparator inverting input */
+#define COMP_INMInput_VREFINT ((uint32_t)0x00000030) /*!< VREFINT connected to comparator inverting input */
+#define COMP_INMInput_IN1 ((uint32_t)0x00000040) /*!< I/O (PA4 for COMP1 and PA3 for COMP2) connected to comparator inverting input */
+#define COMP_INMInput_IN2 ((uint32_t)0x00000050) /*!< I/O (PA5 for COMP1 and PA7 for COMP2) connected to comparator inverting input */
+#define COMP_INMInput_IN3 ((uint32_t)0x00000060) /*!< I/O (PA0 for COMP1 and PA2 for COMP2) connected to comparator inverting input */
+
+#define IS_COMP_INVERTING_INPUT(INPUT) (((INPUT) == COMP_INMInput_1_4VREFINT) || \
+ ((INPUT) == COMP_INMInput_1_2VREFINT) || \
+ ((INPUT) == COMP_INMInput_3_4VREFINT) || \
+ ((INPUT) == COMP_INMInput_VREFINT) || \
+ ((INPUT) == COMP_INMInput_IN1) || \
+ ((INPUT) == COMP_INMInput_1_4VREFINT) || \
+ ((INPUT) == COMP_INMInput_IN3))
+/**
+ * @}
+ */
+
+/** @defgroup COMP_Output
+ * @{
+ */
+
+#define COMP_Output_None ((uint32_t)0x00000000) /*!< COMP output isn't connected to other peripherals */
+#define COMP_Output_TMR1BKIN ((uint32_t)0x00000100) /*!< COMP output connected to TIM1 Break Input (BKIN) */
+#define COMP_Output_TMR1IC1 ((uint32_t)0x00000200) /*!< COMP output connected to TIM1 Input Capture 1 */
+#define COMP_Output_TMR1OCREFCLR ((uint32_t)0x00000300) /*!< COMP output connected to TIM1 OCREF Clear */
+#define COMP_Output_TMR2IC4 ((uint32_t)0x00000400) /*!< COMP output connected to TIM2 Input Capture 4 */
+#define COMP_Output_TMR2OCREFCLR ((uint32_t)0x00000500) /*!< COMP output connected to TIM2 OCREF Clear */
+#define COMP_Output_TMR3IC1 ((uint32_t)0x00000600) /*!< COMP output connected to TIM3 Input Capture 1 */
+#define COMP_Output_TMR3OCREFCLR ((uint32_t)0x00000700) /*!< COMP output connected to TIM3 OCREF Clear */
+
+
+#define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_Output_None) || \
+ ((OUTPUT) == COMP_Output_TMR1BKIN) || \
+ ((OUTPUT) == COMP_Output_TMR1IC1) || \
+ ((OUTPUT) == COMP_Output_TMR1OCREFCLR) || \
+ ((OUTPUT) == COMP_Output_TMR2IC4) || \
+ ((OUTPUT) == COMP_Output_TMR2OCREFCLR) || \
+ ((OUTPUT) == COMP_Output_TMR3IC1) || \
+ ((OUTPUT) == COMP_Output_TMR3OCREFCLR))
+/**
+ * @}
+ */
+
+/** @defgroup COMP_OutputPolarity
+ * @{
+ */
+#define COMP_OutPolarity_NonInverted ((uint32_t)0x00000000) /*!< COMP output on GPIO isn't inverted */
+#define COMP_OutPolarity_Inverted COMP_CTRLSTS_COMP1POL /*!< COMP output on GPIO is inverted */
+
+#define IS_COMP_OUTPUT_POL(POL) (((POL) == COMP_OutPolarity_NonInverted) || \
+ ((POL) == COMP_OutPolarity_Inverted))
+
+/**
+ * @}
+ */
+
+/** @defgroup COMP_Hysteresis
+ * @{
+ */
+/* Please refer to the electrical characteristics in the device datasheet for
+ the hysteresis level */
+#define COMP_Hysteresis_No ((uint32_t)0x00000000) /*!< No hysteresis */
+#define COMP_Hysteresis_Low COMP_CTRLSTS_COMP1HYST_0 /*!< Hysteresis level low */
+#define COMP_Hysteresis_Medium COMP_CTRLSTS_COMP1HYST_1 /*!< Hysteresis level medium */
+#define COMP_Hysteresis_High COMP_CTRLSTS_COMP1HYST /*!< Hysteresis level high */
+
+#define IS_COMP_HYSTERESIS(HYSTERESIS) (((HYSTERESIS) == COMP_Hysteresis_No) || \
+ ((HYSTERESIS) == COMP_Hysteresis_Low) || \
+ ((HYSTERESIS) == COMP_Hysteresis_Medium) || \
+ ((HYSTERESIS) == COMP_Hysteresis_High))
+/**
+ * @}
+ */
+
+/** @defgroup COMP_Mode
+ * @{
+ */
+/* Please refer to the electrical characteristics in the device datasheet for
+ the power consumption values */
+#define COMP_Mode_Fast ((uint32_t)0x00000000) /*!< High Speed */
+#define COMP_Mode_Slow COMP_CTRLSTS_COMP1MDE_0 /*!< Low power mode */
+
+#define IS_COMP_MODE(MODE) (((MODE) == COMP_Mode_Slow) || \
+ ((MODE) == COMP_Mode_Fast))
+/**
+ * @}
+ */
+
+/** @defgroup COMP_OutputLevel
+ * @{
+ */
+/* When output polarity is not inverted, comparator output is high when
+ the non-inverting input is at a higher voltage than the inverting input */
+#define COMP_OutputState_High COMP_CTRLSTS_COMP1OUT
+/* When output polarity is not inverted, comparator output is low when
+ the non-inverting input is at a lower voltage than the inverting input*/
+#define COMP_OutputState_Low ((uint32_t)0x00000000)
+
+/**
+ * @}
+ */
+
+/** @defgroup COMP_High_Pulse_Filter
+ * @{
+ */
+
+#define IS_COMP_HighPulseCnt(HighPulse) ((HighPulse) <= 0x3F)
+/**
+ * @}
+ */
+
+/** @defgroup COMP_Low_Pulse_Filter
+ * @{
+ */
+
+#define IS_COMP_LowPulseCnt(LowPulse) ((LowPulse) <= 0x3F)
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/* Exported macro ------------------------------------------------------------*/
+/* Exported functions ------------------------------------------------------- */
+
+/* Function used to set the COMP configuration to the default reset state ****/
+void COMP_Reset(void);
+
+/* Initialization and Configuration functions *********************************/
+void COMP_Init(uint32_t COMP_Selection, COMP_InitType* COMP_InitStruct);
+void COMP_SelectINPInput(uint32_t COMP_Selection, uint32_t COMP_INPInput);
+void COMP_StructInit(COMP_InitType* COMP_InitStruct);
+void COMP_Cmd(uint32_t COMP_Selection, FunctionalState NewState);
+void COMP_SwitchCmd(FunctionalState NewState);
+uint32_t COMP_GetOutputState(uint32_t COMP_Selection);
+
+/* Window mode control function ***********************************************/
+void COMP_WindowCmd(FunctionalState NewState);
+
+/* COMP configuration locking function ****************************************/
+void COMP_LockConfig(uint32_t COMP_Selection);
+
+/* COMP configuration glitch filter ****************************************/
+void COMP_FilterConfig(uint16_t COMP_HighPulseCnt, uint16_t COMP_LowPulseCnt, FunctionalState NewState);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__AT32F4xx_COMP_H */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/************************ (C) COPYRIGHT Artery *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_crc.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_crc.h
new file mode 100644
index 0000000000000000000000000000000000000000..acb84153c1820e4a7cea55c2c3074ba1a7d064a7
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_crc.h
@@ -0,0 +1,82 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_crc.h
+ * Description : at32f4xx CRC header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_CRC_H
+#define __AT32F4xx_CRC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup CRC
+ * @{
+ */
+
+/** @defgroup CRC_Exported_Types
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CRC_Exported_Constants
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CRC_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CRC_Exported_Functions
+ * @{
+ */
+
+void CRC_ResetDT(void);
+uint32_t CRC_CalculateCRC(uint32_t Data);
+uint32_t CRC_CalculateBlkCRC(uint32_t pBuffer[], uint32_t BufferLength);
+uint32_t CRC_GetCRC(void);
+void CRC_SetIDTReg(uint8_t IDValue);
+uint8_t CRC_GetIDTReg(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_CRC_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_dac.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_dac.h
new file mode 100644
index 0000000000000000000000000000000000000000..6cbf09cb3f3050a9b77c7b2da8748843c480b6e0
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_dac.h
@@ -0,0 +1,269 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_dac.h
+ * Description : at32f4xx DAC header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_DAC_H
+#define __AT32F4xx_DAC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup DAC
+ * @{
+ */
+
+/** @defgroup DAC_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief DAC Init structure definition
+ */
+
+typedef struct
+{
+ uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel.
+ This parameter can be a value of @ref DAC_trigger_selection */
+
+ uint32_t DAC_WaveGeneration; /*!< Specifies whether DAC channel noise waves or triangle waves
+ are generated, or whether no wave is generated.
+ This parameter can be a value of @ref DAC_wave_generation */
+
+ uint32_t DAC_LFSRUnmask_TriangleAmplitude; /*!< Specifies the LFSR mask for noise wave generation or
+ the maximum amplitude triangle generation for the DAC channel.
+ This parameter can be a value of @ref DAC_lfsrunmask_triangleamplitude */
+
+ uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled.
+ This parameter can be a value of @ref DAC_output_buffer */
+} DAC_InitType;
+
+/**
+ * @}
+ */
+
+/** @defgroup DAC_Exported_Constants
+ * @{
+ */
+
+/** @defgroup DAC_trigger_selection
+ * @{
+ */
+
+#define DAC_Trigger_None ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
+ has been loaded, and not by external trigger */
+#define DAC_Trigger_TMR6_TRGO ((uint32_t)0x00000004) /*!< TMR6 TRGO selected as external conversion trigger for DAC channel */
+#define DAC_Trigger_TMR8_TRGO ((uint32_t)0x0000000C) /*!< TMR8 TRGO selected as external conversion trigger for DAC channel
+ only in High-density devices*/
+#define DAC_Trigger_TMR7_TRGO ((uint32_t)0x00000014) /*!< TMR7 TRGO selected as external conversion trigger for DAC channel */
+#define DAC_Trigger_TMR5_TRGO ((uint32_t)0x0000001C) /*!< TMR5 TRGO selected as external conversion trigger for DAC channel */
+#define DAC_Trigger_TMR2_TRGO ((uint32_t)0x00000024) /*!< TMR2 TRGO selected as external conversion trigger for DAC channel */
+#define DAC_Trigger_TMR4_TRGO ((uint32_t)0x0000002C) /*!< TMR4 TRGO selected as external conversion trigger for DAC channel */
+#define DAC_Trigger_Ext_INT9 ((uint32_t)0x00000034) /*!< EXTI Line9 event selected as external conversion trigger for DAC channel */
+#define DAC_Trigger_Software ((uint32_t)0x0000003C) /*!< Conversion started by software trigger for DAC channel */
+
+#define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \
+ ((TRIGGER) == DAC_Trigger_TMR6_TRGO) || \
+ ((TRIGGER) == DAC_Trigger_TMR8_TRGO) || \
+ ((TRIGGER) == DAC_Trigger_TMR7_TRGO) || \
+ ((TRIGGER) == DAC_Trigger_TMR5_TRGO) || \
+ ((TRIGGER) == DAC_Trigger_TMR2_TRGO) || \
+ ((TRIGGER) == DAC_Trigger_TMR4_TRGO) || \
+ ((TRIGGER) == DAC_Trigger_Ext_INT9) || \
+ ((TRIGGER) == DAC_Trigger_Software))
+
+/**
+ * @}
+ */
+
+/** @defgroup DAC_wave_generation
+ * @{
+ */
+
+#define DAC_WaveGeneration_None ((uint32_t)0x00000000)
+#define DAC_WaveGeneration_Noise ((uint32_t)0x00000040)
+#define DAC_WaveGeneration_Triangle ((uint32_t)0x00000080)
+#define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \
+ ((WAVE) == DAC_WaveGeneration_Noise) || \
+ ((WAVE) == DAC_WaveGeneration_Triangle))
+/**
+ * @}
+ */
+
+/** @defgroup DAC_lfsrunmask_triangleamplitude
+ * @{
+ */
+
+#define DAC_LFSRUnmsk_Bit0 ((uint32_t)0x00000000) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */
+#define DAC_LFSRUnmsk_Bits1_0 ((uint32_t)0x00000100) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */
+#define DAC_LFSRUnmsk_Bits2_0 ((uint32_t)0x00000200) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */
+#define DAC_LFSRUnmsk_Bits3_0 ((uint32_t)0x00000300) /*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */
+#define DAC_LFSRUnmsk_Bits4_0 ((uint32_t)0x00000400) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */
+#define DAC_LFSRUnmsk_Bits5_0 ((uint32_t)0x00000500) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */
+#define DAC_LFSRUnmsk_Bits6_0 ((uint32_t)0x00000600) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */
+#define DAC_LFSRUnmsk_Bits7_0 ((uint32_t)0x00000700) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */
+#define DAC_LFSRUnmsk_Bits8_0 ((uint32_t)0x00000800) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */
+#define DAC_LFSRUnmsk_Bits9_0 ((uint32_t)0x00000900) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */
+#define DAC_LFSRUnmsk_Bits10_0 ((uint32_t)0x00000A00) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */
+#define DAC_LFSRUnmsk_Bits11_0 ((uint32_t)0x00000B00) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */
+#define DAC_TriangleAmp_1 ((uint32_t)0x00000000) /*!< Select max triangle amplitude of 1 */
+#define DAC_TriangleAmp_3 ((uint32_t)0x00000100) /*!< Select max triangle amplitude of 3 */
+#define DAC_TriangleAmp_7 ((uint32_t)0x00000200) /*!< Select max triangle amplitude of 7 */
+#define DAC_TriangleAmp_15 ((uint32_t)0x00000300) /*!< Select max triangle amplitude of 15 */
+#define DAC_TriangleAmp_31 ((uint32_t)0x00000400) /*!< Select max triangle amplitude of 31 */
+#define DAC_TriangleAmp_63 ((uint32_t)0x00000500) /*!< Select max triangle amplitude of 63 */
+#define DAC_TriangleAmp_127 ((uint32_t)0x00000600) /*!< Select max triangle amplitude of 127 */
+#define DAC_TriangleAmp_255 ((uint32_t)0x00000700) /*!< Select max triangle amplitude of 255 */
+#define DAC_TriangleAmp_511 ((uint32_t)0x00000800) /*!< Select max triangle amplitude of 511 */
+#define DAC_TriangleAmp_1023 ((uint32_t)0x00000900) /*!< Select max triangle amplitude of 1023 */
+#define DAC_TriangleAmp_2047 ((uint32_t)0x00000A00) /*!< Select max triangle amplitude of 2047 */
+#define DAC_TriangleAmp_4095 ((uint32_t)0x00000B00) /*!< Select max triangle amplitude of 4095 */
+
+#define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmsk_Bit0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits1_0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits2_0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits3_0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits4_0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits5_0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits6_0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits7_0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits8_0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits9_0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits10_0) || \
+ ((VALUE) == DAC_LFSRUnmsk_Bits11_0) || \
+ ((VALUE) == DAC_TriangleAmp_1) || \
+ ((VALUE) == DAC_TriangleAmp_3) || \
+ ((VALUE) == DAC_TriangleAmp_7) || \
+ ((VALUE) == DAC_TriangleAmp_15) || \
+ ((VALUE) == DAC_TriangleAmp_31) || \
+ ((VALUE) == DAC_TriangleAmp_63) || \
+ ((VALUE) == DAC_TriangleAmp_127) || \
+ ((VALUE) == DAC_TriangleAmp_255) || \
+ ((VALUE) == DAC_TriangleAmp_511) || \
+ ((VALUE) == DAC_TriangleAmp_1023) || \
+ ((VALUE) == DAC_TriangleAmp_2047) || \
+ ((VALUE) == DAC_TriangleAmp_4095))
+/**
+ * @}
+ */
+
+/** @defgroup DAC_output_buffer
+ * @{
+ */
+
+#define DAC_OutputBuffer_Enable ((uint32_t)0x00000000)
+#define DAC_OutputBuffer_Disable ((uint32_t)0x00000002)
+#define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \
+ ((STATE) == DAC_OutputBuffer_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup DAC_Channel_selection
+ * @{
+ */
+
+#define DAC_Channel_1 ((uint32_t)0x00000000)
+#define DAC_Channel_2 ((uint32_t)0x00000010)
+#define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \
+ ((CHANNEL) == DAC_Channel_2))
+/**
+ * @}
+ */
+
+/** @defgroup DAC_data_alignment
+ * @{
+ */
+
+#define DAC_Align_12b_Right ((uint32_t)0x00000000)
+#define DAC_Align_12b_Left ((uint32_t)0x00000004)
+#define DAC_Align_8b_Right ((uint32_t)0x00000008)
+#define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_Right) || \
+ ((ALIGN) == DAC_Align_12b_Left) || \
+ ((ALIGN) == DAC_Align_8b_Right))
+/**
+ * @}
+ */
+
+/** @defgroup DAC_wave_generation
+ * @{
+ */
+
+#define DAC_Wave_Noise ((uint32_t)0x00000040)
+#define DAC_Wave_Triangle ((uint32_t)0x00000080)
+#define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \
+ ((WAVE) == DAC_Wave_Triangle))
+/**
+ * @}
+ */
+
+/** @defgroup DAC_data
+ * @{
+ */
+
+#define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0)
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DAC_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DAC_Exported_Functions
+ * @{
+ */
+
+void DAC_Reset(void);
+void DAC_Init(uint32_t DAC_Channel, DAC_InitType* DAC_InitStruct);
+void DAC_StructInit(DAC_InitType* DAC_InitStruct);
+void DAC_Ctrl(uint32_t DAC_Channel, FunctionalState NewState);
+void DAC_DMACtrl(uint32_t DAC_Channel, FunctionalState NewState);
+void DAC_SoftwareTriggerCtrl(uint32_t DAC_Channel, FunctionalState NewState);
+void DAC_DualSoftwareTriggerCtrl(FunctionalState NewState);
+void DAC_WaveGenerationCtrl(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState);
+void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data);
+void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data);
+void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1);
+uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__AT32F4xx_DAC_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_dbgmcu.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_dbgmcu.h
new file mode 100644
index 0000000000000000000000000000000000000000..422c2c9a2f87b49aa1ec0aaaaa89da63df19b7a1
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_dbgmcu.h
@@ -0,0 +1,105 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_dbgmcu.h
+ * Description : at32f4xx MCUDBG header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_MCUDBG_H
+#define __AT32F4xx_MCUDBG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup DBGMCU
+ * @{
+ */
+
+/** @defgroup DBGMCU_Exported_Types
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DBGMCU_Exported_Constants
+ * @{
+ */
+
+#define MCUDBG_SLEEP ((uint32_t)0x00000001)
+#define MCUDBG_STOP ((uint32_t)0x00000002)
+#define MCUDBG_STANDBY ((uint32_t)0x00000004)
+#define MCUDBG_IWDG_STOP ((uint32_t)0x00000100)
+#define MCUDBG_WWDG_STOP ((uint32_t)0x00000200)
+#define MCUDBG_TMR1_STOP ((uint32_t)0x00000400)
+#define MCUDBG_TMR2_STOP ((uint32_t)0x00000800)
+#define MCUDBG_TMR3_STOP ((uint32_t)0x00001000)
+#define MCUDBG_TMR4_STOP ((uint32_t)0x00002000)
+#define MCUDBG_CAN1_STOP ((uint32_t)0x00004000)
+#define MCUDBG_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000)
+#define MCUDBG_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000)
+#define MCUDBG_TMR8_STOP ((uint32_t)0x00020000)
+#define MCUDBG_TMR5_STOP ((uint32_t)0x00040000)
+#define MCUDBG_TMR6_STOP ((uint32_t)0x00080000)
+#define MCUDBG_TMR7_STOP ((uint32_t)0x00100000)
+#define MCUDBG_TMR15_STOP ((uint32_t)0x00400000)
+#define MCUDBG_TMR12_STOP ((uint32_t)0x02000000)
+#define MCUDBG_TMR13_STOP ((uint32_t)0x04000000)
+#define MCUDBG_TMR14_STOP ((uint32_t)0x08000000)
+#define MCUDBG_TMR9_STOP ((uint32_t)0x10000000)
+#define MCUDBG_TMR10_STOP ((uint32_t)0x20000000)
+#define MCUDBG_TMR11_STOP ((uint32_t)0x40000000)
+#define MCUDBG_I2C3_SMBUS_TIMEOUT ((uint32_t)0x80000000)
+
+#define IS_MCUDBG_PERIPH(PERIPH) ((((PERIPH) & 0x008000F8) == 0x00) && ((PERIPH) != 0x00))
+/**
+ * @}
+ */
+
+/** @defgroup DBGMCU_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DBGMCU_Exported_Functions
+ * @{
+ */
+
+uint32_t MCUDBG_GetRevID(void);
+uint32_t MCUDBG_GetDevID(void);
+void MCUDBG_PeriphDebugModeConfig(uint32_t DBGMCU_Periph, FunctionalState NewState);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_MCUDBG_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_dma.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_dma.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef148326df085353c36e300d7600d38ae8550236
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_dma.h
@@ -0,0 +1,574 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_dma.h
+ * Description : at32f4xx DMA header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_DMA_H
+#define __AT32F4xx_DMA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup DMA
+ * @{
+ */
+
+/** @defgroup DMA_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief DMA Init structure definition
+ */
+
+typedef struct
+{
+ uint32_t DMA_PeripheralBaseAddr; /*!< Specifies the peripheral base address for DMAy Channelx. */
+
+ uint32_t DMA_MemoryBaseAddr; /*!< Specifies the memory base address for DMAy Channelx. */
+
+ uint32_t DMA_Direction; /*!< Specifies if the peripheral is the source or destination.
+ This parameter can be a value of @ref DMA_data_transfer_direction */
+
+ uint32_t DMA_BufferSize; /*!< Specifies the buffer size, in data unit, of the specified Channel.
+ The data unit is equal to the configuration set in DMA_PeripheralDataWidth
+ or DMA_MemoryDataWidth members depending in the transfer direction. */
+
+ uint32_t DMA_PeripheralInc; /*!< Specifies whether the Peripheral address register is incremented or not.
+ This parameter can be a value of @ref DMA_peripheral_incremented_mode */
+
+ uint32_t DMA_MemoryInc; /*!< Specifies whether the memory address register is incremented or not.
+ This parameter can be a value of @ref DMA_memory_incremented_mode */
+
+ uint32_t DMA_PeripheralDataWidth; /*!< Specifies the Peripheral data width.
+ This parameter can be a value of @ref DMA_peripheral_data_size */
+
+ uint32_t DMA_MemoryDataWidth; /*!< Specifies the Memory data width.
+ This parameter can be a value of @ref DMA_memory_data_size */
+
+ uint32_t DMA_Mode; /*!< Specifies the operation mode of the DMAy Channelx.
+ This parameter can be a value of @ref DMA_circular_normal_mode.
+ @note: The circular buffer mode cannot be used if the memory-to-memory
+ data transfer is configured on the selected Channel */
+
+ uint32_t DMA_Priority; /*!< Specifies the software priority for the DMAy Channelx.
+ This parameter can be a value of @ref DMA_priority_level */
+
+ uint32_t DMA_MTOM; /*!< Specifies if the DMAy Channelx will be used in memory-to-memory transfer.
+ This parameter can be a value of @ref DMA_memory_to_memory */
+} DMA_InitType;
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_Exported_Constants
+ * @{
+ */
+
+#define IS_DMA_ALL_PERIPH(PERIPH) (((PERIPH) == DMA1_Channel1) || \
+ ((PERIPH) == DMA1_Channel2) || \
+ ((PERIPH) == DMA1_Channel3) || \
+ ((PERIPH) == DMA1_Channel4) || \
+ ((PERIPH) == DMA1_Channel5) || \
+ ((PERIPH) == DMA1_Channel6) || \
+ ((PERIPH) == DMA1_Channel7) || \
+ ((PERIPH) == DMA2_Channel1) || \
+ ((PERIPH) == DMA2_Channel2) || \
+ ((PERIPH) == DMA2_Channel3) || \
+ ((PERIPH) == DMA2_Channel4) || \
+ ((PERIPH) == DMA2_Channel5))
+
+
+/** @defgroup DMA_flexible_channel
+ * @{
+ */
+#define Flex_Channel1 ((uint8_t)0x01)
+#define Flex_Channel2 ((uint8_t)0x02)
+#define Flex_Channel3 ((uint8_t)0x03)
+#define Flex_Channel4 ((uint8_t)0x04)
+#define Flex_Channel5 ((uint8_t)0x05)
+#define Flex_Channel6 ((uint8_t)0x06)
+#define Flex_Channel7 ((uint8_t)0x07)
+
+#define IS_DMA_ALL_CHANNELS(CHANNELS) (((CHANNELS) == Flex_Channel1) || \
+ ((CHANNELS) == Flex_Channel2) || \
+ ((CHANNELS) == Flex_Channel3) || \
+ ((CHANNELS) == Flex_Channel4) || \
+ ((CHANNELS) == Flex_Channel5) || \
+ ((CHANNELS) == Flex_Channel6) || \
+ ((CHANNELS) == Flex_Channel7))
+
+/** @defgroup DMA_hardware_id
+ * @{
+ */
+#define DMA_FLEXIBLE_ADC1 ((uint8_t)0x01)
+#define DMA_FLEXIBLE_ADC3 ((uint8_t)0x03)
+#define DMA_FLEXIBLE_DAC1 ((uint8_t)0x05)
+#define DMA_FLEXIBLE_DAC2 ((uint8_t)0x06)
+#define DMA_FLEXIBLE_SPI1_RX ((uint8_t)0x09)
+#define DMA_FLEXIBLE_SPI1_TX ((uint8_t)0x0A)
+#define DMA_FLEXIBLE_SPI2_RX ((uint8_t)0x0B)
+#define DMA_FLEXIBLE_SPI2_TX ((uint8_t)0x0C)
+#define DMA_FLEXIBLE_SPI3_RX ((uint8_t)0x0D)
+#define DMA_FLEXIBLE_SPI3_TX ((uint8_t)0x0E)
+#define DMA_FLEXIBLE_SPI4_RX ((uint8_t)0x0F)
+#define DMA_FLEXIBLE_SPI4_TX ((uint8_t)0x10)
+#define DMA_FLEXIBLE_I2S2EXT_RX ((uint8_t)0x11)
+#define DMA_FLEXIBLE_I2S2EXT_TX ((uint8_t)0x12)
+#define DMA_FLEXIBLE_I2S3EXT_RX ((uint8_t)0x13)
+#define DMA_FLEXIBLE_I2S3EXT_TX ((uint8_t)0x14)
+#define DMA_FLEXIBLE_UART1_RX ((uint8_t)0x19)
+#define DMA_FLEXIBLE_UART1_TX ((uint8_t)0x1A)
+#define DMA_FLEXIBLE_UART2_RX ((uint8_t)0x1B)
+#define DMA_FLEXIBLE_UART2_TX ((uint8_t)0x1C)
+#define DMA_FLEXIBLE_UART3_RX ((uint8_t)0x1D)
+#define DMA_FLEXIBLE_UART3_TX ((uint8_t)0x1E)
+#define DMA_FLEXIBLE_UART4_RX ((uint8_t)0x1F)
+#define DMA_FLEXIBLE_UART4_TX ((uint8_t)0x20)
+#define DMA_FLEXIBLE_UART5_RX ((uint8_t)0x21)
+#define DMA_FLEXIBLE_UART5_TX ((uint8_t)0x22)
+#define DMA_FLEXIBLE_UART6_RX ((uint8_t)0x23)
+#define DMA_FLEXIBLE_UART6_TX ((uint8_t)0x24)
+#define DMA_FLEXIBLE_UART7_RX ((uint8_t)0x25)
+#define DMA_FLEXIBLE_UART7_TX ((uint8_t)0x26)
+#define DMA_FLEXIBLE_UART8_RX ((uint8_t)0x27)
+#define DMA_FLEXIBLE_UART8_TX ((uint8_t)0x28)
+#define DMA_FLEXIBLE_I2C1_RX ((uint8_t)0x29)
+#define DMA_FLEXIBLE_I2C1_TX ((uint8_t)0x2A)
+#define DMA_FLEXIBLE_I2C2_RX ((uint8_t)0x2B)
+#define DMA_FLEXIBLE_I2C2_TX ((uint8_t)0x2C)
+#define DMA_FLEXIBLE_I2C3_RX ((uint8_t)0x2D)
+#define DMA_FLEXIBLE_I2C3_TX ((uint8_t)0x2E)
+#define DMA_FLEXIBLE_SDIO1 ((uint8_t)0x31)
+#define DMA_FLEXIBLE_SDIO2 ((uint8_t)0x32)
+#define DMA_FLEXIBLE_TIM1_TRIG ((uint8_t)0x35)
+#define DMA_FLEXIBLE_TIM1_COM ((uint8_t)0x36)
+#define DMA_FLEXIBLE_TIM1_UP ((uint8_t)0x37)
+#define DMA_FLEXIBLE_TIM1_CH1 ((uint8_t)0x38)
+#define DMA_FLEXIBLE_TIM1_CH2 ((uint8_t)0x39)
+#define DMA_FLEXIBLE_TIM1_CH3 ((uint8_t)0x3A)
+#define DMA_FLEXIBLE_TIM1_CH4 ((uint8_t)0x3B)
+#define DMA_FLEXIBLE_TIM2_TRIG ((uint8_t)0x3D)
+#define DMA_FLEXIBLE_TIM2_UP ((uint8_t)0x3F)
+#define DMA_FLEXIBLE_TIM2_CH1 ((uint8_t)0x40)
+#define DMA_FLEXIBLE_TIM2_CH2 ((uint8_t)0x41)
+#define DMA_FLEXIBLE_TIM2_CH3 ((uint8_t)0x42)
+#define DMA_FLEXIBLE_TIM2_CH4 ((uint8_t)0x43)
+#define DMA_FLEXIBLE_TIM3_TRIG ((uint8_t)0x45)
+#define DMA_FLEXIBLE_TIM3_UP ((uint8_t)0x47)
+#define DMA_FLEXIBLE_TIM3_CH1 ((uint8_t)0x48)
+#define DMA_FLEXIBLE_TIM3_CH2 ((uint8_t)0x49)
+#define DMA_FLEXIBLE_TIM3_CH3 ((uint8_t)0x4A)
+#define DMA_FLEXIBLE_TIM3_CH4 ((uint8_t)0x4B)
+#define DMA_FLEXIBLE_TIM4_TRIG ((uint8_t)0x4D)
+#define DMA_FLEXIBLE_TIM4_UP ((uint8_t)0x4F)
+#define DMA_FLEXIBLE_TIM4_CH1 ((uint8_t)0x50)
+#define DMA_FLEXIBLE_TIM4_CH2 ((uint8_t)0x51)
+#define DMA_FLEXIBLE_TIM4_CH3 ((uint8_t)0x52)
+#define DMA_FLEXIBLE_TIM4_CH4 ((uint8_t)0x53)
+#define DMA_FLEXIBLE_TIM5_TRIG ((uint8_t)0x55)
+#define DMA_FLEXIBLE_TIM5_UP ((uint8_t)0x57)
+#define DMA_FLEXIBLE_TIM5_CH1 ((uint8_t)0x58)
+#define DMA_FLEXIBLE_TIM5_CH2 ((uint8_t)0x59)
+#define DMA_FLEXIBLE_TIM5_CH3 ((uint8_t)0x5A)
+#define DMA_FLEXIBLE_TIM5_CH4 ((uint8_t)0x5B)
+#define DMA_FLEXIBLE_TIM6_UP ((uint8_t)0x5F)
+#define DMA_FLEXIBLE_TIM7_UP ((uint8_t)0x67)
+#define DMA_FLEXIBLE_TIM8_TRIG ((uint8_t)0x6D)
+#define DMA_FLEXIBLE_TIM8_COM ((uint8_t)0x6E)
+#define DMA_FLEXIBLE_TIM8_UP ((uint8_t)0x6F)
+#define DMA_FLEXIBLE_TIM8_CH1 ((uint8_t)0x70)
+#define DMA_FLEXIBLE_TIM8_CH2 ((uint8_t)0x71)
+#define DMA_FLEXIBLE_TIM8_CH3 ((uint8_t)0x72)
+#define DMA_FLEXIBLE_TIM8_CH4 ((uint8_t)0x73)
+
+#define IS_DMA_ALL_HARDWARE_ID(HARDWARE_ID) (((HARDWARE_ID) == DMA_FLEXIBLE_ADC1) || ((HARDWARE_ID) == DMA_FLEXIBLE_ADC3)|| \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_SPI1_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_SPI1_TX)|| \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_SPI2_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_SPI2_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_SPI3_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_SPI3_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_SPI4_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_SPI4_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_I2S2EXT_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_I2S2EXT_TX)|| \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_I2S3EXT_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_I2S3EXT_TX)|| \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_UART1_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_UART1_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_UART2_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_UART2_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_UART3_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_UART3_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_UART4_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_UART4_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_UART5_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_UART5_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_UART6_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_UART6_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_UART7_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_UART7_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_UART8_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_UART8_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_I2C1_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_I2C1_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_I2C2_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_I2C2_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_I2C3_RX) || ((HARDWARE_ID) == DMA_FLEXIBLE_I2C3_TX) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_SDIO1) || ((HARDWARE_ID) == DMA_FLEXIBLE_SDIO2) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM1_TRIG)|| ((HARDWARE_ID) == DMA_FLEXIBLE_TIM1_COM) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM1_UP) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM1_CH1) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM1_CH2) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM1_CH3) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM1_CH4) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM2_TRIG)|| \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM2_UP) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM2_CH1) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM2_CH2) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM2_CH3) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM2_CH4) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM3_TRIG)|| \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM3_UP) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM3_CH1) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM3_CH2) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM3_CH3) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM3_CH4) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM4_TRIG)|| \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM4_UP) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM4_CH1) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM4_CH2) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM4_CH3) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM4_CH4) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM5_TRIG)|| \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM5_UP) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM5_CH1) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM5_CH2) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM5_CH3) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM5_CH4) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM6_UP) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM7_UP) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM8_TRIG)|| \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM8_COM) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM8_UP) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM8_CH1) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM8_CH2) || \
+ ((HARDWARE_ID) == DMA_FLEXIBLE_TIM8_CH3) || ((HARDWARE_ID) == DMA_FLEXIBLE_TIM8_CH4))
+
+#define DMA_FLEX_FUNCTION_EN ((uint32_t)0X1000000)
+
+/** @defgroup DMA_data_transfer_direction
+ * @{
+ */
+
+#define DMA_DIR_PERIPHERALDST ((uint32_t)0x00000010)
+#define DMA_DIR_PERIPHERALSRC ((uint32_t)0x00000000)
+#define IS_DMA_DIR(DIR) (((DIR) == DMA_DIR_PERIPHERALDST) || \
+ ((DIR) == DMA_DIR_PERIPHERALSRC))
+/**
+ * @}
+ */
+
+/** @defgroup DMA_peripheral_incremented_mode
+ * @{
+ */
+
+#define DMA_PERIPHERALINC_ENABLE ((uint32_t)0x00000040)
+#define DMA_PERIPHERALINC_DISABLE ((uint32_t)0x00000000)
+#define IS_DMA_PERIPHERAL_INC_STATE(STATE) (((STATE) == DMA_PERIPHERALINC_ENABLE) || \
+ ((STATE) == DMA_PERIPHERALINC_DISABLE))
+/**
+ * @}
+ */
+
+/** @defgroup DMA_memory_incremented_mode
+ * @{
+ */
+
+#define DMA_MEMORYINC_ENABLE ((uint32_t)0x00000080)
+#define DMA_MEMORYINC_DISABLE ((uint32_t)0x00000000)
+#define IS_DMA_MEMORY_INC_STATE(STATE) (((STATE) == DMA_MEMORYINC_ENABLE) || \
+ ((STATE) == DMA_MEMORYINC_DISABLE))
+/**
+ * @}
+ */
+
+/** @defgroup DMA_peripheral_data_size
+ * @{
+ */
+
+#define DMA_PERIPHERALDATAWIDTH_BYTE ((uint32_t)0x00000000)
+#define DMA_PERIPHERALDATAWIDTH_HALFWORD ((uint32_t)0x00000100)
+#define DMA_PERIPHERALDATAWIDTH_WORD ((uint32_t)0x00000200)
+#define IS_DMA_PERIPHERAL_DATA_WIDTH(WIDTH) (((WIDTH) == DMA_PERIPHERALDATAWIDTH_BYTE) || \
+ ((WIDTH) == DMA_PERIPHERALDATAWIDTH_HALFWORD) || \
+ ((WIDTH) == DMA_PERIPHERALDATAWIDTH_WORD))
+/**
+ * @}
+ */
+
+/** @defgroup DMA_memory_data_size
+ * @{
+ */
+
+#define DMA_MEMORYDATAWIDTH_BYTE ((uint32_t)0x00000000)
+#define DMA_MEMORYDATAWIDTH_HALFWORD ((uint32_t)0x00000400)
+#define DMA_MEMORYDATAWIDTH_WORD ((uint32_t)0x00000800)
+#define IS_DMA_MEMORY_DATA_WIDTH(WIDTH) (((WIDTH) == DMA_MEMORYDATAWIDTH_BYTE) || \
+ ((WIDTH) == DMA_MEMORYDATAWIDTH_HALFWORD) || \
+ ((WIDTH) == DMA_MEMORYDATAWIDTH_WORD))
+/**
+ * @}
+ */
+
+/** @defgroup DMA_circular_normal_mode
+ * @{
+ */
+
+#define DMA_MODE_CIRCULAR ((uint32_t)0x00000020)
+#define DMA_MODE_NORMAL ((uint32_t)0x00000000)
+#define IS_DMA_MODE(MODE) (((MODE) == DMA_MODE_CIRCULAR) || ((MODE) == DMA_MODE_NORMAL))
+/**
+ * @}
+ */
+
+/** @defgroup DMA_priority_level
+ * @{
+ */
+
+#define DMA_PRIORITY_VERYHIGH ((uint32_t)0x00003000)
+#define DMA_PRIORITY_HIGH ((uint32_t)0x00002000)
+#define DMA_PRIORITY_MEDIUM ((uint32_t)0x00001000)
+#define DMA_PRIORITY_LOW ((uint32_t)0x00000000)
+#define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_VERYHIGH) || \
+ ((PRIORITY) == DMA_PRIORITY_HIGH) || \
+ ((PRIORITY) == DMA_PRIORITY_MEDIUM) || \
+ ((PRIORITY) == DMA_PRIORITY_LOW))
+/**
+ * @}
+ */
+
+/** @defgroup DMA_memory_to_memory
+ * @{
+ */
+
+#define DMA_MEMTOMEM_ENABLE ((uint32_t)0x00004000)
+#define DMA_MEMTOMEM_DISABLE ((uint32_t)0x00000000)
+#define IS_DMA_MTOM_STATE(STATE) (((STATE) == DMA_MEMTOMEM_ENABLE) || ((STATE) == DMA_MEMTOMEM_DISABLE))
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_interrupts_definition
+ * @{
+ */
+
+#define DMA_INT_TC ((uint32_t)0x00000002)
+#define DMA_INT_HT ((uint32_t)0x00000004)
+#define DMA_INT_ERR ((uint32_t)0x00000008)
+#define IS_DMA_CONFIG_INT(INT) ((((INT) & 0xFFFFFFF1) == 0x00) && ((INT) != 0x00))
+
+#define DMA1_INT_GL1 ((uint32_t)0x00000001)
+#define DMA1_INT_TC1 ((uint32_t)0x00000002)
+#define DMA1_INT_HT1 ((uint32_t)0x00000004)
+#define DMA1_INT_ERR1 ((uint32_t)0x00000008)
+#define DMA1_INT_GL2 ((uint32_t)0x00000010)
+#define DMA1_INT_TC2 ((uint32_t)0x00000020)
+#define DMA1_INT_HT2 ((uint32_t)0x00000040)
+#define DMA1_INT_ERR2 ((uint32_t)0x00000080)
+#define DMA1_INT_GL3 ((uint32_t)0x00000100)
+#define DMA1_INT_TC3 ((uint32_t)0x00000200)
+#define DMA1_INT_HT3 ((uint32_t)0x00000400)
+#define DMA1_INT_ERR3 ((uint32_t)0x00000800)
+#define DMA1_INT_GL4 ((uint32_t)0x00001000)
+#define DMA1_INT_TC4 ((uint32_t)0x00002000)
+#define DMA1_INT_HT4 ((uint32_t)0x00004000)
+#define DMA1_INT_ERR4 ((uint32_t)0x00008000)
+#define DMA1_INT_GL5 ((uint32_t)0x00010000)
+#define DMA1_INT_TC5 ((uint32_t)0x00020000)
+#define DMA1_INT_HT5 ((uint32_t)0x00040000)
+#define DMA1_INT_ERR5 ((uint32_t)0x00080000)
+#define DMA1_INT_GL6 ((uint32_t)0x00100000)
+#define DMA1_INT_TC6 ((uint32_t)0x00200000)
+#define DMA1_INT_HT6 ((uint32_t)0x00400000)
+#define DMA1_INT_ERR6 ((uint32_t)0x00800000)
+#define DMA1_INT_GL7 ((uint32_t)0x01000000)
+#define DMA1_INT_TC7 ((uint32_t)0x02000000)
+#define DMA1_INT_HT7 ((uint32_t)0x04000000)
+#define DMA1_INT_ERR7 ((uint32_t)0x08000000)
+
+#define DMA2_INT_GL1 ((uint32_t)0x10000001)
+#define DMA2_INT_TC1 ((uint32_t)0x10000002)
+#define DMA2_INT_HT1 ((uint32_t)0x10000004)
+#define DMA2_INT_ERR1 ((uint32_t)0x10000008)
+#define DMA2_INT_GL2 ((uint32_t)0x10000010)
+#define DMA2_INT_TC2 ((uint32_t)0x10000020)
+#define DMA2_INT_HT2 ((uint32_t)0x10000040)
+#define DMA2_INT_ERR2 ((uint32_t)0x10000080)
+#define DMA2_INT_GL3 ((uint32_t)0x10000100)
+#define DMA2_INT_TC3 ((uint32_t)0x10000200)
+#define DMA2_INT_HT3 ((uint32_t)0x10000400)
+#define DMA2_INT_ERR3 ((uint32_t)0x10000800)
+#define DMA2_INT_GL4 ((uint32_t)0x10001000)
+#define DMA2_INT_TC4 ((uint32_t)0x10002000)
+#define DMA2_INT_HT4 ((uint32_t)0x10004000)
+#define DMA2_INT_ERR4 ((uint32_t)0x10008000)
+#define DMA2_INT_GL5 ((uint32_t)0x10010000)
+#define DMA2_INT_TC5 ((uint32_t)0x10020000)
+#define DMA2_INT_HT5 ((uint32_t)0x10040000)
+#define DMA2_INT_ERR5 ((uint32_t)0x10080000)
+
+#define IS_DMA_CLEAR_INT(INT) (((((INT) & 0xF0000000) == 0x00) || (((INT) & 0xEFF00000) == 0x00)) && ((INT) != 0x00))
+
+#define IS_DMA_GET_INT(INT) (((INT) == DMA1_INT_GL1) || ((INT) == DMA1_INT_TC1) || \
+ ((INT) == DMA1_INT_HT1) || ((INT) == DMA1_INT_ERR1) || \
+ ((INT) == DMA1_INT_GL2) || ((INT) == DMA1_INT_TC2) || \
+ ((INT) == DMA1_INT_HT2) || ((INT) == DMA1_INT_ERR2) || \
+ ((INT) == DMA1_INT_GL3) || ((INT) == DMA1_INT_TC3) || \
+ ((INT) == DMA1_INT_HT3) || ((INT) == DMA1_INT_ERR3) || \
+ ((INT) == DMA1_INT_GL4) || ((INT) == DMA1_INT_TC4) || \
+ ((INT) == DMA1_INT_HT4) || ((INT) == DMA1_INT_ERR4) || \
+ ((INT) == DMA1_INT_GL5) || ((INT) == DMA1_INT_TC5) || \
+ ((INT) == DMA1_INT_HT5) || ((INT) == DMA1_INT_ERR5) || \
+ ((INT) == DMA1_INT_GL6) || ((INT) == DMA1_INT_TC6) || \
+ ((INT) == DMA1_INT_HT6) || ((INT) == DMA1_INT_ERR6) || \
+ ((INT) == DMA1_INT_GL7) || ((INT) == DMA1_INT_TC7) || \
+ ((INT) == DMA1_INT_HT7) || ((INT) == DMA1_INT_ERR7) || \
+ ((INT) == DMA2_INT_GL1) || ((INT) == DMA2_INT_TC1) || \
+ ((INT) == DMA2_INT_HT1) || ((INT) == DMA2_INT_ERR1) || \
+ ((INT) == DMA2_INT_GL2) || ((INT) == DMA2_INT_TC2) || \
+ ((INT) == DMA2_INT_HT2) || ((INT) == DMA2_INT_ERR2) || \
+ ((INT) == DMA2_INT_GL3) || ((INT) == DMA2_INT_TC3) || \
+ ((INT) == DMA2_INT_HT3) || ((INT) == DMA2_INT_ERR3) || \
+ ((INT) == DMA2_INT_GL4) || ((INT) == DMA2_INT_TC4) || \
+ ((INT) == DMA2_INT_HT4) || ((INT) == DMA2_INT_ERR4) || \
+ ((INT) == DMA2_INT_GL5) || ((INT) == DMA2_INT_TC5) || \
+ ((INT) == DMA2_INT_HT5) || ((INT) == DMA2_INT_ERR5))
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_flags_definition
+ * @{
+ */
+#define DMA1_FLAG_GL1 ((uint32_t)0x00000001)
+#define DMA1_FLAG_TC1 ((uint32_t)0x00000002)
+#define DMA1_FLAG_HT1 ((uint32_t)0x00000004)
+#define DMA1_FLAG_ERR1 ((uint32_t)0x00000008)
+#define DMA1_FLAG_GL2 ((uint32_t)0x00000010)
+#define DMA1_FLAG_TC2 ((uint32_t)0x00000020)
+#define DMA1_FLAG_HT2 ((uint32_t)0x00000040)
+#define DMA1_FLAG_ERR2 ((uint32_t)0x00000080)
+#define DMA1_FLAG_GL3 ((uint32_t)0x00000100)
+#define DMA1_FLAG_TC3 ((uint32_t)0x00000200)
+#define DMA1_FLAG_HT3 ((uint32_t)0x00000400)
+#define DMA1_FLAG_ERR3 ((uint32_t)0x00000800)
+#define DMA1_FLAG_GL4 ((uint32_t)0x00001000)
+#define DMA1_FLAG_TC4 ((uint32_t)0x00002000)
+#define DMA1_FLAG_HT4 ((uint32_t)0x00004000)
+#define DMA1_FLAG_ERR4 ((uint32_t)0x00008000)
+#define DMA1_FLAG_GL5 ((uint32_t)0x00010000)
+#define DMA1_FLAG_TC5 ((uint32_t)0x00020000)
+#define DMA1_FLAG_HT5 ((uint32_t)0x00040000)
+#define DMA1_FLAG_ERR5 ((uint32_t)0x00080000)
+#define DMA1_FLAG_GL6 ((uint32_t)0x00100000)
+#define DMA1_FLAG_TC6 ((uint32_t)0x00200000)
+#define DMA1_FLAG_HT6 ((uint32_t)0x00400000)
+#define DMA1_FLAG_ERR6 ((uint32_t)0x00800000)
+#define DMA1_FLAG_GL7 ((uint32_t)0x01000000)
+#define DMA1_FLAG_TC7 ((uint32_t)0x02000000)
+#define DMA1_FLAG_HT7 ((uint32_t)0x04000000)
+#define DMA1_FLAG_ERR7 ((uint32_t)0x08000000)
+
+#define DMA2_FLAG_GL1 ((uint32_t)0x10000001)
+#define DMA2_FLAG_TC1 ((uint32_t)0x10000002)
+#define DMA2_FLAG_HT1 ((uint32_t)0x10000004)
+#define DMA2_FLAG_ERR1 ((uint32_t)0x10000008)
+#define DMA2_FLAG_GL2 ((uint32_t)0x10000010)
+#define DMA2_FLAG_TC2 ((uint32_t)0x10000020)
+#define DMA2_FLAG_HT2 ((uint32_t)0x10000040)
+#define DMA2_FLAG_ERR2 ((uint32_t)0x10000080)
+#define DMA2_FLAG_GL3 ((uint32_t)0x10000100)
+#define DMA2_FLAG_TC3 ((uint32_t)0x10000200)
+#define DMA2_FLAG_HT3 ((uint32_t)0x10000400)
+#define DMA2_FLAG_ERR3 ((uint32_t)0x10000800)
+#define DMA2_FLAG_GL4 ((uint32_t)0x10001000)
+#define DMA2_FLAG_TC4 ((uint32_t)0x10002000)
+#define DMA2_FLAG_HT4 ((uint32_t)0x10004000)
+#define DMA2_FLAG_ERR4 ((uint32_t)0x10008000)
+#define DMA2_FLAG_GL5 ((uint32_t)0x10010000)
+#define DMA2_FLAG_TC5 ((uint32_t)0x10020000)
+#define DMA2_FLAG_HT5 ((uint32_t)0x10040000)
+#define DMA2_FLAG_ERR5 ((uint32_t)0x10080000)
+
+#define IS_DMA_CLEAR_FLAG(FLAG) (((((FLAG) & 0xF0000000) == 0x00) || (((FLAG) & 0xEFF00000) == 0x00)) && ((FLAG) != 0x00))
+
+#define IS_DMA_GET_FLAG(FLAG) (((FLAG) == DMA1_FLAG_GL1) || ((FLAG) == DMA1_FLAG_TC1) || \
+ ((FLAG) == DMA1_FLAG_HT1) || ((FLAG) == DMA1_FLAG_ERR1) || \
+ ((FLAG) == DMA1_FLAG_GL2) || ((FLAG) == DMA1_FLAG_TC2) || \
+ ((FLAG) == DMA1_FLAG_HT2) || ((FLAG) == DMA1_FLAG_ERR2) || \
+ ((FLAG) == DMA1_FLAG_GL3) || ((FLAG) == DMA1_FLAG_TC3) || \
+ ((FLAG) == DMA1_FLAG_HT3) || ((FLAG) == DMA1_FLAG_ERR3) || \
+ ((FLAG) == DMA1_FLAG_GL4) || ((FLAG) == DMA1_FLAG_TC4) || \
+ ((FLAG) == DMA1_FLAG_HT4) || ((FLAG) == DMA1_FLAG_ERR4) || \
+ ((FLAG) == DMA1_FLAG_GL5) || ((FLAG) == DMA1_FLAG_TC5) || \
+ ((FLAG) == DMA1_FLAG_HT5) || ((FLAG) == DMA1_FLAG_ERR5) || \
+ ((FLAG) == DMA1_FLAG_GL6) || ((FLAG) == DMA1_FLAG_TC6) || \
+ ((FLAG) == DMA1_FLAG_HT6) || ((FLAG) == DMA1_FLAG_ERR6) || \
+ ((FLAG) == DMA1_FLAG_GL7) || ((FLAG) == DMA1_FLAG_TC7) || \
+ ((FLAG) == DMA1_FLAG_HT7) || ((FLAG) == DMA1_FLAG_ERR7) || \
+ ((FLAG) == DMA2_FLAG_GL1) || ((FLAG) == DMA2_FLAG_TC1) || \
+ ((FLAG) == DMA2_FLAG_HT1) || ((FLAG) == DMA2_FLAG_ERR1) || \
+ ((FLAG) == DMA2_FLAG_GL2) || ((FLAG) == DMA2_FLAG_TC2) || \
+ ((FLAG) == DMA2_FLAG_HT2) || ((FLAG) == DMA2_FLAG_ERR2) || \
+ ((FLAG) == DMA2_FLAG_GL3) || ((FLAG) == DMA2_FLAG_TC3) || \
+ ((FLAG) == DMA2_FLAG_HT3) || ((FLAG) == DMA2_FLAG_ERR3) || \
+ ((FLAG) == DMA2_FLAG_GL4) || ((FLAG) == DMA2_FLAG_TC4) || \
+ ((FLAG) == DMA2_FLAG_HT4) || ((FLAG) == DMA2_FLAG_ERR4) || \
+ ((FLAG) == DMA2_FLAG_GL5) || ((FLAG) == DMA2_FLAG_TC5) || \
+ ((FLAG) == DMA2_FLAG_HT5) || ((FLAG) == DMA2_FLAG_ERR5))
+/**
+ * @}
+ */
+
+/** @defgroup DMA_Buffer_Size
+ * @{
+ */
+
+#define IS_DMA_BUFFER_SIZE(SIZE) (((SIZE) >= 0x1) && ((SIZE) < 0x10000))
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_Exported_Functions
+ * @{
+ */
+
+void DMA_Reset(DMA_Channel_Type* DMAy_Channelx);
+void DMA_Init(DMA_Channel_Type* DMAy_Channelx, DMA_InitType* DMA_InitStruct);
+void DMA_DefaultInitParaConfig(DMA_InitType* DMA_InitStruct);
+void DMA_ChannelEnable(DMA_Channel_Type* DMAy_Channelx, FunctionalState NewState);
+void DMA_INTConfig(DMA_Channel_Type* DMAy_Channelx, uint32_t DMA_INT, FunctionalState NewState);
+void DMA_SetCurrDataCounter(DMA_Channel_Type* DMAy_Channelx, uint16_t DataNumber);
+uint16_t DMA_GetCurrDataCounter(DMA_Channel_Type* DMAy_Channelx);
+FlagStatus DMA_GetFlagStatus(uint32_t DMAy_FLAG);
+void DMA_ClearFlag(uint32_t DMAy_FLAG);
+ITStatus DMA_GetITStatus(uint32_t DMAy_INT);
+void DMA_ClearITPendingBit(uint32_t DMAy_INT);
+void DMA_Flexible_Config(DMA_Type *DMAx,uint8_t Flex_Channelx,uint8_t Hardware_ID);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__AT32F4xx_DMA_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_ertc.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_ertc.h
new file mode 100644
index 0000000000000000000000000000000000000000..d133b594ed6d70cfc5d3e52be1057f5edaa2fbeb
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_ertc.h
@@ -0,0 +1,864 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_ertc.h
+ * Description : at32f4xx ERTC header file
+ * Date : 2018-03-15
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_ERTC_H
+#define __AT32F4xx_ERTC_H
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup ERTC
+ * @{
+ */
+
+/* Exported types ------------------------------------------------------------*/
+
+/**
+ * @brief ERTC Init structures definition
+ */
+typedef struct
+{
+ uint32_t ERTC_HourFormat; /*!< Specifies the ERTC Hour Format.
+ This parameter can be a value of @ref RTC_Hour_Formats */
+
+ uint32_t ERTC_AsynchPrediv; /*!< Specifies the ERTC Asynchronous Predivider value.
+ This parameter must be set to a value lower than 0x7F */
+
+ uint32_t ERTC_SynchPrediv; /*!< Specifies the ERTC Synchronous Predivider value.
+ This parameter must be set to a value lower than 0x7FFF */
+}ERTC_InitType;
+
+/**
+ * @brief ERTC Time structure definition
+ */
+typedef struct
+{
+ uint8_t ERTC_Hours; /*!< Specifies the ERTC Time Hour.
+ This parameter must be set to a value in the 0-12 range
+ if the ERTC_HourFormat_12 is selected or 0-23 range if
+ the ERTC_HourFormat_24 is selected. */
+
+ uint8_t ERTC_Minutes; /*!< Specifies the ERTC Time Minutes.
+ This parameter must be set to a value in the 0-59 range. */
+
+ uint8_t ERTC_Seconds; /*!< Specifies the ERTC Time Seconds.
+ This parameter must be set to a value in the 0-59 range. */
+
+ uint8_t ERTC_AMPM; /*!< Specifies the ERTC AM/PM Time.
+ This parameter can be a value of @ref RTC_AM_PM_Definitions */
+}ERTC_TimeType;
+
+/**
+ * @brief ERTC Date structure definition
+ */
+typedef struct
+{
+ uint8_t ERTC_WeekDay; /*!< Specifies the ERTC Date WeekDay.
+ This parameter can be a value of @ref RTC_WeekDay_Definitions */
+
+ uint8_t ERTC_Month; /*!< Specifies the ERTC Date Month (in BCD format).
+ This parameter can be a value of @ref RTC_Month_Date_Definitions */
+
+ uint8_t ERTC_Date; /*!< Specifies the ERTC Date.
+ This parameter must be set to a value in the 1-31 range. */
+
+ uint8_t ERTC_Year; /*!< Specifies the ERTC Date Year.
+ This parameter must be set to a value in the 0-99 range. */
+}ERTC_DateType;
+
+/**
+ * @brief ERTC Alarm structure definition
+ */
+typedef struct
+{
+ ERTC_TimeType ERTC_AlarmTime; /*!< Specifies the ERTC Alarm Time members. */
+
+ uint32_t ERTC_AlarmMask; /*!< Specifies the ERTC Alarm Masks.
+ This parameter can be a value of @ref RTC_AlarmMask_Definitions */
+
+ uint32_t ERTC_AlarmDateWeekSel; /*!< Specifies the ERTC Alarm is on Date or WeekDay.
+ This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
+
+ uint8_t ERTC_AlarmDateWeek; /*!< Specifies the ERTC Alarm Date/WeekDay.
+ If the Alarm Date is selected, this parameter
+ must be set to a value in the 1-31 range.
+ If the Alarm WeekDay is selected, this
+ parameter can be a value of @ref RTC_WeekDay_Definitions */
+}ERTC_AlarmType;
+
+/* Exported constants --------------------------------------------------------*/
+
+/** @defgroup RTC_Exported_Constants
+ * @{
+ */
+
+
+/** @defgroup RTC_Hour_Formats
+ * @{
+ */
+#define ERTC_HourFormat_24 ((uint32_t)0x00000000)
+#define ERTC_HourFormat_12 ((uint32_t)0x00000040)
+#define IS_ERTC_HOUR_FORMAT(FORMAT) (((FORMAT) == ERTC_HourFormat_12) || \
+ ((FORMAT) == ERTC_HourFormat_24))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Asynchronous_Predivider
+ * @{
+ */
+#define IS_ERTC_ASYNCH_PRDIV(PRDIV) ((PRDIV) <= 0x7F)
+
+/**
+ * @}
+ */
+
+
+/** @defgroup RTC_Synchronous_Predivider
+ * @{
+ */
+#define IS_ERTC_SYNCH_PRDIV(PRDIV) ((PRDIV) <= 0x7FFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Time_Definitions
+ * @{
+ */
+#define IS_ERTC_HOUR12(HOUR) (((HOUR) > 0) && ((HOUR) <= 12))
+#define IS_ERTC_HOUR24(HOUR) ((HOUR) <= 23)
+#define IS_ERTC_MINUTES(MINUTES) ((MINUTES) <= 59)
+#define IS_ERTC_SECONDS(SECONDS) ((SECONDS) <= 59)
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_AM_PM_Definitions
+ * @{
+ */
+#define ERTC_H12_AM ((uint8_t)0x00)
+#define ERTC_H12_PM ((uint8_t)0x40)
+#define IS_ERTC_H12(AMPM) (((AMPM) == ERTC_H12_AM) || ((AMPM) == ERTC_H12_PM))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Year_Date_Definitions
+ * @{
+ */
+#define IS_ERTC_YEAR(YEAR) ((YEAR) <= 99)
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Month_Date_Definitions
+ * @{
+ */
+
+/* Coded in BCD format */
+#define ERTC_Month_JAN ((uint8_t)0x01)
+#define ERTC_Month_FEB ((uint8_t)0x02)
+#define ERTC_Month_MAR ((uint8_t)0x03)
+#define ERTC_Month_APR ((uint8_t)0x04)
+#define ERTC_Month_MAY ((uint8_t)0x05)
+#define ERTC_Month_JUN ((uint8_t)0x06)
+#define ERTC_Month_JUL ((uint8_t)0x07)
+#define ERTC_Month_AUG ((uint8_t)0x08)
+#define ERTC_Month_SEP ((uint8_t)0x09)
+#define ERTC_Month_OCT ((uint8_t)0x10)
+#define ERTC_Month_NOV ((uint8_t)0x11)
+#define ERTC_Month_DEC ((uint8_t)0x12)
+#define IS_ERTC_MONTH(MONTH) (((MONTH) >= 1) && ((MONTH) <= 12))
+#define IS_ERTC_DATE(DATE) (((DATE) >= 1) && ((DATE) <= 31))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_WeekDay_Definitions
+ * @{
+ */
+
+#define ERTC_Week_MON ((uint8_t)0x01)
+#define ERTC_Week_TUES ((uint8_t)0x02)
+#define ERTC_Week_WED ((uint8_t)0x03)
+#define ERTC_Week_THUR ((uint8_t)0x04)
+#define ERTC_Week_FRI ((uint8_t)0x05)
+#define ERTC_Week_SAT ((uint8_t)0x06)
+#define ERTC_Week_SUN ((uint8_t)0x07)
+#define IS_ERTC_WEEK(WEEK) (((WEEK) == ERTC_Week_MON) || \
+ ((WEEK) == ERTC_Week_TUES) || \
+ ((WEEK) == ERTC_Week_WED) || \
+ ((WEEK) == ERTC_Week_THUR) || \
+ ((WEEK) == ERTC_Week_FRI) || \
+ ((WEEK) == ERTC_Week_SAT) || \
+ ((WEEK) == ERTC_Week_SUN))
+/**
+ * @}
+ */
+
+
+/** @defgroup RTC_Alarm_Definitions
+ * @{
+ */
+#define IS_ERTC_ALARM_DATE_WEEK_DATE(DATE) (((DATE) > 0) && ((DATE) <= 31))
+#define IS_ERTC_ALARM_DATE_WEEK_WEEK(WEEK) (((WEEK) == ERTC_Week_MON) || \
+ ((WEEK) == ERTC_Week_TUES) || \
+ ((WEEK) == ERTC_Week_WED) || \
+ ((WEEK) == ERTC_Week_THUR) || \
+ ((WEEK) == ERTC_Week_FRI) || \
+ ((WEEK) == ERTC_Week_SAT) || \
+ ((WEEK) == ERTC_Week_SUN))
+
+/**
+ * @}
+ */
+
+
+/** @defgroup RTC_AlarmDateWeekDay_Definitions
+ * @{
+ */
+#define ERTC_AlarmDateWeekSel_Date ((uint32_t)0x00000000)
+#define ERTC_AlarmDateWeekSel_Week ((uint32_t)0x40000000)
+
+#define IS_ERTC_ALARM_DATE_WEEK_SEL(SEL) (((SEL) == ERTC_AlarmDateWeekSel_Date) || \
+ ((SEL) == ERTC_AlarmDateWeekSel_Week))
+
+/**
+ * @}
+ */
+
+
+/** @defgroup RTC_AlarmMask_Definitions
+ * @{
+ */
+#define ERTC_AlarmMask_None ((uint32_t)0x00000000)
+#define ERTC_AlarmMask_DateWeek ((uint32_t)0x80000000)
+#define ERTC_AlarmMask_Hours ((uint32_t)0x00800000)
+#define ERTC_AlarmMask_Minutes ((uint32_t)0x00008000)
+#define ERTC_AlarmMask_Seconds ((uint32_t)0x00000080)
+#define ERTC_AlarmMask_All ((uint32_t)0x80808080)
+#define IS_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7F) == (uint32_t)RESET)
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Alarms_Definitions
+ * @{
+ */
+#define ERTC_AlA ((uint32_t)0x00000100)
+#define ERTC_AlB ((uint32_t)0x00000200)
+#define IS_ERTC_ALARM(ALARM) (((ALARM) == ERTC_AlA) || ((ALARM) == ERTC_AlB))
+#define IS_ERTC_CMD_ALARM(ALARM) (((ALARM) & (ERTC_AlA | ERTC_AlB)) != (uint32_t)RESET)
+
+/**
+ * @}
+ */
+
+ /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions
+ * @{
+ */
+#define ERTC_AlarmSubSecondMask_All ((uint32_t)0x00000000) /*!< All Alarm SS fields are masked.
+ There is no comparison on sub seconds
+ for Alarm */
+#define ERTC_AlarmSubSecondMask_SBS14_1 ((uint32_t)0x01000000) /*!< SS[14:1] are don't care in Alarm
+ comparison. Only SS[0] is compared. */
+#define ERTC_AlarmSubSecondMask_SBS14_2 ((uint32_t)0x02000000) /*!< SS[14:2] are don't care in Alarm
+ comparison. Only SS[1:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_3 ((uint32_t)0x03000000) /*!< SS[14:3] are don't care in Alarm
+ comparison. Only SS[2:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_4 ((uint32_t)0x04000000) /*!< SS[14:4] are don't care in Alarm
+ comparison. Only SS[3:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_5 ((uint32_t)0x05000000) /*!< SS[14:5] are don't care in Alarm
+ comparison. Only SS[4:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_6 ((uint32_t)0x06000000) /*!< SS[14:6] are don't care in Alarm
+ comparison. Only SS[5:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_7 ((uint32_t)0x07000000) /*!< SS[14:7] are don't care in Alarm
+ comparison. Only SS[6:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_8 ((uint32_t)0x08000000) /*!< SS[14:8] are don't care in Alarm
+ comparison. Only SS[7:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_9 ((uint32_t)0x09000000) /*!< SS[14:9] are don't care in Alarm
+ comparison. Only SS[8:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_10 ((uint32_t)0x0A000000) /*!< SS[14:10] are don't care in Alarm
+ comparison. Only SS[9:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_11 ((uint32_t)0x0B000000) /*!< SS[14:11] are don't care in Alarm
+ comparison. Only SS[10:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_12 ((uint32_t)0x0C000000) /*!< SS[14:12] are don't care in Alarm
+ comparison.Only SS[11:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14_13 ((uint32_t)0x0D000000) /*!< SS[14:13] are don't care in Alarm
+ comparison. Only SS[12:0] are compared */
+#define ERTC_AlarmSubSecondMask_SBS14 ((uint32_t)0x0E000000) /*!< SS[14] is don't care in Alarm
+ comparison.Only SS[13:0] are compared */
+#define ERTC_AlarmSubSecondMask_None ((uint32_t)0x0F000000) /*!< SS[14:0] are compared and must match
+ to activate alarm. */
+#define IS_ERTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == ERTC_AlarmSubSecondMask_All) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_1) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_2) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_3) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_4) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_5) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_6) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_7) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_8) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_9) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_10) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_11) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_12) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14_13) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_SBS14) || \
+ ((MASK) == ERTC_AlarmSubSecondMask_None))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Alarm_Sub_Seconds_Value
+ * @{
+ */
+
+#define IS_ERTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= 0x00007FFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Wakeup_Timer_Definitions
+ * @{
+ */
+#define ERTC_WakeUpClockSelect_RTCCLK_Div16 ((uint32_t)0x00000000)
+#define ERTC_WakeUpClockSelect_RTCCLK_Div8 ((uint32_t)0x00000001)
+#define ERTC_WakeUpClockSelect_RTCCLK_Div4 ((uint32_t)0x00000002)
+#define ERTC_WakeUpClockSelect_RTCCLK_Div2 ((uint32_t)0x00000003)
+#define ERTC_WakeUpClockSelect_CK_SPRE_16bits ((uint32_t)0x00000004)
+#define ERTC_WakeUpClockSelect_CK_SPRE_17bits ((uint32_t)0x00000006)
+#define IS_ERTC_WAKEUP_CLOCK_SELECT(CLOCK) (((CLOCK) == ERTC_WakeUpClockSelect_RTCCLK_Div16) || \
+ ((CLOCK) == ERTC_WakeUpClockSelect_RTCCLK_Div8) || \
+ ((CLOCK) == ERTC_WakeUpClockSelect_RTCCLK_Div4) || \
+ ((CLOCK) == ERTC_WakeUpClockSelect_RTCCLK_Div2) || \
+ ((CLOCK) == ERTC_WakeUpClockSelect_CK_SPRE_16bits) || \
+ ((CLOCK) == ERTC_WakeUpClockSelect_CK_SPRE_17bits))
+#define IS_ERTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF)
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Time_Stamp_Edges_definitions
+ * @{
+ */
+#define ERTC_TimeStampEdge_Rising ((uint32_t)0x00000000)
+#define ERTC_TimeStampEdge_Falling ((uint32_t)0x00000008)
+#define IS_ERTC_TIMESTAMP_EDGE(EDGE) (((EDGE) == ERTC_TimeStampEdge_Rising) || \
+ ((EDGE) == ERTC_TimeStampEdge_Falling))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Output_selection_Definitions
+ * @{
+ */
+#define ERTC_Output_Disable ((uint32_t)0x00000000)
+#define ERTC_Output_AlarmA ((uint32_t)0x00200000)
+#define ERTC_Output_AlarmB ((uint32_t)0x00400000)
+#define ERTC_Output_WakeUp ((uint32_t)0x00600000)
+
+#define IS_ERTC_OUTPUT(OUTPUT) (((OUTPUT) == ERTC_Output_Disable) || \
+ ((OUTPUT) == ERTC_Output_AlarmA) || \
+ ((OUTPUT) == ERTC_Output_AlarmB) || \
+ ((OUTPUT) == ERTC_Output_WakeUp))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Output_Polarity_Definitions
+ * @{
+ */
+#define ERTC_OutputPolarity_High ((uint32_t)0x00000000)
+#define ERTC_OutputPolarity_Low ((uint32_t)0x00100000)
+#define IS_ERTC_OUTPUT_OPOL(OPOL) (((OPOL) == ERTC_OutputPolarity_High) || \
+ ((OPOL) == ERTC_OutputPolarity_Low))
+/**
+ * @}
+ */
+
+
+/** @defgroup RTC_Digital_Calibration_Definitions
+ * @{
+ */
+#define ERTC_DataCalSign_Positive ((uint32_t)0x00000000)
+#define ERTC_DataCalSign_Negative ((uint32_t)0x00000080)
+#define IS_ERTC_DATACAL_SIGN(SIGN) (((SIGN) == ERTC_DataCalSign_Positive) || \
+ ((SIGN) == ERTC_DataCalSign_Negative))
+#define IS_ERTC_DATACAL_VALUE(VALUE) ((VALUE) < 0x20)
+
+/**
+ * @}
+ */
+
+ /** @defgroup RTC_Calib_Output_selection_Definitions
+ * @{
+ */
+#define ERTC_CalOutput_512Hz ((uint32_t)0x00000000)
+#define ERTC_CalOutput_1Hz ((uint32_t)0x00080000)
+#define IS_ERTC_CAL_OUTPUT(OUTPUT) (((OUTPUT) == ERTC_CalOutput_512Hz) || \
+ ((OUTPUT) == ERTC_CalOutput_1Hz))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Smooth_calib_period_Definitions
+ * @{
+ */
+#define ERTC_SmoothCalPeriod_32sec ((uint32_t)0x00000000) /*!< if RTCCLK = 32768 Hz, Smooth calibation
+ period is 32s, else 2exp20 RTCCLK seconds */
+#define ERTC_SmoothCalPeriod_16sec ((uint32_t)0x00002000) /*!< if RTCCLK = 32768 Hz, Smooth calibration
+ period is 16s, else 2exp19 RTCCLK seconds */
+#define ERTC_SmoothCalPeriod_8sec ((uint32_t)0x00004000) /*!< if RTCCLK = 32768 Hz, Smooth calibation
+ period is 8s, else 2exp18 RTCCLK seconds */
+#define IS_ERTC_SMOOTH_CAL_PERIOD(PERIOD) (((PERIOD) == ERTC_SmoothCalPeriod_32sec) || \
+ ((PERIOD) == ERTC_SmoothCalPeriod_16sec) || \
+ ((PERIOD) == ERTC_SmoothCalPeriod_8sec))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Smooth_calib_Plus_pulses_Definitions
+ * @{
+ */
+#define ERTC_SmoothCalAddPulses_Set ((uint32_t)0x00008000) /*!< The number of RTCCLK pulses added
+ during a X -second window = Y - CALM[8:0].
+ with Y = 512, 256, 128 when X = 32, 16, 8 */
+#define ERTC_SmoothCalAddPulses_Reset ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited
+ during a 32-second window = CALM[8:0]. */
+#define IS_ERTC_SMOOTH_CAL_ADD(ADD) (((ADD) == ERTC_SmoothCalAddPulses_Set) || \
+ ((ADD) == ERTC_SmoothCalAddPulses_Reset))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Smooth_calib_Minus_pulses_Definitions
+ * @{
+ */
+#define IS_ERTC_SMOOTH_CAL_VALUE(VALUE) ((VALUE) <= 0x000001FF)
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_DayLightSaving_Definitions
+ * @{
+ */
+#define ERTC_DayLightSaving_SUB1H ((uint32_t)0x00020000)
+#define ERTC_DayLightSaving_ADD1H ((uint32_t)0x00010000)
+#define IS_ERTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == ERTC_DayLightSaving_SUB1H) || \
+ ((SAVE) == ERTC_DayLightSaving_ADD1H))
+
+#define ERTC_StoreOperation_Reset ((uint32_t)0x00000000)
+#define ERTC_StoreOperation_Set ((uint32_t)0x00040000)
+#define IS_ERTC_STORE_OPERATION(OPERATION) (((OPERATION) == ERTC_StoreOperation_Reset) || \
+ ((OPERATION) == ERTC_StoreOperation_Set))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Tamper_Trigger_Definitions
+ * @{
+ */
+#define ERTC_TamperTrig_RisingEdge ((uint32_t)0x00000000)
+#define ERTC_TamperTrig_FallingEdge ((uint32_t)0x00000001)
+#define ERTC_TamperTrig_LowLevel ((uint32_t)0x00000000)
+#define ERTC_TamperTrig_HighLevel ((uint32_t)0x00000001)
+#define IS_ERTC_TAMPER_TRIG(TRIG) (((TRIG) == ERTC_TamperTrig_RisingEdge) || \
+ ((TRIG) == ERTC_TamperTrig_FallingEdge) || \
+ ((TRIG) == ERTC_TamperTrig_LowLevel) || \
+ ((TRIG) == ERTC_TamperTrig_HighLevel))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Tamper_Filter_Definitions
+ * @{
+ */
+#define ERTC_TamperFilter_Disable ((uint32_t)0x00000000) /*!< Tamper filter is disabled */
+
+#define ERTC_TamperFilter_2Sample ((uint32_t)0x00000800) /*!< Tamper is activated after 2
+ consecutive samples at the active level */
+#define ERTC_TamperFilter_4Sample ((uint32_t)0x00001000) /*!< Tamper is activated after 4
+ consecutive samples at the active level */
+#define ERTC_TamperFilter_8Sample ((uint32_t)0x00001800) /*!< Tamper is activated after 8
+ consecutive samples at the active level. */
+#define IS_ERTC_TAMPER_FILTER(FILTER) (((FILTER) == ERTC_TamperFilter_Disable) || \
+ ((FILTER) == ERTC_TamperFilter_2Sample) || \
+ ((FILTER) == ERTC_TamperFilter_4Sample) || \
+ ((FILTER) == ERTC_TamperFilter_8Sample))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Tamper_Sampling_Frequencies_Definitions
+ * @{
+ */
+#define ERTC_TamperSamplingFreq_CLK_Div32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled
+ with a frequency = RTCCLK / 32768 */
+#define ERTC_TamperSamplingFreq_CLK_Div16384 ((uint32_t)0x000000100) /*!< Each of the tamper inputs are sampled
+ with a frequency = RTCCLK / 16384 */
+#define ERTC_TamperSamplingFreq_CLK_Div8192 ((uint32_t)0x00000200) /*!< Each of the tamper inputs are sampled
+ with a frequency = RTCCLK / 8192 */
+#define ERTC_TamperSamplingFreq_CLK_Div4096 ((uint32_t)0x00000300) /*!< Each of the tamper inputs are sampled
+ with a frequency = RTCCLK / 4096 */
+#define ERTC_TamperSamplingFreq_CLK_Div2048 ((uint32_t)0x00000400) /*!< Each of the tamper inputs are sampled
+ with a frequency = RTCCLK / 2048 */
+#define ERTC_TamperSamplingFreq_CLK_Div1024 ((uint32_t)0x00000500) /*!< Each of the tamper inputs are sampled
+ with a frequency = RTCCLK / 1024 */
+#define ERTC_TamperSamplingFreq_CLK_Div512 ((uint32_t)0x00000600) /*!< Each of the tamper inputs are sampled
+ with a frequency = RTCCLK / 512 */
+#define ERTC_TamperSamplingFreq_CLK_Div256 ((uint32_t)0x00000700) /*!< Each of the tamper inputs are sampled
+ with a frequency = RTCCLK / 256 */
+#define IS_ERTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) ==ERTC_TamperSamplingFreq_CLK_Div32768) || \
+ ((FREQ) ==ERTC_TamperSamplingFreq_CLK_Div16384) || \
+ ((FREQ) ==ERTC_TamperSamplingFreq_CLK_Div8192) || \
+ ((FREQ) ==ERTC_TamperSamplingFreq_CLK_Div4096) || \
+ ((FREQ) ==ERTC_TamperSamplingFreq_CLK_Div2048) || \
+ ((FREQ) ==ERTC_TamperSamplingFreq_CLK_Div1024) || \
+ ((FREQ) ==ERTC_TamperSamplingFreq_CLK_Div512) || \
+ ((FREQ) ==ERTC_TamperSamplingFreq_CLK_Div256))
+
+/**
+ * @}
+ */
+
+ /** @defgroup RTC_Tamper_Pin_Precharge_Duration_Definitions
+ * @{
+ */
+#define ERTC_TamperPrechargeDuration_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before
+ sampling during 1 RTCCLK cycle */
+#define ERTC_TamperPrechargeDuration_2RTCCLK ((uint32_t)0x00002000) /*!< Tamper pins are pre-charged before
+ sampling during 2 RTCCLK cycles */
+#define ERTC_TamperPrechargeDuration_4RTCCLK ((uint32_t)0x00004000) /*!< Tamper pins are pre-charged before
+ sampling during 4 RTCCLK cycles */
+#define ERTC_TamperPrechargeDuration_8RTCCLK ((uint32_t)0x00006000) /*!< Tamper pins are pre-charged before
+ sampling during 8 RTCCLK cycles */
+
+#define IS_ERTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == ERTC_TamperPrechargeDuration_1RTCCLK) || \
+ ((DURATION) == ERTC_TamperPrechargeDuration_2RTCCLK) || \
+ ((DURATION) == ERTC_TamperPrechargeDuration_4RTCCLK) || \
+ ((DURATION) == ERTC_TamperPrechargeDuration_8RTCCLK))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Tamper_Pins_Definitions
+ * @{
+ */
+#define ERTC_TAMP_1 ERTC_TPAF_TM1E
+#define ERTC_TAMP_2 ERTC_TPAF_TM2E
+#define IS_ERTC_TAMP(TAMP) (((TAMP) == ERTC_TAMP_1) || ((TAMP) == ERTC_TAMP_2))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Tamper_Pin_Selection
+ * @{
+ */
+#define ERTC_TAMPPIN_Default ((uint32_t)0x00000000)
+#define ERTC_TAMPPIN_Pos1 ((uint32_t)0x00010000)
+#define IS_ERTC_TAMP_PIN(PIN) (((PIN) == ERTC_TAMPPIN_Default) || \
+ ((PIN) == ERTC_TAMPPIN_Pos1))
+/* Legacy Defines */
+#define ERTC_TAMPPIN_PC13 ERTC_TAMPPIN_Default
+#define ERTC_TAMPPIN_PI8 ERTC_TAMPPIN_Pos1
+/**
+ * @}
+ */
+
+/** @defgroup RTC_TimeStamp_Pin_Selection
+ * @{
+ */
+#define ERTC_TimeStampPin_PC13 ((uint32_t)0x00000000)
+#define ERTC_TimeStampPin_PI8 ((uint32_t)0x00020000)
+#define IS_ERTC_TIMESTAMP_PIN(PIN) (((PIN) == ERTC_TimeStampPin_PC13) || \
+ ((PIN) == ERTC_TimeStampPin_PI8))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Output_Type_ALARM_OUT
+ * @{
+ */
+#define ERTC_OutputType_OpenDrain ((uint32_t)0x00000000)
+#define ERTC_OutputType_PushPull ((uint32_t)0x00040000)
+#define IS_ERTC_OUTPUT_TYPE(TYPE) (((TYPE) == ERTC_OutputType_OpenDrain) || \
+ ((TYPE) == ERTC_OutputType_PushPull))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Add_1_Second_Parameter_Definitions
+ * @{
+ */
+#define ERTC_ShiftAdd1S_Reset ((uint32_t)0x00000000)
+#define ERTC_ShiftAdd1S_Set ((uint32_t)0x80000000)
+#define IS_ERTC_SHIFT_ADD1S(SEL) (((SEL) == ERTC_ShiftAdd1S_Reset) || \
+ ((SEL) == ERTC_ShiftAdd1S_Set))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Substract_Fraction_Of_Second_Value
+ * @{
+ */
+#define IS_ERTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Backup_Registers_Definitions
+ * @{
+ */
+
+#define ERTC_BKP_DT0 ((uint32_t)0x00000000)
+#define ERTC_BKP_DT1 ((uint32_t)0x00000001)
+#define ERTC_BKP_DT2 ((uint32_t)0x00000002)
+#define ERTC_BKP_DT3 ((uint32_t)0x00000003)
+#define ERTC_BKP_DT4 ((uint32_t)0x00000004)
+#define ERTC_BKP_DT5 ((uint32_t)0x00000005)
+#define ERTC_BKP_DT6 ((uint32_t)0x00000006)
+#define ERTC_BKP_DT7 ((uint32_t)0x00000007)
+#define ERTC_BKP_DT8 ((uint32_t)0x00000008)
+#define ERTC_BKP_DT9 ((uint32_t)0x00000009)
+#define ERTC_BKP_DT10 ((uint32_t)0x0000000A)
+#define ERTC_BKP_DT11 ((uint32_t)0x0000000B)
+#define ERTC_BKP_DT12 ((uint32_t)0x0000000C)
+#define ERTC_BKP_DT13 ((uint32_t)0x0000000D)
+#define ERTC_BKP_DT14 ((uint32_t)0x0000000E)
+#define ERTC_BKP_DT15 ((uint32_t)0x0000000F)
+#define ERTC_BKP_DT16 ((uint32_t)0x00000010)
+#define ERTC_BKP_DT17 ((uint32_t)0x00000011)
+#define ERTC_BKP_DT18 ((uint32_t)0x00000012)
+#define ERTC_BKP_DT19 ((uint32_t)0x00000013)
+#define IS_ERTC_BKP(BKP) (((BKP) == ERTC_BKP_DT0) || \
+ ((BKP) == ERTC_BKP_DT1) || \
+ ((BKP) == ERTC_BKP_DT2) || \
+ ((BKP) == ERTC_BKP_DT3) || \
+ ((BKP) == ERTC_BKP_DT4) || \
+ ((BKP) == ERTC_BKP_DT5) || \
+ ((BKP) == ERTC_BKP_DT6) || \
+ ((BKP) == ERTC_BKP_DT7) || \
+ ((BKP) == ERTC_BKP_DT8) || \
+ ((BKP) == ERTC_BKP_DT9) || \
+ ((BKP) == ERTC_BKP_DT10) || \
+ ((BKP) == ERTC_BKP_DT11) || \
+ ((BKP) == ERTC_BKP_DT12) || \
+ ((BKP) == ERTC_BKP_DT13) || \
+ ((BKP) == ERTC_BKP_DT14) || \
+ ((BKP) == ERTC_BKP_DT15) || \
+ ((BKP) == ERTC_BKP_DT16) || \
+ ((BKP) == ERTC_BKP_DT17) || \
+ ((BKP) == ERTC_BKP_DT18) || \
+ ((BKP) == ERTC_BKP_DT19))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Input_parameter_format_definitions
+ * @{
+ */
+#define ERTC_Format_BIN ((uint32_t)0x000000000)
+#define ERTC_Format_BCD ((uint32_t)0x000000001)
+#define IS_ERTC_FORMAT(FORMAT) (((FORMAT) == ERTC_Format_BIN) || ((FORMAT) == ERTC_Format_BCD))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Flags_Definitions
+ * @{
+ */
+#define ERTC_FLAG_RECALPDF ((uint32_t)0x00010000)
+#define ERTC_FLAG_TP1F ((uint32_t)0x00002000)
+#define ERTC_FLAG_TP2F ((uint32_t)0x00004000)
+#define ERTC_FLAG_TSOF ((uint32_t)0x00001000)
+#define ERTC_FLAG_TSF ((uint32_t)0x00000800)
+#define ERTC_FLAG_WATF ((uint32_t)0x00000400)
+#define ERTC_FLAG_ALBF ((uint32_t)0x00000200)
+#define ERTC_FLAG_ALAF ((uint32_t)0x00000100)
+#define ERTC_FLAG_INITF ((uint32_t)0x00000040)
+#define ERTC_FLAG_RSF ((uint32_t)0x00000020)
+#define ERTC_FLAG_INITS ((uint32_t)0x00000010)
+#define ERTC_FLAG_SFP ((uint32_t)0x00000008)
+#define ERTC_FLAG_WATWF ((uint32_t)0x00000004)
+#define ERTC_FLAG_ALBWF ((uint32_t)0x00000002)
+#define ERTC_FLAG_ALAWF ((uint32_t)0x00000001)
+#define IS_ERTC_GET_FLAG(FLAG) (((FLAG) == ERTC_FLAG_TSOF) || ((FLAG) == ERTC_FLAG_TSF) || \
+ ((FLAG) == ERTC_FLAG_WATF) || ((FLAG) == ERTC_FLAG_ALBF) || \
+ ((FLAG) == ERTC_FLAG_ALAF) || ((FLAG) == ERTC_FLAG_INITF) || \
+ ((FLAG) == ERTC_FLAG_RSF) || ((FLAG) == ERTC_FLAG_WATWF) || \
+ ((FLAG) == ERTC_FLAG_ALBWF) || ((FLAG) == ERTC_FLAG_ALAWF) || \
+ ((FLAG) == ERTC_FLAG_TP1F) || ((FLAG) == ERTC_FLAG_RECALPDF) || \
+ ((FLAG) == ERTC_FLAG_TP2F) ||((FLAG) == ERTC_FLAG_SFP))
+#define IS_ERTC_CLEAR_FLAG(FLAG) (((FLAG) != (uint32_t)RESET) && (((FLAG) & 0xFFFF00DF) == (uint32_t)RESET))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Interrupts_Definitions
+ * @{
+ */
+#define ERTC_INT_TS ((uint32_t)0x00008000)
+#define ERTC_INT_WAT ((uint32_t)0x00004000)
+#define ERTC_INT_ALB ((uint32_t)0x00002000)
+#define ERTC_INT_ALA ((uint32_t)0x00001000)
+#define ERTC_INT_TAMP ((uint32_t)0x00000004) /* Used only to Enable the Tamper Interrupt */
+#define ERTC_INT_TAMP1 ((uint32_t)0x00020000)
+#define ERTC_INT_TAMP2 ((uint32_t)0x00040000)
+
+#define IS_ERTC_CONFIG_INT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFFF0FFB) == (uint32_t)RESET))
+#define IS_ERTC_GET_INT(IT) (((IT) == ERTC_INT_TS) || ((IT) == ERTC_INT_WAT) || \
+ ((IT) == ERTC_INT_ALB) || ((IT) == ERTC_INT_ALA) || \
+ ((IT) == ERTC_INT_TAMP1) || ((IT) == ERTC_INT_TAMP2))
+#define IS_ERTC_CLEAR_INT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFF90FFF) == (uint32_t)RESET))
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Legacy
+ * @{
+ */
+#define ERTC_DigitalCalConfig ERTC_CoarseCalConfig
+#define ERTC_DigitalCalCmd ERTC_CoarseCalCmd
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/* Exported macro ------------------------------------------------------------*/
+/* Exported functions --------------------------------------------------------*/
+
+/* Function used to set the ERTC configuration to the default reset state *****/
+ErrorStatus ERTC_Reset(void);
+
+/* Initialization and Configuration functions *********************************/
+ErrorStatus ERTC_Init(ERTC_InitType* ERTC_InitStruct);
+void ERTC_StructInit(ERTC_InitType* ERTC_InitStruct);
+void ERTC_WriteProtectionCmd(FunctionalState NewState);
+ErrorStatus ERTC_EnterInitMode(void);
+void ERTC_ExitInitMode(void);
+ErrorStatus ERTC_WaitForSynchro(void);
+ErrorStatus ERTC_RefClockCmd(FunctionalState NewState);
+void ERTC_BypassShadowCmd(FunctionalState NewState);
+
+/* Time and Date configuration functions **************************************/
+ErrorStatus ERTC_SetTimeValue(uint32_t ERTC_Format, ERTC_TimeType* ERTC_TimeStruct);
+void ERTC_TimeStructInit(ERTC_TimeType* ERTC_TimeStruct);
+void ERTC_GetTimeValue(uint32_t ERTC_Format, ERTC_TimeType* ERTC_TimeStruct);
+uint32_t ERTC_GetSubSecondValue(void);
+ErrorStatus ERTC_SetDateValue(uint32_t ERTC_Format, ERTC_DateType* ERTC_DateStruct);
+void ERTC_DateStructInit(ERTC_DateType* ERTC_DateStruct);
+void ERTC_GetDateValue(uint32_t ERTC_Format, ERTC_DateType* ERTC_DateStruct);
+
+/* Alarms (Alarm A and Alarm B) configuration functions **********************/
+void ERTC_SetAlarmValue(uint32_t ERTC_Format, uint32_t ERTC_Alarm, ERTC_AlarmType* ERTC_AlarmStruct);
+void ERTC_AlarmStructInit(ERTC_AlarmType* ERTC_AlarmStruct);
+void ERTC_GetAlarmValue(uint32_t ERTC_Format, uint32_t ERTC_Alarm, ERTC_AlarmType* ERTC_AlarmStruct);
+ErrorStatus ERTC_AlarmCmd(uint32_t ERTC_Alarm, FunctionalState NewState);
+void ERTC_AlarmSubSecondConfig(uint32_t ERTC_Alarm, uint32_t ERTC_AlarmSubSecondValue, uint32_t ERTC_AlarmSubSecondMask);
+uint32_t ERTC_GetAlarmSubSecond(uint32_t ERTC_Alarm);
+
+/* WakeUp Timer configuration functions ***************************************/
+void ERTC_WakeUpClockConfig(uint32_t ERTC_WakeUpClock);
+void ERTC_SetWakeUpCounter(uint32_t ERTC_WakeUpCounter);
+uint32_t ERTC_GetWakeUpCounter(void);
+ErrorStatus ERTC_WakeUpCmd(FunctionalState NewState);
+
+/* Daylight Saving configuration functions ************************************/
+void ERTC_DayLightSavingConfig(uint32_t ERTC_DayLightSaving, uint32_t ERTC_StoreOperation);
+uint32_t ERTC_GetStoreOperation(void);
+
+/* Output pin Configuration function ******************************************/
+void ERTC_OutputConfig(uint32_t ERTC_Output, uint32_t ERTC_OutputPolarity);
+
+/* Digital Calibration configuration functions *********************************/
+ErrorStatus ERTC_CoarseCalConfig(uint32_t ERTC_CalSign, uint32_t Value);
+ErrorStatus ERTC_CoarseCalCmd(FunctionalState NewState);
+void ERTC_CalOutputCmd(FunctionalState NewState);
+void ERTC_CalOutputConfig(uint32_t ERTC_CalOutput);
+ErrorStatus ERTC_SmoothCalConfig(uint32_t ERTC_SmoothCalPeriod,
+ uint32_t ERTC_SmoothCalPlusPulses,
+ uint32_t ERTC_SmouthCalMinusPulsesValue);
+
+/* TimeStamp configuration functions ******************************************/
+void ERTC_TimeStampCmd(uint32_t ERTC_TimeStampEdge, FunctionalState NewState);
+void ERTC_GetTimeStamp(uint32_t ERTC_Format, ERTC_TimeType* ERTC_StampTimeStruct,
+ ERTC_DateType* ERTC_StampDateStruct);
+uint32_t ERTC_GetTimeStampSubSecond(void);
+
+/* Tampers configuration functions ********************************************/
+void ERTC_TamperTriggerConfig(uint32_t ERTC_Tamper, uint32_t ERTC_TamperTrigger);
+void ERTC_TamperCmd(uint32_t ERTC_Tamper, FunctionalState NewState);
+void ERTC_TamperFilterConfig(uint32_t ERTC_TamperFilter);
+void ERTC_TamperSamplingFreqConfig(uint32_t ERTC_TamperSamplingFreq);
+void ERTC_TamperPinsPrechargeDuration(uint32_t ERTC_TamperPrechargeDuration);
+void ERTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState);
+void ERTC_TamperPullUpCmd(FunctionalState NewState);
+
+/* Backup Data Registers configuration functions ******************************/
+void ERTC_WriteBackupRegister(uint32_t ERTC_BKP_DT, uint32_t Data);
+uint32_t ERTC_ReadBackupRegister(uint32_t ERTC_BKP_DT);
+
+/* ERTC Tamper and TimeStamp Pins Selection and Output Type Config configuration
+ functions ******************************************************************/
+void ERTC_TamperPinSelection(uint32_t ERTC_TamperPin);
+void ERTC_TimeStampPinSelection(uint32_t ERTC_TimeStampPin);
+void ERTC_OutputTypeConfig(uint32_t ERTC_OutputType);
+
+/* RTC_Shift_control_synchonisation_functions *********************************/
+ErrorStatus ERTC_SynchroShiftConfig(uint32_t ERTC_ShiftAdd1S, uint32_t ERTC_ShiftSubFS);
+
+/* Interrupts and flags management functions **********************************/
+void ERTC_INTConfig(uint32_t ERTC_INT, FunctionalState NewState);
+FlagStatus ERTC_GetFlagStatus(uint32_t ERTC_FLAG);
+void ERTC_ClearFlag(uint32_t ERTC_FLAG);
+ITStatus ERTC_GetINTStatus(uint32_t ERTC_INT);
+void ERTC_ClearINTPendingBINT(uint32_t ERTC_INT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__AT32F4xx_RCC_H */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_eth.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_eth.h
new file mode 100644
index 0000000000000000000000000000000000000000..8d1b799baa9fde07bb21cb5aace1890b419f328a
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_eth.h
@@ -0,0 +1,1735 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_eth.h
+ * Description : at32f4xx ETH header file
+ * Date : 2019-12-16
+ * Version : V1.0.0
+ **************************************************************************
+ */
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_ETH_H
+#define __AT32F4xx_ETH_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup ETH_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief ETH MAC Init structure definition
+ * @note The user should not configure all the ETH_InitType structure's fields.
+ * By calling the ETH_StructInit function the structures fields are set to their default values.
+ * Only the parameters that will be set to a non-default value should be configured.
+ */
+typedef struct {
+/**
+ * @brief / * MAC
+ */
+ uint32_t ETH_AutoNegotiation; /*!< Selects or not the AutoNegotiation mode for the external PHY
+ The AutoNegotiation allows an automatic setting of the Speed (10/100Mbps)
+ and the mode (half/full-duplex).
+ This parameter can be a value of @ref ETH_AutoNegotiation */
+
+ uint32_t ETH_Watchdog; /*!< Selects or not the Watchdog timer
+ When enabled, the MAC allows no more then 2048 bytes to be received.
+ When disabled, the MAC can receive up to 16384 bytes.
+ This parameter can be a value of @ref ETH_watchdog */
+
+ uint32_t ETH_Jabber; /*!< Selects or not Jabber timer
+ When enabled, the MAC allows no more then 2048 bytes to be sent.
+ When disabled, the MAC can send up to 16384 bytes.
+ This parameter can be a value of @ref ETH_Jabber */
+
+ uint32_t ETH_InterFrameGap; /*!< Selects the minimum IFG between frames during transmission
+ This parameter can be a value of @ref ETH_Inter_Frame_Gap */
+
+ uint32_t ETH_CarrierSense; /*!< Selects or not the Carrier Sense
+ This parameter can be a value of @ref ETH_Carrier_Sense */
+
+ uint32_t ETH_Speed; /*!< Sets the Ethernet speed: 10/100 Mbps
+ This parameter can be a value of @ref ETH_Speed */
+
+ uint32_t ETH_ReceiveOwn; /*!< Selects or not the ReceiveOwn
+ ReceiveOwn allows the reception of frames when the TX_EN signal is asserted
+ in Half-Duplex mode
+ This parameter can be a value of @ref ETH_Receive_Own */
+
+ uint32_t ETH_LoopbackMode; /*!< Selects or not the internal MAC MII Loopback mode
+ This parameter can be a value of @ref ETH_Loop_Back_Mode */
+
+ uint32_t ETH_Mode; /*!< Selects the MAC duplex mode: Half-Duplex or Full-Duplex mode
+ This parameter can be a value of @ref ETH_Duplex_Mode */
+
+ uint32_t ETH_ChecksumOffload; /*!< Selects or not the IPv4 checksum checking for received frame payloads' TCP/UDP/ICMP headers.
+ This parameter can be a value of @ref ETH_Checksum_Offload */
+
+ uint32_t ETH_RetryTransmission; /*!< Selects or not the MAC attempt retries transmission, based on the settings of BL,
+ when a colision occurs (Half-Duplex mode)
+ This parameter can be a value of @ref ETH_Retry_Transmission */
+
+ uint32_t ETH_AutomaticPadCRCStrip; /*!< Selects or not the Automatic MAC Pad/CRC Stripping
+ This parameter can be a value of @ref ETH_Automatic_Pad_CRC_Strip */
+
+ uint32_t ETH_BackOffLimit; /*!< Selects the BackOff limit value
+ This parameter can be a value of @ref ETH_Back_Off_Limit */
+
+ uint32_t ETH_DeferralCheck; /*!< Selects or not the deferral check function (Half-Duplex mode)
+ This parameter can be a value of @ref ETH_Deferral_Check */
+
+ uint32_t ETH_ReceiveAll; /*!< Selects or not all frames reception by the MAC (No fitering)
+ This parameter can be a value of @ref ETH_Receive_All */
+
+ uint32_t ETH_SourceAddrFilter; /*!< Selects the Source Address Filter mode
+ This parameter can be a value of @ref ETH_Source_Addr_Filter */
+
+ uint32_t ETH_PassControlFrames; /*!< Sets the forwarding mode of the control frames (including unicast and multicast PAUSE frames)
+ This parameter can be a value of @ref ETH_Pass_Control_Frames */
+
+ uint32_t ETH_BroadcastFramesReception; /*!< Selects or not the reception of Broadcast Frames
+ This parameter can be a value of @ref ETH_Broadcast_Frames_Reception */
+
+ uint32_t ETH_DestinationAddrFilter; /*!< Sets the destination filter mode for both unicast and multicast frames
+ This parameter can be a value of @ref ETH_Destination_Addr_Filter */
+
+ uint32_t ETH_PromiscuousMode; /*!< Selects or not the Promiscuous Mode
+ This parameter can be a value of @ref ETH_Promiscuous_Mode */
+
+ uint32_t ETH_MulticastFramesFilter; /*!< Selects the Multicast Frames filter mode: None/HashTableFilter/PerfectFilter/PerfectHashTableFilter
+ This parameter can be a value of @ref ETH_Multicast_Frames_Filter */
+
+ uint32_t ETH_UnicastFramesFilter; /*!< Selects the Unicast Frames filter mode: HashTableFilter/PerfectFilter/PerfectHashTableFilter
+ This parameter can be a value of @ref ETH_Unicast_Frames_Filter */
+
+ uint32_t ETH_HashTableHigh; /*!< This field holds the higher 32 bits of Hash table. */
+
+ uint32_t ETH_HashTableLow; /*!< This field holds the lower 32 bits of Hash table. */
+
+ uint32_t ETH_PauseTime; /*!< This field holds the value to be used in the Pause Time field in the
+ transmit control frame */
+
+ uint32_t ETH_ZeroQuantaPause; /*!< Selects or not the automatic generation of Zero-Quanta Pause Control frames
+ This parameter can be a value of @ref ETH_Zero_Quanta_Pause */
+
+ uint32_t ETH_PauseLowThreshold; /*!< This field configures the threshold of the PAUSE to be checked for
+ automatic retransmission of PAUSE Frame
+ This parameter can be a value of @ref ETH_Pause_Low_Threshold */
+
+ uint32_t ETH_UnicastPauseFrameDetect; /*!< Selects or not the MAC detection of the Pause frames (with MAC Address0
+ unicast address and unique multicast address)
+ This parameter can be a value of @ref ETH_Unicast_Pause_Frame_Detect */
+
+ uint32_t ETH_ReceiveFlowControl; /*!< Enables or disables the MAC to decode the received Pause frame and
+ disable its transmitter for a specified time (Pause Time)
+ This parameter can be a value of @ref ETH_Receive_Flow_Control */
+
+ uint32_t ETH_TransmitFlowControl; /*!< Enables or disables the MAC to transmit Pause frames (Full-Duplex mode)
+ or the MAC back-pressure operation (Half-Duplex mode)
+ This parameter can be a value of @ref ETH_Transmit_Flow_Control */
+
+ uint32_t ETH_VLANTagComparison; /*!< Selects the 12-bit VLAN identifier or the complete 16-bit VLAN tag for
+ comparison and filtering
+ This parameter can be a value of @ref ETH_VLAN_Tag_Comparison */
+
+ uint32_t ETH_VLANTagIdentifier; /*!< Holds the VLAN tag identifier for receive frames */
+
+/**
+ * @brief / * DMA
+ */
+
+ uint32_t ETH_DropTCPIPChecksumErrorFrame; /*!< Selects or not the Dropping of TCP/IP Checksum Error Frames
+ This parameter can be a value of @ref ETH_Drop_TCP_IP_Checksum_Error_Frame */
+
+ uint32_t ETH_ReceiveStoreForward; /*!< Enables or disables the Receive store and forward mode
+ This parameter can be a value of @ref ETH_Receive_Store_Forward */
+
+ uint32_t ETH_FlushReceivedFrame; /*!< Enables or disables the flushing of received frames
+ This parameter can be a value of @ref ETH_Flush_Received_Frame */
+
+ uint32_t ETH_TransmitStoreForward; /*!< Enables or disables Transmit store and forward mode
+ This parameter can be a value of @ref ETH_Transmit_Store_Forward */
+
+ uint32_t ETH_TransmitThresholdControl; /*!< Selects or not the Transmit Threshold Control
+ This parameter can be a value of @ref ETH_Transmit_Threshold_Control */
+
+ uint32_t ETH_ForwardErrorFrames; /*!< Selects or not the forward to the DMA of erroneous frames
+ This parameter can be a value of @ref ETH_Forward_Error_Frames */
+
+ uint32_t ETH_ForwardUndersizedGoodFrames; /*!< Enables or disables the Rx FIFO to forward Undersized frames (frames with no Error
+ and length less than 64 bytes) including pad-bytes and CRC)
+ This parameter can be a value of @ref ETH_Forward_Undersized_Good_Frames */
+
+ uint32_t ETH_ReceiveThresholdControl; /*!< Selects the threshold level of the Receive FIFO
+ This parameter can be a value of @ref ETH_Receive_Threshold_Control */
+
+ uint32_t ETH_SecondFrameOperate; /*!< Selects or not the Operate on second frame mode, which allows the DMA to process a second
+ frame of Transmit data even before obtaining the status for the first frame.
+ This parameter can be a value of @ref ETH_Second_Frame_Operate */
+
+ uint32_t ETH_AddressAlignedBeats; /*!< Enables or disables the Address Aligned Beats
+ This parameter can be a value of @ref ETH_Address_Aligned_Beats */
+
+ uint32_t ETH_FixedBurst; /*!< Enables or disables the AHB Master interface fixed burst transfers
+ This parameter can be a value of @ref ETH_Fixed_Burst */
+
+ uint32_t ETH_RxDMABurstLength; /*!< Indicates the maximum number of beats to be transferred in one Rx DMA transaction
+ This parameter can be a value of @ref ETH_Rx_DMA_Burst_Length */
+
+ uint32_t ETH_TxDMABurstLength; /*!< Indicates sthe maximum number of beats to be transferred in one Tx DMA transaction
+ This parameter can be a value of @ref ETH_Tx_DMA_Burst_Length */
+
+ uint32_t ETH_DescriptorSkipLength; /*!< Specifies the number of word to skip between two unchained descriptors (Ring mode) */
+
+ uint32_t ETH_DMAArbitration; /*!< Selects the DMA Tx/Rx arbitration
+ This parameter can be a value of @ref ETH_DMA_Arbitration */
+}ETH_InitType;
+
+/**--------------------------------------------------------------------------**/
+/**
+ * @brief DMA descriptors types
+ */
+/**--------------------------------------------------------------------------**/
+
+/**
+ * @brief ETH DMA Desciptors data structure definition
+ */
+typedef struct {
+ uint32_t Status; /*!< Status */
+ uint32_t ControlBufferSize; /*!< Control and Buffer1, Buffer2 lengths */
+ uint32_t Buffer1Addr; /*!< Buffer1 address pointer */
+ uint32_t Buffer2NextDescAddr; /*!< Buffer2 or next descriptor address pointer */
+} ETH_DMADESCTypeDef;
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Exported_Constants
+ * @{
+ */
+
+/**
+ * @brief Uncomment the line below if you want to use user defined Delay function
+ * (for precise timing), otherwise default _eth_delay_ function defined within
+ * this driver is used (less precise timing).
+ */
+/* #define USE_Delay */
+
+#ifdef USE_Delay
+#include "main.h"
+ #define _eth_delay_ Delay /*!< User can provide more timing precise _eth_delay_ function */
+#else
+ #define _eth_delay_ ETH_Delay /*!< Default _eth_delay_ function with less precise timing */
+#endif
+
+/**--------------------------------------------------------------------------**/
+/**
+ * @brief ETH Frames defines
+ */
+/**--------------------------------------------------------------------------**/
+
+/** @defgroup ENET_Buffers_setting
+ * @{
+ */
+#define ETH_MAX_PACKET_SIZE 1520 /*!< ETH_HEADER + ETH_EXTRA + MAX_ETH_PAYLOAD + ETH_CRC */
+#define ETH_HEADER 14 /*!< 6 byte Dest addr, 6 byte Src addr, 2 byte length/ept_type */
+#define ETH_CRC 4 /*!< Ethernet CRC */
+#define ETH_EXTRA 2 /*!< Extra bytes in some cases */
+#define VLAN_TAG 4 /*!< optional 802.1q VLAN Tag */
+#define MIN_ETH_PAYLOAD 46 /*!< Minimum Ethernet payload size */
+#define MAX_ETH_PAYLOAD 1500 /*!< Maximum Ethernet payload size */
+#define JUMBO_FRAME_PAYLOAD 9000 /*!< Jumbo frame payload size */
+
+/**--------------------------------------------------------------------------**/
+/**
+ * @brief Ethernet DMA descriptors registers bits definition
+ */
+/**--------------------------------------------------------------------------**/
+
+/**
+@code
+ DMA Tx Desciptor
+ -----------------------------------------------------------------------------------------------
+ TDES0 | OWN(31) | CTRL[30:26] | Reserved[25:24] | CTRL[23:20] | Reserved[19:17] | Status[16:0] |
+ -----------------------------------------------------------------------------------------------
+ TDES1 | Reserved[31:29] | Buffer2 ByteCount[28:16] | Reserved[15:13] | Buffer1 ByteCount[12:0] |
+ -----------------------------------------------------------------------------------------------
+ TDES2 | Buffer1 Address [31:0] |
+ -----------------------------------------------------------------------------------------------
+ TDES3 | Buffer2 Address [31:0] / Next Desciptor Address [31:0] |
+ -----------------------------------------------------------------------------------------------
+@endcode
+*/
+
+/**
+ * @brief Bit definition of TDES0 register: DMA Tx descriptor status register
+ */
+#define ETH_DMATxDesc_OWN ((uint32_t)0x80000000) /*!< OWN bit: descriptor is owned by DMA engine */
+#define ETH_DMATxDesc_IC ((uint32_t)0x40000000) /*!< Interrupt on Completion */
+#define ETH_DMATxDesc_LS ((uint32_t)0x20000000) /*!< Last Segment */
+#define ETH_DMATxDesc_FS ((uint32_t)0x10000000) /*!< First Segment */
+#define ETH_DMATxDesc_DC ((uint32_t)0x08000000) /*!< Disable CRC */
+#define ETH_DMATxDesc_DP ((uint32_t)0x04000000) /*!< Disable Padding */
+#define ETH_DMATxDesc_TTSE ((uint32_t)0x02000000) /*!< Transmit Time Stamp Enable */
+#define ETH_DMATxDesc_CIC ((uint32_t)0x00C00000) /*!< Checksum Insertion Control: 4 cases */
+#define ETH_DMATxDesc_CIC_ByPass ((uint32_t)0x00000000) /*!< Do Nothing: Checksum Engine is bypassed */
+#define ETH_DMATxDesc_CIC_IPV4Header ((uint32_t)0x00400000) /*!< IPV4 header Checksum Insertion */
+#define ETH_DMATxDesc_CIC_TCPUDPICMP_Segment ((uint32_t)0x00800000) /*!< TCP/UDP/ICMP Checksum Insertion calculated over segment only */
+#define ETH_DMATxDesc_CIC_TCPUDPICMP_Full ((uint32_t)0x00C00000) /*!< TCP/UDP/ICMP Checksum Insertion fully calculated */
+#define ETH_DMATxDesc_TER ((uint32_t)0x00200000) /*!< Transmit End of Ring */
+#define ETH_DMATxDesc_TCH ((uint32_t)0x00100000) /*!< Second Address Chained */
+#define ETH_DMATxDesc_TTSS ((uint32_t)0x00020000) /*!< Tx Time Stamp Status */
+#define ETH_DMATxDesc_IHE ((uint32_t)0x00010000) /*!< IP Header Error */
+#define ETH_DMATxDesc_ES ((uint32_t)0x00008000) /*!< Error summary: OR of the following bits: UE || ED || EC || LCO || NC || LCA || FF || JT */
+#define ETH_DMATxDesc_JT ((uint32_t)0x00004000) /*!< Jabber Timeout */
+#define ETH_DMATxDesc_FF ((uint32_t)0x00002000) /*!< Frame Flushed: DMA/MTL flushed the frame due to SW flush */
+#define ETH_DMATxDesc_PCE ((uint32_t)0x00001000) /*!< Payload Checksum Error */
+#define ETH_DMATxDesc_LCA ((uint32_t)0x00000800) /*!< Loss of Carrier: carrier lost during tramsmission */
+#define ETH_DMATxDesc_NC ((uint32_t)0x00000400) /*!< No Carrier: no carrier signal from the tranceiver */
+#define ETH_DMATxDesc_LCO ((uint32_t)0x00000200) /*!< Late Collision: transmission aborted due to collision */
+#define ETH_DMATxDesc_EC ((uint32_t)0x00000100) /*!< Excessive Collision: transmission aborted after 16 collisions */
+#define ETH_DMATxDesc_VF ((uint32_t)0x00000080) /*!< VLAN Frame */
+#define ETH_DMATxDesc_CC ((uint32_t)0x00000078) /*!< Collision Count */
+#define ETH_DMATxDesc_ED ((uint32_t)0x00000004) /*!< Excessive Deferral */
+#define ETH_DMATxDesc_UF ((uint32_t)0x00000002) /*!< Underflow Error: late data arrival from the memory */
+#define ETH_DMATxDesc_DB ((uint32_t)0x00000001) /*!< Deferred Bit */
+
+/**
+ * @brief Bit definition of TDES1 register
+ */
+#define ETH_DMATxDesc_TBS2 ((uint32_t)0x1FFF0000) /*!< Transmit Buffer2 Size */
+#define ETH_DMATxDesc_TBS1 ((uint32_t)0x00001FFF) /*!< Transmit Buffer1 Size */
+
+/**
+ * @brief Bit definition of TDES2 register
+ */
+#define ETH_DMATxDesc_B1AP ((uint32_t)0xFFFFFFFF) /*!< Buffer1 Address Pointer */
+
+/**
+ * @brief Bit definition of TDES3 register
+ */
+#define ETH_DMATxDesc_B2AP ((uint32_t)0xFFFFFFFF) /*!< Buffer2 Address Pointer */
+
+/**
+ * @}
+ */
+
+
+/** @defgroup DMA_Rx_descriptor
+ * @{
+ */
+
+/**
+@code
+ DMA Rx Desciptor
+ --------------------------------------------------------------------------------------------------------------------
+ RDES0 | OWN(31) | Status [30:0] |
+ ---------------------------------------------------------------------------------------------------------------------
+ RDES1 | CTRL(31) | Reserved[30:29] | Buffer2 ByteCount[28:16] | CTRL[15:14] | Reserved(13) | Buffer1 ByteCount[12:0] |
+ ---------------------------------------------------------------------------------------------------------------------
+ RDES2 | Buffer1 Address [31:0] |
+ ---------------------------------------------------------------------------------------------------------------------
+ RDES3 | Buffer2 Address [31:0] / Next Desciptor Address [31:0] |
+ ---------------------------------------------------------------------------------------------------------------------
+@endcode
+*/
+
+/**
+ * @brief Bit definition of RDES0 register: DMA Rx descriptor status register
+ */
+#define ETH_DMARxDesc_OWN ((uint32_t)0x80000000) /*!< OWN bit: descriptor is owned by DMA engine */
+#define ETH_DMARxDesc_AFM ((uint32_t)0x40000000) /*!< DA Filter Fail for the rx frame */
+#define ETH_DMARxDesc_FL ((uint32_t)0x3FFF0000) /*!< Receive descriptor frame length */
+#define ETH_DMARxDesc_ES ((uint32_t)0x00008000) /*!< Error summary: OR of the following bits: DE || OE || IPC || LC || RWT || RE || CE */
+#define ETH_DMARxDesc_DE ((uint32_t)0x00004000) /*!< Desciptor error: no more descriptors for receive frame */
+#define ETH_DMARxDesc_SAF ((uint32_t)0x00002000) /*!< SA Filter Fail for the received frame */
+#define ETH_DMARxDesc_LE ((uint32_t)0x00001000) /*!< Frame size not matching with length field */
+#define ETH_DMARxDesc_OE ((uint32_t)0x00000800) /*!< Overflow Error: Frame was damaged due to buffer overflow */
+#define ETH_DMARxDesc_VLAN ((uint32_t)0x00000400) /*!< VLAN Tag: received frame is a VLAN frame */
+#define ETH_DMARxDesc_FS ((uint32_t)0x00000200) /*!< First descriptor of the frame */
+#define ETH_DMARxDesc_LS ((uint32_t)0x00000100) /*!< Last descriptor of the frame */
+#define ETH_DMARxDesc_IPV4HCE ((uint32_t)0x00000080) /*!< IPC Checksum Error: Rx Ipv4 header checksum error */
+#define ETH_DMARxDesc_LC ((uint32_t)0x00000040) /*!< Late collision occurred during reception */
+#define ETH_DMARxDesc_FT ((uint32_t)0x00000020) /*!< Frame ept_type - Ethernet, otherwise 802.3 */
+#define ETH_DMARxDesc_RWT ((uint32_t)0x00000010) /*!< Receive Watchdog Timeout: watchdog timer expired during reception */
+#define ETH_DMARxDesc_RE ((uint32_t)0x00000008) /*!< Receive error: error reported by MII interface */
+#define ETH_DMARxDesc_DBE ((uint32_t)0x00000004) /*!< Dribble bit error: frame contains non int multiple of 8 bits */
+#define ETH_DMARxDesc_CE ((uint32_t)0x00000002) /*!< CRC error */
+#define ETH_DMARxDesc_MAMPCE ((uint32_t)0x00000001) /*!< Rx MAC Address/Payload Checksum Error: Rx MAC address matched/ Rx Payload Checksum Error */
+
+/**
+ * @brief Bit definition of RDES1 register
+ */
+#define ETH_DMARxDesc_DIC ((uint32_t)0x80000000) /*!< Disable Interrupt on Completion */
+#define ETH_DMARxDesc_RBS2 ((uint32_t)0x1FFF0000) /*!< Receive Buffer2 Size */
+#define ETH_DMARxDesc_RER ((uint32_t)0x00008000) /*!< Receive End of Ring */
+#define ETH_DMARxDesc_RCH ((uint32_t)0x00004000) /*!< Second Address Chained */
+#define ETH_DMARxDesc_RBS1 ((uint32_t)0x00001FFF) /*!< Receive Buffer1 Size */
+
+/**
+ * @brief Bit definition of RDES2 register
+ */
+#define ETH_DMARxDesc_B1AP ((uint32_t)0xFFFFFFFF) /*!< Buffer1 Address Pointer */
+
+/**
+ * @brief Bit definition of RDES3 register
+ */
+#define ETH_DMARxDesc_B2AP ((uint32_t)0xFFFFFFFF) /*!< Buffer2 Address Pointer */
+
+/**--------------------------------------------------------------------------**/
+/**
+ * @brief Desciption of common PHY registers
+ */
+/**--------------------------------------------------------------------------**/
+
+/**
+ * @}
+ */
+
+/** @defgroup PHY_Read_write_Timeouts
+ * @{
+ */
+#define PHY_READ_TO ((uint32_t)0x00FFFFFF)
+#define PHY_WRITE_TO ((uint32_t)0x00FFFFFF)
+
+
+/**
+ * @}
+ */
+
+/** @defgroup PHY_Reset_Delay
+ * @{
+ */
+#define PHY_ResetDelay ((uint32_t)0x000FFFFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup PHY_Config_Delay
+ * @{
+ */
+#define PHY_ConfigDelay ((uint32_t)0x00FFFFFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup PHY_Register_address
+ * @{
+ */
+#define PHY_BCR 0 /*!< Tranceiver Basic Control Register */
+#define PHY_BSR 1 /*!< Tranceiver Basic Status Register */
+
+/**
+ * @}
+ */
+
+/** @defgroup PHY_basic_Control_register
+ * @{
+ */
+#define PHY_Reset ((u16)0x8000) /*!< PHY Reset */
+#define PHY_Loopback ((u16)0x4000) /*!< Select loop-back mode */
+#define PHY_FULLDUPLEX_100M ((u16)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */
+#define PHY_HALFDUPLEX_100M ((u16)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */
+#define PHY_FULLDUPLEX_10M ((u16)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */
+#define PHY_HALFDUPLEX_10M ((u16)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */
+#define PHY_AutoNegotiation ((u16)0x1000) /*!< Enable auto-negotiation function */
+#define PHY_Restart_AutoNegotiation ((u16)0x0200) /*!< Restart auto-negotiation function */
+#define PHY_Powerdown ((u16)0x0800) /*!< Select the power down mode */
+#define PHY_Isolate ((u16)0x0400) /*!< Isolate PHY from MII */
+
+/**
+ * @}
+ */
+
+/** @defgroup PHY_basic_status_register
+ * @{
+ */
+#define PHY_AutoNego_Complete ((u16)0x0020) /*!< Auto-Negotioation process completed */
+#define PHY_Linked_Status ((u16)0x0004) /*!< Valid link established */
+#define PHY_Jabber_detection ((u16)0x0002) /*!< Jabber condition detected */
+
+/**
+ * @}
+ */
+
+/** @defgroup PHY_status_register
+ * @{
+ */
+/* The PHY status register value change from a PHY to another so the user have
+ to update this value depending on the used external PHY */
+/**
+ * @brief For DM6162
+ */
+#define PHY_SR 17 /*!< Tranceiver Status Register */
+/**
+ * @brief For DP83848
+ */
+//#define PHY_SR 0x10 /*!< Tranceiver Status Register */
+
+/* The Speed and Duplex mask values change from a PHY to another so the user have to update
+ this value depending on the used external PHY */
+/**
+ * @brief For dm9162
+ */
+#define PHY_Speed_Status ((u16)0x2000) /*!< Configured information of Speed: 10Mbps */
+#define PHY_Duplex_Status ((u16)0x0100) /*!< Configured information of Duplex: Full-duplex */
+#define PHY_FullDuplex_Speed_100_Status ((u16)0x8000)
+#define PHY_HalfDuplex_Speed_100_Status ((u16)0x4000)
+#define PHY_FullDuplex_Speed_10_Status ((u16)0x2000)
+#define PHY_HalfDuplex_Speed_10_Status ((u16)0x1000)
+
+
+/**
+ * @brief For DP83848
+ */
+//#define PHY_Speed_Status ((u16)0x0002) /*!< Configured information of Speed: 10Mbps */
+//#define PHY_Duplex_Status ((u16)0x0100) /*!< Configured information of Duplex: Full-duplex */
+#define IS_ETH_PHY_ADDRESS(ADDRESS) ((ADDRESS) <= 0x20)
+#define IS_ETH_PHY_REG(REG) (((REG) == PHY_BCR) || \
+ ((REG) == PHY_BSR) || \
+ ((REG) == PHY_SR))
+
+/**--------------------------------------------------------------------------**/
+/**
+ * @brief MAC defines
+ */
+/**--------------------------------------------------------------------------**/
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_AutoNegotiation
+ * @{
+ */
+#define ETH_AutoNegotiation_Enable ((uint32_t)0x00000001)
+#define ETH_AutoNegotiation_Disable ((uint32_t)0x00000000)
+#define IS_ETH_AUTONEGOTIATION(CMD) (((CMD) == ETH_AutoNegotiation_Enable) || \
+ ((CMD) == ETH_AutoNegotiation_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_watchdog
+ * @{
+ */
+#define ETH_Watchdog_Enable ((uint32_t)0x00000000)
+#define ETH_Watchdog_Disable ((uint32_t)0x00800000)
+#define IS_ETH_WATCHDOG(CMD) (((CMD) == ETH_Watchdog_Enable) || \
+ ((CMD) == ETH_Watchdog_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Jabber
+ * @{
+ */
+#define ETH_Jabber_Enable ((uint32_t)0x00000000)
+#define ETH_Jabber_Disable ((uint32_t)0x00400000)
+#define IS_ETH_JABBER(CMD) (((CMD) == ETH_Jabber_Enable) || \
+ ((CMD) == ETH_Jabber_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Inter_Frame_Gap
+ * @{
+ */
+#define ETH_InterFrameGap_96Bit ((uint32_t)0x00000000) /*!< minimum IFG between frames during transmission is 96Bit */
+#define ETH_InterFrameGap_88Bit ((uint32_t)0x00020000) /*!< minimum IFG between frames during transmission is 88Bit */
+#define ETH_InterFrameGap_80Bit ((uint32_t)0x00040000) /*!< minimum IFG between frames during transmission is 80Bit */
+#define ETH_InterFrameGap_72Bit ((uint32_t)0x00060000) /*!< minimum IFG between frames during transmission is 72Bit */
+#define ETH_InterFrameGap_64Bit ((uint32_t)0x00080000) /*!< minimum IFG between frames during transmission is 64Bit */
+#define ETH_InterFrameGap_56Bit ((uint32_t)0x000A0000) /*!< minimum IFG between frames during transmission is 56Bit */
+#define ETH_InterFrameGap_48Bit ((uint32_t)0x000C0000) /*!< minimum IFG between frames during transmission is 48Bit */
+#define ETH_InterFrameGap_40Bit ((uint32_t)0x000E0000) /*!< minimum IFG between frames during transmission is 40Bit */
+#define IS_ETH_INTER_FRAME_GAP(GAP) (((GAP) == ETH_InterFrameGap_96Bit) || \
+ ((GAP) == ETH_InterFrameGap_88Bit) || \
+ ((GAP) == ETH_InterFrameGap_80Bit) || \
+ ((GAP) == ETH_InterFrameGap_72Bit) || \
+ ((GAP) == ETH_InterFrameGap_64Bit) || \
+ ((GAP) == ETH_InterFrameGap_56Bit) || \
+ ((GAP) == ETH_InterFrameGap_48Bit) || \
+ ((GAP) == ETH_InterFrameGap_40Bit))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Carrier_Sense
+ * @{
+ */
+#define ETH_CarrierSense_Enable ((uint32_t)0x00000000)
+#define ETH_CarrierSense_Disable ((uint32_t)0x00010000)
+#define IS_ETH_CARRIER_SENSE(CMD) (((CMD) == ETH_CarrierSense_Enable) || \
+ ((CMD) == ETH_CarrierSense_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Speed
+ * @{
+ */
+#define ETH_Speed_10M ((uint32_t)0x00000000)
+#define ETH_Speed_100M ((uint32_t)0x00004000)
+#define IS_ETH_SPEED(SPEED) (((SPEED) == ETH_Speed_10M) || \
+ ((SPEED) == ETH_Speed_100M))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Receive_Own
+ * @{
+ */
+#define ETH_ReceiveOwn_Enable ((uint32_t)0x00000000)
+#define ETH_ReceiveOwn_Disable ((uint32_t)0x00002000)
+#define IS_ETH_RECEIVE_OWN(CMD) (((CMD) == ETH_ReceiveOwn_Enable) || \
+ ((CMD) == ETH_ReceiveOwn_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Loop_Back_Mode
+ * @{
+ */
+#define ETH_LoopbackMode_Enable ((uint32_t)0x00001000)
+#define ETH_LoopbackMode_Disable ((uint32_t)0x00000000)
+#define IS_ETH_LOOPBACK_MODE(CMD) (((CMD) == ETH_LoopbackMode_Enable) || \
+ ((CMD) == ETH_LoopbackMode_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Duplex_Mode
+ * @{
+ */
+#define ETH_Mode_FullDuplex ((uint32_t)0x00000800)
+#define ETH_Mode_HalfDuplex ((uint32_t)0x00000000)
+#define IS_ETH_DUPLEX_MODE(MODE) (((MODE) == ETH_Mode_FullDuplex) || \
+ ((MODE) == ETH_Mode_HalfDuplex))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Checksum_Offload
+ * @{
+ */
+#define ETH_ChecksumOffload_Enable ((uint32_t)0x00000400)
+#define ETH_ChecksumOffload_Disable ((uint32_t)0x00000000)
+#define IS_ETH_CHECKSUM_OFFLOAD(CMD) (((CMD) == ETH_ChecksumOffload_Enable) || \
+ ((CMD) == ETH_ChecksumOffload_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Retry_Transmission
+ * @{
+ */
+#define ETH_RetryTransmission_Enable ((uint32_t)0x00000000)
+#define ETH_RetryTransmission_Disable ((uint32_t)0x00000200)
+#define IS_ETH_RETRY_TRANSMISSION(CMD) (((CMD) == ETH_RetryTransmission_Enable) || \
+ ((CMD) == ETH_RetryTransmission_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Automatic_Pad_CRC_Strip
+ * @{
+ */
+#define ETH_AutomaticPadCRCStrip_Enable ((uint32_t)0x00000080)
+#define ETH_AutomaticPadCRCStrip_Disable ((uint32_t)0x00000000)
+#define IS_ETH_AUTOMATIC_PADCRC_STRIP(CMD) (((CMD) == ETH_AutomaticPadCRCStrip_Enable) || \
+ ((CMD) == ETH_AutomaticPadCRCStrip_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Back_Off_Limit
+ * @{
+ */
+#define ETH_BackOffLimit_10 ((uint32_t)0x00000000)
+#define ETH_BackOffLimit_8 ((uint32_t)0x00000020)
+#define ETH_BackOffLimit_4 ((uint32_t)0x00000040)
+#define ETH_BackOffLimit_1 ((uint32_t)0x00000060)
+#define IS_ETH_BACKOFF_LIMIT(LIMIT) (((LIMIT) == ETH_BackOffLimit_10) || \
+ ((LIMIT) == ETH_BackOffLimit_8) || \
+ ((LIMIT) == ETH_BackOffLimit_4) || \
+ ((LIMIT) == ETH_BackOffLimit_1))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Deferral_Check
+ * @{
+ */
+#define ETH_DeferralCheck_Enable ((uint32_t)0x00000010)
+#define ETH_DeferralCheck_Disable ((uint32_t)0x00000000)
+#define IS_ETH_DEFERRAL_CHECK(CMD) (((CMD) == ETH_DeferralCheck_Enable) || \
+ ((CMD) == ETH_DeferralCheck_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Receive_All
+ * @{
+ */
+#define ETH_ReceiveAll_Enable ((uint32_t)0x80000000)
+#define ETH_ReceiveAll_Disable ((uint32_t)0x00000000)
+#define IS_ETH_RECEIVE_ALL(CMD) (((CMD) == ETH_ReceiveAll_Enable) || \
+ ((CMD) == ETH_ReceiveAll_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Source_Addr_Filter
+ * @{
+ */
+#define ETH_SourceAddrFilter_Normal_Enable ((uint32_t)0x00000200)
+#define ETH_SourceAddrFilter_Inverse_Enable ((uint32_t)0x00000300)
+#define ETH_SourceAddrFilter_Disable ((uint32_t)0x00000000)
+#define IS_ETH_SOURCE_ADDR_FILTER(CMD) (((CMD) == ETH_SourceAddrFilter_Normal_Enable) || \
+ ((CMD) == ETH_SourceAddrFilter_Inverse_Enable) || \
+ ((CMD) == ETH_SourceAddrFilter_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Pass_Control_Frames
+ * @{
+ */
+#define ETH_PassControlFrames_BlockAll ((uint32_t)0x00000040) /*!< MAC filters all control frames from reaching the application */
+#define ETH_PassControlFrames_ForwardAll ((uint32_t)0x00000080) /*!< MAC forwards all control frames to application even if they fail the Address Filter */
+#define ETH_PassControlFrames_ForwardPassedAddrFilter ((uint32_t)0x000000C0) /*!< MAC forwards control frames that pass the Address Filter. */
+#define IS_ETH_CONTROL_FRAMES(PASS) (((PASS) == ETH_PassControlFrames_BlockAll) || \
+ ((PASS) == ETH_PassControlFrames_ForwardAll) || \
+ ((PASS) == ETH_PassControlFrames_ForwardPassedAddrFilter))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Broadcast_Frames_Reception
+ * @{
+ */
+#define ETH_BroadcastFramesReception_Enable ((uint32_t)0x00000000)
+#define ETH_BroadcastFramesReception_Disable ((uint32_t)0x00000020)
+#define IS_ETH_BROADCAST_FRAMES_RECEPTION(CMD) (((CMD) == ETH_BroadcastFramesReception_Enable) || \
+ ((CMD) == ETH_BroadcastFramesReception_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Destination_Addr_Filter
+ * @{
+ */
+#define ETH_DestinationAddrFilter_Normal ((uint32_t)0x00000000)
+#define ETH_DestinationAddrFilter_Inverse ((uint32_t)0x00000008)
+#define IS_ETH_DESTINATION_ADDR_FILTER(FILTER) (((FILTER) == ETH_DestinationAddrFilter_Normal) || \
+ ((FILTER) == ETH_DestinationAddrFilter_Inverse))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Promiscuous_Mode
+ * @{
+ */
+#define ETH_PromiscuousMode_Enable ((uint32_t)0x00000001)
+#define ETH_PromiscuousMode_Disable ((uint32_t)0x00000000)
+#define IS_ETH_PROMISCUOUS_MODE(CMD) (((CMD) == ETH_PromiscuousMode_Enable) || \
+ ((CMD) == ETH_PromiscuousMode_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Multicast_Frames_Filter
+ * @{
+ */
+#define ETH_MulticastFramesFilter_PerfectHashTable ((uint32_t)0x00000404)
+#define ETH_MulticastFramesFilter_HashTable ((uint32_t)0x00000004)
+#define ETH_MulticastFramesFilter_Perfect ((uint32_t)0x00000000)
+#define ETH_MulticastFramesFilter_None ((uint32_t)0x00000010)
+#define IS_ETH_MULTICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_MulticastFramesFilter_PerfectHashTable) || \
+ ((FILTER) == ETH_MulticastFramesFilter_HashTable) || \
+ ((FILTER) == ETH_MulticastFramesFilter_Perfect) || \
+ ((FILTER) == ETH_MulticastFramesFilter_None))
+
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Unicast_Frames_Filter
+ * @{
+ */
+#define ETH_UnicastFramesFilter_PerfectHashTable ((uint32_t)0x00000402)
+#define ETH_UnicastFramesFilter_HashTable ((uint32_t)0x00000002)
+#define ETH_UnicastFramesFilter_Perfect ((uint32_t)0x00000000)
+#define IS_ETH_UNICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_UnicastFramesFilter_PerfectHashTable) || \
+ ((FILTER) == ETH_UnicastFramesFilter_HashTable) || \
+ ((FILTER) == ETH_UnicastFramesFilter_Perfect))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Pause_Time
+ * @{
+ */
+#define IS_ETH_PAUSE_TIME(TIME) ((TIME) <= 0xFFFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Zero_Quanta_Pause
+ * @{
+ */
+#define ETH_ZeroQuantaPause_Enable ((uint32_t)0x00000000)
+#define ETH_ZeroQuantaPause_Disable ((uint32_t)0x00000080)
+#define IS_ETH_ZEROQUANTA_PAUSE(CMD) (((CMD) == ETH_ZeroQuantaPause_Enable) || \
+ ((CMD) == ETH_ZeroQuantaPause_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Pause_Low_Threshold
+ * @{
+ */
+#define ETH_PauseLowThreshold_Minus4 ((uint32_t)0x00000000) /*!< Pause time minus 4 slot times */
+#define ETH_PauseLowThreshold_Minus28 ((uint32_t)0x00000010) /*!< Pause time minus 28 slot times */
+#define ETH_PauseLowThreshold_Minus144 ((uint32_t)0x00000020) /*!< Pause time minus 144 slot times */
+#define ETH_PauseLowThreshold_Minus256 ((uint32_t)0x00000030) /*!< Pause time minus 256 slot times */
+#define IS_ETH_PAUSE_LOW_THRESHOLD(THRESHOLD) (((THRESHOLD) == ETH_PauseLowThreshold_Minus4) || \
+ ((THRESHOLD) == ETH_PauseLowThreshold_Minus28) || \
+ ((THRESHOLD) == ETH_PauseLowThreshold_Minus144) || \
+ ((THRESHOLD) == ETH_PauseLowThreshold_Minus256))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Unicast_Pause_Frame_Detect
+ * @{
+ */
+#define ETH_UnicastPauseFrameDetect_Enable ((uint32_t)0x00000008)
+#define ETH_UnicastPauseFrameDetect_Disable ((uint32_t)0x00000000)
+#define IS_ETH_UNICAST_PAUSE_FRAME_DETECT(CMD) (((CMD) == ETH_UnicastPauseFrameDetect_Enable) || \
+ ((CMD) == ETH_UnicastPauseFrameDetect_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Receive_Flow_Control
+ * @{
+ */
+#define ETH_ReceiveFlowControl_Enable ((uint32_t)0x00000004)
+#define ETH_ReceiveFlowControl_Disable ((uint32_t)0x00000000)
+#define IS_ETH_RECEIVE_FLOWCONTROL(CMD) (((CMD) == ETH_ReceiveFlowControl_Enable) || \
+ ((CMD) == ETH_ReceiveFlowControl_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Transmit_Flow_Control
+ * @{
+ */
+#define ETH_TransmitFlowControl_Enable ((uint32_t)0x00000002)
+#define ETH_TransmitFlowControl_Disable ((uint32_t)0x00000000)
+#define IS_ETH_TRANSMIT_FLOWCONTROL(CMD) (((CMD) == ETH_TransmitFlowControl_Enable) || \
+ ((CMD) == ETH_TransmitFlowControl_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_VLAN_Tag_Comparison
+ * @{
+ */
+#define ETH_VLANTagComparison_12Bit ((uint32_t)0x00010000)
+#define ETH_VLANTagComparison_16Bit ((uint32_t)0x00000000)
+#define IS_ETH_VLAN_TAG_COMPARISON(COMPARISON) (((COMPARISON) == ETH_VLANTagComparison_12Bit) || \
+ ((COMPARISON) == ETH_VLANTagComparison_16Bit))
+#define IS_ETH_VLAN_TAG_IDENTIFIER(IDENTIFIER) ((IDENTIFIER) <= 0xFFFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_MAC_Flags
+ * @{
+ */
+#define ETH_MAC_FLAG_TST ((uint32_t)0x00000200) /*!< Time stamp trigger flag (on MAC) */
+#define ETH_MAC_FLAG_MMCT ((uint32_t)0x00000040) /*!< MMC transmit flag */
+#define ETH_MAC_FLAG_MMCR ((uint32_t)0x00000020) /*!< MMC receive flag */
+#define ETH_MAC_FLAG_MMC ((uint32_t)0x00000010) /*!< MMC flag (on MAC) */
+#define ETH_MAC_FLAG_PMT ((uint32_t)0x00000008) /*!< PMT flag (on MAC) */
+#define IS_ETH_MAC_GET_FLAG(FLAG) (((FLAG) == ETH_MAC_FLAG_TST) || ((FLAG) == ETH_MAC_FLAG_MMCT) || \
+ ((FLAG) == ETH_MAC_FLAG_MMCR) || ((FLAG) == ETH_MAC_FLAG_MMC) || \
+ ((FLAG) == ETH_MAC_FLAG_PMT))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_MAC_Interrupts
+ * @{
+ */
+#define ETH_MAC_INT_TST ((uint32_t)0x00000200) /*!< Time stamp trigger interrupt (on MAC) */
+#define ETH_MAC_INT_MMCT ((uint32_t)0x00000040) /*!< MMC transmit interrupt */
+#define ETH_MAC_INT_MMCR ((uint32_t)0x00000020) /*!< MMC receive interrupt */
+#define ETH_MAC_INT_MMC ((uint32_t)0x00000010) /*!< MMC interrupt (on MAC) */
+#define ETH_MAC_INT_PMT ((uint32_t)0x00000008) /*!< PMT interrupt (on MAC) */
+#define IS_ETH_MAC_IT(IT) ((((IT) & (uint32_t)0xFFFFFDF7) == 0x00) && ((IT) != 0x00))
+#define IS_ETH_MAC_GET_IT(IT) (((IT) == ETH_MAC_INT_TST) || ((IT) == ETH_MAC_INT_MMCT) || \
+ ((IT) == ETH_MAC_INT_MMCR) || ((IT) == ETH_MAC_INT_MMC) || \
+ ((IT) == ETH_MAC_INT_PMT))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_MAC_addresses
+ * @{
+ */
+#define ETH_MAC_Address0 ((uint32_t)0x00000000)
+#define ETH_MAC_Address1 ((uint32_t)0x00000008)
+#define ETH_MAC_Address2 ((uint32_t)0x00000010)
+#define ETH_MAC_Address3 ((uint32_t)0x00000018)
+#define IS_ETH_MAC_ADDRESS0123(ADDRESS) (((ADDRESS) == ETH_MAC_Address0) || \
+ ((ADDRESS) == ETH_MAC_Address1) || \
+ ((ADDRESS) == ETH_MAC_Address2) || \
+ ((ADDRESS) == ETH_MAC_Address3))
+#define IS_ETH_MAC_ADDRESS123(ADDRESS) (((ADDRESS) == ETH_MAC_Address1) || \
+ ((ADDRESS) == ETH_MAC_Address2) || \
+ ((ADDRESS) == ETH_MAC_Address3))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_MAC_addresses_filter_SA_DA_filed_of_received_frames
+ * @{
+ */
+#define ETH_MAC_AddressFilter_SA ((uint32_t)0x00000000)
+#define ETH_MAC_AddressFilter_DA ((uint32_t)0x00000008)
+#define IS_ETH_MAC_ADDRESS_FILTER(FILTER) (((FILTER) == ETH_MAC_AddressFilter_SA) || \
+ ((FILTER) == ETH_MAC_AddressFilter_DA))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_MAC_addresses_filter_Mask_bytes
+ * @{
+ */
+#define ETH_MAC_AddressMask_Byte6 ((uint32_t)0x20000000) /*!< Mask MAC Address high reg bits [15:8] */
+#define ETH_MAC_AddressMask_Byte5 ((uint32_t)0x10000000) /*!< Mask MAC Address high reg bits [7:0] */
+#define ETH_MAC_AddressMask_Byte4 ((uint32_t)0x08000000) /*!< Mask MAC Address low reg bits [31:24] */
+#define ETH_MAC_AddressMask_Byte3 ((uint32_t)0x04000000) /*!< Mask MAC Address low reg bits [23:16] */
+#define ETH_MAC_AddressMask_Byte2 ((uint32_t)0x02000000) /*!< Mask MAC Address low reg bits [15:8] */
+#define ETH_MAC_AddressMask_Byte1 ((uint32_t)0x01000000) /*!< Mask MAC Address low reg bits [70] */
+#define IS_ETH_MAC_ADDRESS_MASK(MASK) (((MASK) == ETH_MAC_AddressMask_Byte6) || \
+ ((MASK) == ETH_MAC_AddressMask_Byte5) || \
+ ((MASK) == ETH_MAC_AddressMask_Byte4) || \
+ ((MASK) == ETH_MAC_AddressMask_Byte3) || \
+ ((MASK) == ETH_MAC_AddressMask_Byte2) || \
+ ((MASK) == ETH_MAC_AddressMask_Byte1))
+
+/**--------------------------------------------------------------------------**/
+/**
+ * @brief Ethernet DMA Desciptors defines
+ */
+/**--------------------------------------------------------------------------**/
+/**
+ * @}
+ */
+
+/** @defgroup ETH_DMA_Tx_descriptor_flags
+ * @{
+ */
+#define IS_ETH_DMATxDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMATxDesc_OWN) || \
+ ((FLAG) == ETH_DMATxDesc_IC) || \
+ ((FLAG) == ETH_DMATxDesc_LS) || \
+ ((FLAG) == ETH_DMATxDesc_FS) || \
+ ((FLAG) == ETH_DMATxDesc_DC) || \
+ ((FLAG) == ETH_DMATxDesc_DP) || \
+ ((FLAG) == ETH_DMATxDesc_TTSE) || \
+ ((FLAG) == ETH_DMATxDesc_TER) || \
+ ((FLAG) == ETH_DMATxDesc_TCH) || \
+ ((FLAG) == ETH_DMATxDesc_TTSS) || \
+ ((FLAG) == ETH_DMATxDesc_IHE) || \
+ ((FLAG) == ETH_DMATxDesc_ES) || \
+ ((FLAG) == ETH_DMATxDesc_JT) || \
+ ((FLAG) == ETH_DMATxDesc_FF) || \
+ ((FLAG) == ETH_DMATxDesc_PCE) || \
+ ((FLAG) == ETH_DMATxDesc_LCA) || \
+ ((FLAG) == ETH_DMATxDesc_NC) || \
+ ((FLAG) == ETH_DMATxDesc_LCO) || \
+ ((FLAG) == ETH_DMATxDesc_EC) || \
+ ((FLAG) == ETH_DMATxDesc_VF) || \
+ ((FLAG) == ETH_DMATxDesc_CC) || \
+ ((FLAG) == ETH_DMATxDesc_ED) || \
+ ((FLAG) == ETH_DMATxDesc_UF) || \
+ ((FLAG) == ETH_DMATxDesc_DB))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_DMA_Tx_descriptor_segment
+ * @{
+ */
+#define ETH_DMATxDesc_LastSegment ((uint32_t)0x40000000) /*!< Last Segment */
+#define ETH_DMATxDesc_FirstSegment ((uint32_t)0x20000000) /*!< First Segment */
+#define IS_ETH_DMA_TXDESC_SEGMENT(SEGMENT) (((SEGMENT) == ETH_DMATxDesc_LastSegment) || \
+ ((SEGMENT) == ETH_DMATxDesc_FirstSegment))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_DMA_Tx_descriptor_Checksum_Insertion_Control
+ * @{
+ */
+#define ETH_DMATxDesc_ChecksumByPass ((uint32_t)0x00000000) /*!< Checksum engine bypass */
+#define ETH_DMATxDesc_ChecksumIPV4Header ((uint32_t)0x00400000) /*!< IPv4 header checksum insertion */
+#define ETH_DMATxDesc_ChecksumTCPUDPICMPSegment ((uint32_t)0x00800000) /*!< TCP/UDP/ICMP checksum insertion. Pseudo header checksum is assumed to be present */
+#define ETH_DMATxDesc_ChecksumTCPUDPICMPFull ((uint32_t)0x00C00000) /*!< TCP/UDP/ICMP checksum fully in hardware including pseudo header */
+#define IS_ETH_DMA_TXDESC_CHECKSUM(CHECKSUM) (((CHECKSUM) == ETH_DMATxDesc_ChecksumByPass) || \
+ ((CHECKSUM) == ETH_DMATxDesc_ChecksumIPV4Header) || \
+ ((CHECKSUM) == ETH_DMATxDesc_ChecksumTCPUDPICMPSegment) || \
+ ((CHECKSUM) == ETH_DMATxDesc_ChecksumTCPUDPICMPFull))
+/**
+ * @brief ETH DMA Tx Desciptor buffer size
+ */
+#define IS_ETH_DMATxDESC_BUFFER_SIZE(SIZE) ((SIZE) <= 0x1FFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_DMA_Rx_descriptor_flags
+ * @{
+ */
+#define IS_ETH_DMARxDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMARxDesc_OWN) || \
+ ((FLAG) == ETH_DMARxDesc_AFM) || \
+ ((FLAG) == ETH_DMARxDesc_ES) || \
+ ((FLAG) == ETH_DMARxDesc_DE) || \
+ ((FLAG) == ETH_DMARxDesc_SAF) || \
+ ((FLAG) == ETH_DMARxDesc_LE) || \
+ ((FLAG) == ETH_DMARxDesc_OE) || \
+ ((FLAG) == ETH_DMARxDesc_VLAN) || \
+ ((FLAG) == ETH_DMARxDesc_FS) || \
+ ((FLAG) == ETH_DMARxDesc_LS) || \
+ ((FLAG) == ETH_DMARxDesc_IPV4HCE) || \
+ ((FLAG) == ETH_DMARxDesc_LC) || \
+ ((FLAG) == ETH_DMARxDesc_FT) || \
+ ((FLAG) == ETH_DMARxDesc_RWT) || \
+ ((FLAG) == ETH_DMARxDesc_RE) || \
+ ((FLAG) == ETH_DMARxDesc_DBE) || \
+ ((FLAG) == ETH_DMARxDesc_CE) || \
+ ((FLAG) == ETH_DMARxDesc_MAMPCE))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_DMA_Rx_descriptor_buffers_
+ * @{
+ */
+#define ETH_DMARxDesc_Buffer1 ((uint32_t)0x00000000) /*!< DMA Rx Desc Buffer1 */
+#define ETH_DMARxDesc_Buffer2 ((uint32_t)0x00000001) /*!< DMA Rx Desc Buffer2 */
+#define IS_ETH_DMA_RXDESC_BUFFER(BUFFER) (((BUFFER) == ETH_DMARxDesc_Buffer1) || \
+ ((BUFFER) == ETH_DMARxDesc_Buffer2))
+
+/**--------------------------------------------------------------------------**/
+/**
+ * @brief Ethernet DMA defines
+ */
+/**--------------------------------------------------------------------------**/
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Drop_TCP_IP_Checksum_Error_Frame
+ * @{
+ */
+#define ETH_DropTCPIPChecksumErrorFrame_Enable ((uint32_t)0x00000000)
+#define ETH_DropTCPIPChecksumErrorFrame_Disable ((uint32_t)0x04000000)
+#define IS_ETH_DROP_TCPIP_CHECKSUM_FRAME(CMD) (((CMD) == ETH_DropTCPIPChecksumErrorFrame_Enable) || \
+ ((CMD) == ETH_DropTCPIPChecksumErrorFrame_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Receive_Store_Forward
+ * @{
+ */
+#define ETH_ReceiveStoreForward_Enable ((uint32_t)0x02000000)
+#define ETH_ReceiveStoreForward_Disable ((uint32_t)0x00000000)
+#define IS_ETH_RECEIVE_STORE_FORWARD(CMD) (((CMD) == ETH_ReceiveStoreForward_Enable) || \
+ ((CMD) == ETH_ReceiveStoreForward_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Flush_Received_Frame
+ * @{
+ */
+#define ETH_FlushReceivedFrame_Enable ((uint32_t)0x00000000)
+#define ETH_FlushReceivedFrame_Disable ((uint32_t)0x01000000)
+#define IS_ETH_FLUSH_RECEIVE_FRAME(CMD) (((CMD) == ETH_FlushReceivedFrame_Enable) || \
+ ((CMD) == ETH_FlushReceivedFrame_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Transmit_Store_Forward
+ * @{
+ */
+#define ETH_TransmitStoreForward_Enable ((uint32_t)0x00200000)
+#define ETH_TransmitStoreForward_Disable ((uint32_t)0x00000000)
+#define IS_ETH_TRANSMIT_STORE_FORWARD(CMD) (((CMD) == ETH_TransmitStoreForward_Enable) || \
+ ((CMD) == ETH_TransmitStoreForward_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Transmit_Threshold_Control
+ * @{
+ */
+#define ETH_TransmitThresholdControl_64Bytes ((uint32_t)0x00000000) /*!< threshold level of the MTL Transmit FIFO is 64 Bytes */
+#define ETH_TransmitThresholdControl_128Bytes ((uint32_t)0x00004000) /*!< threshold level of the MTL Transmit FIFO is 128 Bytes */
+#define ETH_TransmitThresholdControl_192Bytes ((uint32_t)0x00008000) /*!< threshold level of the MTL Transmit FIFO is 192 Bytes */
+#define ETH_TransmitThresholdControl_256Bytes ((uint32_t)0x0000C000) /*!< threshold level of the MTL Transmit FIFO is 256 Bytes */
+#define ETH_TransmitThresholdControl_40Bytes ((uint32_t)0x00010000) /*!< threshold level of the MTL Transmit FIFO is 40 Bytes */
+#define ETH_TransmitThresholdControl_32Bytes ((uint32_t)0x00014000) /*!< threshold level of the MTL Transmit FIFO is 32 Bytes */
+#define ETH_TransmitThresholdControl_24Bytes ((uint32_t)0x00018000) /*!< threshold level of the MTL Transmit FIFO is 24 Bytes */
+#define ETH_TransmitThresholdControl_16Bytes ((uint32_t)0x0001C000) /*!< threshold level of the MTL Transmit FIFO is 16 Bytes */
+#define IS_ETH_TRANSMIT_THRESHOLD_CONTROL(THRESHOLD) (((THRESHOLD) == ETH_TransmitThresholdControl_64Bytes) || \
+ ((THRESHOLD) == ETH_TransmitThresholdControl_128Bytes) || \
+ ((THRESHOLD) == ETH_TransmitThresholdControl_192Bytes) || \
+ ((THRESHOLD) == ETH_TransmitThresholdControl_256Bytes) || \
+ ((THRESHOLD) == ETH_TransmitThresholdControl_40Bytes) || \
+ ((THRESHOLD) == ETH_TransmitThresholdControl_32Bytes) || \
+ ((THRESHOLD) == ETH_TransmitThresholdControl_24Bytes) || \
+ ((THRESHOLD) == ETH_TransmitThresholdControl_16Bytes))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Forward_Error_Frames
+ * @{
+ */
+#define ETH_ForwardErrorFrames_Enable ((uint32_t)0x00000080)
+#define ETH_ForwardErrorFrames_Disable ((uint32_t)0x00000000)
+#define IS_ETH_FORWARD_ERROR_FRAMES(CMD) (((CMD) == ETH_ForwardErrorFrames_Enable) || \
+ ((CMD) == ETH_ForwardErrorFrames_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Forward_Undersized_Good_Frames
+ * @{
+ */
+#define ETH_ForwardUndersizedGoodFrames_Enable ((uint32_t)0x00000040)
+#define ETH_ForwardUndersizedGoodFrames_Disable ((uint32_t)0x00000000)
+#define IS_ETH_FORWARD_UNDERSIZED_GOOD_FRAMES(CMD) (((CMD) == ETH_ForwardUndersizedGoodFrames_Enable) || \
+ ((CMD) == ETH_ForwardUndersizedGoodFrames_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Receive_Threshold_Control
+ * @{
+ */
+#define ETH_ReceiveThresholdControl_64Bytes ((uint32_t)0x00000000) /*!< threshold level of the MTL Receive FIFO is 64 Bytes */
+#define ETH_ReceiveThresholdControl_32Bytes ((uint32_t)0x00000008) /*!< threshold level of the MTL Receive FIFO is 32 Bytes */
+#define ETH_ReceiveThresholdControl_96Bytes ((uint32_t)0x00000010) /*!< threshold level of the MTL Receive FIFO is 96 Bytes */
+#define ETH_ReceiveThresholdControl_128Bytes ((uint32_t)0x00000018) /*!< threshold level of the MTL Receive FIFO is 128 Bytes */
+#define IS_ETH_RECEIVE_THRESHOLD_CONTROL(THRESHOLD) (((THRESHOLD) == ETH_ReceiveThresholdControl_64Bytes) || \
+ ((THRESHOLD) == ETH_ReceiveThresholdControl_32Bytes) || \
+ ((THRESHOLD) == ETH_ReceiveThresholdControl_96Bytes) || \
+ ((THRESHOLD) == ETH_ReceiveThresholdControl_128Bytes))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Second_Frame_Operate
+ * @{
+ */
+#define ETH_SecondFrameOperate_Enable ((uint32_t)0x00000004)
+#define ETH_SecondFrameOperate_Disable ((uint32_t)0x00000000)
+#define IS_ETH_SECOND_FRAME_OPERATE(CMD) (((CMD) == ETH_SecondFrameOperate_Enable) || \
+ ((CMD) == ETH_SecondFrameOperate_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Address_Aligned_Beats
+ * @{
+ */
+#define ETH_AddressAlignedBeats_Enable ((uint32_t)0x02000000)
+#define ETH_AddressAlignedBeats_Disable ((uint32_t)0x00000000)
+#define IS_ETH_ADDRESS_ALIGNED_BEATS(CMD) (((CMD) == ETH_AddressAlignedBeats_Enable) || \
+ ((CMD) == ETH_AddressAlignedBeats_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Fixed_Burst
+ * @{
+ */
+#define ETH_FixedBurst_Enable ((uint32_t)0x00010000)
+#define ETH_FixedBurst_Disable ((uint32_t)0x00000000)
+#define IS_ETH_FIXED_BURST(CMD) (((CMD) == ETH_FixedBurst_Enable) || \
+ ((CMD) == ETH_FixedBurst_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Rx_DMA_Burst_Length
+ * @{
+ */
+#define ETH_RxDMABurstLength_1Beat ((uint32_t)0x00020000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 1 */
+#define ETH_RxDMABurstLength_2Beat ((uint32_t)0x00040000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 2 */
+#define ETH_RxDMABurstLength_4Beat ((uint32_t)0x00080000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 4 */
+#define ETH_RxDMABurstLength_8Beat ((uint32_t)0x00100000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 8 */
+#define ETH_RxDMABurstLength_16Beat ((uint32_t)0x00200000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 16 */
+#define ETH_RxDMABurstLength_32Beat ((uint32_t)0x00400000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 32 */
+#define ETH_RxDMABurstLength_4xPBL_4Beat ((uint32_t)0x01020000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 4 */
+#define ETH_RxDMABurstLength_4xPBL_8Beat ((uint32_t)0x01040000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 8 */
+#define ETH_RxDMABurstLength_4xPBL_16Beat ((uint32_t)0x01080000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 16 */
+#define ETH_RxDMABurstLength_4xPBL_32Beat ((uint32_t)0x01100000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 32 */
+#define ETH_RxDMABurstLength_4xPBL_64Beat ((uint32_t)0x01200000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 64 */
+#define ETH_RxDMABurstLength_4xPBL_128Beat ((uint32_t)0x01400000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 128 */
+#define IS_ETH_RXDMA_BURST_LENGTH(LENGTH) (((LENGTH) == ETH_RxDMABurstLength_1Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_2Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_4Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_8Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_16Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_32Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_4Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_8Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_16Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_32Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_64Beat) || \
+ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_128Beat))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Tx_DMA_Burst_Length
+ * @{
+ */
+#define ETH_TxDMABurstLength_1Beat ((uint32_t)0x00000100) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 1 */
+#define ETH_TxDMABurstLength_2Beat ((uint32_t)0x00000200) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 2 */
+#define ETH_TxDMABurstLength_4Beat ((uint32_t)0x00000400) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */
+#define ETH_TxDMABurstLength_8Beat ((uint32_t)0x00000800) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */
+#define ETH_TxDMABurstLength_16Beat ((uint32_t)0x00001000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */
+#define ETH_TxDMABurstLength_32Beat ((uint32_t)0x00002000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */
+#define ETH_TxDMABurstLength_4xPBL_4Beat ((uint32_t)0x01000100) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */
+#define ETH_TxDMABurstLength_4xPBL_8Beat ((uint32_t)0x01000200) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */
+#define ETH_TxDMABurstLength_4xPBL_16Beat ((uint32_t)0x01000400) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */
+#define ETH_TxDMABurstLength_4xPBL_32Beat ((uint32_t)0x01000800) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */
+#define ETH_TxDMABurstLength_4xPBL_64Beat ((uint32_t)0x01001000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 64 */
+#define ETH_TxDMABurstLength_4xPBL_128Beat ((uint32_t)0x01002000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 128 */
+#define IS_ETH_TXDMA_BURST_LENGTH(LENGTH) (((LENGTH) == ETH_TxDMABurstLength_1Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_2Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_4Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_8Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_16Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_32Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_4Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_8Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_16Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_32Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_64Beat) || \
+ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_128Beat))
+/**
+ * @brief ETH DMA Desciptor SkipLength
+ */
+#define IS_ETH_DMA_DESC_SKIP_LENGTH(LENGTH) ((LENGTH) <= 0x1F)
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_DMA_Arbitration
+ * @{
+ */
+#define ETH_DMAArbitration_RoundRobin_RxTx_1_1 ((uint32_t)0x00000000)
+#define ETH_DMAArbitration_RoundRobin_RxTx_2_1 ((uint32_t)0x00004000)
+#define ETH_DMAArbitration_RoundRobin_RxTx_3_1 ((uint32_t)0x00008000)
+#define ETH_DMAArbitration_RoundRobin_RxTx_4_1 ((uint32_t)0x0000C000)
+#define ETH_DMAArbitration_RxPriorTx ((uint32_t)0x00000002)
+#define IS_ETH_DMA_ARBITRATION_ROUNDROBIN_RXTX(RATIO) (((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_1_1) || \
+ ((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_2_1) || \
+ ((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_3_1) || \
+ ((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_4_1) || \
+ ((RATIO) == ETH_DMAArbitration_RxPriorTx))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_DMA_Flags
+ * @{
+ */
+#define ETH_DMA_FLAG_TST ((uint32_t)0x20000000) /*!< Time-stamp trigger interrupt (on DMA) */
+#define ETH_DMA_FLAG_PMT ((uint32_t)0x10000000) /*!< PMT interrupt (on DMA) */
+#define ETH_DMA_FLAG_MMC ((uint32_t)0x08000000) /*!< MMC interrupt (on DMA) */
+#define ETH_DMA_FLAG_DataTransferError ((uint32_t)0x00800000) /*!< Error bits 0-Rx DMA, 1-Tx DMA */
+#define ETH_DMA_FLAG_ReadWriteError ((uint32_t)0x01000000) /*!< Error bits 0-write trnsf, 1-read transfr */
+#define ETH_DMA_FLAG_AccessError ((uint32_t)0x02000000) /*!< Error bits 0-data buffer, 1-desc. access */
+#define ETH_DMA_FLAG_NIS ((uint32_t)0x00010000) /*!< Normal interrupt summary flag */
+#define ETH_DMA_FLAG_AIS ((uint32_t)0x00008000) /*!< Abnormal interrupt summary flag */
+#define ETH_DMA_FLAG_ER ((uint32_t)0x00004000) /*!< Early receive flag */
+#define ETH_DMA_FLAG_FBE ((uint32_t)0x00002000) /*!< Fatal bus error flag */
+#define ETH_DMA_FLAG_ET ((uint32_t)0x00000400) /*!< Early transmit flag */
+#define ETH_DMA_FLAG_RWT ((uint32_t)0x00000200) /*!< Receive watchdog timeout flag */
+#define ETH_DMA_FLAG_RPS ((uint32_t)0x00000100) /*!< Receive process stopped flag */
+#define ETH_DMA_FLAG_RBU ((uint32_t)0x00000080) /*!< Receive buffer unavailable flag */
+#define ETH_DMA_FLAG_R ((uint32_t)0x00000040) /*!< Receive flag */
+#define ETH_DMA_FLAG_TU ((uint32_t)0x00000020) /*!< Underflow flag */
+#define ETH_DMA_FLAG_RO ((uint32_t)0x00000010) /*!< Overflow flag */
+#define ETH_DMA_FLAG_TJT ((uint32_t)0x00000008) /*!< Transmit jabber timeout flag */
+#define ETH_DMA_FLAG_TBU ((uint32_t)0x00000004) /*!< Transmit buffer unavailable flag */
+#define ETH_DMA_FLAG_TPS ((uint32_t)0x00000002) /*!< Transmit process stopped flag */
+#define ETH_DMA_FLAG_T ((uint32_t)0x00000001) /*!< Transmit flag */
+
+#define IS_ETH_DMA_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFE1800) == 0x00) && ((FLAG) != 0x00))
+#define IS_ETH_DMA_GET_FLAG(FLAG) (((FLAG) == ETH_DMA_FLAG_TST) || ((FLAG) == ETH_DMA_FLAG_PMT) || \
+ ((FLAG) == ETH_DMA_FLAG_MMC) || ((FLAG) == ETH_DMA_FLAG_DataTransferError) || \
+ ((FLAG) == ETH_DMA_FLAG_ReadWriteError) || ((FLAG) == ETH_DMA_FLAG_AccessError) || \
+ ((FLAG) == ETH_DMA_FLAG_NIS) || ((FLAG) == ETH_DMA_FLAG_AIS) || \
+ ((FLAG) == ETH_DMA_FLAG_ER) || ((FLAG) == ETH_DMA_FLAG_FBE) || \
+ ((FLAG) == ETH_DMA_FLAG_ET) || ((FLAG) == ETH_DMA_FLAG_RWT) || \
+ ((FLAG) == ETH_DMA_FLAG_RPS) || ((FLAG) == ETH_DMA_FLAG_RBU) || \
+ ((FLAG) == ETH_DMA_FLAG_R) || ((FLAG) == ETH_DMA_FLAG_TU) || \
+ ((FLAG) == ETH_DMA_FLAG_RO) || ((FLAG) == ETH_DMA_FLAG_TJT) || \
+ ((FLAG) == ETH_DMA_FLAG_TBU) || ((FLAG) == ETH_DMA_FLAG_TPS) || \
+ ((FLAG) == ETH_DMA_FLAG_T))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_DMA_Interrupts
+ * @{
+ */
+#define ETH_DMA_INT_TST ((uint32_t)0x20000000) /*!< Time-stamp trigger interrupt (on DMA) */
+#define ETH_DMA_INT_PMT ((uint32_t)0x10000000) /*!< PMT interrupt (on DMA) */
+#define ETH_DMA_INT_MMC ((uint32_t)0x08000000) /*!< MMC interrupt (on DMA) */
+#define ETH_DMA_INT_NIS ((uint32_t)0x00010000) /*!< Normal interrupt summary */
+#define ETH_DMA_INT_AIS ((uint32_t)0x00008000) /*!< Abnormal interrupt summary */
+#define ETH_DMA_INT_ER ((uint32_t)0x00004000) /*!< Early receive interrupt */
+#define ETH_DMA_INT_FBE ((uint32_t)0x00002000) /*!< Fatal bus error interrupt */
+#define ETH_DMA_INT_ET ((uint32_t)0x00000400) /*!< Early transmit interrupt */
+#define ETH_DMA_INT_RWT ((uint32_t)0x00000200) /*!< Receive watchdog timeout interrupt */
+#define ETH_DMA_INT_RPS ((uint32_t)0x00000100) /*!< Receive process stopped interrupt */
+#define ETH_DMA_INT_RBU ((uint32_t)0x00000080) /*!< Receive buffer unavailable interrupt */
+#define ETH_DMA_INT_R ((uint32_t)0x00000040) /*!< Receive interrupt */
+#define ETH_DMA_INT_TU ((uint32_t)0x00000020) /*!< Underflow interrupt */
+#define ETH_DMA_INT_RO ((uint32_t)0x00000010) /*!< Overflow interrupt */
+#define ETH_DMA_INT_TJT ((uint32_t)0x00000008) /*!< Transmit jabber timeout interrupt */
+#define ETH_DMA_INT_TBU ((uint32_t)0x00000004) /*!< Transmit buffer unavailable interrupt */
+#define ETH_DMA_INT_TPS ((uint32_t)0x00000002) /*!< Transmit process stopped interrupt */
+#define ETH_DMA_INT_T ((uint32_t)0x00000001) /*!< Transmit interrupt */
+
+#define IS_ETH_DMA_IT(IT) ((((IT) & (uint32_t)0xFFFE1800) == 0x00) && ((IT) != 0x00))
+#define IS_ETH_DMA_GET_IT(IT) (((IT) == ETH_DMA_INT_TST) || ((IT) == ETH_DMA_INT_PMT) || \
+ ((IT) == ETH_DMA_INT_MMC) || ((IT) == ETH_DMA_INT_NIS) || \
+ ((IT) == ETH_DMA_INT_AIS) || ((IT) == ETH_DMA_INT_ER) || \
+ ((IT) == ETH_DMA_INT_FBE) || ((IT) == ETH_DMA_INT_ET) || \
+ ((IT) == ETH_DMA_INT_RWT) || ((IT) == ETH_DMA_INT_RPS) || \
+ ((IT) == ETH_DMA_INT_RBU) || ((IT) == ETH_DMA_INT_R) || \
+ ((IT) == ETH_DMA_INT_TU) || ((IT) == ETH_DMA_INT_RO) || \
+ ((IT) == ETH_DMA_INT_TJT) || ((IT) == ETH_DMA_INT_TBU) || \
+ ((IT) == ETH_DMA_INT_TPS) || ((IT) == ETH_DMA_INT_T))
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_DMA_transmit_process_state_
+ * @{
+ */
+#define ETH_DMA_TransmitProcess_Stopped ((uint32_t)0x00000000) /*!< Stopped - Reset or Stop Tx Command issued */
+#define ETH_DMA_TransmitProcess_Fetching ((uint32_t)0x00100000) /*!< Running - fetching the Tx descriptor */
+#define ETH_DMA_TransmitProcess_Waiting ((uint32_t)0x00200000) /*!< Running - waiting for status */
+#define ETH_DMA_TransmitProcess_Reading ((uint32_t)0x00300000) /*!< Running - reading the data from host memory */
+#define ETH_DMA_TransmitProcess_Suspended ((uint32_t)0x00600000) /*!< Suspended - Tx Desciptor unavailabe */
+#define ETH_DMA_TransmitProcess_Closing ((uint32_t)0x00700000) /*!< Running - closing Rx descriptor */
+
+/**
+ * @}
+ */
+
+
+/** @defgroup ETH_DMA_receive_process_state_
+ * @{
+ */
+#define ETH_DMA_ReceiveProcess_Stopped ((uint32_t)0x00000000) /*!< Stopped - Reset or Stop Rx Command issued */
+#define ETH_DMA_ReceiveProcess_Fetching ((uint32_t)0x00020000) /*!< Running - fetching the Rx descriptor */
+#define ETH_DMA_ReceiveProcess_Waiting ((uint32_t)0x00060000) /*!< Running - waiting for packet */
+#define ETH_DMA_ReceiveProcess_Suspended ((uint32_t)0x00080000) /*!< Suspended - Rx Desciptor unavailable */
+#define ETH_DMA_ReceiveProcess_Closing ((uint32_t)0x000A0000) /*!< Running - closing descriptor */
+#define ETH_DMA_ReceiveProcess_Queuing ((uint32_t)0x000E0000) /*!< Running - queuing the recieve frame into host memory */
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_DMA_overflow_
+ * @{
+ */
+#define ETH_DMA_Overflow_RxFIFOCounter ((uint32_t)0x10000000) /*!< Overflow bit for FIFO overflow counter */
+#define ETH_DMA_Overflow_MissedFrameCounter ((uint32_t)0x00010000) /*!< Overflow bit for missed frame counter */
+#define IS_ETH_DMA_GET_OVERFLOW(OVERFLOW) (((OVERFLOW) == ETH_DMA_Overflow_RxFIFOCounter) || \
+ ((OVERFLOW) == ETH_DMA_Overflow_MissedFrameCounter))
+
+/**--------------------------------------------------------------------------**/
+/**
+ * @brief Ethernet PMT defines
+ */
+/**--------------------------------------------------------------------------**/
+/**
+ * @}
+ */
+
+/** @defgroup ETH_PMT_Flags
+ * @{
+ */
+#define ETH_PMT_FLAG_WUFFRPR ((uint32_t)0x80000000) /*!< Wake-Up Frame Filter Register Poniter Reset */
+#define ETH_PMT_FLAG_WUFR ((uint32_t)0x00000040) /*!< Wake-Up Frame Received */
+#define ETH_PMT_FLAG_MPR ((uint32_t)0x00000020) /*!< Magic Packet Received */
+#define IS_ETH_PMT_GET_FLAG(FLAG) (((FLAG) == ETH_PMT_FLAG_WUFR) || \
+ ((FLAG) == ETH_PMT_FLAG_MPR))
+
+/**--------------------------------------------------------------------------**/
+/**
+ * @brief Ethernet MMC defines
+ */
+/**--------------------------------------------------------------------------**/
+/**
+ * @}
+ */
+
+/** @defgroup ETH_MMC_Tx_Interrupts
+ * @{
+ */
+#define ETH_MMC_INT_TGF ((uint32_t)0x00200000) /*!< When Tx good frame counter reaches half the maximum value */
+#define ETH_MMC_INT_TGFMSC ((uint32_t)0x00008000) /*!< When Tx good multi col counter reaches half the maximum value */
+#define ETH_MMC_INT_TGFSC ((uint32_t)0x00004000) /*!< When Tx good single col counter reaches half the maximum value */
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_MMC_Rx_Interrupts
+ * @{
+ */
+#define ETH_MMC_INT_RGUF ((uint32_t)0x10020000) /*!< When Rx good unicast frames counter reaches half the maximum value */
+#define ETH_MMC_INT_RFAE ((uint32_t)0x10000040) /*!< When Rx alignment error counter reaches half the maximum value */
+#define ETH_MMC_INT_RFCE ((uint32_t)0x10000020) /*!< When Rx crc error counter reaches half the maximum value */
+#define IS_ETH_MMC_IT(IT) (((((IT) & (uint32_t)0xFFDF3FFF) == 0x00) || (((IT) & (uint32_t)0xEFFDFF9F) == 0x00)) && \
+ ((IT) != 0x00))
+#define IS_ETH_MMC_GET_IT(IT) (((IT) == ETH_MMC_INT_TGF) || ((IT) == ETH_MMC_INT_TGFMSC) || \
+ ((IT) == ETH_MMC_INT_TGFSC) || ((IT) == ETH_MMC_INT_RGUF) || \
+ ((IT) == ETH_MMC_INT_RFAE) || ((IT) == ETH_MMC_INT_RFCE))
+/**
+ * @}
+ */
+
+/** @defgroup ETH_MMC_Registers
+ * @{
+ */
+#define ETH_MMCCR ((uint32_t)0x00000100) /*!< MMC CR register */
+#define ETH_MMCRIR ((uint32_t)0x00000104) /*!< MMC RIR register */
+#define ETH_MMCTIR ((uint32_t)0x00000108) /*!< MMC TIR register */
+#define ETH_MMCRIMR ((uint32_t)0x0000010C) /*!< MMC RIMR register */
+#define ETH_MMCTIMR ((uint32_t)0x00000110) /*!< MMC TIMR register */
+#define ETH_MMCTGFSCCR ((uint32_t)0x0000014C) /*!< MMC TGFSCCR register */
+#define ETH_MMCTGFMSCCR ((uint32_t)0x00000150) /*!< MMC TGFMSCCR register */
+#define ETH_MMCTGFCR ((uint32_t)0x00000168) /*!< MMC TGFCR register */
+#define ETH_MMCRFCECR ((uint32_t)0x00000194) /*!< MMC RFCECR register */
+#define ETH_MMCRFAECR ((uint32_t)0x00000198) /*!< MMC RFAECR register */
+#define ETH_MMCRGUFCR ((uint32_t)0x000001C4) /*!< MMC RGUFCR register */
+
+/**
+ * @brief ETH MMC registers
+ */
+#define IS_ETH_MMC_REGISTER(REG) (((REG) == ETH_MMCCR) || ((REG) == ETH_MMCRIR) || \
+ ((REG) == ETH_MMCTIR) || ((REG) == ETH_MMCRIMR) || \
+ ((REG) == ETH_MMCTIMR) || ((REG) == ETH_MMCTGFSCCR) || \
+ ((REG) == ETH_MMCTGFMSCCR) || ((REG) == ETH_MMCTGFCR) || \
+ ((REG) == ETH_MMCRFCECR) || ((REG) == ETH_MMCRFAECR) || \
+ ((REG) == ETH_MMCRGUFCR))
+
+/**--------------------------------------------------------------------------**/
+/**
+ * @brief Ethernet PTP defines
+ */
+/**--------------------------------------------------------------------------**/
+/**
+ * @}
+ */
+
+/** @defgroup ETH_PTP_time_update_method
+ * @{
+ */
+#define ETH_PTP_FineUpdate ((uint32_t)0x00000001) /*!< Fine Update method */
+#define ETH_PTP_CoarseUpdate ((uint32_t)0x00000000) /*!< Coarse Update method */
+#define IS_ETH_PTP_UPDATE(UPDATE) (((UPDATE) == ETH_PTP_FineUpdate) || \
+ ((UPDATE) == ETH_PTP_CoarseUpdate))
+
+/**
+ * @}
+ */
+
+
+/** @defgroup ETH_PTP_Flags
+ * @{
+ */
+#define ETH_PTP_FLAG_TSARU ((uint32_t)0x00000020) /*!< Addend Register Update */
+#define ETH_PTP_FLAG_TSITE ((uint32_t)0x00000010) /*!< Time Stamp Interrupt Trigger */
+#define ETH_PTP_FLAG_TSSTU ((uint32_t)0x00000008) /*!< Time Stamp Update */
+#define ETH_PTP_FLAG_TSSTI ((uint32_t)0x00000004) /*!< Time Stamp Initialize */
+#define IS_ETH_PTP_GET_FLAG(FLAG) (((FLAG) == ETH_PTP_FLAG_TSARU) || \
+ ((FLAG) == ETH_PTP_FLAG_TSITE) || \
+ ((FLAG) == ETH_PTP_FLAG_TSSTU) || \
+ ((FLAG) == ETH_PTP_FLAG_TSSTI))
+/**
+ * @brief ETH PTP subsecond increment
+ */
+#define IS_ETH_PTP_SUBSECOND_INCREMENT(SUBSECOND) ((SUBSECOND) <= 0xFF)
+
+/**
+ * @}
+ */
+
+
+/** @defgroup ETH_PTP_time_sign
+ * @{
+ */
+#define ETH_PTP_PositiveTime ((uint32_t)0x00000000) /*!< Positive time value */
+#define ETH_PTP_NegativeTime ((uint32_t)0x80000000) /*!< Negative time value */
+#define IS_ETH_PTP_TIME_SIGN(SIGN) (((SIGN) == ETH_PTP_PositiveTime) || \
+ ((SIGN) == ETH_PTP_NegativeTime))
+
+/**
+ * @brief ETH PTP time stamp low update
+ */
+#define IS_ETH_PTP_TIME_STAMP_UPDATE_SUBSECOND(SUBSECOND) ((SUBSECOND) <= 0x7FFFFFFF)
+
+/**
+ * @brief ETH PTP registers
+ */
+#define ETH_PTPTSCR ((uint32_t)0x00000700) /*!< PTP TSCR register */
+#define ETH_PTPSSIR ((uint32_t)0x00000704) /*!< PTP SSIR register */
+#define ETH_PTPTSHR ((uint32_t)0x00000708) /*!< PTP TSHR register */
+#define ETH_PTPTSLR ((uint32_t)0x0000070C) /*!< PTP TSLR register */
+#define ETH_PTPTSHUR ((uint32_t)0x00000710) /*!< PTP TSHUR register */
+#define ETH_PTPTSLUR ((uint32_t)0x00000714) /*!< PTP TSLUR register */
+#define ETH_PTPTSAR ((uint32_t)0x00000718) /*!< PTP TSAR register */
+#define ETH_PTPTTHR ((uint32_t)0x0000071C) /*!< PTP TTHR register */
+#define ETH_PTPTTLR ((uint32_t)0x00000720) /* PTP TTLR register */
+#define IS_ETH_PTP_REGISTER(REG) (((REG) == ETH_PTPTSCR) || ((REG) == ETH_PTPSSIR) || \
+ ((REG) == ETH_PTPTSHR) || ((REG) == ETH_PTPTSLR) || \
+ ((REG) == ETH_PTPTSHUR) || ((REG) == ETH_PTPTSLUR) || \
+ ((REG) == ETH_PTPTSAR) || ((REG) == ETH_PTPTTHR) || \
+ ((REG) == ETH_PTPTTLR))
+
+/**
+ * @}
+ */
+
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Exported_Macros
+ * @{
+ */
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Exported_Functions
+ * @{
+ */
+void ETH_DeInit(void);
+uint32_t ETH_Init(ETH_InitType* ETH_InitStruct, u16 PHYAddress);
+void ETH_StructInit(ETH_InitType* ETH_InitStruct);
+void ETH_SoftwareReset(void);
+FlagStatus ETH_GetSoftwareResetStatus(void);
+void ETH_Start(void);
+uint32_t ETH_HandleTxPkt(u8 *ppkt, u16 FrameLength);
+uint32_t ETH_HandleRxPkt(u8 *ppkt);
+uint32_t ETH_GetRxPktSize(void);
+void ETH_DropRxPkt(void);
+
+/**
+ * @brief PHY
+ */
+u16 ETH_ReadPHYRegister(u16 PHYAddress, u16 PHYReg);
+uint32_t ETH_WritePHYRegister(u16 PHYAddress, u16 PHYReg, u16 PHYValue);
+uint32_t ETH_PHYLoopBackCmd(u16 PHYAddress, FunctionalState NewState);
+
+/**
+ * @brief MAC
+ */
+void ETH_MACTransmissionCmd(FunctionalState NewState);
+void ETH_MACReceptionCmd(FunctionalState NewState);
+FlagStatus ETH_GetFlowControlBusyStatus(void);
+void ETH_InitiatePauseControlFrame(void);
+void ETH_BackPressureActivationCmd(FunctionalState NewState);
+FlagStatus ETH_GetMACFlagStatus(uint32_t ETH_MAC_FLAG);
+ITStatus ETH_GetMACITStatus(uint32_t ETH_MAC_IT);
+void ETH_MACITConfig(uint32_t ETH_MAC_IT, FunctionalState NewState);
+void ETH_MACAddressConfig(uint32_t MacAddr, u8 *Addr);
+void ETH_GetMACAddress(uint32_t MacAddr, u8 *Addr);
+void ETH_MACAddressPerfectFilterCmd(uint32_t MacAddr, FunctionalState NewState);
+void ETH_MACAddressFilterConfig(uint32_t MacAddr, uint32_t Filter);
+void ETH_MACAddressMaskBytesFilterConfig(uint32_t MacAddr, uint32_t MaskByte);
+
+/**
+ * @brief DMA Tx/Rx descriptors
+ */
+void ETH_DMATxDescChainInit(ETH_DMADESCTypeDef *DMATxDescTab, u8 *TxBuff, uint32_t TxBuffCount);
+void ETH_DMATxDescRingInit(ETH_DMADESCTypeDef *DMATxDescTab, u8 *TxBuff1, u8 *TxBuff2, uint32_t TxBuffCount);
+FlagStatus ETH_GetDMATxDescFlagStatus(ETH_DMADESCTypeDef *DMATxDesc, uint32_t ETH_DMATxDescFlag);
+uint32_t ETH_GetDMATxDescCollisionCount(ETH_DMADESCTypeDef *DMATxDesc);
+void ETH_SetDMATxDescOwnBit(ETH_DMADESCTypeDef *DMATxDesc);
+void ETH_DMATxDescTransmitITConfig(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
+void ETH_DMATxDescFrameSegmentConfig(ETH_DMADESCTypeDef *DMATxDesc, uint32_t DMATxDesc_FrameSegment);
+void ETH_DMATxDescChecksumInsertionConfig(ETH_DMADESCTypeDef *DMATxDesc, uint32_t DMATxDesc_Checksum);
+void ETH_DMATxDescCRCCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
+void ETH_DMATxDescEndOfRingCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
+void ETH_DMATxDescSecondAddressChainedCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
+void ETH_DMATxDescShortFramePaddingCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
+void ETH_DMATxDescTimeStampCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
+void ETH_DMATxDescBufferSizeConfig(ETH_DMADESCTypeDef *DMATxDesc, uint32_t BufferSize1, uint32_t BufferSize2);
+void ETH_DMARxDescChainInit(ETH_DMADESCTypeDef *DMARxDescTab, u8 *RxBuff, uint32_t RxBuffCount);
+void ETH_DMARxDescRingInit(ETH_DMADESCTypeDef *DMARxDescTab, u8 *RxBuff1, u8 *RxBuff2, uint32_t RxBuffCount);
+FlagStatus ETH_GetDMARxDescFlagStatus(ETH_DMADESCTypeDef *DMARxDesc, uint32_t ETH_DMARxDescFlag);
+void ETH_SetDMARxDescOwnBit(ETH_DMADESCTypeDef *DMARxDesc);
+uint32_t ETH_GetDMARxDescFrameLength(ETH_DMADESCTypeDef *DMARxDesc);
+void ETH_DMARxDescReceiveITConfig(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState);
+void ETH_DMARxDescEndOfRingCmd(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState);
+void ETH_DMARxDescSecondAddressChainedCmd(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState);
+uint32_t ETH_GetDMARxDescBufferSize(ETH_DMADESCTypeDef *DMARxDesc, uint32_t DMARxDesc_Buffer);
+
+/**
+ * @brief DMA
+ */
+FlagStatus ETH_GetDMAFlagStatus(uint32_t ETH_DMA_FLAG);
+void ETH_DMAClearFlag(uint32_t ETH_DMA_FLAG);
+ITStatus ETH_GetDMAITStatus(uint32_t ETH_DMA_IT);
+void ETH_DMAClearITPendingBit(uint32_t ETH_DMA_IT);
+uint32_t ETH_GetTransmitProcessState(void);
+uint32_t ETH_GetReceiveProcessState(void);
+void ETH_FlushTransmitFIFO(void);
+FlagStatus ETH_GetFlushTransmitFIFOStatus(void);
+void ETH_DMATransmissionCmd(FunctionalState NewState);
+void ETH_DMAReceptionCmd(FunctionalState NewState);
+void ETH_DMAITConfig(uint32_t ETH_DMA_IT, FunctionalState NewState);
+FlagStatus ETH_GetDMAOverflowStatus(uint32_t ETH_DMA_Overflow);
+uint32_t ETH_GetRxOverflowMissedFrameCounter(void);
+uint32_t ETH_GetBufferUnavailableMissedFrameCounter(void);
+uint32_t ETH_GetCurrentTxDescStartAddress(void);
+uint32_t ETH_GetCurrentRxDescStartAddress(void);
+uint32_t ETH_GetCurrentTxBufferAddress(void);
+uint32_t ETH_GetCurrentRxBufferAddress(void);
+void ETH_ResumeDMATransmission(void);
+void ETH_ResumeDMAReception(void);
+
+/**
+ * @brief PMT
+ */
+void ETH_ResetWakeUpFrameFilterRegisterPointer(void);
+void ETH_SetWakeUpFrameFilterRegister(uint32_t *Buffer);
+void ETH_GlobalUnicastWakeUpCmd(FunctionalState NewState);
+FlagStatus ETH_GetPMTFlagStatus(uint32_t ETH_PMT_FLAG);
+void ETH_WakeUpFrameDetectionCmd(FunctionalState NewState);
+void ETH_MagicPacketDetectionCmd(FunctionalState NewState);
+void ETH_PowerDownCmd(FunctionalState NewState);
+
+/**
+ * @brief MMC
+ */
+void ETH_MMCCounterFreezeCmd(FunctionalState NewState);
+void ETH_MMCResetOnReadCmd(FunctionalState NewState);
+void ETH_MMCCounterRolloverCmd(FunctionalState NewState);
+void ETH_MMCCountersReset(void);
+void ETH_MMCITConfig(uint32_t ETH_MMC_IT, FunctionalState NewState);
+ITStatus ETH_GetMMCITStatus(uint32_t ETH_MMC_IT);
+uint32_t ETH_GetMMCRegister(uint32_t ETH_MMCReg);
+
+/**
+ * @brief PTP
+ */
+uint32_t ETH_HandlePTPTxPkt(u8 *ppkt, u16 FrameLength, uint32_t *PTPTxTab);
+uint32_t ETH_HandlePTPRxPkt(u8 *ppkt, uint32_t *PTPRxTab);
+void ETH_DMAPTPTxDescChainInit(ETH_DMADESCTypeDef *DMATxDescTab, ETH_DMADESCTypeDef *DMAPTPTxDescTab, u8* TxBuff, uint32_t TxBuffCount);
+void ETH_DMAPTPRxDescChainInit(ETH_DMADESCTypeDef *DMARxDescTab, ETH_DMADESCTypeDef *DMAPTPRxDescTab, u8 *RxBuff, uint32_t RxBuffCount);
+void ETH_EnablePTPTimeStampAddend(void);
+void ETH_EnablePTPTimeStampInterruptTrigger(void);
+void ETH_EnablePTPTimeStampUpdate(void);
+void ETH_InitializePTPTimeStamp(void);
+void ETH_PTPUpdateMethodConfig(uint32_t UpdateMethod);
+void ETH_PTPTimeStampCmd(FunctionalState NewState);
+FlagStatus ETH_GetPTPFlagStatus(uint32_t ETH_PTP_FLAG);
+void ETH_SetPTPSubSecondIncrement(uint32_t SubSecondValue);
+void ETH_SetPTPTimeStampUpdate(uint32_t Sign, uint32_t SecondValue, uint32_t SubSecondValue);
+void ETH_SetPTPTimeStampAddend(uint32_t Value);
+void ETH_SetPTPTargetTime(uint32_t HighValue, uint32_t LowValue);
+uint32_t ETH_GetPTPRegister(uint32_t ETH_PTPReg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_ETH_H */
+/**
+ * @}
+ */
+
+
+/**
+ * @}
+ */
+
+/******************* (C) COPYRIGHT 2009 Artery Technology *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_exti.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_exti.h
new file mode 100644
index 0000000000000000000000000000000000000000..8ad1b7079492b9a6b67a40098655701a32bbc53c
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_exti.h
@@ -0,0 +1,191 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_exti.h
+ * Description : at32f4xx EXTI header file
+ * Date : 2019-06-04
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_EXTI_H
+#define __AT32F4xx_EXTI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup EXTI
+ * @{
+ */
+
+/** @defgroup EXTI_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief EXTI mode enumeration
+ */
+
+typedef enum
+{
+ EXTI_Mode_Interrupt = 0x00,
+ EXTI_Mode_Event = 0x04
+} EXTIMode_Type;
+
+#define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event))
+
+/**
+ * @brief EXTI Trigger enumeration
+ */
+
+typedef enum
+{
+ EXTI_Trigger_Rising = 0x08,
+ EXTI_Trigger_Falling = 0x0C,
+ EXTI_Trigger_Rising_Falling = 0x10
+} EXTITrigger_Type;
+
+#define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \
+ ((TRIGGER) == EXTI_Trigger_Falling) || \
+ ((TRIGGER) == EXTI_Trigger_Rising_Falling))
+/**
+ * @brief EXTI Init Structure definition
+ */
+
+typedef struct
+{
+ uint32_t EXTI_Line; /*!< Specifies the EXTI lines to be enabled or disabled.
+ This parameter can be any combination of @ref EXTI_Lines */
+
+ EXTIMode_Type EXTI_Mode; /*!< Specifies the mode for the EXTI lines.
+ This parameter can be a value of @ref EXTIMode_Type */
+
+ EXTITrigger_Type EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines.
+ This parameter can be a value of @ref EXTIMode_Type */
+
+ FunctionalState EXTI_LineEnable; /*!< Specifies the new state of the selected EXTI lines.
+ This parameter can be set either to ENABLE or DISABLE */
+} EXTI_InitType;
+
+/**
+ * @}
+ */
+
+/** @defgroup EXTI_Exported_Constants
+ * @{
+ */
+
+/** @defgroup EXTI_Lines
+ * @{
+ */
+
+#define EXTI_Line0 ((uint32_t)0x000001) /*!< External interrupt line 0 */
+#define EXTI_Line1 ((uint32_t)0x000002) /*!< External interrupt line 1 */
+#define EXTI_Line2 ((uint32_t)0x000004) /*!< External interrupt line 2 */
+#define EXTI_Line3 ((uint32_t)0x000008) /*!< External interrupt line 3 */
+#define EXTI_Line4 ((uint32_t)0x000010) /*!< External interrupt line 4 */
+#define EXTI_Line5 ((uint32_t)0x000020) /*!< External interrupt line 5 */
+#define EXTI_Line6 ((uint32_t)0x000040) /*!< External interrupt line 6 */
+#define EXTI_Line7 ((uint32_t)0x000080) /*!< External interrupt line 7 */
+#define EXTI_Line8 ((uint32_t)0x000100) /*!< External interrupt line 8 */
+#define EXTI_Line9 ((uint32_t)0x000200) /*!< External interrupt line 9 */
+#define EXTI_Line10 ((uint32_t)0x000400) /*!< External interrupt line 10 */
+#define EXTI_Line11 ((uint32_t)0x000800) /*!< External interrupt line 11 */
+#define EXTI_Line12 ((uint32_t)0x001000) /*!< External interrupt line 12 */
+#define EXTI_Line13 ((uint32_t)0x002000) /*!< External interrupt line 13 */
+#define EXTI_Line14 ((uint32_t)0x004000) /*!< External interrupt line 14 */
+#define EXTI_Line15 ((uint32_t)0x008000) /*!< External interrupt line 15 */
+#define EXTI_Line16 ((uint32_t)0x010000) /*!< External interrupt line 16 Connected to the PVD Output */
+#define EXTI_Line17 ((uint32_t)0x020000) /*!< External interrupt line 17 Connected to the RTC Alarm event */
+#define EXTI_Line18 ((uint32_t)0x040000) /*!< External interrupt line 18 Connected to the USB Device FS
+ Wakeup from suspend event */
+#define EXTI_Line19 ((uint32_t)0x080000) /*!< External interrupt line 19 Connected to the COMP1*/
+#ifdef AT32F415xx
+ #define EXTI_Line20 ((uint32_t)0x100000) /*!< External interrupt line 20 Connected to the COMP2*/
+ #define EXTI_Line21 ((uint32_t)0x200000) /*!< External interrupt line 20 Connected to the RTC Temper_Pin and Temper_Stamp*/
+ #define EXTI_Line22 ((uint32_t)0x400000) /*!< External interrupt line 20 Connected to the RTC Wakeup*/
+
+ #define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0xFF800000) == 0x00) && ((LINE) != (uint16_t)0x00))
+ #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
+ ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
+ ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \
+ ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \
+ ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \
+ ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \
+ ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \
+ ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \
+ ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \
+ ((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19) || \
+ ((LINE) == EXTI_Line20) || ((LINE) == EXTI_Line21) || \
+ ((LINE) == EXTI_Line22))
+#else
+ #define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0xFFF00000) == 0x00) && ((LINE) != (uint16_t)0x00))
+ #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
+ ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
+ ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \
+ ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \
+ ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \
+ ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \
+ ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \
+ ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \
+ ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \
+ ((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19))
+#endif
+
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup EXTI_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup EXTI_Exported_Functions
+ * @{
+ */
+
+void EXTI_Reset(void);
+void EXTI_Init(EXTI_InitType* EXTI_InitStruct);
+void EXTI_StructInit(EXTI_InitType* EXTI_InitStruct);
+void EXTI_GenerateSWInt(uint32_t EXTI_Line);
+FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line);
+void EXTI_ClearFlag(uint32_t EXTI_Line);
+ITStatus EXTI_GetIntStatus(uint32_t EXTI_Line);
+void EXTI_ClearIntPendingBit(uint32_t EXTI_Line);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_EXTI_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_flash.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_flash.h
new file mode 100644
index 0000000000000000000000000000000000000000..6c1328a24c9f0d278b18d535bb92357dfb96d0aa
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_flash.h
@@ -0,0 +1,428 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_flash.h
+ * Description : at32f4xx FMC header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_FLASH_H
+#define __AT32F4xx_FLASH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup FLASH
+ * @{
+ */
+
+/** @defgroup FLASH_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief FLASH Status
+ */
+
+typedef enum
+{
+ FLASH_BSY = 1,
+ FLASH_PGRM_FLR,
+ FLASH_WRPRT_FLR,
+ FLASH_PRC_DONE,
+ FLASH_TIMEOUT
+} FLASH_Status;
+
+/**
+ * @brief BANK3 SEL
+ */
+
+typedef enum
+{
+ E_BANK3_SEL_ESMT_SP=0,
+ E_BANK3_SEL_GENERAL_CFGQE,
+ E_BANK3_SEL_GENERAL,
+}T_BANK3_SEL;
+
+/**
+ * @}
+ */
+
+/** @defgroup FLASH_Exported_Constants
+ * @{
+ */
+
+/** @defgroup Option_Bytes_Write_Protection
+ * @{
+ */
+
+/* Values to be used with AT32F4xx Medium-density devices */
+#define FLASH_WRPRT_PAGE_0to3 ((uint32_t)0x00000001) /*!< AT32F4xx Medium-density devices: Write protection of page 0 to 3 */
+#define FLASH_WRPRT_PAGE_4to7 ((uint32_t)0x00000002) /*!< AT32F4xx Medium-density devices: Write protection of page 4 to 7 */
+#define FLASH_WRPRT_PAGE_8to11 ((uint32_t)0x00000004) /*!< AT32F4xx Medium-density devices: Write protection of page 8 to 11 */
+#define FLASH_WRPRT_PAGE_12to15 ((uint32_t)0x00000008) /*!< AT32F4xx Medium-density devices: Write protection of page 12 to 15 */
+#define FLASH_WRPRT_PAGE_16to19 ((uint32_t)0x00000010) /*!< AT32F4xx Medium-density devices: Write protection of page 16 to 19 */
+#define FLASH_WRPRT_PAGE_20to23 ((uint32_t)0x00000020) /*!< AT32F4xx Medium-density devices: Write protection of page 20 to 23 */
+#define FLASH_WRPRT_PAGE_24to27 ((uint32_t)0x00000040) /*!< AT32F4xx Medium-density devices: Write protection of page 24 to 27 */
+#define FLASH_WRPRT_PAGE_28to31 ((uint32_t)0x00000080) /*!< AT32F4xx Medium-density devices: Write protection of page 28 to 31 */
+#define FLASH_WRPRT_PAGE_32to35 ((uint32_t)0x00000100) /*!< AT32F4xx Medium-density devices: Write protection of page 32 to 35 */
+#define FLASH_WRPRT_PAGE_36to39 ((uint32_t)0x00000200) /*!< AT32F4xx Medium-density devices: Write protection of page 36 to 39 */
+#define FLASH_WRPRT_PAGE_40to43 ((uint32_t)0x00000400) /*!< AT32F4xx Medium-density devices: Write protection of page 40 to 43 */
+#define FLASH_WRPRT_PAGE_44to47 ((uint32_t)0x00000800) /*!< AT32F4xx Medium-density devices: Write protection of page 44 to 47 */
+#define FLASH_WRPRT_PAGE_48to51 ((uint32_t)0x00001000) /*!< AT32F4xx Medium-density devices: Write protection of page 48 to 51 */
+#define FLASH_WRPRT_PAGE_52to55 ((uint32_t)0x00002000) /*!< AT32F4xx Medium-density devices: Write protection of page 52 to 55 */
+#define FLASH_WRPRT_PAGE_56to59 ((uint32_t)0x00004000) /*!< AT32F4xx Medium-density devices: Write protection of page 56 to 59 */
+#define FLASH_WRPRT_PAGE_60to63 ((uint32_t)0x00008000) /*!< AT32F4xx Medium-density devices: Write protection of page 60 to 63 */
+#define FLASH_WRPRT_PAGE_64to67 ((uint32_t)0x00010000) /*!< AT32F4xx Medium-density devices: Write protection of page 64 to 67 */
+#define FLASH_WRPRT_PAGE_68to71 ((uint32_t)0x00020000) /*!< AT32F4xx Medium-density devices: Write protection of page 68 to 71 */
+#define FLASH_WRPRT_PAGE_72to75 ((uint32_t)0x00040000) /*!< AT32F4xx Medium-density devices: Write protection of page 72 to 75 */
+#define FLASH_WRPRT_PAGE_76to79 ((uint32_t)0x00080000) /*!< AT32F4xx Medium-density devices: Write protection of page 76 to 79 */
+#define FLASH_WRPRT_PAGE_80to83 ((uint32_t)0x00100000) /*!< AT32F4xx Medium-density devices: Write protection of page 80 to 83 */
+#define FLASH_WRPRT_PAGE_84to87 ((uint32_t)0x00200000) /*!< AT32F4xx Medium-density devices: Write protection of page 84 to 87 */
+#define FLASH_WRPRT_PAGE_88to91 ((uint32_t)0x00400000) /*!< AT32F4xx Medium-density devices: Write protection of page 88 to 91 */
+#define FLASH_WRPRT_PAGE_92to95 ((uint32_t)0x00800000) /*!< AT32F4xx Medium-density devices: Write protection of page 92 to 95 */
+#define FLASH_WRPRT_PAGE_96to99 ((uint32_t)0x01000000) /*!< AT32F4xx Medium-density devices: Write protection of page 96 to 99 */
+#define FLASH_WRPRT_PAGE_100to103 ((uint32_t)0x02000000) /*!< AT32F4xx Medium-density devices: Write protection of page 100 to 103 */
+#define FLASH_WRPRT_PAGE_104to107 ((uint32_t)0x04000000) /*!< AT32F4xx Medium-density devices: Write protection of page 104 to 107 */
+#define FLASH_WRPRT_PAGE_108to111 ((uint32_t)0x08000000) /*!< AT32F4xx Medium-density devices: Write protection of page 108 to 111 */
+#define FLASH_WRPRT_PAGE_112to115 ((uint32_t)0x10000000) /*!< AT32F4xx Medium-density devices: Write protection of page 112 to 115 */
+#define FLASH_WRPRT_PAGE_116to119 ((uint32_t)0x20000000) /*!< AT32F4xx Medium-density devices: Write protection of page 115 to 119 */
+#define FLASH_WRPRT_PAGE_120to123 ((uint32_t)0x40000000) /*!< AT32F4xx Medium-density devices: Write protection of page 120 to 123 */
+#define FLASH_WRPRT_PAGE_124to127 ((uint32_t)0x80000000) /*!< AT32F4xx Medium-density devices: Write protection of page 124 to 127 */
+
+/* Values to be used with AT32F4xx High-density, XL-density and AT32F415xx devices */
+#define FLASH_WRPRT_PAGE_0to1 ((uint32_t)0x00000001) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 0 to 1 */
+#define FLASH_WRPRT_PAGE_2to3 ((uint32_t)0x00000002) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 2 to 3 */
+#define FLASH_WRPRT_PAGE_4to5 ((uint32_t)0x00000004) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 4 to 5 */
+#define FLASH_WRPRT_PAGE_6to7 ((uint32_t)0x00000008) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 6 to 7 */
+#define FLASH_WRPRT_PAGE_8to9 ((uint32_t)0x00000010) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 8 to 9 */
+#define FLASH_WRPRT_PAGE_10to11 ((uint32_t)0x00000020) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 10 to 11 */
+#define FLASH_WRPRT_PAGE_12to13 ((uint32_t)0x00000040) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 12 to 13 */
+#define FLASH_WRPRT_PAGE_14to15 ((uint32_t)0x00000080) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 14 to 15 */
+#define FLASH_WRPRT_PAGE_16to17 ((uint32_t)0x00000100) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 16 to 17 */
+#define FLASH_WRPRT_PAGE_18to19 ((uint32_t)0x00000200) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 18 to 19 */
+#define FLASH_WRPRT_PAGE_20to21 ((uint32_t)0x00000400) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 20 to 21 */
+#define FLASH_WRPRT_PAGE_22to23 ((uint32_t)0x00000800) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 22 to 23 */
+#define FLASH_WRPRT_PAGE_24to25 ((uint32_t)0x00001000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 24 to 25 */
+#define FLASH_WRPRT_PAGE_26to27 ((uint32_t)0x00002000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 26 to 27 */
+#define FLASH_WRPRT_PAGE_28to29 ((uint32_t)0x00004000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 28 to 29 */
+#define FLASH_WRPRT_PAGE_30to31 ((uint32_t)0x00008000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 30 to 31 */
+#define FLASH_WRPRT_PAGE_32to33 ((uint32_t)0x00010000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 32 to 33 */
+#define FLASH_WRPRT_PAGE_34to35 ((uint32_t)0x00020000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 34 to 35 */
+#define FLASH_WRPRT_PAGE_36to37 ((uint32_t)0x00040000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 36 to 37 */
+#define FLASH_WRPRT_PAGE_38to39 ((uint32_t)0x00080000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 38 to 39 */
+#define FLASH_WRPRT_PAGE_40to41 ((uint32_t)0x00100000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 40 to 41 */
+#define FLASH_WRPRT_PAGE_42to43 ((uint32_t)0x00200000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 42 to 43 */
+#define FLASH_WRPRT_PAGE_44to45 ((uint32_t)0x00400000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 44 to 45 */
+#define FLASH_WRPRT_PAGE_46to47 ((uint32_t)0x00800000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 46 to 47 */
+#define FLASH_WRPRT_PAGE_48to49 ((uint32_t)0x01000000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 48 to 49 */
+#define FLASH_WRPRT_PAGE_50to51 ((uint32_t)0x02000000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 50 to 51 */
+#define FLASH_WRPRT_PAGE_52to53 ((uint32_t)0x04000000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 52 to 53 */
+#define FLASH_WRPRT_PAGE_54to55 ((uint32_t)0x08000000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 54 to 55 */
+#define FLASH_WRPRT_PAGE_56to57 ((uint32_t)0x10000000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 56 to 57 */
+#define FLASH_WRPRT_PAGE_58to59 ((uint32_t)0x20000000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 58 to 59 */
+#define FLASH_WRPRT_PAGE_60to61 ((uint32_t)0x40000000) /*!< AT32F4xx High-density, XL-density and AT32F415xx devices:
+ Write protection of page 60 to 61 */
+
+#define FLASH_WRPRT_PAGE_62to63 ((uint32_t)0x80000000) /*!< AT32F415xx Medium-density devices: Write protection of page 62 to 63 */
+#define FLASH_WRPRT_PAGE_62to127 ((uint32_t)0x80000000) /*!< AT32F4xx High-density, AT32F415xx Medium-density, High-density devices:
+ Write protection of page 62 to 127 */
+#define FLASH_WRPRT_PAGE_62to255 ((uint32_t)0x80000000) /*!< AT32F4xx High-density devices: Write protection of page 62 to 255 */
+#define FLASH_WRPRT_PAGE_62to511 ((uint32_t)0x80000000) /*!< AT32F4xx XL-density devices: Write protection of page 62 to 511 */
+
+#define FLASH_WRPRT_AllPAGES ((uint32_t)0xFFFFFFFF) /*!< Write protection of all Pages */
+
+#define IS_FLASH_WRPRT_PAGES(PAGES) (((PAGES) != 0x00000000))
+
+#define IS_FLASH_ADDR(ADDR) (((ADDR) >= 0x08000000) && ((ADDR) <= FLASH_BANK3_ADDR_MAX))
+
+/**
+ * @}
+ */
+
+/** @defgroup Option_Bytes_IWatchdog
+ * @{
+ */
+
+#define UOB_SW_IWDG ((uint16_t)0x0001) /*!< Software IWDG selected */
+#define UOB_HW_IWDG ((uint16_t)0x0000) /*!< Hardware IWDG selected */
+#define IS_UOB_IWDG_CFG(CFG) (((CFG) == UOB_SW_IWDG) || ((CFG) == UOB_HW_IWDG))
+
+/**
+ * @}
+ */
+
+/** @defgroup Option_Bytes_nRST_STOP
+ * @{
+ */
+
+#define UOB_NO_RST_STP ((uint16_t)0x0002) /*!< No reset generated when entering in STOP */
+#define UOB_RST_STP ((uint16_t)0x0000) /*!< Reset generated when entering in STOP */
+#define IS_UOB_STOP_CFG(CFG) (((CFG) == UOB_NO_RST_STP) || ((CFG) == UOB_RST_STP))
+
+/**
+ * @}
+ */
+
+/** @defgroup Option_Bytes_nRST_STDBY
+ * @{
+ */
+
+#define UOB_NO_RST_STDBY ((uint16_t)0x0004) /*!< No reset generated when entering in STANDBY */
+#define UOB_RST_STDBY ((uint16_t)0x0000) /*!< Reset generated when entering in STANDBY */
+#define IS_UOB_STDBY_CFG(CFG) (((CFG) == UOB_NO_RST_STDBY) || ((CFG) == UOB_RST_STDBY))
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+/**
+ * @}
+ */
+/** @defgroup FLASH_Boot
+ * @{
+ */
+#define FLASH_BOOT_FROM_BANK1 ((uint16_t)0x0000) /*!< At startup, if boot pins are set in boot from user Flash position
+ and this parameter is selected the device will boot from Bank1(Default) */
+#define FLASH_BOOT_FROM_BANK2 ((uint16_t)0x0001) /*!< At startup, if boot pins are set in boot from user Flash position
+ and this parameter is selected the device will boot from Bank 2 or Bank 1,
+ depending on the activation of the bank */
+#define IS_FLASH_BOOT_CFG(CFG) (((CFG) == FLASH_BOOT_FROM_BANK1) || ((CFG) == FLASH_BOOT_FROM_BANK2))
+#endif
+/**
+ * @}
+ */
+/** @defgroup FLASH_Interrupts
+ * @{
+ */
+#define FLASH_INT_FLR ((uint32_t)0x00000400) /*!< FPEC error interrupt source */
+#define FLASH_INT_PRCDN ((uint32_t)0x00001000) /*!< End of FLASH Operation Interrupt source */
+#define FLASH_INT_BANK1_FLR FLASH_INT_FLR /*!< FPEC BANK1 error interrupt source */
+#define FLASH_INT_BANK1_PRCDN FLASH_INT_PRCDN /*!< End of FLASH BANK1 Operation Interrupt source */
+#define FLASH_INT_BANK3 ((uint32_t)0x40000000)
+#define FLASH_INT_BANK3_MASK (~FLASH_INT_BANK3)
+#define FLASH_INT_BANK3_FLR ((uint32_t)0x40000400) /*!< FPEC BANK1 error interrupt source */
+#define FLASH_INT_BANK3_PRCDN ((uint32_t)0x40001000) /*!< End of FLASH BANK1 Operation Interrupt source */
+
+
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+#define FLASH_INT_BANK2 ((uint32_t)0x80000000)
+#define FLASH_INT_BANK2_MASK (~FLASH_INT_BANK2)
+#define FLASH_INT_BANK2_FLR ((uint32_t)0x80000400) /*!< FPEC BANK2 error interrupt source */
+#define FLASH_INT_BANK2_PRCDN ((uint32_t)0x80001000) /*!< End of FLASH BANK2 Operation Interrupt source */
+#define IS_FLASH_INT(INT) ((((INT) & (uint32_t)0x3FFFEBFF) == 0x00000000) && (((INT) != 0x00000000)))
+#else
+#define IS_FLASH_INT(INT) ((((INT) & (uint32_t)0xBFFFEBFF) == 0x00000000) && (((INT) != 0x00000000)))
+#endif
+
+/**
+ * @}
+ */
+
+/** @defgroup FLASH_Flags
+ * @{
+ */
+
+#define FLASH_FLAG_BSY ((uint32_t)0x00000001) /*!< FLASH Busy flag */
+#define FLASH_FLAG_PRCDN ((uint32_t)0x00000020) /*!< FLASH End of Operation flag */
+#define FLASH_FLAG_PRGMFLR ((uint32_t)0x00000004) /*!< FLASH Program error flag */
+#define FLASH_FLAG_WRPRTFLR ((uint32_t)0x00000010) /*!< FLASH Write protected error flag */
+#define FLASH_FLAG_UOBFLR ((uint32_t)0x00000001) /*!< FLASH Option Byte error flag */
+
+#define FLASH_FLAG_BNK1_BSY FLASH_FLAG_BSY /*!< FLASH BANK1 Busy flag*/
+#define FLASH_FLAG_BNK1_PRCDN FLASH_FLAG_PRCDN /*!< FLASH BANK1 End of Operation flag */
+#define FLASH_FLAG_BNK1_PRGMFLR FLASH_FLAG_PRGMFLR /*!< FLASH BANK1 Program error flag */
+#define FLASH_FLAG_BNK1_WRPRTFLR FLASH_FLAG_WRPRTFLR /*!< FLASH BANK1 Write protected error flag */
+
+#define FLASH_FLAG_BANK3 ((uint32_t)0x40000000)
+#define FLASH_FLAG_BNK3_BSY ((uint32_t)0x40000001) /*!< FLASH BANK3 Busy flag*/
+#define FLASH_FLAG_BNK3_PRCDN ((uint32_t)0x40000020) /*!< FLASH BANK3 End of Operation flag */
+#define FLASH_FLAG_BNK3_PRGMFLR ((uint32_t)0x40000004) /*!< FLASH BANK3 Program error flag */
+#define FLASH_FLAG_BNK3_WRPRTFLR ((uint32_t)0x40000010) /*!< FLASH BANK3 Write protected error flag */
+
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+#define FLASH_FLAG_BANK2 ((uint32_t)0x80000000)
+#define FLASH_FLAG_BNK2_BSY ((uint32_t)0x80000001) /*!< FLASH BANK2 Busy flag */
+#define FLASH_FLAG_BNK2_PRCDN ((uint32_t)0x80000020) /*!< FLASH BANK2 End of Operation flag */
+#define FLASH_FLAG_BNK2_PRGMFLR ((uint32_t)0x80000004) /*!< FLASH BANK2 Program error flag */
+#define FLASH_FLAG_BNK2_WRPRTFLR ((uint32_t)0x80000010) /*!< FLASH BANK2 Write protected error flag */
+
+#define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0x3FFFFFCA) == 0x00000000) && ((FLAG) != 0x00000000))
+#define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_PRCDN) || \
+ ((FLAG) == FLASH_FLAG_PRGMFLR) || ((FLAG) == FLASH_FLAG_WRPRTFLR) || \
+ ((FLAG) == FLASH_FLAG_UOBFLR)|| \
+ ((FLAG) == FLASH_FLAG_BNK1_BSY) || ((FLAG) == FLASH_FLAG_BNK1_PRCDN) || \
+ ((FLAG) == FLASH_FLAG_BNK1_PRGMFLR) || ((FLAG) == FLASH_FLAG_BNK1_WRPRTFLR) || \
+ ((FLAG) == FLASH_FLAG_BNK2_BSY) || ((FLAG) == FLASH_FLAG_BNK2_PRCDN) || \
+ ((FLAG) == FLASH_FLAG_BNK2_PRGMFLR) || ((FLAG) == FLASH_FLAG_BNK2_WRPRTFLR) || \
+ ((FLAG) == FLASH_FLAG_BNK3_BSY) || ((FLAG) == FLASH_FLAG_BNK3_PRCDN) || \
+ ((FLAG) == FLASH_FLAG_BNK3_PRGMFLR) || ((FLAG) == FLASH_FLAG_BNK3_WRPRTFLR))
+#else
+#define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xBFFFFFCA) == 0x00000000) && ((FLAG) != 0x00000000))
+#define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_PRCDN) || \
+ ((FLAG) == FLASH_FLAG_PRGMFLR) || ((FLAG) == FLASH_FLAG_WRPRTFLR) || \
+ ((FLAG) == FLASH_FLAG_BNK1_BSY) || ((FLAG) == FLASH_FLAG_BNK1_PRCDN) || \
+ ((FLAG) == FLASH_FLAG_BNK1_PRGMFLR) || ((FLAG) == FLASH_FLAG_BNK1_WRPRTFLR) || \
+ ((FLAG) == FLASH_FLAG_UOBFLR) || \
+ ((FLAG) == FLASH_FLAG_BNK3_BSY) || ((FLAG) == FLASH_FLAG_BNK3_PRCDN) || \
+ ((FLAG) == FLASH_FLAG_BNK3_PRGMFLR) || ((FLAG) == FLASH_FLAG_BNK3_WRPRTFLR))
+#endif
+
+#define FLASH_BANK3_ADDR_MAX ((uint32_t)0x1FFEFFFF)
+#define IS_IN_FLASH_BANK3_RANGE(ADDR) (((ADDR) >=EXT_FLASH_BASE) && ((ADDR) <= FLASH_BANK3_ADDR_MAX))
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup FLASH_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup FLASH_Exported_Functions
+ * @{
+ */
+
+/*------------ Functions used for all at32f4xx devices -----*/
+void FLASH_Unlock(void);
+void FLASH_Lock(void);
+FLASH_Status FLASH_ErasePage(uint32_t Page_Address);
+FLASH_Status FLASH_EraseAllPages(void);
+FLASH_Status FLASH_EraseUserOptionBytes(void);
+FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data);
+FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);
+FLASH_Status FLASH_ProgramByte(uint32_t Address, uint8_t Data);
+FLASH_Status FLASH_ProgramUserOptionByteData(uint32_t Address, uint8_t Data);
+FLASH_Status FLASH_EnableWriteProtect(uint32_t FLASH_Pages);
+FLASH_Status FLASH_ReadProtectConfig(FunctionalState NewState);
+FLASH_Status FLASH_UserOptionByteConfig(uint16_t UOB_IWDG, uint16_t UOB_STOP, uint16_t UOB_STDBY);
+uint32_t FLASH_GetUserOptionByte(void);
+uint32_t FLASH_GetWriteProtectStatus(void);
+FlagStatus FLASH_GetReadProtectStatus(void);
+FlagStatus FLASH_GetPrefetchBufferStatus(void);
+void FLASH_INTConfig(uint32_t FLASH_INT, FunctionalState NewState);
+FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG);
+void FLASH_ClearFlag(uint32_t FLASH_FLAG);
+FLASH_Status FLASH_GetStatus(void);
+FLASH_Status FLASH_WaitForProcess(uint32_t Timeout);
+
+#if defined (AT32F415xx)
+/*------------ Functions used only for at32f415 devices -----*/
+FLASH_Status FLASH_SYS_AP(void);
+FLASH_Status FLASH_SlibSysEnable(uint32_t Psw,uint8_t data_start_page);
+FlagStatus FLASH_GetOptionByteProtectStatus(void);
+FLASH_Status FLASH_RDPandOptionByteProtectEnable(void);
+void FLASH_OptionByteProtectDisable(void);
+#endif /* AT32F415xx */
+
+/*------------ New function used for all at32f4xx devices -----*/
+void FLASH_UnlockBank1(void);
+void FLASH_LockBank1(void);
+FLASH_Status FLASH_EraseBank1AllPages(void);
+FLASH_Status FLASH_GetBank1Status(void);
+FLASH_Status FLASH_WaitForBank1Process(uint32_t Timeout);
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+/*---- New Functions used only with at32f403_XL density devices -----*/
+void FLASH_UnlockBank2(void);
+void FLASH_LockBank2(void);
+FLASH_Status FLASH_EraseBank2AllPages(void);
+FLASH_Status FLASH_GetBank2Status(void);
+FLASH_Status FLASH_WaitForBank2Process(uint32_t Timeout);
+FLASH_Status FLASH_BootOptConfig(uint16_t FLASH_BOOT);
+#endif
+
+#if !defined (AT32F415xx)
+/*---- New Functions for extrenal flash -----*/
+void FLASH_UnlockBank3(void);
+void FLASH_LockBank3(void);
+FLASH_Status FLASH_EraseBank3AllPages(void);
+FLASH_Status FLASH_GetBank3Status(void);
+FLASH_Status FLASH_WaitForBank3Process(uint32_t Timeout);
+void FLASH_Bank3EncEndAddrConfig(uint32_t EndAddress);
+#endif
+
+/*---- New Functions for SLIB -----*/
+FLASH_Status FLASH_SlibMainEnable(uint32_t Psw, uint16_t StartPage, uint16_t DataPage, uint16_t EndPage);
+uint32_t FLASH_SlibDisable(uint32_t dwPsw);
+#if !defined (AT32F415xx)
+uint32_t FLASH_GetSlibCurCnt(void);
+#endif
+uint8_t FLASH_GetSlibState(void);
+uint16_t FLASH_GetSlibStartPage(void);
+uint16_t FLASH_GetSlibDataStartPage(void);
+uint16_t FLASH_GetSlibEndPage(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_FLASH_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_gpio.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_gpio.h
new file mode 100644
index 0000000000000000000000000000000000000000..e33461f18f5b0b67b68cd1ff15414a3b5d4c51e2
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_gpio.h
@@ -0,0 +1,677 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_gpio.h
+ * Description : at32f4xx GPIO header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_GPIO_H
+#define __AT32F4xx_GPIO_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup GPIO
+ * @{
+ */
+
+/** @defgroup GPIO_Exported_Types
+ * @{
+ */
+
+#if defined (AT32F413xx) || defined (AT32F415xx)
+#define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
+ ((PERIPH) == GPIOB) || \
+ ((PERIPH) == GPIOC) || \
+ ((PERIPH) == GPIOD) || \
+ ((PERIPH) == GPIOF))
+#elif defined AT32F403xx
+#define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
+ ((PERIPH) == GPIOB) || \
+ ((PERIPH) == GPIOC) || \
+ ((PERIPH) == GPIOD) || \
+ ((PERIPH) == GPIOE) || \
+ ((PERIPH) == GPIOF) || \
+ ((PERIPH) == GPIOG))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
+ ((PERIPH) == GPIOB) || \
+ ((PERIPH) == GPIOC) || \
+ ((PERIPH) == GPIOD) || \
+ ((PERIPH) == GPIOE))
+#endif
+
+
+/**
+ * @brief Output Maximum frequency selection
+ */
+
+typedef enum
+{
+ GPIO_MaxSpeed_10MHz = 1,
+ GPIO_MaxSpeed_2MHz,
+ GPIO_MaxSpeed_50MHz = 2
+}GPIOMaxSpeed_Type;
+#define IS_GPIO_MAXSPEED(MAXSPEED) (((MAXSPEED) == GPIO_MaxSpeed_10MHz) ||\
+ ((MAXSPEED) == GPIO_MaxSpeed_2MHz) || \
+ ((MAXSPEED) == GPIO_MaxSpeed_50MHz))
+
+/**
+ * @brief Configuration Mode enumeration
+ */
+
+typedef enum
+{ GPIO_Mode_IN_ANALOG = 0x0,
+ GPIO_Mode_IN_FLOATING = 0x04,
+ GPIO_Mode_IN_PD = 0x28,
+ GPIO_Mode_IN_PU = 0x48,
+ GPIO_Mode_OUT_OD = 0x14,
+ GPIO_Mode_OUT_PP = 0x10,
+ GPIO_Mode_AF_OD = 0x1C,
+ GPIO_Mode_AF_PP = 0x18
+}GPIOMode_Type;
+
+#define IS_GPIO_MDE(MDE) (((MDE) == GPIO_Mode_IN_ANALOG) || ((MDE) == GPIO_Mode_IN_FLOATING) || \
+ ((MDE) == GPIO_Mode_IN_PD) || ((MDE) == GPIO_Mode_IN_PU) || \
+ ((MDE) == GPIO_Mode_OUT_OD) || ((MDE) == GPIO_Mode_OUT_PP) || \
+ ((MDE) == GPIO_Mode_AF_OD) || ((MDE) == GPIO_Mode_AF_PP))
+
+/**
+ * @brief GPIO Init structure definition
+ */
+
+typedef struct
+{
+ uint16_t GPIO_Pins; /*!< Specifies the GPIO pins to be configured.
+ This parameter can be any value of @ref GPIO_pins_define */
+
+ GPIOMaxSpeed_Type GPIO_MaxSpeed; /*!< Specifies the speed for the selected pins.
+ This parameter can be a value of @ref GPIOMaxSpeed_Type */
+
+ GPIOMode_Type GPIO_Mode; /*!< Specifies the operating mode for the selected pins.
+ This parameter can be a value of @ref GPIOMode_Type */
+}GPIO_InitType;
+
+
+/**
+ * @brief Bit_SET and Bit_RESET enumeration
+ */
+
+typedef enum
+{ Bit_RESET = 0,
+ Bit_SET
+}BitState;
+
+#define IS_GPIO_BIT_STATE(STATE) (((STATE) == Bit_RESET) || ((STATE) == Bit_SET))
+
+/**
+ * @}
+ */
+
+/** @defgroup GPIO_Exported_Constants
+ * @{
+ */
+
+/** @defgroup GPIO_pins_define
+ * @{
+ */
+
+#define GPIO_Pins_0 ((uint16_t)0x0001) /*!< Pin 0 selected */
+#define GPIO_Pins_1 ((uint16_t)0x0002) /*!< Pin 1 selected */
+#define GPIO_Pins_2 ((uint16_t)0x0004) /*!< Pin 2 selected */
+#define GPIO_Pins_3 ((uint16_t)0x0008) /*!< Pin 3 selected */
+#define GPIO_Pins_4 ((uint16_t)0x0010) /*!< Pin 4 selected */
+#define GPIO_Pins_5 ((uint16_t)0x0020) /*!< Pin 5 selected */
+#define GPIO_Pins_6 ((uint16_t)0x0040) /*!< Pin 6 selected */
+#define GPIO_Pins_7 ((uint16_t)0x0080) /*!< Pin 7 selected */
+#define GPIO_Pins_8 ((uint16_t)0x0100) /*!< Pin 8 selected */
+#define GPIO_Pins_9 ((uint16_t)0x0200) /*!< Pin 9 selected */
+#define GPIO_Pins_10 ((uint16_t)0x0400) /*!< Pin 10 selected */
+#define GPIO_Pins_11 ((uint16_t)0x0800) /*!< Pin 11 selected */
+#define GPIO_Pins_12 ((uint16_t)0x1000) /*!< Pin 12 selected */
+#define GPIO_Pins_13 ((uint16_t)0x2000) /*!< Pin 13 selected */
+#define GPIO_Pins_14 ((uint16_t)0x4000) /*!< Pin 14 selected */
+#define GPIO_Pins_15 ((uint16_t)0x8000) /*!< Pin 15 selected */
+#define GPIO_Pins_All ((uint16_t)0xFFFF) /*!< All pins selected */
+
+#define IS_GPIO_PINS(PINS) ((((PINS) & (uint16_t)0x00) == 0x00) && ((PINS) != (uint16_t)0x00))
+
+#define IS_GET_GPIO_PINS(PINS) (((PINS) == GPIO_Pins_0) || \
+ ((PINS) == GPIO_Pins_1) || \
+ ((PINS) == GPIO_Pins_2) || \
+ ((PINS) == GPIO_Pins_3) || \
+ ((PINS) == GPIO_Pins_4) || \
+ ((PINS) == GPIO_Pins_5) || \
+ ((PINS) == GPIO_Pins_6) || \
+ ((PINS) == GPIO_Pins_7) || \
+ ((PINS) == GPIO_Pins_8) || \
+ ((PINS) == GPIO_Pins_9) || \
+ ((PINS) == GPIO_Pins_10) || \
+ ((PINS) == GPIO_Pins_11) || \
+ ((PINS) == GPIO_Pins_12) || \
+ ((PINS) == GPIO_Pins_13) || \
+ ((PINS) == GPIO_Pins_14) || \
+ ((PINS) == GPIO_Pins_15))
+
+/**
+ * @}
+ */
+
+#if defined (AT32F403xx) || defined (AT32F413xx)|| defined (AT32F415xx) || defined (AT32F403Axx) || defined (AT32F407xx)
+/** @defgroup GPIO_Remap_define
+ * @{
+ */
+
+/** @defgroup AFIO_MAP_define
+ * @{
+ */
+#define GPIO_Remap01_SPI1 ((uint32_t)0x00000001) /*!< SPI1 Alternate Function mapping 01 */
+#define GPIO_Remap_I2C1 ((uint32_t)0x00000002) /*!< I2C1 Alternate Function mapping */
+#define GPIO_Remap_USART1 ((uint32_t)0x00000004) /*!< USART1 Alternate Function mapping */
+#define GPIO_PartialRemap_USART3 ((uint32_t)0x00000010) /*!< USART3 Partial Alternate Function mapping */
+#define GPIO_PartialRemap_TMR1 ((uint32_t)0x00000040) /*!< TMR1 Partial Alternate Function mapping */
+#define GPIO_PartialRemap1_TMR2 ((uint32_t)0x00000100) /*!< TMR2 Partial1 Alternate Function mapping */
+#define GPIO_PartialRemap2_TMR2 ((uint32_t)0x00000200) /*!< TMR2 Partial2 Alternate Function mapping */
+#define GPIO_FullRemap_TMR2 ((uint32_t)0x00000300) /*!< TMR2 Full Alternate Function mapping */
+#define GPIO_PartialRemap_TMR3 ((uint32_t)0x00000800) /*!< TMR3 Partial Alternate Function mapping */
+#define GPIO_FullRemap_TMR3 ((uint32_t)0x00000C00) /*!< TMR3 Full Alternate Function mapping */
+#define GPIO_Remap1_CAN1 ((uint32_t)0x00004000) /*!< CAN1 Alternate Function mapping */
+#define GPIO_Remap_PD01 ((uint32_t)0x00008000) /*!< PD01 Alternate Function mapping */
+#define GPIO_Remap_TMR5CH4_LSI ((uint32_t)0x00010000) /*!< LSI connected to TMR5 Channel4 input capture for calibration */
+#define GPIO_Remap_ADC1_EXTRGINJ ((uint32_t)0x00020000) /*!< ADC1 External Trigger Injected Conversion remapping */
+#define GPIO_Remap_ADC1_EXTRGREG ((uint32_t)0x00040000) /*!< ADC1 External Trigger Regular Conversion remapping */
+#define GPIO_Remap_SWJ_NoJNTRST ((uint32_t)0x01000000) /*!< Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST */
+#define GPIO_Remap_SWJ_JTAGDisable ((uint32_t)0x02000000) /*!< JTAG-DP Disabled and SW-DP Enabled */
+#define GPIO_Remap_SWJ_AllDisable ((uint32_t)0x04000000) /*!< Full SWJ Disabled (JTAG-DP + SW-DP) */
+#ifdef AT32F403xx
+#define GPIO_Remap10_SPI1 ((uint32_t)0x80000000) /*!< SPI1 Alternate Function mapping 10*/
+#define GPIO_Remap_USART2 ((uint32_t)0x00000008) /*!< USART2 Alternate Function mapping */
+#define GPIO_FullRemap_USART3 ((uint32_t)0x00000030) /*!< USART3 Full Alternate Function mapping */
+#define GPIO_FullRemap_TMR1 ((uint32_t)0x000000C0) /*!< TMR1 Full Alternate Function mapping */
+#define GPIO_Remap_TMR4 ((uint32_t)0x00001000) /*!< TMR4 Alternate Function mapping */
+#define GPIO_Remap2_CAN1 ((uint32_t)0x00006000) /*!< CAN1 Alternate Function mapping */
+#define GPIO_Remap_ADC2_EXTRGINJ ((uint32_t)0x00080000) /*!< ADC2 External Trigger Injected Conversion remapping */
+#define GPIO_Remap_ADC2_EXTRGREG ((uint32_t)0x00100000) /*!< ADC2 External Trigger Regular Conversion remapping */
+#elif defined (AT32F413xx)
+#define GPIO_Remap_ADC2_EXTRGINJ ((uint32_t)0x00080000) /*!< ADC2 External Trigger Injected Conversion remapping */
+#define GPIO_Remap_ADC2_EXTRGREG ((uint32_t)0x00100000) /*!< ADC2 External Trigger Regular Conversion remapping */
+#elif defined (AT32F415xx)
+#define GPIO_PartialRemap2_USART3 ((uint32_t)0x00000020) /*!< EXT_FLASH Alternate Function mapping*/
+#define GPIO_PartialRemap2_TMR1 ((uint32_t)0x00000080) /*!< TMR1 Partial2 Alternate Function mapping */
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define GPIO_Remap_USART2 ((uint32_t)0x00000008) /*!< USART2 Alternate Function mapping */
+#define GPIO_FullRemap_USART3 ((uint32_t)0x00000030) /*!< USART3 Full Alternate Function mapping */
+#define GPIO_FullRemap_TMR1 ((uint32_t)0x000000C0) /*!< TMR1 Full Alternate Function mapping */
+#define GPIO_Remap_TMR4 ((uint32_t)0x00001000) /*!< TMR4 Alternate Function mapping */
+#define GPIO_Remap2_CAN1 ((uint32_t)0x00006000) /*!< CAN1 Alternate Function mapping */
+#define GPIO_Remap_ADC2_EXTRGINJ ((uint32_t)0x00080000) /*!< ADC2 External Trigger Injected Conversion remapping */
+#define GPIO_Remap_ADC2_EXTRGREG ((uint32_t)0x00100000) /*!< ADC2 External Trigger Regular Conversion remapping */
+#define GPIO_Remap_ETH ((uint32_t)0x00200000) /*!< ETH Alternate Function mapping*/
+#define GPIO_Remap_CAN2 ((uint32_t)0x00400000) /*!< CAN2 Alternate Function mapping*/
+#define GPIO_Remap_MII_RMII ((uint32_t)0x00800000) /*!< MII or RMII Alternate Function mapping */
+#define GPIO_Remap_SPI3 ((uint32_t)0x10000000) /*!< SPI3 Alternate Function mapping*/
+#define GPIO_Remap_TMR2ITR1 ((uint32_t)0x20000000) /*!< TMR2 internal trigger 1 Alternate remapping */
+#define GPIO_Remap_PTP_PPS ((uint32_t)0x40000000) /*!< Ethernet PTP PPS Alternate Function remapping */
+#endif
+/**
+ * @}
+ */
+
+/** @defgroup AFIO_MAP2_define
+ * @{
+ */
+#ifdef AT32F403xx
+#define GPIO_Remap_TMR15 ((uint32_t)0x40000001) /*!< TMR15 Alternate Function mapping */
+#define GPIO_Remap_TMR9 ((uint32_t)0x40000020) /*!< TMR9 Alternate Function mapping */
+#define GPIO_Remap_TMR10 ((uint32_t)0x40000040) /*!< TMR10 Alternate Function mapping */
+#define GPIO_Remap_TMR11 ((uint32_t)0x40000080) /*!< TMR11 Alternate Function mapping */
+#define GPIO_Remap_TMR13 ((uint32_t)0x40000100) /*!< TMR13 Alternate Function mapping */
+#define GPIO_Remap_TMR14 ((uint32_t)0x40000200) /*!< TMR14 Alternate Function mapping */
+#define GPIO_Remap_XMC_NADV ((uint32_t)0x40000400) /*!< XMC_NADV Alternate Function mapping */
+#define GPIO_Remap_SPI4 ((uint32_t)0x40020000) /*!< SPI4 Alternate Function mapping*/
+#define GPIO_Remap_I2C3 ((uint32_t)0x40040000) /*!< I2C3 Alternate Function mapping*/
+#define GPIO_Remap01_SDIO2 ((uint32_t)0x40080000) /*!< SDIO2 Alternate Function mapping 01:CK/CMD Remaped None,D0~D3 Remaped to PA4~PA7*/
+#define GPIO_Remap10_SDIO2 ((uint32_t)0x40100000) /*!< SDIO2 Alternate Function mapping 10:CK/CMD Remaped to PA2/PA3,D0~D3 Remaped None*/
+#define GPIO_Remap11_SDIO2 ((uint32_t)0x40180000) /*!< SDIO2 Alternate Function mapping 11:CK/CMD Remaped to PA2/PA3,D0~D3 Remaped to PA4~PA7*/
+#define GPIO_Remap_EXT_FLASH ((uint32_t)0x40200000) /*!< EXT_FLASH Alternate Function mapping*/
+#elif defined (AT32F413xx)
+#define GPIO_Remap_EXT_FLASH ((uint32_t)0x40200000) /*!< EXT_FLASH Alternate Function mapping*/
+#elif defined (AT32F415xx)
+#define GPIO_Remap01_COMP ((uint32_t)0x44000000) /*!< COMP1/2 Alternate Function mapping 01: COMP1/2_OUT connect to PA6/7*/
+#define GPIO_Remap10_COMP ((uint32_t)0x48000000) /*!< COMP1/2 Alternate Function mapping 10: COMP1/2_OUT connect to PA11/12*/
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define GPIO_Remap_TMR9 ((uint32_t)0x40000020) /*!< TMR9 Alternate Function mapping */
+#define GPIO_Remap_XMC_NADV ((uint32_t)0x40000400) /*!< XMC_NADV Alternate Function mapping */
+#define GPIO_Remap_SPI4 ((uint32_t)0x40020000) /*!< SPI4 Alternate Function mapping*/
+#define GPIO_Remap_I2C3 ((uint32_t)0x40040000) /*!< I2C3 Alternate Function mapping*/
+#define GPIO_Remap01_SDIO2 ((uint32_t)0x40080000) /*!< SDIO2 Alternate Function mapping 01:CK/CMD Remaped None,D0~D3 Remaped to PA4~PA7*/
+#define GPIO_Remap10_SDIO2 ((uint32_t)0x40100000) /*!< SDIO2 Alternate Function mapping 10:CK/CMD Remaped to PA2/PA3,D0~D3 Remaped None*/
+#define GPIO_Remap11_SDIO2 ((uint32_t)0x40180000) /*!< SDIO2 Alternate Function mapping 11:CK/CMD Remaped to PA2/PA3,D0~D3 Remaped to PA4~PA7*/
+#define GPIO_Remap_EXT_FLASH ((uint32_t)0x40200000) /*!< EXT_FLASH Alternate Function mapping*/
+#endif
+/**
+ * @}
+ */
+
+#ifdef AT32F403xx
+#define IS_GPIO_REMAP(REMAP) (((REMAP) == GPIO_Remap01_SPI1) || ((REMAP) == GPIO_Remap_I2C1) || \
+ ((REMAP) == GPIO_Remap_USART1) || ((REMAP) == GPIO_Remap_USART2) || \
+ ((REMAP) == GPIO_PartialRemap_USART3) || ((REMAP) == GPIO_FullRemap_USART3) || \
+ ((REMAP) == GPIO_PartialRemap_TMR1) || ((REMAP) == GPIO_FullRemap_TMR1) || \
+ ((REMAP) == GPIO_PartialRemap1_TMR2) || ((REMAP) == GPIO_PartialRemap2_TMR2) || \
+ ((REMAP) == GPIO_FullRemap_TMR2) || ((REMAP) == GPIO_PartialRemap_TMR3) || \
+ ((REMAP) == GPIO_FullRemap_TMR3) || ((REMAP) == GPIO_Remap_TMR4) || \
+ ((REMAP) == GPIO_Remap1_CAN1) || ((REMAP) == GPIO_Remap2_CAN1) || \
+ ((REMAP) == GPIO_Remap_PD01) || ((REMAP) == GPIO_Remap_TMR5CH4_LSI) || \
+ ((REMAP) == GPIO_Remap_ADC1_EXTRGINJ) || ((REMAP) == GPIO_Remap_ADC1_EXTRGREG) || \
+ ((REMAP) == GPIO_Remap_ADC2_EXTRGINJ) || ((REMAP) == GPIO_Remap_ADC2_EXTRGREG) || \
+ ((REMAP) == GPIO_Remap_SWJ_NoJNTRST) || ((REMAP) == GPIO_Remap_SWJ_JTAGDisable)|| \
+ ((REMAP) == GPIO_Remap_SWJ_AllDisable) || ((REMAP) == GPIO_Remap10_SPI1) || \
+ ((REMAP) == GPIO_Remap_TMR15) || ((REMAP) == GPIO_Remap_TMR9) || \
+ ((REMAP) == GPIO_Remap_TMR10) || ((REMAP) == GPIO_Remap_TMR11) || \
+ ((REMAP) == GPIO_Remap_TMR13) || ((REMAP) == GPIO_Remap_TMR14) || \
+ ((REMAP) == GPIO_Remap_XMC_NADV) || ((REMAP) == GPIO_Remap_SPI4) || \
+ ((REMAP) == GPIO_Remap_I2C3) || ((REMAP) == GPIO_Remap01_SDIO2) || \
+ ((REMAP) == GPIO_Remap10_SDIO2) || ((REMAP) == GPIO_Remap11_SDIO2) || \
+ ((REMAP) == GPIO_Remap_EXT_FLASH))
+#elif defined (AT32F413xx)
+#define IS_GPIO_REMAP(REMAP) (((REMAP) == GPIO_Remap01_SPI1) || ((REMAP) == GPIO_Remap_I2C1) || \
+ ((REMAP) == GPIO_Remap_USART1) || ((REMAP) == GPIO_PartialRemap_USART3) || \
+ ((REMAP) == GPIO_PartialRemap_TMR1) || ((REMAP) == GPIO_PartialRemap1_TMR2) || \
+ ((REMAP) == GPIO_PartialRemap2_TMR2) || ((REMAP) == GPIO_FullRemap_TMR2) || \
+ ((REMAP) == GPIO_PartialRemap_TMR3) || ((REMAP) == GPIO_FullRemap_TMR3) || \
+ ((REMAP) == GPIO_Remap1_CAN1) || ((REMAP) == GPIO_Remap_EXT_FLASH) || \
+ ((REMAP) == GPIO_Remap_PD01) || ((REMAP) == GPIO_Remap_TMR5CH4_LSI) || \
+ ((REMAP) == GPIO_Remap_ADC1_EXTRGINJ) || ((REMAP) == GPIO_Remap_ADC1_EXTRGREG) || \
+ ((REMAP) == GPIO_Remap_ADC2_EXTRGINJ) || ((REMAP) == GPIO_Remap_ADC2_EXTRGREG) || \
+ ((REMAP) == GPIO_Remap_SWJ_NoJNTRST) || ((REMAP) == GPIO_Remap_SWJ_JTAGDisable)|| \
+ ((REMAP) == GPIO_Remap_SWJ_AllDisable))
+#elif defined (AT32F415xx)
+#define IS_GPIO_REMAP(REMAP) (((REMAP) == GPIO_Remap01_SPI1) || ((REMAP) == GPIO_Remap_I2C1) || \
+ ((REMAP) == GPIO_Remap_USART1) || ((REMAP) == GPIO_PartialRemap_USART3) || \
+ ((REMAP) == GPIO_PartialRemap_TMR1) || ((REMAP) == GPIO_PartialRemap1_TMR2) || \
+ ((REMAP) == GPIO_PartialRemap2_TMR2) || ((REMAP) == GPIO_FullRemap_TMR2) || \
+ ((REMAP) == GPIO_PartialRemap_TMR3) || ((REMAP) == GPIO_FullRemap_TMR3) || \
+ ((REMAP) == GPIO_Remap1_CAN1) || ((REMAP) == GPIO_Remap_PD01) || \
+ ((REMAP) == GPIO_Remap_TMR5CH4_LSI) || ((REMAP) == GPIO_Remap_ADC1_EXTRGINJ) || \
+ ((REMAP) == GPIO_Remap_ADC1_EXTRGREG) || ((REMAP) == GPIO_Remap_SWJ_NoJNTRST) || \
+ ((REMAP) == GPIO_Remap_SWJ_JTAGDisable)|| ((REMAP) == GPIO_Remap_SWJ_AllDisable) || \
+ ((REMAP) == GPIO_Remap01_COMP) || ((REMAP) == GPIO_Remap10_COMP) || \
+ ((REMAP) == GPIO_PartialRemap2_USART3) || ((REMAP) == GPIO_PartialRemap2_TMR1))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_GPIO_REMAP(REMAP) (((REMAP) == GPIO_Remap01_SPI1) || ((REMAP) == GPIO_Remap_I2C1) || \
+ ((REMAP) == GPIO_Remap_USART1) || ((REMAP) == GPIO_Remap_USART2) || \
+ ((REMAP) == GPIO_PartialRemap_USART3) || ((REMAP) == GPIO_FullRemap_USART3) || \
+ ((REMAP) == GPIO_PartialRemap_TMR1) || ((REMAP) == GPIO_FullRemap_TMR1) || \
+ ((REMAP) == GPIO_PartialRemap1_TMR2) || ((REMAP) == GPIO_PartialRemap2_TMR2) || \
+ ((REMAP) == GPIO_FullRemap_TMR2) || ((REMAP) == GPIO_PartialRemap_TMR3) || \
+ ((REMAP) == GPIO_FullRemap_TMR3) || ((REMAP) == GPIO_Remap_TMR4) || \
+ ((REMAP) == GPIO_Remap1_CAN1) || ((REMAP) == GPIO_Remap2_CAN1) || \
+ ((REMAP) == GPIO_Remap_PD01) || ((REMAP) == GPIO_Remap_TMR5CH4_LSI) || \
+ ((REMAP) == GPIO_Remap_ADC1_EXTRGINJ) || ((REMAP) == GPIO_Remap_ADC1_EXTRGREG) || \
+ ((REMAP) == GPIO_Remap_ADC2_EXTRGINJ) || ((REMAP) == GPIO_Remap_ADC2_EXTRGREG) || \
+ ((REMAP) == GPIO_Remap_SWJ_NoJNTRST) || ((REMAP) == GPIO_Remap_SWJ_JTAGDisable)|| \
+ ((REMAP) == GPIO_Remap_SWJ_AllDisable) || ((REMAP) == GPIO_Remap_EXT_FLASH) || \
+ ((REMAP) == GPIO_Remap_PTP_PPS) || ((REMAP) == GPIO_Remap_TMR2ITR1) || \
+ ((REMAP) == GPIO_Remap_SPI3) || ((REMAP) == GPIO_Remap_MII_RMII) || \
+ ((REMAP) == GPIO_Remap_CAN2) || ((REMAP) == GPIO_Remap_ETH) || \
+ ((REMAP) == GPIO_Remap_TMR9) || ((REMAP) == GPIO_Remap_XMC_NADV) || \
+ ((REMAP) == GPIO_Remap_SPI4) || ((REMAP) == GPIO_Remap_I2C3) || \
+ ((REMAP) == GPIO_Remap01_SDIO2) || ((REMAP) == GPIO_Remap10_SDIO2) || \
+ ((REMAP) == GPIO_Remap11_SDIO2))
+
+#endif
+
+/**
+ * @}
+ */
+#endif
+
+#if !defined(AT32F403xx)
+
+#define AFIO_MAP3 0x00
+#define AFIO_MAP4 0x01
+#define AFIO_MAP5 0x02
+#define AFIO_MAP6 0x03
+#define AFIO_MAP7 0x04
+#if defined (AT32F415xx) || defined (AT32F403Axx) || defined (AT32F407xx)
+#define AFIO_MAP8 0x05
+#endif
+
+#define BITS0 0x00
+#define BITS1 0x01
+#define BITS2 0x02
+#define BITS3 0x03
+#define BITS4 0x04
+#define BITS5 0x05
+#define BITS6 0x06
+#define BITS7 0x07
+
+#define OFFSET_MASK0 0xFFFFFFF0
+#define OFFSET_MASK1 0xFFFFFF0F
+#define OFFSET_MASK2 0xFFFFF0FF
+#define OFFSET_MASK3 0xFFFF0FFF
+#define OFFSET_MASK4 0xFFF0FFFF
+#define OFFSET_MASK5 0xFF0FFFFF
+#define OFFSET_MASK6 0xF0FFFFFF
+#define OFFSET_MASK7 0x0FFFFFFF
+
+/** @defgroup AFIO_MAP3_4_5_6_7_8_define
+ * @{
+ */
+#define AFIO_MAP3_TMR9_0010 ((uint32_t)0x80000002) /*!< TMR9 Alternate Function mapping */
+#define AFIO_MAP3_TMR10_0010 ((uint32_t)0x80000012) /*!< TMR10 Alternate Function mapping */
+#define AFIO_MAP3_TMR11_0010 ((uint32_t)0x80000022) /*!< TMR11 Alternate Function mapping */
+
+#define AFIO_MAP4_TMR1_0001 ((uint32_t)0x80000081) /*!< TMR1 Alternate Function mapping */
+#define AFIO_MAP4_TMR3_0010 ((uint32_t)0x800000A2) /*!< TMR3 Alternate Function mapping 0010*/
+#define AFIO_MAP4_TMR3_0011 ((uint32_t)0x800000A3) /*!< TMR3 Alternate Function mapping 0011*/
+#define AFIO_MAP4_TMR5_1000 ((uint32_t)0x800000C8) /*!< TMR5 Alternate Function mapping 1000: CH4 */
+
+#define AFIO_MAP5_USART5_0001 ((uint32_t)0x80000101) /*!< USART5 Alternate Function mapping 0001*/
+#define AFIO_MAP5_I2C1_0001 ((uint32_t)0x80000111) /*!< I2C1 Alternate Function mapping 0001*/
+#define AFIO_MAP5_I2C1_0011 ((uint32_t)0x80000113) /*!< I2C1 Alternate Function mapping 0011*/
+#define AFIO_MAP5_I2C2_0001 ((uint32_t)0x80000121) /*!< I2C2 Alternate Function mapping 0001*/
+#define AFIO_MAP5_I2C2_0010 ((uint32_t)0x80000122) /*!< I2C2 Alternate Function mapping 0010*/
+#define AFIO_MAP5_I2C2_0011 ((uint32_t)0x80000123) /*!< I2C2 Alternate Function mapping 0011*/
+#define AFIO_MAP5_I2C3_0001 ((uint32_t)0x80000131) /*!< I2C3 Alternate Function mapping 0001*/
+#define AFIO_MAP5_SPI1_0001 ((uint32_t)0x80000141) /*!< SPI1 Alternate Function mapping 0001*/
+#define AFIO_MAP5_SPI1_0010 ((uint32_t)0x80000142) /*!< SPI1 Alternate Function mapping 0010*/
+#define AFIO_MAP5_SPI1_0011 ((uint32_t)0x80000143) /*!< SPI1 Alternate Function mapping 0011*/
+#define AFIO_MAP5_SPI2_0001 ((uint32_t)0x80000151) /*!< SPI2 Alternate Function mapping 0001*/
+#define AFIO_MAP5_SPI2_0010 ((uint32_t)0x80000152) /*!< SPI2 Alternate Function mapping 0010*/
+#define AFIO_MAP5_SPI3_0001 ((uint32_t)0x80000161) /*!< SPI3 Alternate Function mapping 0001*/
+#define AFIO_MAP5_SPI3_0010 ((uint32_t)0x80000162) /*!< SPI3 Alternate Function mapping 0010*/
+#define AFIO_MAP5_SPI3_0011 ((uint32_t)0x80000163) /*!< SPI3 Alternate Function mapping 0011*/
+#define AFIO_MAP5_SPI4_0001 ((uint32_t)0x80000171) /*!< SPI4 Alternate Function mapping 0001*/
+#define AFIO_MAP5_SPI4_0010 ((uint32_t)0x80000172) /*!< SPI4 Alternate Function mapping 0010*/
+#define AFIO_MAP5_SPI4_0011 ((uint32_t)0x80000173) /*!< SPI4 Alternate Function mapping 0011*/
+
+#define AFIO_MAP6_CAN1_0010 ((uint32_t)0x80000182) /*!< CAN1 Alternate Function mapping 0010*/
+#define AFIO_MAP6_CAN1_0011 ((uint32_t)0x80000183) /*!< CAN1 Alternate Function mapping 0011*/
+#define AFIO_MAP6_CAN2_0001 ((uint32_t)0x80000191) /*!< CAN2 Alternate Function mapping */
+#define AFIO_MAP6_SDIO_0100 ((uint32_t)0x800001A4) /*!< SDIO Alternate Function mapping 100 */
+#define AFIO_MAP6_SDIO_0101 ((uint32_t)0x800001A5) /*!< SDIO Alternate Function mapping 101 */
+#define AFIO_MAP6_SDIO_0110 ((uint32_t)0x800001A6) /*!< SDIO Alternate Function mapping 110 */
+#define AFIO_MAP6_SDIO_0111 ((uint32_t)0x800001A7) /*!< SDIO Alternate Function mapping 111 */
+#define AFIO_MAP6_SDIO2_0001 ((uint32_t)0x800001B1) /*!< SDIO2 Alternate Function mapping 0001 */
+#define AFIO_MAP6_SDIO2_0010 ((uint32_t)0x800001B2) /*!< SDIO2 Alternate Function mapping 0010 */
+#define AFIO_MAP6_SDIO2_0011 ((uint32_t)0x800001B3) /*!< SDIO2 Alternate Function mapping 0011 */
+#define AFIO_MAP6_USART1_0001 ((uint32_t)0x800001C1) /*!< USART1 Alternate Function mapping */
+#define AFIO_MAP6_USART2_0001 ((uint32_t)0x800001D1) /*!< USART2 Alternate Function mapping */
+#define AFIO_MAP6_USART3_0001 ((uint32_t)0x800001E1) /*!< USART3 Alternate Function mapping 0001*/
+#define AFIO_MAP6_USART3_0011 ((uint32_t)0x800001E3) /*!< USART3 Alternate Function mapping 0011*/
+#define AFIO_MAP6_UART4_0001 ((uint32_t)0x800001F1) /*!< UART4 Alternate Function mapping */
+
+#define AFIO_MAP7_SPIF_1000 ((uint32_t)0x80000208) /*!< EXT_FLASH Alternate Function mapping */
+#define AFIO_MAP7_SPIF_1001 ((uint32_t)0x80000209) /*!< EXT_FLASH Alternate Function enable */
+#define AFIO_MAP7_ADC1_0001 ((uint32_t)0x80000211) /*!< ADC1 External Trigger Injected Conversion remapping */
+#define AFIO_MAP7_ADC1_0010 ((uint32_t)0x80000212) /*!< ADC1 External Trigger Regular Conversion remapping */
+#define AFIO_MAP7_ADC1_0011 ((uint32_t)0x80000213) /*!< ADC1 External Trigger Regular & Injected Conversion remapping */
+#define AFIO_MAP7_ADC2_0001 ((uint32_t)0x80000221) /*!< ADC2 External Trigger Injected Conversion remapping */
+#define AFIO_MAP7_ADC2_0010 ((uint32_t)0x80000222) /*!< ADC2 External Trigger Regular Conversion remapping */
+#define AFIO_MAP7_ADC2_0011 ((uint32_t)0x80000223) /*!< ADC2 External Trigger Regular & Injected Conversion remapping */
+#define AFIO_MAP7_SWJTAG_0001 ((uint32_t)0x80000241) /*!< Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST */
+#define AFIO_MAP7_SWJTAG_0010 ((uint32_t)0x80000242) /*!< JTAG-DP Disabled and SW-DP Enabled */
+#define AFIO_MAP7_SWJTAG_0100 ((uint32_t)0x80000244) /*!< Full SWJ Disabled (JTAG-DP + SW-DP) */
+#define AFIO_MAP7_PD01_0001 ((uint32_t)0x80000251) /*!< PD01 Alternate Function mapping */
+#define AFIO_MAP7_XMC_0001 ((uint32_t)0x80000261) /*!< XMC Alternate Function mapping 0001 */
+#define AFIO_MAP7_XMC_0010 ((uint32_t)0x80000262) /*!< XMC Alternate Function mapping 0010 */
+#define AFIO_MAP7_XMC_1000 ((uint32_t)0x80000268) /*!< XMC Alternate Function mapping 1000 */
+#define AFIO_MAP7_XMC_1001 ((uint32_t)0x80000269) /*!< XMC Alternate Function mapping 1001 */
+#define AFIO_MAP7_XMC_1010 ((uint32_t)0x8000026A) /*!< XMC Alternate Function mapping 1011 */
+
+#define AFIO_MAP8_ETH_0001 ((uint32_t)0x800002C1) /*!< ETH Alternate Function mapping 0001*/
+#define AFIO_MAP8_ETH_0100 ((uint32_t)0x800002C4) /*!< ETH Alternate Function mapping 0100*/
+#define AFIO_MAP8_ETH_0101 ((uint32_t)0x800002C5) /*!< ETH Alternate Function mapping 0101*/
+#define AFIO_MAP8_ETH_1000 ((uint32_t)0x800002C8) /*!< ETH Alternate Function mapping 1000*/
+#define AFIO_MAP8_ETH_1001 ((uint32_t)0x800002C9) /*!< ETH Alternate Function mapping 1001*/
+#define AFIO_MAP8_ETH_1100 ((uint32_t)0x800002CC) /*!< ETH Alternate Function mapping 1100*/
+#define AFIO_MAP8_ETH_1101 ((uint32_t)0x800002CD) /*!< ETH Alternate Function mapping 1101*/
+#define AFIO_MAP8_USART6_0001 ((uint32_t)0x800002D1) /*!< USART6 Alternate Function mapping */
+#define AFIO_MAP8_UART7_0001 ((uint32_t)0x800002E1) /*!< UART7 Alternate Function mapping */
+#define AFIO_MAP8_UART8_0001 ((uint32_t)0x800002F1) /*!< UART8 Alternate Function mapping */
+
+#ifdef AT32F413xx
+#define AFIO_MAP4_TMR2_0001 ((uint32_t)0x80000091) /*!< TMR2 Alternate Function mapping 1001*/
+#define AFIO_MAP4_TMR2_0010 ((uint32_t)0x80000092) /*!< TMR2 Alternate Function mapping 1010*/
+#define AFIO_MAP4_TMR2_0011 ((uint32_t)0x80000093) /*!< TMR2 Alternate Function mapping 1011*/
+#define AFIO_MAP4_TMR2_1001 ((uint32_t)0x80000099) /*!< TMR2 Alternate Function mapping 1001*/
+#define AFIO_MAP4_TMR2_1010 ((uint32_t)0x8000009A) /*!< TMR2 Alternate Function mapping 1010*/
+#define AFIO_MAP4_TMR2_1011 ((uint32_t)0x8000009B) /*!< TMR2 Alternate Function mapping 1011*/
+#define AFIO_MAP4_TMR5_0001 ((uint32_t)0x800000C1) /*!< TMR5 Alternate Function mapping 0001: CH1/CH2*/
+#define AFIO_MAP4_TMR5_1001 ((uint32_t)0x800000C9) /*!< TMR5 Alternate Function mapping 1001: CH1/CH2+CH4 */
+#endif
+
+#ifdef AT32F415xx
+#define AFIO_MAP4_TMR1_0010 ((uint32_t)0x80000082) /*!< TMR1 Alternate Function mapping 0010*/
+#define AFIO_MAP4_TMR2_0001 ((uint32_t)0x80000091) /*!< TMR2 Alternate Function mapping 0001*/
+#define AFIO_MAP4_TMR2_0010 ((uint32_t)0x80000092) /*!< TMR2 Alternate Function mapping 0010*/
+#define AFIO_MAP4_TMR2_0011 ((uint32_t)0x80000093) /*!< TMR2 Alternate Function mapping 0011*/
+#define AFIO_MAP4_TMR5_0001 ((uint32_t)0x800000C1) /*!< TMR5 Alternate Function mapping 0001: CH1/CH2*/
+#define AFIO_MAP4_TMR5_1001 ((uint32_t)0x800000C9) /*!< TMR5 Alternate Function mapping 1001: CH1/CH2+CH4 */
+
+#define AFIO_MAP8_TMR1_BK1_00 ((uint32_t)0x80000280) /*!< TMR1 BK1 input selection 00/01*/
+#define AFIO_MAP8_TMR1_BK1_10 ((uint32_t)0x80000282) /*!< TMR1 BK1 input selection 10 */
+#define AFIO_MAP8_TMR1_BK1_11 ((uint32_t)0x80000283) /*!< TMR1 BK1 input selection 11 */
+#define AFIO_MAP8_TMR1_CH1_00 ((uint32_t)0x80000290) /*!< TMR1 CH1 input selection 00/01*/
+#define AFIO_MAP8_TMR1_CH1_10 ((uint32_t)0x80000298) /*!< TMR1 CH1 input selection 10 */
+#define AFIO_MAP8_TMR1_CH1_11 ((uint32_t)0x8000029C) /*!< TMR1 CH1 input selection 11 */
+#define AFIO_MAP8_TMR2_CH4_00 ((uint32_t)0x800002A0) /*!< TMR2 CH4 input selection 00/01*/
+#define AFIO_MAP8_TMR2_CH4_10 ((uint32_t)0x800002A2) /*!< TMR2 CH4 input selection 10 */
+#define AFIO_MAP8_TMR2_CH4_11 ((uint32_t)0x800002A3) /*!< TMR2 CH4 input selection 11 */
+#define AFIO_MAP8_TMR3_CH1_00 ((uint32_t)0x800002B0) /*!< TMR3 CH1 input selection 00/01*/
+#define AFIO_MAP8_TMR3_CH1_10 ((uint32_t)0x800002B8) /*!< TMR3 CH1 input selection 10 */
+#define AFIO_MAP8_TMR3_CH1_11 ((uint32_t)0x800002BC) /*!< TMR3 CH1 input selection 11 */
+#endif
+
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+#define AFIO_MAP4_TMR1_0011 ((uint32_t)0x80000083) /*!< TMR1 Alternate Function mapping 0011*/
+#define AFIO_MAP4_TMR2_0001 ((uint32_t)0x80000091) /*!< TMR2 Alternate Function mapping 1001*/
+#define AFIO_MAP4_TMR2_0010 ((uint32_t)0x80000092) /*!< TMR2 Alternate Function mapping 1010*/
+#define AFIO_MAP4_TMR2_0011 ((uint32_t)0x80000093) /*!< TMR2 Alternate Function mapping 1011*/
+#define AFIO_MAP4_TIM2ITR1_1000 ((uint32_t)0x80000098) /*!< TMR2 Alternate Function mapping 1101*/
+#define AFIO_MAP4_TIM2ITR1_1100 ((uint32_t)0x8000009C) /*!< TMR2 Alternate Function mapping 1110*/
+#define AFIO_MAP4_TMR4_0001 ((uint32_t)0x800000B1) /*!< TMR5 Alternate Function mapping 0001: CH1/CH2*/
+#endif
+
+#define IS_GREMAP(REMAP) ((REMAP) > 0x80000000)
+
+#define IS_GPIO_GREMAP(REMAP) (((REMAP) == AFIO_MAP3_TMR9_0010) || ((REMAP) == AFIO_MAP3_TMR10_0010) || \
+ ((REMAP) == AFIO_MAP3_TMR11_0010) || ((REMAP) == AFIO_MAP4_TMR1_0001) || \
+ ((REMAP) == AFIO_MAP4_TMR2_0001) || ((REMAP) == AFIO_MAP6_CAN1_0010) || \
+ ((REMAP) == AFIO_MAP4_TMR2_0010) || ((REMAP) == AFIO_MAP6_CAN2_0001) || \
+ ((REMAP) == AFIO_MAP4_TMR2_0011) || ((REMAP) == AFIO_MAP6_SDIO_0100) || \
+ ((REMAP) == AFIO_MAP4_TMR3_0010) || ((REMAP) == AFIO_MAP6_SDIO_0101) || \
+ ((REMAP) == AFIO_MAP4_TMR3_0011) || ((REMAP) == AFIO_MAP6_SDIO_0110) || \
+ ((REMAP) == AFIO_MAP4_TMR5_0001) || ((REMAP) == AFIO_MAP6_SDIO_0111) || \
+ ((REMAP) == AFIO_MAP4_TMR5_1000) || ((REMAP) == AFIO_MAP6_USART1_0001) || \
+ ((REMAP) == AFIO_MAP4_TMR5_1001) || ((REMAP) == AFIO_MAP6_USART3_0001) || \
+ ((REMAP) == AFIO_MAP5_I2C1_0001) || ((REMAP) == AFIO_MAP6_UART4_0001) || \
+ ((REMAP) == AFIO_MAP5_I2C1_0011) || ((REMAP) == AFIO_MAP7_SPIF_1000) || \
+ ((REMAP) == AFIO_MAP5_I2C2_0001) || ((REMAP) == AFIO_MAP7_SPIF_1001) || \
+ ((REMAP) == AFIO_MAP5_I2C2_0010) || ((REMAP) == AFIO_MAP7_ADC1_0001) || \
+ ((REMAP) == AFIO_MAP5_I2C2_0011) || ((REMAP) == AFIO_MAP7_ADC1_0010) || \
+ ((REMAP) == AFIO_MAP5_SPI1_0001) || ((REMAP) == AFIO_MAP7_ADC2_0001) || \
+ ((REMAP) == AFIO_MAP5_SPI2_0001) || ((REMAP) == AFIO_MAP7_ADC2_0010) || \
+ ((REMAP) == AFIO_MAP7_SWJTAG_0010) || ((REMAP) == AFIO_MAP7_SWJTAG_0001) || \
+ ((REMAP) == AFIO_MAP7_SWJTAG_0100) || ((REMAP) == AFIO_MAP7_PD01_0001) || \
+ ((REMAP) == AFIO_MAP8_TMR1_BK1_00) || ((REMAP) == AFIO_MAP8_TMR1_BK1_10) || \
+ ((REMAP) == AFIO_MAP8_TMR1_BK1_11) || ((REMAP) == AFIO_MAP8_TMR1_CH1_00) || \
+ ((REMAP) == AFIO_MAP8_TMR1_CH1_10) || ((REMAP) == AFIO_MAP8_TMR1_CH1_11) || \
+ ((REMAP) == AFIO_MAP8_TMR2_CH4_00) || ((REMAP) == AFIO_MAP8_TMR2_CH4_10) || \
+ ((REMAP) == AFIO_MAP8_TMR2_CH4_11) || ((REMAP) == AFIO_MAP8_TMR3_CH1_00) || \
+ ((REMAP) == AFIO_MAP8_TMR3_CH1_10) || ((REMAP) == AFIO_MAP8_TMR3_CH1_11) || \
+ ((REMAP) == AFIO_MAP4_TMR1_0011) || ((REMAP) == AFIO_MAP4_TMR4_0001) || \
+ ((REMAP) == AFIO_MAP4_TMR2_1001) || ((REMAP) == AFIO_MAP4_TMR2_1010) || \
+ ((REMAP) == AFIO_MAP4_TMR2_1011) || ((REMAP) == AFIO_MAP4_TMR2_1101) || \
+ ((REMAP) == AFIO_MAP4_TMR2_1110) || ((REMAP) == AFIO_MAP4_TMR2_1111) || \
+ ((REMAP) == AFIO_MAP5_USART5_0001) || ((REMAP) == AFIO_MAP5_I2C3_0001) || \
+ ((REMAP) == AFIO_MAP5_SPI1_0010) || ((REMAP) == AFIO_MAP5_SPI1_0011) || \
+ ((REMAP) == AFIO_MAP5_SPI2_0010) || ((REMAP) == AFIO_MAP5_SPI3_0001) || \
+ ((REMAP) == AFIO_MAP5_SPI3_0010) || ((REMAP) == AFIO_MAP5_SPI3_0011) || \
+ ((REMAP) == AFIO_MAP5_SPI4_0001) || ((REMAP) == AFIO_MAP5_SPI4_0010) || \
+ ((REMAP) == AFIO_MAP5_SPI4_0011) || ((REMAP) == AFIO_MAP6_CAN1_0011) || \
+ ((REMAP) == AFIO_MAP6_SDIO2_0001) || ((REMAP) == AFIO_MAP6_SDIO2_0010) || \
+ ((REMAP) == AFIO_MAP6_SDIO2_0011) || ((REMAP) == AFIO_MAP6_USART2_0001) || \
+ ((REMAP) == AFIO_MAP6_USART3_0011) || ((REMAP) == AFIO_MAP7_ADC1_0011) || \
+ ((REMAP) == AFIO_MAP7_ADC2_0011) || ((REMAP) == AFIO_MAP7_XMC_0001) || \
+ ((REMAP) == AFIO_MAP7_XMC_0010) || ((REMAP) == AFIO_MAP7_XMC_1001) || \
+ ((REMAP) == AFIO_MAP7_XMC_1010) || ((REMAP) == AFIO_MAP8_ETH_0001) || \
+ ((REMAP) == AFIO_MAP8_ETH_0100) || ((REMAP) == AFIO_MAP8_ETH_0101) || \
+ ((REMAP) == AFIO_MAP8_ETH_1000) || ((REMAP) == AFIO_MAP8_ETH_1001) || \
+ ((REMAP) == AFIO_MAP8_ETH_1100) || ((REMAP) == AFIO_MAP8_ETH_1101) || \
+ ((REMAP) == AFIO_MAP8_USART6_0001) || ((REMAP) == AFIO_MAP8_UART7_0001) || \
+ ((REMAP) == AFIO_MAP8_UART8_0001) || ((REMAP) == AFIO_MAP4_TIM2ITR1_1000) || \
+ ((REMAP) == AFIO_MAP4_TIM2ITR1_1100) || ((REMAP) == AFIO_MAP7_XMC_1000))
+
+/**
+ * @}
+ */
+#endif
+
+/** @defgroup GPIO_Port_Sources
+ * @{
+ */
+
+#define GPIO_PortSourceGPIOA ((uint8_t)0x00)
+#define GPIO_PortSourceGPIOB ((uint8_t)0x01)
+#define GPIO_PortSourceGPIOC ((uint8_t)0x02)
+#define GPIO_PortSourceGPIOD ((uint8_t)0x03)
+#define GPIO_PortSourceGPIOE ((uint8_t)0x04)
+#define GPIO_PortSourceGPIOF ((uint8_t)0x05)
+#define GPIO_PortSourceGPIOG ((uint8_t)0x06)
+#define IS_GPIO_EVENTOUT_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == GPIO_PortSourceGPIOA) || \
+ ((PORTSOURCE) == GPIO_PortSourceGPIOB) || \
+ ((PORTSOURCE) == GPIO_PortSourceGPIOC) || \
+ ((PORTSOURCE) == GPIO_PortSourceGPIOD) || \
+ ((PORTSOURCE) == GPIO_PortSourceGPIOE))
+
+#define IS_GPIO_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == GPIO_PortSourceGPIOA) || \
+ ((PORTSOURCE) == GPIO_PortSourceGPIOB) || \
+ ((PORTSOURCE) == GPIO_PortSourceGPIOC) || \
+ ((PORTSOURCE) == GPIO_PortSourceGPIOD) || \
+ ((PORTSOURCE) == GPIO_PortSourceGPIOE) || \
+ ((PORTSOURCE) == GPIO_PortSourceGPIOF) || \
+ ((PORTSOURCE) == GPIO_PortSourceGPIOG))
+
+/**
+ * @}
+ */
+
+/** @defgroup GPIO_Pin_sources
+ * @{
+ */
+
+#define GPIO_PinsSource0 ((uint8_t)0x00)
+#define GPIO_PinsSource1 ((uint8_t)0x01)
+#define GPIO_PinsSource2 ((uint8_t)0x02)
+#define GPIO_PinsSource3 ((uint8_t)0x03)
+#define GPIO_PinsSource4 ((uint8_t)0x04)
+#define GPIO_PinsSource5 ((uint8_t)0x05)
+#define GPIO_PinsSource6 ((uint8_t)0x06)
+#define GPIO_PinsSource7 ((uint8_t)0x07)
+#define GPIO_PinsSource8 ((uint8_t)0x08)
+#define GPIO_PinsSource9 ((uint8_t)0x09)
+#define GPIO_PinsSource10 ((uint8_t)0x0A)
+#define GPIO_PinsSource11 ((uint8_t)0x0B)
+#define GPIO_PinsSource12 ((uint8_t)0x0C)
+#define GPIO_PinsSource13 ((uint8_t)0x0D)
+#define GPIO_PinsSource14 ((uint8_t)0x0E)
+#define GPIO_PinsSource15 ((uint8_t)0x0F)
+
+#define IS_GPIO_PINS_SOURCE(PINSSOURCE) (((PINSSOURCE) == GPIO_PinsSource0) || \
+ ((PINSSOURCE) == GPIO_PinsSource1) || \
+ ((PINSSOURCE) == GPIO_PinsSource2) || \
+ ((PINSSOURCE) == GPIO_PinsSource3) || \
+ ((PINSSOURCE) == GPIO_PinsSource4) || \
+ ((PINSSOURCE) == GPIO_PinsSource5) || \
+ ((PINSSOURCE) == GPIO_PinsSource6) || \
+ ((PINSSOURCE) == GPIO_PinsSource7) || \
+ ((PINSSOURCE) == GPIO_PinsSource8) || \
+ ((PINSSOURCE) == GPIO_PinsSource9) || \
+ ((PINSSOURCE) == GPIO_PinsSource10) || \
+ ((PINSSOURCE) == GPIO_PinsSource11) || \
+ ((PINSSOURCE) == GPIO_PinsSource12) || \
+ ((PINSSOURCE) == GPIO_PinsSource13) || \
+ ((PINSSOURCE) == GPIO_PinsSource14) || \
+ ((PINSSOURCE) == GPIO_PinsSource15))
+
+/**
+ * @}
+ */
+
+/** @defgroup Ethernet_Media_Interface
+ * @{
+ */
+#define GPIO_ETH_MediaInterface_MII ((uint32_t)0x00000000)
+#define GPIO_ETH_MediaInterface_RMII ((uint32_t)0x00000001)
+
+#define IS_GPIO_ETH_MEDIA_INTERFACE(INTERFACE) (((INTERFACE) == GPIO_ETH_MediaInterface_MII) || \
+ ((INTERFACE) == GPIO_ETH_MediaInterface_RMII))
+
+/**
+ * @}
+ */
+
+/** @defgroup GPIO_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup GPIO_Exported_Functions
+ * @{
+ */
+
+void GPIO_Reset(GPIO_Type* GPIOx);
+void GPIO_AFIOReset(void);
+void GPIO_Init(GPIO_Type* GPIOx, GPIO_InitType* GPIO_InitStruct);
+void GPIO_StructInit(GPIO_InitType* GPIO_InitStruct);
+uint8_t GPIO_ReadInputDataBit(GPIO_Type* GPIOx, uint16_t GPIO_Pin);
+uint16_t GPIO_ReadInputData(GPIO_Type* GPIOx);
+uint8_t GPIO_ReadOutputDataBit(GPIO_Type* GPIOx, uint16_t GPIO_Pin);
+uint16_t GPIO_ReadOutputData(GPIO_Type* GPIOx);
+void GPIO_SetBits(GPIO_Type* GPIOx, uint16_t GPIO_Pin);
+void GPIO_ResetBits(GPIO_Type* GPIOx, uint16_t GPIO_Pin);
+void GPIO_WriteBit(GPIO_Type* GPIOx, uint16_t GPIO_Pin, BitState BitVal);
+void GPIO_Write(GPIO_Type* GPIOx, uint16_t PortVal);
+void GPIO_PinsLockConfig(GPIO_Type* GPIOx, uint16_t GPIO_Pin);
+void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
+void GPIO_EventOutputCmd(FunctionalState NewState);
+void GPIO_PinsRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState);
+void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
+void GPIO_ETH_MediaInterfaceConfig(uint32_t GPIO_ETH_MediaInterface);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_GPIO_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_i2c.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_i2c.h
new file mode 100644
index 0000000000000000000000000000000000000000..891ccd9706cf584ccbf5721b0b7ab58bf90f6b63
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_i2c.h
@@ -0,0 +1,682 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_i2c.h
+ * Description : at32f4xx I2C header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_I2C_H
+#define __AT32F4xx_I2C_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup I2C
+ * @{
+ */
+
+/** @defgroup I2C_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief I2C Init structure definition
+ */
+
+typedef struct
+{
+ uint32_t I2C_BitRate; /*!< Specifies the clock frequency.
+ This parameter must be set to a value lower than 400kHz */
+
+ uint16_t I2C_Mode; /*!< Specifies the I2C mode.
+ This parameter can be a value of @ref I2C_mode */
+
+ uint16_t I2C_FmDutyCycle; /*!< Specifies the I2C fast mode duty cycle.
+ This parameter can be a value of @ref I2C_duty_cycle_in_fast_mode */
+
+ uint16_t I2C_OwnAddr1; /*!< Specifies the first device own address.
+ This parameter can be a 7-bit or 10-bit address. */
+
+ uint16_t I2C_Ack; /*!< Enables or disables the acknowledgement.
+ This parameter can be a value of @ref I2C_acknowledgement */
+
+ uint16_t I2C_AddrMode; /*!< Specifies if 7-bit or 10-bit address is acknowledged.
+ This parameter can be a value of @ref I2C_acknowledged_address */
+} I2C_InitType;
+
+/**
+ * @}
+ */
+
+
+/** @defgroup I2C_Exported_Constants
+ * @{
+ */
+
+#if defined (AT32F413xx) || defined (AT32F415xx)
+#define IS_I2C_ALL_PERIPH(PERIPH) (((PERIPH) == I2C1) || \
+ ((PERIPH) == I2C2))
+#elif defined (AT32F403xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+#define IS_I2C_ALL_PERIPH(PERIPH) (((PERIPH) == I2C1) || \
+ ((PERIPH) == I2C2) || \
+ ((PERIPH) == I2C3))
+#endif
+
+/** @defgroup I2C_mode
+ * @{
+ */
+
+#define I2C_Mode_I2CDevice ((uint16_t)0x0000)
+#define I2C_Mode_SMBusDevice ((uint16_t)0x0002)
+#define I2C_Mode_SMBusHost ((uint16_t)0x000A)
+#define IS_I2C_MODE(MODE) (((MODE) == I2C_Mode_I2CDevice) || \
+ ((MODE) == I2C_Mode_SMBusDevice) || \
+ ((MODE) == I2C_Mode_SMBusHost))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_duty_cycle_in_fast_mode
+ * @{
+ */
+
+#define I2C_FmDutyCycle_16_9 ((uint16_t)0x4000) /*!< I2C fast mode Tlow/Thigh = 16/9 */
+#define I2C_FmDutyCycle_2_1 ((uint16_t)0xBFFF) /*!< I2C fast mode Tlow/Thigh = 2 */
+#define IS_I2C_FM_DUTY_CYCLE(CYCLE) (((CYCLE) == I2C_FmDutyCycle_16_9) || \
+ ((CYCLE) == I2C_FmDutyCycle_2_1))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_acknowledgement
+ * @{
+ */
+
+#define I2C_Ack_Enable ((uint16_t)0x0400)
+#define I2C_Ack_Disable ((uint16_t)0x0000)
+#define IS_I2C_ACK_STATE(STATE) (((STATE) == I2C_Ack_Enable) || \
+ ((STATE) == I2C_Ack_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_transfer_direction
+ * @{
+ */
+
+#define I2C_Direction_Transmit ((uint8_t)0x00)
+#define I2C_Direction_Receive ((uint8_t)0x01)
+#define IS_I2C_DIRECTION(DIRECTION) (((DIRECTION) == I2C_Direction_Transmit) || \
+ ((DIRECTION) == I2C_Direction_Receive))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_acknowledged_address
+ * @{
+ */
+
+#define I2C_AddrMode_7bit ((uint16_t)0x4000)
+#define I2C_AddrMode_10bit ((uint16_t)0xC000)
+#define IS_I2C_ADDR_MODE(MODE) (((MODE) == I2C_AddrMode_7bit) || \
+ ((MODE) == I2C_AddrMode_10bit))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_registers
+ * @{
+ */
+
+#define I2C_Register_CTRL1 ((uint8_t)0x00)
+#define I2C_Register_CTRL2 ((uint8_t)0x04)
+#define I2C_Register_OADDR1 ((uint8_t)0x08)
+#define I2C_Register_OADDR2 ((uint8_t)0x0C)
+#define I2C_Register_DT ((uint8_t)0x10)
+#define I2C_Register_STS1 ((uint8_t)0x14)
+#define I2C_Register_STS2 ((uint8_t)0x18)
+#define I2C_Register_CLKCTRL ((uint8_t)0x1C)
+#define I2C_Register_TMRISE ((uint8_t)0x20)
+#define IS_I2C_REGISTER(REGISTER) (((REGISTER) == I2C_Register_CTRL1) || \
+ ((REGISTER) == I2C_Register_CTRL2) || \
+ ((REGISTER) == I2C_Register_OADDR1) || \
+ ((REGISTER) == I2C_Register_OADDR2) || \
+ ((REGISTER) == I2C_Register_DT) || \
+ ((REGISTER) == I2C_Register_STS1) || \
+ ((REGISTER) == I2C_Register_STS2) || \
+ ((REGISTER) == I2C_Register_CLKCTRL)|| \
+ ((REGISTER) == I2C_Register_TMRISE))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_SMBus_alert_pin_level
+ * @{
+ */
+
+#define I2C_SMBusAlert_Low ((uint16_t)0x2000)
+#define I2C_SMBusAlert_High ((uint16_t)0xDFFF)
+#define IS_I2C_SMBUS_ALERT(ALERT) (((ALERT) == I2C_SMBusAlert_Low) || \
+ ((ALERT) == I2C_SMBusAlert_High))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_PEC_position
+ * @{
+ */
+
+#define I2C_PECPosition_Next ((uint16_t)0x0800)
+#define I2C_PECPosition_Current ((uint16_t)0xF7FF)
+#define IS_I2C_PEC_POSITION(POSITION) (((POSITION) == I2C_PECPosition_Next) || \
+ ((POSITION) == I2C_PECPosition_Current))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_NCAK_position
+ * @{
+ */
+
+#define I2C_NACKPosition_Next ((uint16_t)0x0800)
+#define I2C_NACKPosition_Current ((uint16_t)0xF7FF)
+#define IS_I2C_NACK_POSITION(POSITION) (((POSITION) == I2C_NACKPosition_Next) || \
+ ((POSITION) == I2C_NACKPosition_Current))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_interrupts_definition
+ * @{
+ */
+
+#define I2C_INT_BUF ((uint16_t)0x0400)
+#define I2C_INT_EVT ((uint16_t)0x0200)
+#define I2C_INT_ERR ((uint16_t)0x0100)
+#define IS_I2C_CONFIG_INT(INT) ((((INT) & (uint16_t)0xF8FF) == 0x00) && ((INT) != 0x00))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_interrupts_definition
+ * @{
+ */
+
+#define I2C_INT_SMBALERTF ((uint32_t)0x01008000)
+#define I2C_INT_TIMOUT ((uint32_t)0x01004000)
+#define I2C_INT_PECERR ((uint32_t)0x01001000)
+#define I2C_INT_OVRUN ((uint32_t)0x01000800)
+#define I2C_INT_ACKFAIL ((uint32_t)0x01000400)
+#define I2C_INT_ARLOST ((uint32_t)0x01000200)
+#define I2C_INT_BUSERR ((uint32_t)0x01000100)
+#define I2C_INT_TDE ((uint32_t)0x06000080)
+#define I2C_INT_RDNE ((uint32_t)0x06000040)
+#define I2C_INT_STOPF ((uint32_t)0x02000010)
+#define I2C_INT_ADDR10F ((uint32_t)0x02000008)
+#define I2C_INT_BTFF ((uint32_t)0x02000004)
+#define I2C_INT_ADDRF ((uint32_t)0x02000002)
+#define I2C_INT_STARTF ((uint32_t)0x02000001)
+
+#define IS_I2C_CLEAR_INT(INT) ((((INT) & (uint16_t)0x20FF) == 0x00) && ((INT) != (uint16_t)0x00))
+
+#define IS_I2C_GET_INT(INT) (((INT) == I2C_INT_SMBALERTF) || ((INT) == I2C_INT_TIMOUT) || \
+ ((INT) == I2C_INT_PECERR) || ((INT) == I2C_INT_OVRUN) || \
+ ((INT) == I2C_INT_ACKFAIL) || ((INT) == I2C_INT_ARLOST) || \
+ ((INT) == I2C_INT_BUSERR) || ((INT) == I2C_INT_TDE) || \
+ ((INT) == I2C_INT_RDNE) || ((INT) == I2C_INT_STOPF) || \
+ ((INT) == I2C_INT_ADDR10F) || ((INT) == I2C_INT_BTFF) || \
+ ((INT) == I2C_INT_ADDRF) || ((INT) == I2C_INT_STARTF))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_flags_definition
+ * @{
+ */
+
+/**
+ * @brief SR2 register flags
+ */
+
+#define I2C_FLAG_DUALF ((uint32_t)0x00800000)
+#define I2C_FLAG_SMBHOSTADDRF ((uint32_t)0x00400000)
+#define I2C_FLAG_SMBDEFTADDRF ((uint32_t)0x00200000)
+#define I2C_FLAG_GCADDRF ((uint32_t)0x00100000)
+#define I2C_FLAG_TRF ((uint32_t)0x00040000)
+#define I2C_FLAG_BUSYF ((uint32_t)0x00020000)
+#define I2C_FLAG_MSF ((uint32_t)0x00010000)
+
+/**
+ * @brief SR1 register flags
+ */
+
+#define I2C_FLAG_SMBALERTF ((uint32_t)0x10008000)
+#define I2C_FLAG_TIMOUT ((uint32_t)0x10004000)
+#define I2C_FLAG_PECERR ((uint32_t)0x10001000)
+#define I2C_FLAG_OVRUN ((uint32_t)0x10000800)
+#define I2C_FLAG_ACKFAIL ((uint32_t)0x10000400)
+#define I2C_FLAG_ARLOST ((uint32_t)0x10000200)
+#define I2C_FLAG_BUSERR ((uint32_t)0x10000100)
+#define I2C_FLAG_TDE ((uint32_t)0x10000080)
+#define I2C_FLAG_RDNE ((uint32_t)0x10000040)
+#define I2C_FLAG_STOPF ((uint32_t)0x10000010)
+#define I2C_FLAG_ADDR10F ((uint32_t)0x10000008)
+#define I2C_FLAG_BTFF ((uint32_t)0x10000004)
+#define I2C_FLAG_ADDRF ((uint32_t)0x10000002)
+#define I2C_FLAG_STARTF ((uint32_t)0x10000001)
+
+#define IS_I2C_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0x20FF) == 0x00) && ((FLAG) != (uint16_t)0x00))
+
+#define IS_I2C_GET_FLAG(FLAG) (((FLAG) == I2C_FLAG_DUALF) || ((FLAG) == I2C_FLAG_SMBHOSTADDRF) || \
+ ((FLAG) == I2C_FLAG_SMBDEFTADDRF) || ((FLAG) == I2C_FLAG_GCADDRF) || \
+ ((FLAG) == I2C_FLAG_TRF) || ((FLAG) == I2C_FLAG_BUSYF) || \
+ ((FLAG) == I2C_FLAG_MSF) || ((FLAG) == I2C_FLAG_SMBALERTF) || \
+ ((FLAG) == I2C_FLAG_TIMOUT) || ((FLAG) == I2C_FLAG_PECERR) || \
+ ((FLAG) == I2C_FLAG_OVRUN) || ((FLAG) == I2C_FLAG_ACKFAIL) || \
+ ((FLAG) == I2C_FLAG_ARLOST) || ((FLAG) == I2C_FLAG_BUSERR) || \
+ ((FLAG) == I2C_FLAG_TDE) || ((FLAG) == I2C_FLAG_RDNE) || \
+ ((FLAG) == I2C_FLAG_STOPF) || ((FLAG) == I2C_FLAG_ADDR10F) || \
+ ((FLAG) == I2C_FLAG_BTFF) || ((FLAG) == I2C_FLAG_ADDRF) || \
+ ((FLAG) == I2C_FLAG_STARTF))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_Events
+ * @{
+ */
+
+/*========================================
+
+ I2C Master Events (Events grouped in order of communication)
+ ==========================================*/
+/**
+ * @brief Communication start
+ *
+ * After sending the START condition (I2C_GenerateSTART() function) the master
+ * has to wait for this event. It means that the Start condition has been correctly
+ * released on the I2C bus (the bus is free, no other devices is communicating).
+ *
+ */
+/* --EV5 */
+#define I2C_EVENT_MASTER_START_GENERATED ((uint32_t)0x00030001) /* BUSY, MSL and SB flag */
+
+/**
+ * @brief Address Acknowledge
+ *
+ * After checking on EV5 (start condition correctly released on the bus), the
+ * master sends the address of the slave(s) with which it will communicate
+ * (I2C_Send7bitAddress() function, it also determines the direction of the communication:
+ * Master transmitter or Receiver). Then the master has to wait that a slave acknowledges
+ * his address. If an acknowledge is sent on the bus, one of the following events will
+ * be set:
+ *
+ * 1) In case of Master Receiver (7-bit addressing): the I2C_EVENT_MASTER_ADDRESS_WITH_RECEIVER
+ * event is set.
+ *
+ * 2) In case of Master Transmitter (7-bit addressing): the I2C_EVENT_MASTER_ADDRESS | I2C_EVENT_MASTER_TRANSMITTER
+ * is set
+ *
+ * 3) In case of 10-Bit addressing mode, the master (just after generating the START
+ * and checking on EV5) has to send the header of 10-bit addressing mode (I2C_SendData()
+ * function). Then master should wait on EV9. It means that the 10-bit addressing
+ * header has been correctly sent on the bus. Then master should send the second part of
+ * the 10-bit address (LSB) using the function I2C_Send7bitAddress(). Then master
+ * should wait for event EV6.
+ *
+ */
+
+/* --EV6 */
+#define I2C_EVENT_MASTER_ADDRESS ((uint32_t)0x00070002) /* BUSY, MSL, ADDR and TRF flags */
+#define I2C_EVENT_MASTER_TRANSMITTER ((uint32_t)0x00000080) /* TDE flags */
+#define I2C_EVENT_MASTER_ADDRESS_WITH_RECEIVER ((uint32_t)0x00030002) /* BUSY, MSL and ADDR flags */
+/* --EV9 */
+#define I2C_EVENT_MASTER_ADDRESS10_GENERATED ((uint32_t)0x00030008) /* BUSY, MSL and ADD10 flags */
+
+/**
+ * @brief Communication events
+ *
+ * If a communication is established (START condition generated and slave address
+ * acknowledged) then the master has to check on one of the following events for
+ * communication procedures:
+ *
+ * 1) Master Receiver mode: The master has to wait on the event EV7 then to read
+ * the data received from the slave (I2C_ReceiveData() function).
+ *
+ * 2) Master Transmitter mode: The master has to send data (I2C_SendData()
+ * function) then to wait on event EV8 or EV8_2.
+ * These two events are similar:
+ * - EV8 means that the data has been written in the data register and is
+ * being shifted out.
+ * - EV8_2 means that the data has been physically shifted out and output
+ * on the bus.
+ * In most cases, using EV8 is sufficient for the application.
+ * Using EV8_2 leads to a slower communication but ensure more reliable test.
+ * EV8_2 is also more suitable than EV8 for testing on the last data transmission
+ * (before Stop condition generation).
+ *
+ * @note In case the user software does not guarantee that this event EV7 is
+ * managed before the current byte end of transfer, then user may check on EV7
+ * and BTF flag at the same time (ie. (I2C_EVENT_MASTER_DATA_RECEIVED | I2C_FLAG_BTFF)).
+ * In this case the communication may be slower.
+ *
+ */
+
+/* Master RECEIVER mode -----------------------------*/
+/* --EV7 */
+#define I2C_EVENT_MASTER_DATA_RECEIVED ((uint32_t)0x00030040) /* BUSY, MSL and RXNE flags */
+
+/* Master TRANSMITTER mode --------------------------*/
+/* --EV8 */
+#define I2C_EVENT_MASTER_DATA_TRANSMITTING ((uint32_t)0x00070080) /* TRA, BUSY, MSL, TXE flags */
+/* --EV8_2 */
+#define I2C_EVENT_MASTER_DATA_TRANSMITTED ((uint32_t)0x00070084) /* TRA, BUSY, MSL, TXE and BTF flags */
+
+
+/*========================================
+
+ I2C Slave Events (Events grouped in order of communication)
+ ==========================================*/
+
+/**
+ * @brief Communication start events
+ *
+ * Wait on one of these events at the start of the communication. It means that
+ * the I2C peripheral detected a Start condition on the bus (generated by master
+ * device) followed by the peripheral address. The peripheral generates an ACK
+ * condition on the bus (if the acknowledge feature is enabled through function
+ * I2C_AcknowledgeConfig()) and the events listed above are set :
+ *
+ * 1) In normal case (only one address managed by the slave), when the address
+ * sent by the master matches the own address of the peripheral (configured by
+ * I2C_OwnAddress1 field) the I2C_EVENT_SLAVE_XXX_ADDRESS_MATCHED event is set
+ * (where XXX could be TRANSMITTER or RECEIVER).
+ *
+ * 2) In case the address sent by the master matches the second address of the
+ * peripheral (configured by the function I2C_OwnAddress2Config() and enabled
+ * by the function I2C_DualAddressCmd()) the events I2C_EVENT_SLAVE_XXX_SECONDADDRESS_MATCHED
+ * (where XXX could be TRANSMITTER or RECEIVER) are set.
+ *
+ * 3) In case the address sent by the master is General Call (address 0x00) and
+ * if the General Call is enabled for the peripheral (using function I2C_GeneralCallCmd())
+ * the following event is set I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED.
+ *
+ */
+
+/* --EV1 (all the events below are variants of EV1) */
+/* 1) Case of One Single Address managed by the slave */
+#define I2C_EVENT_SLAVE_ADDRESS_RECEIVER_MATCHED ((uint32_t)0x00020002) /* BUSY and ADDR flags */
+#define I2C_EVENT_SLAVE_ADDRESS_TRANSMITTER_MATCHED ((uint32_t)0x00060082) /* TRA, BUSY, TXE and ADDR flags */
+
+/* 2) Case of Dual address managed by the slave */
+#define I2C_EVENT_SLAVE_SECONDADDRESS_RECEIVER_MATCHED ((uint32_t)0x00820000) /* DUALF and BUSY flags */
+#define I2C_EVENT_SLAVE_SECONDADDRESS_TRANSMITTER_MATCHED ((uint32_t)0x00860080) /* DUALF, TRA, BUSY and TXE flags */
+
+/* 3) Case of General Call enabled for the slave */
+#define I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED ((uint32_t)0x00120000) /* GENCALL and BUSY flags */
+
+/**
+ * @brief Communication events
+ *
+ * Wait on one of these events when EV1 has already been checked and:
+ *
+ * - Slave RECEIVER mode:
+ * - EV2: When the application is expecting a data byte to be received.
+ * - EV4: When the application is expecting the end of the communication: master
+ * sends a stop condition and data transmission is stopped.
+ *
+ * - Slave Transmitter mode:
+ * - EV3: When a byte has been transmitted by the slave and the application is expecting
+ * the end of the byte transmission. The two events I2C_EVENT_SLAVE_DATA_TRANSMITTED and
+ * I2C_EVENT_SLAVE_DATA_TRANSMITTING are similar. The second one can optionally be
+ * used when the user software doesn't guarantee the EV3 is managed before the
+ * current byte end of transfer.
+ * - EV3_2: When the master sends a NACK in order to tell slave that data transmission
+ * shall end (before sending the STOP condition). In this case slave has to stop sending
+ * data bytes and expect a Stop condition on the bus.
+ *
+ * @note In case the user software does not guarantee that the event EV2 is
+ * managed before the current byte end of transfer, then user may check on EV2
+ * and BTF flag at the same time (ie. (I2C_EVENT_SLAVE_DATA_RECEIVED | I2C_FLAG_BTFF)).
+ * In this case the communication may be slower.
+ *
+ */
+
+/* Slave RECEIVER mode --------------------------*/
+/* --EV2 */
+#define I2C_EVENT_SLAVE_DATA_RECEIVED ((uint32_t)0x00020040) /* BUSY and RXNE flags */
+/* --EV4 */
+#define I2C_EVENT_SLAVE_STOP_DETECTED ((uint32_t)0x00000010) /* STOPF flag */
+
+/* Slave TRANSMITTER mode -----------------------*/
+/* --EV3 */
+#define I2C_EVENT_SLAVE_DATA_TRANSMITTED ((uint32_t)0x00060084) /* TRA, BUSY, TXE and BTF flags */
+#define I2C_EVENT_SLAVE_DATA_TRANSMITTING ((uint32_t)0x00060080) /* TRA, BUSY and TXE flags */
+/* --EV3_2 */
+#define I2C_EVENT_SLAVE_ACK_FAILURE_DETECTED ((uint32_t)0x00000400) /* AF flag */
+
+/*=========================== End of Events Description ==========================================*/
+
+#define IS_I2C_EVENT(EVENT) (((EVENT) == I2C_EVENT_SLAVE_ADDRESS_TRANSMITTER_MATCHED) || \
+ ((EVENT) == I2C_EVENT_SLAVE_ADDRESS_RECEIVER_MATCHED) || \
+ ((EVENT) == I2C_EVENT_SLAVE_SECONDADDRESS_TRANSMITTER_MATCHED) || \
+ ((EVENT) == I2C_EVENT_SLAVE_SECONDADDRESS_RECEIVER_MATCHED) || \
+ ((EVENT) == I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED) || \
+ ((EVENT) == I2C_EVENT_SLAVE_DATA_RECEIVED) || \
+ ((EVENT) == (I2C_EVENT_SLAVE_DATA_RECEIVED | I2C_FLAG_DUALF)) || \
+ ((EVENT) == (I2C_EVENT_SLAVE_DATA_RECEIVED | I2C_FLAG_GCADDRF)) || \
+ ((EVENT) == I2C_EVENT_SLAVE_DATA_TRANSMITTED) || \
+ ((EVENT) == (I2C_EVENT_SLAVE_DATA_TRANSMITTED | I2C_FLAG_DUALF)) || \
+ ((EVENT) == (I2C_EVENT_SLAVE_DATA_TRANSMITTED | I2C_FLAG_GCADDRF)) || \
+ ((EVENT) == I2C_EVENT_SLAVE_STOP_DETECTED) || \
+ ((EVENT) == I2C_EVENT_MASTER_START_GENERATED) || \
+ ((EVENT) == I2C_EVENT_MASTER_ADDRESS) || \
+ ((EVENT) == I2C_EVENT_MASTER_TRANSMITTER) || \
+ ((EVENT) == I2C_EVENT_MASTER_ADDRESS_WITH_RECEIVER) || \
+ ((EVENT) == I2C_EVENT_MASTER_DATA_RECEIVED) || \
+ ((EVENT) == I2C_EVENT_MASTER_DATA_TRANSMITTED) || \
+ ((EVENT) == I2C_EVENT_MASTER_DATA_TRANSMITTING) || \
+ ((EVENT) == I2C_EVENT_MASTER_ADDRESS10_GENERATED) || \
+ ((EVENT) == I2C_EVENT_SLAVE_ACK_FAILURE_DETECTED))
+/**
+ * @}
+ */
+
+/** @defgroup I2C_own_address1
+ * @{
+ */
+
+#define IS_I2C_OWN_ADDRESS1(ADDRESS1) ((ADDRESS1) <= 0x3FF)
+/**
+ * @}
+ */
+
+/** @defgroup I2C_clock_speed
+ * @{
+ */
+
+#define IS_I2C_BIT_RATE(RATE) (((RATE) >= 0x1) && ((RATE) <= 400000))
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup I2C_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup I2C_Exported_Functions
+ * @{
+ */
+
+void I2C_DeInit(I2C_Type* I2Cx);
+void I2C_Init(I2C_Type* I2Cx, I2C_InitType* I2C_InitStruct);
+void I2C_StructInit(I2C_InitType* I2C_InitStruct);
+void I2C_Cmd(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_DMACmd(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_DMALastTransferCmd(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_GenerateSTART(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_GenerateSTOP(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_AcknowledgeConfig(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_OwnAddress2Config(I2C_Type* I2Cx, uint8_t Address);
+void I2C_DualAddressCmd(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_GeneralCallCmd(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_INTConfig(I2C_Type* I2Cx, uint16_t I2C_INT, FunctionalState NewState);
+void I2C_SendData(I2C_Type* I2Cx, uint8_t Data);
+uint8_t I2C_ReceiveData(I2C_Type* I2Cx);
+void I2C_Send7bitAddress(I2C_Type* I2Cx, uint8_t Address, uint8_t I2C_Direction);
+uint16_t I2C_ReadRegister(I2C_Type* I2Cx, uint8_t I2C_Register);
+void I2C_SoftwareResetCmd(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_NACKPositionConfig(I2C_Type* I2Cx, uint16_t I2C_NACKPosition);
+void I2C_SMBusAlertConfig(I2C_Type* I2Cx, uint16_t I2C_SMBusAlert);
+void I2C_TransmitPEC(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_PECPositionConfig(I2C_Type* I2Cx, uint16_t I2C_PECPosition);
+void I2C_CalculatePEC(I2C_Type* I2Cx, FunctionalState NewState);
+uint8_t I2C_GetPEC(I2C_Type* I2Cx);
+void I2C_ARPCmd(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_StretchClockCmd(I2C_Type* I2Cx, FunctionalState NewState);
+void I2C_FastModeDutyCycleConfig(I2C_Type* I2Cx, uint16_t I2C_DutyCycle);
+
+/**
+ * @brief
+ ****************************************************************************************
+ *
+ * I2C State Monitoring Functions
+ *
+ ****************************************************************************************
+ * This I2C driver provides three different ways for I2C state monitoring
+ * depending on the application requirements and constraints:
+ *
+ *
+ * 1) Basic state monitoring:
+ * Using I2C_CheckEvent() function:
+ * It compares the status registers (SR1 and SR2) content to a given event
+ * (can be the combination of one or more flags).
+ * It returns SUCCESS if the current status includes the given flags
+ * and returns ERROR if one or more flags are missing in the current status.
+ * - When to use:
+ * - This function is suitable for most applications as well as for startup
+ * activity since the events are fully described in the product reference manual
+ * (RM0008).
+ * - It is also suitable for users who need to define their own events.
+ * - Limitations:
+ * - If an error occurs (ie. error flags are set besides to the monitored flags),
+ * the I2C_CheckEvent() function may return SUCCESS despite the communication
+ * hold or corrupted real state.
+ * In this case, it is advised to use error interrupts to monitor the error
+ * events and handle them in the interrupt IRQ handler.
+ *
+ * @note
+ * For error management, it is advised to use the following functions:
+ * - I2C_INTConfig() to configure and enable the error interrupts (I2C_INT_ERR).
+ * - I2Cx_ER_IRQHandler() which is called when the error interrupt occurs.
+ * Where x is the peripheral instance (I2C1, I2C2 ...)
+ * - I2C_GetFlagStatus() or I2C_GetINTStatus() to be called into I2Cx_ER_IRQHandler()
+ * in order to determine which error occurred.
+ * - I2C_ClearFlag() or I2C_ClearITPendingBit() and/or I2C_SoftwareResetCmd()
+ * and/or I2C_GenerateStop() in order to clear the error flag and source,
+ * and return to correct communication status.
+ *
+ *
+ * 2) Advanced state monitoring:
+ * Using the function I2C_GetLastEvent() which returns the image of both status
+ * registers in a single word (uint32_t) (Status Register 2 value is shifted left
+ * by 16 bits and concatenated to Status Register 1).
+ * - When to use:
+ * - This function is suitable for the same applications above but it allows to
+ * overcome the limitations of I2C_GetFlagStatus() function (see below).
+ * The returned value could be compared to events already defined in the
+ * library (at32f4xx_i2c.h) or to custom values defined by user.
+ * - This function is suitable when multiple flags are monitored at the same time.
+ * - At the opposite of I2C_CheckEvent() function, this function allows user to
+ * choose when an event is accepted (when all events flags are set and no
+ * other flags are set or just when the needed flags are set like
+ * I2C_CheckEvent() function).
+ * - Limitations:
+ * - User may need to define his own events.
+ * - Same remark concerning the error management is applicable for this
+ * function if user decides to check only regular communication flags (and
+ * ignores error flags).
+ *
+ *
+ * 3) Flag-based state monitoring:
+ * Using the function I2C_GetFlagStatus() which simply returns the status of
+ * one single flag (ie. I2C_FLAG_RDNE ...).
+ * - When to use:
+ * - This function could be used for specific applications or in debug phase.
+ * - It is suitable when only one flag checking is needed (most I2C events
+ * are monitored through multiple flags).
+ * - Limitations:
+ * - When calling this function, the Status register is accessed. Some flags are
+ * cleared when the status register is accessed. So checking the status
+ * of one Flag, may clear other ones.
+ * - Function may need to be called twice or more in order to monitor one
+ * single event.
+ *
+ */
+
+/**
+ *
+ * 1) Basic state monitoring
+ *******************************************************************************
+ */
+ErrorStatus I2C_CheckEvent(I2C_Type* I2Cx, uint32_t I2C_EVENT);
+/**
+ *
+ * 2) Advanced state monitoring
+ *******************************************************************************
+ */
+uint32_t I2C_GetLastEvent(I2C_Type* I2Cx);
+/**
+ *
+ * 3) Flag-based state monitoring
+ *******************************************************************************
+ */
+FlagStatus I2C_GetFlagStatus(I2C_Type* I2Cx, uint32_t I2C_FLAG);
+/**
+ *
+ *******************************************************************************
+ */
+
+void I2C_ClearFlag(I2C_Type* I2Cx, uint32_t I2C_FLAG);
+ITStatus I2C_GetINTStatus(I2C_Type* I2Cx, uint32_t I2C_INT);
+void I2C_ClearITPendingBit(I2C_Type* I2Cx, uint32_t I2C_INT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__AT32F4xx_I2C_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_iwdg.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_iwdg.h
new file mode 100644
index 0000000000000000000000000000000000000000..ac85c93c5e66b44e238988aa08ca7d1a7d49905b
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_iwdg.h
@@ -0,0 +1,128 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_iwdg.h
+ * Description : at32f4xx IWDG header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_IWDG_H
+#define __AT32F4xx_IWDG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup IWDG
+ * @{
+ */
+
+/** @defgroup IWDG_Exported_Types
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup IWDG_Exported_Constants
+ * @{
+ */
+
+/** @defgroup IWDG_WriteAccess
+ * @{
+ */
+
+#define IWDG_KeyRegWrite_Enable ((uint16_t)0x5555)
+#define IWDG_KeyRegWrite_Disable ((uint16_t)0x0000)
+#define IS_IWDG_KEY_REG_WRITE(WRITE) (((WRITE) == IWDG_KeyRegWrite_Enable) || \
+ ((WRITE) == IWDG_KeyRegWrite_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup IWDG_prescaler
+ * @{
+ */
+
+#define IWDG_Psc_4 ((uint8_t)0x00)
+#define IWDG_Psc_8 ((uint8_t)0x01)
+#define IWDG_Psc_16 ((uint8_t)0x02)
+#define IWDG_Psc_32 ((uint8_t)0x03)
+#define IWDG_Psc_64 ((uint8_t)0x04)
+#define IWDG_Psc_128 ((uint8_t)0x05)
+#define IWDG_Psc_256 ((uint8_t)0x06)
+#define IS_IWDG_PSC(PSC) (((PSC) == IWDG_Psc_4) || \
+ ((PSC) == IWDG_Psc_8) || \
+ ((PSC) == IWDG_Psc_16) || \
+ ((PSC) == IWDG_Psc_32) || \
+ ((PSC) == IWDG_Psc_64) || \
+ ((PSC) == IWDG_Psc_128)|| \
+ ((PSC) == IWDG_Psc_256))
+/**
+ * @}
+ */
+
+/** @defgroup IWDG_Flag
+ * @{
+ */
+
+#define IWDG_FLAG_PSCF ((uint16_t)0x0001)
+#define IWDG_FLAG_RLDF ((uint16_t)0x0002)
+#define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PSCF) || ((FLAG) == IWDG_FLAG_RLDF))
+#define IS_IWDG_RLD(RLD) ((RLD) <= 0xFFF)
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup IWDG_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup IWDG_Exported_Functions
+ * @{
+ */
+
+void IWDG_KeyRegWrite(uint16_t IWDG_WriteAccess);
+void IWDG_SetPrescaler(uint8_t IWDG_Prescaler);
+void IWDG_SetReload(uint16_t Reload);
+void IWDG_ReloadCounter(void);
+void IWDG_Enable(void);
+FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_IWDG_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_pwr.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_pwr.h
new file mode 100644
index 0000000000000000000000000000000000000000..3827e4e67f57e7fe01a7fd1044f77817c1d120e3
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_pwr.h
@@ -0,0 +1,156 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_pwr.h
+ * Description : at32f4xx PWR header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_PWR_H
+#define __AT32F4xx_PWR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup PWR
+ * @{
+ */
+
+/** @defgroup PWR_Exported_Types
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup PWR_Exported_Constants
+ * @{
+ */
+
+/** @defgroup PVD_detection_level
+ * @{
+ */
+
+#define PWR_PVDS_2V2 ((uint32_t)0x00000000)
+#define PWR_PVDS_2V3 ((uint32_t)0x00000020)
+#define PWR_PVDS_2V4 ((uint32_t)0x00000040)
+#define PWR_PVDS_2V5 ((uint32_t)0x00000060)
+#define PWR_PVDS_2V6 ((uint32_t)0x00000080)
+#define PWR_PVDS_2V7 ((uint32_t)0x000000A0)
+#define PWR_PVDS_2V8 ((uint32_t)0x000000C0)
+#define PWR_PVDS_2V9 ((uint32_t)0x000000E0)
+#define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDS_2V2) || ((LEVEL) == PWR_PVDS_2V3)|| \
+ ((LEVEL) == PWR_PVDS_2V4) || ((LEVEL) == PWR_PVDS_2V5)|| \
+ ((LEVEL) == PWR_PVDS_2V6) || ((LEVEL) == PWR_PVDS_2V7)|| \
+ ((LEVEL) == PWR_PVDS_2V8) || ((LEVEL) == PWR_PVDS_2V9))
+/**
+ * @}
+ */
+
+/** @defgroup PWR_SLEEP_mode_entry
+ * @{
+ */
+
+#define PWR_SLEEPEntry_WFI ((uint8_t)0x01)
+#define PWR_SLEEPEntry_WFE ((uint8_t)0x02)
+#define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPEntry_WFI) || ((ENTRY) == PWR_SLEEPEntry_WFE))
+
+/** @defgroup Regulator_state_is_STOP_mode
+ * @{
+ */
+#define PWR_Regulator_ON ((uint32_t)0x00000000)
+#define PWR_Regulator_LowPower ((uint32_t)0x00000001)
+#define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
+ ((REGULATOR) == PWR_Regulator_LowPower))
+/**
+ * @}
+ */
+
+/** @defgroup STOP_mode_entry
+ * @{
+ */
+
+#define PWR_STOPEntry_WFI ((uint8_t)0x01)
+#define PWR_STOPEntry_WFE ((uint8_t)0x02)
+#define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
+
+/**
+ * @}
+ */
+
+/** @defgroup PWR_Flag
+ * @{
+ */
+
+#define PWR_FLAG_WUF ((uint32_t)0x00000001)
+#define PWR_FLAG_SBF ((uint32_t)0x00000002)
+#define PWR_FLAG_PVDO ((uint32_t)0x00000004)
+#define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WUF) || ((FLAG) == PWR_FLAG_SBF) || \
+ ((FLAG) == PWR_FLAG_PVDO))
+
+#define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WUF) || ((FLAG) == PWR_FLAG_SBF))
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup PWR_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup PWR_Exported_Functions
+ * @{
+ */
+
+void PWR_Reset(void);
+void PWR_BackupAccessCtrl(FunctionalState NewState);
+void PWR_PVDCtrl(FunctionalState NewState);
+void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
+void PWR_WakeUpPinCtrl(FunctionalState NewState);
+void PWR_EnterSleepMode(uint8_t PWR_SLEEPEntry);
+#if defined (AT32F403xx) || defined (AT32F413xx)
+ void PWR_EnterSTOPMode(uint8_t PWR_STOPEntry);
+#else
+ void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
+#endif
+void PWR_EnterSTANDBYMode(void);
+FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
+void PWR_ClearFlag(uint32_t PWR_FLAG);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_PWR_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_rcc.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_rcc.h
new file mode 100644
index 0000000000000000000000000000000000000000..695f82d65ed40e7b9c1cb231c323c883b31926c1
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_rcc.h
@@ -0,0 +1,784 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_rcc.h
+ * Description : at32f4xx RCC header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_RCC_H
+#define __AT32F4xx_RCC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup RCC
+ * @{
+ */
+
+/** @defgroup RCC_Exported_Types
+ * @{
+ */
+
+typedef struct
+{
+ uint32_t SYSCLK_Freq; /*!< returns SYSCLK clock frequency expressed in Hz */
+ uint32_t AHBCLK_Freq; /*!< returns HCLK clock frequency expressed in Hz */
+ uint32_t APB1CLK_Freq; /*!< returns PCLK1 clock frequency expressed in Hz */
+ uint32_t APB2CLK_Freq; /*!< returns PCLK2 clock frequency expressed in Hz */
+ uint32_t ADCCLK_Freq; /*!< returns ADCCLK clock frequency expressed in Hz */
+} RCC_ClockType;
+
+/**
+ * @}
+ */
+
+/** @defgroup RCC_Exported_Constants
+ * @{
+ */
+
+/** @defgroup HSE_configuration
+ * @{
+ */
+
+#define RCC_HSE_DISABLE ((uint32_t)0x00000000)
+#define RCC_HSE_ENABLE ((uint32_t)0x00010000)
+#define RCC_HSE_BYPASS ((uint32_t)0x00040000)
+#define IS_RCC_HSE(HSE) (((HSE) == RCC_HSE_DISABLE) || \
+ ((HSE) == RCC_HSE_ENABLE) || \
+ ((HSE) == RCC_HSE_BYPASS))
+
+/**
+ * @}
+ */
+
+/** @defgroup PLL_entry_clock_source
+ * @{
+ */
+
+#define RCC_PLLRefClk_HSI_Div2 ((uint32_t)0x00000000)
+
+#define RCC_PLLRefClk_HSE_Div1 ((uint32_t)0x00010000)
+#define RCC_PLLRefClk_HSE_Div2 ((uint32_t)0x00030000)
+#define IS_RCC_PLL_CFG(CFG) (((CFG) == RCC_PLLRefClk_HSI_Div2) || \
+ ((CFG) == RCC_PLLRefClk_HSE_Div1) || \
+ ((CFG) == RCC_PLLRefClk_HSE_Div2))
+
+
+/**
+ * @}
+ */
+#define RCC_PLL_RANGE 72000000
+/** @defgroup PLL_clock_range_setting
+ * @{
+ */
+#define RCC_Range_LessEqual_72Mhz ((uint32_t)0x00000000)
+#define RCC_Range_GreatThan_72Mhz ((uint32_t)0x80000000)
+#define IS_RCC_PLL_RANGE(CFG) (((CFG) == RCC_Range_LessEqual_72Mhz) || \
+ ((CFG) == RCC_Range_GreatThan_72Mhz))
+/**
+ * @}
+ */
+/** @defgroup PLL_multiplication_factor
+ * @{
+ */
+#define RCC_PLLMult_2 RCC_CFG_PLLMULT2
+#define RCC_PLLMult_3 RCC_CFG_PLLMULT3
+#define RCC_PLLMult_4 RCC_CFG_PLLMULT4
+#define RCC_PLLMult_5 RCC_CFG_PLLMULT5
+#define RCC_PLLMult_6 RCC_CFG_PLLMULT6
+#define RCC_PLLMult_7 RCC_CFG_PLLMULT7
+#define RCC_PLLMult_8 RCC_CFG_PLLMULT8
+#define RCC_PLLMult_9 RCC_CFG_PLLMULT9
+#define RCC_PLLMult_10 RCC_CFG_PLLMULT10
+#define RCC_PLLMult_11 RCC_CFG_PLLMULT11
+#define RCC_PLLMult_12 RCC_CFG_PLLMULT12
+#define RCC_PLLMult_13 RCC_CFG_PLLMULT13
+#define RCC_PLLMult_14 RCC_CFG_PLLMULT14
+#define RCC_PLLMult_15 RCC_CFG_PLLMULT15
+#define RCC_PLLMult_16 RCC_CFG_PLLMULT16
+#define RCC_PLLMult_17 RCC_CFG_PLLMULT17
+#define RCC_PLLMult_18 RCC_CFG_PLLMULT18
+#define RCC_PLLMult_19 RCC_CFG_PLLMULT19
+#define RCC_PLLMult_20 RCC_CFG_PLLMULT20
+#define RCC_PLLMult_21 RCC_CFG_PLLMULT21
+#define RCC_PLLMult_22 RCC_CFG_PLLMULT22
+#define RCC_PLLMult_23 RCC_CFG_PLLMULT23
+#define RCC_PLLMult_24 RCC_CFG_PLLMULT24
+#define RCC_PLLMult_25 RCC_CFG_PLLMULT25
+#define RCC_PLLMult_26 RCC_CFG_PLLMULT26
+#define RCC_PLLMult_27 RCC_CFG_PLLMULT27
+#define RCC_PLLMult_28 RCC_CFG_PLLMULT28
+#define RCC_PLLMult_29 RCC_CFG_PLLMULT29
+#define RCC_PLLMult_30 RCC_CFG_PLLMULT30
+#define RCC_PLLMult_31 RCC_CFG_PLLMULT31
+#define RCC_PLLMult_32 RCC_CFG_PLLMULT32
+#define RCC_PLLMult_33 RCC_CFG_PLLMULT33
+#define RCC_PLLMult_34 RCC_CFG_PLLMULT34
+#define RCC_PLLMult_35 RCC_CFG_PLLMULT35
+#define RCC_PLLMult_36 RCC_CFG_PLLMULT36
+#define RCC_PLLMult_37 RCC_CFG_PLLMULT37
+#define RCC_PLLMult_38 RCC_CFG_PLLMULT38
+#define RCC_PLLMult_39 RCC_CFG_PLLMULT39
+#define RCC_PLLMult_40 RCC_CFG_PLLMULT40
+#define RCC_PLLMult_41 RCC_CFG_PLLMULT41
+#define RCC_PLLMult_42 RCC_CFG_PLLMULT42
+#define RCC_PLLMult_43 RCC_CFG_PLLMULT43
+#define RCC_PLLMult_44 RCC_CFG_PLLMULT44
+#define RCC_PLLMult_45 RCC_CFG_PLLMULT45
+#define RCC_PLLMult_46 RCC_CFG_PLLMULT46
+#define RCC_PLLMult_47 RCC_CFG_PLLMULT47
+#define RCC_PLLMult_48 RCC_CFG_PLLMULT48
+#define RCC_PLLMult_49 RCC_CFG_PLLMULT49
+#define RCC_PLLMult_50 RCC_CFG_PLLMULT50
+#define RCC_PLLMult_51 RCC_CFG_PLLMULT51
+#define RCC_PLLMult_52 RCC_CFG_PLLMULT52
+#define RCC_PLLMult_53 RCC_CFG_PLLMULT53
+#define RCC_PLLMult_54 RCC_CFG_PLLMULT54
+#define RCC_PLLMult_55 RCC_CFG_PLLMULT55
+#define RCC_PLLMult_56 RCC_CFG_PLLMULT56
+#define RCC_PLLMult_57 RCC_CFG_PLLMULT57
+#define RCC_PLLMult_58 RCC_CFG_PLLMULT58
+#define RCC_PLLMult_59 RCC_CFG_PLLMULT59
+#define RCC_PLLMult_60 RCC_CFG_PLLMULT60
+#define RCC_PLLMult_61 RCC_CFG_PLLMULT61
+#define RCC_PLLMult_62 RCC_CFG_PLLMULT62
+#define RCC_PLLMult_63 RCC_CFG_PLLMULT63
+#define RCC_PLLMult_64 RCC_CFG_PLLMULT64
+#define IS_RCC_PLL_MULT(MULT) (((MULT) & (~RCC_CFG_PLLMULT)) == 0x00000000)
+
+#define RCC_GET_PLLMULT(MULT) ((((MULT & RCC_CFG_PLLMULT_LB_MASK) >> RCC_CFG_PLLMULT_LB_POS) | \
+ ((MULT & RCC_CFG_PLLMULT_HB_MASK) >> (RCC_CFG_PLLMULT_HB_POS - RCC_CFG_PLLMULT_HB_OFFSET))) +\
+ ((((MULT & RCC_CFG_PLLMULT_HB_MASK)==0) && \
+ ((MULT & RCC_CFG_PLLMULT_LB_MASK)!=RCC_CFG_PLLMULT_LB_MASK) )? 2 : 1 ))
+
+/**
+ * @}
+ */
+/** @defgroup System_clock_source
+ * @{
+ */
+
+#define RCC_SYSCLKSelction_HSI ((uint32_t)0x00000000)
+#define RCC_SYSCLKSelction_HSE ((uint32_t)0x00000001)
+#define RCC_SYSCLKSelction_PLL ((uint32_t)0x00000002)
+#define IS_RCC_SYSCLK_CFG(CFG) (((CFG) == RCC_SYSCLKSelction_HSI) || \
+ ((CFG) == RCC_SYSCLKSelction_HSE) || \
+ ((CFG) == RCC_SYSCLKSelction_PLL))
+/**
+ * @}
+ */
+
+/** @defgroup AHB_clock_source
+ * @{
+ */
+
+#define RCC_SYSCLK_Div1 ((uint32_t)0x00000000)
+#define RCC_SYSCLK_Div2 ((uint32_t)0x00000080)
+#define RCC_SYSCLK_Div4 ((uint32_t)0x00000090)
+#define RCC_SYSCLK_Div8 ((uint32_t)0x000000A0)
+#define RCC_SYSCLK_Div16 ((uint32_t)0x000000B0)
+#define RCC_SYSCLK_Div64 ((uint32_t)0x000000C0)
+#define RCC_SYSCLK_Div128 ((uint32_t)0x000000D0)
+#define RCC_SYSCLK_Div256 ((uint32_t)0x000000E0)
+#define RCC_SYSCLK_Div512 ((uint32_t)0x000000F0)
+#define IS_RCC_AHBCLK(CLK) (((CLK) == RCC_SYSCLK_Div1) || ((CLK) == RCC_SYSCLK_Div2) || \
+ ((CLK) == RCC_SYSCLK_Div4) || ((CLK) == RCC_SYSCLK_Div8) || \
+ ((CLK) == RCC_SYSCLK_Div16) || ((CLK) == RCC_SYSCLK_Div64) || \
+ ((CLK) == RCC_SYSCLK_Div128) || ((CLK) == RCC_SYSCLK_Div256) || \
+ ((CLK) == RCC_SYSCLK_Div512))
+/**
+ * @}
+ */
+
+/** @defgroup APB1_APB2_clock_source
+ * @{
+ */
+
+#define RCC_AHBCLK_Div1 ((uint32_t)0x00000000)
+#define RCC_AHBCLK_Div2 ((uint32_t)0x00000400)
+#define RCC_AHBCLK_Div4 ((uint32_t)0x00000500)
+#define RCC_AHBCLK_Div8 ((uint32_t)0x00000600)
+#define RCC_AHBCLK_Div16 ((uint32_t)0x00000700)
+#define IS_RCC_APBCLK(CLK) (((CLK) == RCC_AHBCLK_Div1) || ((CLK) == RCC_AHBCLK_Div2) || \
+ ((CLK) == RCC_AHBCLK_Div4) || ((CLK) == RCC_AHBCLK_Div8) || \
+ ((CLK) == RCC_AHBCLK_Div16))
+/**
+ * @}
+ */
+
+/** @defgroup RCC_Interrupt_source
+ * @{
+ */
+
+#define RCC_INT_LSISTBL ((uint8_t)0x01)
+#define RCC_INT_LSESTBL ((uint8_t)0x02)
+#define RCC_INT_HSISTBL ((uint8_t)0x04)
+#define RCC_INT_HSESTBL ((uint8_t)0x08)
+#define RCC_INT_PLLSTBL ((uint8_t)0x10)
+#define RCC_INT_HSECFD ((uint8_t)0x80)
+
+#define IS_RCC_INT_EN(INT) ((((INT) & (uint8_t)0xE0) == 0x00) && ((INT) != 0x00))
+#define IS_RCC_INT_STS(INT) (((INT) == RCC_INT_LSISTBL) || ((INT) == RCC_INT_LSESTBL) || \
+ ((INT) == RCC_INT_HSISTBL) || ((INT) == RCC_INT_HSESTBL) || \
+ ((INT) == RCC_INT_PLLSTBL) || ((INT) == RCC_INT_HSECFD))
+#define IS_RCC_INT_CLR(INT) ((((INT) & (uint8_t)0x60) == 0x00) && ((INT) != 0x00))
+/**
+ * @}
+ */
+
+/** @defgroup USB_Device_clock_source
+ * @{
+ */
+#define RCC_USBCLKSelection_PLL_Div1_5 ((uint32_t)0x00000000)
+#define RCC_USBCLKSelection_PLL_Div1 ((uint32_t)0x00400000)
+#define RCC_USBCLKSelection_PLL_Div2_5 ((uint32_t)0x00800000)
+#define RCC_USBCLKSelection_PLL_Div2 ((uint32_t)0x00C00000)
+#define RCC_USBCLKSelection_PLL_Div3_5 ((uint32_t)0x08000000)
+#define RCC_USBCLKSelection_PLL_Div3 ((uint32_t)0x08400000)
+#define RCC_USBCLKSelection_PLL_Div4 ((uint32_t)0x08800000)
+
+#define IS_RCC_USBCLK_CFG(CFG) (((CFG) == RCC_USBCLKSelection_PLL_Div1_5) || \
+ ((CFG) == RCC_USBCLKSelection_PLL_Div1) || \
+ ((CFG) == RCC_USBCLKSelection_PLL_Div2_5) || \
+ ((CFG) == RCC_USBCLKSelection_PLL_Div2) || \
+ ((CFG) == RCC_USBCLKSelection_PLL_Div3_5) || \
+ ((CFG) == RCC_USBCLKSelection_PLL_Div3) || \
+ ((CFG) == RCC_USBCLKSelection_PLL_Div4))
+/**
+ * @}
+ */
+
+/** @defgroup ADC_clock_source
+ * @{
+ */
+
+#define RCC_APB2CLK_Div2 ((uint32_t)0x00000000)
+#define RCC_APB2CLK_Div4 ((uint32_t)0x00004000)
+#define RCC_APB2CLK_Div6 ((uint32_t)0x00008000)
+#define RCC_APB2CLK_Div8 ((uint32_t)0x0000C000)
+#define RCC_APB2CLK_Div12 ((uint32_t)0x10004000)
+#define RCC_APB2CLK_Div16 ((uint32_t)0x1000C000)
+#define IS_RCC_ADCCLK(CLK) (((CLK) == RCC_APB2CLK_Div2) || ((CLK) == RCC_APB2CLK_Div4) || \
+ ((CLK) == RCC_APB2CLK_Div6) || ((CLK) == RCC_APB2CLK_Div8) || \
+ ((CLK) == RCC_APB2CLK_Div12)|| ((CLK) == RCC_APB2CLK_Div16))
+/**
+ * @}
+ */
+
+/** @defgroup LSE_configuration
+ * @{
+ */
+
+#define RCC_LSE_DISABLE ((uint8_t)0x00)
+#define RCC_LSE_ENABLE ((uint8_t)0x01)
+#define RCC_LSE_BYPASS ((uint8_t)0x04)
+#define IS_RCC_LSE(LSE) (((LSE) == RCC_LSE_DISABLE) || ((LSE) == RCC_LSE_ENABLE) || \
+ ((LSE) == RCC_LSE_BYPASS))
+/**
+ * @}
+ */
+
+
+#if defined (AT32F415xx)
+/** @defgroup ERTC_clock_source
+ * @{
+ */
+#define RCC_ERTCCLKSelection_LSE ((uint32_t)0x00000100)
+#define RCC_ERTCCLKSelection_LSI ((uint32_t)0x00000200)
+#define RCC_ERTCCLKSelection_HSE_Div128 ((uint32_t)0x00000300)
+#define IS_RCC_ERTCCLK_SEL(SEL) (((SEL) == RCC_ERTCCLKSelection_LSE) || \
+ ((SEL) == RCC_ERTCCLKSelection_LSI) || \
+ ((SEL) == RCC_ERTCCLKSelection_HSE_Div128))
+#else
+/** @defgroup RTC_clock_source
+ * @{
+ */
+#define RCC_RTCCLKSelection_LSE ((uint32_t)0x00000100)
+#define RCC_RTCCLKSelection_LSI ((uint32_t)0x00000200)
+#define RCC_RTCCLKSelection_HSE_Div128 ((uint32_t)0x00000300)
+#define IS_RCC_RTCCLK_SEL(SEL) (((SEL) == RCC_RTCCLKSelection_LSE) || \
+ ((SEL) == RCC_RTCCLKSelection_LSI) || \
+ ((SEL) == RCC_RTCCLKSelection_HSE_Div128))
+#endif
+/**
+ * @}
+ */
+
+/** @defgroup AHB_peripheral
+ * @{
+ */
+
+#define RCC_AHBPERIPH_DMA1 ((uint32_t)0x00000001)
+#define RCC_AHBPERIPH_DMA2 ((uint32_t)0x00000002)
+#define RCC_AHBPERIPH_SRAM ((uint32_t)0x00000004)
+#define RCC_AHBPERIPH_FLASH ((uint32_t)0x00000010)
+#define RCC_AHBPERIPH_CRC ((uint32_t)0x00000040)
+#define RCC_AHBPERIPH_SDIO1 ((uint32_t)0x00000400)
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+#define RCC_AHBPERIPH_XMC ((uint32_t)0x00000100)
+#define RCC_AHBPERIPH_SDIO2 ((uint32_t)0x00000800)
+#endif
+
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+#define RCC_AHBPERIPH_ETHMAC ((uint32_t)0x00004000)
+#define RCC_AHBPERIPH_ETHMACTX ((uint32_t)0x00008000)
+#define RCC_AHBPERIPH_ETHMACRX ((uint32_t)0x00010000)
+#define RCC_AHBPERIPH_ETHMACPTP ((uint32_t)0x10000000)
+#endif
+
+#if defined (AT32F415xx)
+#define RCC_AHBPERIPH_USB ((uint32_t)0x00001000)
+#endif
+
+#if defined (AT32F403xx)
+#define IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFF2A8) == 0x00) && ((PERIPH) != 0x00))
+#elif defined (AT32F413xx)
+#define IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFFBA8) == 0x00) && ((PERIPH) != 0x00))
+#elif defined (AT32F415xx)
+#define IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFEBA8) == 0x00) && ((PERIPH) != 0x00))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_RCC_AHB_PERIPH(PERIPH) ((((PERIPH) & 0xEFFE32A8) == 0x00) && ((PERIPH) != 0x00))
+#endif
+
+
+/**
+ * @}
+ */
+
+/** @defgroup APB2_peripheral
+ * @{
+ */
+
+#define RCC_APB2PERIPH_AFIO ((uint32_t)0x00000001)
+#define RCC_APB2PERIPH_GPIOA ((uint32_t)0x00000004)
+#define RCC_APB2PERIPH_GPIOB ((uint32_t)0x00000008)
+#define RCC_APB2PERIPH_GPIOC ((uint32_t)0x00000010)
+#define RCC_APB2PERIPH_GPIOD ((uint32_t)0x00000020)
+#if !defined (AT32F403Axx) || !defined (AT32F407xx)
+#define RCC_APB2PERIPH_GPIOF ((uint32_t)0x00000080)
+#endif
+#define RCC_APB2PERIPH_ADC1 ((uint32_t)0x00000200)
+#define RCC_APB2PERIPH_ADC2 ((uint32_t)0x00000400)
+#define RCC_APB2PERIPH_TMR1 ((uint32_t)0x00000800)
+#define RCC_APB2PERIPH_SPI1 ((uint32_t)0x00001000)
+#define RCC_APB2PERIPH_USART1 ((uint32_t)0x00004000)
+#define RCC_APB2PERIPH_TMR9 ((uint32_t)0x00080000)
+#define RCC_APB2PERIPH_TMR10 ((uint32_t)0x00100000)
+#define RCC_APB2PERIPH_TMR11 ((uint32_t)0x00200000)
+
+#if defined (AT32F403xx)
+#define RCC_APB2PERIPH_GPIOE ((uint32_t)0x00000040)
+#define RCC_APB2PERIPH_GPIOG ((uint32_t)0x00000100)
+#define RCC_APB2PERIPH_ADC3 ((uint32_t)0x00008000)
+#define RCC_APB2PERIPH_TMR15 ((uint32_t)0x00010000)
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define RCC_APB2PERIPH_GPIOE ((uint32_t)0x00000040)
+#define RCC_APB2PERIPH_ADC3 ((uint32_t)0x00008000)
+#define RCC_APB2PERIPH_I2C3 ((uint32_t)0x00800000)
+#define RCC_APB2PERIPH_USART6 ((uint32_t)0x01000000)
+#define RCC_APB2PERIPH_UART7 ((uint32_t)0x02000000)
+#define RCC_APB2PERIPH_UART8 ((uint32_t)0x04000000)
+#endif
+
+#if !defined (AT32F415xx)
+#define RCC_APB2PERIPH_TMR8 ((uint32_t)0x00002000)
+#endif
+
+#if !defined (AT32F403xx)
+#define RCC_APB2PERIPH_ACC ((uint32_t)0x00400000)
+#endif
+
+#if defined (AT32F415xx)
+#define RCC_APB2PERIPH_EFCB ((uint32_t)0x00800000)
+#endif
+
+#if defined (AT32F403xx)
+#define IS_RCC_APB2_PERIPH(PERIPH) ((((PERIPH) & 0xFFC60002) == 0x00) && ((PERIPH) != 0x00))
+#elif defined (AT32F413xx)
+#define IS_RCC_APB2_PERIPH(PERIPH) ((((PERIPH) & 0xFF878142) == 0x00) && ((PERIPH) != 0x00))
+#elif defined (AT32F415xx)
+#define IS_RCC_APB2_PERIPH(PERIPH) ((((PERIPH) & 0xFF078142) == 0x00) && ((PERIPH) != 0x00))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_RCC_APB2_PERIPH(PERIPH) ((((PERIPH) & 0xF8070182) == 0x00) && ((PERIPH) != 0x00))
+#endif
+
+/**
+ * @}
+ */
+
+/** @defgroup APB1_peripheral
+ * @{
+ */
+
+#define RCC_APB1PERIPH_TMR2 ((uint32_t)0x00000001)
+#define RCC_APB1PERIPH_TMR3 ((uint32_t)0x00000002)
+#define RCC_APB1PERIPH_TMR4 ((uint32_t)0x00000004)
+#define RCC_APB1PERIPH_TMR5 ((uint32_t)0x00000008)
+#define RCC_APB1PERIPH_WWDG ((uint32_t)0x00000800)
+#define RCC_APB1PERIPH_SPI2 ((uint32_t)0x00004000)
+#define RCC_APB1PERIPH_USART2 ((uint32_t)0x00020000)
+#define RCC_APB1PERIPH_USART3 ((uint32_t)0x00040000)
+#define RCC_APB1PERIPH_UART4 ((uint32_t)0x00080000)
+#define RCC_APB1PERIPH_UART5 ((uint32_t)0x00100000)
+#define RCC_APB1PERIPH_I2C1 ((uint32_t)0x00200000)
+#define RCC_APB1PERIPH_I2C2 ((uint32_t)0x00400000)
+#define RCC_APB1PERIPH_CAN1 ((uint32_t)0x02000000)
+#define RCC_APB1PERIPH_PWR ((uint32_t)0x10000000)
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+#define RCC_APB1PERIPH_TMR6 ((uint32_t)0x00000010)
+#define RCC_APB1PERIPH_TMR7 ((uint32_t)0x00000020)
+#define RCC_APB1PERIPH_TMR12 ((uint32_t)0x00000040)
+#define RCC_APB1PERIPH_TMR13 ((uint32_t)0x00000080)
+#define RCC_APB1PERIPH_TMR14 ((uint32_t)0x00000100)
+#define RCC_APB1PERIPH_SPI3 ((uint32_t)0x00008000)
+#define RCC_APB1PERIPH_SPI4 ((uint32_t)0x00010000)
+#define RCC_APB1PERIPH_I2C3 ((uint32_t)0x04000000)
+#define RCC_APB1PERIPH_DAC ((uint32_t)0x20000000)
+#endif
+
+#if defined (AT32F413xx)
+#define RCC_APB1PERIPH_CAN2 ((uint32_t)0x80000000)
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define RCC_APB1PERIPH_CAN2 ((uint32_t)0x04000000)
+#endif
+
+#if !defined (AT32F415xx)
+#define RCC_APB1PERIPH_USB ((uint32_t)0x00800000)
+#define RCC_APB1PERIPH_BKP ((uint32_t)0x08000000)
+#else
+#define RCC_APB1PERIPH_COMP ((uint32_t)0x00000200)
+#endif
+
+#if defined (AT32F403xx)
+#define IS_RCC_APB1_PERIPH(PERIPH) ((((PERIPH) & 0xC1003600) == 0x00) && ((PERIPH) != 0x00))
+#elif defined (AT32F413xx)
+#define IS_RCC_APB1_PERIPH(PERIPH) ((((PERIPH) & 0x6501B7F0) == 0x00) && ((PERIPH) != 0x00))
+#elif defined (AT32F415xx)
+#define IS_RCC_APB1_PERIPH(PERIPH) ((((PERIPH) & 0xED81B3F0) == 0x00) && ((PERIPH) != 0x00))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_RCC_APB1_PERIPH(PERIPH) ((((PERIPH) & 0xC1003600) == 0x00) && ((PERIPH) != 0x00))
+#endif
+/**
+ * @}
+ */
+
+/** @defgroup Clock_source_to_output_on_CLKOUT_pin
+ * @{
+ */
+#define RCC_CLKOUT_NOCLK ((uint32_t)0x00000000)
+#define RCC_CLKOUT_SYSCLK ((uint32_t)0x04000000)
+#define RCC_CLKOUT_HSI ((uint32_t)0x05000000)
+#define RCC_CLKOUT_HSE ((uint32_t)0x06000000)
+#define RCC_CLKOUT_PLL_Div2 ((uint32_t)0x07000000)
+#define RCC_CLKOUT_PLL_Div4 ((uint32_t)0x14000000)
+#define RCC_CLKOUT_USB ((uint32_t)0x15000000)
+#define RCC_CLKOUT_ADC ((uint32_t)0x16000000)
+#if !defined (AT32F403xx)
+#define RCC_CLKOUT_LSI ((uint32_t)0x02000000)
+#define RCC_CLKOUT_LSE ((uint32_t)0x03000000)
+#endif
+#if !defined (AT32F403xx)
+#define IS_RCC_CLKOUT(CLK) (((CLK) == RCC_CLKOUT_NOCLK) || ((CLK) == RCC_CLKOUT_HSI) || \
+ ((CLK) == RCC_CLKOUT_SYSCLK) || ((CLK) == RCC_CLKOUT_HSE) || \
+ ((CLK) == RCC_CLKOUT_PLL_Div2) || ((CLK) == RCC_CLKOUT_PLL_Div4) || \
+ ((CLK) == RCC_CLKOUT_USB) || ((CLK) == RCC_CLKOUT_ADC) || \
+ ((CLK) == RCC_CLKOUT_LSI) || ((CLK) == RCC_CLKOUT_LSE))
+#else
+#define IS_RCC_CLKOUT(CLK) (((CLK) == RCC_CLKOUT_NOCLK) || ((CLK) == RCC_CLKOUT_HSI) || \
+ ((CLK) == RCC_CLKOUT_SYSCLK) || ((CLK) == RCC_CLKOUT_HSE) || \
+ ((CLK) == RCC_CLKOUT_PLL_Div2) || ((CLK) == RCC_CLKOUT_PLL_Div4) || \
+ ((CLK) == RCC_CLKOUT_USB) || ((CLK) == RCC_CLKOUT_ADC))
+#endif
+
+/**
+ * @}
+ */
+
+/** @defgroup HSE_Divider
+ * @{
+ */
+#define RCC_HSE_DIV_MASK RCC_MISC2_HSE_DIV_CTRL
+#define RCC_HSE_DIV_2 RCC_MISC2_HSE_DIV_CTRL_2
+#define RCC_HSE_DIV_3 RCC_MISC2_HSE_DIV_CTRL_3
+#define RCC_HSE_DIV_4 RCC_MISC2_HSE_DIV_CTRL_4
+#define RCC_HSE_DIV_5 RCC_MISC2_HSE_DIV_CTRL_5
+
+#define IS_RCC_HSEDIV(CLK) (((CLK) == RCC_HSE_DIV_2) || ((CLK) == RCC_HSE_DIV_3) || \
+ ((CLK) == RCC_HSE_DIV_4) || ((CLK) == RCC_HSE_DIV_5))
+/**
+ * @}
+ */
+
+/** @defgroup Clock_source_to_output_MCOPRE
+ * @{
+ */
+#define RCC_MCOPRE_MASK RCC_MISC_MCOPRE_MASK
+#define RCC_MCOPRE_1 RCC_MISC_MCOPRE_1
+#define RCC_MCOPRE_2 RCC_MISC_MCOPRE_2
+#define RCC_MCOPRE_4 RCC_MISC_MCOPRE_4
+#define RCC_MCOPRE_8 RCC_MISC_MCOPRE_8
+#define RCC_MCOPRE_16 RCC_MISC_MCOPRE_16
+#define RCC_MCOPRE_64 RCC_MISC_MCOPRE_64
+#define RCC_MCOPRE_128 RCC_MISC_MCOPRE_128
+#define RCC_MCOPRE_256 RCC_MISC_MCOPRE_256
+#define RCC_MCOPRE_512 RCC_MISC_MCOPRE_512
+
+#if !defined (AT32F403xx)
+#define IS_RCC_MCO(MCOPRE) (((MCOPRE) == RCC_MCOPRE_1) || ((MCOPRE) == RCC_MCOPRE_2) || \
+ ((MCOPRE) == RCC_MCOPRE_4) || ((MCOPRE) == RCC_MCOPRE_8) || \
+ ((MCOPRE) == RCC_MCOPRE_16) || ((MCOPRE) == RCC_MCOPRE_64) || \
+ ((MCOPRE) == RCC_MCOPRE_128) || ((MCOPRE) == RCC_MCOPRE_256) || \
+ ((MCOPRE) == RCC_MCOPRE_512))
+#endif
+/**
+ * @}
+ */
+
+/** @defgroup RCC_Flag
+ * @{
+ */
+
+#define RCC_FLAG_HSISTBL ((uint8_t)0x21)
+#define RCC_FLAG_HSESTBL ((uint8_t)0x31)
+#define RCC_FLAG_PLLSTBL ((uint8_t)0x39)
+#define RCC_FLAG_LSESTBL ((uint8_t)0x41)
+#define RCC_FLAG_LSISTBL ((uint8_t)0x61)
+#define RCC_FLAG_PINRST ((uint8_t)0x7A)
+#define RCC_FLAG_PORST ((uint8_t)0x7B)
+#define RCC_FLAG_SWRST ((uint8_t)0x7C)
+#define RCC_FLAG_IWDGRST ((uint8_t)0x7D)
+#define RCC_FLAG_WWDGRST ((uint8_t)0x7E)
+#define RCC_FLAG_LPRST ((uint8_t)0x7F)
+
+#define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSISTBL) || ((FLAG) == RCC_FLAG_HSESTBL) || \
+ ((FLAG) == RCC_FLAG_PLLSTBL) || ((FLAG) == RCC_FLAG_LSESTBL) || \
+ ((FLAG) == RCC_FLAG_LSISTBL) || ((FLAG) == RCC_FLAG_PINRST) || \
+ ((FLAG) == RCC_FLAG_PORST) || ((FLAG) == RCC_FLAG_SWRST) || \
+ ((FLAG) == RCC_FLAG_IWDGRST) || ((FLAG) == RCC_FLAG_WWDGRST) || \
+ ((FLAG) == RCC_FLAG_LPRST))
+#if defined (AT32F403xx)
+#define IS_RCC_TWEAK_VALUE(VALUE) ((VALUE) <= 0x1F)
+#else
+#define IS_RCC_TWEAK_VALUE(VALUE) ((VALUE) <= 0x3F)
+#endif
+#define IS_RCC_CALIB_VALUE(VALUE) ((VALUE) <= 0xFF)
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#if defined (AT32F415xx)
+/** @defgroup RCC_PLL_Register_For_F415
+ * @{
+ */
+#define PLL_FR_POS 0
+#define PLL_FR_MASK ((uint32_t)0x00000007)
+#define PLL_FR_1 ((uint32_t)0x00000000)
+#define PLL_FR_2 ((uint32_t)0x00000001)
+#define PLL_FR_4 ((uint32_t)0x00000002)
+#define PLL_FR_8 ((uint32_t)0x00000003)
+#define PLL_FR_16 ((uint32_t)0x00000004)
+#define PLL_FR_32 ((uint32_t)0x00000005)
+
+#define PLL_MS_POS 4
+#define PLL_MS_MASK ((uint32_t)0x000000F0)
+
+#define PLL_NS_POS 8
+#define PLL_NS_MASK ((uint32_t)0x0000FF00)
+
+#define PLL_FREF_POS 24
+#define PLL_FREF_MASK ((uint32_t)0x07000000)
+#define PLL_FREF_4M ((uint32_t)0x00000000)
+#define PLL_FREF_6M ((uint32_t)0x01000000)
+#define PLL_FREF_8M ((uint32_t)0x02000000)
+#define PLL_FREF_12M ((uint32_t)0x03000000)
+#define PLL_FREF_16M ((uint32_t)0x04000000)
+#define PLL_FREF_25M ((uint32_t)0x05000000)
+
+#define PLL_CFGGEN_POS 31
+#define PLL_CFGEN_ENABLE ((uint32_t)0x80000000)
+#define PLL_CFGEN_MASK ((uint32_t)0x80000000)
+
+#define IS_RCC_FR(PLL_FR) (((PLL_FR) == PLL_FR_1) || ((PLL_FR) == PLL_FR_2) || \
+ ((PLL_FR) == PLL_FR_4) || ((PLL_FR) == PLL_FR_8) || \
+ ((PLL_FR) == PLL_FR_16) || ((PLL_FR) == PLL_FR_32))
+
+#define IS_RCC_FREF(PLL_FREF) (((PLL_FREF) == PLL_FREF_4M) || ((PLL_FREF) == PLL_FREF_6M) || \
+ ((PLL_FREF) == PLL_FREF_8M) || ((PLL_FREF) == PLL_FREF_12M) || \
+ ((PLL_FREF) == PLL_FREF_16M) || ((PLL_FREF) == PLL_FREF_25M))
+
+#define IS_RCC_MS_VALUE(VALUE) (((VALUE) >= 0x1) && ((VALUE) <= 0xF))
+#define IS_RCC_NS_VALUE(VALUE) (((VALUE) >= 0x1F) && ((VALUE) <= 0x1F4))
+#define IS_RCC_RESULT_VALUE(VALUE) (((VALUE) >= 0x1F4) && ((VALUE) <= 0x3E8))
+
+#define RCC_FREF_VALUE(VALUE, RET) do \
+ { \
+ switch (VALUE) \
+ { \
+ case PLL_FREF_4M: \
+ RET = 4; \
+ break; \
+ case PLL_FREF_6M: \
+ RET = 6; \
+ break; \
+ case PLL_FREF_8M: \
+ RET = 8; \
+ break; \
+ case PLL_FREF_12M: \
+ RET = 12; \
+ break; \
+ case PLL_FREF_16M: \
+ RET = 16; \
+ break; \
+ case PLL_FREF_25M: \
+ RET = 25; \
+ break; \
+ default: \
+ RET = 0; \
+ break; \
+ } \
+ }while(0)
+
+#define RCC_FR_VALUE(VALUE, RET) do \
+ { \
+ switch (VALUE) \
+ { \
+ case PLL_FR_1: \
+ RET = 1; \
+ break; \
+ case PLL_FR_2: \
+ RET = 2; \
+ break; \
+ case PLL_FR_4: \
+ RET = 4; \
+ break; \
+ case PLL_FR_8: \
+ RET = 8; \
+ break; \
+ case PLL_FR_16: \
+ RET = 16; \
+ break; \
+ case PLL_FR_32: \
+ RET = 32; \
+ break; \
+ default: \
+ RET = 1; \
+ break; \
+ } \
+ }while(0)
+/**
+ * @}
+ */
+#endif
+
+/**
+ * @}
+ */
+
+/** @defgroup RCC_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup RCC_Exported_Functions
+ * @{
+ */
+
+void RCC_Reset(void);
+void RCC_HSEConfig(uint32_t RCC_HSE);
+ErrorStatus RCC_WaitForHSEStable(void);
+void RCC_SetHSITweakValue(uint8_t HSITweakValue);
+void RCC_SetHSICalibValue(uint8_t HSICalibValue);
+void RCC_HSICmd(FunctionalState NewState);
+void RCC_PLLConfig(uint32_t RCC_PLLRefClk, uint32_t RCC_PLLMult, uint32_t RCC_PLLRange);
+void RCC_PLLCmd(FunctionalState NewState);
+void RCC_SYSCLKConfig(uint32_t RCC_SYSCLKSelect);
+uint8_t RCC_GetSYSCLKSelction(void);
+void RCC_AHBCLKConfig(uint32_t RCC_SYSCLK_Div);
+void RCC_APB1CLKConfig(uint32_t RCC_HCLK_Div);
+void RCC_APB2CLKConfig(uint32_t RCC_HCLK_Div);
+void RCC_INTConfig(uint8_t RCC_INT, FunctionalState NewState);
+void RCC_ADCCLKConfig(uint32_t RCC_PCLK2_Div);
+void RCC_LSEConfig(uint8_t RCC_LSE);
+void RCC_LSICmd(FunctionalState NewState);
+#if defined (AT32F415xx)
+void RCC_ERTCCLKConfig(uint32_t RCC_ERTCCLKSelect);
+void RCC_ERTCCLKCmd(FunctionalState NewState);
+#else
+void RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSelect);
+void RCC_RTCCLKCmd(FunctionalState NewState);
+#endif
+void RCC_GetClocksFreq(RCC_ClockType* RCC_Clocks);
+void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
+void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
+void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+void RCC_AHBPeriphResetCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState);
+#endif
+void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState);
+void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState);
+void RCC_BackupResetCmd(FunctionalState NewState);
+void RCC_HSEClockFailureDetectorCmd(FunctionalState NewState);
+#if defined (AT32F403xx)
+void RCC_CLKOUTConfig(uint32_t RCC_CLKOUT);
+#else
+void RCC_CLKOUTConfig(uint32_t RCC_CLKOUT, uint32_t RCC_CLKOUTPRE);
+#endif
+FlagStatus RCC_GetFlagStatus(uint8_t RCC_Flag);
+void RCC_ClearFlag(void);
+ITStatus RCC_GetINTStatus(uint8_t RCC_INT);
+void RCC_ClearINTPendingBit(uint8_t RCC_INT);
+void RCC_USBCLKConfig(uint32_t RCC_USBCLKSelect);
+void RCC_StepModeCmd(FunctionalState NewState);
+void RCC_USBINTRemap(FunctionalState NewState);
+void RCC_HSI2USB48M(FunctionalState NewState);
+void RCC_MCO2TMR10(FunctionalState NewState);
+#if defined (AT32F415xx)
+void RCC_PLLconfig2(uint32_t PLL_FREF, uint32_t PLL_NS, uint32_t PLL_MS, \
+ uint32_t PLL_FR);
+#endif
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+void RCC_HSEDivConfig(uint32_t HSEDiv);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_RCC_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_rtc.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_rtc.h
new file mode 100644
index 0000000000000000000000000000000000000000..a8262a1cf5193e67cd3a6dd046c0decc43ed2ea2
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_rtc.h
@@ -0,0 +1,123 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_rtc.h
+ * Description : at32f4xx RTC header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_RTC_H
+#define __AT32F4xx_RTC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup RTC
+ * @{
+ */
+
+/** @defgroup RTC_Exported_Types
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Exported_Constants
+ * @{
+ */
+
+/** @defgroup RTC_interrupts_define
+ * @{
+ */
+
+#define RTC_INT_OV ((uint16_t)0x0004) /*!< Overflow interrupt */
+#define RTC_INT_ALA ((uint16_t)0x0002) /*!< Alarm interrupt */
+#define RTC_INT_PACE ((uint16_t)0x0001) /*!< Second interrupt */
+#define IS_RTC_INT(INT) ((((INT) & (uint16_t)0xFFF8) == 0x00) && ((INT) != 0x00))
+#define IS_RTC_GET_INT(INT) (((INT) == RTC_INT_OV) || ((INT) == RTC_INT_ALA) || \
+ ((INT) == RTC_INT_PACE))
+/**
+ * @}
+ */
+
+/** @defgroup RTC_interrupts_flags
+ * @{
+ */
+
+#define RTC_FLAG_RTF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */
+#define RTC_FLAG_RSYNF ((uint16_t)0x0008) /*!< Registers Synchronized flag */
+#define RTC_FLAG_OV ((uint16_t)0x0004) /*!< Overflow flag */
+#define RTC_FLAG_ALA ((uint16_t)0x0002) /*!< Alarm flag */
+#define RTC_FLAG_PACE ((uint16_t)0x0001) /*!< Second flag */
+#define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00))
+#define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTF) || ((FLAG) == RTC_FLAG_RSYNF) || \
+ ((FLAG) == RTC_FLAG_OV) || ((FLAG) == RTC_FLAG_ALA) || \
+ ((FLAG) == RTC_FLAG_PACE))
+#define IS_RTC_DIV(DIV) ((DIV) <= 0xFFFFF)
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Exported_Functions
+ * @{
+ */
+
+void RTC_INTConfig(uint16_t RTC_INT, FunctionalState NewState);
+void RTC_EnterConfigMode(void);
+void RTC_ExitConfigMode(void);
+uint32_t RTC_GetCounter(void);
+void RTC_SetCounter(uint32_t CounterValue);
+void RTC_SetDIV(uint32_t PrescalerValue);
+void RTC_SetAlarmValue(uint32_t AlarmValue);
+uint32_t RTC_GetDivider(void);
+void RTC_WaitForLastTask(void);
+void RTC_WaitForSynchro(void);
+FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG);
+void RTC_ClearFlag(uint16_t RTC_FLAG);
+ITStatus RTC_GetINTStatus(uint16_t RTC_INT);
+void RTC_ClearINTPendingBit(uint16_t RTC_INT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_RTC_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_sdio.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_sdio.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef3b4e95b62141246d9e2953dd505cb955f66bf4
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_sdio.h
@@ -0,0 +1,526 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_sdio.h
+ * Description : at32f4xx SDIO header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_SDIO_H
+#define __AT32F4xx_SDIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup SDIO
+ * @{
+ */
+
+/** @defgroup SDIO_Exported_Types
+ * @{
+ */
+
+typedef struct
+{
+ uint32_t SDIO_ClkEdge; /*!< Specifies the clock transition on which the bit capture is made.
+ This parameter can be a value of @ref SDIO_Clock_Edge */
+
+ uint32_t SDIO_ClkBypass; /*!< Specifies whether the SDIO Clock divider bypass is
+ enabled or disabled.
+ This parameter can be a value of @ref SDIO_Clock_Bypass */
+
+ uint32_t SDIO_ClkPowerSave; /*!< Specifies whether SDIO Clock output is enabled or
+ disabled when the bus is idle.
+ This parameter can be a value of @ref SDIO_Clock_Power_Save */
+
+ uint32_t SDIO_BusWidth; /*!< Specifies the SDIO bus width.
+ This parameter can be a value of @ref SDIO_Bus_Wide */
+
+ uint32_t SDIO_FlowCtrl; /*!< Specifies whether the SDIO hardware flow control is enabled or disabled.
+ This parameter can be a value of @ref SDIO_Hardware_Flow_Control */
+
+ uint16_t SDIO_ClkPsc; /*!< Specifies the clock frequency of the SDIO controller.
+ This parameter can be a value between 0x00 and 0x3FF. */
+
+} SDIO_InitType;
+
+typedef struct
+{
+ uint32_t SDIO_Argu; /*!< Specifies the SDIO command argument which is sent
+ to a card as part of a command message. If a command
+ contains an argument, it must be loaded into this register
+ before writing the command to the command register */
+
+ uint32_t SDIO_CmdIdx; /*!< Specifies the SDIO command index. It must be lower than 0x40. */
+
+ uint32_t SDIO_Resp; /*!< Specifies the SDIO response type.
+ This parameter can be a value of @ref SDIO_Response_Type */
+
+ uint32_t SDIO_Wait; /*!< Specifies whether SDIO wait-for-interrupt request is enabled or disabled.
+ This parameter can be a value of @ref SDIO_Wait_Interrupt_State */
+
+ uint32_t SDIO_CPSM; /*!< Specifies whether SDIO Command path state machine (CPSM)
+ is enabled or disabled.
+ This parameter can be a value of @ref SDIO_CPSM_State */
+} SDIO_CmdInitType;
+
+typedef struct
+{
+ uint32_t SDIO_DataTimeOut; /*!< Specifies the data timeout period in card bus clock periods. */
+
+ uint32_t SDIO_DataLen; /*!< Specifies the number of data bytes to be transferred. */
+
+ uint32_t SDIO_DataBlkSize; /*!< Specifies the data block size for block transfer.
+ This parameter can be a value of @ref SDIO_Data_Block_Size */
+
+ uint32_t SDIO_TransferDir; /*!< Specifies the data transfer direction, whether the transfer
+ is a read or write.
+ This parameter can be a value of @ref SDIO_Transfer_Direction */
+
+ uint32_t SDIO_TransferMode; /*!< Specifies whether data transfer is in stream or block mode.
+ This parameter can be a value of @ref SDIO_Transfer_Type */
+
+ uint32_t SDIO_DPSM; /*!< Specifies whether SDIO Data path state machine (DPSM)
+ is enabled or disabled.
+ This parameter can be a value of @ref SDIO_DPSM_State */
+} SDIO_DataInitType;
+
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Exported_Constants
+ * @{
+ */
+
+#if defined (AT32F413xx) || defined (AT32F415xx)
+#define IS_SDIO_ALL_PERIPH(PERIPH) ((PERIPH) == SDIO)
+#elif defined (AT32F403xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+#define IS_SDIO_ALL_PERIPH(PERIPH) (((PERIPH) == SDIO1) || \
+ ((PERIPH) == SDIO2))
+#endif
+/** @defgroup SDIO_Clock_Edge
+ * @{
+ */
+
+#define SDIO_ClkEdge_Rising ((uint32_t)0x00000000)
+#define SDIO_ClkEdge_Falling ((uint32_t)0x00002000)
+#define IS_SDIO_CLK_EDGE(EDGE) (((EDGE) == SDIO_ClkEdge_Rising) || \
+ ((EDGE) == SDIO_ClkEdge_Falling))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Clock_Bypass
+ * @{
+ */
+
+#define SDIO_ClkBypass_Disable ((uint32_t)0x00000000)
+#define SDIO_ClkBypass_Enable ((uint32_t)0x00000400)
+#define IS_SDIO_CLK_BYPASS(BYPASS) (((BYPASS) == SDIO_ClkBypass_Disable) || \
+ ((BYPASS) == SDIO_ClkBypass_Enable))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Clock_Power_Save
+ * @{
+ */
+
+#define SDIO_ClkPowerSave_Disable ((uint32_t)0x00000000)
+#define SDIO_ClkPowerSave_Enable ((uint32_t)0x00000200)
+#define IS_SDIO_CLK_POWER_SAVE(SAVE) (((SAVE) == SDIO_ClkPowerSave_Disable) || \
+ ((SAVE) == SDIO_ClkPowerSave_Enable))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Bus_Wide
+ * @{
+ */
+
+#define SDIO_BusWidth_1b ((uint32_t)0x00000000)
+#define SDIO_BusWidth_4b ((uint32_t)0x00000800)
+#define SDIO_BusWidth_8b ((uint32_t)0x00001000)
+#define IS_SDIO_BUS_WIDTH(WIDTH) (((WIDTH) == SDIO_BusWidth_1b) || ((WIDTH) == SDIO_BusWidth_4b) || \
+ ((WIDTH) == SDIO_BusWidth_8b))
+
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Hardware_Flow_Control
+ * @{
+ */
+
+#define SDIO_FlowCtrl_Disable ((uint32_t)0x00000000)
+#define SDIO_FlowCtrl_Enable ((uint32_t)0x00004000)
+#define IS_SDIO_FLOW_CTRL(CTRL) (((CTRL) == SDIO_FlowCtrl_Disable) || \
+ ((CTRL) == SDIO_FlowCtrl_Enable))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Power_State
+ * @{
+ */
+
+#define SDIO_PowerSave_OFF ((uint32_t)0x00000000)
+#define SDIO_PowerSave_ON ((uint32_t)0x00000003)
+#define IS_SDIO_POWER_SAVE(SAVE) (((SAVE) == SDIO_PowerSave_OFF) || ((SAVE) == SDIO_PowerSave_ON))
+/**
+ * @}
+ */
+
+
+/** @defgroup SDIO_Interrupt_sources
+ * @{
+ */
+
+#define SDIO_INT_CMDFAIL ((uint32_t)0x00000001)
+#define SDIO_INT_DTFAIL ((uint32_t)0x00000002)
+#define SDIO_INT_CMDTIMEOUT ((uint32_t)0x00000004)
+#define SDIO_INT_DTTIMEOUT ((uint32_t)0x00000008)
+#define SDIO_INT_TXERRU ((uint32_t)0x00000010)
+#define SDIO_INT_RXERRO ((uint32_t)0x00000020)
+#define SDIO_INT_CMDRSPCMPL ((uint32_t)0x00000040)
+#define SDIO_INT_CMDCMPL ((uint32_t)0x00000080)
+#define SDIO_INT_DTCMPL ((uint32_t)0x00000100)
+#define SDIO_INT_SBITERR ((uint32_t)0x00000200)
+#define SDIO_INT_DTBLKCMPL ((uint32_t)0x00000400)
+#define SDIO_INT_DOCMD ((uint32_t)0x00000800)
+#define SDIO_INT_DOTX ((uint32_t)0x00001000)
+#define SDIO_INT_DORX ((uint32_t)0x00002000)
+#define SDIO_INT_TXBUF_H ((uint32_t)0x00004000)
+#define SDIO_INT_RXBUF_H ((uint32_t)0x00008000)
+#define SDIO_INT_TXBUF_F ((uint32_t)0x00010000)
+#define SDIO_INT_RXBUF_F ((uint32_t)0x00020000)
+#define SDIO_INT_TXBUF_E ((uint32_t)0x00040000)
+#define SDIO_INT_RXBUF_E ((uint32_t)0x00080000)
+#define SDIO_INT_TXBUF ((uint32_t)0x00100000)
+#define SDIO_INT_RXBUF ((uint32_t)0x00200000)
+#define SDIO_INT_SDIOIF ((uint32_t)0x00400000)
+#define SDIO_INT_ATACMPL ((uint32_t)0x00800000)
+#define IS_SDIO_INT(INT) ((((INT) & (uint32_t)0xFF000000) == 0x00) && ((INT) != (uint32_t)0x00))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Command_Index
+ * @{
+ */
+
+#define IS_SDIO_CMD_IDX(IDX) ((IDX) < 0x40)
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Response_Type
+ * @{
+ */
+
+#define SDIO_Rsp_No ((uint32_t)0x00000000)
+#define SDIO_Rsp_Short ((uint32_t)0x00000040)
+#define SDIO_Rsp_Long ((uint32_t)0x000000C0)
+#define IS_SDIO_RSP_TYPE(TYPE) (((TYPE) == SDIO_Rsp_No) || \
+ ((TYPE) == SDIO_Rsp_Short) || \
+ ((TYPE) == SDIO_Rsp_Long))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Wait_Interrupt_State
+ * @{
+ */
+
+#define SDIO_Wait_No ((uint32_t)0x00000000) /*!< SDIO No Wait, TimeOut is enabled */
+#define SDIO_Wait_INT ((uint32_t)0x00000100) /*!< SDIO Wait Interrupt Request */
+#define SDIO_Wait_Pend ((uint32_t)0x00000200) /*!< SDIO Wait End of transfer */
+#define IS_SDIO_WAIT(WAIT) (((WAIT) == SDIO_Wait_No) || ((WAIT) == SDIO_Wait_INT) || \
+ ((WAIT) == SDIO_Wait_Pend))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_CPSM_State
+ * @{
+ */
+
+#define SDIO_CPSM_Disable ((uint32_t)0x00000000)
+#define SDIO_CPSM_Enable ((uint32_t)0x00000400)
+#define IS_SDIO_CPSM(CPSM) (((CPSM) == SDIO_CPSM_Enable) || ((CPSM) == SDIO_CPSM_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Response_Registers
+ * @{
+ */
+
+#define SDIO_RSP1 ((uint32_t)0x00000000)
+#define SDIO_RSP2 ((uint32_t)0x00000004)
+#define SDIO_RSP3 ((uint32_t)0x00000008)
+#define SDIO_RSP4 ((uint32_t)0x0000000C)
+#define IS_SDIO_RSP(RSP) (((RSP) == SDIO_RSP1) || ((RSP) == SDIO_RSP2) || \
+ ((RSP) == SDIO_RSP3) || ((RSP) == SDIO_RSP4))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Data_Length
+ * @{
+ */
+
+#define IS_SDIO_DATA_LEN(LEN) ((LEN) <= 0x01FFFFFF)
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Data_Block_Size
+ * @{
+ */
+
+#define SDIO_DataBlkSize_1b ((uint32_t)0x00000000)
+#define SDIO_DataBlkSize_2b ((uint32_t)0x00000010)
+#define SDIO_DataBlkSize_4b ((uint32_t)0x00000020)
+#define SDIO_DataBlkSize_8b ((uint32_t)0x00000030)
+#define SDIO_DataBlkSize_16b ((uint32_t)0x00000040)
+#define SDIO_DataBlkSize_32b ((uint32_t)0x00000050)
+#define SDIO_DataBlkSize_64b ((uint32_t)0x00000060)
+#define SDIO_DataBlkSize_128b ((uint32_t)0x00000070)
+#define SDIO_DataBlkSize_256b ((uint32_t)0x00000080)
+#define SDIO_DataBlkSize_512b ((uint32_t)0x00000090)
+#define SDIO_DataBlkSize_1024b ((uint32_t)0x000000A0)
+#define SDIO_DataBlkSize_2048b ((uint32_t)0x000000B0)
+#define SDIO_DataBlkSize_4096b ((uint32_t)0x000000C0)
+#define SDIO_DataBlkSize_8192b ((uint32_t)0x000000D0)
+#define SDIO_DataBlkSize_16384b ((uint32_t)0x000000E0)
+#define IS_SDIO_BLK_SIZE(SIZE) (((SIZE) == SDIO_DataBlkSize_1b) || \
+ ((SIZE) == SDIO_DataBlkSize_2b) || \
+ ((SIZE) == SDIO_DataBlkSize_4b) || \
+ ((SIZE) == SDIO_DataBlkSize_8b) || \
+ ((SIZE) == SDIO_DataBlkSize_16b) || \
+ ((SIZE) == SDIO_DataBlkSize_32b) || \
+ ((SIZE) == SDIO_DataBlkSize_64b) || \
+ ((SIZE) == SDIO_DataBlkSize_128b) || \
+ ((SIZE) == SDIO_DataBlkSize_256b) || \
+ ((SIZE) == SDIO_DataBlkSize_512b) || \
+ ((SIZE) == SDIO_DataBlkSize_1024b) || \
+ ((SIZE) == SDIO_DataBlkSize_2048b) || \
+ ((SIZE) == SDIO_DataBlkSize_4096b) || \
+ ((SIZE) == SDIO_DataBlkSize_8192b) || \
+ ((SIZE) == SDIO_DataBlkSize_16384b))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Transfer_Direction
+ * @{
+ */
+
+#define SDIO_TransferDir_ToCard ((uint32_t)0x00000000)
+#define SDIO_TransferDir_ToSDIO ((uint32_t)0x00000002)
+#define IS_SDIO_TRANSFER_DIR(DIR) (((DIR) == SDIO_TransferDir_ToCard) || \
+ ((DIR) == SDIO_TransferDir_ToSDIO))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Transfer_Type
+ * @{
+ */
+
+#define SDIO_TransferMode_Block ((uint32_t)0x00000000)
+#define SDIO_TransferMode_Stream ((uint32_t)0x00000004)
+#define IS_SDIO_TRANSFER_MODE(MODE) (((MODE) == SDIO_TransferMode_Stream) || \
+ ((MODE) == SDIO_TransferMode_Block))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_DPSM_State
+ * @{
+ */
+
+#define SDIO_DPSM_Disable ((uint32_t)0x00000000)
+#define SDIO_DPSM_Enable ((uint32_t)0x00000001)
+#define IS_SDIO_DPSM(DPSM) (((DPSM) == SDIO_DPSM_Enable) || ((DPSM) == SDIO_DPSM_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Flags
+ * @{
+ */
+
+#define SDIO_FLG_CMDFAIL ((uint32_t)0x00000001)
+#define SDIO_FLG_DTFAIL ((uint32_t)0x00000002)
+#define SDIO_FLG_CMDTIMEOUT ((uint32_t)0x00000004)
+#define SDIO_FLG_DTTIMEOUT ((uint32_t)0x00000008)
+#define SDIO_FLG_TXERRU ((uint32_t)0x00000010)
+#define SDIO_FLG_RXERRO ((uint32_t)0x00000020)
+#define SDIO_FLG_CMDRSPCMPL ((uint32_t)0x00000040)
+#define SDIO_FLG_CMDCMPL ((uint32_t)0x00000080)
+#define SDIO_FLG_DTCMPL ((uint32_t)0x00000100)
+#define SDIO_FLG_SBITERR ((uint32_t)0x00000200)
+#define SDIO_FLG_DTBLKCMPL ((uint32_t)0x00000400)
+#define SDIO_FLG_DOCMD ((uint32_t)0x00000800)
+#define SDIO_FLG_DOTX ((uint32_t)0x00001000)
+#define SDIO_FLG_DORX ((uint32_t)0x00002000)
+#define SDIO_FLG_TXBUF_H ((uint32_t)0x00004000)
+#define SDIO_FLG_RXBUF_H ((uint32_t)0x00008000)
+#define SDIO_FLG_TXBUF_F ((uint32_t)0x00010000)
+#define SDIO_FLG_RXBUF_F ((uint32_t)0x00020000)
+#define SDIO_FLG_TXBUF_E ((uint32_t)0x00040000)
+#define SDIO_FLG_RXBUF_E ((uint32_t)0x00080000)
+#define SDIO_FLG_TXBUF ((uint32_t)0x00100000)
+#define SDIO_FLG_RXBUF ((uint32_t)0x00200000)
+#define SDIO_FLG_SDIOIF ((uint32_t)0x00400000)
+#define SDIO_FLG_ATACMPL ((uint32_t)0x00800000)
+#define IS_SDIO_FLG(FLG) (((FLG) == SDIO_FLG_CMDFAIL) || \
+ ((FLG) == SDIO_FLG_DTFAIL) || \
+ ((FLG) == SDIO_FLG_CMDTIMEOUT) || \
+ ((FLG) == SDIO_FLG_DTTIMEOUT) || \
+ ((FLG) == SDIO_FLG_TXERRU) || \
+ ((FLG) == SDIO_FLG_RXERRO) || \
+ ((FLG) == SDIO_FLG_CMDRSPCMPL) || \
+ ((FLG) == SDIO_FLG_CMDCMPL) || \
+ ((FLG) == SDIO_FLG_DTCMPL) || \
+ ((FLG) == SDIO_FLG_SBITERR) || \
+ ((FLG) == SDIO_FLG_DTBLKCMPL) || \
+ ((FLG) == SDIO_FLG_DOCMD) || \
+ ((FLG) == SDIO_FLG_DOTX) || \
+ ((FLG) == SDIO_FLG_DORX) || \
+ ((FLG) == SDIO_FLG_TXBUF_H) || \
+ ((FLG) == SDIO_FLG_RXBUF_H) || \
+ ((FLG) == SDIO_FLG_TXBUF_F) || \
+ ((FLG) == SDIO_FLG_RXBUF_F) || \
+ ((FLG) == SDIO_FLG_TXBUF_E) || \
+ ((FLG) == SDIO_FLG_RXBUF_E) || \
+ ((FLG) == SDIO_FLG_TXBUF) || \
+ ((FLG) == SDIO_FLG_RXBUF) || \
+ ((FLG) == SDIO_FLG_SDIOIF) || \
+ ((FLG) == SDIO_FLG_ATACMPL))
+
+#define IS_SDIO_CLEAR_FLG(FLG) ((((FLG) & (uint32_t)0xFF3FF800) == 0x00) && ((FLG) != (uint32_t)0x00))
+
+#define IS_SDIO_GET_INT(INT) (((INT) == SDIO_INT_CMDFAIL) || \
+ ((INT) == SDIO_INT_DTFAIL) || \
+ ((INT) == SDIO_INT_CMDTIMEOUT) || \
+ ((INT) == SDIO_INT_DTTIMEOUT) || \
+ ((INT) == SDIO_INT_TXERRU) || \
+ ((INT) == SDIO_INT_RXERRO) || \
+ ((INT) == SDIO_INT_CMDRSPCMPL) || \
+ ((INT) == SDIO_INT_CMDCMPL) || \
+ ((INT) == SDIO_INT_DTCMPL) || \
+ ((INT) == SDIO_INT_SBITERR) || \
+ ((INT) == SDIO_INT_DTBLKCMPL) || \
+ ((INT) == SDIO_INT_DOCMD) || \
+ ((INT) == SDIO_INT_DOTX) || \
+ ((INT) == SDIO_INT_DORX) || \
+ ((INT) == SDIO_INT_TXBUF_H) || \
+ ((INT) == SDIO_INT_RXBUF_H) || \
+ ((INT) == SDIO_INT_TXBUF_F) || \
+ ((INT) == SDIO_INT_RXBUF_F) || \
+ ((INT) == SDIO_INT_TXBUF_E) || \
+ ((INT) == SDIO_INT_RXBUF_E) || \
+ ((INT) == SDIO_INT_TXBUF) || \
+ ((INT) == SDIO_INT_RXBUF) || \
+ ((INT) == SDIO_INT_SDIOIF) || \
+ ((INT) == SDIO_INT_ATACMPL))
+
+#define IS_SDIO_CLEAR_INT(INT) ((((INT) & (uint32_t)0xFF3FF800) == 0x00) && ((INT) != (uint32_t)0x00))
+
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Read_Wait_Mode
+ * @{
+ */
+
+#define SDIO_ReadWaitMode_CLK ((uint32_t)0x00000001)
+#define SDIO_ReadWaitMode_DATA2 ((uint32_t)0x00000000)
+#define IS_SDIO_READWAIT_MODE(MODE) (((MODE) == SDIO_ReadWaitMode_CLK) || \
+ ((MODE) == SDIO_ReadWaitMode_DATA2))
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Exported_Functions
+ * @{
+ */
+
+void SDIO_Reset(SDIO_Type * SDIOx);
+void SDIO_Init(SDIO_Type * SDIOx, SDIO_InitType* SDIO_InitStruct);
+void SDIO_StructInit(SDIO_InitType* SDIO_InitStruct);
+void SDIO_ClockCmd(SDIO_Type * SDIOx, FunctionalState NewState);
+void SDIO_SetPowerSaveState(SDIO_Type * SDIOx, uint32_t SDIO_PowerState);
+uint32_t SDIO_GetPowerSaveState(SDIO_Type * SDIOx);
+void SDIO_INTConfig(SDIO_Type * SDIOx, uint32_t SDIO_INT, FunctionalState NewState);
+void SDIO_DMACmd(SDIO_Type * SDIOx, FunctionalState NewState);
+void SDIO_SendCommand(SDIO_Type * SDIOx, SDIO_CmdInitType *SDIO_CmdInitStruct);
+void SDIO_CmdStructInit(SDIO_CmdInitType* SDIO_CmdInitStruct);
+uint8_t SDIO_GetCommandResponse(SDIO_Type * SDIOx);
+uint32_t SDIO_GetResponse(SDIO_Type * SDIOx, uint32_t SDIO_RESP);
+void SDIO_DataConfig(SDIO_Type * SDIOx, SDIO_DataInitType* SDIO_DataInitStruct);
+void SDIO_DataStructInit(SDIO_DataInitType* SDIO_DataInitStruct);
+uint32_t SDIO_GetDataCounter(SDIO_Type * SDIOx);
+uint32_t SDIO_ReadData(SDIO_Type * SDIOx);
+void SDIO_WriteData(SDIO_Type * SDIOx, uint32_t Data);
+uint32_t SDIO_GetBUFCount(SDIO_Type * SDIOx);
+void SDIO_StartSDIOReadWait(SDIO_Type * SDIOx, FunctionalState NewState);
+void SDIO_StopSDIOReadWait(SDIO_Type * SDIOx, FunctionalState NewState);
+void SDIO_SetSDIOReadWaitMode(SDIO_Type * SDIOx, uint32_t SDIO_ReadWaitMode);
+void SDIO_SetSDIOOperation(SDIO_Type * SDIOx, FunctionalState NewState);
+void SDIO_SendSDIOSuspendCmd(SDIO_Type * SDIOx, FunctionalState NewState);
+void SDIO_CommandCompletionCmd(SDIO_Type * SDIOx, FunctionalState NewState);
+void SDIO_ATAINTCmd(SDIO_Type * SDIOx, FunctionalState NewState);
+void SDIO_SendATACmd(SDIO_Type * SDIOx, FunctionalState NewState);
+FlagStatus SDIO_GetFlagStatus(SDIO_Type * SDIOx, uint32_t SDIO_FLAG);
+void SDIO_ClearFlag(SDIO_Type * SDIOx, uint32_t SDIO_FLAG);
+ITStatus SDIO_GetINTStatus(SDIO_Type * SDIOx, uint32_t SDIO_INT);
+void SDIO_ClearINTPendingBit(SDIO_Type * SDIOx, uint32_t SDIO_INT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_SDIO_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_spi.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_spi.h
new file mode 100644
index 0000000000000000000000000000000000000000..48637a9b75018e06419edbe2bef0c90090ade7f9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_spi.h
@@ -0,0 +1,513 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_spi.h
+ * Description : at32f4xx SPI header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_SPI_H
+#define __AT32F4xx_SPI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup SPI
+ * @{
+ */
+
+/** @defgroup SPI_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief SPI Init structure definition
+ */
+
+typedef struct
+{
+ uint16_t SPI_TransMode; /*!< Specifies the SPI unidirectional or bidirectional data mode.
+ This parameter can be a value of @ref SPI_data_direction */
+
+ uint16_t SPI_Mode; /*!< Specifies the SPI operating mode.
+ This parameter can be a value of @ref SPI_mode */
+
+ uint16_t SPI_FrameSize; /*!< Specifies the SPI data size.
+ This parameter can be a value of @ref SPI_data_size */
+
+ uint16_t SPI_CPOL; /*!< Specifies the serial clock steady state.
+ This parameter can be a value of @ref SPI_Clock_Polarity */
+
+ uint16_t SPI_CPHA; /*!< Specifies the clock active edge for the bit capture.
+ This parameter can be a value of @ref SPI_Clock_Phase */
+
+ uint16_t SPI_NSSSEL; /*!< Specifies whether the NSSSEL signal is managed by
+ hardware (NSSSEL pin) or by software using the SSI bit.
+ This parameter can be a value of @ref SPI_Slave_Select_management */
+
+ uint16_t SPI_MCLKP; /*!< Specifies the Baud Rate prescaler value which will be
+ used to configure the transmit and receive SCK clock.
+ This parameter can be a value of @ref SPI_BaudRate_Prescaler.
+ @note The communication clock is derived from the master
+ clock. The slave clock does not need to be set. */
+
+ uint16_t SPI_FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit.
+ This parameter can be a value of @ref SPI_MSB_LSB_transmission */
+
+ uint16_t SPI_CPOLY; /*!< Specifies the polynomial used for the CRC calculation. */
+} SPI_InitType;
+
+/**
+ * @brief I2S Init structure defi nition
+ */
+
+typedef struct
+{
+
+ uint16_t I2S_Mode; /*!< Specifies the I2S operating mode.
+ This parameter can be a value of @ref I2S_Mode */
+
+ uint16_t I2s_AudioProtocol; /*!< Specifies the standard used for the I2S communication.
+ This parameter can be a value of @ref I2s_AudioProtocol */
+
+ uint16_t I2S_FrameFormat; /*! < Specifies the data format for the I2S communication.
+ This parameter can be a value of @ref I2S_Data_Format */
+
+ uint16_t I2S_MCLKOE; /*!< Specifies whether the I2S MCLK output is enabled or not.
+ This parameter can be a value of @ref I2S_MCLK_Output */
+
+ uint32_t I2S_AudioFreq; /*!< Specifies the frequency selected for the I2S communication.
+ This parameter can be a value of @ref I2S_Audio_Frequency */
+
+ uint16_t I2S_CPOL; /*!< Specifies the idle state of the I2S clock.
+ This parameter can be a value of @ref I2S_Clock_Polarity */
+} I2S_InitType;
+
+/**
+ * @}
+ */
+
+/** @defgroup SPI_Exported_Constants
+ * @{
+ */
+
+#if defined (AT32F413xx) || defined (AT32F415xx)
+#define IS_SPI_ALL_PERIPH(PERIPH) (((PERIPH) == SPI1) || \
+ ((PERIPH) == SPI2))
+#elif defined (AT32F403xx)
+#define IS_SPI_ALL_PERIPH(PERIPH) (((PERIPH) == SPI1) || \
+ ((PERIPH) == SPI2) || \
+ ((PERIPH) == SPI3) || \
+ ((PERIPH) == SPI4))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_SPI_ALL_PERIPH(PERIPH) (((PERIPH) == SPI1) || \
+ ((PERIPH) == SPI2) || \
+ ((PERIPH) == SPI3) || \
+ ((PERIPH) == SPI4) || \
+ ((PERIPH) == I2S2EXT) || \
+ ((PERIPH) == I2S3EXT))
+#endif
+
+#if defined (AT32F413xx) || defined (AT32F415xx)
+#define IS_SPI_I2S_PERIPH(PERIPH) (((PERIPH) == SPI1) || \
+ ((PERIPH) == SPI2))
+#elif defined (AT32F403xx)
+#define IS_SPI_I2S_PERIPH(PERIPH) (((PERIPH) == SPI1) || \
+ ((PERIPH) == SPI2) || \
+ ((PERIPH) == SPI3) || \
+ ((PERIPH) == SPI4))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_SPI_I2S_PERIPH(PERIPH) (((PERIPH) == SPI1) || \
+ ((PERIPH) == SPI2) || \
+ ((PERIPH) == SPI3) || \
+ ((PERIPH) == SPI4) || \
+ ((PERIPH) == I2S2EXT) || \
+ ((PERIPH) == I2S3EXT))
+#endif
+
+/** @defgroup SPI_data_direction
+ * @{
+ */
+
+#define SPI_TRANSMODE_FULLDUPLEX ((uint16_t)0x0000)
+#define SPI_TRANSMODE_RXONLY ((uint16_t)0x0400)
+#define SPI_TRANSMODE_RX_HALFDUPLEX ((uint16_t)0x8000)
+#define SPI_TRANSMODE_TX_HALFDUPLEX ((uint16_t)0xC000)
+#define IS_SPI_TRANS_MODE(MODE) (((MODE) == SPI_TRANSMODE_FULLDUPLEX) || \
+ ((MODE) == SPI_TRANSMODE_RXONLY) || \
+ ((MODE) == SPI_TRANSMODE_RX_HALFDUPLEX) || \
+ ((MODE) == SPI_TRANSMODE_TX_HALFDUPLEX))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_mode
+ * @{
+ */
+
+#define SPI_MODE_MASTER ((uint16_t)0x0104)
+#define SPI_MODE_SLAVE ((uint16_t)0x0000)
+#define IS_SPI_MODE(MODE) (((MODE) == SPI_MODE_MASTER) || \
+ ((MODE) == SPI_MODE_SLAVE))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_data_size
+ * @{
+ */
+
+#define SPI_FRAMESIZE_16BIT ((uint16_t)0x0800)
+#define SPI_FRAMESIZE_8BIT ((uint16_t)0x0000)
+#define IS_SPI_FRAMESIZE(FRAMESIZE) (((FRAMESIZE) == SPI_FRAMESIZE_16BIT) || \
+ ((FRAMESIZE) == SPI_FRAMESIZE_8BIT))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_Clock_Polarity
+ * @{
+ */
+
+#define SPI_CPOL_LOW ((uint16_t)0x0000)
+#define SPI_CPOL_HIGH ((uint16_t)0x0002)
+#define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_CPOL_LOW) || \
+ ((CPOL) == SPI_CPOL_HIGH))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_Clock_Phase
+ * @{
+ */
+
+#define SPI_CPHA_1EDGE ((uint16_t)0x0000)
+#define SPI_CPHA_2EDGE ((uint16_t)0x0001)
+#define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_CPHA_1EDGE) || \
+ ((CPHA) == SPI_CPHA_2EDGE))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_Slave_Select_management
+ * @{
+ */
+
+#define SPI_NSSSEL_SOFT ((uint16_t)0x0200)
+#define SPI_NSSSEL_HARD ((uint16_t)0x0000)
+#define IS_SPI_NSSSEL(NSSSEL) (((NSSSEL) == SPI_NSSSEL_SOFT) || \
+ ((NSSSEL) == SPI_NSSSEL_HARD))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_BaudRate_Prescaler
+ * @{
+ */
+
+
+#define SPI_MCLKP_OVER_256 ((uint16_t)0x8000)
+
+#define SPI_MCLKP_2 ((uint16_t)0x0000)
+#define SPI_MCLKP_4 ((uint16_t)0x0008)
+#define SPI_MCLKP_8 ((uint16_t)0x0010)
+#define SPI_MCLKP_16 ((uint16_t)0x0018)
+#define SPI_MCLKP_32 ((uint16_t)0x0020)
+#define SPI_MCLKP_64 ((uint16_t)0x0028)
+#define SPI_MCLKP_128 ((uint16_t)0x0030)
+#define SPI_MCLKP_256 ((uint16_t)0x0038)
+#define SPI_MCLKP_512 ((uint16_t)0x8000)
+#define SPI_MCLKP_1024 ((uint16_t)0x8008)
+#define IS_SPI_MCLKP(MCLKP) (((MCLKP) == SPI_MCLKP_2) || \
+ ((MCLKP) == SPI_MCLKP_4) || \
+ ((MCLKP) == SPI_MCLKP_8) || \
+ ((MCLKP) == SPI_MCLKP_16) || \
+ ((MCLKP) == SPI_MCLKP_32) || \
+ ((MCLKP) == SPI_MCLKP_64) || \
+ ((MCLKP) == SPI_MCLKP_128) || \
+ ((MCLKP) == SPI_MCLKP_256) || \
+ ((MCLKP) == SPI_MCLKP_512) || \
+ ((MCLKP) == SPI_MCLKP_1024))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_MSB_LSB_transmission
+ * @{
+ */
+
+#define SPI_FIRSTBIT_MSB ((uint16_t)0x0000)
+#define SPI_FIRSTBIT_LSB ((uint16_t)0x0080)
+#define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FIRSTBIT_MSB) || \
+ ((BIT) == SPI_FIRSTBIT_LSB))
+/**
+ * @}
+ */
+
+/** @defgroup I2S_Mode
+ * @{
+ */
+
+#define I2S_MODE_SLAVETX ((uint16_t)0x0000)
+#define I2S_MODE_SLAVERX ((uint16_t)0x0100)
+#define I2S_MODE_MASTERTX ((uint16_t)0x0200)
+#define I2S_MODE_MASTERRX ((uint16_t)0x0300)
+#define IS_I2S_MODE(MODE) (((MODE) == I2S_MODE_SLAVETX) || \
+ ((MODE) == I2S_MODE_SLAVERX) || \
+ ((MODE) == I2S_MODE_MASTERTX) || \
+ ((MODE) == I2S_MODE_MASTERRX) )
+/**
+ * @}
+ */
+
+/** @defgroup I2S_AUDIOPROTOCOL
+ * @{
+ */
+
+#define I2S_AUDIOPROTOCOL_PHILLIPS ((uint16_t)0x0000)
+#define I2S_AUDIOPROTOCOL_MSB ((uint16_t)0x0010)
+#define I2S_AUDIOPROTOCOL_LSB ((uint16_t)0x0020)
+#define I2S_AUDIOPROTOCOL_PCMSHORT ((uint16_t)0x0030)
+#define I2S_AUDIOPROTOCOL_PCMLONG ((uint16_t)0x00B0)
+#define IS_I2S_AUDIOPROTOCOL(AUDIOPROTOCOL) (((AUDIOPROTOCOL) == I2S_AUDIOPROTOCOL_PHILLIPS) || \
+ ((AUDIOPROTOCOL) == I2S_AUDIOPROTOCOL_MSB) || \
+ ((AUDIOPROTOCOL) == I2S_AUDIOPROTOCOL_LSB) || \
+ ((AUDIOPROTOCOL) == I2S_AUDIOPROTOCOL_PCMSHORT) || \
+ ((AUDIOPROTOCOL) == I2S_AUDIOPROTOCOL_PCMLONG))
+/**
+ * @}
+ */
+
+/** @defgroup I2S_Data_Format
+ * @{
+ */
+
+#define I2S_FRAMEFORMAT_DL16BIT_CHL16BIT ((uint16_t)0x0000)
+#define I2S_FRAMEFORMAT_DL16BIT_CHL32BIT ((uint16_t)0x0001)
+#define I2S_FRAMEFORMAT_DL24BIT_CHL32BIT ((uint16_t)0x0003)
+#define I2S_FRAMEFORMAT_DL32BIT_CHL32BIT ((uint16_t)0x0005)
+#define IS_I2S_FRAMEFORMAT(FRAMEFORMAT) (((FRAMEFORMAT) == I2S_FRAMEFORMAT_DL16BIT_CHL16BIT) || \
+ ((FRAMEFORMAT) == I2S_FRAMEFORMAT_DL16BIT_CHL32BIT) || \
+ ((FRAMEFORMAT) == I2S_FRAMEFORMAT_DL24BIT_CHL32BIT) || \
+ ((FRAMEFORMAT) == I2S_FRAMEFORMAT_DL32BIT_CHL32BIT))
+/**
+ * @}
+ */
+
+/** @defgroup I2S_MCLK_Output
+ * @{
+ */
+
+#define I2S_MCLKOE_ENABLE ((uint16_t)0x0200)
+#define I2S_MCLKOE_DISABLE ((uint16_t)0x0000)
+#define IS_I2S_MCLKOE(MCLKOE) (((MCLKOE) == I2S_MCLKOE_ENABLE) || \
+ ((MCLKOE) == I2S_MCLKOE_DISABLE))
+/**
+ * @}
+ */
+
+#define I2S_DIV_VALUE_MAX ((uint16_t)0x03FF)
+#define I2S_DIV_EXT_VALUE_MASK ((uint16_t)0x0300)
+#define I2S_DIV_EXT_VALUE_LSHIFT_OFFSET ((uint16_t)2)
+
+/** @defgroup I2S_Audio_Frequency
+ * @{
+ */
+
+#define I2S_AUDIOFREQ_192K ((uint32_t)192000)
+#define I2S_AUDIOFREQ_96K ((uint32_t)96000)
+#define I2S_AUDIOFREQ_48K ((uint32_t)48000)
+#define I2S_AUDIOFREQ_44K ((uint32_t)44100)
+#define I2S_AUDIOFREQ_32K ((uint32_t)32000)
+#define I2S_AUDIOFREQ_22K ((uint32_t)22050)
+#define I2S_AUDIOFREQ_16K ((uint32_t)16000)
+#define I2S_AUDIOFREQ_11K ((uint32_t)11025)
+#define I2S_AUDIOFREQ_8K ((uint32_t)8000)
+#define I2S_AUDIOFREQ_DEFAULT ((uint32_t)2)
+
+#define IS_I2S_AUDIO_FREQ(FREQ) ((((FREQ) >= I2S_AUDIOFREQ_8K) && \
+ ((FREQ) <= I2S_AUDIOFREQ_192K)) || \
+ ((FREQ) == I2S_AUDIOFREQ_DEFAULT))
+/**
+ * @}
+ */
+
+/** @defgroup I2S_Clock_Polarity
+ * @{
+ */
+
+#define I2S_CPOL_LOW ((uint16_t)0x0000)
+#define I2S_CPOL_HIGH ((uint16_t)0x0008)
+#define IS_I2S_CPOL(CPOL) (((CPOL) == I2S_CPOL_LOW) || \
+ ((CPOL) == I2S_CPOL_HIGH))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_I2S_DMA_transfer_requests
+ * @{
+ */
+
+#define SPI_I2S_DMA_TX ((uint16_t)0x0002)
+#define SPI_I2S_DMA_RX ((uint16_t)0x0001)
+#define IS_SPI_I2S_DMA(DMA) ((((DMA) & (uint16_t)0xFFFC) == 0x00) && ((DMA) != 0x00))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_NSS_internal_software_management
+ * @{
+ */
+
+#define SPI_ISS_SET ((uint16_t)0x0100)
+#define SPI_ISS_RESET ((uint16_t)0xFEFF)
+#define IS_SPI_ISS(ISS) (((ISS) == SPI_ISS_SET) || \
+ ((ISS) == SPI_ISS_RESET))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_CRC_Transmit_Receive
+ * @{
+ */
+
+#define SPI_CRC_TX ((uint8_t)0x00)
+#define SPI_CRC_RX ((uint8_t)0x01)
+#define IS_SPI_CRC(CRC) (((CRC) == SPI_CRC_TX) || ((CRC) == SPI_CRC_RX))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_direction_transmit_receive
+ * @{
+ */
+
+#define SPI_HALFDUPLEX_RX ((uint16_t)0xBFFF)
+#define SPI_HALFDUPLEX_TX ((uint16_t)0x4000)
+#define IS_SPI_DIRECTION(DIRECTION) (((DIRECTION) == SPI_HALFDUPLEX_RX) || \
+ ((DIRECTION) == SPI_HALFDUPLEX_TX))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_I2S_interrupts_definition
+ * @{
+ */
+
+#define SPI_I2S_INT_TE ((uint8_t)0x71)
+#define SPI_I2S_INT_RNE ((uint8_t)0x60)
+#define SPI_I2S_INT_ERR ((uint8_t)0x50)
+#define IS_SPI_I2S_CONFIG_INT(INT) (((INT) == SPI_I2S_INT_TE) || \
+ ((INT) == SPI_I2S_INT_RNE) || \
+ ((INT) == SPI_I2S_INT_ERR))
+#define SPI_I2S_INT_OVR ((uint8_t)0x56)
+#define SPI_INT_MODF ((uint8_t)0x55)
+#define SPI_INT_CERR ((uint8_t)0x54)
+#define I2S_INT_UDR ((uint8_t)0x53)
+#define IS_SPI_I2S_CLEAR_INT(INT) (((INT) == SPI_INT_CERR))
+#define IS_SPI_I2S_GET_INT(INT) (((INT) == SPI_I2S_INT_RNE) || ((INT) == SPI_I2S_INT_TE) || \
+ ((INT) == I2S_INT_UDR) || ((INT) == SPI_INT_CERR) || \
+ ((INT) == SPI_INT_MODF) || ((INT) == SPI_I2S_INT_OVR))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_I2S_flags_definition
+ * @{
+ */
+
+#define SPI_I2S_FLAG_RNE ((uint16_t)0x0001)
+#define SPI_I2S_FLAG_TE ((uint16_t)0x0002)
+#define I2S_FLAG_CS ((uint16_t)0x0004)
+#define I2S_FLAG_UDR ((uint16_t)0x0008)
+#define SPI_FLAG_CERR ((uint16_t)0x0010)
+#define SPI_FLAG_MODF ((uint16_t)0x0020)
+#define SPI_I2S_FLAG_OVR ((uint16_t)0x0040)
+#define SPI_I2S_FLAG_BUSY ((uint16_t)0x0080)
+#define IS_SPI_I2S_CLEAR_FLAG(FLAG) (((FLAG) == SPI_FLAG_CERR))
+#define IS_SPI_I2S_GET_FLAG(FLAG) (((FLAG) == SPI_I2S_FLAG_BUSY) || ((FLAG) == SPI_I2S_FLAG_OVR) || \
+ ((FLAG) == SPI_FLAG_MODF) || ((FLAG) == SPI_FLAG_CERR) || \
+ ((FLAG) == I2S_FLAG_UDR) || ((FLAG) == I2S_FLAG_CS) || \
+ ((FLAG) == SPI_I2S_FLAG_TE) || ((FLAG) == SPI_I2S_FLAG_RNE))
+/**
+ * @}
+ */
+
+/** @defgroup SPI_CRC_polynomial
+ * @{
+ */
+
+#define IS_SPI_CPOLY(CPOLY) ((CPOLY) >= 0x1)
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SPI_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SPI_Exported_Functions
+ * @{
+ */
+
+void SPI_I2S_Reset(SPI_Type* SPIx);
+void SPI_Init(SPI_Type* SPIx, SPI_InitType* SPI_InitStruct);
+void I2S_Init(SPI_Type* SPIx, I2S_InitType* I2S_InitStruct);
+void SPI_DefaultInitParaConfig(SPI_InitType* SPI_InitStruct);
+void I2S_DefaultInit(I2S_InitType* I2S_InitStruct);
+void SPI_Enable(SPI_Type* SPIx, FunctionalState NewState);
+void I2S_Enable(SPI_Type* SPIx, FunctionalState NewState);
+void SPI_I2S_INTConfig(SPI_Type* SPIx, uint8_t SPI_I2S_INT, FunctionalState NewState);
+void SPI_I2S_DMAEnable(SPI_Type* SPIx, uint16_t SPI_I2S_DMAReq, FunctionalState NewState);
+void SPI_I2S_TxData(SPI_Type* SPIx, uint16_t Data);
+uint16_t SPI_I2S_RxData(SPI_Type* SPIx);
+void SPI_NSSInternalSoftwareConfig(SPI_Type* SPIx, uint16_t SPI_NSSInternalSoft);
+void SPI_NSSHardwareOutputEnable(SPI_Type* SPIx, FunctionalState NewState);
+void SPI_FrameSizeConfig(SPI_Type* SPIx, uint16_t SPI_DataSize);
+void SPI_TxCRC(SPI_Type* SPIx);
+void SPI_CRCEN(SPI_Type* SPIx, FunctionalState NewState);
+uint16_t SPI_GetCRC(SPI_Type* SPIx, uint8_t SPI_CRC);
+uint16_t SPI_GetCRCPolynomial(SPI_Type* SPIx);
+void SPI_HalfDuplexTransModeConfig(SPI_Type* SPIx, uint16_t SPI_Direction);
+FlagStatus SPI_I2S_GetFlagStatus(SPI_Type* SPIx, uint16_t SPI_I2S_FLAG);
+void SPI_I2S_ClearFlag(SPI_Type* SPIx, uint16_t SPI_I2S_FLAG);
+ITStatus SPI_I2S_GetITStatus(SPI_Type* SPIx, uint8_t SPI_I2S_INT);
+void SPI_I2S_ClearINTPendingBit(SPI_Type* SPIx, uint8_t SPI_I2S_INT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__AT32F4xx_SPI_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_tim.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_tim.h
new file mode 100644
index 0000000000000000000000000000000000000000..a833f4de48fcc69bbafc04e15b910d27b0a76d52
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_tim.h
@@ -0,0 +1,1402 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_tim.h
+ * Description : at32f4xx TIMER header file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_TIM_H
+#define __AT32F4xx_TIM_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup TMR
+ * @{
+ */
+
+/** @defgroup TMR_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief TMR Time Base Init structure definition
+ * @note This structure is used with all TMRx except for TMR6 and TMR7.
+ */
+
+typedef struct
+{
+ uint16_t TMR_DIV; /*!< Specifies the prescaler value used to divide the TMR clock.
+ This parameter can be a number between 0x0000 and 0xFFFF */
+
+ uint32_t TMR_CounterMode; /*!< Specifies the counter mode.
+ This parameter can be a value of @ref TMR_Counter_Mode */
+
+ uint32_t TMR_Period; /*!< Specifies the period value to be loaded into the active
+ Auto-Reload Register at the next update event.
+ This parameter must be a number between 0x0000 and 0xFFFF. */
+
+ uint16_t TMR_ClockDivision; /*!< Specifies the clock division.
+ This parameter can be a value of @ref TMR_Clock_Division_CKD */
+
+ uint8_t TMR_RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter
+ reaches zero, an update event is generated and counting restarts
+ from the RCR value (N).
+ This means in PWM mode that (N+1) corresponds to:
+ - the number of PWM periods in edge-aligned mode
+ - the number of half PWM period in center-aligned mode
+ This parameter must be a number between 0x00 and 0xFF.
+ @note This parameter is valid only for TMR1 and TMR8. */
+} TMR_TimerBaseInitType;
+
+/**
+ * @brief TMR Output Compare Init structure definition
+ */
+
+typedef struct
+{
+ uint16_t TMR_OCMode; /*!< Specifies the TMR mode.
+ This parameter can be a value of @ref TMR_Output_Compare_and_PWM_modes */
+
+ uint16_t TMR_OutputState; /*!< Specifies the TMR Output Compare state.
+ This parameter can be a value of @ref TMR_Output_Compare_state */
+
+ uint16_t TMR_OutputNState; /*!< Specifies the TMR complementary Output Compare state.
+ This parameter can be a value of @ref TMR_Output_Compare_N_state
+ @note This parameter is valid only for TMR1 and TMR8. */
+
+ uint32_t TMR_Pulse; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
+ This parameter can be a number between 0x0000 and 0xFFFF */
+
+
+ uint16_t TMR_OCPolarity; /*!< Specifies the output polarity.
+ This parameter can be a value of @ref TMR_Output_Compare_Polarity */
+
+ uint16_t TMR_OCNPolarity; /*!< Specifies the complementary output polarity.
+ This parameter can be a value of @ref TMR_Output_Compare_N_Polarity
+ @note This parameter is valid only for TMR1 and TMR8. */
+
+ uint16_t TMR_OCIdleState; /*!< Specifies the TMR Output Compare pin state during Idle state.
+ This parameter can be a value of @ref TMR_Output_Compare_Idle_State
+ @note This parameter is valid only for TMR1 and TMR8. */
+
+ uint16_t TMR_OCNIdleState; /*!< Specifies the TMR Output Compare pin state during Idle state.
+ This parameter can be a value of @ref TMR_Output_Compare_N_Idle_State
+ @note This parameter is valid only for TMR1 and TMR8. */
+} TMR_OCInitType;
+
+/**
+ * @brief TMR Input Capture Init structure definition
+ */
+
+typedef struct
+{
+
+ uint16_t TMR_Channel; /*!< Specifies the TMR channel.
+ This parameter can be a value of @ref TMR_Channel */
+
+ uint16_t TMR_ICPolarity; /*!< Specifies the active edge of the input signal.
+ This parameter can be a value of @ref TMR_Input_Capture_Polarity */
+
+ uint16_t TMR_ICSelection; /*!< Specifies the input.
+ This parameter can be a value of @ref TMR_Input_Capture_Selection */
+
+ uint16_t TMR_ICDIV; /*!< Specifies the Input Capture Prescaler.
+ This parameter can be a value of @ref TMR_Input_Capture_Prescaler */
+
+ uint16_t TMR_ICFilter; /*!< Specifies the input capture filter.
+ This parameter can be a number between 0x0 and 0xF */
+} TMR_ICInitType;
+
+/**
+ * @brief BDTR structure definition
+ * @note This structure is used only with TMR1 and TMR8.
+ */
+
+typedef struct
+{
+
+ uint16_t TMR_OSIMRState; /*!< Specifies the Off-State selection used in Run mode.
+ This parameter can be a value of @ref OSSR_Off_State_Selection_for_Run_mode_state */
+
+ uint16_t TMR_OSIMIState; /*!< Specifies the Off-State used in Idle state.
+ This parameter can be a value of @ref OSSI_Off_State_Selection_for_Idle_mode_state */
+
+ uint16_t TMR_LOCKgrade; /*!< Specifies the LOCK level parameters.
+ This parameter can be a value of @ref Lock_level */
+
+ uint16_t TMR_DeadTime; /*!< Specifies the delay time between the switching-off and the
+ switching-on of the outputs.
+ This parameter can be a number between 0x00 and 0xFF */
+
+ uint16_t TMR_Break; /*!< Specifies whether the TMR Break input is enabled or not.
+ This parameter can be a value of @ref Break_Input_enable_disable */
+
+ uint16_t TMR_BreakPolarity; /*!< Specifies the TMR Break Input pin polarity.
+ This parameter can be a value of @ref Break_Polarity */
+
+ uint16_t TMR_AutomaticOutput; /*!< Specifies whether the TMR Automatic Output feature is enabled or not.
+ This parameter can be a value of @ref TMR_AOE_Bit_Set_Reset */
+} TMR_BRKDTInitType;
+
+/** @defgroup TMR_Exported_constants
+ * @{
+ */
+
+#if defined (AT32F403xx)
+#define IS_TMR_ALL_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR6) || \
+ ((PERIPH) == TMR7) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR10)|| \
+ ((PERIPH) == TMR11)|| \
+ ((PERIPH) == TMR12)|| \
+ ((PERIPH) == TMR13)|| \
+ ((PERIPH) == TMR14)|| \
+ ((PERIPH) == TMR15))
+#elif defined (AT32F413xx)
+#define IS_TMR_ALL_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR10)|| \
+ ((PERIPH) == TMR11))
+#elif defined (AT32F415xx)
+#define IS_TMR_ALL_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR10)|| \
+ ((PERIPH) == TMR11))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_TMR_ALL_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR6) || \
+ ((PERIPH) == TMR7) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR10)|| \
+ ((PERIPH) == TMR11)|| \
+ ((PERIPH) == TMR12)|| \
+ ((PERIPH) == TMR13)|| \
+ ((PERIPH) == TMR14))
+#endif
+
+
+
+/* LIST1: TMR 1, 8 and 15 */
+#if defined (AT32F403xx)
+#define IS_TMR_LIST1_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR15))
+#elif defined (AT32F413xx)
+#define IS_TMR_LIST1_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR8))
+#elif defined (AT32F415xx)
+#define IS_TMR_LIST1_PERIPH(PERIPH) (((PERIPH) == TMR1))
+
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_TMR_LIST1_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR8))
+#endif
+
+/* LIST2: TMR 1, 8, 15 */
+#if defined (AT32F403xx)
+#define IS_TMR_LIST2_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR15))
+#elif defined (AT32F413xx)
+#define IS_TMR_LIST2_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR8))
+#elif defined (AT32F415xx)
+#define IS_TMR_LIST2_PERIPH(PERIPH) (((PERIPH) == TMR1))
+
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_TMR_LIST2_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR8))
+#endif
+
+
+/* LIST3: TMR 1, 2, 3, 4, 5 ,8 and 15 */
+#if defined (AT32F403xx)
+#define IS_TMR_LIST3_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR15))
+#elif defined (AT32F413xx)
+#define IS_TMR_LIST3_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8))
+#elif defined (AT32F415xx)
+#define IS_TMR_LIST3_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_TMR_LIST3_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8))
+#endif
+
+/* LIST4: TMR 1, 2, 3, 4, 5, 8, 15 */
+#if defined (AT32F403xx)
+#define IS_TMR_LIST4_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR15))
+#elif defined (AT32F413xx)
+#define IS_TMR_LIST4_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8))
+#elif defined (AT32F415xx)
+#define IS_TMR_LIST4_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_TMR_LIST4_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8))
+#endif
+
+/* LIST5: TMR 1, 2, 3, 4, 5, 8 and 15 */
+
+#if defined (AT32F403xx)
+#define IS_TMR_LIST5_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR15))
+#elif defined (AT32F413xx)
+#define IS_TMR_LIST5_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8))
+#elif defined (AT32F415xx)
+#define IS_TMR_LIST5_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_TMR_LIST5_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8))
+#endif
+
+/* LIST6: TMR 1, 2, 3, 4, 5, 8, 9, 12 and 15 */
+#if defined (AT32F403xx)
+#define IS_TMR_LIST6_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR12)|| \
+ ((PERIPH) == TMR15))
+#elif defined (AT32F413xx)
+#define IS_TMR_LIST6_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9))
+#elif defined (AT32F415xx)
+#define IS_TMR_LIST6_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR9))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_TMR_LIST6_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR12))
+#endif
+
+/* LIST7: TMR 1, 2, 3, 4, 5, 6, 7, 8, 9, 12 and 15 */
+#if defined (AT32F403xx)
+#define IS_TMR_LIST7_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR6) || \
+ ((PERIPH) == TMR7) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR12)|| \
+ ((PERIPH) == TMR15))
+#elif defined (AT32F413xx)
+#define IS_TMR_LIST7_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9))
+#elif defined (AT32F415xx)
+#define IS_TMR_LIST7_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR9))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_TMR_LIST7_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR6) || \
+ ((PERIPH) == TMR7) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR12))
+#endif
+
+/* LIST8: TMR 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15 */
+#if defined (AT32F403xx)
+#define IS_TMR_LIST8_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR10)|| \
+ ((PERIPH) == TMR11)|| \
+ ((PERIPH) == TMR12)|| \
+ ((PERIPH) == TMR13)|| \
+ ((PERIPH) == TMR14)|| \
+ ((PERIPH) == TMR15))
+#elif defined (AT32F413xx)
+#define IS_TMR_LIST8_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR10)|| \
+ ((PERIPH) == TMR11))
+#elif defined (AT32F415xx)
+#define IS_TMR_LIST8_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR10)|| \
+ ((PERIPH) == TMR11))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_TMR_LIST8_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR9) || \
+ ((PERIPH) == TMR10)|| \
+ ((PERIPH) == TMR11)|| \
+ ((PERIPH) == TMR12)|| \
+ ((PERIPH) == TMR13)|| \
+ ((PERIPH) == TMR14))
+#endif
+
+/* LIST9: TMR 1, 2, 3, 4, 5, 6, 7, 8, 15 */
+#if defined (AT32F403xx)
+#define IS_TMR_LIST9_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR6) || \
+ ((PERIPH) == TMR7) || \
+ ((PERIPH) == TMR8) || \
+ ((PERIPH) == TMR15))
+#elif defined (AT32F413xx)
+#define IS_TMR_LIST9_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR8))
+#elif defined (AT32F415xx)
+#define IS_TMR_LIST9_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5))
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+#define IS_TMR_LIST9_PERIPH(PERIPH) (((PERIPH) == TMR1) || \
+ ((PERIPH) == TMR2) || \
+ ((PERIPH) == TMR3) || \
+ ((PERIPH) == TMR4) || \
+ ((PERIPH) == TMR5) || \
+ ((PERIPH) == TMR6) || \
+ ((PERIPH) == TMR7) || \
+ ((PERIPH) == TMR8))
+#endif
+
+/*LIST10:TIM 2, 5*/
+#define IS_TMR_PLUSMODE_PERIPH(PERIPH) (((PERIPH)==TMR2) ||\
+ ((PERIPH)==TMR5))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Output_Compare_and_PWM_modes
+ * @{
+ */
+
+#define TMR_OCMode_Timing ((uint16_t)0x0000)
+#define TMR_OCMode_Active ((uint16_t)0x0010)
+#define TMR_OCMode_Inactive ((uint16_t)0x0020)
+#define TMR_OCMode_Toggle ((uint16_t)0x0030)
+#define TMR_OCMode_PWM1 ((uint16_t)0x0060)
+#define TMR_OCMode_PWM2 ((uint16_t)0x0070)
+#define IS_TMR_OC_MODE(MODE) (((MODE) == TMR_OCMode_Timing) || \
+ ((MODE) == TMR_OCMode_Active) || \
+ ((MODE) == TMR_OCMode_Inactive) || \
+ ((MODE) == TMR_OCMode_Toggle)|| \
+ ((MODE) == TMR_OCMode_PWM1) || \
+ ((MODE) == TMR_OCMode_PWM2))
+#define IS_TMR_OCM(MODE) (((MODE) == TMR_OCMode_Timing) || \
+ ((MODE) == TMR_OCMode_Active) || \
+ ((MODE) == TMR_OCMode_Inactive) || \
+ ((MODE) == TMR_OCMode_Toggle)|| \
+ ((MODE) == TMR_OCMode_PWM1) || \
+ ((MODE) == TMR_OCMode_PWM2) || \
+ ((MODE) == TMR_ForcedAction_Active) || \
+ ((MODE) == TMR_ForcedAction_InActive))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_One_Pulse_Mode
+ * @{
+ */
+
+#define TMR_OPMode_Once ((uint16_t)0x0008)
+#define TMR_OPMode_Repetitive ((uint16_t)0x0000)
+#define IS_TMR_OPM_MODE(MODE) (((MODE) == TMR_OPMode_Once) || \
+ ((MODE) == TMR_OPMode_Repetitive))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Channel
+ * @{
+ */
+
+#define TMR_Channel_1 ((uint16_t)0x0000)
+#define TMR_Channel_2 ((uint16_t)0x0004)
+#define TMR_Channel_3 ((uint16_t)0x0008)
+#define TMR_Channel_4 ((uint16_t)0x000C)
+#define IS_TMR_CHANNEL(CHANNEL) (((CHANNEL) == TMR_Channel_1) || \
+ ((CHANNEL) == TMR_Channel_2) || \
+ ((CHANNEL) == TMR_Channel_3) || \
+ ((CHANNEL) == TMR_Channel_4))
+#define IS_TMR_PWMI_CHANNEL(CHANNEL) (((CHANNEL) == TMR_Channel_1) || \
+ ((CHANNEL) == TMR_Channel_2))
+#define IS_TMR_COMPLEMENTARY_CHANNEL(CHANNEL) (((CHANNEL) == TMR_Channel_1) || \
+ ((CHANNEL) == TMR_Channel_2) || \
+ ((CHANNEL) == TMR_Channel_3))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Clock_Division_CKD
+ * @{
+ */
+
+#define TMR_CKD_DIV1 ((uint16_t)0x0000)
+#define TMR_CKD_DIV2 ((uint16_t)0x0100)
+#define TMR_CKD_DIV4 ((uint16_t)0x0200)
+#define IS_TMR_CKD_DIV(DIV) (((DIV) == TMR_CKD_DIV1) || \
+ ((DIV) == TMR_CKD_DIV2) || \
+ ((DIV) == TMR_CKD_DIV4))
+/**
+ * @}
+ */
+
+
+/** @defgroup TMR_Counter_Mode
+ * @{
+ */
+
+#define TMR_CounterDIR_Up ((uint16_t)0x0000)
+#define TMR_CounterDIR_Down ((uint16_t)0x0010)
+#define TMR_CounterDIR_CenterAligned1 ((uint16_t)0x0020)
+#define TMR_CounterDIR_CenterAligned2 ((uint16_t)0x0040)
+#define TMR_CounterDIR_CenterAligned3 ((uint16_t)0x0060)
+#define IS_TMR_COUNTER_DIR(DIR) (((DIR) == TMR_CounterDIR_Up) || \
+ ((DIR) == TMR_CounterDIR_Down) || \
+ ((DIR) == TMR_CounterDIR_CenterAligned1) || \
+ ((DIR) == TMR_CounterDIR_CenterAligned2) || \
+ ((DIR) == TMR_CounterDIR_CenterAligned3))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Output_Compare_Polarity
+ * @{
+ */
+
+#define TMR_OCPolarity_High ((uint16_t)0x0000)
+#define TMR_OCPolarity_Low ((uint16_t)0x0002)
+#define IS_TMR_OC_POLARITY(POLARITY) (((POLARITY) == TMR_OCPolarity_High) || \
+ ((POLARITY) == TMR_OCPolarity_Low))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Output_Compare_N_Polarity
+ * @{
+ */
+
+#define TMR_OCNPolarity_High ((uint16_t)0x0000)
+#define TMR_OCNPolarity_Low ((uint16_t)0x0008)
+#define IS_TMR_OCN_POLARITY(POLARITY) (((POLARITY) == TMR_OCNPolarity_High) || \
+ ((POLARITY) == TMR_OCNPolarity_Low))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Output_Compare_state
+ * @{
+ */
+
+#define TMR_OutputState_Disable ((uint16_t)0x0000)
+#define TMR_OutputState_Enable ((uint16_t)0x0001)
+#define IS_TMR_OUTPUT_STATE(STATE) (((STATE) == TMR_OutputState_Disable) || \
+ ((STATE) == TMR_OutputState_Enable))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Output_Compare_N_state
+ * @{
+ */
+
+#define TMR_OutputNState_Disable ((uint16_t)0x0000)
+#define TMR_OutputNState_Enable ((uint16_t)0x0004)
+#define IS_TMR_OUTPUTN_STATE(STATE) (((STATE) == TMR_OutputNState_Disable) || \
+ ((STATE) == TMR_OutputNState_Enable))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Capture_Compare_state
+ * @{
+ */
+
+#define TMR_CCx_Enable ((uint16_t)0x0001)
+#define TMR_CCx_Disable ((uint16_t)0x0000)
+#define IS_TMR_CCX(CCX) (((CCX) == TMR_CCx_Enable) || \
+ ((CCX) == TMR_CCx_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Capture_Compare_N_state
+ * @{
+ */
+
+#define TMR_CCxN_Enable ((uint16_t)0x0004)
+#define TMR_CCxN_Disable ((uint16_t)0x0000)
+#define IS_TMR_CCXN(CCXN) (((CCXN) == TMR_CCxN_Enable) || \
+ ((CCXN) == TMR_CCxN_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup Break_Input_enable_disable
+ * @{
+ */
+
+#define TMR_Break_Enable ((uint16_t)0x1000)
+#define TMR_Break_Disable ((uint16_t)0x0000)
+#define IS_TMR_BREAK_STATE(STATE) (((STATE) == TMR_Break_Enable) || \
+ ((STATE) == TMR_Break_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup Break_Polarity
+ * @{
+ */
+
+#define TMR_BreakPolarity_Low ((uint16_t)0x0000)
+#define TMR_BreakPolarity_High ((uint16_t)0x2000)
+#define IS_TMR_BREAK_POLARITY(POLARITY) (((POLARITY) == TMR_BreakPolarity_Low) || \
+ ((POLARITY) == TMR_BreakPolarity_High))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_AOE_Bit_Set_Reset
+ * @{
+ */
+
+#define TMR_AutomaticOutput_Enable ((uint16_t)0x4000)
+#define TMR_AutomaticOutput_Disable ((uint16_t)0x0000)
+#define IS_TMR_AUTOMATIC_OUTPUT_STATE(STATE) (((STATE) == TMR_AutomaticOutput_Enable) || \
+ ((STATE) == TMR_AutomaticOutput_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup Lock_level
+ * @{
+ */
+
+#define TMR_LOCKgrade_OFF ((uint16_t)0x0000)
+#define TMR_LOCKgrade_1 ((uint16_t)0x0100)
+#define TMR_LOCKgrade_2 ((uint16_t)0x0200)
+#define TMR_LOCKgrade_3 ((uint16_t)0x0300)
+#define IS_TMR_LOCK_grade(grade) (((grade) == TMR_LOCKgrade_OFF) || \
+ ((grade) == TMR_LOCKgrade_1) || \
+ ((grade) == TMR_LOCKgrade_2) || \
+ ((grade) == TMR_LOCKgrade_3))
+/**
+ * @}
+ */
+
+/** @defgroup OSSI_Off_State_Selection_for_Idle_mode_state
+ * @{
+ */
+
+#define TMR_OSIMIState_Enable ((uint16_t)0x0400)
+#define TMR_OSIMIState_Disable ((uint16_t)0x0000)
+#define IS_TMR_OSIMI_STATE(STATE) (((STATE) == TMR_OSIMIState_Enable) || \
+ ((STATE) == TMR_OSIMIState_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup OSSR_Off_State_Selection_for_Run_mode_state
+ * @{
+ */
+
+#define TMR_OSIMRState_Enable ((uint16_t)0x0800)
+#define TMR_OSIMRState_Disable ((uint16_t)0x0000)
+#define IS_TMR_OSIMR_STATE(STATE) (((STATE) == TMR_OSIMRState_Enable) || \
+ ((STATE) == TMR_OSIMRState_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Output_Compare_Idle_State
+ * @{
+ */
+
+#define TMR_OCIdleState_Set ((uint16_t)0x0100)
+#define TMR_OCIdleState_Reset ((uint16_t)0x0000)
+#define IS_TMR_OCIDLE_STATE(STATE) (((STATE) == TMR_OCIdleState_Set) || \
+ ((STATE) == TMR_OCIdleState_Reset))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Output_Compare_N_Idle_State
+ * @{
+ */
+
+#define TMR_OCNIdleState_Set ((uint16_t)0x0200)
+#define TMR_OCNIdleState_Reset ((uint16_t)0x0000)
+#define IS_TMR_OCNIDLE_STATE(STATE) (((STATE) == TMR_OCNIdleState_Set) || \
+ ((STATE) == TMR_OCNIdleState_Reset))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Input_Capture_Polarity
+ * @{
+ */
+
+#define TMR_ICPolarity_Rising ((uint16_t)0x0000)
+#define TMR_ICPolarity_Falling ((uint16_t)0x0002)
+#define TMR_ICPolarity_BothEdge ((uint16_t)0x000A)
+#define IS_TMR_IC_POLARITY(POLARITY) (((POLARITY) == TMR_ICPolarity_Rising) || \
+ ((POLARITY) == TMR_ICPolarity_Falling))
+#define IS_TMR_IC_POLARITY_LITE(POLARITY) (((POLARITY) == TMR_ICPolarity_Rising) || \
+ ((POLARITY) == TMR_ICPolarity_Falling)|| \
+ ((POLARITY) == TMR_ICPolarity_BothEdge))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Input_Capture_Selection
+ * @{
+ */
+
+#define TMR_ICSelection_DirectTI ((uint16_t)0x0001) /*!< TMR Input 1, 2, 3 or 4 is selected to be
+ connected to IC1, IC2, IC3 or IC4, respectively */
+#define TMR_ICSelection_IndirectTI ((uint16_t)0x0002) /*!< TMR Input 1, 2, 3 or 4 is selected to be
+ connected to IC2, IC1, IC4 or IC3, respectively. */
+#define TMR_ICSelection_TRC ((uint16_t)0x0003) /*!< TMR Input 1, 2, 3 or 4 is selected to be connected to TRC. */
+#define IS_TMR_IC_SELECTION(SELECTION) (((SELECTION) == TMR_ICSelection_DirectTI) || \
+ ((SELECTION) == TMR_ICSelection_IndirectTI) || \
+ ((SELECTION) == TMR_ICSelection_TRC))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Input_Capture_Prescaler
+ * @{
+ */
+
+#define TMR_ICDIV_DIV1 ((uint16_t)0x0000) /*!< Capture performed each time an edge is detected on the capture input. */
+#define TMR_ICDIV_DIV2 ((uint16_t)0x0004) /*!< Capture performed once every 2 events. */
+#define TMR_ICDIV_DIV4 ((uint16_t)0x0008) /*!< Capture performed once every 4 events. */
+#define TMR_ICDIV_DIV8 ((uint16_t)0x000C) /*!< Capture performed once every 8 events. */
+#define IS_TMR_IC_DIV(DIV) (((DIV) == TMR_ICDIV_DIV1) || \
+ ((DIV) == TMR_ICDIV_DIV2) || \
+ ((DIV) == TMR_ICDIV_DIV4) || \
+ ((DIV) == TMR_ICDIV_DIV8))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_interrupt_sources
+ * @{
+ */
+
+#define TMR_INT_Overflow ((uint16_t)0x0001)
+#define TMR_INT_CC1 ((uint16_t)0x0002)
+#define TMR_INT_CC2 ((uint16_t)0x0004)
+#define TMR_INT_CC3 ((uint16_t)0x0008)
+#define TMR_INT_CC4 ((uint16_t)0x0010)
+#define TMR_INT_HALL ((uint16_t)0x0020)
+#define TMR_INT_Trigger ((uint16_t)0x0040)
+#define TMR_INT_Break ((uint16_t)0x0080)
+#define IS_TMR_INT(INT) ((((INT) & (uint16_t)0xFF00) == 0x0000) && ((INT) != 0x0000))
+
+#define IS_TMR_GET_INT(INT) (((INT) == TMR_INT_Overflow) || \
+ ((INT) == TMR_INT_CC1) || \
+ ((INT) == TMR_INT_CC2) || \
+ ((INT) == TMR_INT_CC3) || \
+ ((INT) == TMR_INT_CC4) || \
+ ((INT) == TMR_INT_HALL) || \
+ ((INT) == TMR_INT_Trigger) || \
+ ((INT) == TMR_INT_Break))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_DMA_Base_address
+ * @{
+ */
+
+#define TMR_DMABase_CTRL1 ((uint16_t)0x0000)
+#define TMR_DMABase_CTRL2 ((uint16_t)0x0001)
+#define TMR_DMABase_SMC ((uint16_t)0x0002)
+#define TMR_DMABase_DIE ((uint16_t)0x0003)
+#define TMR_DMABase_STS ((uint16_t)0x0004)
+#define TMR_DMABase_EVEG ((uint16_t)0x0005)
+#define TMR_DMABase_CCM1 ((uint16_t)0x0006)
+#define TMR_DMABase_CCM2 ((uint16_t)0x0007)
+#define TMR_DMABase_CCE ((uint16_t)0x0008)
+#define TMR_DMABase_CNT ((uint16_t)0x0009)
+#define TMR_DMABase_DIV ((uint16_t)0x000A)
+#define TMR_DMABase_AR ((uint16_t)0x000B)
+#define TMR_DMABase_RC ((uint16_t)0x000C)
+#define TMR_DMABase_CC1 ((uint16_t)0x000D)
+#define TMR_DMABase_CC2 ((uint16_t)0x000E)
+#define TMR_DMABase_CC3 ((uint16_t)0x000F)
+#define TMR_DMABase_CC4 ((uint16_t)0x0010)
+#define TMR_DMABase_BRKDT ((uint16_t)0x0011)
+#define TMR_DMABase_DMAC ((uint16_t)0x0012)
+#define IS_TMR_DMA_BASE(BASE) (((BASE) == TMR_DMABase_CTRL1) || \
+ ((BASE) == TMR_DMABase_CTRL2) || \
+ ((BASE) == TMR_DMABase_SMC) || \
+ ((BASE) == TMR_DMABase_DIE) || \
+ ((BASE) == TMR_DMABase_STS) || \
+ ((BASE) == TMR_DMABase_EVEG) || \
+ ((BASE) == TMR_DMABase_CCM1) || \
+ ((BASE) == TMR_DMABase_CCM2) || \
+ ((BASE) == TMR_DMABase_CCE) || \
+ ((BASE) == TMR_DMABase_CNT) || \
+ ((BASE) == TMR_DMABase_DIV) || \
+ ((BASE) == TMR_DMABase_AR) || \
+ ((BASE) == TMR_DMABase_RC) || \
+ ((BASE) == TMR_DMABase_CC1) || \
+ ((BASE) == TMR_DMABase_CC2) || \
+ ((BASE) == TMR_DMABase_CC3) || \
+ ((BASE) == TMR_DMABase_CC4) || \
+ ((BASE) == TMR_DMABase_BRKDT) || \
+ ((BASE) == TMR_DMABase_DMAC))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_DMA_Burst_Length
+ * @{
+ */
+
+#define TMR_DMABurstLength_1Transfer ((uint16_t)0x0000)
+#define TMR_DMABurstLength_2Transfers ((uint16_t)0x0100)
+#define TMR_DMABurstLength_3Transfers ((uint16_t)0x0200)
+#define TMR_DMABurstLength_4Transfers ((uint16_t)0x0300)
+#define TMR_DMABurstLength_5Transfers ((uint16_t)0x0400)
+#define TMR_DMABurstLength_6Transfers ((uint16_t)0x0500)
+#define TMR_DMABurstLength_7Transfers ((uint16_t)0x0600)
+#define TMR_DMABurstLength_8Transfers ((uint16_t)0x0700)
+#define TMR_DMABurstLength_9Transfers ((uint16_t)0x0800)
+#define TMR_DMABurstLength_10Transfers ((uint16_t)0x0900)
+#define TMR_DMABurstLength_11Transfers ((uint16_t)0x0A00)
+#define TMR_DMABurstLength_12Transfers ((uint16_t)0x0B00)
+#define TMR_DMABurstLength_13Transfers ((uint16_t)0x0C00)
+#define TMR_DMABurstLength_14Transfers ((uint16_t)0x0D00)
+#define TMR_DMABurstLength_15Transfers ((uint16_t)0x0E00)
+#define TMR_DMABurstLength_16Transfers ((uint16_t)0x0F00)
+#define TMR_DMABurstLength_17Transfers ((uint16_t)0x1000)
+#define TMR_DMABurstLength_18Transfers ((uint16_t)0x1100)
+#define IS_TMR_DMA_LENGTH(LENGTH) (((LENGTH) == TMR_DMABurstLength_1Transfer) || \
+ ((LENGTH) == TMR_DMABurstLength_2Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_3Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_4Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_5Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_6Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_7Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_8Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_9Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_10Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_11Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_12Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_13Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_14Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_15Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_16Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_17Transfers) || \
+ ((LENGTH) == TMR_DMABurstLength_18Transfers))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_DMA_sources
+ * @{
+ */
+
+#define TMR_DMA_Update ((uint16_t)0x0100)
+#define TMR_DMA_CC1 ((uint16_t)0x0200)
+#define TMR_DMA_CC2 ((uint16_t)0x0400)
+#define TMR_DMA_CC3 ((uint16_t)0x0800)
+#define TMR_DMA_CC4 ((uint16_t)0x1000)
+#define TMR_DMA_HALL ((uint16_t)0x2000)
+#define TMR_DMA_Trigger ((uint16_t)0x4000)
+#define IS_TMR_DMA_SOURCE(SOURCE) ((((SOURCE) & (uint16_t)0x80FF) == 0x0000) && ((SOURCE) != 0x0000))
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_External_Trigger_Prescaler
+ * @{
+ */
+
+#define TMR_ExtTRGDIV_OFF ((uint16_t)0x0000)
+#define TMR_ExtTRGDIV_DIV2 ((uint16_t)0x1000)
+#define TMR_ExtTRGDIV_DIV4 ((uint16_t)0x2000)
+#define TMR_ExtTRGDIV_DIV8 ((uint16_t)0x3000)
+#define IS_TMR_EXT_DIV(DIV) (((DIV) == TMR_ExtTRGDIV_OFF) || \
+ ((DIV) == TMR_ExtTRGDIV_DIV2) || \
+ ((DIV) == TMR_ExtTRGDIV_DIV4) || \
+ ((DIV) == TMR_ExtTRGDIV_DIV8))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Internal_Trigger_Selection
+ * @{
+ */
+
+#define TMR_TRGSEL_ITR0 ((uint16_t)0x0000)
+#define TMR_TRGSEL_ITR1 ((uint16_t)0x0010)
+#define TMR_TRGSEL_ITR2 ((uint16_t)0x0020)
+#define TMR_TRGSEL_ITR3 ((uint16_t)0x0030)
+#define TMR_TRGSEL_TI1F_ED ((uint16_t)0x0040)
+#define TMR_TRGSEL_TI1FP1 ((uint16_t)0x0050)
+#define TMR_TRGSEL_TI2FP2 ((uint16_t)0x0060)
+#define TMR_TRGSEL_ETRF ((uint16_t)0x0070)
+#define IS_TMR_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TMR_TRGSEL_ITR0) || \
+ ((SELECTION) == TMR_TRGSEL_ITR1) || \
+ ((SELECTION) == TMR_TRGSEL_ITR2) || \
+ ((SELECTION) == TMR_TRGSEL_ITR3) || \
+ ((SELECTION) == TMR_TRGSEL_TI1F_ED) || \
+ ((SELECTION) == TMR_TRGSEL_TI1FP1) || \
+ ((SELECTION) == TMR_TRGSEL_TI2FP2) || \
+ ((SELECTION) == TMR_TRGSEL_ETRF))
+#define IS_TMR_INTERNAL_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TMR_TRGSEL_ITR0) || \
+ ((SELECTION) == TMR_TRGSEL_ITR1) || \
+ ((SELECTION) == TMR_TRGSEL_ITR2) || \
+ ((SELECTION) == TMR_TRGSEL_ITR3))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_TIx_External_Clock_Source
+ * @{
+ */
+
+#define TMR_TIxExternalCLK1Source_TI1 ((uint16_t)0x0050)
+#define TMR_TIxExternalCLK1Source_TI2 ((uint16_t)0x0060)
+#define TMR_TIxExternalCLK1Source_TI1ED ((uint16_t)0x0040)
+#define IS_TMR_TIXCLK_SOURCE(SOURCE) (((SOURCE) == TMR_TIxExternalCLK1Source_TI1) || \
+ ((SOURCE) == TMR_TIxExternalCLK1Source_TI2) || \
+ ((SOURCE) == TMR_TIxExternalCLK1Source_TI1ED))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_External_Trigger_Polarity
+ * @{
+ */
+#define TMR_ExtTRGPolarity_Inverted ((uint16_t)0x8000)
+#define TMR_ExtTRGPolarity_NonInverted ((uint16_t)0x0000)
+#define IS_TMR_EXT_POLARITY(POLARITY) (((POLARITY) == TMR_ExtTRGPolarity_Inverted) || \
+ ((POLARITY) == TMR_ExtTRGPolarity_NonInverted))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Prescaler_Reload_Mode
+ * @{
+ */
+
+#define TMR_DIVReloadMode_Update ((uint16_t)0x0000)
+#define TMR_DIVReloadMode_Immediate ((uint16_t)0x0001)
+#define IS_TMR_DIV_RELOAD(RELOAD) (((RELOAD) == TMR_DIVReloadMode_Update) || \
+ ((RELOAD) == TMR_DIVReloadMode_Immediate))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Forced_Action
+ * @{
+ */
+
+#define TMR_ForcedAction_Active ((uint16_t)0x0050)
+#define TMR_ForcedAction_InActive ((uint16_t)0x0040)
+#define IS_TMR_FORCED_ACTION(ACTION) (((ACTION) == TMR_ForcedAction_Active) || \
+ ((ACTION) == TMR_ForcedAction_InActive))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Encoder_Mode
+ * @{
+ */
+
+#define TMR_EncoderMode_TI1 ((uint16_t)0x0001)
+#define TMR_EncoderMode_TI2 ((uint16_t)0x0002)
+#define TMR_EncoderMode_TI12 ((uint16_t)0x0003)
+#define IS_TMR_ENCODER_MODE(MODE) (((MODE) == TMR_EncoderMode_TI1) || \
+ ((MODE) == TMR_EncoderMode_TI2) || \
+ ((MODE) == TMR_EncoderMode_TI12))
+/**
+ * @}
+ */
+
+
+/** @defgroup TMR_Event_Source
+ * @{
+ */
+
+#define TMR_EventSource_Update ((uint16_t)0x0001)
+#define TMR_EventSource_CC1 ((uint16_t)0x0002)
+#define TMR_EventSource_CC2 ((uint16_t)0x0004)
+#define TMR_EventSource_CC3 ((uint16_t)0x0008)
+#define TMR_EventSource_CC4 ((uint16_t)0x0010)
+#define TMR_EventSource_HALL ((uint16_t)0x0020)
+#define TMR_EventSource_Trigger ((uint16_t)0x0040)
+#define TMR_EventSource_Break ((uint16_t)0x0080)
+#define IS_TMR_EVENT_SOURCE(SOURCE) ((((SOURCE) & (uint16_t)0xFF00) == 0x0000) && ((SOURCE) != 0x0000))
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Update_Source
+ * @{
+ */
+
+#define TMR_UpdateSource_Global ((uint16_t)0x0000) /*!< Source of update is the counter overflow/underflow
+ or the setting of UG bit, or an update generation
+ through the slave mode controller. */
+#define TMR_UpdateSource_Regular ((uint16_t)0x0001) /*!< Source of update is counter overflow/underflow. */
+#define IS_TMR_UPDATE_SOURCE(SOURCE) (((SOURCE) == TMR_UpdateSource_Global) || \
+ ((SOURCE) == TMR_UpdateSource_Regular))
+/**
+ * @}
+ */
+
+/** @defgroup TIM_Plus_Mode__State
+ * @{
+ */
+
+#define TMR_Plus_Mode_Enable ((uint16_t)0x0400)
+#define TMR_Plus_Mode_Disable ((uint16_t)0x0000)
+#define IS_TMR_PLUS_MODE_STATE(STATE) (((STATE) == TMR_Plus_Mode_Enable) || \
+ ((STATE) == TMR_Plus_Mode_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Output_Compare_Preload_State
+ * @{
+ */
+
+#define TMR_OCPreload_Enable ((uint16_t)0x0008)
+#define TMR_OCPreload_Disable ((uint16_t)0x0000)
+#define IS_TMR_OCPRELOAD_STATE(STATE) (((STATE) == TMR_OCPreload_Enable) || \
+ ((STATE) == TMR_OCPreload_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Output_Compare_Fast_State
+ * @{
+ */
+
+#define TMR_OCFast_Enable ((uint16_t)0x0004)
+#define TMR_OCFast_Disable ((uint16_t)0x0000)
+#define IS_TMR_OCFAST_STATE(STATE) (((STATE) == TMR_OCFast_Enable) || \
+ ((STATE) == TMR_OCFast_Disable))
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Output_Compare_Clear_State
+ * @{
+ */
+
+#define TMR_OCClear_Enable ((uint16_t)0x0080)
+#define TMR_OCClear_Disable ((uint16_t)0x0000)
+#define IS_TMR_OCCLEAR_STATE(STATE) (((STATE) == TMR_OCClear_Enable) || \
+ ((STATE) == TMR_OCClear_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Trigger_Output_Source
+ * @{
+ */
+
+#define TMR_TRGOSource_Reset ((uint16_t)0x0000)
+#define TMR_TRGOSource_Enable ((uint16_t)0x0010)
+#define TMR_TRGOSource_Update ((uint16_t)0x0020)
+#define TMR_TRGOSource_OC1 ((uint16_t)0x0030)
+#define TMR_TRGOSource_OC1Ref ((uint16_t)0x0040)
+#define TMR_TRGOSource_OC2Ref ((uint16_t)0x0050)
+#define TMR_TRGOSource_OC3Ref ((uint16_t)0x0060)
+#define TMR_TRGOSource_OC4Ref ((uint16_t)0x0070)
+#define IS_TMR_TRGO_SOURCE(SOURCE) (((SOURCE) == TMR_TRGOSource_Reset) || \
+ ((SOURCE) == TMR_TRGOSource_Enable) || \
+ ((SOURCE) == TMR_TRGOSource_Update) || \
+ ((SOURCE) == TMR_TRGOSource_OC1) || \
+ ((SOURCE) == TMR_TRGOSource_OC1Ref) || \
+ ((SOURCE) == TMR_TRGOSource_OC2Ref) || \
+ ((SOURCE) == TMR_TRGOSource_OC3Ref) || \
+ ((SOURCE) == TMR_TRGOSource_OC4Ref))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Slave_Mode
+ * @{
+ */
+
+#define TMR_SlaveMode_Reset ((uint16_t)0x0004)
+#define TMR_SlaveMode_Gate ((uint16_t)0x0005)
+#define TMR_SlaveMode_Trigger ((uint16_t)0x0006)
+#define TMR_SlaveMode_External1 ((uint16_t)0x0007)
+#define IS_TMR_SLAVE_MODE(MODE) (((MODE) == TMR_SlaveMode_Reset) || \
+ ((MODE) == TMR_SlaveMode_Gate) || \
+ ((MODE) == TMR_SlaveMode_Trigger) || \
+ ((MODE) == TMR_SlaveMode_External1))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Master_Slave_Mode
+ * @{
+ */
+
+#define TMR_MasterSlaveMode_Enable ((uint16_t)0x0080)
+#define TMR_MasterSlaveMode_Disable ((uint16_t)0x0000)
+#define IS_TMR_MSMODE_STATE(STATE) (((STATE) == TMR_MasterSlaveMode_Enable) || \
+ ((STATE) == TMR_MasterSlaveMode_Disable))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Flags
+ * @{
+ */
+
+#define TMR_FLAG_Update ((uint16_t)0x0001)
+#define TMR_FLAG_CC1 ((uint16_t)0x0002)
+#define TMR_FLAG_CC2 ((uint16_t)0x0004)
+#define TMR_FLAG_CC3 ((uint16_t)0x0008)
+#define TMR_FLAG_CC4 ((uint16_t)0x0010)
+#define TMR_FLAG_HALL ((uint16_t)0x0020)
+#define TMR_FLAG_Trigger ((uint16_t)0x0040)
+#define TMR_FLAG_Break ((uint16_t)0x0080)
+#define TMR_FLAG_C1OF ((uint16_t)0x0200)
+#define TMR_FLAG_C2OF ((uint16_t)0x0400)
+#define TMR_FLAG_C3OF ((uint16_t)0x0800)
+#define TMR_FLAG_C4OF ((uint16_t)0x1000)
+#define IS_TMR_GET_FLAG(FLAG) (((FLAG) == TMR_FLAG_Update) || \
+ ((FLAG) == TMR_FLAG_CC1) || \
+ ((FLAG) == TMR_FLAG_CC2) || \
+ ((FLAG) == TMR_FLAG_CC3) || \
+ ((FLAG) == TMR_FLAG_CC4) || \
+ ((FLAG) == TMR_FLAG_HALL) || \
+ ((FLAG) == TMR_FLAG_Trigger) || \
+ ((FLAG) == TMR_FLAG_Break) || \
+ ((FLAG) == TMR_FLAG_C1OF) || \
+ ((FLAG) == TMR_FLAG_C2OF) || \
+ ((FLAG) == TMR_FLAG_C3OF) || \
+ ((FLAG) == TMR_FLAG_C4OF))
+
+
+#define IS_TMR_CLEAR_FLAG(TMR_FLAG) ((((TMR_FLAG) & (uint16_t)0xE100) == 0x0000) && ((TMR_FLAG) != 0x0000))
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Input_Capture_Filer_Value
+ * @{
+ */
+
+#define IS_TMR_IC_FILTER(ICFILTER) ((ICFILTER) <= 0xF)
+/**
+ * @}
+ */
+
+/** @defgroup TMR_External_Trigger_Filter
+ * @{
+ */
+
+#define IS_TMR_EXT_FILTER(EXTFILTER) ((EXTFILTER) <= 0xF)
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Legacy
+ * @{
+ */
+
+#define TMR_DMABurstLength_1Byte TMR_DMABurstLength_1Transfer
+#define TMR_DMABurstLength_2Bytes TMR_DMABurstLength_2Transfers
+#define TMR_DMABurstLength_3Bytes TMR_DMABurstLength_3Transfers
+#define TMR_DMABurstLength_4Bytes TMR_DMABurstLength_4Transfers
+#define TMR_DMABurstLength_5Bytes TMR_DMABurstLength_5Transfers
+#define TMR_DMABurstLength_6Bytes TMR_DMABurstLength_6Transfers
+#define TMR_DMABurstLength_7Bytes TMR_DMABurstLength_7Transfers
+#define TMR_DMABurstLength_8Bytes TMR_DMABurstLength_8Transfers
+#define TMR_DMABurstLength_9Bytes TMR_DMABurstLength_9Transfers
+#define TMR_DMABurstLength_10Bytes TMR_DMABurstLength_10Transfers
+#define TMR_DMABurstLength_11Bytes TMR_DMABurstLength_11Transfers
+#define TMR_DMABurstLength_12Bytes TMR_DMABurstLength_12Transfers
+#define TMR_DMABurstLength_13Bytes TMR_DMABurstLength_13Transfers
+#define TMR_DMABurstLength_14Bytes TMR_DMABurstLength_14Transfers
+#define TMR_DMABurstLength_15Bytes TMR_DMABurstLength_15Transfers
+#define TMR_DMABurstLength_16Bytes TMR_DMABurstLength_16Transfers
+#define TMR_DMABurstLength_17Bytes TMR_DMABurstLength_17Transfers
+#define TMR_DMABurstLength_18Bytes TMR_DMABurstLength_18Transfers
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Exported_Functions
+ * @{
+ */
+
+void TMR_Reset(TMR_Type* TMRx);
+void TMR_TimeBaseInit(TMR_Type* TMRx, TMR_TimerBaseInitType* TMR_TimeBaseInitStruct);
+void TMR_OC1Init(TMR_Type* TMRx, TMR_OCInitType* TMR_OCInitStruct);
+void TMR_OC2Init(TMR_Type* TMRx, TMR_OCInitType* TMR_OCInitStruct);
+void TMR_OC3Init(TMR_Type* TMRx, TMR_OCInitType* TMR_OCInitStruct);
+void TMR_OC4Init(TMR_Type* TMRx, TMR_OCInitType* TMR_OCInitStruct);
+void TMR_ICInit(TMR_Type* TMRx, TMR_ICInitType* TMR_ICInitStruct);
+void TMR_PWMIConfig(TMR_Type* TMRx, TMR_ICInitType* TMR_ICInitStruct);
+void TMR_BRKDTConfig(TMR_Type* TMRx, TMR_BRKDTInitType *TMR_BDTRInitStruct);
+void TMR_TimeBaseStructInit(TMR_TimerBaseInitType* TMR_TimeBaseInitStruct);
+void TMR_OCStructInit(TMR_OCInitType* TMR_OCInitStruct);
+void TMR_ICStructInit(TMR_ICInitType* TMR_ICInitStruct);
+void TMR_BRKDTStructInit(TMR_BRKDTInitType* TMR_BDTRInitStruct);
+void TMR_Cmd(TMR_Type* TMRx, FunctionalState NewState);
+void TMR_CtrlPWMOutputs(TMR_Type* TMRx, FunctionalState NewState);
+void TMR_INTConfig(TMR_Type* TMRx, uint16_t TMR_INT, FunctionalState NewState);
+void TMR_GenerateEvent(TMR_Type* TMRx, uint16_t TMR_EventSource);
+void TMR_DMAConfig(TMR_Type* TMRx, uint16_t TMR_DMABase, uint16_t TMR_DMABurstLength);
+void TMR_DMACmd(TMR_Type* TMRx, uint16_t TMR_DMASource, FunctionalState NewState);
+void TMR_InternalClockConfig(TMR_Type* TMRx);
+void TMR_ITRxExternalClockConfig(TMR_Type* TMRx, uint16_t TMR_InputTriggerSource);
+void TMR_TIxExternalClockConfig(TMR_Type* TMRx, uint16_t TMR_TIxExternalCLKSource,
+ uint16_t TMR_ICPolarity, uint16_t ICFilter);
+void TMR_ETRClockMode1Config(TMR_Type* TMRx, uint16_t TMR_ExtTRGPrescaler, uint16_t TMR_ExtTRGPolarity,
+ uint16_t ExtTRGFilter);
+void TMR_ETRClockMode2Config(TMR_Type* TMRx, uint16_t TMR_ExtTRGPrescaler,
+ uint16_t TMR_ExtTRGPolarity, uint16_t ExtTRGFilter);
+void TMR_ETRConfig(TMR_Type* TMRx, uint16_t TMR_ExtTRGPrescaler, uint16_t TMR_ExtTRGPolarity,
+ uint16_t ExtTRGFilter);
+void TMR_DIVConfig(TMR_Type* TMRx, uint16_t Prescaler, uint16_t TMR_PSCReloadMode);
+void TMR_CounterModeConfig(TMR_Type* TMRx, uint16_t TMR_CounterMode);
+void TMR_SelectInputTrigger(TMR_Type* TMRx, uint16_t TMR_InputTriggerSource);
+void TMR_EncoderInterfaceConfig(TMR_Type* TMRx, uint16_t TMR_EncoderMode,
+ uint16_t TMR_IC1Polarity, uint16_t TMR_IC2Polarity);
+void TMR_ForcedOC1Config(TMR_Type* TMRx, uint16_t TMR_ForcedAction);
+void TMR_ForcedOC2Config(TMR_Type* TMRx, uint16_t TMR_ForcedAction);
+void TMR_ForcedOC3Config(TMR_Type* TMRx, uint16_t TMR_ForcedAction);
+void TMR_ForcedOC4Config(TMR_Type* TMRx, uint16_t TMR_ForcedAction);
+void TMR_ARPreloadConfig(TMR_Type* TMRx, FunctionalState NewState);
+void TMR_SelectHALL(TMR_Type* TMRx, FunctionalState NewState);
+void TMR_SelectCCDMA(TMR_Type* TMRx, FunctionalState NewState);
+void TMR_CCPreloadControl(TMR_Type* TMRx, FunctionalState NewState);
+void TMR_OC1PreloadConfig(TMR_Type* TMRx, uint16_t TMR_OCPreload);
+void TMR_OC2PreloadConfig(TMR_Type* TMRx, uint16_t TMR_OCPreload);
+void TMR_OC3PreloadConfig(TMR_Type* TMRx, uint16_t TMR_OCPreload);
+void TMR_OC4PreloadConfig(TMR_Type* TMRx, uint16_t TMR_OCPreload);
+void TMR_OC1FastConfig(TMR_Type* TMRx, uint16_t TMR_OCFast);
+void TMR_OC2FastConfig(TMR_Type* TMRx, uint16_t TMR_OCFast);
+void TMR_OC3FastConfig(TMR_Type* TMRx, uint16_t TMR_OCFast);
+void TMR_OC4FastConfig(TMR_Type* TMRx, uint16_t TMR_OCFast);
+void TMR_ClearOC1Ref(TMR_Type* TMRx, uint16_t TMR_OCClear);
+void TMR_ClearOC2Ref(TMR_Type* TMRx, uint16_t TMR_OCClear);
+void TMR_ClearOC3Ref(TMR_Type* TMRx, uint16_t TMR_OCClear);
+void TMR_ClearOC4Ref(TMR_Type* TMRx, uint16_t TMR_OCClear);
+void TMR_OC1PolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCPolarity);
+void TMR_OC1NPolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCNPolarity);
+void TMR_OC2PolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCPolarity);
+void TMR_OC2NPolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCNPolarity);
+void TMR_OC3PolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCPolarity);
+void TMR_OC3NPolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCNPolarity);
+void TMR_OC4PolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCPolarity);
+void TMR_CCxCmd(TMR_Type* TMRx, uint16_t TMR_Channel, uint16_t TMR_CCx);
+void TMR_CCxNCmd(TMR_Type* TMRx, uint16_t TMR_Channel, uint16_t TMR_CCxN);
+void TMR_SelectOCxM(TMR_Type* TMRx, uint16_t TMR_Channel, uint16_t TMR_OCMode);
+void TMR_UpdateDisableConfig(TMR_Type* TMRx, FunctionalState NewState);
+void TMR_UpdateRequestConfig(TMR_Type* TMRx, uint16_t TMR_UpdateSource);
+void TMR_SelectHallSensor(TMR_Type* TMRx, FunctionalState NewState);
+void TMR_SelectOnePulseMode(TMR_Type* TMRx, uint16_t TMR_OPMode);
+void TMR_SelectPlusMode(TMR_Type* TIMx, uint16_t TIMX_PLUS_MODE_STATE);
+void TMR_SelectOutputTrigger(TMR_Type* TMRx, uint16_t TMR_TRGOSource);
+void TMR_SelectSlaveMode(TMR_Type* TMRx, uint16_t TMR_SlaveMode);
+void TMR_SelectMasterSlaveMode(TMR_Type* TMRx, uint16_t TMR_MasterSlaveMode);
+void TMR_SetCounter(TMR_Type* TMRx, uint32_t Counter);
+void TMR_SetAutoreload(TMR_Type* TMRx, uint32_t Autoreload);
+void TMR_SetCompare1(TMR_Type* TMRx, uint32_t Compare1);
+void TMR_SetCompare2(TMR_Type* TMRx, uint32_t Compare2);
+void TMR_SetCompare3(TMR_Type* TMRx, uint32_t Compare3);
+void TMR_SetCompare4(TMR_Type* TMRx, uint32_t Compare4);
+void TMR_SetIC1DIV(TMR_Type* TMRx, uint16_t TMR_ICPSC);
+void TMR_SetIC2DIV(TMR_Type* TMRx, uint16_t TMR_ICPSC);
+void TMR_SetIC3DIV(TMR_Type* TMRx, uint16_t TMR_ICPSC);
+void TMR_SetIC4DIV(TMR_Type* TMRx, uint16_t TMR_ICPSC);
+void TMR_SetClockDivision(TMR_Type* TMRx, uint16_t TMR_CKD);
+uint32_t TMR_GetCapture1(TMR_Type* TMRx);
+uint32_t TMR_GetCapture2(TMR_Type* TMRx);
+uint32_t TMR_GetCapture3(TMR_Type* TMRx);
+uint32_t TMR_GetCapture4(TMR_Type* TMRx);
+uint32_t TMR_GetCounter(TMR_Type* TMRx);
+uint16_t TMR_GetDIV(TMR_Type* TMRx);
+FlagStatus TMR_GetFlagStatus(TMR_Type* TMRx, uint16_t TMR_FLAG);
+void TMR_ClearFlag(TMR_Type* TMRx, uint16_t TMR_FLAG);
+ITStatus TMR_GetINTStatus(TMR_Type* TMRx, uint16_t TMR_INT);
+void TMR_ClearITPendingBit(TMR_Type* TMRx, uint16_t TMR_INT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__AT32F4xx_TIM_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_usart.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_usart.h
new file mode 100644
index 0000000000000000000000000000000000000000..1977cd86603834ad35c5f0e06450b1dee67bc154
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_usart.h
@@ -0,0 +1,400 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_usart.h
+ * Description : at32f4xx USART header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_USART_H
+#define __AT32F4xx_USART_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup USART
+ * @{
+ */
+
+/** @defgroup USART_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief USART Init Structure definition
+ */
+
+typedef struct
+{
+ uint32_t USART_BaudRate; /*!< This member configures the USART communication baud rate.
+ The baud rate is computed using the following formula:
+ - IntegerDivider = ((PCLKx) / (16 * (USART_InitStruct->USART_BaudRate)))
+ - FractionalDivider = ((IntegerDivider - ((u32) IntegerDivider)) * 16) + 0.5 */
+
+ uint16_t USART_WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
+ This parameter can be a value of @ref USART_Word_Length */
+
+ uint16_t USART_StopBits; /*!< Specifies the number of stop bits transmitted.
+ This parameter can be a value of @ref USART_Stop_Bits */
+
+ uint16_t USART_Parity; /*!< Specifies the parity mode.
+ This parameter can be a value of @ref USART_Parity
+ @note When parity is enabled, the computed parity is inserted
+ at the MSB position of the transmitted data (9th bit when
+ the word length is set to 9 data bits; 8th bit when the
+ word length is set to 8 data bits). */
+
+ uint16_t USART_Mode; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled.
+ This parameter can be a value of @ref USART_Mode */
+
+ uint16_t USART_HardwareFlowControl; /*!< Specifies wether the hardware flow control mode is enabled
+ or disabled.
+ This parameter can be a value of @ref USART_Hardware_Flow_Control */
+} USART_InitType;
+
+/**
+ * @brief USART Clock Init Structure definition
+ */
+
+typedef struct
+{
+
+ uint16_t USART_Clock; /*!< Specifies whether the USART clock is enabled or disabled.
+ This parameter can be a value of @ref USART_Clock */
+
+ uint16_t USART_CPOL; /*!< Specifies the steady state value of the serial clock.
+ This parameter can be a value of @ref USART_Clock_Polarity */
+
+ uint16_t USART_CPHA; /*!< Specifies the clock transition on which the bit capture is made.
+ This parameter can be a value of @ref USART_Clock_Phase */
+
+ uint16_t USART_LastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted
+ data bit (MSB) has to be output on the SCLK pin in synchronous mode.
+ This parameter can be a value of @ref USART_Last_Bit */
+} USART_ClockInitType;
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_Exported_Constants
+ * @{
+ */
+
+#define IS_USART_ALL_PERIPH(PERIPH) (((PERIPH) == USART1) || \
+ ((PERIPH) == USART2) || \
+ ((PERIPH) == USART3) || \
+ ((PERIPH) == UART4) || \
+ ((PERIPH) == UART5))
+
+#define IS_USART_123_PERIPH(PERIPH) (((PERIPH) == USART1) || \
+ ((PERIPH) == USART2) || \
+ ((PERIPH) == USART3))
+
+#define IS_USART_1234_PERIPH(PERIPH) (((PERIPH) == USART1) || \
+ ((PERIPH) == USART2) || \
+ ((PERIPH) == USART3) || \
+ ((PERIPH) == UART4))
+/** @defgroup USART_Word_Length
+ * @{
+ */
+
+#define USART_WordLength_8b ((uint16_t)0x0000)
+#define USART_WordLength_9b ((uint16_t)0x1000)
+
+#define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WordLength_8b) || \
+ ((LENGTH) == USART_WordLength_9b))
+/**
+ * @}
+ */
+
+/** @defgroup USART_Stop_Bits
+ * @{
+ */
+
+#define USART_StopBits_1 ((uint16_t)0x0000)
+#define USART_StopBits_0_5 ((uint16_t)0x1000)
+#define USART_StopBits_2 ((uint16_t)0x2000)
+#define USART_StopBits_1_5 ((uint16_t)0x3000)
+#define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_StopBits_1) || \
+ ((STOPBITS) == USART_StopBits_0_5) || \
+ ((STOPBITS) == USART_StopBits_2) || \
+ ((STOPBITS) == USART_StopBits_1_5))
+/**
+ * @}
+ */
+
+/** @defgroup USART_Parity
+ * @{
+ */
+
+#define USART_Parity_No ((uint16_t)0x0000)
+#define USART_Parity_Even ((uint16_t)0x0400)
+#define USART_Parity_Odd ((uint16_t)0x0600)
+#define IS_USART_PARITY(PARITY) (((PARITY) == USART_Parity_No) || \
+ ((PARITY) == USART_Parity_Even) || \
+ ((PARITY) == USART_Parity_Odd))
+/**
+ * @}
+ */
+
+/** @defgroup USART_Mode
+ * @{
+ */
+
+#define USART_Mode_Rx ((uint16_t)0x0004)
+#define USART_Mode_Tx ((uint16_t)0x0008)
+#define IS_USART_MODE(MODE) ((((MODE) & (uint16_t)0xFFF3) == 0x00) && ((MODE) != (uint16_t)0x00))
+/**
+ * @}
+ */
+
+/** @defgroup USART_Hardware_Flow_Control
+ * @{
+ */
+#define USART_HardwareFlowControl_None ((uint16_t)0x0000)
+#define USART_HardwareFlowControl_RTS ((uint16_t)0x0100)
+#define USART_HardwareFlowControl_CTS ((uint16_t)0x0200)
+#define USART_HardwareFlowControl_RTS_CTS ((uint16_t)0x0300)
+#define IS_USART_HARDWARE_FLOW_CONTROL(CONTROL)\
+ (((CONTROL) == USART_HardwareFlowControl_None) || \
+ ((CONTROL) == USART_HardwareFlowControl_RTS) || \
+ ((CONTROL) == USART_HardwareFlowControl_CTS) || \
+ ((CONTROL) == USART_HardwareFlowControl_RTS_CTS))
+/**
+ * @}
+ */
+
+/** @defgroup USART_Clock
+ * @{
+ */
+#define USART_Clock_Disable ((uint16_t)0x0000)
+#define USART_Clock_Enable ((uint16_t)0x0800)
+#define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_Clock_Disable) || \
+ ((CLOCK) == USART_Clock_Enable))
+/**
+ * @}
+ */
+
+/** @defgroup USART_Clock_Polarity
+ * @{
+ */
+
+#define USART_CPOL_Low ((uint16_t)0x0000)
+#define USART_CPOL_High ((uint16_t)0x0400)
+#define IS_USART_CPOL(CPOL) (((CPOL) == USART_CPOL_Low) || ((CPOL) == USART_CPOL_High))
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_Clock_Phase
+ * @{
+ */
+
+#define USART_CPHA_1Edge ((uint16_t)0x0000)
+#define USART_CPHA_2Edge ((uint16_t)0x0200)
+#define IS_USART_CPHA(CPHA) (((CPHA) == USART_CPHA_1Edge) || ((CPHA) == USART_CPHA_2Edge))
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_Last_Bit
+ * @{
+ */
+
+#define USART_LastBit_Disable ((uint16_t)0x0000)
+#define USART_LastBit_Enable ((uint16_t)0x0100)
+#define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LastBit_Disable) || \
+ ((LASTBIT) == USART_LastBit_Enable))
+/**
+ * @}
+ */
+
+/** @defgroup USART_Interrupt_definition
+ * @{
+ */
+
+#define USART_INT_PERR ((uint16_t)0x0028)
+#define USART_INT_TDE ((uint16_t)0x0727)
+#define USART_INT_TRAC ((uint16_t)0x0626)
+#define USART_INT_RDNE ((uint16_t)0x0525)
+#define USART_INT_IDLEF ((uint16_t)0x0424)
+#define USART_INT_LBDF ((uint16_t)0x0846)
+#define USART_INT_CTSF ((uint16_t)0x096A)
+#define USART_INT_ERR ((uint16_t)0x0060)
+#define USART_INT_ORERR ((uint16_t)0x0360)
+#define USART_INT_NERR ((uint16_t)0x0260)
+#define USART_INT_FERR ((uint16_t)0x0160)
+#define IS_USART_CONFIG_INT(INT) (((INT) == USART_INT_PERR) || ((INT) == USART_INT_TDE) || \
+ ((INT) == USART_INT_TRAC) || ((INT) == USART_INT_RDNE) || \
+ ((INT) == USART_INT_IDLEF) || ((INT) == USART_INT_LBDF) || \
+ ((INT) == USART_INT_CTSF) || ((INT) == USART_INT_ERR))
+#define IS_USART_GET_INT(INT) (((INT) == USART_INT_PERR) || ((INT) == USART_INT_TDE) || \
+ ((INT) == USART_INT_TRAC) || ((INT) == USART_INT_RDNE) || \
+ ((INT) == USART_INT_IDLEF) || ((INT) == USART_INT_LBDF) || \
+ ((INT) == USART_INT_CTSF) || ((INT) == USART_INT_ORERR) || \
+ ((INT) == USART_INT_NERR) || ((INT) == USART_INT_FERR))
+#define IS_USART_CLEAR_INT(INT) (((INT) == USART_INT_TRAC) || ((INT) == USART_INT_RDNE) || \
+ ((INT) == USART_INT_LBDF) || ((INT) == USART_INT_CTSF))
+/**
+ * @}
+ */
+
+/** @defgroup USART_DMA_Requests
+ * @{
+ */
+
+#define USART_DMAReq_Tx ((uint16_t)0x0080)
+#define USART_DMAReq_Rx ((uint16_t)0x0040)
+#define IS_USART_DMAREQ(DMAREQ) ((((DMAREQ) & (uint16_t)0xFF3F) == 0x00) && ((DMAREQ) != (uint16_t)0x00))
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_WakeUp_methods
+ * @{
+ */
+
+#define USART_WakeUp_IdleLine ((uint16_t)0x0000)
+#define USART_WakeUp_AddressMark ((uint16_t)0x0800)
+#define IS_USART_WAKEUP(WAKEUP) (((WAKEUP) == USART_WakeUp_IdleLine) || \
+ ((WAKEUP) == USART_WakeUp_AddressMark))
+/**
+ * @}
+ */
+
+/** @defgroup USART_LIN_Break_Detection_Length
+ * @{
+ */
+
+#define USART_LINBreakDetectLength_10b ((uint16_t)0x0000)
+#define USART_LINBreakDetectLength_11b ((uint16_t)0x0020)
+#define IS_USART_LIN_BREAK_DETECT_LENGTH(LENGTH) \
+ (((LENGTH) == USART_LINBreakDetectLength_10b) || \
+ ((LENGTH) == USART_LINBreakDetectLength_11b))
+/**
+ * @}
+ */
+
+/** @defgroup USART_IrDA_Low_Power
+ * @{
+ */
+
+#define USART_IrDAMode_LowPower ((uint16_t)0x0004)
+#define USART_IrDAMode_Normal ((uint16_t)0x0000)
+#define IS_USART_IRDA_MODE(MODE) (((MODE) == USART_IrDAMode_LowPower) || \
+ ((MODE) == USART_IrDAMode_Normal))
+/**
+ * @}
+ */
+
+/** @defgroup USART_Flags
+ * @{
+ */
+
+#define USART_FLAG_CTSF ((uint16_t)0x0200)
+#define USART_FLAG_LBDF ((uint16_t)0x0100)
+#define USART_FLAG_TDE ((uint16_t)0x0080)
+#define USART_FLAG_TRAC ((uint16_t)0x0040)
+#define USART_FLAG_RDNE ((uint16_t)0x0020)
+#define USART_FLAG_IDLEF ((uint16_t)0x0010)
+#define USART_FLAG_ORERR ((uint16_t)0x0008)
+#define USART_FLAG_NERR ((uint16_t)0x0004)
+#define USART_FLAG_FERR ((uint16_t)0x0002)
+#define USART_FLAG_PERR ((uint16_t)0x0001)
+#define IS_USART_FLAG(FLAG) (((FLAG) == USART_FLAG_PERR) || ((FLAG) == USART_FLAG_TDE) || \
+ ((FLAG) == USART_FLAG_TRAC) || ((FLAG) == USART_FLAG_RDNE) || \
+ ((FLAG) == USART_FLAG_IDLEF)|| ((FLAG) == USART_FLAG_LBDF) || \
+ ((FLAG) == USART_FLAG_CTSF) || ((FLAG) == USART_FLAG_ORERR) || \
+ ((FLAG) == USART_FLAG_NERR) || ((FLAG) == USART_FLAG_FERR))
+
+#define IS_USART_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFC9F) == 0x00) && ((FLAG) != (uint16_t)0x00))
+#define IS_USART_PERIPH_FLAG(PERIPH, USART_FLAG) ((((*(uint32_t*)&(PERIPH)) != UART4_BASE) &&\
+ ((*(uint32_t*)&(PERIPH)) != UART5_BASE)) \
+ || ((USART_FLAG) != USART_FLAG_CTSF))
+#define IS_USART_BAUDRATE(BAUDRATE) (((BAUDRATE) > 0) && ((BAUDRATE) < 0x0044AA21))
+#define IS_USART_ADDRESS(ADDRESS) ((ADDRESS) <= 0xF)
+#define IS_USART_DATA(DATA) ((DATA) <= 0x1FF)
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_Exported_Functions
+ * @{
+ */
+
+void USART_Reset(USART_Type* USARTx);
+void USART_Init(USART_Type* USARTx, USART_InitType* USART_InitStruct);
+void USART_StructInit(USART_InitType* USART_InitStruct);
+void USART_ClockInit(USART_Type* USARTx, USART_ClockInitType* USART_ClockInitStruct);
+void USART_ClockStructInit(USART_ClockInitType* USART_ClockInitStruct);
+void USART_Cmd(USART_Type* USARTx, FunctionalState NewState);
+void USART_INTConfig(USART_Type* USARTx, uint16_t USART_INT, FunctionalState NewState);
+void USART_DMACmd(USART_Type* USARTx, uint16_t USART_DMAReq, FunctionalState NewState);
+void USART_SetAddress(USART_Type* USARTx, uint8_t USART_Address);
+void USART_WakeUpConfig(USART_Type* USARTx, uint16_t USART_WakeUp);
+void USART_ReceiverWakeUpCmd(USART_Type* USARTx, FunctionalState NewState);
+void USART_LINBreakDetectLengthConfig(USART_Type* USARTx, uint16_t USART_LINBreakDetectLength);
+void USART_LINCmd(USART_Type* USARTx, FunctionalState NewState);
+void USART_SendData(USART_Type* USARTx, uint16_t Data);
+uint16_t USART_ReceiveData(USART_Type* USARTx);
+void USART_SendBreak(USART_Type* USARTx);
+void USART_SetGuardTime(USART_Type* USARTx, uint8_t USART_GuardTime);
+void USART_SetPrescaler(USART_Type* USARTx, uint8_t USART_Prescaler);
+void USART_SmartCardCmd(USART_Type* USARTx, FunctionalState NewState);
+void USART_SmartCardNACKCmd(USART_Type* USARTx, FunctionalState NewState);
+void USART_HalfDuplexCmd(USART_Type* USARTx, FunctionalState NewState);
+void USART_OverSampling8Cmd(USART_Type* USARTx, FunctionalState NewState);
+void USART_OneBitMethodCmd(USART_Type* USARTx, FunctionalState NewState);
+void USART_IrDAConfig(USART_Type* USARTx, uint16_t USART_IrDAMode);
+void USART_IrDACmd(USART_Type* USARTx, FunctionalState NewState);
+FlagStatus USART_GetFlagStatus(USART_Type* USARTx, uint16_t USART_FLAG);
+void USART_ClearFlag(USART_Type* USARTx, uint16_t USART_FLAG);
+ITStatus USART_GetITStatus(USART_Type* USARTx, uint16_t USART_INT);
+void USART_ClearITPendingBit(USART_Type* USARTx, uint16_t USART_INT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_USART_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_wwdg.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_wwdg.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa22a19fbe0a406a4e23a753a61b604bbe1f8959
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_wwdg.h
@@ -0,0 +1,103 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_wwdg.h
+ * Description : at32f4xx WWDG header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_WWDG_H
+#define __AT32F4xx_WWDG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup WWDG
+ * @{
+ */
+
+/** @defgroup WWDG_Exported_Types
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup WWDG_Exported_Constants
+ * @{
+ */
+
+/** @defgroup WWDG_Prescaler
+ * @{
+ */
+
+#define WWDG_Psc_1 ((uint32_t)0x00000000)
+#define WWDG_Psc_2 ((uint32_t)0x00000080)
+#define WWDG_Psc_4 ((uint32_t)0x00000100)
+#define WWDG_Psc_8 ((uint32_t)0x00000180)
+#define IS_WWDG_PSC(PSC) (((PSC) == WWDG_Psc_1) || \
+ ((PSC) == WWDG_Psc_2) || \
+ ((PSC) == WWDG_Psc_4) || \
+ ((PSC) == WWDG_Psc_8))
+#define IS_WWDG_WCNTR(WCNTR) ((WCNTR) <= 0x7F)
+#define IS_WWDG_CNTR(CNTR) (((CNTR) >= 0x40) && ((CNTR) <= 0x7F))
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup WWDG_Exported_Macros
+ * @{
+ */
+/**
+ * @}
+ */
+
+/** @defgroup WWDG_Exported_Functions
+ * @{
+ */
+
+void WWDG_Reset(void);
+void WWDG_SetPrescaler(uint32_t WWDG_Prescaler);
+void WWDG_SetWindowCounter(uint8_t WindowValue);
+void WWDG_EnableINT(void);
+void WWDG_SetCounter(uint8_t Counter);
+void WWDG_Enable(uint8_t Counter);
+FlagStatus WWDG_GetFlagStatus(void);
+void WWDG_ClearFlag(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_WWDG_H */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_xmc.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_xmc.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d9de95207724d2c7d95dc74a09925f4eb4f329d
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/at32f4xx_xmc.h
@@ -0,0 +1,739 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_xmc.h
+ * Description : at32f4xx XMC header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_XMC_H
+#define __AT32F4xx_XMC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup XMC
+ * @{
+ */
+
+/** @defgroup XMC_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief Timing parameters For NOR/SRAM Banks
+ */
+
+typedef struct
+{
+ uint32_t XMC_AdrOpTime; /*!< Defines the number of HCLK cycles to configure
+ the duration of the address setup time.
+ This parameter can be a value between 0 and 0xF.
+ @note: It is not used with synchronous NOR Flash memories. */
+
+ uint32_t XMC_AdrHoldTime; /*!< Defines the number of HCLK cycles to configure
+ the duration of the address hold time.
+ This parameter can be a value between 0 and 0xF.
+ @note: It is not used with synchronous NOR Flash memories.*/
+
+ uint32_t XMC_DataOpTime; /*!< Defines the number of HCLK cycles to configure
+ the duration of the data setup time.
+ This parameter can be a value between 0 and 0xFF.
+ @note: It is used for SRAMs, ROMs and asynchronous multiplexed NOR Flash memories. */
+
+ uint32_t XMC_IntervalBetweenOP; /*!< Defines the number of HCLK cycles to configure
+ the duration of the bus turnaround.
+ This parameter can be a value between 0 and 0xF.
+ @note: It is only used for multiplexed NOR Flash memories. */
+
+ uint32_t XMC_CLKPsc; /*!< Defines the period of CLK clock output signal, expressed in number of HCLK cycles.
+ This parameter can be a value between 1 and 0xF.
+ @note: This parameter is not used for asynchronous NOR Flash, SRAM or ROM accesses. */
+
+ uint32_t XMC_DataStableTime; /*!< Defines the number of memory clock cycles to issue
+ to the memory before getting the first data.
+ The value of this parameter depends on the memory type as shown below:
+ - It must be set to 0 in case of a CRAM
+ - It is don't care in asynchronous NOR, SRAM or ROM accesses
+ - It may assume a value between 0 and 0xF in NOR Flash memories
+ with synchronous burst mode enable */
+
+ uint32_t XMC_Mode; /*!< Specifies the asynchronous access mode.
+ This parameter can be a value of @ref XMC_Access_Mode */
+} XMC_NORSRAMTimingInitType;
+
+/**
+ * @brief XMC NOR/SRAM Init structure definition
+ */
+
+typedef struct
+{
+ uint32_t XMC_Bank; /*!< Specifies the NOR/SRAM memory bank that will be used.
+ This parameter can be a value of @ref XMC_NORSRAM_Bank */
+
+ uint32_t XMC_DataAdrMux; /*!< Specifies whether the address and data values are
+ multiplexed on the databus or not.
+ This parameter can be a value of @ref XMC_Data_Address_Bus_Multiplexing */
+
+ uint32_t XMC_Dev; /*!< Specifies the type of external memory attached to
+ the corresponding memory bank.
+ This parameter can be a value of @ref XMC_Memory_Type */
+
+ uint32_t XMC_BusType; /*!< Specifies the external memory device width.
+ This parameter can be a value of @ref XMC_Data_Width */
+
+ uint32_t XMC_EnableBurstMode; /*!< Enables or disables the burst access mode for Flash memory,
+ valid only with synchronous burst Flash memories.
+ This parameter can be a value of @ref XMC_Burst_Access_Mode */
+
+ uint32_t XMC_EnableAsynWait; /*!< Enables or disables wait signal during asynchronous transfers,
+ valid only with asynchronous Flash memories.
+ This parameter can be a value of @ref XMC_EnableAsynWait */
+
+ uint32_t XMC_WaitSignalLv; /*!< Specifies the wait signal polarity, valid only when accessing
+ the Flash memory in burst mode.
+ This parameter can be a value of @ref XMC_Wait_Signal_Polarity */
+
+ uint32_t XMC_EnableBurstModeSplit; /*!< Enables or disables the Wrapped burst access mode for Flash
+ memory, valid only when accessing Flash memories in burst mode.
+ This parameter can be a value of @ref XMC_Wrap_Mode */
+
+ uint32_t XMC_WaitSignalConfig; /*!< Specifies if the wait signal is asserted by the memory one
+ clock cycle before the wait state or during the wait state,
+ valid only when accessing memories in burst mode.
+ This parameter can be a value of @ref XMC_Wait_Timing */
+
+ uint32_t XMC_EnableWrite; /*!< Enables or disables the write operation in the selected bank by the XMC.
+ This parameter can be a value of @ref XMC_Write_Operation */
+
+ uint32_t XMC_EnableWaitSignal; /*!< Enables or disables the wait-state insertion via wait
+ signal, valid for Flash memory access in burst mode.
+ This parameter can be a value of @ref XMC_Wait_Signal */
+
+ uint32_t XMC_EnableWriteTiming; /*!< Enables or disables the extended mode.
+ This parameter can be a value of @ref XMC_Extended_Mode */
+
+ uint32_t XMC_WriteBurstSyn; /*!< Enables or disables the write burst operation.
+ This parameter can be a value of @ref XMC_Write_Burst */
+
+ XMC_NORSRAMTimingInitType* XMC_RWTimingStruct; /*!< Timing Parameters for write and read access if the ExtendedMode is not used*/
+
+ XMC_NORSRAMTimingInitType* XMC_WTimingStruct; /*!< Timing Parameters for write access if the ExtendedMode is used*/
+} XMC_NORSRAMInitType;
+
+/**
+ * @brief Timing parameters For XMC NAND and PCCARD Banks
+ */
+
+typedef struct
+{
+ uint32_t XMC_SetupTime; /*!< Defines the number of HCLK cycles to setup address before
+ the command assertion for NAND-Flash read or write access
+ to common/Attribute or I/O memory space (depending on
+ the memory space timing to be configured).
+ This parameter can be a value between 0 and 0xFF.*/
+
+ uint32_t XMC_OpTime; /*!< Defines the minimum number of HCLK cycles to assert the
+ command for NAND-Flash read or write access to
+ common/Attribute or I/O memory space (depending on the
+ memory space timing to be configured).
+ This parameter can be a number between 0x00 and 0xFF */
+
+ uint32_t XMC_HoldTime; /*!< Defines the number of HCLK clock cycles to hold address
+ (and data for write access) after the command deassertion
+ for NAND-Flash read or write access to common/Attribute
+ or I/O memory space (depending on the memory space timing
+ to be configured).
+ This parameter can be a number between 0x00 and 0xFF */
+
+ uint32_t XMC_WriteSetupTime; /*!< Defines the number of HCLK clock cycles during which the
+ databus is kept in HiZ after the start of a NAND-Flash
+ write access to common/Attribute or I/O memory space (depending
+ on the memory space timing to be configured).
+ This parameter can be a number between 0x00 and 0xFF */
+} XMC_NAND_PCCARDTimingInitType;
+
+/**
+ * @brief XMC NAND Init structure definition
+ */
+
+typedef struct
+{
+ uint32_t XMC_Bank; /*!< Specifies the NAND memory bank that will be used.
+ This parameter can be a value of @ref XMC_NAND_Bank */
+
+ uint32_t XMC_EnableWait; /*!< Enables or disables the Wait feature for the NAND Memory Bank.
+ This parameter can be any value of @ref XMC_Wait_feature */
+
+ uint32_t XMC_BusType; /*!< Specifies the external memory device width.
+ This parameter can be any value of @ref XMC_Data_Width */
+
+ uint32_t XMC_EnableECC; /*!< Enables or disables the ECC computation.
+ This parameter can be any value of @ref XMC_EnableECC */
+
+ uint32_t XMC_ECCPageSize; /*!< Defines the page size for the extended ECC.
+ This parameter can be any value of @ref XMC_ECC_Page_Size */
+
+ uint32_t XMC_DelayTimeCR; /*!< Defines the number of HCLK cycles to configure the
+ delay between CLE low and RE low.
+ This parameter can be a value between 0 and 0xFF. */
+
+ uint32_t XMC_DelayTimeAR; /*!< Defines the number of HCLK cycles to configure the
+ delay between ALE low and RE low.
+ This parameter can be a number between 0x0 and 0xFF */
+
+ XMC_NAND_PCCARDTimingInitType* XMC_CommonSpaceTimingStruct; /*!< XMC Common Space Timing */
+
+ XMC_NAND_PCCARDTimingInitType* XMC_AttributeSpaceTimingStruct; /*!< XMC Attribute Space Timing */
+} XMC_NANDInitType;
+
+/**
+ * @brief XMC PCCARD Init structure definition
+ */
+
+typedef struct
+{
+ uint32_t XMC_EnableWait; /*!< Enables or disables the Wait feature for the Memory Bank.
+ This parameter can be any value of @ref XMC_Wait_feature */
+
+ uint32_t XMC_DelayTimeCR; /*!< Defines the number of HCLK cycles to configure the
+ delay between CLE low and RE low.
+ This parameter can be a value between 0 and 0xFF. */
+
+ uint32_t XMC_DelayTimeAR; /*!< Defines the number of HCLK cycles to configure the
+ delay between ALE low and RE low.
+ This parameter can be a number between 0x0 and 0xFF */
+
+
+ XMC_NAND_PCCARDTimingInitType* XMC_CommonSpaceTimingStruct; /*!< XMC Common Space Timing */
+
+ XMC_NAND_PCCARDTimingInitType* XMC_AttributeSpaceTimingStruct; /*!< XMC Attribute Space Timing */
+
+ XMC_NAND_PCCARDTimingInitType* XMC_IOSpaceTimingStruct; /*!< XMC IO Space Timing */
+} XMC_PCCARDInitType;
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Exported_Constants
+ * @{
+ */
+
+/** @defgroup XMC_NORSRAM_Bank
+ * @{
+ */
+#define XMC_Bank1_NORSRAM1 ((uint32_t)0x00000000)
+#define XMC_Bank1_NORSRAM2 ((uint32_t)0x00000002)
+#define XMC_Bank1_NORSRAM3 ((uint32_t)0x00000004)
+#define XMC_Bank1_NORSRAM4 ((uint32_t)0x00000006)
+/**
+ * @}
+ */
+
+/** @defgroup XMC_SubBank
+ * @{
+ */
+#define XMC_SubBank1_NORSRAM1 ((uint32_t)0x00000000)
+#define XMC_SubBank1_NORSRAM2 ((uint32_t)0x00000001)
+#define XMC_SubBank1_NORSRAM3 ((uint32_t)0x00000002)
+#define XMC_SubBank1_NORSRAM4 ((uint32_t)0x00000003)
+/**
+ * @}
+ */
+
+
+/** @defgroup XMC_NAND_Bank
+ * @{
+ */
+#define XMC_Bank2_NAND ((uint32_t)0x00000010)
+#define XMC_Bank3_NAND ((uint32_t)0x00000100)
+/**
+ * @}
+ */
+
+/** @defgroup XMC_PCCARD_Bank
+ * @{
+ */
+#define XMC_Bank4_PCCARD ((uint32_t)0x00001000)
+/**
+ * @}
+ */
+
+#define IS_XMC_Sub_NORSRAM_REGION(REGION) (((REGION) == XMC_SubBank1_NORSRAM1) || \
+ ((REGION) == XMC_SubBank1_NORSRAM2) || \
+ ((REGION) == XMC_SubBank1_NORSRAM3) || \
+ ((REGION) == XMC_SubBank1_NORSRAM4))
+
+#define IS_XMC_NORSRAM_REGION(REGION) (((REGION) == XMC_Bank1_NORSRAM1) || \
+ ((REGION) == XMC_Bank1_NORSRAM2) || \
+ ((REGION) == XMC_Bank1_NORSRAM3) || \
+ ((REGION) == XMC_Bank1_NORSRAM4))
+
+#define IS_XMC_NAND_BANK(BANK) (((BANK) == XMC_Bank2_NAND) || \
+ ((BANK) == XMC_Bank3_NAND))
+
+#define IS_XMC_GETFLAG_BANK(BANK) (((BANK) == XMC_Bank2_NAND) || \
+ ((BANK) == XMC_Bank3_NAND) || \
+ ((BANK) == XMC_Bank4_PCCARD))
+
+#define IS_XMC_INT_BANK(BANK) (((BANK) == XMC_Bank2_NAND) || \
+ ((BANK) == XMC_Bank3_NAND) || \
+ ((BANK) == XMC_Bank4_PCCARD))
+
+/** @defgroup NOR_SRAM_Controller
+ * @{
+ */
+
+/** @defgroup XMC_Data_Address_Bus_Multiplexing
+ * @{
+ */
+
+#define XMC_DataAdrMux_Disable ((uint32_t)0x00000000)
+#define XMC_DataAdrMux_Enable ((uint32_t)0x00000002)
+#define IS_XMC_MUX(MUX) (((MUX) == XMC_DataAdrMux_Disable) || \
+ ((MUX) == XMC_DataAdrMux_Enable))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Memory_Type
+ * @{
+ */
+
+#define XMC_Dev_SRAM ((uint32_t)0x00000000)
+#define XMC_Dev_PSRAM ((uint32_t)0x00000004)
+#define XMC_Dev_NOR ((uint32_t)0x00000008)
+#define IS_XMC_DEVICE(DEVICE) (((DEVICE) == XMC_Dev_SRAM) || \
+ ((DEVICE) == XMC_Dev_PSRAM)|| \
+ ((DEVICE) == XMC_Dev_NOR))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Data_Width
+ * @{
+ */
+
+#define XMC_BusType_8b ((uint32_t)0x00000000)
+#define XMC_BusType_16b ((uint32_t)0x00000010)
+#define IS_XMC_BUS_TYPE(TYPE) (((TYPE) == XMC_BusType_8b) || \
+ ((TYPE) == XMC_BusType_16b))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Burst_Access_Mode
+ * @{
+ */
+
+#define XMC_BurstMode_Disable ((uint32_t)0x00000000)
+#define XMC_BurstMode_Enable ((uint32_t)0x00000100)
+#define IS_XMC_BURSTMODE(STATE) (((STATE) == XMC_BurstMode_Disable) || \
+ ((STATE) == XMC_BurstMode_Enable))
+/**
+ * @}
+ */
+
+/** @defgroup XMC_AsynchronousWait
+ * @{
+ */
+#define XMC_AsynWait_Disable ((uint32_t)0x00000000)
+#define XMC_AsynWait_Enable ((uint32_t)0x00008000)
+#define IS_XMC_ASYNWAIT(STATE) (((STATE) == XMC_AsynWait_Disable) || \
+ ((STATE) == XMC_AsynWait_Enable))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Wait_Signal_Polarity
+ * @{
+ */
+
+#define XMC_WaitSignalLv_Low ((uint32_t)0x00000000)
+#define XMC_WaitSignalLv_High ((uint32_t)0x00000200)
+#define IS_XMC_WAIT_SIGNAL_LEVEL(LEVEL) (((LEVEL) == XMC_WaitSignalLv_Low) || \
+ ((LEVEL) == XMC_WaitSignalLv_High))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Wrap_Mode
+ * @{
+ */
+
+#define XMC_BurstModeSplit_Disable ((uint32_t)0x00000000)
+#define XMC_BurstModeSplit_Enable ((uint32_t)0x00000400)
+#define IS_XMC_BURSTMODE_SPLIT(MODE) (((MODE) == XMC_BurstModeSplit_Disable) || \
+ ((MODE) == XMC_BurstModeSplit_Enable))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Wait_Timing
+ * @{
+ */
+
+#define XMC_WaitSignalConfig_BeforeWaitState ((uint32_t)0x00000000)
+#define XMC_WaitSignalConfig_DuringWaitState ((uint32_t)0x00000800)
+#define IS_XMC_WAIT_SIGNAL_CONFIG(CONFIG) (((CONFIG) == XMC_WaitSignalConfig_BeforeWaitState) || \
+ ((CONFIG) == XMC_WaitSignalConfig_DuringWaitState))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Write_Operation
+ * @{
+ */
+
+#define XMC_WriteOperation_Disable ((uint32_t)0x00000000)
+#define XMC_WriteOperation_Enable ((uint32_t)0x00001000)
+#define IS_XMC_WRITE_OPERATION(OPERATION) (((OPERATION) == XMC_WriteOperation_Disable) || \
+ ((OPERATION) == XMC_WriteOperation_Enable))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Wait_Signal
+ * @{
+ */
+
+#define XMC_WaitSignal_Disable ((uint32_t)0x00000000)
+#define XMC_WaitSignal_Enable ((uint32_t)0x00002000)
+#define IS_XMC_WAIT_SIGNAL(SIGNAL) (((SIGNAL) == XMC_WaitSignal_Disable) || \
+ ((SIGNAL) == XMC_WaitSignal_Enable))
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Extended_Mode
+ * @{
+ */
+
+#define XMC_WriteTiming_Disable ((uint32_t)0x00000000)
+#define XMC_WriteTiming_Enable ((uint32_t)0x00004000)
+
+#define IS_XMC_WRITE_TIMING(STATE) (((STATE) == XMC_WriteTiming_Disable) || \
+ ((STATE) == XMC_WriteTiming_Enable))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Write_Burst
+ * @{
+ */
+
+#define XMC_WriteBurstSyn_Disable ((uint32_t)0x00000000)
+#define XMC_WriteBurstSyn_Enable ((uint32_t)0x00080000)
+#define IS_XMC_WRITE_BURST_SYN(SYN) (((SYN) == XMC_WriteBurstSyn_Disable) || \
+ ((SYN) == XMC_WriteBurstSyn_Enable))
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Address_Setup_Time
+ * @{
+ */
+
+#define IS_XMC_ADDRESS_OP_TIME(TIME) ((TIME) <= 0xF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Address_Hold_Time
+ * @{
+ */
+
+#define IS_XMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Data_Setup_Time
+ * @{
+ */
+
+#define IS_XMC_DATA_OP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Bus_Turn_around_Duration
+ * @{
+ */
+
+#define IS_XMC_INTERVAL_BETWEEN_OP_TIME(TIME) ((TIME) <= 0xF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_CLK_Division
+ * @{
+ */
+
+#define IS_XMC_CLK_DIV(DIV) ((DIV) <= 0xF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Data_Latency
+ * @{
+ */
+
+#define IS_XMC_DATA_STABLE_TIME(TIME) ((TIME) <= 0xF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Access_Mode
+ * @{
+ */
+
+#define XMC_Mode_A ((uint32_t)0x00000000)
+#define XMC_Mode_B ((uint32_t)0x10000000)
+#define XMC_Mode_C ((uint32_t)0x20000000)
+#define XMC_Mode_D ((uint32_t)0x30000000)
+#define IS_XMC_MODE(MODE) (((MODE) == XMC_Mode_A) || \
+ ((MODE) == XMC_Mode_B) || \
+ ((MODE) == XMC_Mode_C) || \
+ ((MODE) == XMC_Mode_D))
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup NAND_PCCARD_Controller
+ * @{
+ */
+
+/** @defgroup XMC_Wait_feature
+ * @{
+ */
+
+#define XMC_WaitOperation_Disable ((uint32_t)0x00000000)
+#define XMC_WaitOperation_Enable ((uint32_t)0x00000002)
+#define IS_XMC_WAIT_OPERATION(OPERATION) (((OPERATION) == XMC_WaitOperation_Disable) || \
+ ((OPERATION) == XMC_WaitOperation_Enable))
+
+/**
+ * @}
+ */
+
+
+/** @defgroup XMC_EnableECC
+ * @{
+ */
+
+#define XMC_ECCOperation_Disable ((uint32_t)0x00000000)
+#define XMC_ECCOperation_Enable ((uint32_t)0x00000040)
+#define IS_XMC_ECC_OPERATION(OPERATION) (((OPERATION) == XMC_ECCOperation_Disable) || \
+ ((OPERATION) == XMC_ECCOperation_Enable))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_ECC_Page_Size
+ * @{
+ */
+
+#define XMC_ECCPageSize_256Bytes ((uint32_t)0x00000000)
+#define XMC_ECCPageSize_512Bytes ((uint32_t)0x00020000)
+#define XMC_ECCPageSize_1024Bytes ((uint32_t)0x00040000)
+#define XMC_ECCPageSize_2048Bytes ((uint32_t)0x00060000)
+#define XMC_ECCPageSize_4096Bytes ((uint32_t)0x00080000)
+#define XMC_ECCPageSize_8192Bytes ((uint32_t)0x000A0000)
+#define IS_XMC_ECCPAGE_SIZE(SIZE) (((SIZE) == XMC_ECCPageSize_256Bytes) || \
+ ((SIZE) == XMC_ECCPageSize_512Bytes) || \
+ ((SIZE) == XMC_ECCPageSize_1024Bytes) || \
+ ((SIZE) == XMC_ECCPageSize_2048Bytes) || \
+ ((SIZE) == XMC_ECCPageSize_4096Bytes) || \
+ ((SIZE) == XMC_ECCPageSize_8192Bytes))
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_TCLR_Setup_Time
+ * @{
+ */
+
+#define IS_XMC_DELAY_CR_TIME(TIME) ((TIME) <= 0xFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_TAR_Setup_Time
+ * @{
+ */
+
+#define IS_XMC_DELAY_AR_TIME(TIME) ((TIME) <= 0xFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Setup_Time
+ * @{
+ */
+
+#define IS_XMC_SETUP_TIME(TIME) ((TIME) <= 0xFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Wait_Setup_Time
+ * @{
+ */
+
+#define IS_XMC_OP_TIME(TIME) ((TIME) <= 0xFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Hold_Setup_Time
+ * @{
+ */
+
+#define IS_XMC_HOLD_TIME(TIME) ((TIME) <= 0xFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_HiZ_Setup_Time
+ * @{
+ */
+
+#define IS_XMC_WRITE_SETUP_TIME(TIME) ((TIME) <= 0xFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Interrupt_sources
+ * @{
+ */
+
+#define XMC_INT_RisingEdge ((uint32_t)0x00000008)
+#define XMC_INT_Level ((uint32_t)0x00000010)
+#define XMC_INT_FallingEdge ((uint32_t)0x00000020)
+#define IS_XMC_INT(INT) ((((INT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((INT) != 0x00000000))
+#define IS_XMC_GET_INT(INT) (((INT) == XMC_INT_RisingEdge) || \
+ ((INT) == XMC_INT_Level) || \
+ ((INT) == XMC_INT_FallingEdge))
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Flags
+ * @{
+ */
+
+#define XMC_FLAG_RisingEdge ((uint32_t)0x00000001)
+#define XMC_FLAG_Level ((uint32_t)0x00000002)
+#define XMC_FLAG_FallingEdge ((uint32_t)0x00000004)
+#define XMC_FLAG_FEMPT ((uint32_t)0x00000040)
+#define IS_XMC_GET_FLAG(FLAG) (((FLAG) == XMC_FLAG_RisingEdge) || \
+ ((FLAG) == XMC_FLAG_Level) || \
+ ((FLAG) == XMC_FLAG_FallingEdge) || \
+ ((FLAG) == XMC_FLAG_FEMPT))
+
+#define IS_XMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Exported_Functions
+ * @{
+ */
+
+void XMC_ExtTimingConfig(uint32_t XMC_SubBank, uint8_t W2W_Timing, uint8_t R2R_Timing);
+void XMC_NORSRAMReset(uint32_t XMC_Bank);
+void XMC_NANDReset(uint32_t XMC_Bank);
+void XMC_PCCARDReset(void);
+void XMC_NORSRAMInit(XMC_NORSRAMInitType* XMC_NORSRAMInitStruct);
+void XMC_NANDInit(XMC_NANDInitType* XMC_NANDInitStruct);
+void XMC_PCCARDInit(XMC_PCCARDInitType* XMC_PCCARDInitStruct);
+void XMC_NORSRAMStructInit(XMC_NORSRAMInitType* XMC_NORSRAMInitStruct);
+void XMC_NANDStructInit(XMC_NANDInitType* XMC_NANDInitStruct);
+void XMC_PCCARDStructInit(XMC_PCCARDInitType* XMC_PCCARDInitStruct);
+void XMC_NORSRAMCmd(uint32_t XMC_Bank, FunctionalState NewState);
+void XMC_NANDCmd(uint32_t XMC_Bank, FunctionalState NewState);
+void XMC_PCCARDCmd(FunctionalState NewState);
+void XMC_NANDECCCmd(uint32_t XMC_Bank, FunctionalState NewState);
+uint32_t XMC_GetECC(uint32_t XMC_Bank);
+void XMC_INTConfig(uint32_t XMC_Bank, uint32_t XMC_INT, FunctionalState NewState);
+FlagStatus XMC_GetFlagStatus(uint32_t XMC_Bank, uint32_t XMC_FLAG);
+void XMC_ClearFlag(uint32_t XMC_Bank, uint32_t XMC_FLAG);
+ITStatus XMC_GetINTStatus(uint32_t XMC_Bank, uint32_t XMC_INT);
+void XMC_ClearINTPendingBit(uint32_t XMC_Bank, uint32_t XMC_INT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__AT32F4xx_XMC_H */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/misc.h b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/misc.h
new file mode 100644
index 0000000000000000000000000000000000000000..0abbd8d94a13c6f8f04a6cdc91e621deb86ec8e3
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/inc/misc.h
@@ -0,0 +1,219 @@
+/*
+ **************************************************************************
+ * Copyright (C) 2016 by ARTERY Technology Co., Ltd. All Rights Reserved.
+ **************************************************************************
+ * THIS SOURCE FILE IS DISTRIBUTED IN THE HOPE THAT CAN REDUCE EFFORTS AND
+ * TIME, BUT WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ **************************************************************************
+ * File Name : misc.h
+ * Description : at32f4xx MISC header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __MISC_H
+#define __MISC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @addtogroup MISC
+ * @{
+ */
+
+/** @defgroup MISC_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief NVIC Init Structure definition
+ */
+
+typedef struct
+{
+ uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled.
+ This parameter can be a value of @ref IRQn_Type
+ (For the complete AT32 Devices IRQ Channels list, please
+ refer to at32f4xx.h file) */
+
+ uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel
+ specified in NVIC_IRQChannel. This parameter can be a value
+ between 0 and 15 as described in the table @ref NVIC_Priority_Table */
+
+ uint8_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified
+ in NVIC_IRQChannel. This parameter can be a value
+ between 0 and 15 as described in the table @ref NVIC_Priority_Table */
+
+ FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
+ will be enabled or disabled.
+ This parameter can be set either to ENABLE or DISABLE */
+} NVIC_InitType;
+
+/**
+ * @}
+ */
+
+/** @defgroup NVIC_Priority_Table
+ * @{
+ */
+
+/**
+@code
+ The table below gives the allowed values of the pre-emption priority and subpriority according
+ to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function
+ ============================================================================================================================
+ NVIC_PriorityGroup | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority | Description
+ ============================================================================================================================
+ NVIC_PriorityGroup_0 | 0 | 0-15 | 0 bits for pre-emption priority
+ | | | 4 bits for subpriority
+ ----------------------------------------------------------------------------------------------------------------------------
+ NVIC_PriorityGroup_1 | 0-1 | 0-7 | 1 bits for pre-emption priority
+ | | | 3 bits for subpriority
+ ----------------------------------------------------------------------------------------------------------------------------
+ NVIC_PriorityGroup_2 | 0-3 | 0-3 | 2 bits for pre-emption priority
+ | | | 2 bits for subpriority
+ ----------------------------------------------------------------------------------------------------------------------------
+ NVIC_PriorityGroup_3 | 0-7 | 0-1 | 3 bits for pre-emption priority
+ | | | 1 bits for subpriority
+ ----------------------------------------------------------------------------------------------------------------------------
+ NVIC_PriorityGroup_4 | 0-15 | 0 | 4 bits for pre-emption priority
+ | | | 0 bits for subpriority
+ ============================================================================================================================
+@endcode
+*/
+
+/**
+ * @}
+ */
+
+/** @defgroup MISC_Exported_Constants
+ * @{
+ */
+
+/** @defgroup Vector_Table_Base
+ * @{
+ */
+
+#define NVIC_VectTab_RAM ((uint32_t)0x20000000)
+#define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
+#define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
+ ((VECTTAB) == NVIC_VectTab_FLASH))
+/**
+ * @}
+ */
+
+/** @defgroup System_Low_Power
+ * @{
+ */
+
+#define NVIC_LP_SEVONPEND ((uint8_t)0x10)
+#define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
+#define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
+#define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
+ ((LP) == NVIC_LP_SLEEPDEEP) || \
+ ((LP) == NVIC_LP_SLEEPONEXIT))
+/**
+ * @}
+ */
+
+/** @defgroup Preemption_Priority_Group
+ * @{
+ */
+
+#define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
+ 4 bits for subpriority */
+#define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
+ 3 bits for subpriority */
+#define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
+ 2 bits for subpriority */
+#define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
+ 1 bits for subpriority */
+#define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
+ 0 bits for subpriority */
+
+#define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
+ ((GROUP) == NVIC_PriorityGroup_1) || \
+ ((GROUP) == NVIC_PriorityGroup_2) || \
+ ((GROUP) == NVIC_PriorityGroup_3) || \
+ ((GROUP) == NVIC_PriorityGroup_4))
+
+#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
+
+#define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
+
+#define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
+
+/**
+ * @}
+ */
+
+/** @defgroup SysTick_clock_source
+ * @{
+ */
+
+#define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
+#define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
+#define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
+ ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup MISC_Exported_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup MISC_Exported_Functions
+ * @{
+ */
+
+void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
+void NVIC_Init(NVIC_InitType* NVIC_InitStruct);
+void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
+void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
+void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MISC_H */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_acc.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_acc.c
new file mode 100644
index 0000000000000000000000000000000000000000..b53ca75a05e57e1d4173c26f219d3a17eadcc763
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_acc.c
@@ -0,0 +1,238 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_acc.c
+ * Description : at32f4xx ACC source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_acc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup ACC
+ * @brief ACC driver modules
+ * @{
+ */
+#if defined (AT32F413xx) || defined (AT32F415xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+
+/** @defgroup ACC_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Stores Calibration Step data in ACC's CTRL1 register.
+ * @param StepValue: value to be stored in the ACC's CTRL1 register
+ * @retval None
+ */
+void ACC_SetStep(uint8_t StepValue)
+{
+ ACC->CTRL1 |= StepValue<<8;
+}
+
+/**
+ * @brief Enables the specified ACC Calibration.
+ * @param ACC_CAL: specifies the ACC CAL sources.
+ * This parameter can be one of the following values:
+ * @arg ACC_CAL_HSICAL: Calibration HSICAL
+ * @arg ACC_CAL_HSITRIM: Calibration HSITRIM
+ * @retval None
+ */
+void ACC_CAL_Choose(uint16_t ACC_CAL)
+{
+ ACC->CTRL1 &= ~0x2;
+
+ ACC->CTRL1 |= ACC_CAL;
+
+}
+
+/**
+ * @brief Enables or disables the specified ACC interrupts.
+ * @param ACC_IT: specifies the ACC interrupt sources to be enabled or disabled.
+ * This parameter can be one of the following values:
+ * @arg ACC_IT_CALRDYIEN: CALRDY interrupt enable
+ * @arg ACC_IT_EIEN: RSLOST error interrupt enable
+ * @param NewState: new state of the specified ACC interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ACC_ITConfig(uint16_t ACC_IT, FunctionalState NewState)
+{
+ if (NewState != DISABLE)
+ {
+ /* Enable the Interrupt sources */
+ ACC->CTRL1 |= ACC_IT;
+ }
+ else
+ {
+ /* Disable the Interrupt sources */
+ ACC->CTRL1 &= (uint16_t)~ACC_IT;
+ }
+}
+
+/**
+ * @brief Enters the ACC Calibration mode.
+ * @param ACC_IT: specifies the ACC interrupt sources to be enabled or disabled.
+ * This parameter can be one of the following values:
+ * @arg ACC_CAL_ON: CALRDY interrupt enable
+ * @arg ACC_TRIM_ON: RSLOST error interrupt enable
+ * @param NewState: new state of the specified ACC interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ACC_EnterCALMode(uint16_t ACC_ON, FunctionalState NewState)
+{
+ ACC->CTRL1 |= ACC_ON;
+}
+/**
+ * @brief Exits from the ACC Calibration mode.
+ * @param None
+ * @retval None
+ */
+void ACC_ExitCALMode(void)
+{
+ ACC->CTRL1 &= ~ACC_CAL_Enable;
+}
+
+/**
+ * @brief Checks whether the specified ACC flag is set or not.
+ * @param ACC_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg ACC_FLAG_RSLOST: Reference Signal Lost
+ * @arg ACC_FLAG_CALRDY: Internal high-speed clock calibration ready
+ * @retval The new state of ACC_FLAG (SET or RESET).
+ */
+FlagStatus ACC_GetFlagStatus(uint16_t ACC_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+
+ if ((ACC->STS & ACC_FLAG) != (uint16_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Wtire the value to ACC C1 register.
+ * @param ACC_C1_Value
+ * @retval none.
+ */
+void ACC_WriteC1(uint16_t ACC_C1_Value)
+{
+ ACC->C1 = ACC_C1_Value;
+}
+
+/**
+ * @brief Wtire the value to ACC C2 register.
+ * @param ACC_C2_Value
+ * @retval none.
+ */
+void ACC_WriteC2(uint16_t ACC_C2_Value)
+{
+ ACC->C2 = ACC_C2_Value;
+}
+/**
+ * @brief Wtire the value to ACC C3 register.
+ * @param ACC_C3_Value
+ * @retval none.
+ */
+void ACC_WriteC3(uint16_t ACC_C3_Value)
+{
+ ACC->C3 = ACC_C3_Value;
+}
+
+/**
+ * @brief Returns the current ACC HSITRIM value.
+ * @param None
+ * @retval 8-bit HSITRIM value.
+ */
+uint8_t ACC_GetHSITRIM(void)
+{
+ return ((uint8_t)((ACC->CTRL2)>>8));
+}
+
+
+/**
+ * @brief Returns the current ACC HSICAL value.
+ * @param None
+ * @retval 8-bit HSITRIM value.
+ */
+uint8_t ACC_GetHSICAL(void)
+{
+ return ((uint8_t)(ACC->CTRL2));
+}
+
+/**
+ * @brief Returns the current ACC C1 value.
+ * @param None
+ * @retval 16-bit C1 value.
+ */
+uint16_t ACC_ReadC1(void)
+{
+ return ((uint16_t)(ACC->C1));
+}
+
+/**
+ * @brief Returns the current ACC C2 value.
+ * @param None
+ * @retval 16-bit C2 value.
+ */
+uint16_t ACC_ReadC2(void)
+{
+ return ((uint16_t)(ACC->C2));
+}
+/**
+ * @brief Returns the current ACC C3 value.
+ * @param None
+ * @retval 16-bit C3 value.
+ */
+uint16_t ACC_ReadC3(void)
+{
+ return ((uint16_t)(ACC->C3));
+}
+
+/**
+ * @brief Checks whether the specified ACC flag is set or not.
+ * @param ACC_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg ACC_FLAG_RSLOST: Reference Signal Lost
+ * @arg ACC_FLAG_CALRDY: Internal high-speed clock calibration ready
+ * @retval None.
+ */
+void ACC_ClearFlag(uint16_t ACC_FLAG)
+{
+ if(ACC_FLAG == ACC_FLAG_CALRDY)
+ {
+ ACC->STS &= ~1;
+ }
+
+ if(ACC_FLAG == ACC_FLAG_RSLOST)
+ {
+ ACC->STS &= ~2;
+ }
+}
+
+/**
+ * @}
+ */
+
+#endif /* AT32F413xx || AT32F415xx || AT32F403Axx || AT32F407xx */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_adc.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_adc.c
new file mode 100644
index 0000000000000000000000000000000000000000..c3794aef5adcf037939f8bcdd4b60b3eb74d7500
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_adc.c
@@ -0,0 +1,1331 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_adc.c
+ * Description : at32f4xx ADC source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_adc.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup ADC
+ * @brief ADC driver modules
+ * @{
+ */
+
+/** @defgroup ADC_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_Private_Defines
+ * @{
+ */
+
+/* ADC DISCNUM mask */
+#define CTRL1_DISCNUM_Reset ((uint32_t)0xFFFF1FFF)
+
+/* ADC DISCEN mask */
+#define CTRL1_RDISCEN_Set ((uint32_t)0x00000800)
+#define CTRL1_RDISCEN_Rst ((uint32_t)0xFFFFF7FF)
+
+/* ADC JAUTO mask */
+#define CTRL1_JAUT_Set ((uint32_t)0x00000400)
+#define CTRL1_JAUT_Rst ((uint32_t)0xFFFFFBFF)
+
+/* ADC JDISCEN mask */
+#define CTRL1_JDISCEN_Set ((uint32_t)0x00001000)
+#define CTRL1_JDISCEN_Rst ((uint32_t)0xFFFFEFFF)
+
+/* ADC AWDCH mask */
+#define CTRL1_AWDCH_Rst ((uint32_t)0xFFFFFFE0)
+
+/* ADC Analog watchdog enable mode mask */
+#define CTRL1_AWDMode_Rst ((uint32_t)0xFF3FFDFF)
+
+/* CTRL1 register Mask */
+#define CTRL1_CLEAR_MASK ((uint32_t)0xFFF0FEFF)
+
+/* ADC ADON mask */
+#define CTRL2_ADON_Set ((uint32_t)0x00000001)
+#define CTRL2_ADON_Rst ((uint32_t)0xFFFFFFFE)
+
+/* ADC DMA mask */
+#define CTRL2_DMA_Set ((uint32_t)0x00000100)
+#define CTRL2_DMA_Rst ((uint32_t)0xFFFFFEFF)
+
+/* ADC RSTCAL mask */
+#define CTRL2_RSTCAL_Set ((uint32_t)0x00000008)
+
+/* ADC CAL mask */
+#define CTRL2_CAL_Set ((uint32_t)0x00000004)
+
+/* ADC SWSTART mask */
+#define CTRL2_SWSTR_Set ((uint32_t)0x00400000)
+
+/* ADC EXTTRIG mask */
+#define CTRL2_EXTTRIG_Set ((uint32_t)0x00100000)
+#define CTRL2_EXTTRIG_Rst ((uint32_t)0xFFEFFFFF)
+
+/* ADC Software start mask */
+#define CTRL2_EXTTRIG_SWSTR_Set ((uint32_t)0x00500000)
+#define CTRL2_EXTTRIG_SWSTR_Rst ((uint32_t)0xFFAFFFFF)
+
+/* ADC JEXTSEL mask */
+#define CTRL2_JEXTSEL_Rst ((uint32_t)0xFEFF8FFF)
+
+/* ADC JEXTTRIG mask */
+#define CTRL2_JEXTTRIG_Set ((uint32_t)0x00008000)
+#define CTRL2_JEXTTRIG_Rst ((uint32_t)0xFFFF7FFF)
+
+/* ADC JSWSTART mask */
+#define CTRL2_JSWSTR_Set ((uint32_t)0x00200000)
+
+/* ADC injected software start mask */
+#define CTRL2_JEXTTRIG_JSWSTR_Set ((uint32_t)0x00208000)
+#define CTRL2_JEXTTRIG_JSWSTR_Rst ((uint32_t)0xFFDF7FFF)
+
+/* ADC TSPD mask */
+#define CTRL2_TSVREFE_Set ((uint32_t)0x00800000)
+#define CTRL2_TSVREFE_Rst ((uint32_t)0xFF7FFFFF)
+
+/* CTRL2 register Mask */
+#define CTRL2_CLEAR_Msk ((uint32_t)0xFDF1F7FD)
+
+/* ADC SQx mask */
+#define RSQ3_SQ_Set ((uint32_t)0x0000001F)
+#define RSQ2_SQ_Set ((uint32_t)0x0000001F)
+#define RSQ1_SQ_Set ((uint32_t)0x0000001F)
+
+/* SQR1 register Mask */
+#define RSQ1_CLEAR_Msk ((uint32_t)0xFF0FFFFF)
+
+/* ADC JSQx mask */
+#define JSQR_JSQ_Set ((uint32_t)0x0000001F)
+
+/* ADC JL mask */
+#define JSQR_JLEN_Set ((uint32_t)0x00300000)
+#define JSQR_JLEN_Rst ((uint32_t)0xFFCFFFFF)
+
+/* ADC SMPx mask */
+#define SMPT1_SMP_Set ((uint32_t)0x00000007)
+#define SMPT2_SMP_Set ((uint32_t)0x00000007)
+
+/* ADC JDRx registers offset */
+#define JDOR_Offset ((uint8_t)0x28)
+
+/* ADC1 DR register base address */
+#define DOR_ADDRESS ((uint32_t)0x4001244C)
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup ADC_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the ADCx peripheral registers to their default reset values.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @retval None
+ */
+void ADC_Reset(ADC_Type* ADCx)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+
+ if (ADCx == ADC1)
+ {
+ /* Enable ADC1 reset state */
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_ADC1, ENABLE);
+ /* Release ADC1 from reset state */
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_ADC1, DISABLE);
+ }
+ else if (ADCx == ADC2)
+ {
+ /* Enable ADC2 reset state */
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_ADC2, ENABLE);
+ /* Release ADC2 from reset state */
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_ADC2, DISABLE);
+ }
+#ifdef AT32F403xx
+ else if (ADCx == ADC3)
+ {
+ /* Enable ADC3 reset state */
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_ADC3, ENABLE);
+ /* Release ADC3 from reset state */
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_ADC3, DISABLE);
+ }
+#endif
+}
+
+/**
+ * @brief Initializes the ADCx peripheral according to the specified parameters
+ * in the ADC_InitStruct.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_InitStruct: pointer to an ADC_InitType structure that contains
+ * the configuration information for the specified ADC peripheral.
+ * @retval None
+ */
+void ADC_Init(ADC_Type* ADCx, ADC_InitType* ADC_InitStruct)
+{
+ uint32_t tmpreg1 = 0;
+ uint8_t tmpreg2 = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_MODE(ADC_InitStruct->ADC_Mode));
+ assert_param(IS_FUNCTIONAL_STATE(ADC_InitStruct->ADC_ScanMode));
+ assert_param(IS_FUNCTIONAL_STATE(ADC_InitStruct->ADC_ContinuousMode));
+ assert_param(IS_ADC_EXT_TRIG(ADC_InitStruct->ADC_ExternalTrig));
+ assert_param(IS_ADC_DATA_ALIGN(ADC_InitStruct->ADC_DataAlign));
+ assert_param(IS_ADC_REGULAR_LENGTH(ADC_InitStruct->ADC_NumOfChannel));
+
+ /*---------------------------- ADCx CTRL1 Configuration -----------------*/
+ /* Get the ADCx CTRL1 value */
+ tmpreg1 = ADCx->CTRL1;
+ /* Clear DUALMOD and SCAN bits */
+ tmpreg1 &= CTRL1_CLEAR_MASK;
+ /* Configure ADCx: Dual mode and scan conversion mode */
+ /* Set DUALMOD bits according to ADC_Mode value */
+ /* Set SCAN bit according to ADC_ScanConvMode value */
+ tmpreg1 |= (uint32_t)(ADC_InitStruct->ADC_Mode | ((uint32_t)ADC_InitStruct->ADC_ScanMode << 8));
+ /* Write to ADCx CTRL1 */
+ ADCx->CTRL1 = tmpreg1;
+
+ /*---------------------------- ADCx CTRL2 Configuration -----------------*/
+ /* Get the ADCx CTRL2 value */
+ tmpreg1 = ADCx->CTRL2;
+ /* Clear CONT, ALIGN and EXTSEL bits */
+ tmpreg1 &= CTRL2_CLEAR_Msk;
+ /* Configure ADCx: external trigger event and continuous conversion mode */
+ /* Set ALIGN bit according to ADC_DataAlign value */
+ /* Set EXTSEL bits according to ADC_ExternalTrigConv value */
+ /* Set CONT bit according to ADC_ContinuousConvMode value */
+ tmpreg1 |= (uint32_t)(ADC_InitStruct->ADC_DataAlign | ADC_InitStruct->ADC_ExternalTrig |
+ ((uint32_t)ADC_InitStruct->ADC_ContinuousMode << 1));
+ /* Write to ADCx CTRL2 */
+ ADCx->CTRL2 = tmpreg1;
+
+ /*---------------------------- ADCx SQR1 Configuration -----------------*/
+ /* Get the ADCx SQR1 value */
+ tmpreg1 = ADCx->RSQ1;
+ /* Clear L bits */
+ tmpreg1 &= RSQ1_CLEAR_Msk;
+ /* Configure ADCx: regular channel sequence length */
+ /* Set L bits according to ADC_NbrOfChannel value */
+ tmpreg2 |= (uint8_t) (ADC_InitStruct->ADC_NumOfChannel - (uint8_t)1);
+ tmpreg1 |= (uint32_t)tmpreg2 << 20;
+ /* Write to ADCx SQR1 */
+ ADCx->RSQ1 = tmpreg1;
+}
+
+/**
+ * @brief Fills each ADC_InitStruct member with its default value.
+ * @param ADC_InitStruct : pointer to an ADC_InitType structure which will be initialized.
+ * @retval None
+ */
+void ADC_StructInit(ADC_InitType* ADC_InitStruct)
+{
+ /* Reset ADC init structure parameters values */
+ /* Initialize the ADC_Mode member */
+ ADC_InitStruct->ADC_Mode = ADC_Mode_Independent;
+ /* initialize the ADC_ScanConvMode member */
+ ADC_InitStruct->ADC_ScanMode = DISABLE;
+ /* Initialize the ADC_ContinuousConvMode member */
+ ADC_InitStruct->ADC_ContinuousMode = DISABLE;
+ /* Initialize the ADC_ExternalTrigConv member */
+ ADC_InitStruct->ADC_ExternalTrig = ADC_ExternalTrig_TMR1_CC1_ADC12;
+ /* Initialize the ADC_DataAlign member */
+ ADC_InitStruct->ADC_DataAlign = ADC_DataAlign_Right;
+ /* Initialize the ADC_NbrOfChannel member */
+ ADC_InitStruct->ADC_NumOfChannel = 1;
+}
+
+/**
+ * @brief Enables or disables the specified ADC peripheral.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param NewState: new state of the ADCx peripheral.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_Ctrl(ADC_Type* ADCx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Set the ADON bit to wake up the ADC from power down mode */
+ ADCx->CTRL2 |= CTRL2_ADON_Set;
+ }
+ else
+ {
+ /* Disable the selected ADC peripheral */
+ ADCx->CTRL2 &= CTRL2_ADON_Rst;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified ADC DMA request.
+ * @param ADCx: where x can be 1 or 3 to select the ADC peripheral.
+ * Note: ADC2 hasn't a DMA capability.
+ * @param NewState: new state of the selected ADC DMA transfer.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_DMACtrl(ADC_Type* ADCx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_DMA_PERIPH(ADCx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ADC DMA request */
+ ADCx->CTRL2 |= CTRL2_DMA_Set;
+ }
+ else
+ {
+ /* Disable the selected ADC DMA request */
+ ADCx->CTRL2 &= CTRL2_DMA_Rst;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified ADC interrupts.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_INT: specifies the ADC interrupt sources to be enabled or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg ADC_INT_EC: End of conversion interrupt mask
+ * @arg ADC_INT_AWD: Analog watchdog interrupt mask
+ * @arg ADC_INT_JEC: End of injected conversion interrupt mask
+ * @param NewState: new state of the specified ADC interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_INTConfig(ADC_Type* ADCx, uint16_t ADC_INT, FunctionalState NewState)
+{
+ uint8_t itmask = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ assert_param(IS_ADC_INT(ADC_INT));
+ /* Get the ADC INT index */
+ itmask = (uint8_t)ADC_INT;
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ADC interrupts */
+ ADCx->CTRL1 |= itmask;
+ }
+ else
+ {
+ /* Disable the selected ADC interrupts */
+ ADCx->CTRL1 &= (~(uint32_t)itmask);
+ }
+}
+
+/**
+ * @brief Resets the selected ADC calibration registers.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @retval None
+ */
+void ADC_RstCalibration(ADC_Type* ADCx)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ /* Resets the selected ADC calibration registers */
+ ADCx->CTRL2 |= CTRL2_RSTCAL_Set;
+}
+
+/**
+ * @brief Gets the selected ADC reset calibration registers status.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @retval The new state of ADC reset calibration registers (SET or RESET).
+ */
+FlagStatus ADC_GetResetCalibrationStatus(ADC_Type* ADCx)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+
+ /* Check the status of RSTCAL bit */
+ if ((ADCx->CTRL2 & CTRL2_RSTCAL_Set) != (uint32_t)RESET)
+ {
+ /* RSTCAL bit is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* RSTCAL bit is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the RSTCAL bit status */
+ return bitstatus;
+}
+
+/**
+ * @brief Starts the selected ADC calibration process.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @retval None
+ */
+void ADC_StartCalibration(ADC_Type* ADCx)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ /* Enable the selected ADC calibration process */
+ ADCx->CTRL2 |= CTRL2_CAL_Set;
+}
+
+/**
+ * @brief Gets the selected ADC calibration status.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @retval The new state of ADC calibration (SET or RESET).
+ */
+FlagStatus ADC_GetCalibrationStatus(ADC_Type* ADCx)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+
+ /* Check the status of CAL bit */
+ if ((ADCx->CTRL2 & CTRL2_CAL_Set) != (uint32_t)RESET)
+ {
+ /* CAL bit is set: calibration on going */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* CAL bit is reset: end of calibration */
+ bitstatus = RESET;
+ }
+
+ /* Return the CAL bit status */
+ return bitstatus;
+}
+
+/**
+ * @brief Enables or disables the selected ADC software start conversion .
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param NewState: new state of the selected ADC software start conversion.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_SoftwareStartConvCtrl(ADC_Type* ADCx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ADC conversion on external event and start the selected
+ ADC conversion */
+ ADCx->CTRL2 |= CTRL2_EXTTRIG_SWSTR_Set;
+ }
+ else
+ {
+ /* Disable the selected ADC conversion on external event and stop the selected
+ ADC conversion */
+ ADCx->CTRL2 &= CTRL2_EXTTRIG_SWSTR_Rst;
+ }
+}
+
+/**
+ * @brief Gets the selected ADC Software start conversion Status.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @retval The new state of ADC software start conversion (SET or RESET).
+ */
+FlagStatus ADC_GetSoftwareStartConvStatus(ADC_Type* ADCx)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+
+ /* Check the status of SWSTART bit */
+ if ((ADCx->CTRL2 & CTRL2_SWSTR_Set) != (uint32_t)RESET)
+ {
+ /* SWSTART bit is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* SWSTART bit is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the SWSTART bit status */
+ return bitstatus;
+}
+
+/**
+ * @brief Configures the discontinuous mode for the selected ADC regular
+ * group channel.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param Number: specifies the discontinuous mode regular channel
+ * count value. This number must be between 1 and 8.
+ * @retval None
+ */
+void ADC_DiscModeChannelCountConfig(ADC_Type* ADCx, uint8_t Number)
+{
+ uint32_t tmpreg1 = 0;
+ uint32_t tmpreg2 = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_REGULAR_DISC_NUMBER(Number));
+ /* Get the old register value */
+ tmpreg1 = ADCx->CTRL1;
+ /* Clear the old discontinuous mode channel count */
+ tmpreg1 &= CTRL1_DISCNUM_Reset;
+ /* Set the discontinuous mode channel count */
+ tmpreg2 = Number - 1;
+ tmpreg1 |= tmpreg2 << 13;
+ /* Store the new register value */
+ ADCx->CTRL1 = tmpreg1;
+}
+
+/**
+ * @brief Enables or disables the discontinuous mode on regular group
+ * channel for the specified ADC
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param NewState: new state of the selected ADC discontinuous mode
+ * on regular group channel.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_DiscModeCtrl(ADC_Type* ADCx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ADC regular discontinuous mode */
+ ADCx->CTRL1 |= CTRL1_RDISCEN_Set;
+ }
+ else
+ {
+ /* Disable the selected ADC regular discontinuous mode */
+ ADCx->CTRL1 &= CTRL1_RDISCEN_Rst;
+ }
+}
+
+/**
+ * @brief Configures for the selected ADC regular channel its corresponding
+ * rank in the sequencer and its sample time.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_Channel: the ADC channel to configure.
+ * This parameter can be one of the following values:
+ * @arg ADC_Channel_0: ADC Channel0 selected
+ * @arg ADC_Channel_1: ADC Channel1 selected
+ * @arg ADC_Channel_2: ADC Channel2 selected
+ * @arg ADC_Channel_3: ADC Channel3 selected
+ * @arg ADC_Channel_4: ADC Channel4 selected
+ * @arg ADC_Channel_5: ADC Channel5 selected
+ * @arg ADC_Channel_6: ADC Channel6 selected
+ * @arg ADC_Channel_7: ADC Channel7 selected
+ * @arg ADC_Channel_8: ADC Channel8 selected
+ * @arg ADC_Channel_9: ADC Channel9 selected
+ * @arg ADC_Channel_10: ADC Channel10 selected
+ * @arg ADC_Channel_11: ADC Channel11 selected
+ * @arg ADC_Channel_12: ADC Channel12 selected
+ * @arg ADC_Channel_13: ADC Channel13 selected
+ * @arg ADC_Channel_14: ADC Channel14 selected
+ * @arg ADC_Channel_15: ADC Channel15 selected
+ * @arg ADC_Channel_16: ADC Channel16 selected
+ * @arg ADC_Channel_17: ADC Channel17 selected
+ * @param Rank: The rank in the regular group sequencer. This parameter must be between 1 to 16.
+ * @param ADC_SampleTime: The sample time value to be set for the selected channel.
+ * This parameter can be one of the following values:
+ * @arg ADC_SampleTime_1_5: Sample time equal to 1.5 cycles
+ * @arg ADC_SampleTime_7_5: Sample time equal to 7.5 cycles
+ * @arg ADC_SampleTime_13_5: Sample time equal to 13.5 cycles
+ * @arg ADC_SampleTime_28_5: Sample time equal to 28.5 cycles
+ * @arg ADC_SampleTime_41_5: Sample time equal to 41.5 cycles
+ * @arg ADC_SampleTime_55_5: Sample time equal to 55.5 cycles
+ * @arg ADC_SampleTime_71_5: Sample time equal to 71.5 cycles
+ * @arg ADC_SampleTime_239_5: Sample time equal to 239.5 cycles
+ * @retval None
+ */
+void ADC_RegularChannelConfig(ADC_Type* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
+{
+ uint32_t tmpreg1 = 0, tmpreg2 = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_CHANNEL(ADC_Channel));
+ assert_param(IS_ADC_REGULAR_RANK(Rank));
+ assert_param(IS_ADC_SAMPLE_TIME(ADC_SampleTime));
+
+ /* if ADC_Channel_10 ... ADC_Channel_17 is selected */
+ if (ADC_Channel > ADC_Channel_9)
+ {
+ /* Get the old register value */
+ tmpreg1 = ADCx->SMPT1;
+ /* Calculate the mask to clear */
+ tmpreg2 = SMPT1_SMP_Set << (3 * (ADC_Channel - 10));
+ /* Clear the old channel sample time */
+ tmpreg1 &= ~tmpreg2;
+ /* Calculate the mask to set */
+ tmpreg2 = (uint32_t)ADC_SampleTime << (3 * (ADC_Channel - 10));
+ /* Set the new channel sample time */
+ tmpreg1 |= tmpreg2;
+ /* Store the new register value */
+ ADCx->SMPT1 = tmpreg1;
+ }
+ else /* ADC_Channel include in ADC_Channel_[0..9] */
+ {
+ /* Get the old register value */
+ tmpreg1 = ADCx->SMPT2;
+ /* Calculate the mask to clear */
+ tmpreg2 = SMPT2_SMP_Set << (3 * ADC_Channel);
+ /* Clear the old channel sample time */
+ tmpreg1 &= ~tmpreg2;
+ /* Calculate the mask to set */
+ tmpreg2 = (uint32_t)ADC_SampleTime << (3 * ADC_Channel);
+ /* Set the new channel sample time */
+ tmpreg1 |= tmpreg2;
+ /* Store the new register value */
+ ADCx->SMPT2 = tmpreg1;
+ }
+
+ /* For Rank 1 to 6 */
+ if (Rank < 7)
+ {
+ /* Get the old register value */
+ tmpreg1 = ADCx->RSQ3;
+ /* Calculate the mask to clear */
+ tmpreg2 = RSQ3_SQ_Set << (5 * (Rank - 1));
+ /* Clear the old SQx bits for the selected rank */
+ tmpreg1 &= ~tmpreg2;
+ /* Calculate the mask to set */
+ tmpreg2 = (uint32_t)ADC_Channel << (5 * (Rank - 1));
+ /* Set the SQx bits for the selected rank */
+ tmpreg1 |= tmpreg2;
+ /* Store the new register value */
+ ADCx->RSQ3 = tmpreg1;
+ }
+ /* For Rank 7 to 12 */
+ else if (Rank < 13)
+ {
+ /* Get the old register value */
+ tmpreg1 = ADCx->RSQ2;
+ /* Calculate the mask to clear */
+ tmpreg2 = RSQ2_SQ_Set << (5 * (Rank - 7));
+ /* Clear the old SQx bits for the selected rank */
+ tmpreg1 &= ~tmpreg2;
+ /* Calculate the mask to set */
+ tmpreg2 = (uint32_t)ADC_Channel << (5 * (Rank - 7));
+ /* Set the SQx bits for the selected rank */
+ tmpreg1 |= tmpreg2;
+ /* Store the new register value */
+ ADCx->RSQ2 = tmpreg1;
+ }
+ /* For Rank 13 to 16 */
+ else
+ {
+ /* Get the old register value */
+ tmpreg1 = ADCx->RSQ1;
+ /* Calculate the mask to clear */
+ tmpreg2 = RSQ1_SQ_Set << (5 * (Rank - 13));
+ /* Clear the old SQx bits for the selected rank */
+ tmpreg1 &= ~tmpreg2;
+ /* Calculate the mask to set */
+ tmpreg2 = (uint32_t)ADC_Channel << (5 * (Rank - 13));
+ /* Set the SQx bits for the selected rank */
+ tmpreg1 |= tmpreg2;
+ /* Store the new register value */
+ ADCx->RSQ1 = tmpreg1;
+ }
+}
+
+/**
+ * @brief Enables or disables the ADCx conversion through external trigger.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param NewState: new state of the selected ADC external trigger start of conversion.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_ExternalTrigConvCtrl(ADC_Type* ADCx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ADC conversion on external event */
+ ADCx->CTRL2 |= CTRL2_EXTTRIG_Set;
+ }
+ else
+ {
+ /* Disable the selected ADC conversion on external event */
+ ADCx->CTRL2 &= CTRL2_EXTTRIG_Rst;
+ }
+}
+
+/**
+ * @brief Returns the last ADCx conversion result data for regular channel.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @retval The Data conversion value.
+ */
+uint16_t ADC_GetConversionValue(ADC_Type* ADCx)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ /* Return the selected ADC conversion value */
+ return (uint16_t) ADCx->RDOR;
+}
+
+/**
+ * @brief Returns the last ADC1 and ADC2 conversion result data in dual mode.
+ * @retval The Data conversion value.
+ */
+uint32_t ADC_GetDualModeConversionValue(void)
+{
+ /* Return the dual mode conversion value */
+ return (*(__IO uint32_t *) DOR_ADDRESS);
+}
+
+/**
+ * @brief Enables or disables the selected ADC automatic injected group
+ * conversion after regular one.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param NewState: new state of the selected ADC auto injected conversion
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_AutoInjectedConvCtrl(ADC_Type* ADCx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ADC automatic injected group conversion */
+ ADCx->CTRL1 |= CTRL1_JAUT_Set;
+ }
+ else
+ {
+ /* Disable the selected ADC automatic injected group conversion */
+ ADCx->CTRL1 &= CTRL1_JAUT_Rst;
+ }
+}
+
+/**
+ * @brief Enables or disables the discontinuous mode for injected group
+ * channel for the specified ADC
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param NewState: new state of the selected ADC discontinuous mode
+ * on injected group channel.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_InjectedDiscModeCtrl(ADC_Type* ADCx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ADC injected discontinuous mode */
+ ADCx->CTRL1 |= CTRL1_JDISCEN_Set;
+ }
+ else
+ {
+ /* Disable the selected ADC injected discontinuous mode */
+ ADCx->CTRL1 &= CTRL1_JDISCEN_Rst;
+ }
+}
+
+/**
+ * @brief Configures the ADCx external trigger for injected channels conversion.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_ExternalTrigInjecConv: specifies the ADC trigger to start injected conversion.
+ * This parameter can be one of the following values:
+ * @arg ADC_ExternalTrigInjec_TMR2_TRGO_ADC12: Timer2 TRGO event selected (for ADC1, ADC2)
+ * @arg ADC_ExternalTrigInjec_TMR2_CC1_ADC12: Timer2 capture compare1 selected (for ADC1, ADC2)
+ * @arg ADC_ExternalTrigInjec_TMR3_CC4_ADC12: Timer3 capture compare4 selected (for ADC1, ADC2)
+ * @arg ADC_ExternalTrigInjec_TMR4_TRGO_ADC12: Timer4 TRGO event selected (for ADC1, ADC2)
+ * @arg ADC_ExternalTrigInjec_Ext_INT15_TMR8_CC4_ADC12: External interrupt line 15 or Timer8 capture compare4 event selected (for ADC1 and ADC2)
+ * @arg ADC_ExternalTrigInjec_TMR8_CC1_ADC12: Timer8 capture compare1 selected (for ADC1, ADC2)
+
+ * @arg ADC_ExternalTrigInjec_TMR1_TRGO: Timer1 TRGO event selected (for ADC1, ADC2 and ADC3)
+ * @arg ADC_ExternalTrigInjec_TMR1_CC4: Timer1 capture compare4 selected (for ADC1, ADC2 and ADC3)
+ * @arg ADC_ExternalTrigInjec_TMR15_CC1: Timer15 capture compare1 selected (for ADC1, ADC2 and ADC3)
+ * @arg ADC_ExternalTrigInjec_TMR15_CC2: Timer15 capture compare2 selected (for ADC1, ADC2 and ADC3)
+ * @arg ADC_ExternalTrigInjec_TMR15_CC3: Timer15 capture compare3 selected (for ADC1, ADC2 and ADC3)
+ * @arg ADC_ExternalTrigInjec_TMR15_CC4: Timer15 capture compare4 selected (for ADC1, ADC2 and ADC3)
+ * @arg ADC_ExternalTrigInjec_TMR15_TRGO: Timer15 TRGO event selected (for ADC1, ADC2 and ADC3)
+ * @arg ADC_ExternalTrigInjec_TMR1_CC1: Timer1 capture compare1 selected (for ADC1, ADC2 and ADC3)
+ * @arg ADC_ExternalTrigInjec_TMR8_TRGO: Timer8 TRGO event selected (for ADC1, ADC2 and ADC3)
+ * @arg ADC_ExternalTrigInjec_None: Injected conversion started by software and not by external trigger (for ADC1, ADC2 and ADC3)
+
+ * @arg ADC_ExternalTrigInjec_TMR4_CC3_ADC3: Timer4 capture compare3 selected (for ADC3 only)
+ * @arg ADC_ExternalTrigInjec_TMR8_CC2_ADC3: Timer8 capture compare2 selected (for ADC3 only)
+ * @arg ADC_ExternalTrigInjec_TMR8_CC4_ADC3: Timer8 capture compare4 selected (for ADC3 only)
+ * @arg ADC_ExternalTrigInjec_TMR5_TRGO_ADC3: Timer5 TRGO event selected (for ADC3 only)
+ * @arg ADC_ExternalTrigInjec_TMR5_CC4_ADC3: Timer5 capture compare4 selected (for ADC3 only)
+ * @arg ADC_ExternalTrigInjec_TMR1_CC2_ADC3: Timer1 capture compare2 selected (for ADC3 only)
+ * @retval None
+ */
+void ADC_ExternalTrigInjectedConvConfig(ADC_Type* ADCx, uint32_t ADC_ExternalTrigInjecConv)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_EXT_INJEC_TRIG(ADC_ExternalTrigInjecConv));
+ /* Get the old register value */
+ tmpreg = ADCx->CTRL2;
+ /* Clear the old external event selection for injected group */
+ tmpreg &= CTRL2_JEXTSEL_Rst;
+ /* Set the external event selection for injected group */
+ tmpreg |= ADC_ExternalTrigInjecConv;
+ /* Store the new register value */
+ ADCx->CTRL2 = tmpreg;
+}
+
+/**
+ * @brief Enables or disables the ADCx injected channels conversion through
+ * external trigger
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param NewState: new state of the selected ADC external trigger start of
+ * injected conversion.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_ExternalTrigInjectedConvCtrl(ADC_Type* ADCx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ADC external event selection for injected group */
+ ADCx->CTRL2 |= CTRL2_JEXTTRIG_Set;
+ }
+ else
+ {
+ /* Disable the selected ADC external event selection for injected group */
+ ADCx->CTRL2 &= CTRL2_JEXTTRIG_Rst;
+ }
+}
+
+/**
+ * @brief Enables or disables the selected ADC start of the injected
+ * channels conversion.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param NewState: new state of the selected ADC software start injected conversion.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_SoftwareStartInjectedConvCtrl(ADC_Type* ADCx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ADC conversion for injected group on external event and start the selected
+ ADC injected conversion */
+ ADCx->CTRL2 |= CTRL2_JEXTTRIG_JSWSTR_Set;
+ }
+ else
+ {
+ /* Disable the selected ADC conversion on external event for injected group and stop the selected
+ ADC injected conversion */
+ ADCx->CTRL2 &= CTRL2_JEXTTRIG_JSWSTR_Rst;
+ }
+}
+
+/**
+ * @brief Gets the selected ADC Software start injected conversion Status.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @retval The new state of ADC software start injected conversion (SET or RESET).
+ */
+FlagStatus ADC_GetSoftwareStartInjectedConvCtrlStatus(ADC_Type* ADCx)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+
+ /* Check the status of JSWSTART bit */
+ if ((ADCx->CTRL2 & CTRL2_JSWSTR_Set) != (uint32_t)RESET)
+ {
+ /* JSWSTART bit is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* JSWSTART bit is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the JSWSTART bit status */
+ return bitstatus;
+}
+
+/**
+ * @brief Configures for the selected ADC injected channel its corresponding
+ * rank in the sequencer and its sample time.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_Channel: the ADC channel to configure.
+ * This parameter can be one of the following values:
+ * @arg ADC_Channel_0: ADC Channel0 selected
+ * @arg ADC_Channel_1: ADC Channel1 selected
+ * @arg ADC_Channel_2: ADC Channel2 selected
+ * @arg ADC_Channel_3: ADC Channel3 selected
+ * @arg ADC_Channel_4: ADC Channel4 selected
+ * @arg ADC_Channel_5: ADC Channel5 selected
+ * @arg ADC_Channel_6: ADC Channel6 selected
+ * @arg ADC_Channel_7: ADC Channel7 selected
+ * @arg ADC_Channel_8: ADC Channel8 selected
+ * @arg ADC_Channel_9: ADC Channel9 selected
+ * @arg ADC_Channel_10: ADC Channel10 selected
+ * @arg ADC_Channel_11: ADC Channel11 selected
+ * @arg ADC_Channel_12: ADC Channel12 selected
+ * @arg ADC_Channel_13: ADC Channel13 selected
+ * @arg ADC_Channel_14: ADC Channel14 selected
+ * @arg ADC_Channel_15: ADC Channel15 selected
+ * @arg ADC_Channel_16: ADC Channel16 selected
+ * @arg ADC_Channel_17: ADC Channel17 selected
+ * @param Rank: The rank in the injected group sequencer. This parameter must be between 1 and 4.
+ * @param ADC_SampleTime: The sample time value to be set for the selected channel.
+ * This parameter can be one of the following values:
+ * @arg ADC_SampleTime_1_5: Sample time equal to 1.5 cycles
+ * @arg ADC_SampleTime_7_5: Sample time equal to 7.5 cycles
+ * @arg ADC_SampleTime_13_5: Sample time equal to 13.5 cycles
+ * @arg ADC_SampleTime_28_5: Sample time equal to 28.5 cycles
+ * @arg ADC_SampleTime_41_5: Sample time equal to 41.5 cycles
+ * @arg ADC_SampleTime_55_5: Sample time equal to 55.5 cycles
+ * @arg ADC_SampleTime_71_5: Sample time equal to 71.5 cycles
+ * @arg ADC_SampleTime_239_5: Sample time equal to 239.5 cycles
+ * @retval None
+ */
+void ADC_InjectedChannelConfig(ADC_Type* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
+{
+ uint32_t tmpreg1 = 0, tmpreg2 = 0, tmpreg3 = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_CHANNEL(ADC_Channel));
+ assert_param(IS_ADC_INJECTED_RANK(Rank));
+ assert_param(IS_ADC_SAMPLE_TIME(ADC_SampleTime));
+
+ /* if ADC_Channel_10 ... ADC_Channel_17 is selected */
+ if (ADC_Channel > ADC_Channel_9)
+ {
+ /* Get the old register value */
+ tmpreg1 = ADCx->SMPT1;
+ /* Calculate the mask to clear */
+ tmpreg2 = SMPT1_SMP_Set << (3 * (ADC_Channel - 10));
+ /* Clear the old channel sample time */
+ tmpreg1 &= ~tmpreg2;
+ /* Calculate the mask to set */
+ tmpreg2 = (uint32_t)ADC_SampleTime << (3 * (ADC_Channel - 10));
+ /* Set the new channel sample time */
+ tmpreg1 |= tmpreg2;
+ /* Store the new register value */
+ ADCx->SMPT1 = tmpreg1;
+ }
+ else /* ADC_Channel include in ADC_Channel_[0..9] */
+ {
+ /* Get the old register value */
+ tmpreg1 = ADCx->SMPT2;
+ /* Calculate the mask to clear */
+ tmpreg2 = SMPT2_SMP_Set << (3 * ADC_Channel);
+ /* Clear the old channel sample time */
+ tmpreg1 &= ~tmpreg2;
+ /* Calculate the mask to set */
+ tmpreg2 = (uint32_t)ADC_SampleTime << (3 * ADC_Channel);
+ /* Set the new channel sample time */
+ tmpreg1 |= tmpreg2;
+ /* Store the new register value */
+ ADCx->SMPT2 = tmpreg1;
+ }
+
+ /* Rank configuration */
+ /* Get the old register value */
+ tmpreg1 = ADCx->JSQ;
+ /* Get JL value: Number = JL+1 */
+ tmpreg3 = (tmpreg1 & JSQR_JLEN_Set) >> 20;
+ /* Calculate the mask to clear: ((Rank-1)+(4-JL-1)) */
+ tmpreg2 = JSQR_JSQ_Set << (5 * (uint8_t)((Rank + 3) - (tmpreg3 + 1)));
+ /* Clear the old JSQx bits for the selected rank */
+ tmpreg1 &= ~tmpreg2;
+ /* Calculate the mask to set: ((Rank-1)+(4-JL-1)) */
+ tmpreg2 = (uint32_t)ADC_Channel << (5 * (uint8_t)((Rank + 3) - (tmpreg3 + 1)));
+ /* Set the JSQx bits for the selected rank */
+ tmpreg1 |= tmpreg2;
+ /* Store the new register value */
+ ADCx->JSQ = tmpreg1;
+}
+
+/**
+ * @brief Configures the sequencer length for injected channels
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param Length: The sequencer length.
+ * This parameter must be a number between 1 to 4.
+ * @retval None
+ */
+void ADC_InjectedSequencerLengthConfig(ADC_Type* ADCx, uint8_t Length)
+{
+ uint32_t tmpreg1 = 0;
+ uint32_t tmpreg2 = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_INJECTED_LENGTH(Length));
+
+ /* Get the old register value */
+ tmpreg1 = ADCx->JSQ;
+ /* Clear the old injected sequnence lenght JL bits */
+ tmpreg1 &= JSQR_JLEN_Rst;
+ /* Set the injected sequnence lenght JL bits */
+ tmpreg2 = Length - 1;
+ tmpreg1 |= tmpreg2 << 20;
+ /* Store the new register value */
+ ADCx->JSQ = tmpreg1;
+}
+
+/**
+ * @brief Set the injected channels conversion value offset
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_InjectedChannel: the ADC injected channel to set its offset.
+ * This parameter can be one of the following values:
+ * @arg ADC_InjectedChannel_1: Injected Channel1 selected
+ * @arg ADC_InjectedChannel_2: Injected Channel2 selected
+ * @arg ADC_InjectedChannel_3: Injected Channel3 selected
+ * @arg ADC_InjectedChannel_4: Injected Channel4 selected
+ * @param Offset: the offset value for the selected ADC injected channel
+ * This parameter must be a 12bit value.
+ * @retval None
+ */
+void ADC_SetInjectedOffset(ADC_Type* ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_INJECTED_CHANNEL(ADC_InjectedChannel));
+ assert_param(IS_ADC_OFFSET(Offset));
+
+ tmp = (uint32_t)ADCx;
+ tmp += ADC_InjectedChannel;
+
+ /* Set the selected injected channel data offset */
+ *(__IO uint32_t *) tmp = (uint32_t)Offset;
+}
+
+/**
+ * @brief Returns the ADC injected channel conversion result
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_InjectedChannel: the converted ADC injected channel.
+ * This parameter can be one of the following values:
+ * @arg ADC_InjectedChannel_1: Injected Channel1 selected
+ * @arg ADC_InjectedChannel_2: Injected Channel2 selected
+ * @arg ADC_InjectedChannel_3: Injected Channel3 selected
+ * @arg ADC_InjectedChannel_4: Injected Channel4 selected
+ * @retval The Data conversion value.
+ */
+uint16_t ADC_GetInjectedConversionValue(ADC_Type* ADCx, uint8_t ADC_InjectedChannel)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_INJECTED_CHANNEL(ADC_InjectedChannel));
+
+ tmp = (uint32_t)ADCx;
+ tmp += ADC_InjectedChannel + JDOR_Offset;
+
+ /* Returns the selected injected channel conversion data value */
+ return (uint16_t) (*(__IO uint32_t*) tmp);
+}
+
+/**
+ * @brief Enables or disables the analog watchdog on single/all regular
+ * or injected channels
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_AnalogWatchdog: the ADC analog watchdog configuration.
+ * This parameter can be one of the following values:
+ * @arg ADC_AnalogWDG_SingleRegEnable: Analog watchdog on a single regular channel
+ * @arg ADC_AnalogWDG_SingleInjecEnable: Analog watchdog on a single injected channel
+ * @arg ADC_AnalogWDG_SingleRegOrInjecEnable: Analog watchdog on a single regular or injected channel
+ * @arg ADC_AnalogWDG_AllRegEnable: Analog watchdog on all regular channel
+ * @arg ADC_AnalogWDG_AllInjecEnable: Analog watchdog on all injected channel
+ * @arg ADC_AnalogWDG_AllRegAllInjecEnable: Analog watchdog on all regular and injected channels
+ * @arg ADC_AnalogWDG_None: No channel guarded by the analog watchdog
+ * @retval None
+ */
+void ADC_AnalogWDGCtrl(ADC_Type* ADCx, uint32_t ADC_AnalogWatchdog)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_ANALOG_WDG(ADC_AnalogWatchdog));
+ /* Get the old register value */
+ tmpreg = ADCx->CTRL1;
+ /* Clear AWDEN, AWDENJ and AWDSGL bits */
+ tmpreg &= CTRL1_AWDMode_Rst;
+ /* Set the analog watchdog enable mode */
+ tmpreg |= ADC_AnalogWatchdog;
+ /* Store the new register value */
+ ADCx->CTRL1 = tmpreg;
+}
+
+/**
+ * @brief Configures the high and low thresholds of the analog watchdog.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param HighThreshold: the ADC analog watchdog High threshold value.
+ * This parameter must be a 12bit value.
+ * @param LowThreshold: the ADC analog watchdog Low threshold value.
+ * This parameter must be a 12bit value.
+ * @retval None
+ */
+void ADC_AnalogWDGThresholdsConfig(ADC_Type* ADCx, uint16_t HighThreshold,
+ uint16_t LowThreshold)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_THRESHOLD(HighThreshold));
+ assert_param(IS_ADC_THRESHOLD(LowThreshold));
+ /* Set the ADCx high threshold */
+ ADCx->WHTR = HighThreshold;
+ /* Set the ADCx low threshold */
+ ADCx->WLTR = LowThreshold;
+}
+
+/**
+ * @brief Configures the analog watchdog guarded single channel
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_Channel: the ADC channel to configure for the analog watchdog.
+ * This parameter can be one of the following values:
+ * @arg ADC_Channel_0: ADC Channel0 selected
+ * @arg ADC_Channel_1: ADC Channel1 selected
+ * @arg ADC_Channel_2: ADC Channel2 selected
+ * @arg ADC_Channel_3: ADC Channel3 selected
+ * @arg ADC_Channel_4: ADC Channel4 selected
+ * @arg ADC_Channel_5: ADC Channel5 selected
+ * @arg ADC_Channel_6: ADC Channel6 selected
+ * @arg ADC_Channel_7: ADC Channel7 selected
+ * @arg ADC_Channel_8: ADC Channel8 selected
+ * @arg ADC_Channel_9: ADC Channel9 selected
+ * @arg ADC_Channel_10: ADC Channel10 selected
+ * @arg ADC_Channel_11: ADC Channel11 selected
+ * @arg ADC_Channel_12: ADC Channel12 selected
+ * @arg ADC_Channel_13: ADC Channel13 selected
+ * @arg ADC_Channel_14: ADC Channel14 selected
+ * @arg ADC_Channel_15: ADC Channel15 selected
+ * @arg ADC_Channel_16: ADC Channel16 selected
+ * @arg ADC_Channel_17: ADC Channel17 selected
+ * @retval None
+ */
+void ADC_AnalogWDGSingleChannelConfig(ADC_Type* ADCx, uint8_t ADC_Channel)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_CHANNEL(ADC_Channel));
+ /* Get the old register value */
+ tmpreg = ADCx->CTRL1;
+ /* Clear the Analog watchdog channel select bits */
+ tmpreg &= CTRL1_AWDCH_Rst;
+ /* Set the Analog watchdog channel */
+ tmpreg |= ADC_Channel;
+ /* Store the new register value */
+ ADCx->CTRL1 = tmpreg;
+}
+
+/**
+ * @brief Enables or disables the temperature sensor and Vrefint channel.
+ * @param NewState: new state of the temperature sensor.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ADC_TempSensorVrefintCtrl(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the temperature sensor and Vrefint channel*/
+ ADC1->CTRL2 |= CTRL2_TSVREFE_Set;
+ }
+ else
+ {
+ /* Disable the temperature sensor and Vrefint channel*/
+ ADC1->CTRL2 &= CTRL2_TSVREFE_Rst;
+ }
+}
+
+/**
+ * @brief Checks whether the specified ADC flag is set or not.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg ADC_FLAG_AWD: Analog watchdog flag
+ * @arg ADC_FLAG_EC: End of conversion flag
+ * @arg ADC_FLAG_JEC: End of injected group conversion flag
+ * @arg ADC_FLAG_JSTR: Start of injected group conversion flag
+ * @arg ADC_FLAG_RSTR: Start of regular group conversion flag
+ * @retval The new state of ADC_FLAG (SET or RESET).
+ */
+FlagStatus ADC_GetFlagStatus(ADC_Type* ADCx, uint8_t ADC_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_GET_FLAG(ADC_FLAG));
+
+ /* Check the status of the specified ADC flag */
+ if ((ADCx->STS & ADC_FLAG) != (uint8_t)RESET)
+ {
+ /* ADC_FLAG is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* ADC_FLAG is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the ADC_FLAG status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the ADCx's pending flags.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_FLAG: specifies the flag to clear.
+ * This parameter can be any combination of the following values:
+ * @arg ADC_FLAG_AWD: Analog watchdog flag
+ * @arg ADC_FLAG_EC: End of conversion flag
+ * @arg ADC_FLAG_JEC: End of injected group conversion flag
+ * @arg ADC_FLAG_JSTR: Start of injected group conversion flag
+ * @arg ADC_FLAG_RSTR: Start of regular group conversion flag
+ * @retval None
+ */
+void ADC_ClearFlag(ADC_Type* ADCx, uint8_t ADC_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_CLEAR_FLAG(ADC_FLAG));
+ /* Clear the selected ADC flags */
+ ADCx->STS = ~(uint32_t)ADC_FLAG;
+}
+
+/**
+ * @brief Checks whether the specified ADC interrupt has occurred or not.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_INT: specifies the ADC interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg ADC_INT_EC: End of conversion interrupt mask
+ * @arg ADC_INT_AWD: Analog watchdog interrupt mask
+ * @arg ADC_INT_JEC: End of injected conversion interrupt mask
+ * @retval The new state of ADC_INT (SET or RESET).
+ */
+ITStatus ADC_GetINTStatus(ADC_Type* ADCx, uint16_t ADC_INT)
+{
+ ITStatus bitstatus = RESET;
+ uint32_t itmask = 0, enablestatus = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_GET_INT(ADC_INT));
+ /* Get the ADC INT index */
+ itmask = ADC_INT >> 8;
+ /* Get the ADC_INT enable bit status */
+ enablestatus = (ADCx->CTRL1 & (uint8_t)ADC_INT) ;
+
+ /* Check the status of the specified ADC interrupt */
+ if (((ADCx->STS & itmask) != (uint32_t)RESET) && enablestatus)
+ {
+ /* ADC_INT is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* ADC_INT is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the ADC_INT status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the ADCx's interrupt pending bits.
+ * @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
+ * @param ADC_INT: specifies the ADC interrupt pending bit to clear.
+ * This parameter can be any combination of the following values:
+ * @arg ADC_INT_EC: End of conversion interrupt mask
+ * @arg ADC_INT_AWD: Analog watchdog interrupt mask
+ * @arg ADC_INT_JEC: End of injected conversion interrupt mask
+ * @retval None
+ */
+void ADC_ClearINTPendingBit(ADC_Type* ADCx, uint16_t ADC_INT)
+{
+ uint8_t itmask = 0;
+ /* Check the parameters */
+ assert_param(IS_ADC_ALL_PERIPH(ADCx));
+ assert_param(IS_ADC_INT(ADC_INT));
+ /* Get the ADC INT index */
+ itmask = (uint8_t)(ADC_INT >> 8);
+ /* Clear the selected ADC interrupt pending bits */
+ ADCx->STS = ~(uint32_t)itmask;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_bkp.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_bkp.c
new file mode 100644
index 0000000000000000000000000000000000000000..ecee79574ce28a4200ab7c99eb8e8255f89e0b3e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_bkp.c
@@ -0,0 +1,302 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_bkp.c
+ * Description : at32f4xx BKP source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_bkp.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup BKP
+ * @brief BKP driver modules
+ * @{
+ */
+
+#if defined (AT32F403xx) || defined (AT32F413xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+
+/** @defgroup BKP_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup BKP_Private_Defines
+ * @{
+ */
+
+/* ------------ BKP registers bit address in the alias region --------------- */
+#define BKP_OFFSET (BKP_BASE - PERIPH_BASE)
+
+/* --- CTRL Register ----*/
+
+/* Alias word address of TPAL bit */
+#define CTRL_OFFSET (BKP_OFFSET + 0x30)
+#define TPALV_BitPos 0x01
+#define CTRL_TPALV_BBMAP (PERIPH_BB_BASE + (CTRL_OFFSET * 32) + (TPALV_BitPos * 4))
+
+/* Alias word address of TPE bit */
+#define TPEN_BitPos 0x00
+#define CTRL_TPEN_BBMAP (PERIPH_BB_BASE + (CTRL_OFFSET * 32) + (TPEN_BitPos * 4))
+
+/* --- CTRLSTS Register ---*/
+
+/* Alias word address of TPIE bit */
+#define CTRLSTS_OFFSET (BKP_OFFSET + 0x34)
+#define TPIEN_BitPos 0x02
+#define CTRLSTS_TPIEN_BBMAP (PERIPH_BB_BASE + (CTRLSTS_OFFSET * 32) + (TPIEN_BitPos * 4))
+
+/* Alias word address of TIF bit */
+#define TPIF_BitPos 0x09
+#define CTRLSTS_TPIF_BBMAP (PERIPH_BB_BASE + (CTRLSTS_OFFSET * 32) + (TPIF_BitPos * 4))
+
+/* Alias word address of TEF bit */
+#define TPEF_BitPos 0x08
+#define CTRLSTS_TPEF_BBMAP (PERIPH_BB_BASE + (CTRLSTS_OFFSET * 32) + (TPEF_BitPos * 4))
+
+/* ---------------------- BKP registers bit mask ------------------------ */
+
+/* RTCCR register bit mask */
+#define RTCCAL_CAL_MASK ((uint16_t)0xFF80)
+#define RTCCAL_MASK ((uint16_t)0xFC7F)
+
+/**
+ * @}
+ */
+
+
+/** @defgroup BKP_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup BKP_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup BKP_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup BKP_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the BKP peripheral registers to their default reset values.
+ * @param None
+ * @retval None
+ */
+void BKP_Reset(void)
+{
+ RCC_BackupResetCmd(ENABLE);
+ RCC_BackupResetCmd(DISABLE);
+}
+
+/**
+ * @brief Configures the Tamper Pin active level.
+ * @param BKP_TamperPinLevel: specifies the Tamper Pin active level.
+ * This parameter can be one of the following values:
+ * @arg BKP_TamperPinLv_H: Tamper pin active on high level
+ * @arg BKP_TamperPinLv_L: Tamper pin active on low level
+ * @retval None
+ */
+void BKP_TamperPinLvConfig(uint16_t BKP_TamperPinLevel)
+{
+ /* Check the parameters */
+ assert_param(IS_BKP_TAMPER_PIN_LV(BKP_TamperPinLevel));
+ *(__IO uint32_t *) CTRL_TPALV_BBMAP = BKP_TamperPinLevel;
+}
+
+/**
+ * @brief Enables or disables the Tamper Pin activation.
+ * @param NewState: new state of the Tamper Pin activation.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void BKP_TamperPinCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) CTRL_TPEN_BBMAP = (uint32_t)NewState;
+}
+
+/**
+ * @brief Enables or disables the Tamper Pin Interrupt.
+ * @param NewState: new state of the Tamper Pin Interrupt.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void BKP_IntConfig(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) CTRLSTS_TPIEN_BBMAP = (uint32_t)NewState;
+}
+
+/**
+ * @brief Select the RTC output source to output on the Tamper pin.
+ * @param BKP_RTCOutputSource: specifies the RTC output source.
+ * This parameter can be one of the following values:
+ * @arg BKP_RTCOutput_None: no RTC output on the Tamper pin.
+ * @arg BKP_RTCOutput_CalClk: output the RTC clock with frequency
+ * divided by 64 on the Tamper pin.
+ * @arg BKP_RTCOutput_Alarm: output the RTC Alarm pulse signal on
+ * the Tamper pin.
+ * @arg BKP_RTCOutput_Second: output the RTC Second pulse signal on
+ * the Tamper pin.
+ * @retval None
+ */
+void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource)
+{
+ uint16_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_BKP_RTC_OUTPUT_SEL(BKP_RTCOutputSource));
+ tmpreg = BKP->RTCCAL;
+ /* Clear CCO, ASOE and ASOS bits */
+ tmpreg &= RTCCAL_MASK;
+
+ /* Set CCO, ASOE and ASOS bits according to BKP_RTCOutputSource value */
+ tmpreg |= BKP_RTCOutputSource;
+ /* Store the new value */
+ BKP->RTCCAL = tmpreg;
+}
+
+/**
+ * @brief Sets RTC Clock Calibration value.
+ * @param CalibrationValue: specifies the RTC Clock Calibration value.
+ * This parameter must be a number between 0 and 0x7F.
+ * @retval None
+ */
+void BKP_SetRTCCalValue(uint8_t CalibrationValue)
+{
+ uint16_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_BKP_CAL_VAL(CalibrationValue));
+ tmpreg = BKP->RTCCAL;
+ /* Clear CAL[6:0] bits */
+ tmpreg &= RTCCAL_CAL_MASK;
+ /* Set CAL[6:0] bits according to CalibrationValue value */
+ tmpreg |= CalibrationValue;
+ /* Store the new value */
+ BKP->RTCCAL = tmpreg;
+}
+
+/**
+ * @brief Writes user data to the specified Data Backup Register.
+ * @param BKP_DR: specifies the Data Backup Register.
+ * This parameter can be BKP_DRx where x:[1, 42]
+ * @param Data: data to write
+ * @retval None
+ */
+void BKP_WriteBackupReg(uint16_t BKP_DR, uint16_t Data)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_BKP_DT(BKP_DR));
+
+ tmp = (uint32_t)BKP_BASE;
+ tmp += BKP_DR;
+
+ *(__IO uint32_t *) tmp = Data;
+}
+
+/**
+ * @brief Reads data from the specified Data Backup Register.
+ * @param BKP_DR: specifies the Data Backup Register.
+ * This parameter can be BKP_DRx where x:[1, 42]
+ * @retval The content of the specified Data Backup Register
+ */
+uint16_t BKP_ReadBackupReg(uint16_t BKP_DR)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_BKP_DT(BKP_DR));
+
+ tmp = (uint32_t)BKP_BASE;
+ tmp += BKP_DR;
+
+ return (*(__IO uint16_t *) tmp);
+}
+
+/**
+ * @brief Checks whether the Tamper Pin Event flag is set or not.
+ * @param None
+ * @retval The new state of the Tamper Pin Event flag (SET or RESET).
+ */
+FlagStatus BKP_GetFlagStatus(void)
+{
+ return (FlagStatus)(*(__IO uint32_t *) CTRLSTS_TPEF_BBMAP);
+}
+
+/**
+ * @brief Clears Tamper Pin Event pending flag.
+ * @param None
+ * @retval None
+ */
+void BKP_ClearFlag(void)
+{
+ /* Set CTE bit to clear Tamper Pin Event flag */
+ BKP->CTRLSTS |= BKP_CTRLSTS_CTPEF;
+}
+
+/**
+ * @brief Checks whether the Tamper Pin Interrupt has occurred or not.
+ * @param None
+ * @retval The new state of the Tamper Pin Interrupt (SET or RESET).
+ */
+ITStatus BKP_GetIntStatus(void)
+{
+ return (ITStatus)(*(__IO uint32_t *) CTRLSTS_TPIF_BBMAP);
+}
+
+/**
+ * @brief Clears Tamper Pin Interrupt pending bit.
+ * @param None
+ * @retval None
+ */
+void BKP_ClearIntPendingBit(void)
+{
+ /* Set CTI bit to clear Tamper Pin Interrupt pending bit */
+ BKP->CTRLSTS |= BKP_CTRLSTS_CTPIF;
+}
+
+/**
+ * @}
+ */
+
+#endif /* AT32F403xx || AT32F413xx || AT32F403Axx || AT32F407xx */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_can.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_can.c
new file mode 100644
index 0000000000000000000000000000000000000000..e6a8f0cb399692dbe5cce34784f3e1023e54a98e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_can.c
@@ -0,0 +1,1480 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_can.c
+ * Description : at32f4xx CAN source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_can.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup CAN
+ * @brief CAN driver modules
+ * @{
+ */
+
+/** @defgroup CAN_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Private_Defines
+ * @{
+ */
+
+/* CAN Master Control Register bits */
+
+#define MCR_DBF ((uint32_t)0x00010000) /* software master reset */
+
+/* CAN Mailbox Transmit Request */
+#define TMIDxR_TXRQ ((uint32_t)0x00000001) /* Transmit mailbox request */
+
+/* CAN Filter Master Register bits */
+#define FM_FINIT ((uint32_t)0x00000001) /* Filter init mode */
+
+/* Time out for INAK bit */
+#define IAK_TIMEOUT ((uint32_t)0x0000FFFF)
+/* Time out for SLAK bit */
+#define SAK_TIMEOUT ((uint32_t)0x0000FFFF)
+
+
+
+/* Flags in TSR register */
+#define CAN_FLAGS_TTST ((uint32_t)0x08000000)
+/* Flags in RF1R register */
+#define CAN_FLAGS_RF1 ((uint32_t)0x04000000)
+/* Flags in RF0R register */
+#define CAN_FLAGS_RF0 ((uint32_t)0x02000000)
+/* Flags in MSR register */
+#define CAN_FLAGS_MSTS ((uint32_t)0x01000000)
+/* Flags in ESR register */
+#define CAN_FLAGS_ESTS ((uint32_t)0x00F00000)
+
+/* Mailboxes definition */
+#define CAN_TXMAILBOX_0 ((uint8_t)0x00)
+#define CAN_TXMAILBOX_1 ((uint8_t)0x01)
+#define CAN_TXMAILBOX_2 ((uint8_t)0x02)
+
+
+
+#define CAN_MODE_MSK ((uint32_t) 0x00000003)
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Private_FunctionPrototypes
+ * @{
+ */
+
+static ITStatus CheckINTStatus(uint32_t CAN_Reg, uint32_t It_Bit);
+
+/**
+ * @}
+ */
+
+/** @defgroup CAN_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the CAN peripheral registers to their default reset values.
+ * @param CANx: where x can be only 1 to select the CAN peripheral.
+ * @retval None.
+ */
+void CAN_Reset(CAN_Type* CANx)
+{
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+
+ if (CANx == CAN1)
+ {
+ /* Enable CAN1 reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_CAN1, ENABLE);
+ /* Release CAN1 from reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_CAN1, DISABLE);
+ }
+#ifdef AT32F413xx
+#ifndef AT32FEBKCx_MD
+ if (CANx == CAN2)
+ {
+ /* Enable CAN1 reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_CAN2, ENABLE);
+ /* Release CAN1 from reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_CAN2, DISABLE);
+ }
+#endif
+#endif
+}
+
+/**
+ * @brief Initializes the CAN peripheral according to the specified
+ * parameters in the CAN_InitStruct.
+ * @param CANx: where x can be only 1 to to select the CAN
+ * peripheral.
+ * @param CAN_InitStruct: pointer to a CAN_InitType structure that
+ * contains the configuration information for the
+ * CAN peripheral.
+ * @retval Constant indicates initialization succeed which will be
+ * CAN_InitStatus_Failed or CAN_InitStatus_Success.
+ */
+uint8_t CAN_Init(CAN_Type* CANx, CAN_InitType* CAN_InitStruct)
+{
+ uint8_t InitStatus = CAN_InitStatus_Failed;
+ uint32_t wait_ack = 0x00000000;
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_FUNCTIONAL_STATE(CAN_InitStruct->CAN_TTC));
+ assert_param(IS_FUNCTIONAL_STATE(CAN_InitStruct->CAN_ABO));
+ assert_param(IS_FUNCTIONAL_STATE(CAN_InitStruct->CAN_AWU));
+ assert_param(IS_FUNCTIONAL_STATE(CAN_InitStruct->CAN_NART));
+ assert_param(IS_FUNCTIONAL_STATE(CAN_InitStruct->CAN_RFL));
+ assert_param(IS_FUNCTIONAL_STATE(CAN_InitStruct->CAN_TFP));
+ assert_param(IS_CAN_MODE(CAN_InitStruct->CAN_Mode));
+ assert_param(IS_CAN_SJW(CAN_InitStruct->CAN_SJW));
+ assert_param(IS_CAN_BS1(CAN_InitStruct->CAN_BS1));
+ assert_param(IS_CAN_BS2(CAN_InitStruct->CAN_BS2));
+ assert_param(IS_CAN_PRESCALER(CAN_InitStruct->CAN_Prescaler));
+
+ /* Exit from sleep mode */
+ CANx->MCTRL &= (~(uint32_t)CAN_MCTRL_SLP);
+
+ /* Request initialisation */
+ CANx->MCTRL |= CAN_MCTRL_INRQ ;
+
+ /* Wait the acknowledge */
+ while (((CANx->MSTS & CAN_MSTS_IAK) != CAN_MSTS_IAK) && (wait_ack != IAK_TIMEOUT))
+ {
+ wait_ack++;
+ }
+
+ /* Check acknowledge */
+ if ((CANx->MSTS & CAN_MSTS_IAK) != CAN_MSTS_IAK)
+ {
+ InitStatus = CAN_InitStatus_Failed;
+ }
+ else
+ {
+ /* Set the time triggered communication mode */
+ if (CAN_InitStruct->CAN_TTC == ENABLE)
+ {
+ CANx->MCTRL |= CAN_MCTRL_TTC;
+ }
+ else
+ {
+ CANx->MCTRL &= ~(uint32_t)CAN_MCTRL_TTC;
+ }
+
+ /* Set the automatic bus-off management */
+ if (CAN_InitStruct->CAN_ABO == ENABLE)
+ {
+ CANx->MCTRL |= CAN_MCTRL_ABO;
+ }
+ else
+ {
+ CANx->MCTRL &= ~(uint32_t)CAN_MCTRL_ABO;
+ }
+
+ /* Set the automatic wake-up mode */
+ if (CAN_InitStruct->CAN_AWU == ENABLE)
+ {
+ CANx->MCTRL |= CAN_MCTRL_AWU;
+ }
+ else
+ {
+ CANx->MCTRL &= ~(uint32_t)CAN_MCTRL_AWU;
+ }
+
+ /* Set the no automatic retransmission */
+ if (CAN_InitStruct->CAN_NART == ENABLE)
+ {
+ CANx->MCTRL |= CAN_MCTRL_NART;
+ }
+ else
+ {
+ CANx->MCTRL &= ~(uint32_t)CAN_MCTRL_NART;
+ }
+
+ /* Set the receive FIFO locked mode */
+ if (CAN_InitStruct->CAN_RFL == ENABLE)
+ {
+ CANx->MCTRL |= CAN_MCTRL_RFL;
+ }
+ else
+ {
+ CANx->MCTRL &= ~(uint32_t)CAN_MCTRL_RFL;
+ }
+
+ /* Set the transmit FIFO priority */
+ if (CAN_InitStruct->CAN_TFP == ENABLE)
+ {
+ CANx->MCTRL |= CAN_MCTRL_TFP;
+ }
+ else
+ {
+ CANx->MCTRL &= ~(uint32_t)CAN_MCTRL_TFP;
+ }
+
+ /* Set the bit timing register */
+ CANx->BTMG = (uint32_t)((uint32_t)CAN_InitStruct->CAN_Mode << 30) | \
+ ((uint32_t)CAN_InitStruct->CAN_SJW << 24) | \
+ ((uint32_t)CAN_InitStruct->CAN_BS1 << 16) | \
+ ((uint32_t)CAN_InitStruct->CAN_BS2 << 20) | \
+ ((uint32_t)CAN_InitStruct->CAN_Prescaler - 1);
+
+ /* Request leave initialisation */
+ CANx->MCTRL &= ~(uint32_t)CAN_MCTRL_INRQ;
+
+ /* Wait the acknowledge */
+ wait_ack = 0;
+
+ while (((CANx->MSTS & CAN_MSTS_IAK) == CAN_MSTS_IAK) && (wait_ack != IAK_TIMEOUT))
+ {
+ wait_ack++;
+ }
+
+ /* ...and check acknowledged */
+ if ((CANx->MSTS & CAN_MSTS_IAK) == CAN_MSTS_IAK)
+ {
+ InitStatus = CAN_InitStatus_Failed;
+ }
+ else
+ {
+ InitStatus = CAN_InitStatus_Success ;
+ }
+ }
+
+ /* At this step, return the status of initialization */
+ return InitStatus;
+}
+
+/**
+ * @brief Initializes the CAN peripheral according to the specified
+ * parameters in the CAN_FilterInitStruct.
+ * @param CANx: where x can be only 1 to to select the CAN
+ * peripheral.
+ * @param CAN_FilterInitStruct: pointer to a CAN_FilterInitType
+ * structure that contains the configuration
+ * information.
+ * @retval None.
+ */
+void CAN_FilterInit(CAN_Type* CANx, CAN_FilterInitType* CAN_FilterInitStruct)
+{
+ uint32_t filter_number_bit_pos = 0;
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_FILTER_NUMBER(CAN_FilterInitStruct->CAN_FilterNumber));
+ assert_param(IS_CAN_FILTER_MODE(CAN_FilterInitStruct->CAN_FilterMode));
+ assert_param(IS_CAN_FILTER_SCALE(CAN_FilterInitStruct->CAN_FilterScale));
+ assert_param(IS_CAN_FILTER_FIFO(CAN_FilterInitStruct->CAN_FilterFIFOAssignment));
+ assert_param(IS_FUNCTIONAL_STATE(CAN_FilterInitStruct->CAN_FilterActivation));
+
+ filter_number_bit_pos = ((uint32_t)1) << CAN_FilterInitStruct->CAN_FilterNumber;
+
+ /* Initialisation mode for the filter */
+ CANx->FM |= FM_FINIT;
+
+ /* Filter Deactivation */
+ CANx->FA1 &= ~(uint32_t)filter_number_bit_pos;
+
+ /* Filter Scale */
+ if (CAN_FilterInitStruct->CAN_FilterScale == CAN_FilterScale_16bit)
+ {
+ /* 16-bit scale for the filter */
+ CANx->FS1 &= ~(uint32_t)filter_number_bit_pos;
+
+ /* First 16-bit identifier and First 16-bit mask */
+ /* Or First 16-bit identifier and Second 16-bit identifier */
+ CANx->FilterRegister[CAN_FilterInitStruct->CAN_FilterNumber].FBR1 =
+ ((0x0000FFFF & (uint32_t)CAN_FilterInitStruct->CAN_FilterMskIdLow) << 16) |
+ (0x0000FFFF & (uint32_t)CAN_FilterInitStruct->CAN_FilterIdLow);
+
+ /* Second 16-bit identifier and Second 16-bit mask */
+ /* Or Third 16-bit identifier and Fourth 16-bit identifier */
+ CANx->FilterRegister[CAN_FilterInitStruct->CAN_FilterNumber].FBR2 =
+ ((0x0000FFFF & (uint32_t)CAN_FilterInitStruct->CAN_FilterMskIdHigh) << 16) |
+ (0x0000FFFF & (uint32_t)CAN_FilterInitStruct->CAN_FilterIdHigh);
+ }
+
+ if (CAN_FilterInitStruct->CAN_FilterScale == CAN_FilterScale_32bit)
+ {
+ /* 32-bit scale for the filter */
+ CANx->FS1 |= filter_number_bit_pos;
+ /* 32-bit identifier or First 32-bit identifier */
+ CANx->FilterRegister[CAN_FilterInitStruct->CAN_FilterNumber].FBR1 =
+ ((0x0000FFFF & (uint32_t)CAN_FilterInitStruct->CAN_FilterIdHigh) << 16) |
+ (0x0000FFFF & (uint32_t)CAN_FilterInitStruct->CAN_FilterIdLow);
+ /* 32-bit mask or Second 32-bit identifier */
+ CANx->FilterRegister[CAN_FilterInitStruct->CAN_FilterNumber].FBR2 =
+ ((0x0000FFFF & (uint32_t)CAN_FilterInitStruct->CAN_FilterMskIdHigh) << 16) |
+ (0x0000FFFF & (uint32_t)CAN_FilterInitStruct->CAN_FilterMskIdLow);
+ }
+
+ /* Filter Mode */
+ if (CAN_FilterInitStruct->CAN_FilterMode == CAN_FilterMode_IdMask)
+ {
+ /*Id/Mask mode for the filter*/
+ CANx->FM1 &= ~(uint32_t)filter_number_bit_pos;
+ }
+ else /* CAN_FilterInitStruct->CAN_FilterMode == CAN_FilterMode_IdList */
+ {
+ /*Identifier list mode for the filter*/
+ CANx->FM1 |= (uint32_t)filter_number_bit_pos;
+ }
+
+ /* Filter FIFO assignment */
+ if (CAN_FilterInitStruct->CAN_FilterFIFOAssignment == CAN_Filter_FIFO0)
+ {
+ /* FIFO 0 assignation for the filter */
+ CANx->FFA1 &= ~(uint32_t)filter_number_bit_pos;
+ }
+
+ if (CAN_FilterInitStruct->CAN_FilterFIFOAssignment == CAN_Filter_FIFO1)
+ {
+ /* FIFO 1 assignation for the filter */
+ CANx->FFA1 |= (uint32_t)filter_number_bit_pos;
+ }
+
+ /* Filter activation */
+ if (CAN_FilterInitStruct->CAN_FilterActivation == ENABLE)
+ {
+ CANx->FA1 |= filter_number_bit_pos;
+ }
+
+ /* Leave the initialisation mode for the filter */
+ CANx->FM &= ~FM_FINIT;
+}
+
+/**
+ * @brief Fills each CAN_InitStruct member with its default value.
+ * @param CAN_InitStruct: pointer to a CAN_InitType structure which
+ * will be initialized.
+ * @retval None.
+ */
+void CAN_StructInit(CAN_InitType* CAN_InitStruct)
+{
+ /* Reset CAN init structure parameters values */
+
+ /* Initialize the time triggered communication mode */
+ CAN_InitStruct->CAN_TTC = DISABLE;
+
+ /* Initialize the automatic bus-off management */
+ CAN_InitStruct->CAN_ABO = DISABLE;
+
+ /* Initialize the automatic wake-up mode */
+ CAN_InitStruct->CAN_AWU = DISABLE;
+
+ /* Initialize the no automatic retransmission */
+ CAN_InitStruct->CAN_NART = DISABLE;
+
+ /* Initialize the receive FIFO locked mode */
+ CAN_InitStruct->CAN_RFL = DISABLE;
+
+ /* Initialize the transmit FIFO priority */
+ CAN_InitStruct->CAN_TFP = DISABLE;
+
+ /* Initialize the CAN_Mode member */
+ CAN_InitStruct->CAN_Mode = CAN_Mode_Normal;
+
+ /* Initialize the CAN_SJW member */
+ CAN_InitStruct->CAN_SJW = CAN_SJW_1tq;
+
+ /* Initialize the CAN_BS1 member */
+ CAN_InitStruct->CAN_BS1 = CAN_BS1_4tq;
+
+ /* Initialize the CAN_BS2 member */
+ CAN_InitStruct->CAN_BS2 = CAN_BS2_3tq;
+
+ /* Initialize the CAN_Prescaler member */
+ CAN_InitStruct->CAN_Prescaler = 1;
+}
+
+/**
+ * @brief Select the start bank filter for slave CAN.
+ * @note None.
+ * @param CAN_BankNumber: Select the start slave bank filter from 1..27.
+ * @retval None.
+ */
+void CAN_SlaveStartBank(uint8_t CAN_BankNumber)
+{
+ /* Check the parameters */
+ assert_param(IS_CAN_BANKNUMBER(CAN_BankNumber));
+
+ /* Enter Initialisation mode for the filter */
+ CAN1->FM |= FM_FINIT;
+
+ /* Select the start slave bank */
+ CAN1->FM &= (uint32_t)0xFFFFC0F1 ;
+ CAN1->FM |= (uint32_t)(CAN_BankNumber) << 8;
+
+ /* Leave Initialisation mode for the filter */
+ CAN1->FM &= ~FM_FINIT;
+}
+
+/**
+ * @brief Enables or disables the DBG Freeze for CAN.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param NewState: new state of the CAN peripheral. This parameter can
+ * be: ENABLE or DISABLE.
+ * @retval None.
+ */
+void CAN_DBGFreeze(CAN_Type* CANx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable Debug Freeze */
+ CANx->MCTRL |= MCR_DBF;
+ }
+ else
+ {
+ /* Disable Debug Freeze */
+ CANx->MCTRL &= ~MCR_DBF;
+ }
+}
+
+
+/**
+ * @brief Enables or disabes the CAN Time TriggerOperation communication mode.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param NewState : Mode new state , can be one of @ref FunctionalState.
+ * @note when enabled, Time stamp (TIME[15:0]) value is sent in the last
+ * two data bytes of the 8-byte message: TIME[7:0] in data byte 6
+ * and TIME[15:8] in data byte 7
+ * @note DLC must be programmed as 8 in order Time Stamp (2 bytes) to be
+ * sent over the CAN bus.
+ * @retval None
+ */
+void CAN_TTComModeCtrl(CAN_Type* CANx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the TTCM mode */
+ CANx->MCTRL |= CAN_MCTRL_TTC;
+
+ /* Set TGT bits */
+ CANx->TxMailBox[0].TDT |= ((uint32_t)CAN_TDT0_TMEN);
+ CANx->TxMailBox[1].TDT |= ((uint32_t)CAN_TDT1_TMEN);
+ CANx->TxMailBox[2].TDT |= ((uint32_t)CAN_TDT2_TMEN);
+ }
+ else
+ {
+ /* Disable the TTCM mode */
+ CANx->MCTRL &= (uint32_t)(~(uint32_t)CAN_MCTRL_TTC);
+
+ /* Reset TGT bits */
+ CANx->TxMailBox[0].TDT &= ((uint32_t)~CAN_TDT0_TMEN);
+ CANx->TxMailBox[1].TDT &= ((uint32_t)~CAN_TDT1_TMEN);
+ CANx->TxMailBox[2].TDT &= ((uint32_t)~CAN_TDT2_TMEN);
+ }
+}
+/**
+ * @brief Initiates the transmission of a message.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param TxMessage: pointer to a structure which contains CAN Id, CAN
+ * DLC and CAN data.
+ * @retval The number of the mailbox that is used for transmission
+ * or CAN_TxStatus_NoMailBox if there is no empty mailbox.
+ */
+uint8_t CAN_Transmit(CAN_Type* CANx, CanTxMsg* TxMessage)
+{
+ uint8_t transmit_mailbox = 0;
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_IDTYPE(TxMessage->IDT));
+ assert_param(IS_CAN_RTR(TxMessage->RTR));
+ assert_param(IS_CAN_DLC(TxMessage->DLC));
+
+ /* Select one empty transmit mailbox */
+ if ((CANx->TSTS & CAN_TSTS_TSME0) == CAN_TSTS_TSME0)
+ {
+ transmit_mailbox = 0;
+ }
+ else if ((CANx->TSTS & CAN_TSTS_TSME1) == CAN_TSTS_TSME1)
+ {
+ transmit_mailbox = 1;
+ }
+ else if ((CANx->TSTS & CAN_TSTS_TSME2) == CAN_TSTS_TSME2)
+ {
+ transmit_mailbox = 2;
+ }
+ else
+ {
+ transmit_mailbox = CAN_TxStatus_NoMailBox;
+ }
+
+ if (transmit_mailbox != CAN_TxStatus_NoMailBox)
+ {
+ /* Set up the Id */
+ CANx->TxMailBox[transmit_mailbox].TMI &= TMIDxR_TXRQ;
+
+ if (TxMessage->IDT == CAN_Id_Standard)
+ {
+ assert_param(IS_CAN_STDID(TxMessage->StdId));
+ CANx->TxMailBox[transmit_mailbox].TMI |= ((TxMessage->StdId << 21) | \
+ TxMessage->RTR);
+ }
+ else
+ {
+ assert_param(IS_CAN_EXTID(TxMessage->ExtId));
+ CANx->TxMailBox[transmit_mailbox].TMI |= ((TxMessage->ExtId << 3) | \
+ TxMessage->IDT | \
+ TxMessage->RTR);
+ }
+
+ /* Set up the DLC */
+ TxMessage->DLC &= (uint8_t)0x0000000F;
+ CANx->TxMailBox[transmit_mailbox].TDT &= (uint32_t)0xFFFFFFF0;
+ CANx->TxMailBox[transmit_mailbox].TDT |= TxMessage->DLC;
+
+ /* Set up the data field */
+ CANx->TxMailBox[transmit_mailbox].TDL = (((uint32_t)TxMessage->Data[3] << 24) |
+ ((uint32_t)TxMessage->Data[2] << 16) |
+ ((uint32_t)TxMessage->Data[1] << 8) |
+ ((uint32_t)TxMessage->Data[0]));
+ CANx->TxMailBox[transmit_mailbox].TDH = (((uint32_t)TxMessage->Data[7] << 24) |
+ ((uint32_t)TxMessage->Data[6] << 16) |
+ ((uint32_t)TxMessage->Data[5] << 8) |
+ ((uint32_t)TxMessage->Data[4]));
+ /* Request transmission */
+ CANx->TxMailBox[transmit_mailbox].TMI |= TMIDxR_TXRQ;
+ }
+
+ return transmit_mailbox;
+}
+
+/**
+ * @brief Checks the transmission of a message.
+ * @param CANx: where x can be only 1 to to select the
+ * CAN peripheral.
+ * @param TransmitMailbox: the number of the mailbox that is used for
+ * transmission.
+ * @retval CAN_TxStatus_Ok if the CAN driver transmits the message, CAN_TxStatus_Failed
+ * in an other case.
+ */
+uint8_t CAN_TransmitStatus(CAN_Type* CANx, uint8_t TransmitMailbox)
+{
+ uint32_t state = 0;
+
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_TRANSMITMAILBOX(TransmitMailbox));
+
+ switch (TransmitMailbox)
+ {
+ case (CAN_TXMAILBOX_0):
+ state = CANx->TSTS & (CAN_TSTS_RQC0 | CAN_TSTS_TOK0 | CAN_TSTS_TSME0);
+ break;
+
+ case (CAN_TXMAILBOX_1):
+ state = CANx->TSTS & (CAN_TSTS_RQC1 | CAN_TSTS_TOK1 | CAN_TSTS_TSME1);
+ break;
+
+ case (CAN_TXMAILBOX_2):
+ state = CANx->TSTS & (CAN_TSTS_RQC2 | CAN_TSTS_TOK2 | CAN_TSTS_TSME2);
+ break;
+
+ default:
+ state = CAN_TxStatus_Failed;
+ break;
+ }
+
+ switch (state)
+ {
+ /* transmit pending */
+ case (0x0):
+ state = CAN_TxStatus_Pending;
+ break;
+
+ /* transmit failed */
+ case (CAN_TSTS_RQC0 | CAN_TSTS_TSME0):
+ state = CAN_TxStatus_Failed;
+ break;
+
+ case (CAN_TSTS_RQC1 | CAN_TSTS_TSME1):
+ state = CAN_TxStatus_Failed;
+ break;
+
+ case (CAN_TSTS_RQC2 | CAN_TSTS_TSME2):
+ state = CAN_TxStatus_Failed;
+ break;
+
+ /* transmit succeeded */
+ case (CAN_TSTS_RQC0 | CAN_TSTS_TOK0 | CAN_TSTS_TSME0):
+ state = CAN_TxStatus_Ok;
+ break;
+
+ case (CAN_TSTS_RQC1 | CAN_TSTS_TOK1 | CAN_TSTS_TSME1):
+ state = CAN_TxStatus_Ok;
+ break;
+
+ case (CAN_TSTS_RQC2 | CAN_TSTS_TOK2 | CAN_TSTS_TSME2):
+ state = CAN_TxStatus_Ok;
+ break;
+
+ default:
+ state = CAN_TxStatus_Failed;
+ break;
+ }
+
+ return (uint8_t) state;
+}
+
+/**
+ * @brief Cancels a transmit request.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param Mailbox: Mailbox number.
+ * @retval None.
+ */
+void CAN_CancelTransmit(CAN_Type* CANx, uint8_t Mailbox)
+{
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_TRANSMITMAILBOX(Mailbox));
+
+ /* abort transmission */
+ switch (Mailbox)
+ {
+ case (CAN_TXMAILBOX_0):
+ CANx->TSTS |= CAN_TSTS_ARQ0;
+ break;
+
+ case (CAN_TXMAILBOX_1):
+ CANx->TSTS |= CAN_TSTS_ARQ1;
+ break;
+
+ case (CAN_TXMAILBOX_2):
+ CANx->TSTS |= CAN_TSTS_ARQ2;
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/**
+ * @brief Receives a message.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param FIFONumber: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1.
+ * @param RxMessage: pointer to a structure receive message which contains
+ * CAN Id, CAN DLC, CAN datas and FMI number.
+ * @retval None.
+ */
+void CAN_Receive(CAN_Type* CANx, uint8_t FIFONumber, CanRxMsg* RxMessage)
+{
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_FIFO(FIFONumber));
+ /* Get the Id */
+ RxMessage->IDT = (uint8_t)0x04 & CANx->FIFOMailBox[FIFONumber].RFI;
+
+ if (RxMessage->IDT == CAN_Id_Standard)
+ {
+ RxMessage->StdId = (uint32_t)0x000007FF & (CANx->FIFOMailBox[FIFONumber].RFI >> 21);
+ }
+ else
+ {
+ RxMessage->ExtId = (uint32_t)0x1FFFFFFF & (CANx->FIFOMailBox[FIFONumber].RFI >> 3);
+ }
+
+ RxMessage->RTR = (uint8_t)0x02 & CANx->FIFOMailBox[FIFONumber].RFI;
+ /* Get the DLC */
+ RxMessage->DLC = (uint8_t)0x0F & CANx->FIFOMailBox[FIFONumber].RDT;
+ /* Get the FMI */
+ RxMessage->FID = (uint8_t)0xFF & (CANx->FIFOMailBox[FIFONumber].RDT >> 8);
+ /* Get the data field */
+ RxMessage->Data[0] = (uint8_t)0xFF & CANx->FIFOMailBox[FIFONumber].RDL;
+ RxMessage->Data[1] = (uint8_t)0xFF & (CANx->FIFOMailBox[FIFONumber].RDL >> 8);
+ RxMessage->Data[2] = (uint8_t)0xFF & (CANx->FIFOMailBox[FIFONumber].RDL >> 16);
+ RxMessage->Data[3] = (uint8_t)0xFF & (CANx->FIFOMailBox[FIFONumber].RDL >> 24);
+ RxMessage->Data[4] = (uint8_t)0xFF & CANx->FIFOMailBox[FIFONumber].RDH;
+ RxMessage->Data[5] = (uint8_t)0xFF & (CANx->FIFOMailBox[FIFONumber].RDH >> 8);
+ RxMessage->Data[6] = (uint8_t)0xFF & (CANx->FIFOMailBox[FIFONumber].RDH >> 16);
+ RxMessage->Data[7] = (uint8_t)0xFF & (CANx->FIFOMailBox[FIFONumber].RDH >> 24);
+
+ /* Release the FIFO */
+ /* Release FIFO0 */
+ if (FIFONumber == CAN_FIFO0)
+ {
+ CANx->RF0 |= CAN_RF0_RRFM0;
+ }
+ /* Release FIFO1 */
+ else /* FIFONumber == CAN_FIFO1 */
+ {
+ CANx->RF1 |= CAN_RF1_RRFM1;
+ }
+}
+
+/**
+ * @brief Releases the specified FIFO.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param FIFONumber: FIFO to release, CAN_FIFO0 or CAN_FIFO1.
+ * @retval None.
+ */
+void CAN_FIFORelease(CAN_Type* CANx, uint8_t FIFONumber)
+{
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_FIFO(FIFONumber));
+
+ /* Release FIFO0 */
+ if (FIFONumber == CAN_FIFO0)
+ {
+ CANx->RF0 |= CAN_RF0_RRFM0;
+ }
+ /* Release FIFO1 */
+ else /* FIFONumber == CAN_FIFO1 */
+ {
+ CANx->RF1 |= CAN_RF1_RRFM1;
+ }
+}
+
+/**
+ * @brief Returns the number of pending messages.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param FIFONumber: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1.
+ * @retval NbMessage : which is the number of pending message.
+ */
+uint8_t CAN_MessagePending(CAN_Type* CANx, uint8_t FIFONumber)
+{
+ uint8_t message_pending = 0;
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_FIFO(FIFONumber));
+
+ if (FIFONumber == CAN_FIFO0)
+ {
+ message_pending = (uint8_t)(CANx->RF0 & (uint32_t)0x03);
+ }
+ else if (FIFONumber == CAN_FIFO1)
+ {
+ message_pending = (uint8_t)(CANx->RF1 & (uint32_t)0x03);
+ }
+ else
+ {
+ message_pending = 0;
+ }
+
+ return message_pending;
+}
+
+
+/**
+ * @brief Select the CAN Operation mode.
+ * @param CAN_OperatingMode : CAN Operating Mode. This parameter can be one
+ * of @ref CAN_Operating_Mode enumeration.
+ * @retval status of the requested mode which can be
+ * - CAN_ModeStatus_Failed CAN failed entering the specific mode
+ * - CAN_ModeStatus_Success CAN Succeed entering the specific mode
+
+ */
+uint8_t CAN_OperatingModeRequest(CAN_Type* CANx, uint8_t CAN_OperatingMode)
+{
+ uint8_t status = CAN_ModeStatus_Failed;
+
+ /* Timeout for INAK or also for SLAK bits*/
+ uint32_t timeout = IAK_TIMEOUT;
+
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_OPERATING_MODE(CAN_OperatingMode));
+
+ if (CAN_OperatingMode == CAN_OperatingMode_Initialization)
+ {
+ /* Request initialisation */
+ CANx->MCTRL = (uint32_t)((CANx->MCTRL & (uint32_t)(~(uint32_t)CAN_MCTRL_SLP)) | CAN_MCTRL_INRQ);
+
+ /* Wait the acknowledge */
+ while (((CANx->MSTS & CAN_MODE_MSK) != CAN_MSTS_IAK) && (timeout != 0))
+ {
+ timeout--;
+ }
+
+ if ((CANx->MSTS & CAN_MODE_MSK) != CAN_MSTS_IAK)
+ {
+ status = CAN_ModeStatus_Failed;
+ }
+ else
+ {
+ status = CAN_ModeStatus_Success;
+ }
+ }
+ else if (CAN_OperatingMode == CAN_OperatingMode_Normal)
+ {
+ /* Request leave initialisation and sleep mode and enter Normal mode */
+ CANx->MCTRL &= (uint32_t)(~(CAN_MCTRL_SLP | CAN_MCTRL_INRQ));
+
+ /* Wait the acknowledge */
+ while (((CANx->MSTS & CAN_MODE_MSK) != 0) && (timeout != 0))
+ {
+ timeout--;
+ }
+
+ if ((CANx->MSTS & CAN_MODE_MSK) != 0)
+ {
+ status = CAN_ModeStatus_Failed;
+ }
+ else
+ {
+ status = CAN_ModeStatus_Success;
+ }
+ }
+ else if (CAN_OperatingMode == CAN_OperatingMode_Sleep)
+ {
+ /* Request Sleep mode */
+ CANx->MCTRL = (uint32_t)((CANx->MCTRL & (uint32_t)(~(uint32_t)CAN_MCTRL_INRQ)) | CAN_MCTRL_SLP);
+
+ /* Wait the acknowledge */
+ while (((CANx->MSTS & CAN_MODE_MSK) != CAN_MSTS_SAK) && (timeout != 0))
+ {
+ timeout--;
+ }
+
+ if ((CANx->MSTS & CAN_MODE_MSK) != CAN_MSTS_SAK)
+ {
+ status = CAN_ModeStatus_Failed;
+ }
+ else
+ {
+ status = CAN_ModeStatus_Success;
+ }
+ }
+ else
+ {
+ status = CAN_ModeStatus_Failed;
+ }
+
+ return (uint8_t) status;
+}
+
+/**
+ * @brief Enters the low power mode.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @retval status: CAN_Sleep_Ok if sleep entered, CAN_Sleep_Failed in an
+ * other case.
+ */
+uint8_t CAN_Sleep(CAN_Type* CANx)
+{
+ uint8_t sleepstatus = CAN_Sleep_Failed;
+
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+
+ /* Request Sleep mode */
+ CANx->MCTRL = (((CANx->MCTRL) & (uint32_t)(~(uint32_t)CAN_MCTRL_INRQ)) | CAN_MCTRL_SLP);
+
+ /* Sleep mode status */
+ if ((CANx->MSTS & (CAN_MSTS_SAK | CAN_MSTS_IAK)) == CAN_MSTS_SAK)
+ {
+ /* Sleep mode not entered */
+ sleepstatus = CAN_Sleep_Ok;
+ }
+
+ /* return sleep mode status */
+ return (uint8_t)sleepstatus;
+}
+
+/**
+ * @brief Wakes the CAN up.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @retval status: CAN_WakeUp_Ok if sleep mode left, CAN_WakeUp_Failed in an
+ * other case.
+ */
+uint8_t CAN_WakeUp(CAN_Type* CANx)
+{
+ uint32_t wait_slak = SAK_TIMEOUT;
+ uint8_t wakeupstatus = CAN_WakeUp_Failed;
+
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+
+ /* Wake up request */
+ CANx->MCTRL &= ~(uint32_t)CAN_MCTRL_SLP;
+
+ /* Sleep mode status */
+ while(((CANx->MSTS & CAN_MSTS_SAK) == CAN_MSTS_SAK) && (wait_slak != 0x00))
+ {
+ wait_slak--;
+ }
+
+ if((CANx->MSTS & CAN_MSTS_SAK) != CAN_MSTS_SAK)
+ {
+ /* wake up done : Sleep mode exited */
+ wakeupstatus = CAN_WakeUp_Ok;
+ }
+
+ /* return wakeup status */
+ return (uint8_t)wakeupstatus;
+}
+
+
+/**
+ * @brief Returns the CANx's last error code (LEC).
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @retval CAN_ErrorCode: specifies the Error code :
+ * - CAN_ErrorCode_NoErr No Error
+ * - CAN_ErrorCode_StuffErr Stuff Error
+ * - CAN_ErrorCode_FormErr Form Error
+ * - CAN_ErrorCode_ACKErr Acknowledgment Error
+ * - CAN_ErrorCode_BitRecessiveErr Bit Recessive Error
+ * - CAN_ErrorCode_BitDominantErr Bit Dominant Error
+ * - CAN_ErrorCode_CRCErr CRC Error
+ * - CAN_ErrorCode_SoftwareSetErr Software Set Error
+ */
+
+uint8_t CAN_GetLastErrorCode(CAN_Type* CANx)
+{
+ uint8_t errorcode = 0;
+
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+
+ /* Get the error code*/
+ errorcode = (((uint8_t)CANx->ESTS) & (uint8_t)CAN_ESTS_ERC);
+
+ /* Return the error code*/
+ return errorcode;
+}
+/**
+ * @brief Returns the CANx Receive Error Counter (REC).
+ * @note In case of an error during reception, this counter is incremented
+ * by 1 or by 8 depending on the error condition as defined by the CAN
+ * standard. After every successful reception, the counter is
+ * decremented by 1 or reset to 120 if its value was higher than 128.
+ * When the counter value exceeds 127, the CAN controller enters the
+ * error passive state.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @retval CAN Receive Error Counter.
+ */
+uint8_t CAN_GetReceiveErrorCounter(CAN_Type* CANx)
+{
+ uint8_t counter = 0;
+
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+
+ /* Get the Receive Error Counter*/
+ counter = (uint8_t)((CANx->ESTS & CAN_ESTS_REC) >> 24);
+
+ /* Return the Receive Error Counter*/
+ return counter;
+}
+
+
+/**
+ * @brief Returns the LSB of the 9-bit CANx Transmit Error Counter(TEC).
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @retval LSB of the 9-bit CAN Transmit Error Counter.
+ */
+uint8_t CAN_GetLSBTransmitErrorCounter(CAN_Type* CANx)
+{
+ uint8_t counter = 0;
+
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+
+ /* Get the LSB of the 9-bit CANx Transmit Error Counter(TEC) */
+ counter = (uint8_t)((CANx->ESTS & CAN_ESTS_TEC) >> 16);
+
+ /* Return the LSB of the 9-bit CANx Transmit Error Counter(TEC) */
+ return counter;
+}
+
+
+/**
+ * @brief Enables or disables the specified CANx interrupts.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param CAN_INT: specifies the CAN interrupt sources to be enabled or disabled.
+ * This parameter can be:
+ * - CAN_INT_TSME,
+ * - CAN_INT_RFP0,
+ * - CAN_INT_RFFU0,
+ * - CAN_INT_RFOV0,
+ * - CAN_INT_RFP1,
+ * - CAN_INT_RFFU1,
+ * - CAN_INT_RFOV1,
+ * - CAN_INT_ERG,
+ * - CAN_INT_ERP,
+ * - CAN_INT_LEC,
+ * - CAN_INT_ERR,
+ * - CAN_INT_WK or
+ * - CAN_INT_SAK.
+ * @param NewState: new state of the CAN interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None.
+ */
+void CAN_INTConfig(CAN_Type* CANx, uint32_t CAN_INT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_INT(CAN_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected CANx interrupt */
+ CANx->INTEN |= CAN_INT;
+ }
+ else
+ {
+ /* Disable the selected CANx interrupt */
+ CANx->INTEN &= ~CAN_INT;
+ }
+}
+/**
+ * @brief Checks whether the specified CAN flag is set or not.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param CAN_FLAG: specifies the flag to check.
+ * This parameter can be one of the following flags:
+ * - CAN_FLAG_ERG
+ * - CAN_FLAG_ERP
+ * - CAN_FLAG_BU
+ * - CAN_FLAG_RQCP0
+ * - CAN_FLAG_RQCP1
+ * - CAN_FLAG_RQCP2
+ * - CAN_FLAG_RFP1
+ * - CAN_FLAG_RFFU1
+ * - CAN_FLAG_RFOV1
+ * - CAN_FLAG_RFP0
+ * - CAN_FLAG_RFFU0
+ * - CAN_FLAG_RFOV0
+ * - CAN_FLAG_WK
+ * - CAN_FLAG_SAK
+ * - CAN_FLAG_ERC
+ * @retval The new state of CAN_FLAG (SET or RESET).
+ */
+FlagStatus CAN_GetFlagStatus(CAN_Type* CANx, uint32_t CAN_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_GET_FLAG(CAN_FLAG));
+
+
+ if((CAN_FLAG & CAN_FLAGS_ESTS) != (uint32_t)RESET)
+ {
+ /* Check the status of the specified CAN flag */
+ if ((CANx->ESTS & (CAN_FLAG & 0x000FFFFF)) != (uint32_t)RESET)
+ {
+ /* CAN_FLAG is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* CAN_FLAG is reset */
+ bitstatus = RESET;
+ }
+ }
+ else if((CAN_FLAG & CAN_FLAGS_MSTS) != (uint32_t)RESET)
+ {
+ /* Check the status of the specified CAN flag */
+ if ((CANx->MSTS & (CAN_FLAG & 0x000FFFFF)) != (uint32_t)RESET)
+ {
+ /* CAN_FLAG is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* CAN_FLAG is reset */
+ bitstatus = RESET;
+ }
+ }
+ else if((CAN_FLAG & CAN_FLAGS_TTST) != (uint32_t)RESET)
+ {
+ /* Check the status of the specified CAN flag */
+ if ((CANx->TSTS & (CAN_FLAG & 0x000FFFFF)) != (uint32_t)RESET)
+ {
+ /* CAN_FLAG is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* CAN_FLAG is reset */
+ bitstatus = RESET;
+ }
+ }
+ else if((CAN_FLAG & CAN_FLAGS_RF0) != (uint32_t)RESET)
+ {
+ /* Check the status of the specified CAN flag */
+ if ((CANx->RF0 & (CAN_FLAG & 0x000FFFFF)) != (uint32_t)RESET)
+ {
+ /* CAN_FLAG is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* CAN_FLAG is reset */
+ bitstatus = RESET;
+ }
+ }
+ else /* If(CAN_FLAG & CAN_FLAGS_RF1 != (uint32_t)RESET) */
+ {
+ /* Check the status of the specified CAN flag */
+ if ((uint32_t)(CANx->RF1 & (CAN_FLAG & 0x000FFFFF)) != (uint32_t)RESET)
+ {
+ /* CAN_FLAG is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* CAN_FLAG is reset */
+ bitstatus = RESET;
+ }
+ }
+
+ /* Return the CAN_FLAG status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the CAN's pending flags.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param CAN_FLAG: specifies the flag to clear.
+ * This parameter can be one of the following flags:
+ * - CAN_FLAG_RQCP0
+ * - CAN_FLAG_RQCP1
+ * - CAN_FLAG_RQCP2
+ * - CAN_FLAG_RFFU1
+ * - CAN_FLAG_RFOV1
+ * - CAN_FLAG_RFFU0
+ * - CAN_FLAG_RFOV0
+ * - CAN_FLAG_WK
+ * - CAN_FLAG_SAK
+ * - CAN_FLAG_ERC
+ * @retval None.
+ */
+void CAN_ClearFlag(CAN_Type* CANx, uint32_t CAN_FLAG)
+{
+ uint32_t flagtmp = 0;
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_CLEAR_FLAG(CAN_FLAG));
+
+ if (CAN_FLAG == CAN_FLAG_ERC) /* ESR register */
+ {
+ /* Clear the selected CAN flags */
+ CANx->ESTS = (uint32_t)RESET;
+ }
+ else /* MSR or TSR or RF0R or RF1R */
+ {
+ flagtmp = CAN_FLAG & 0x000FFFFF;
+
+ if ((CAN_FLAG & CAN_FLAGS_RF0) != (uint32_t)RESET)
+ {
+ /* Receive Flags */
+ CANx->RF0 = (uint32_t)(flagtmp);
+ }
+ else if ((CAN_FLAG & CAN_FLAGS_RF1) != (uint32_t)RESET)
+ {
+ /* Receive Flags */
+ CANx->RF1 = (uint32_t)(flagtmp);
+ }
+ else if ((CAN_FLAG & CAN_FLAGS_TTST) != (uint32_t)RESET)
+ {
+ /* Transmit Flags */
+ CANx->TSTS = (uint32_t)(flagtmp);
+ }
+ else /* If((CAN_FLAG & CAN_FLAGS_MSTS)!=(uint32_t)RESET) */
+ {
+ /* Operating mode Flags */
+ CANx->MSTS = (uint32_t)(flagtmp);
+ }
+ }
+}
+
+/**
+ * @brief Checks whether the specified CANx interrupt has occurred or not.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param CAN_INT: specifies the CAN interrupt source to check.
+ * This parameter can be one of the following flags:
+ * - CAN_INT_TSME
+ * - CAN_INT_RFP0
+ * - CAN_INT_RFFU0
+ * - CAN_INT_RFOV0
+ * - CAN_INT_RFP1
+ * - CAN_INT_RFFU1
+ * - CAN_INT_RFOV1
+ * - CAN_INT_WK
+ * - CAN_INT_SAK
+ * - CAN_INT_ERG
+ * - CAN_INT_ERP
+ * - CAN_INT_BU
+ * - CAN_INT_LEC
+ * - CAN_INT_ERR
+ * @retval The current state of CAN_INT (SET or RESET).
+ */
+ITStatus CAN_GetINTStatus(CAN_Type* CANx, uint32_t CAN_INT)
+{
+ ITStatus itstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_INT(CAN_INT));
+
+ /* check the enable interrupt bit */
+ if((CANx->INTEN & CAN_INT) != RESET)
+ {
+ /* in case the Interrupt is enabled, .... */
+ switch (CAN_INT)
+ {
+ case CAN_INT_TSME:
+ /* Check CAN_TSR_RQCPx bits */
+ itstatus = CheckINTStatus(CANx->TSTS, CAN_TSTS_RQC0 | CAN_TSTS_RQC1 | CAN_TSTS_RQC2);
+ break;
+
+ case CAN_INT_RFP0:
+ /* Check CAN_RF0_RFP0 bit */
+ itstatus = CheckINTStatus(CANx->RF0, CAN_RF0_RFP0);
+ break;
+
+ case CAN_INT_RFFU0:
+ /* Check CAN_RF0_RFFU0 bit */
+ itstatus = CheckINTStatus(CANx->RF0, CAN_RF0_RFFU0);
+ break;
+
+ case CAN_INT_RFOV0:
+ /* Check CAN_RF0_RFOV0 bit */
+ itstatus = CheckINTStatus(CANx->RF0, CAN_RF0_RFOV0);
+ break;
+
+ case CAN_INT_RFP1:
+ /* Check CAN_RF1_RFP1 bit */
+ itstatus = CheckINTStatus(CANx->RF1, CAN_RF1_RFP1);
+ break;
+
+ case CAN_INT_RFFU1:
+ /* Check CAN_RF1_RFFU1 bit */
+ itstatus = CheckINTStatus(CANx->RF1, CAN_RF1_RFFU1);
+ break;
+
+ case CAN_INT_RFOV1:
+ /* Check CAN_RF1_RFOV1 bit */
+ itstatus = CheckINTStatus(CANx->RF1, CAN_RF1_RFOV1);
+ break;
+
+ case CAN_INT_WK:
+ /* Check CAN_MSTS_WKIT bit */
+ itstatus = CheckINTStatus(CANx->MSTS, CAN_MSTS_WKIT);
+ break;
+
+ case CAN_INT_SAK:
+ /* Check CAN_MSTS_SAKIT bit */
+ itstatus = CheckINTStatus(CANx->MSTS, CAN_MSTS_SAKIT);
+ break;
+
+ case CAN_INT_ERG:
+ /* Check CAN_ESTS_ERWF bit */
+ itstatus = CheckINTStatus(CANx->ESTS, CAN_ESTS_ERWF);
+ break;
+
+ case CAN_INT_ERP:
+ /* Check CAN_ESTS_ERPF bit */
+ itstatus = CheckINTStatus(CANx->ESTS, CAN_ESTS_ERPF);
+ break;
+
+ case CAN_INT_BU:
+ /* Check CAN_ESTS_BFF bit */
+ itstatus = CheckINTStatus(CANx->ESTS, CAN_ESTS_BFF);
+ break;
+
+ case CAN_INT_LEC:
+ /* Check CAN_ESTS_ERC bit */
+ itstatus = CheckINTStatus(CANx->ESTS, CAN_ESTS_ERC);
+ break;
+
+ case CAN_INT_ERR:
+ /* Check CAN_MSTS_ERIT bit */
+ itstatus = CheckINTStatus(CANx->MSTS, CAN_MSTS_ERIT);
+ break;
+
+ default :
+ /* in case of error, return RESET */
+ itstatus = RESET;
+ break;
+ }
+ }
+ else
+ {
+ /* in case the Interrupt is not enabled, return RESET */
+ itstatus = RESET;
+ }
+
+ /* Return the CAN_INT status */
+ return itstatus;
+}
+
+/**
+ * @brief Clears the CANx's interrupt pending bits.
+ * @param CANx: where x can be only 1 to to select the CAN peripheral.
+ * @param CAN_INT: specifies the interrupt pending bit to clear.
+ * - CAN_INT_TSME
+ * - CAN_INT_RFFU0
+ * - CAN_INT_RFOV0
+ * - CAN_INT_RFFU1
+ * - CAN_INT_RFOV1
+ * - CAN_INT_WK
+ * - CAN_INT_SAK
+ * - CAN_INT_ERG
+ * - CAN_INT_ERP
+ * - CAN_INT_BU
+ * - CAN_INT_LEC
+ * - CAN_INT_ERR
+ * @retval None.
+ */
+void CAN_ClearINTPendingBit(CAN_Type* CANx, uint32_t CAN_INT)
+{
+ /* Check the parameters */
+ assert_param(IS_CAN_ALL_PERIPH(CANx));
+ assert_param(IS_CAN_CLEAR_INT(CAN_INT));
+
+ switch (CAN_INT)
+ {
+ case CAN_INT_TSME:
+ /* Clear CAN_TSR_RQCPx (rc_w1)*/
+ CANx->TSTS = CAN_TSTS_RQC0 | CAN_TSTS_RQC1 | CAN_TSTS_RQC2;
+ break;
+
+ case CAN_INT_RFFU0:
+ /* Clear CAN_RF0_RFFU0 (rc_w1)*/
+ CANx->RF0 = CAN_RF0_RFFU0;
+ break;
+
+ case CAN_INT_RFOV0:
+ /* Clear CAN_RF0_RFOV0 (rc_w1)*/
+ CANx->RF0 = CAN_RF0_RFOV0;
+ break;
+
+ case CAN_INT_RFFU1:
+ /* Clear CAN_RF1_RFFU1 (rc_w1)*/
+ CANx->RF1 = CAN_RF1_RFFU1;
+ break;
+
+ case CAN_INT_RFOV1:
+ /* Clear CAN_RF1_RFOV1 (rc_w1)*/
+ CANx->RF1 = CAN_RF1_RFOV1;
+ break;
+
+ case CAN_INT_WK:
+ /* Clear CAN_MSTS_WKIT (rc_w1)*/
+ CANx->MSTS = CAN_MSTS_WKIT;
+ break;
+
+ case CAN_INT_SAK:
+ /* Clear CAN_MSTS_SAKIT (rc_w1)*/
+ CANx->MSTS = CAN_MSTS_SAKIT;
+ break;
+
+ case CAN_INT_ERG:
+ /* Clear CAN_MSTS_ERIT (rc_w1) */
+ CANx->MSTS = CAN_MSTS_ERIT;
+ /* Note : the corresponding Flag is cleared by hardware depending
+ of the CAN Bus status*/
+ break;
+
+ case CAN_INT_ERP:
+ /* Clear CAN_MSTS_ERIT (rc_w1) */
+ CANx->MSTS = CAN_MSTS_ERIT;
+ /* Note : the corresponding Flag is cleared by hardware depending
+ of the CAN Bus status*/
+ break;
+
+ case CAN_INT_BU:
+ /* Clear CAN_MSTS_ERIT (rc_w1) */
+ CANx->MSTS = CAN_MSTS_ERIT;
+ /* Note : the corresponding Flag is cleared by hardware depending
+ of the CAN Bus status*/
+ break;
+
+ case CAN_INT_LEC:
+ /* Clear LEC bits */
+ CANx->ESTS = RESET;
+ /* Clear CAN_MSTS_ERIT (rc_w1) */
+ CANx->MSTS = CAN_MSTS_ERIT;
+ break;
+
+ case CAN_INT_ERR:
+ /*Clear LEC bits */
+ CANx->ESTS = RESET;
+ /* Clear CAN_MSTS_ERIT (rc_w1) */
+ CANx->MSTS = CAN_MSTS_ERIT;
+ /* Note : BOFF, EPVF and EWGF Flags are cleared by hardware depending
+ of the CAN Bus status*/
+ break;
+
+ default :
+ break;
+ }
+}
+
+/**
+ * @brief Checks whether the CAN interrupt has occurred or not.
+ * @param CAN_Reg: specifies the CAN interrupt register to check.
+ * @param It_Bit: specifies the interrupt source bit to check.
+ * @retval The new state of the CAN Interrupt (SET or RESET).
+ */
+static ITStatus CheckINTStatus(uint32_t CAN_Reg, uint32_t It_Bit)
+{
+ ITStatus pendingbitstatus = RESET;
+
+ if ((CAN_Reg & It_Bit) != (uint32_t)RESET)
+ {
+ /* CAN_INT is set */
+ pendingbitstatus = SET;
+ }
+ else
+ {
+ /* CAN_INT is reset */
+ pendingbitstatus = RESET;
+ }
+
+ return pendingbitstatus;
+}
+
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_comp.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_comp.c
new file mode 100644
index 0000000000000000000000000000000000000000..6adf32c5d65959b575d411ad2d10e93f799c0bee
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_comp.c
@@ -0,0 +1,449 @@
+/**
+ ******************************************************************************
+ * @file at32f4xx_comp.c
+ * @author Artery
+ * @version V1.0.1
+ * @date 20-April-2012
+ * @brief This file provides firmware functions to manage the following
+ * functionalities of the comparators (COMP1 and COMP2) peripheral:
+ * + Comparators configuration
+ * + Window mode control
+ *
+ * @verbatim
+ *
+ ===============================================================================
+ ##### How to use this driver #####
+ ===============================================================================
+ [..]
+
+ The device integrates two analog comparators COMP1 and COMP2:
+ (+) The non inverting input is set to PA1 for COMP1 and to PA3
+ for COMP2.
+
+ (+) The inverting input can be selected among: DAC_OUT1,
+ 1/4 VREFINT, 1/2 VERFINT, 3/4 VREFINT, VREFINT,
+ I/O (PA0 for COMP1 and PA2 for COMP2)
+
+ (+) The COMP output is internally is available using COMP_GetOutputState()
+ and can be set on GPIO pins: PA0, PA6, PA11 for COMP1
+ and PA2, PA7, PA12 for COMP2
+
+ (+) The COMP output can be redirected to embedded timers (TIM1, TIM2
+ and TIM3)
+
+ (+) The two comparators COMP1 and COMP2 can be combined in window
+ mode and only COMP1 non inverting (PA1) can be used as non-
+ inverting input.
+
+ (+) The two comparators COMP1 and COMP2 have interrupt capability
+ with wake-up from Sleep and Stop modes (through the EXTI controller).
+ COMP1 and COMP2 outputs are internally connected to EXTI Line 21
+ and EXTI Line 22 respectively.
+
+
+ ##### How to configure the comparator #####
+ ===============================================================================
+ [..]
+ This driver provides functions to configure and program the Comparators
+ of all AT32F4xx devices.
+
+ [..] To use the comparator, perform the following steps:
+
+ (#) Enable the SYSCFG APB clock to get write access to comparator
+ register using RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
+
+ (#) Configure the comparator input in analog mode using GPIO_Init()
+
+ (#) Configure the comparator output in alternate function mode
+ using GPIO_Init() and use GPIO_PinAFConfig() function to map the
+ comparator output to the GPIO pin
+
+ (#) Configure the comparator using COMP_Init() function:
+ (++) Select the inverting input
+ (++) Select the output polarity
+ (++) Select the output redirection
+ (++) Select the hysteresis level
+ (++) Select the power mode
+
+ (#) Enable the comparator using COMP_Cmd() function
+
+ (#) If required enable the COMP interrupt by configuring and enabling
+ EXTI line in Interrupt mode and selecting the desired sensitivity
+ level using EXTI_Init() function. After that enable the comparator
+ interrupt vector using NVIC_Init() function.
+
+ @endverbatim
+ *
+ ******************************************************************************
+ * @attention
+ *
+ * © COPYRIGHT 2012 Artery
+ *
+ * Licensed under Artery Liberty SW License Agreement V2, (the "License");
+ * You may not use this file except in compliance with the License.
+ *
+ * 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.
+ *
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_comp.h"
+
+/** @addtogroup AT32F4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup COMP
+ * @brief COMP driver modules
+ * @{
+ */
+
+#if defined (AT32F415xx)
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+/* CTRLSTS1 register Mask */
+#define COMP_CTRLSTS1_CLEAR_MASK ((uint32_t)0x00003FFE)
+#define COMP_CTRLSTS2_CLEAR_MASK ((uint32_t)0x00000003)
+#define COMP_HIGH_PULSE_CLEAR_MASK ((uint16_t)0x003F)
+#define COMP_LOW_PULSE_CLEAR_MASK ((uint16_t)0x003F)
+
+/* Private macro -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+/* Private functions ---------------------------------------------------------*/
+
+/** @defgroup COMP_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes COMP peripheral registers to their default reset values.
+ * @note Deinitialization can't be performed if the COMP configuration is locked.
+ * To unlock the configuration, perform a system reset.
+ * @param None
+ * @retval None
+ */
+void COMP_Reset(void)
+{
+ COMP->CTRLSTS1 = ((uint32_t)0x00000000); /*!< Set COMP_CTRLSTS register to reset value */
+}
+
+/**
+ * @brief Initializes the COMP peripheral according to the specified parameters
+ * in COMP_InitStruct
+ * @note If the selected comparator is locked, initialization can't be performed.
+ * To unlock the configuration, perform a system reset.
+ * @note By default, PA1 is selected as COMP1 non inverting input.
+ * To use PA4 as COMP1 non inverting input call COMP_SwitchCmd() after COMP_Init()
+ * @param COMP_Selection: the selected comparator.
+ * This parameter can be one of the following values:
+ * @arg COMP1_Selection: COMP1 selected
+ * @arg COMP2_Selection: COMP2 selected
+ * @param COMP_InitStruct: pointer to an COMP_InitType structure that contains
+ * the configuration information for the specified COMP peripheral.
+ * @retval None
+ */
+void COMP_Init(uint32_t COMP_Selection, COMP_InitType* COMP_InitStruct)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_COMP_ALL_PERIPH(COMP_Selection));
+ assert_param(IS_COMP_INVERTING_INPUT(COMP_InitStruct->COMP_INMInput));
+ assert_param(IS_COMP_OUTPUT(COMP_InitStruct->COMP_Output));
+ assert_param(IS_COMP_OUTPUT_POL(COMP_InitStruct->COMP_OutPolarity));
+ assert_param(IS_COMP_HYSTERESIS(COMP_InitStruct->COMP_Hysteresis));
+ assert_param(IS_COMP_MODE(COMP_InitStruct->COMP_Mode));
+
+ /*!< Get the COMP_CTRLSTS register value */
+ tmpreg = COMP->CTRLSTS1;
+
+ /*!< Clear the COMP1SW1, COMPx_IN_SEL, COMPx_OUT_TIM_SEL, COMPx_POL, COMPx_HYST and COMPx_PWR_MODE bits */
+ tmpreg &= (uint32_t) ~(COMP_CTRLSTS1_CLEAR_MASK<COMP_InvertingInput value */
+ /*!< Set COMPxOUTSEL bits according to COMP_InitStruct->COMP_Output value */
+ /*!< Set COMPxPOL bit according to COMP_InitStruct->COMP_OutputPol value */
+ /*!< Set COMPxHYST bits according to COMP_InitStruct->COMP_Hysteresis value */
+ /*!< Set COMPxMODE bits according to COMP_InitStruct->COMP_Mode value */
+ tmpreg |= (uint32_t)((COMP_InitStruct->COMP_INMInput | COMP_InitStruct->COMP_Output |
+ COMP_InitStruct->COMP_OutPolarity | COMP_InitStruct->COMP_Hysteresis |
+ COMP_InitStruct->COMP_Mode)<CTRLSTS1 = tmpreg;
+}
+
+/**
+ * @brief Select the non-inverting input for COMP1/COMP2.
+ * @param COMP_Selection: the selected comparator.
+ * This parameter can be one of the following values:
+ * @arg COMP1_Selection: COMP1 selected
+ * @arg COMP2_Selection: COMP2 selected
+ * @param COMP_INPInput: the selected COMP non-inverting input.
+ * This parameter can be one of the following values:
+ * @arg COMP_INPInput_00: PA5/PA7 connected to comparator1/2 non-inverting input
+ * @arg COMP_INPInput_01: PA1/PA3 connected to comparator1/2 non-inverting input
+ * @arg COMP_INPInput_10: PA0/PA2 connected to comparator1/2 non-inverting input
+ * @retval None
+ */
+void COMP_SelectINPInput(uint32_t COMP_Selection, uint32_t COMP_INPInput)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_COMP_ALL_PERIPH(COMP_Selection));
+ assert_param(IS_COMP_NONINVERTING_INPUT(COMP_INPInput));
+
+ /*!< Get the COMP_CTRLSTS register value */
+ tmpreg = COMP->CTRLSTS2;
+
+ /*!< Clear the COMPxINPSEL bits */
+ tmpreg &= (uint32_t) ~(COMP_CTRLSTS2_CLEAR_MASK<COMP_NonInvertingInput value */
+ tmpreg |= (uint32_t)(COMP_INPInput<CTRLSTS2 = tmpreg;
+}
+
+/**
+ * @brief Fills each COMP_InitStruct member with its default value.
+ * @param COMP_InitStruct: pointer to an COMP_InitType structure which will
+ * be initialized.
+ * @retval None
+ */
+void COMP_StructInit(COMP_InitType* COMP_InitStruct)
+{
+ COMP_InitStruct->COMP_INMInput = COMP_INMInput_1_4VREFINT;
+ COMP_InitStruct->COMP_Output = COMP_Output_None;
+ COMP_InitStruct->COMP_OutPolarity = COMP_OutPolarity_NonInverted;
+ COMP_InitStruct->COMP_Hysteresis = COMP_Hysteresis_No;
+ COMP_InitStruct->COMP_Mode = COMP_Mode_Slow;
+}
+
+/**
+ * @brief Enable or disable the COMP peripheral.
+ * @note If the selected comparator is locked, enable/disable can't be performed.
+ * To unlock the configuration, perform a system reset.
+ * @param COMP_Selection: the selected comparator.
+ * This parameter can be one of the following values:
+ * @arg COMP1_Selection: COMP1 selected
+ * @arg COMP2_Selection: COMP2 selected
+ * @param NewState: new state of the COMP peripheral.
+ * This parameter can be: ENABLE or DISABLE.
+ * @note When enabled, the comparator compares the non inverting input with
+ * the inverting input and the comparison result is available on comparator output.
+ * @note When disabled, the comparator doesn't perform comparison and the
+ * output level is low.
+ * @retval None
+ */
+void COMP_Cmd(uint32_t COMP_Selection, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_COMP_ALL_PERIPH(COMP_Selection));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected COMP peripheral */
+ COMP->CTRLSTS1 |= (uint32_t) (1<CTRLSTS1 &= (uint32_t)(~((uint32_t)1<CTRLSTS1 |= (uint32_t) (COMP_CTRLSTS_COMP1SW1);
+ }
+ else
+ {
+ /* Open SW1 switch */
+ COMP->CTRLSTS1 &= (uint32_t)(~COMP_CTRLSTS_COMP1SW1);
+ }
+}
+
+/**
+ * @brief Return the output level (high or low) of the selected comparator.
+ * @note The output level depends on the selected polarity.
+ * @note If the polarity is not inverted:
+ * - Comparator output is low when the non-inverting input is at a lower
+ * voltage than the inverting input
+ * - Comparator output is high when the non-inverting input is at a higher
+ * voltage than the inverting input
+ * @note If the polarity is inverted:
+ * - Comparator output is high when the non-inverting input is at a lower
+ * voltage than the inverting input
+ * - Comparator output is low when the non-inverting input is at a higher
+ * voltage than the inverting input
+ * @param COMP_Selection: the selected comparator.
+ * This parameter can be one of the following values:
+ * @arg COMP1_Selection: COMP1 selected
+ * @arg COMP2_Selection: COMP2 selected
+ * @retval Returns the selected comparator output level: low or high.
+ *
+ */
+uint32_t COMP_GetOutputState(uint32_t COMP_Selection)
+{
+ uint32_t compout = 0x0;
+
+ /* Check the parameters */
+ assert_param(IS_COMP_ALL_PERIPH(COMP_Selection));
+
+ /* Check if selected comparator output is high */
+ if ((COMP->CTRLSTS1 & (COMP_CTRLSTS_COMP1OUT<CTRLSTS1 |= (uint32_t)COMP_CTRLSTS_WNDWEN;
+ }
+ else
+ {
+ /* Disable the window mode */
+ COMP->CTRLSTS1 &= (uint32_t)(~COMP_CTRLSTS_WNDWEN);
+ }
+}
+
+/**
+ * @brief Lock the selected comparator (COMP1/COMP2) configuration.
+ * @note Locking the configuration means that all control bits are read-only.
+ * To unlock the comparator configuration, perform a system reset.
+ * @param COMP_Selection: selects the comparator to be locked
+ * This parameter can be a value of the following values:
+ * @arg COMP1_Selection: COMP1 configuration is locked.
+ * @arg COMP2_Selection: COMP2 configuration is locked.
+ * @retval None
+ */
+void COMP_LockConfig(uint32_t COMP_Selection)
+{
+ /* Check the parameter */
+ assert_param(IS_COMP_ALL_PERIPH(COMP_Selection));
+
+ /* Set the lock bit corresponding to selected comparator */
+ COMP->CTRLSTS1 |= (uint32_t) (COMP_CTRLSTS_COMP1LOCK<G_FILTER_EN |= (uint16_t)COMP_G_FILTER_EN_GFE;
+
+ tmphp = COMP->HIGH_PULSE;
+ tmplp = COMP->LOW_PULSE;
+
+ /* Reset the H_PULSE_CNT and L_PULSE_CNT Bits */
+ tmphp &= ~COMP_HIGH_PULSE_CLEAR_MASK;
+ tmplp &= ~COMP_LOW_PULSE_CLEAR_MASK;
+
+ /* Set the H_PULSE_CNT and L_PULSE_CNT Bits */
+ tmphp |= COMP_HighPulseCnt;
+ tmplp |= COMP_LowPulseCnt;
+
+ /* Write to COMP HIGH_PULSE and LOW_PULSE */
+ COMP->HIGH_PULSE = tmphp;
+ COMP->LOW_PULSE = tmplp;
+ }
+ else
+ {
+ /* Disable the glitch filter */
+ COMP->G_FILTER_EN &= (uint16_t)(~COMP_G_FILTER_EN_GFE);
+
+ /* Reset the H_PULSE_CNT and L_PULSE_CNT Bits */
+ COMP->HIGH_PULSE &= ~COMP_HIGH_PULSE_CLEAR_MASK;
+ COMP->LOW_PULSE &= ~COMP_LOW_PULSE_CLEAR_MASK;
+ }
+}
+
+/**
+ * @}
+ */
+
+#endif /* AT32F415xx */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/************************ (C) COPYRIGHT Artery *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_crc.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_crc.c
new file mode 100644
index 0000000000000000000000000000000000000000..3171db96f8b575760bf6a426c73243d61d682c61
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_crc.c
@@ -0,0 +1,150 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_crc.c
+ * Description : at32f4xx CRC source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_crc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup CRC
+ * @brief CRC driver modules
+ * @{
+ */
+
+/** @defgroup CRC_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CRC_Private_Defines
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CRC_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CRC_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CRC_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup CRC_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Resets the CRC Data register (DR).
+ * @param None
+ * @retval None
+ */
+void CRC_ResetDT(void)
+{
+ /* Reset CRC generator */
+ CRC->CTRL = CRC_CTRL_RST;
+}
+
+/**
+ * @brief Computes the 32-bit CRC of a given data word(32-bit).
+ * @param Data: data word(32-bit) to compute its CRC
+ * @retval 32-bit CRC
+ */
+uint32_t CRC_CalculateCRC(uint32_t Data)
+{
+ CRC->DT = Data;
+
+ return (CRC->DT);
+}
+
+/**
+ * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit).
+ * @param pBuffer: pointer to the buffer containing the data to be computed
+ * @param BufferLength: length of the buffer to be computed
+ * @retval 32-bit CRC
+ */
+uint32_t CRC_CalculateBlkCRC(uint32_t pBuffer[], uint32_t BufferLength)
+{
+ uint32_t index = 0;
+
+ for(index = 0; index < BufferLength; index++)
+ {
+ CRC->DT = pBuffer[index];
+ }
+
+ return (CRC->DT);
+}
+
+/**
+ * @brief Returns the current CRC value.
+ * @param None
+ * @retval 32-bit CRC
+ */
+uint32_t CRC_GetCRC(void)
+{
+ return (CRC->DT);
+}
+
+/**
+ * @brief Stores a 8-bit data in the Independent Data(ID) register.
+ * @param IDValue: 8-bit value to be stored in the ID register
+ * @retval None
+ */
+void CRC_SetIDTReg(uint8_t IDValue)
+{
+ CRC->IDT = IDValue;
+}
+
+/**
+ * @brief Returns the 8-bit data stored in the Independent Data(ID) register
+ * @param None
+ * @retval 8-bit value of the ID register
+ */
+uint8_t CRC_GetIDTReg(void)
+{
+ return (CRC->IDT);
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_dac.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_dac.c
new file mode 100644
index 0000000000000000000000000000000000000000..fa0fd1b0207ce8c4d5943629dd3a09046e03972a
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_dac.c
@@ -0,0 +1,420 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_dac.c
+ * Description : at32f4xx DAC source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_dac.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup DAC
+ * @brief DAC driver modules
+ * @{
+ */
+#if defined (AT32F403xx) || defined (AT32F403Axx) || defined (AT32F407xx)
+
+/** @defgroup DAC_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DAC_Private_Defines
+ * @{
+ */
+
+/* CTRL register Mask */
+#define CTRL_CLEAR_MSK ((uint32_t)0x00000FFE)
+
+/* DAC Dual Channels SWTRIG masks */
+#define DUAL_SWTRIG_SET ((uint32_t)0x00000003)
+#define DUAL_SWTRIG_RST ((uint32_t)0xFFFFFFFC)
+
+/* DHR registers offsets */
+#define DHR12R1_OFFSET ((uint32_t)0x00000008)
+#define DHR12R2_OFFSET ((uint32_t)0x00000014)
+#define DHR12RD_OFFSET ((uint32_t)0x00000020)
+
+/* DOR register offset */
+#define ODT_OFFSET ((uint32_t)0x0000002C)
+/**
+ * @}
+ */
+
+/** @defgroup DAC_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DAC_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DAC_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DAC_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the DAC peripheral registers to their default reset values.
+ * @param None
+ * @retval None
+ */
+void DAC_Reset(void)
+{
+ /* Enable DAC reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_DAC, ENABLE);
+ /* Release DAC from reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_DAC, DISABLE);
+}
+
+/**
+ * @brief Initializes the DAC peripheral according to the specified
+ * parameters in the DAC_InitStruct.
+ * @param DAC_Channel: the selected DAC channel.
+ * This parameter can be one of the following values:
+ * @arg DAC_Channel_1: DAC Channel1 selected
+ * @arg DAC_Channel_2: DAC Channel2 selected
+ * @param DAC_InitStruct: pointer to a DAC_InitType structure that
+ * contains the configuration information for the specified DAC channel.
+ * @retval None
+ */
+void DAC_Init(uint32_t DAC_Channel, DAC_InitType* DAC_InitStruct)
+{
+ uint32_t tmpreg1 = 0, tmpreg2 = 0;
+ /* Check the DAC parameters */
+ assert_param(IS_DAC_TRIGGER(DAC_InitStruct->DAC_Trigger));
+ assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->DAC_WaveGeneration));
+ assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude));
+ assert_param(IS_DAC_OUTPUT_BUFFER_STATE(DAC_InitStruct->DAC_OutputBuffer));
+ /*---------------------------- DAC CTRL Configuration --------------------------*/
+ /* Get the DAC CTRL value */
+ tmpreg1 = DAC->CTRL;
+ /* Clear BOFFx, TENx, TSELx, WAVEx and MAMPx bits */
+ tmpreg1 &= ~(CTRL_CLEAR_MSK << DAC_Channel);
+ /* Configure for the selected DAC channel: buffer output, trigger, wave generation,
+ mask/amplitude for wave generation */
+ /* Set TSELx and TENx bits according to DAC_Trigger value */
+ /* Set WAVEx bits according to DAC_WaveGeneration value */
+ /* Set MAMPx bits according to DAC_LFSRUnmask_TriangleAmplitude value */
+ /* Set BOFFx bit according to DAC_OutputBuffer value */
+ tmpreg2 = (DAC_InitStruct->DAC_Trigger | DAC_InitStruct->DAC_WaveGeneration |
+ DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude | DAC_InitStruct->DAC_OutputBuffer);
+ /* Calculate CTRL register value depending on DAC_Channel */
+ tmpreg1 |= tmpreg2 << DAC_Channel;
+ /* Write to DAC CTRL */
+ DAC->CTRL = tmpreg1;
+}
+
+/**
+ * @brief Fills each DAC_InitStruct member with its default value.
+ * @param DAC_InitStruct : pointer to a DAC_InitType structure which will
+ * be initialized.
+ * @retval None
+ */
+void DAC_StructInit(DAC_InitType* DAC_InitStruct)
+{
+ /*--------------- Reset DAC init structure parameters values -----------------*/
+ /* Initialize the DAC_Trigger member */
+ DAC_InitStruct->DAC_Trigger = DAC_Trigger_None;
+ /* Initialize the DAC_WaveGeneration member */
+ DAC_InitStruct->DAC_WaveGeneration = DAC_WaveGeneration_None;
+ /* Initialize the DAC_LFSRUnmask_TriangleAmplitude member */
+ DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmsk_Bit0;
+ /* Initialize the DAC_OutputBuffer member */
+ DAC_InitStruct->DAC_OutputBuffer = DAC_OutputBuffer_Enable;
+}
+
+/**
+ * @brief Enables or disables the specified DAC channel.
+ * @param DAC_Channel: the selected DAC channel.
+ * This parameter can be one of the following values:
+ * @arg DAC_Channel_1: DAC Channel1 selected
+ * @arg DAC_Channel_2: DAC Channel2 selected
+ * @param NewState: new state of the DAC channel.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void DAC_Ctrl(uint32_t DAC_Channel, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_DAC_CHANNEL(DAC_Channel));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DAC channel */
+ DAC->CTRL |= (DAC_CTRL_EN1 << DAC_Channel);
+ }
+ else
+ {
+ /* Disable the selected DAC channel */
+ DAC->CTRL &= ~(DAC_CTRL_EN1 << DAC_Channel);
+ }
+}
+
+/**
+ * @brief Enables or disables the specified DAC channel DMA request.
+ * @param DAC_Channel: the selected DAC channel.
+ * This parameter can be one of the following values:
+ * @arg DAC_Channel_1: DAC Channel1 selected
+ * @arg DAC_Channel_2: DAC Channel2 selected
+ * @param NewState: new state of the selected DAC channel DMA request.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void DAC_DMACtrl(uint32_t DAC_Channel, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_DAC_CHANNEL(DAC_Channel));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DAC channel DMA request */
+ DAC->CTRL |= (DAC_CTRL_DMAEN1 << DAC_Channel);
+ }
+ else
+ {
+ /* Disable the selected DAC channel DMA request */
+ DAC->CTRL &= ~(DAC_CTRL_DMAEN1 << DAC_Channel);
+ }
+}
+
+/**
+ * @brief Enables or disables the selected DAC channel software trigger.
+ * @param DAC_Channel: the selected DAC channel.
+ * This parameter can be one of the following values:
+ * @arg DAC_Channel_1: DAC Channel1 selected
+ * @arg DAC_Channel_2: DAC Channel2 selected
+ * @param NewState: new state of the selected DAC channel software trigger.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void DAC_SoftwareTriggerCtrl(uint32_t DAC_Channel, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_DAC_CHANNEL(DAC_Channel));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable software trigger for the selected DAC channel */
+ DAC->SWTRG |= (uint32_t)DAC_SWTRG_SWTRG1 << (DAC_Channel >> 4);
+ }
+ else
+ {
+ /* Disable software trigger for the selected DAC channel */
+ DAC->SWTRG &= ~((uint32_t)DAC_SWTRG_SWTRG1 << (DAC_Channel >> 4));
+ }
+}
+
+/**
+ * @brief Enables or disables simultaneously the two DAC channels software
+ * triggers.
+ * @param NewState: new state of the DAC channels software triggers.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void DAC_DualSoftwareTriggerCtrl(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable software trigger for both DAC channels */
+ DAC->SWTRG |= DUAL_SWTRIG_SET ;
+ }
+ else
+ {
+ /* Disable software trigger for both DAC channels */
+ DAC->SWTRG &= DUAL_SWTRIG_RST;
+ }
+}
+
+/**
+ * @brief Enables or disables the selected DAC channel wave generation.
+ * @param DAC_Channel: the selected DAC channel.
+ * This parameter can be one of the following values:
+ * @arg DAC_Channel_1: DAC Channel1 selected
+ * @arg DAC_Channel_2: DAC Channel2 selected
+ * @param DAC_Wave: Specifies the wave type to enable or disable.
+ * This parameter can be one of the following values:
+ * @arg DAC_Wave_Noise: noise wave generation
+ * @arg DAC_Wave_Triangle: triangle wave generation
+ * @param NewState: new state of the selected DAC channel wave generation.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void DAC_WaveGenerationCtrl(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_DAC_CHANNEL(DAC_Channel));
+ assert_param(IS_DAC_WAVE(DAC_Wave));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected wave generation for the selected DAC channel */
+ DAC->CTRL |= DAC_Wave << DAC_Channel;
+ }
+ else
+ {
+ /* Disable the selected wave generation for the selected DAC channel */
+ DAC->CTRL &= ~(DAC_Wave << DAC_Channel);
+ }
+}
+
+/**
+ * @brief Set the specified data holding register value for DAC channel1.
+ * @param DAC_Align: Specifies the data alignment for DAC channel1.
+ * This parameter can be one of the following values:
+ * @arg DAC_Align_8b_Right: 8bit right data alignment selected
+ * @arg DAC_Align_12b_Left: 12bit left data alignment selected
+ * @arg DAC_Align_12b_Right: 12bit right data alignment selected
+ * @param Data : Data to be loaded in the selected data holding register.
+ * @retval None
+ */
+void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_DAC_ALIGN(DAC_Align));
+ assert_param(IS_DAC_DATA(Data));
+
+ tmp = (uint32_t)DAC_BASE;
+ tmp += DHR12R1_OFFSET + DAC_Align;
+
+ /* Set the DAC channel1 selected data holding register */
+ *(__IO uint32_t *) tmp = Data;
+}
+
+/**
+ * @brief Set the specified data holding register value for DAC channel2.
+ * @param DAC_Align: Specifies the data alignment for DAC channel2.
+ * This parameter can be one of the following values:
+ * @arg DAC_Align_8b_Right: 8bit right data alignment selected
+ * @arg DAC_Align_12b_Left: 12bit left data alignment selected
+ * @arg DAC_Align_12b_Right: 12bit right data alignment selected
+ * @param Data : Data to be loaded in the selected data holding register.
+ * @retval None
+ */
+void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_DAC_ALIGN(DAC_Align));
+ assert_param(IS_DAC_DATA(Data));
+
+ tmp = (uint32_t)DAC_BASE;
+ tmp += DHR12R2_OFFSET + DAC_Align;
+
+ /* Set the DAC channel2 selected data holding register */
+ *(__IO uint32_t *)tmp = Data;
+}
+
+/**
+ * @brief Set the specified data holding register value for dual channel
+ * DAC.
+ * @param DAC_Align: Specifies the data alignment for dual channel DAC.
+ * This parameter can be one of the following values:
+ * @arg DAC_Align_8b_Right: 8bit right data alignment selected
+ * @arg DAC_Align_12b_Left: 12bit left data alignment selected
+ * @arg DAC_Align_12b_Right: 12bit right data alignment selected
+ * @param Data2: Data for DAC Channel2 to be loaded in the selected data
+ * holding register.
+ * @param Data1: Data for DAC Channel1 to be loaded in the selected data
+ * holding register.
+ * @retval None
+ */
+void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1)
+{
+ uint32_t data = 0, tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_DAC_ALIGN(DAC_Align));
+ assert_param(IS_DAC_DATA(Data1));
+ assert_param(IS_DAC_DATA(Data2));
+
+ /* Calculate and set dual DAC data holding register value */
+ if (DAC_Align == DAC_Align_8b_Right)
+ {
+ data = ((uint32_t)Data2 << 8) | Data1;
+ }
+ else
+ {
+ data = ((uint32_t)Data2 << 16) | Data1;
+ }
+
+ tmp = (uint32_t)DAC_BASE;
+ tmp += DHR12RD_OFFSET + DAC_Align;
+
+ /* Set the dual DAC selected data holding register */
+ *(__IO uint32_t *)tmp = data;
+}
+
+/**
+ * @brief Returns the last data output value of the selected DAC channel.
+ * @param DAC_Channel: the selected DAC channel.
+ * This parameter can be one of the following values:
+ * @arg DAC_Channel_1: DAC Channel1 selected
+ * @arg DAC_Channel_2: DAC Channel2 selected
+ * @retval The selected DAC channel data output value.
+ */
+uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_DAC_CHANNEL(DAC_Channel));
+
+ tmp = (uint32_t) DAC_BASE ;
+ tmp += ODT_OFFSET + ((uint32_t)DAC_Channel >> 2);
+
+ /* Returns the DAC channel data output register value */
+ return (uint16_t) (*(__IO uint32_t*) tmp);
+}
+
+/**
+ * @}
+ */
+
+#endif /* AT32F403xx || AT32F403Axx || AT32F407xx */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_dbgmcu.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_dbgmcu.c
new file mode 100644
index 0000000000000000000000000000000000000000..9e463960298501c3b516cff76a8d747ef6d5a9af
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_dbgmcu.c
@@ -0,0 +1,149 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_dbgmcu.c
+ * Description : at32f4xx MCUDBG source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_dbgmcu.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup DBGMCU
+ * @brief DBGMCU driver modules
+ * @{
+ */
+
+/** @defgroup DBGMCU_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DBGMCU_Private_Defines
+ * @{
+ */
+
+#define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF)
+/**
+ * @}
+ */
+
+/** @defgroup DBGMCU_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DBGMCU_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DBGMCU_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DBGMCU_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Returns the device revision identifier.
+ * @param None
+ * @retval Device revision identifier
+ */
+uint32_t MCUDBG_GetRevID(void)
+{
+ return(DBGMCU->IDCR >> 16);
+}
+
+/**
+ * @brief Returns the device identifier.
+ * @param None
+ * @retval Device identifier
+ */
+uint32_t MCUDBG_GetDevID(void)
+{
+ return(DBGMCU->IDCR & IDCODE_DEVID_MASK);
+}
+
+/**
+ * @brief Configures the specified peripheral and low power mode behavior
+ * when the MCU under Debug mode.
+ * @param DBGMCU_Periph: specifies the peripheral and low power mode.
+ * This parameter can be any combination of the following values:
+ * @arg MCUDBG_SLEEP: Keep debugger connection during SLEEP mode
+ * @arg MCUDBG_STOP: Keep debugger connection during STOP mode
+ * @arg MCUDBG_STANDBY: Keep debugger connection during STANDBY mode
+ * @arg MCUDBG_IWDG_STOP: Debug IWDG stopped when Core is halted
+ * @arg MCUDBG_WWDG_STOP: Debug WWDG stopped when Core is halted
+ * @arg MCUDBG_TMR1_STOP: TMR1 counter stopped when Core is halted
+ * @arg MCUDBG_TMR2_STOP: TMR2 counter stopped when Core is halted
+ * @arg MCUDBG_TMR3_STOP: TMR3 counter stopped when Core is halted
+ * @arg MCUDBG_TMR4_STOP: TMR4 counter stopped when Core is halted
+ * @arg MCUDBG_CAN1_STOP: Debug CAN1 stopped when Core is halted
+ * @arg MCUDBG_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted
+ * @arg MCUDBG_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted
+ * @arg MCUDBG_I2C3_SMBUS_TIMEOUT: I2C3 SMBUS timeout mode stopped when Core is halted
+ * @arg MCUDBG_TMR5_STOP: TMR5 counter stopped when Core is halted
+ * @arg MCUDBG_TMR6_STOP: TMR6 counter stopped when Core is halted
+ * @arg MCUDBG_TMR7_STOP: TMR7 counter stopped when Core is halted
+ * @arg MCUDBG_TMR8_STOP: TMR8 counter stopped when Core is halted
+ * @arg MCUDBG_TMR15_STOP: TMR15 counter stopped when Core is halted
+ * @arg MCUDBG_TMR9_STOP: TMR9 counter stopped when Core is halted
+ * @arg MCUDBG_TMR10_STOP: TMR10 counter stopped when Core is halted
+ * @arg MCUDBG_TMR11_STOP: TMR11 counter stopped when Core is halted
+ * @arg MCUDBG_TMR12_STOP: TMR12 counter stopped when Core is halted
+ * @arg MCUDBG_TMR13_STOP: TMR13 counter stopped when Core is halted
+ * @arg MCUDBG_TMR14_STOP: TMR14 counter stopped when Core is halted
+ * @param NewState: new state of the specified peripheral in Debug mode.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void MCUDBG_PeriphDebugModeConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_MCUDBG_PERIPH(DBGMCU_Periph));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ DBGMCU->CTRL |= DBGMCU_Periph;
+ }
+ else
+ {
+ DBGMCU->CTRL &= ~DBGMCU_Periph;
+ }
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_dma.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_dma.c
new file mode 100644
index 0000000000000000000000000000000000000000..f8a1aac9dc504ddafd95ec53f45e643ddc68a881
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_dma.c
@@ -0,0 +1,755 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_dma.c
+ * Description : at32f4xx DMA source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_dma.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup DMA
+ * @brief DMA driver modules
+ * @{
+ */
+
+/** @defgroup DMA_Private_TypesDefinitions
+ * @{
+ */
+/**
+ * @}
+ */
+
+/** @defgroup DMA_Private_Defines
+ * @{
+ */
+
+
+/* DMA1 Channelx interrupt pending bit masks */
+#define DMA1_CHANNEL1_INT_MASK ((uint32_t)(DMA_ISTS_GIF1 | DMA_ISTS_TCIF1 | DMA_ISTS_HTIF1 | DMA_ISTS_ERRIF1))
+#define DMA1_CHANNEL2_INT_MASK ((uint32_t)(DMA_ISTS_GIF2 | DMA_ISTS_TCIF2 | DMA_ISTS_HTIF2 | DMA_ISTS_ERRIF2))
+#define DMA1_CHANNEL3_INT_MASK ((uint32_t)(DMA_ISTS_GIF3 | DMA_ISTS_TCIF3 | DMA_ISTS_HTIF3 | DMA_ISTS_ERRIF3))
+#define DMA1_CHANNEL4_INT_MASK ((uint32_t)(DMA_ISTS_GIF4 | DMA_ISTS_TCIF4 | DMA_ISTS_HTIF4 | DMA_ISTS_ERRIF4))
+#define DMA1_CHANNEL5_INT_MASK ((uint32_t)(DMA_ISTS_GIF5 | DMA_ISTS_TCIF5 | DMA_ISTS_HTIF5 | DMA_ISTS_ERRIF5))
+#define DMA1_CHANNEL6_INT_MASK ((uint32_t)(DMA_ISTS_GIF6 | DMA_ISTS_TCIF6 | DMA_ISTS_HTIF6 | DMA_ISTS_ERRIF6))
+#define DMA1_CHANNEL7_INT_MASK ((uint32_t)(DMA_ISTS_GIF7 | DMA_ISTS_TCIF7 | DMA_ISTS_HTIF7 | DMA_ISTS_ERRIF7))
+
+/* DMA2 Channelx interrupt pending bit masks */
+#define DMA2_CHANNEL1_INT_MASK ((uint32_t)(DMA_ISTS_GIF1 | DMA_ISTS_TCIF1 | DMA_ISTS_HTIF1 | DMA_ISTS_ERRIF1))
+#define DMA2_CHANNEL2_INT_MASK ((uint32_t)(DMA_ISTS_GIF2 | DMA_ISTS_TCIF2 | DMA_ISTS_HTIF2 | DMA_ISTS_ERRIF2))
+#define DMA2_CHANNEL3_INT_MASK ((uint32_t)(DMA_ISTS_GIF3 | DMA_ISTS_TCIF3 | DMA_ISTS_HTIF3 | DMA_ISTS_ERRIF3))
+#define DMA2_CHANNEL4_INT_MASK ((uint32_t)(DMA_ISTS_GIF4 | DMA_ISTS_TCIF4 | DMA_ISTS_HTIF4 | DMA_ISTS_ERRIF4))
+#define DMA2_CHANNEL5_INT_MASK ((uint32_t)(DMA_ISTS_GIF5 | DMA_ISTS_TCIF5 | DMA_ISTS_HTIF5 | DMA_ISTS_ERRIF5))
+
+/* DMA2 FLAG mask */
+#define FLAG_Mask ((uint32_t)0x10000000)
+
+/* DMA registers Masks */
+#define CHCTRL_CLEAR_MASK ((uint32_t)0xFFFF800F)
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the DMAy Channelx registers to their default reset
+ * values.
+ * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
+ * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
+ * @retval None
+ */
+void DMA_Reset(DMA_Channel_Type* DMAy_Channelx)
+{
+ /* Check the parameters */
+ assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
+
+ /* Disable the selected DMAy Channelx */
+ DMAy_Channelx->CHCTRL &= (uint16_t)(~DMA_CHCTRL1_CHEN);
+
+ /* Reset DMAy Channelx control register */
+ DMAy_Channelx->CHCTRL = 0;
+
+ /* Reset DMAy Channelx remaining bytes register */
+ DMAy_Channelx->TCNT = 0;
+
+ /* Reset DMAy Channelx peripheral address register */
+ DMAy_Channelx->CPBA = 0;
+
+ /* Reset DMAy Channelx memory address register */
+ DMAy_Channelx->CMBA = 0;
+
+ if (DMAy_Channelx == DMA1_Channel1)
+ {
+ /* Reset interrupt pending bits for DMA1 Channel1 */
+ DMA1->ICLR |= DMA1_CHANNEL1_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA1_Channel2)
+ {
+ /* Reset interrupt pending bits for DMA1 Channel2 */
+ DMA1->ICLR |= DMA1_CHANNEL2_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA1_Channel3)
+ {
+ /* Reset interrupt pending bits for DMA1 Channel3 */
+ DMA1->ICLR |= DMA1_CHANNEL3_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA1_Channel4)
+ {
+ /* Reset interrupt pending bits for DMA1 Channel4 */
+ DMA1->ICLR |= DMA1_CHANNEL4_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA1_Channel5)
+ {
+ /* Reset interrupt pending bits for DMA1 Channel5 */
+ DMA1->ICLR |= DMA1_CHANNEL5_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA1_Channel6)
+ {
+ /* Reset interrupt pending bits for DMA1 Channel6 */
+ DMA1->ICLR |= DMA1_CHANNEL6_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA1_Channel7)
+ {
+ /* Reset interrupt pending bits for DMA1 Channel7 */
+ DMA1->ICLR |= DMA1_CHANNEL7_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA2_Channel1)
+ {
+ /* Reset interrupt pending bits for DMA2 Channel1 */
+ DMA2->ICLR |= DMA2_CHANNEL1_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA2_Channel2)
+ {
+ /* Reset interrupt pending bits for DMA2 Channel2 */
+ DMA2->ICLR |= DMA2_CHANNEL2_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA2_Channel3)
+ {
+ /* Reset interrupt pending bits for DMA2 Channel3 */
+ DMA2->ICLR |= DMA2_CHANNEL3_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA2_Channel4)
+ {
+ /* Reset interrupt pending bits for DMA2 Channel4 */
+ DMA2->ICLR |= DMA2_CHANNEL4_INT_MASK;
+ }
+ else if (DMAy_Channelx == DMA2_Channel5)
+ {
+ /* Reset interrupt pending bits for DMA2 Channel5 */
+ DMA2->ICLR |= DMA2_CHANNEL5_INT_MASK;
+ }
+}
+
+/**
+ * @brief Initializes the DMAy Channelx according to the specified
+ * parameters in the DMA_InitStruct.
+ * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
+ * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
+ * @param DMA_InitStruct: pointer to a DMA_InitType structure that
+ * contains the configuration information for the specified DMA Channel.
+ * @retval None
+ */
+void DMA_Init(DMA_Channel_Type* DMAy_Channelx, DMA_InitType* DMA_InitStruct)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
+ assert_param(IS_DMA_DIR(DMA_InitStruct->DMA_Direction));
+ assert_param(IS_DMA_BUFFER_SIZE(DMA_InitStruct->DMA_BufferSize));
+ assert_param(IS_DMA_PERIPHERAL_INC_STATE(DMA_InitStruct->DMA_PeripheralInc));
+ assert_param(IS_DMA_MEMORY_INC_STATE(DMA_InitStruct->DMA_MemoryInc));
+ assert_param(IS_DMA_PERIPHERAL_DATA_WIDTH(DMA_InitStruct->DMA_PeripheralDataWidth));
+ assert_param(IS_DMA_MEMORY_DATA_WIDTH(DMA_InitStruct->DMA_MemoryDataWidth));
+ assert_param(IS_DMA_MODE(DMA_InitStruct->DMA_Mode));
+ assert_param(IS_DMA_PRIORITY(DMA_InitStruct->DMA_Priority));
+ assert_param(IS_DMA_MTOM_STATE(DMA_InitStruct->DMA_MTOM));
+
+ /*--------------------------- DMAy Channelx CCR Configuration -----------------*/
+ /* Get the DMAy_Channelx CCR value */
+ tmpreg = DMAy_Channelx->CHCTRL;
+ /* Clear MEM2MEM, PL, MSIZE, PSIZE, MINC, PINC, CIRC and DIR bits */
+ tmpreg &= CHCTRL_CLEAR_MASK;
+ /* Configure DMAy Channelx: data transfer, data size, priority level and mode */
+ /* Set DIR bit according to DMA_DIR value */
+ /* Set CIRC bit according to DMA_Mode value */
+ /* Set PINC bit according to DMA_PeripheralInc value */
+ /* Set MINC bit according to DMA_MemoryInc value */
+ /* Set PSIZE bits according to DMA_PeripheralDataSize value */
+ /* Set MSIZE bits according to DMA_MemoryDataSize value */
+ /* Set PL bits according to DMA_Priority value */
+ /* Set the MEM2MEM bit according to DMA_M2M value */
+ tmpreg |= DMA_InitStruct->DMA_Direction | DMA_InitStruct->DMA_Mode |
+ DMA_InitStruct->DMA_PeripheralInc | DMA_InitStruct->DMA_MemoryInc |
+ DMA_InitStruct->DMA_PeripheralDataWidth | DMA_InitStruct->DMA_MemoryDataWidth |
+ DMA_InitStruct->DMA_Priority | DMA_InitStruct->DMA_MTOM;
+
+ /* Write to DMAy Channelx CCR */
+ DMAy_Channelx->CHCTRL = tmpreg;
+
+ /*--------------------------- DMAy Channelx CNDTR Configuration ---------------*/
+ /* Write to DMAy Channelx CNDTR */
+ DMAy_Channelx->TCNT = DMA_InitStruct->DMA_BufferSize;
+
+ /*--------------------------- DMAy Channelx CPAR Configuration ----------------*/
+ /* Write to DMAy Channelx CPAR */
+ DMAy_Channelx->CPBA = DMA_InitStruct->DMA_PeripheralBaseAddr;
+
+ /*--------------------------- DMAy Channelx CMAR Configuration ----------------*/
+ /* Write to DMAy Channelx CMAR */
+ DMAy_Channelx->CMBA = DMA_InitStruct->DMA_MemoryBaseAddr;
+}
+
+/**
+ * @brief Initializes the DMAy flexible function according to the specified
+ * parameters.
+ * @param Flex_Channelx: where x can be 1 to 7 for DMA1 or DMA2.
+ * @param Hardware_ID: Every peripheral have specified Hardware_ID.
+ * @retval None
+ */
+void DMA_Flexible_Config(DMA_Type* DMAx,uint8_t Flex_Channelx,uint8_t Hardware_ID)
+{
+ /* Check the parameters */
+ assert_param(IS_DMA_ALL_CHANNELS(Flex_Channelx));
+ assert_param(IS_DMA_ALL_HARDWARE_ID(Hardware_ID));
+ /* Initialize the DMA flexible function */
+ DMAx->DMA_SRC_SEL1 &= (uint32_t)(~DMA_FLEX_FUNCTION_EN);
+ DMAx->DMA_SRC_SEL1 |= (uint32_t)(DMA_FLEX_FUNCTION_EN);
+ /* Set the Hardware_ID for DMA_Channel */
+ if(Flex_Channelx == Flex_Channel1)/* channel1 */
+ {
+ DMAx->DMA_SRC_SEL0 &= (uint32_t)(~0xFF);
+ DMAx->DMA_SRC_SEL0 |= (uint32_t)(Hardware_ID);
+ }
+ else if(Flex_Channelx == Flex_Channel2)/* channel2 */
+ {
+ DMAx->DMA_SRC_SEL0 &= (uint32_t)(~(0xFF<<8));
+ DMAx->DMA_SRC_SEL0 |= (uint32_t)((Hardware_ID<<8));
+ }
+ else if(Flex_Channelx == Flex_Channel3)/* channel3 */
+ {
+ DMAx->DMA_SRC_SEL0 &= (uint32_t)(~(0xFF<<16));
+ DMAx->DMA_SRC_SEL0 |= (uint32_t)((Hardware_ID<<16));
+ }
+ else if(Flex_Channelx == Flex_Channel4)/* channel5 */
+ {
+ DMAx->DMA_SRC_SEL0 &= (uint32_t)(~((~0x00)<<24));
+ DMAx->DMA_SRC_SEL0 |= (uint32_t)((Hardware_ID<<24));
+ }
+ else if(Flex_Channelx == Flex_Channel5)/* channel5 */
+ {
+ DMAx->DMA_SRC_SEL1 &= (uint32_t)(~0xFF);
+ DMAx->DMA_SRC_SEL1 |= (uint32_t)(Hardware_ID);
+ }
+ else if(Flex_Channelx == Flex_Channel6)/* channel6 */
+ {
+ DMAx->DMA_SRC_SEL1 &= (uint32_t)(~(0xFF<<8));
+ DMAx->DMA_SRC_SEL1 |= (uint32_t)((Hardware_ID<<8));
+ }
+ else if(Flex_Channelx == Flex_Channel7)/* channel7 */
+ {
+ DMAx->DMA_SRC_SEL1 &= (uint32_t)(~(0xFF<<16));
+ DMAx->DMA_SRC_SEL1 |= (uint32_t)((Hardware_ID<<16));
+ }
+}
+
+/**
+ * @brief Fills each DMA_InitStruct member with its default value.
+ * @param DMA_InitStruct : pointer to a DMA_InitType structure which will
+ * be initialized.
+ * @retval None
+ */
+void DMA_DefaultInitParaConfig(DMA_InitType* DMA_InitStruct)
+{
+ /*-------------- Reset DMA init structure parameters values ------------------*/
+ /* Initialize the DMA_PeripheralBaseAddr member */
+ DMA_InitStruct->DMA_PeripheralBaseAddr = 0;
+ /* Initialize the DMA_MemoryBaseAddr member */
+ DMA_InitStruct->DMA_MemoryBaseAddr = 0;
+ /* Initialize the DMA_DIR member */
+ DMA_InitStruct->DMA_Direction = DMA_DIR_PERIPHERALSRC;
+ /* Initialize the DMA_BufferSize member */
+ DMA_InitStruct->DMA_BufferSize = 0;
+ /* Initialize the DMA_PeripheralInc member */
+ DMA_InitStruct->DMA_PeripheralInc = DMA_PERIPHERALINC_DISABLE;
+ /* Initialize the DMA_MemoryInc member */
+ DMA_InitStruct->DMA_MemoryInc = DMA_MEMORYINC_DISABLE;
+ /* Initialize the DMA_PeripheralDataSize member */
+ DMA_InitStruct->DMA_PeripheralDataWidth = DMA_PERIPHERALDATAWIDTH_BYTE;
+ /* Initialize the DMA_MemoryDataSize member */
+ DMA_InitStruct->DMA_MemoryDataWidth = DMA_MEMORYDATAWIDTH_BYTE;
+ /* Initialize the DMA_Mode member */
+ DMA_InitStruct->DMA_Mode = DMA_MODE_NORMAL;
+ /* Initialize the DMA_Priority member */
+ DMA_InitStruct->DMA_Priority = DMA_PRIORITY_LOW;
+ /* Initialize the DMA_M2M member */
+ DMA_InitStruct->DMA_MTOM = DMA_MEMTOMEM_DISABLE;
+}
+
+/**
+ * @brief Enables or disables the specified DMAy Channelx.
+ * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
+ * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
+ * @param NewState: new state of the DMAy Channelx.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void DMA_ChannelEnable(DMA_Channel_Type* DMAy_Channelx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DMAy Channelx */
+ DMAy_Channelx->CHCTRL |= DMA_CHCTRL1_CHEN;
+ }
+ else
+ {
+ /* Disable the selected DMAy Channelx */
+ DMAy_Channelx->CHCTRL &= (uint16_t)(~DMA_CHCTRL1_CHEN);
+ }
+}
+
+/**
+ * @brief Enables or disables the specified DMAy Channelx interrupts.
+ * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
+ * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
+ * @param DMA_INT: specifies the DMA interrupts sources to be enabled
+ * or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg DMA_INT_TC: Transfer complete interrupt mask
+ * @arg DMA_INT_HT: Half transfer interrupt mask
+ * @arg DMA_INT_ERR: Transfer error interrupt mask
+ * @param NewState: new state of the specified DMA interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void DMA_INTConfig(DMA_Channel_Type* DMAy_Channelx, uint32_t DMA_INT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
+ assert_param(IS_DMA_CONFIG_INT(DMA_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DMA interrupts */
+ DMAy_Channelx->CHCTRL |= DMA_INT;
+ }
+ else
+ {
+ /* Disable the selected DMA interrupts */
+ DMAy_Channelx->CHCTRL &= ~DMA_INT;
+ }
+}
+
+/**
+ * @brief Sets the number of data units in the current DMAy Channelx transfer.
+ * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
+ * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
+ * @param DataNumber: The number of data units in the current DMAy Channelx
+ * transfer.
+ * @note This function can only be used when the DMAy_Channelx is disabled.
+ * @retval None.
+ */
+void DMA_SetCurrDataCounter(DMA_Channel_Type* DMAy_Channelx, uint16_t DataNumber)
+{
+ /* Check the parameters */
+ assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
+
+ /*--------------------------- DMAy Channelx CNDTR Configuration ---------------*/
+ /* Write to DMAy Channelx CNDTR */
+ DMAy_Channelx->TCNT = DataNumber;
+}
+
+/**
+ * @brief Returns the number of remaining data units in the current
+ * DMAy Channelx transfer.
+ * @param DMAy_Channelx: where y can be 1 or 2 to select the DMA and
+ * x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel.
+ * @retval The number of remaining data units in the current DMAy Channelx
+ * transfer.
+ */
+uint16_t DMA_GetCurrDataCounter(DMA_Channel_Type* DMAy_Channelx)
+{
+ /* Check the parameters */
+ assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx));
+ /* Return the number of remaining data units for DMAy Channelx */
+ return ((uint16_t)(DMAy_Channelx->TCNT));
+}
+
+/**
+ * @brief Checks whether the specified DMAy Channelx flag is set or not.
+ * @param DMAy_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg DMA1_FLAG_GL1: DMA1 Channel1 global flag.
+ * @arg DMA1_FLAG_TC1: DMA1 Channel1 transfer complete flag.
+ * @arg DMA1_FLAG_HT1: DMA1 Channel1 half transfer flag.
+ * @arg DMA1_FLAG_ERR1: DMA1 Channel1 transfer error flag.
+ * @arg DMA1_FLAG_GL2: DMA1 Channel2 global flag.
+ * @arg DMA1_FLAG_TC2: DMA1 Channel2 transfer complete flag.
+ * @arg DMA1_FLAG_HT2: DMA1 Channel2 half transfer flag.
+ * @arg DMA1_FLAG_ERR2: DMA1 Channel2 transfer error flag.
+ * @arg DMA1_FLAG_GL3: DMA1 Channel3 global flag.
+ * @arg DMA1_FLAG_TC3: DMA1 Channel3 transfer complete flag.
+ * @arg DMA1_FLAG_HT3: DMA1 Channel3 half transfer flag.
+ * @arg DMA1_FLAG_ERR3: DMA1 Channel3 transfer error flag.
+ * @arg DMA1_FLAG_GL4: DMA1 Channel4 global flag.
+ * @arg DMA1_FLAG_TC4: DMA1 Channel4 transfer complete flag.
+ * @arg DMA1_FLAG_HT4: DMA1 Channel4 half transfer flag.
+ * @arg DMA1_FLAG_ERR4: DMA1 Channel4 transfer error flag.
+ * @arg DMA1_FLAG_GL5: DMA1 Channel5 global flag.
+ * @arg DMA1_FLAG_TC5: DMA1 Channel5 transfer complete flag.
+ * @arg DMA1_FLAG_HT5: DMA1 Channel5 half transfer flag.
+ * @arg DMA1_FLAG_ERR5: DMA1 Channel5 transfer error flag.
+ * @arg DMA1_FLAG_GL6: DMA1 Channel6 global flag.
+ * @arg DMA1_FLAG_TC6: DMA1 Channel6 transfer complete flag.
+ * @arg DMA1_FLAG_HT6: DMA1 Channel6 half transfer flag.
+ * @arg DMA1_FLAG_ERR6: DMA1 Channel6 transfer error flag.
+ * @arg DMA1_FLAG_GL7: DMA1 Channel7 global flag.
+ * @arg DMA1_FLAG_TC7: DMA1 Channel7 transfer complete flag.
+ * @arg DMA1_FLAG_HT7: DMA1 Channel7 half transfer flag.
+ * @arg DMA1_FLAG_ERR7: DMA1 Channel7 transfer error flag.
+ * @arg DMA2_FLAG_GL1: DMA2 Channel1 global flag.
+ * @arg DMA2_FLAG_TC1: DMA2 Channel1 transfer complete flag.
+ * @arg DMA2_FLAG_HT1: DMA2 Channel1 half transfer flag.
+ * @arg DMA2_FLAG_ERR1: DMA2 Channel1 transfer error flag.
+ * @arg DMA2_FLAG_GL2: DMA2 Channel2 global flag.
+ * @arg DMA2_FLAG_TC2: DMA2 Channel2 transfer complete flag.
+ * @arg DMA2_FLAG_HT2: DMA2 Channel2 half transfer flag.
+ * @arg DMA2_FLAG_ERR2: DMA2 Channel2 transfer error flag.
+ * @arg DMA2_FLAG_GL3: DMA2 Channel3 global flag.
+ * @arg DMA2_FLAG_TC3: DMA2 Channel3 transfer complete flag.
+ * @arg DMA2_FLAG_HT3: DMA2 Channel3 half transfer flag.
+ * @arg DMA2_FLAG_ERR3: DMA2 Channel3 transfer error flag.
+ * @arg DMA2_FLAG_GL4: DMA2 Channel4 global flag.
+ * @arg DMA2_FLAG_TC4: DMA2 Channel4 transfer complete flag.
+ * @arg DMA2_FLAG_HT4: DMA2 Channel4 half transfer flag.
+ * @arg DMA2_FLAG_ERR4: DMA2 Channel4 transfer error flag.
+ * @arg DMA2_FLAG_GL5: DMA2 Channel5 global flag.
+ * @arg DMA2_FLAG_TC5: DMA2 Channel5 transfer complete flag.
+ * @arg DMA2_FLAG_HT5: DMA2 Channel5 half transfer flag.
+ * @arg DMA2_FLAG_ERR5: DMA2 Channel5 transfer error flag.
+ * @retval The new state of DMAy_FLAG (SET or RESET).
+ */
+FlagStatus DMA_GetFlagStatus(uint32_t DMAy_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_DMA_GET_FLAG(DMAy_FLAG));
+
+ /* Calculate the used DMAy */
+ if ((DMAy_FLAG & FLAG_Mask) != (uint32_t)RESET)
+ {
+ /* Get DMA2 ISR register value */
+ tmpreg = DMA2->ISTS ;
+ }
+ else
+ {
+ /* Get DMA1 ISR register value */
+ tmpreg = DMA1->ISTS ;
+ }
+
+ /* Check the status of the specified DMAy flag */
+ if ((tmpreg & DMAy_FLAG) != (uint32_t)RESET)
+ {
+ /* DMAy_FLAG is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* DMAy_FLAG is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the DMAy_FLAG status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the DMAy Channelx's pending flags.
+ * @param DMAy_FLAG: specifies the flag to clear.
+ * This parameter can be any combination (for the same DMA) of the following values:
+ * @arg DMA1_FLAG_GL1: DMA1 Channel1 global flag.
+ * @arg DMA1_FLAG_TC1: DMA1 Channel1 transfer complete flag.
+ * @arg DMA1_FLAG_HT1: DMA1 Channel1 half transfer flag.
+ * @arg DMA1_FLAG_ERR1: DMA1 Channel1 transfer error flag.
+ * @arg DMA1_FLAG_GL2: DMA1 Channel2 global flag.
+ * @arg DMA1_FLAG_TC2: DMA1 Channel2 transfer complete flag.
+ * @arg DMA1_FLAG_HT2: DMA1 Channel2 half transfer flag.
+ * @arg DMA1_FLAG_ERR2: DMA1 Channel2 transfer error flag.
+ * @arg DMA1_FLAG_GL3: DMA1 Channel3 global flag.
+ * @arg DMA1_FLAG_TC3: DMA1 Channel3 transfer complete flag.
+ * @arg DMA1_FLAG_HT3: DMA1 Channel3 half transfer flag.
+ * @arg DMA1_FLAG_ERR3: DMA1 Channel3 transfer error flag.
+ * @arg DMA1_FLAG_GL4: DMA1 Channel4 global flag.
+ * @arg DMA1_FLAG_TC4: DMA1 Channel4 transfer complete flag.
+ * @arg DMA1_FLAG_HT4: DMA1 Channel4 half transfer flag.
+ * @arg DMA1_FLAG_ERR4: DMA1 Channel4 transfer error flag.
+ * @arg DMA1_FLAG_GL5: DMA1 Channel5 global flag.
+ * @arg DMA1_FLAG_TC5: DMA1 Channel5 transfer complete flag.
+ * @arg DMA1_FLAG_HT5: DMA1 Channel5 half transfer flag.
+ * @arg DMA1_FLAG_ERR5: DMA1 Channel5 transfer error flag.
+ * @arg DMA1_FLAG_GL6: DMA1 Channel6 global flag.
+ * @arg DMA1_FLAG_TC6: DMA1 Channel6 transfer complete flag.
+ * @arg DMA1_FLAG_HT6: DMA1 Channel6 half transfer flag.
+ * @arg DMA1_FLAG_ERR6: DMA1 Channel6 transfer error flag.
+ * @arg DMA1_FLAG_GL7: DMA1 Channel7 global flag.
+ * @arg DMA1_FLAG_TC7: DMA1 Channel7 transfer complete flag.
+ * @arg DMA1_FLAG_HT7: DMA1 Channel7 half transfer flag.
+ * @arg DMA1_FLAG_ERR7: DMA1 Channel7 transfer error flag.
+ * @arg DMA2_FLAG_GL1: DMA2 Channel1 global flag.
+ * @arg DMA2_FLAG_TC1: DMA2 Channel1 transfer complete flag.
+ * @arg DMA2_FLAG_HT1: DMA2 Channel1 half transfer flag.
+ * @arg DMA2_FLAG_ERR1: DMA2 Channel1 transfer error flag.
+ * @arg DMA2_FLAG_GL2: DMA2 Channel2 global flag.
+ * @arg DMA2_FLAG_TC2: DMA2 Channel2 transfer complete flag.
+ * @arg DMA2_FLAG_HT2: DMA2 Channel2 half transfer flag.
+ * @arg DMA2_FLAG_ERR2: DMA2 Channel2 transfer error flag.
+ * @arg DMA2_FLAG_GL3: DMA2 Channel3 global flag.
+ * @arg DMA2_FLAG_TC3: DMA2 Channel3 transfer complete flag.
+ * @arg DMA2_FLAG_HT3: DMA2 Channel3 half transfer flag.
+ * @arg DMA2_FLAG_ERR3: DMA2 Channel3 transfer error flag.
+ * @arg DMA2_FLAG_GL4: DMA2 Channel4 global flag.
+ * @arg DMA2_FLAG_TC4: DMA2 Channel4 transfer complete flag.
+ * @arg DMA2_FLAG_HT4: DMA2 Channel4 half transfer flag.
+ * @arg DMA2_FLAG_ERR4: DMA2 Channel4 transfer error flag.
+ * @arg DMA2_FLAG_GL5: DMA2 Channel5 global flag.
+ * @arg DMA2_FLAG_TC5: DMA2 Channel5 transfer complete flag.
+ * @arg DMA2_FLAG_HT5: DMA2 Channel5 half transfer flag.
+ * @arg DMA2_FLAG_ERR5: DMA2 Channel5 transfer error flag.
+ * @retval None
+ */
+void DMA_ClearFlag(uint32_t DMAy_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_DMA_CLEAR_FLAG(DMAy_FLAG));
+
+ /* Calculate the used DMAy */
+ if ((DMAy_FLAG & FLAG_Mask) != (uint32_t)RESET)
+ {
+ /* Clear the selected DMAy flags */
+ DMA2->ICLR = DMAy_FLAG;
+ }
+ else
+ {
+ /* Clear the selected DMAy flags */
+ DMA1->ICLR = DMAy_FLAG;
+ }
+}
+
+/**
+ * @brief Checks whether the specified DMAy Channelx interrupt has occurred or not.
+ * @param DMAy_INT: specifies the DMAy interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg DMA1_INT_GL1: DMA1 Channel1 global interrupt.
+ * @arg DMA1_INT_TC1: DMA1 Channel1 transfer complete interrupt.
+ * @arg DMA1_INT_HT1: DMA1 Channel1 half transfer interrupt.
+ * @arg DMA1_INT_ERR1: DMA1 Channel1 transfer error interrupt.
+ * @arg DMA1_INT_GL2: DMA1 Channel2 global interrupt.
+ * @arg DMA1_INT_TC2: DMA1 Channel2 transfer complete interrupt.
+ * @arg DMA1_INT_HT2: DMA1 Channel2 half transfer interrupt.
+ * @arg DMA1_INT_ERR2: DMA1 Channel2 transfer error interrupt.
+ * @arg DMA1_INT_GL3: DMA1 Channel3 global interrupt.
+ * @arg DMA1_INT_TC3: DMA1 Channel3 transfer complete interrupt.
+ * @arg DMA1_INT_HT3: DMA1 Channel3 half transfer interrupt.
+ * @arg DMA1_INT_ERR3: DMA1 Channel3 transfer error interrupt.
+ * @arg DMA1_INT_GL4: DMA1 Channel4 global interrupt.
+ * @arg DMA1_INT_TC4: DMA1 Channel4 transfer complete interrupt.
+ * @arg DMA1_INT_HT4: DMA1 Channel4 half transfer interrupt.
+ * @arg DMA1_INT_ERR4: DMA1 Channel4 transfer error interrupt.
+ * @arg DMA1_INT_GL5: DMA1 Channel5 global interrupt.
+ * @arg DMA1_INT_TC5: DMA1 Channel5 transfer complete interrupt.
+ * @arg DMA1_INT_HT5: DMA1 Channel5 half transfer interrupt.
+ * @arg DMA1_INT_ERR5: DMA1 Channel5 transfer error interrupt.
+ * @arg DMA1_INT_GL6: DMA1 Channel6 global interrupt.
+ * @arg DMA1_INT_TC6: DMA1 Channel6 transfer complete interrupt.
+ * @arg DMA1_INT_HT6: DMA1 Channel6 half transfer interrupt.
+ * @arg DMA1_INT_ERR6: DMA1 Channel6 transfer error interrupt.
+ * @arg DMA1_INT_GL7: DMA1 Channel7 global interrupt.
+ * @arg DMA1_INT_TC7: DMA1 Channel7 transfer complete interrupt.
+ * @arg DMA1_INT_HT7: DMA1 Channel7 half transfer interrupt.
+ * @arg DMA1_INT_ERR7: DMA1 Channel7 transfer error interrupt.
+ * @arg DMA2_INT_GL1: DMA2 Channel1 global interrupt.
+ * @arg DMA2_INT_TC1: DMA2 Channel1 transfer complete interrupt.
+ * @arg DMA2_INT_HT1: DMA2 Channel1 half transfer interrupt.
+ * @arg DMA2_INT_ERR1: DMA2 Channel1 transfer error interrupt.
+ * @arg DMA2_INT_GL2: DMA2 Channel2 global interrupt.
+ * @arg DMA2_INT_TC2: DMA2 Channel2 transfer complete interrupt.
+ * @arg DMA2_INT_HT2: DMA2 Channel2 half transfer interrupt.
+ * @arg DMA2_INT_ERR2: DMA2 Channel2 transfer error interrupt.
+ * @arg DMA2_INT_GL3: DMA2 Channel3 global interrupt.
+ * @arg DMA2_INT_TC3: DMA2 Channel3 transfer complete interrupt.
+ * @arg DMA2_INT_HT3: DMA2 Channel3 half transfer interrupt.
+ * @arg DMA2_INT_ERR3: DMA2 Channel3 transfer error interrupt.
+ * @arg DMA2_INT_GL4: DMA2 Channel4 global interrupt.
+ * @arg DMA2_INT_TC4: DMA2 Channel4 transfer complete interrupt.
+ * @arg DMA2_INT_HT4: DMA2 Channel4 half transfer interrupt.
+ * @arg DMA2_INT_ERR4: DMA2 Channel4 transfer error interrupt.
+ * @arg DMA2_INT_GL5: DMA2 Channel5 global interrupt.
+ * @arg DMA2_INT_TC5: DMA2 Channel5 transfer complete interrupt.
+ * @arg DMA2_INT_HT5: DMA2 Channel5 half transfer interrupt.
+ * @arg DMA2_INT_ERR5: DMA2 Channel5 transfer error interrupt.
+ * @retval The new state of DMAy_INT (SET or RESET).
+ */
+ITStatus DMA_GetITStatus(uint32_t DMAy_INT)
+{
+ ITStatus bitstatus = RESET;
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_DMA_GET_INT(DMAy_INT));
+
+ /* Calculate the used DMA */
+ if ((DMAy_INT & FLAG_Mask) != (uint32_t)RESET)
+ {
+ /* Get DMA2 ISR register value */
+ tmpreg = DMA2->ISTS;
+ }
+ else
+ {
+ /* Get DMA1 ISR register value */
+ tmpreg = DMA1->ISTS;
+ }
+
+ /* Check the status of the specified DMAy interrupt */
+ if ((tmpreg & DMAy_INT) != (uint32_t)RESET)
+ {
+ /* DMAy_INT is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* DMAy_INT is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the DMA_INT status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the DMAy Channelx's interrupt pending bits.
+ * @param DMAy_INT: specifies the DMAy interrupt pending bit to clear.
+ * This parameter can be any combination (for the same DMA) of the following values:
+ * @arg DMA1_INT_GL1: DMA1 Channel1 global interrupt.
+ * @arg DMA1_INT_TC1: DMA1 Channel1 transfer complete interrupt.
+ * @arg DMA1_INT_HT1: DMA1 Channel1 half transfer interrupt.
+ * @arg DMA1_INT_ERR1: DMA1 Channel1 transfer error interrupt.
+ * @arg DMA1_INT_GL2: DMA1 Channel2 global interrupt.
+ * @arg DMA1_INT_TC2: DMA1 Channel2 transfer complete interrupt.
+ * @arg DMA1_INT_HT2: DMA1 Channel2 half transfer interrupt.
+ * @arg DMA1_INT_ERR2: DMA1 Channel2 transfer error interrupt.
+ * @arg DMA1_INT_GL3: DMA1 Channel3 global interrupt.
+ * @arg DMA1_INT_TC3: DMA1 Channel3 transfer complete interrupt.
+ * @arg DMA1_INT_HT3: DMA1 Channel3 half transfer interrupt.
+ * @arg DMA1_INT_ERR3: DMA1 Channel3 transfer error interrupt.
+ * @arg DMA1_INT_GL4: DMA1 Channel4 global interrupt.
+ * @arg DMA1_INT_TC4: DMA1 Channel4 transfer complete interrupt.
+ * @arg DMA1_INT_HT4: DMA1 Channel4 half transfer interrupt.
+ * @arg DMA1_INT_ERR4: DMA1 Channel4 transfer error interrupt.
+ * @arg DMA1_INT_GL5: DMA1 Channel5 global interrupt.
+ * @arg DMA1_INT_TC5: DMA1 Channel5 transfer complete interrupt.
+ * @arg DMA1_INT_HT5: DMA1 Channel5 half transfer interrupt.
+ * @arg DMA1_INT_ERR5: DMA1 Channel5 transfer error interrupt.
+ * @arg DMA1_INT_GL6: DMA1 Channel6 global interrupt.
+ * @arg DMA1_INT_TC6: DMA1 Channel6 transfer complete interrupt.
+ * @arg DMA1_INT_HT6: DMA1 Channel6 half transfer interrupt.
+ * @arg DMA1_INT_ERR6: DMA1 Channel6 transfer error interrupt.
+ * @arg DMA1_INT_GL7: DMA1 Channel7 global interrupt.
+ * @arg DMA1_INT_TC7: DMA1 Channel7 transfer complete interrupt.
+ * @arg DMA1_INT_HT7: DMA1 Channel7 half transfer interrupt.
+ * @arg DMA1_INT_ERR7: DMA1 Channel7 transfer error interrupt.
+ * @arg DMA2_INT_GL1: DMA2 Channel1 global interrupt.
+ * @arg DMA2_INT_TC1: DMA2 Channel1 transfer complete interrupt.
+ * @arg DMA2_INT_HT1: DMA2 Channel1 half transfer interrupt.
+ * @arg DMA2_INT_ERR1: DMA2 Channel1 transfer error interrupt.
+ * @arg DMA2_INT_GL2: DMA2 Channel2 global interrupt.
+ * @arg DMA2_INT_TC2: DMA2 Channel2 transfer complete interrupt.
+ * @arg DMA2_INT_HT2: DMA2 Channel2 half transfer interrupt.
+ * @arg DMA2_INT_ERR2: DMA2 Channel2 transfer error interrupt.
+ * @arg DMA2_INT_GL3: DMA2 Channel3 global interrupt.
+ * @arg DMA2_INT_TC3: DMA2 Channel3 transfer complete interrupt.
+ * @arg DMA2_INT_HT3: DMA2 Channel3 half transfer interrupt.
+ * @arg DMA2_INT_ERR3: DMA2 Channel3 transfer error interrupt.
+ * @arg DMA2_INT_GL4: DMA2 Channel4 global interrupt.
+ * @arg DMA2_INT_TC4: DMA2 Channel4 transfer complete interrupt.
+ * @arg DMA2_INT_HT4: DMA2 Channel4 half transfer interrupt.
+ * @arg DMA2_INT_ERR4: DMA2 Channel4 transfer error interrupt.
+ * @arg DMA2_INT_GL5: DMA2 Channel5 global interrupt.
+ * @arg DMA2_INT_TC5: DMA2 Channel5 transfer complete interrupt.
+ * @arg DMA2_INT_HT5: DMA2 Channel5 half transfer interrupt.
+ * @arg DMA2_INT_ERR5: DMA2 Channel5 transfer error interrupt.
+ * @retval None
+ */
+void DMA_ClearITPendingBit(uint32_t DMAy_INT)
+{
+ /* Check the parameters */
+ assert_param(IS_DMA_CLEAR_INT(DMAy_INT));
+
+ /* Calculate the used DMAy */
+ if ((DMAy_INT & FLAG_Mask) != (uint32_t)RESET)
+ {
+ /* Clear the selected DMAy interrupt pending bits */
+ DMA2->ICLR = DMAy_INT;
+ }
+ else
+ {
+ /* Clear the selected DMAy interrupt pending bits */
+ DMA1->ICLR = DMAy_INT;
+ }
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_ertc.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_ertc.c
new file mode 100644
index 0000000000000000000000000000000000000000..3cc2ade0a1ccba8dc1fadced903df44f03b7fd69
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_ertc.c
@@ -0,0 +1,2456 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_ertc.c
+ * Description : at32f4xx ERTC source file
+ * Date : 2018-03-15
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_ertc.h"
+#include "at32f4xx_rcc.h"
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup ERTC
+ * @brief ERTC driver modules
+ * @{
+ */
+
+#if defined (AT32F415xx)
+
+/* Private typedef -----------------------------------------------------------*/
+/* Private define ------------------------------------------------------------*/
+
+/* Masks Definition */
+#define ERTC_TIME_RESERVED_MASK ((uint32_t)0x007F7F7F)
+#define ERTC_DATE_RESERVED_MASK ((uint32_t)0x00FFFF3F)
+#define ERTC_INIT_MASK ((uint32_t)0xFFFFFFFF)
+#define ERTC_RSF_MASK ((uint32_t)0xFFFFFF5F)
+#define ERTC_FLAGS_MASK ((uint32_t)(ERTC_FLAG_TSOF | ERTC_FLAG_TSF | ERTC_FLAG_WATF | \
+ ERTC_FLAG_ALBF | ERTC_FLAG_ALAF | ERTC_FLAG_INITF | \
+ ERTC_FLAG_RSF | ERTC_FLAG_INITS | ERTC_FLAG_WATWF | \
+ ERTC_FLAG_ALBWF | ERTC_FLAG_ALAWF | ERTC_FLAG_TP1F | \
+ ERTC_FLAG_TP2F | ERTC_FLAG_RECALPDF | ERTC_FLAG_SFP))
+
+#define INITMODE_TMROUT ((uint32_t) 0x00010000)
+#define SYNCHRO_TMROUT ((uint32_t) 0x00020000)
+#define RECALPDF_TMROUT ((uint32_t) 0x00020000)
+#define SFP_TMROUT ((uint32_t) 0x00001000)
+
+/* Private macro -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Private function prototypes -----------------------------------------------*/
+static uint8_t ERTC_ByteToBcd2(uint8_t Value);
+static uint8_t ERTC_Bcd2ToByte(uint8_t Value);
+
+/* Private functions ---------------------------------------------------------*/
+
+/** @defgroup RTC_Private_Functions
+ * @{
+ */
+
+
+/**
+ * @brief Deinitializes the ERTC registers to their default reset values.
+ * @note This function doesn't reset the ERTC Clock source and ERTC Backup Data
+ * registers.
+ * @param None
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC registers are deinitialized
+ * - ERROR: ERTC registers are not deinitialized
+ */
+ErrorStatus ERTC_Reset(void)
+{
+ __IO uint32_t wutcounter = 0x00;
+ uint32_t wutwfstatus = 0x00;
+ ErrorStatus status = ERROR;
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Set Initialization mode */
+ if (ERTC_EnterInitMode() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ /* Reset TIME, DATE and CTRL registers */
+ ERTC->TIME = (uint32_t)0x00000000;
+ ERTC->DATE = (uint32_t)0x00002101;
+ /* Reset All CTRL bits except CTRL[2:0] */
+ ERTC->CTRL &= (uint32_t)0x00000007;
+
+ /* Wait till ERTC WUTWF flag is set and if Time out is reached exit */
+ do
+ {
+ wutwfstatus = ERTC->ISTS & ERTC_ISTS_WATWF;
+ wutcounter++;
+ } while((wutcounter != INITMODE_TMROUT) && (wutwfstatus == 0x00));
+
+ if ((ERTC->ISTS & ERTC_ISTS_WATWF) == RESET)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ /* Reset all ERTC CTRL register bits */
+ ERTC->CTRL &= (uint32_t)0x00000000;
+ ERTC->WATR = (uint32_t)0x0000FFFF;
+ ERTC->PSC = (uint32_t)0x007F00FF;
+ ERTC->CAL = (uint32_t)0x00000000;
+ ERTC->ALA = (uint32_t)0x00000000;
+ ERTC->ALB = (uint32_t)0x00000000;
+ ERTC->SFCTR = (uint32_t)0x00000000;
+ ERTC->CCR = (uint32_t)0x00000000;
+ ERTC->ALASBS = (uint32_t)0x00000000;
+ ERTC->ALBSBS = (uint32_t)0x00000000;
+
+ /* Reset ISTS register and exit initialization mode */
+ ERTC->ISTS = (uint32_t)0x00000000;
+
+ /* Reset Tamper and alternate functions configuration register */
+ ERTC->TPAF = 0x00000000;
+
+ if(ERTC_WaitForSynchro() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ status = SUCCESS;
+ }
+ }
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return status;
+}
+
+/**
+ * @brief Initializes the ERTC registers according to the specified parameters
+ * in ERTC_InitStruct.
+ * @param ERTC_InitStruct: pointer to a ERTC_InitType structure that contains
+ * the configuration information for the ERTC peripheral.
+ * @note The ERTC Prescaler register is write protected and can be written in
+ * initialization mode only.
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC registers are initialized
+ * - ERROR: ERTC registers are not initialized
+ */
+ErrorStatus ERTC_Init(ERTC_InitType* ERTC_InitStruct)
+{
+ ErrorStatus status = ERROR;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_HOUR_FORMAT(ERTC_InitStruct->ERTC_HourFormat));
+ assert_param(IS_ERTC_ASYNCH_PRDIV(ERTC_InitStruct->ERTC_AsynchPrediv));
+ assert_param(IS_ERTC_SYNCH_PRDIV(ERTC_InitStruct->ERTC_SynchPrediv));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Set Initialization mode */
+ if (ERTC_EnterInitMode() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ /* Clear ERTC CTRL FMT Bit */
+ ERTC->CTRL &= ((uint32_t)~(ERTC_CTRL_HFM));
+ /* Set RTC_CR register */
+ ERTC->CTRL |= ((uint32_t)(ERTC_InitStruct->ERTC_HourFormat));
+
+ /* Configure the ERTC PSC */
+ ERTC->PSC = (uint32_t)(ERTC_InitStruct->ERTC_SynchPrediv);
+ ERTC->PSC |= (uint32_t)(ERTC_InitStruct->ERTC_AsynchPrediv << 16);
+
+ /* Exit Initialization mode */
+ ERTC_ExitInitMode();
+
+ status = SUCCESS;
+ }
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return status;
+}
+
+/**
+ * @brief Fills each ERTC_InitStruct member with its default value.
+ * @param ERTC_InitStruct: pointer to a ERTC_InitType structure which will be
+ * initialized.
+ * @retval None
+ */
+void ERTC_StructInit(ERTC_InitType* ERTC_InitStruct)
+{
+ /* Initialize the ERTC_HourFormat member */
+ ERTC_InitStruct->ERTC_HourFormat = ERTC_HourFormat_24;
+
+ /* Initialize the ERTC_AsynchPrediv member */
+ ERTC_InitStruct->ERTC_AsynchPrediv = (uint32_t)0x7F;
+
+ /* Initialize the ERTC_SynchPrediv member */
+ ERTC_InitStruct->ERTC_SynchPrediv = (uint32_t)0xFF;
+}
+
+/**
+ * @brief Enables or disables the ERTC registers write protection.
+ * @note All the ERTC registers are write protected except for RTC_ISR[13:8],
+ * RTC_TAFCR and RTC_BKPxR.
+ * @note Writing a wrong key reactivates the write protection.
+ * @note The protection mechanism is not affected by system reset.
+ * @param NewState: new state of the write protection.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ERTC_WriteProtectionCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+ }
+ else
+ {
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+ }
+}
+
+/**
+ * @brief Enters the ERTC Initialization mode.
+ * @note The ERTC Initialization mode is write protected, use the
+ * ERTC_WriteProtectionCmd(DISABLE) before calling this function.
+ * @param None
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC is in Init mode
+ * - ERROR: ERTC is not in Init mode
+ */
+ErrorStatus ERTC_EnterInitMode(void)
+{
+ __IO uint32_t initcounter = 0x00;
+ ErrorStatus status = ERROR;
+ uint32_t initstatus = 0x00;
+
+ /* Check if the Initialization mode is set */
+ if ((ERTC->ISTS & ERTC_ISTS_INITF) == (uint32_t)RESET)
+ {
+ /* Set the Initialization mode */
+ ERTC->ISTS = (uint32_t)ERTC_INIT_MASK;
+
+ /* Wait till ERTC is in INIT state and if Time out is reached exit */
+ do
+ {
+ initstatus = ERTC->ISTS & ERTC_ISTS_INITF;
+ initcounter++;
+ } while((initcounter != INITMODE_TMROUT) && (initstatus == 0x00));
+
+ if ((ERTC->ISTS & ERTC_ISTS_INITF) != RESET)
+ {
+ status = SUCCESS;
+ }
+ else
+ {
+ status = ERROR;
+ }
+ }
+ else
+ {
+ status = SUCCESS;
+ }
+
+ return (status);
+}
+
+/**
+ * @brief Exits the ERTC Initialization mode.
+ * @note When the initialization sequence is complete, the calendar restarts
+ * counting after 4 RTCCLK cycles.
+ * @note The ERTC Initialization mode is write protected, use the
+ * ERTC_WriteProtectionCmd(DISABLE) before calling this function.
+ * @param None
+ * @retval None
+ */
+void ERTC_ExitInitMode(void)
+{
+ /* Exit Initialization mode */
+ ERTC->ISTS &= (uint32_t)~ERTC_ISTS_INITM;
+}
+
+/**
+ * @brief Waits until the ERTC Time and Date registers (RTC_TR and RTC_DR) are
+ * synchronized with ERTC APB clock.
+ * @note The ERTC Resynchronization mode is write protected, use the
+ * ERTC_WriteProtectionCmd(DISABLE) before calling this function.
+ * @note To read the calendar through the shadow registers after Calendar
+ * initialization, calendar update or after wakeup from low power modes
+ * the software must first clear the RSF flag.
+ * The software must then wait until it is set again before reading
+ * the calendar, which means that the calendar registers have been
+ * correctly copied into the RTC_TR and RTC_DR shadow registers.
+ * @param None
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC registers are synchronised
+ * - ERROR: ERTC registers are not synchronised
+ */
+ErrorStatus ERTC_WaitForSynchro(void)
+{
+ __IO uint32_t synchrocounter = 0;
+ ErrorStatus status = ERROR;
+ uint32_t synchrostatus = 0x00;
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Clear RSF flag */
+ ERTC->ISTS &= (uint32_t)ERTC_RSF_MASK;
+
+ /* Wait the registers to be synchronised */
+ do
+ {
+ synchrostatus = ERTC->ISTS & ERTC_ISTS_RSF;
+ synchrocounter++;
+ } while((synchrocounter != SYNCHRO_TMROUT) && (synchrostatus == 0x00));
+
+ if ((ERTC->ISTS & ERTC_ISTS_RSF) != RESET)
+ {
+ status = SUCCESS;
+ }
+ else
+ {
+ status = ERROR;
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return (status);
+}
+
+/**
+ * @brief Enables or disables the ERTC reference clock detection.
+ * @param NewState: new state of the ERTC reference clock.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC reference clock detection is enabled
+ * - ERROR: ERTC reference clock detection is disabled
+ */
+ErrorStatus ERTC_RefClockCmd(FunctionalState NewState)
+{
+ ErrorStatus status = ERROR;
+
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Set Initialization mode */
+ if (ERTC_EnterInitMode() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ if (NewState != DISABLE)
+ {
+ /* Enable the ERTC reference clock detection */
+ ERTC->CTRL |= ERTC_CTRL_RFCKON;
+ }
+ else
+ {
+ /* Disable the ERTC reference clock detection */
+ ERTC->CTRL &= ~ERTC_CTRL_RFCKON;
+ }
+ /* Exit Initialization mode */
+ ERTC_ExitInitMode();
+
+ status = SUCCESS;
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return status;
+}
+
+/**
+ * @brief Enables or Disables the Bypass Shadow feature.
+ * @note When the Bypass Shadow is enabled the calendar value are taken
+ * directly from the Calendar counter.
+ * @param NewState: new state of the Bypass Shadow feature.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+*/
+void ERTC_BypassShadowCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ if (NewState != DISABLE)
+ {
+ /* Set the BYPSHAD bit */
+ ERTC->CTRL |= (uint8_t)ERTC_CTRL_BYPSHDW;
+ }
+ else
+ {
+ /* Reset the BYPSHAD bit */
+ ERTC->CTRL &= (uint8_t)~ERTC_CTRL_BYPSHDW;
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group2 Time and Date configuration functions
+ * @brief Time and Date configuration functions
+ *
+@verbatim
+ ===============================================================================
+ ##### Time and Date configuration functions #####
+ ===============================================================================
+
+ [..] This section provide functions allowing to program and read the ERTC Calendar
+ (Time and Date).
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Set the ERTC current time.
+ * @param ERTC_Format: specifies the format of the entered parameters.
+ * This parameter can be one of the following values:
+ * @arg ERTC_Format_BIN: Binary data format
+ * @arg ERTC_Format_BCD: BCD data format
+ * @param ERTC_TimeStruct: pointer to a ERTC_TimeType structure that contains
+ * the time configuration information for the ERTC.
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC Time register is configured
+ * - ERROR: ERTC Time register is not configured
+ */
+ErrorStatus ERTC_SetTimeValue(uint32_t ERTC_Format, ERTC_TimeType* ERTC_TimeStruct)
+{
+ uint32_t tmpreg = 0;
+ ErrorStatus status = ERROR;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_FORMAT(ERTC_Format));
+
+ if (ERTC_Format == ERTC_Format_BIN)
+ {
+ if ((ERTC->CTRL & ERTC_CTRL_HFM) != (uint32_t)RESET)
+ {
+ assert_param(IS_ERTC_HOUR12(ERTC_TimeStruct->ERTC_Hours));
+ assert_param(IS_ERTC_H12(ERTC_TimeStruct->ERTC_AMPM));
+ }
+ else
+ {
+ ERTC_TimeStruct->ERTC_AMPM = 0x00;
+ assert_param(IS_ERTC_HOUR24(ERTC_TimeStruct->ERTC_Hours));
+ }
+ assert_param(IS_ERTC_MINUTES(ERTC_TimeStruct->ERTC_Minutes));
+ assert_param(IS_ERTC_SECONDS(ERTC_TimeStruct->ERTC_Seconds));
+ }
+ else
+ {
+ if ((ERTC->CTRL & ERTC_CTRL_HFM) != (uint32_t)RESET)
+ {
+ tmpreg = ERTC_Bcd2ToByte(ERTC_TimeStruct->ERTC_Hours);
+ assert_param(IS_ERTC_HOUR12(tmpreg));
+ assert_param(IS_ERTC_H12(ERTC_TimeStruct->ERTC_AMPM));
+ }
+ else
+ {
+ ERTC_TimeStruct->ERTC_AMPM = 0x00;
+ assert_param(IS_ERTC_HOUR24(ERTC_Bcd2ToByte(ERTC_TimeStruct->ERTC_Hours)));
+ }
+ assert_param(IS_ERTC_MINUTES(ERTC_Bcd2ToByte(ERTC_TimeStruct->ERTC_Minutes)));
+ assert_param(IS_ERTC_SECONDS(ERTC_Bcd2ToByte(ERTC_TimeStruct->ERTC_Seconds)));
+ }
+
+ /* Check the input parameters format */
+ if (ERTC_Format != ERTC_Format_BIN)
+ {
+ tmpreg = (((uint32_t)(ERTC_TimeStruct->ERTC_Hours) << 16) | \
+ ((uint32_t)(ERTC_TimeStruct->ERTC_Minutes) << 8) | \
+ ((uint32_t)ERTC_TimeStruct->ERTC_Seconds) | \
+ ((uint32_t)(ERTC_TimeStruct->ERTC_AMPM) << 16));
+ }
+ else
+ {
+ tmpreg = (uint32_t)(((uint32_t)ERTC_ByteToBcd2(ERTC_TimeStruct->ERTC_Hours) << 16) | \
+ ((uint32_t)ERTC_ByteToBcd2(ERTC_TimeStruct->ERTC_Minutes) << 8) | \
+ ((uint32_t)ERTC_ByteToBcd2(ERTC_TimeStruct->ERTC_Seconds)) | \
+ (((uint32_t)ERTC_TimeStruct->ERTC_AMPM) << 16));
+ }
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Set Initialization mode */
+ if (ERTC_EnterInitMode() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ /* Set the RTC_TR register */
+ ERTC->TIME = (uint32_t)(tmpreg & ERTC_TIME_RESERVED_MASK);
+
+ /* Exit Initialization mode */
+ ERTC_ExitInitMode();
+
+ /* If ERTC_CTRL_BYPSHDW bit = 0, wait for synchro else this check is not needed */
+ if ((ERTC->CTRL & ERTC_CTRL_BYPSHDW) == RESET)
+ {
+ if(ERTC_WaitForSynchro() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ status = SUCCESS;
+ }
+ }
+ else
+ {
+ status = SUCCESS;
+ }
+ }
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return status;
+}
+
+/**
+ * @brief Fills each ERTC_TimeStruct member with its default value
+ * (Time = 00h:00min:00sec).
+ * @param ERTC_TimeStruct: pointer to a ERTC_TimeType structure which will be
+ * initialized.
+ * @retval None
+ */
+void ERTC_TimeStructInit(ERTC_TimeType* ERTC_TimeStruct)
+{
+ /* Time = 00h:00min:00sec */
+ ERTC_TimeStruct->ERTC_AMPM = ERTC_H12_AM;
+ ERTC_TimeStruct->ERTC_Hours = 0;
+ ERTC_TimeStruct->ERTC_Minutes = 0;
+ ERTC_TimeStruct->ERTC_Seconds = 0;
+}
+
+/**
+ * @brief Get the ERTC current Time.
+ * @param ERTC_Format: specifies the format of the returned parameters.
+ * This parameter can be one of the following values:
+ * @arg ERTC_Format_BIN: Binary data format
+ * @arg ERTC_Format_BCD: BCD data format
+ * @param ERTC_TimeStruct: pointer to a ERTC_TimeType structure that will
+ * contain the returned current time configuration.
+ * @retval None
+ */
+void ERTC_GetTimeValue(uint32_t ERTC_Format, ERTC_TimeType* ERTC_TimeStruct)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_FORMAT(ERTC_Format));
+
+ /* Get the RTC_TR register */
+ tmpreg = (uint32_t)(ERTC->TIME & ERTC_TIME_RESERVED_MASK);
+
+ /* Fill the structure fields with the read parameters */
+ ERTC_TimeStruct->ERTC_Hours = (uint8_t)((tmpreg & (ERTC_TIME_HT | ERTC_TIME_HU)) >> 16);
+ ERTC_TimeStruct->ERTC_Minutes = (uint8_t)((tmpreg & (ERTC_TIME_MT | ERTC_TIME_MU)) >>8);
+ ERTC_TimeStruct->ERTC_Seconds = (uint8_t)(tmpreg & (ERTC_TIME_ST | ERTC_TIME_SU));
+ ERTC_TimeStruct->ERTC_AMPM = (uint8_t)((tmpreg & (ERTC_TIME_AMPM)) >> 16);
+
+ /* Check the input parameters format */
+ if (ERTC_Format == ERTC_Format_BIN)
+ {
+ /* Convert the structure parameters to Binary format */
+ ERTC_TimeStruct->ERTC_Hours = (uint8_t)ERTC_Bcd2ToByte(ERTC_TimeStruct->ERTC_Hours);
+ ERTC_TimeStruct->ERTC_Minutes = (uint8_t)ERTC_Bcd2ToByte(ERTC_TimeStruct->ERTC_Minutes);
+ ERTC_TimeStruct->ERTC_Seconds = (uint8_t)ERTC_Bcd2ToByte(ERTC_TimeStruct->ERTC_Seconds);
+ }
+}
+
+/**
+ * @brief Gets the ERTC current Calendar Sub seconds value.
+ * @note This function freeze the Time and Date registers after reading the
+ * SBSR register.
+ * @param None
+ * @retval ERTC current Calendar Sub seconds value.
+ */
+uint32_t ERTC_GetSubSecondValue(void)
+{
+ uint32_t tmpreg = 0;
+
+ /* Get sub seconds values from the correspondent registers*/
+ tmpreg = (uint32_t)(ERTC->SBSR);
+
+ /* Read DATE register to unfroze calendar registers */
+ (void) (ERTC->DATE);
+
+ return (tmpreg);
+}
+
+/**
+ * @brief Set the ERTC current date.
+ * @param ERTC_Format: specifies the format of the entered parameters.
+ * This parameter can be one of the following values:
+ * @arg ERTC_Format_BIN: Binary data format
+ * @arg ERTC_Format_BCD: BCD data format
+ * @param ERTC_DateStruct: pointer to a ERTC_DateType structure that contains
+ * the date configuration information for the ERTC.
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC Date register is configured
+ * - ERROR: ERTC Date register is not configured
+ */
+ErrorStatus ERTC_SetDateValue(uint32_t ERTC_Format, ERTC_DateType* ERTC_DateStruct)
+{
+ uint32_t tmpreg = 0;
+ ErrorStatus status = ERROR;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_FORMAT(ERTC_Format));
+
+ if ((ERTC_Format == ERTC_Format_BIN) && ((ERTC_DateStruct->ERTC_Month & 0x10) == 0x10))
+ {
+ ERTC_DateStruct->ERTC_Month = (ERTC_DateStruct->ERTC_Month & (uint32_t)~(0x10)) + 0x0A;
+ }
+ if (ERTC_Format == ERTC_Format_BIN)
+ {
+ assert_param(IS_ERTC_YEAR(ERTC_DateStruct->ERTC_Year));
+ assert_param(IS_ERTC_MONTH(ERTC_DateStruct->ERTC_Month));
+ assert_param(IS_ERTC_DATE(ERTC_DateStruct->ERTC_Date));
+ }
+ else
+ {
+ assert_param(IS_ERTC_YEAR(ERTC_Bcd2ToByte(ERTC_DateStruct->ERTC_Year)));
+ tmpreg = ERTC_Bcd2ToByte(ERTC_DateStruct->ERTC_Month);
+ assert_param(IS_ERTC_MONTH(tmpreg));
+ tmpreg = ERTC_Bcd2ToByte(ERTC_DateStruct->ERTC_Date);
+ assert_param(IS_ERTC_DATE(tmpreg));
+ }
+ assert_param(IS_ERTC_WEEK(ERTC_DateStruct->ERTC_WeekDay));
+
+ /* Check the input parameters format */
+ if (ERTC_Format != ERTC_Format_BIN)
+ {
+ tmpreg = ((((uint32_t)ERTC_DateStruct->ERTC_Year) << 16) | \
+ (((uint32_t)ERTC_DateStruct->ERTC_Month) << 8) | \
+ ((uint32_t)ERTC_DateStruct->ERTC_Date) | \
+ (((uint32_t)ERTC_DateStruct->ERTC_WeekDay) << 13));
+ }
+ else
+ {
+ tmpreg = (((uint32_t)ERTC_ByteToBcd2(ERTC_DateStruct->ERTC_Year) << 16) | \
+ ((uint32_t)ERTC_ByteToBcd2(ERTC_DateStruct->ERTC_Month) << 8) | \
+ ((uint32_t)ERTC_ByteToBcd2(ERTC_DateStruct->ERTC_Date)) | \
+ ((uint32_t)ERTC_DateStruct->ERTC_WeekDay << 13));
+ }
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Set Initialization mode */
+ if (ERTC_EnterInitMode() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ /* Set the RTC_DR register */
+ ERTC->DATE = (uint32_t)(tmpreg & ERTC_DATE_RESERVED_MASK);
+
+ /* Exit Initialization mode */
+ ERTC_ExitInitMode();
+
+ /* If ERTC_CTRL_BYPSHDW bit = 0, wait for synchro else this check is not needed */
+ if ((ERTC->CTRL & ERTC_CTRL_BYPSHDW) == RESET)
+ {
+ if(ERTC_WaitForSynchro() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ status = SUCCESS;
+ }
+ }
+ else
+ {
+ status = SUCCESS;
+ }
+ }
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return status;
+}
+
+/**
+ * @brief Fills each ERTC_DateStruct member with its default value
+ * (Monday, January 01 xx00).
+ * @param ERTC_DateStruct: pointer to a ERTC_DateType structure which will be
+ * initialized.
+ * @retval None
+ */
+void ERTC_DateStructInit(ERTC_DateType* ERTC_DateStruct)
+{
+ /* Monday, January 01 xx00 */
+ ERTC_DateStruct->ERTC_WeekDay = ERTC_Week_MON;
+ ERTC_DateStruct->ERTC_Date = 1;
+ ERTC_DateStruct->ERTC_Month = ERTC_Month_JAN;
+ ERTC_DateStruct->ERTC_Year = 0;
+}
+
+/**
+ * @brief Get the ERTC current date.
+ * @param ERTC_Format: specifies the format of the returned parameters.
+ * This parameter can be one of the following values:
+ * @arg ERTC_Format_BIN: Binary data format
+ * @arg ERTC_Format_BCD: BCD data format
+ * @param ERTC_DateStruct: pointer to a ERTC_DateType structure that will
+ * contain the returned current date configuration.
+ * @retval None
+ */
+void ERTC_GetDateValue(uint32_t ERTC_Format, ERTC_DateType* ERTC_DateStruct)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_FORMAT(ERTC_Format));
+
+ /* Get the RTC_TR register */
+ tmpreg = (uint32_t)(ERTC->DATE & ERTC_DATE_RESERVED_MASK);
+
+ /* Fill the structure fields with the read parameters */
+ ERTC_DateStruct->ERTC_Year = (uint8_t)((tmpreg & (ERTC_DATE_YT | ERTC_DATE_YU)) >> 16);
+ ERTC_DateStruct->ERTC_Month = (uint8_t)((tmpreg & (ERTC_DATE_MT | ERTC_DATE_MU)) >> 8);
+ ERTC_DateStruct->ERTC_Date = (uint8_t)(tmpreg & (ERTC_DATE_DT | ERTC_DATE_DU));
+ ERTC_DateStruct->ERTC_WeekDay = (uint8_t)((tmpreg & (ERTC_DATE_WK)) >> 13);
+
+ /* Check the input parameters format */
+ if (ERTC_Format == ERTC_Format_BIN)
+ {
+ /* Convert the structure parameters to Binary format */
+ ERTC_DateStruct->ERTC_Year = (uint8_t)ERTC_Bcd2ToByte(ERTC_DateStruct->ERTC_Year);
+ ERTC_DateStruct->ERTC_Month = (uint8_t)ERTC_Bcd2ToByte(ERTC_DateStruct->ERTC_Month);
+ ERTC_DateStruct->ERTC_Date = (uint8_t)ERTC_Bcd2ToByte(ERTC_DateStruct->ERTC_Date);
+ }
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group3 Alarms configuration functions
+ * @brief Alarms (Alarm A and Alarm B) configuration functions
+ *
+@verbatim
+ ===============================================================================
+ ##### Alarms A and B configuration functions #####
+ ===============================================================================
+
+ [..] This section provide functions allowing to program and read the ERTC Alarms.
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Set the specified ERTC Alarm.
+ * @note The Alarm register can only be written when the corresponding Alarm
+ * is disabled (Use the ERTC_AlarmCmd(DISABLE)).
+ * @param ERTC_Format: specifies the format of the returned parameters.
+ * This parameter can be one of the following values:
+ * @arg ERTC_Format_BIN: Binary data format
+ * @arg ERTC_Format_BCD: BCD data format
+ * @param ERTC_Alarm: specifies the alarm to be configured.
+ * This parameter can be one of the following values:
+ * @arg ERTC_AlA: to select Alarm A
+ * @arg ERTC_AlB: to select Alarm B
+ * @param ERTC_AlarmStruct: pointer to a ERTC_AlarmType structure that
+ * contains the alarm configuration parameters.
+ * @retval None
+ */
+void ERTC_SetAlarmValue(uint32_t ERTC_Format, uint32_t ERTC_Alarm, ERTC_AlarmType* ERTC_AlarmStruct)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_FORMAT(ERTC_Format));
+ assert_param(IS_ERTC_ALARM(ERTC_Alarm));
+ assert_param(IS_ALARM_MASK(ERTC_AlarmStruct->ERTC_AlarmMask));
+ assert_param(IS_ERTC_ALARM_DATE_WEEK_SEL(ERTC_AlarmStruct->ERTC_AlarmDateWeekSel));
+
+ if (ERTC_Format == ERTC_Format_BIN)
+ {
+ if ((ERTC->CTRL & ERTC_CTRL_HFM) != (uint32_t)RESET)
+ {
+ assert_param(IS_ERTC_HOUR12(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Hours));
+ assert_param(IS_ERTC_H12(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_AMPM));
+ }
+ else
+ {
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_AMPM = 0x00;
+ assert_param(IS_ERTC_HOUR24(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Hours));
+ }
+ assert_param(IS_ERTC_MINUTES(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Minutes));
+ assert_param(IS_ERTC_SECONDS(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Seconds));
+
+ if(ERTC_AlarmStruct->ERTC_AlarmDateWeekSel == ERTC_AlarmDateWeekSel_Date)
+ {
+ assert_param(IS_ERTC_ALARM_DATE_WEEK_DATE(ERTC_AlarmStruct->ERTC_AlarmDateWeek));
+ }
+ else
+ {
+ assert_param(IS_ERTC_ALARM_DATE_WEEK_WEEK(ERTC_AlarmStruct->ERTC_AlarmDateWeek));
+ }
+ }
+ else
+ {
+ if ((ERTC->CTRL & ERTC_CTRL_HFM) != (uint32_t)RESET)
+ {
+ tmpreg = ERTC_Bcd2ToByte(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Hours);
+ assert_param(IS_ERTC_HOUR12(tmpreg));
+ assert_param(IS_ERTC_H12(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_AMPM));
+ }
+ else
+ {
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_AMPM = 0x00;
+ assert_param(IS_ERTC_HOUR24(ERTC_Bcd2ToByte(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Hours)));
+ }
+
+ assert_param(IS_ERTC_MINUTES(ERTC_Bcd2ToByte(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Minutes)));
+ assert_param(IS_ERTC_SECONDS(ERTC_Bcd2ToByte(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Seconds)));
+
+ if(ERTC_AlarmStruct->ERTC_AlarmDateWeekSel == ERTC_AlarmDateWeekSel_Date)
+ {
+ tmpreg = ERTC_Bcd2ToByte(ERTC_AlarmStruct->ERTC_AlarmDateWeek);
+ assert_param(IS_ERTC_ALARM_DATE_WEEK_DATE(tmpreg));
+ }
+ else
+ {
+ tmpreg = ERTC_Bcd2ToByte(ERTC_AlarmStruct->ERTC_AlarmDateWeek);
+ assert_param(IS_ERTC_ALARM_DATE_WEEK_WEEK(tmpreg));
+ }
+ }
+
+ /* Check the input parameters format */
+ if (ERTC_Format != ERTC_Format_BIN)
+ {
+ tmpreg = (((uint32_t)(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Hours) << 16) | \
+ ((uint32_t)(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Minutes) << 8) | \
+ ((uint32_t)ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Seconds) | \
+ ((uint32_t)(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_AMPM) << 16) | \
+ ((uint32_t)(ERTC_AlarmStruct->ERTC_AlarmDateWeek) << 24) | \
+ ((uint32_t)ERTC_AlarmStruct->ERTC_AlarmDateWeekSel) | \
+ ((uint32_t)ERTC_AlarmStruct->ERTC_AlarmMask));
+ }
+ else
+ {
+ tmpreg = (((uint32_t)ERTC_ByteToBcd2(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Hours) << 16) | \
+ ((uint32_t)ERTC_ByteToBcd2(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Minutes) << 8) | \
+ ((uint32_t)ERTC_ByteToBcd2(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Seconds)) | \
+ ((uint32_t)(ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_AMPM) << 16) | \
+ ((uint32_t)ERTC_ByteToBcd2(ERTC_AlarmStruct->ERTC_AlarmDateWeek) << 24) | \
+ ((uint32_t)ERTC_AlarmStruct->ERTC_AlarmDateWeekSel) | \
+ ((uint32_t)ERTC_AlarmStruct->ERTC_AlarmMask));
+ }
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Configure the Alarm register */
+ if (ERTC_Alarm == ERTC_AlA)
+ {
+ ERTC->ALA = (uint32_t)tmpreg;
+ }
+ else
+ {
+ ERTC->ALB = (uint32_t)tmpreg;
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+}
+
+/**
+ * @brief Fills each ERTC_AlarmStruct member with its default value
+ * (Time = 00h:00mn:00sec / Date = 1st day of the month/Mask =
+ * all fields are masked).
+ * @param ERTC_AlarmStruct: pointer to a @ref ERTC_AlarmType structure which
+ * will be initialized.
+ * @retval None
+ */
+void ERTC_AlarmStructInit(ERTC_AlarmType* ERTC_AlarmStruct)
+{
+ /* Alarm Time Settings : Time = 00h:00mn:00sec */
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_AMPM = ERTC_H12_AM;
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Hours = 0;
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Minutes = 0;
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Seconds = 0;
+
+ /* Alarm Date Settings : Date = 1st day of the month */
+ ERTC_AlarmStruct->ERTC_AlarmDateWeekSel = ERTC_AlarmDateWeekSel_Date;
+ ERTC_AlarmStruct->ERTC_AlarmDateWeek = 1;
+
+ /* Alarm Masks Settings : Mask = all fields are not masked */
+ ERTC_AlarmStruct->ERTC_AlarmMask = ERTC_AlarmMask_None;
+}
+
+/**
+ * @brief Get the ERTC Alarm value and masks.
+ * @param ERTC_Format: specifies the format of the output parameters.
+ * This parameter can be one of the following values:
+ * @arg ERTC_Format_BIN: Binary data format
+ * @arg ERTC_Format_BCD: BCD data format
+ * @param ERTC_Alarm: specifies the alarm to be read.
+ * This parameter can be one of the following values:
+ * @arg ERTC_AlA: to select Alarm A
+ * @arg ERTC_AlB: to select Alarm B
+ * @param ERTC_AlarmStruct: pointer to a ERTC_AlarmType structure that will
+ * contains the output alarm configuration values.
+ * @retval None
+ */
+void ERTC_GetAlarmValue(uint32_t ERTC_Format, uint32_t ERTC_Alarm, ERTC_AlarmType* ERTC_AlarmStruct)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_FORMAT(ERTC_Format));
+ assert_param(IS_ERTC_ALARM(ERTC_Alarm));
+
+ /* Get the RTC_ALRMxR register */
+ if (ERTC_Alarm == ERTC_AlA)
+ {
+ tmpreg = (uint32_t)(ERTC->ALA);
+ }
+ else
+ {
+ tmpreg = (uint32_t)(ERTC->ALB);
+ }
+
+ /* Fill the structure with the read parameters */
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Hours = (uint32_t)((tmpreg & (ERTC_ALA_HT | \
+ ERTC_ALA_HU)) >> 16);
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Minutes = (uint32_t)((tmpreg & (ERTC_ALA_MT | \
+ ERTC_ALA_MU)) >> 8);
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Seconds = (uint32_t)(tmpreg & (ERTC_ALA_ST | \
+ ERTC_ALA_SU));
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_AMPM = (uint32_t)((tmpreg & ERTC_ALA_AMPM) >> 16);
+ ERTC_AlarmStruct->ERTC_AlarmDateWeek = (uint32_t)((tmpreg & (ERTC_ALA_DT | ERTC_ALA_DU)) >> 24);
+ ERTC_AlarmStruct->ERTC_AlarmDateWeekSel = (uint32_t)(tmpreg & ERTC_ALA_WKSEL);
+ ERTC_AlarmStruct->ERTC_AlarmMask = (uint32_t)(tmpreg & ERTC_AlarmMask_All);
+
+ if (ERTC_Format == ERTC_Format_BIN)
+ {
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Hours = ERTC_Bcd2ToByte(ERTC_AlarmStruct-> \
+ ERTC_AlarmTime.ERTC_Hours);
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Minutes = ERTC_Bcd2ToByte(ERTC_AlarmStruct-> \
+ ERTC_AlarmTime.ERTC_Minutes);
+ ERTC_AlarmStruct->ERTC_AlarmTime.ERTC_Seconds = ERTC_Bcd2ToByte(ERTC_AlarmStruct-> \
+ ERTC_AlarmTime.ERTC_Seconds);
+ ERTC_AlarmStruct->ERTC_AlarmDateWeek = ERTC_Bcd2ToByte(ERTC_AlarmStruct->ERTC_AlarmDateWeek);
+ }
+}
+
+/**
+ * @brief Enables or disables the specified ERTC Alarm.
+ * @param ERTC_Alarm: specifies the alarm to be configured.
+ * This parameter can be any combination of the following values:
+ * @arg ERTC_AlA: to select Alarm A
+ * @arg ERTC_AlB: to select Alarm B
+ * @param NewState: new state of the specified alarm.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC Alarm is enabled/disabled
+ * - ERROR: ERTC Alarm is not enabled/disabled
+ */
+ErrorStatus ERTC_AlarmCmd(uint32_t ERTC_Alarm, FunctionalState NewState)
+{
+ __IO uint32_t alarmcounter = 0x00;
+ uint32_t alarmstatus = 0x00;
+ ErrorStatus status = ERROR;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_CMD_ALARM(ERTC_Alarm));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Configure the Alarm state */
+ if (NewState != DISABLE)
+ {
+ ERTC->CTRL |= (uint32_t)ERTC_Alarm;
+
+ status = SUCCESS;
+ }
+ else
+ {
+ /* Disable the Alarm in RTC_CR register */
+ ERTC->CTRL &= (uint32_t)~ERTC_Alarm;
+
+ /* Wait till ERTC ALRxWF flag is set and if Time out is reached exit */
+ do
+ {
+ alarmstatus = ERTC->ISTS & (ERTC_Alarm >> 8);
+ alarmcounter++;
+ } while((alarmcounter != INITMODE_TMROUT) && (alarmstatus == 0x00));
+
+ if ((ERTC->ISTS & (ERTC_Alarm >> 8)) == RESET)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ status = SUCCESS;
+ }
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return status;
+}
+
+/**
+ * @brief Configure the ERTC AlarmA/B Sub seconds value and mask.*
+ * @note This function is performed only when the Alarm is disabled.
+ * @param ERTC_Alarm: specifies the alarm to be configured.
+ * This parameter can be one of the following values:
+ * @arg ERTC_AlA: to select Alarm A
+ * @arg ERTC_AlB: to select Alarm B
+ * @param ERTC_AlarmSubSecondValue: specifies the Sub seconds value.
+ * This parameter can be a value from 0 to 0x00007FFF.
+ * @param ERTC_AlarmSubSecondMask: specifies the Sub seconds Mask.
+ * This parameter can be any combination of the following values:
+ * @arg ERTC_AlarmSubSecondMask_All : All Alarm SS fields are masked.
+ * There is no comparison on sub seconds for Alarm.
+ * @arg ERTC_AlarmSubSecondMask_SBS14_1 : SS[14:1] are don't care in Alarm comparison.
+ * Only SS[0] is compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_2 : SS[14:2] are don't care in Alarm comparison.
+ * Only SS[1:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_3 : SS[14:3] are don't care in Alarm comparison.
+ * Only SS[2:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_4 : SS[14:4] are don't care in Alarm comparison.
+ * Only SS[3:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_5 : SS[14:5] are don't care in Alarm comparison.
+ * Only SS[4:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_6 : SS[14:6] are don't care in Alarm comparison.
+ * Only SS[5:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_7 : SS[14:7] are don't care in Alarm comparison.
+ * Only SS[6:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_8 : SS[14:8] are don't care in Alarm comparison.
+ * Only SS[7:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_9 : SS[14:9] are don't care in Alarm comparison.
+ * Only SS[8:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_10: SS[14:10] are don't care in Alarm comparison.
+ * Only SS[9:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_11: SS[14:11] are don't care in Alarm comparison.
+ * Only SS[10:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_12: SS[14:12] are don't care in Alarm comparison.
+ * Only SS[11:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14_13: SS[14:13] are don't care in Alarm comparison.
+ * Only SS[12:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_SBS14 : SS[14] is don't care in Alarm comparison.
+ * Only SS[13:0] are compared
+ * @arg ERTC_AlarmSubSecondMask_None : SS[14:0] are compared and must match
+ * to activate alarm
+ * @retval None
+ */
+void ERTC_AlarmSubSecondConfig(uint32_t ERTC_Alarm, uint32_t ERTC_AlarmSubSecondValue, uint32_t ERTC_AlarmSubSecondMask)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_ALARM(ERTC_Alarm));
+ assert_param(IS_ERTC_ALARM_SUB_SECOND_VALUE(ERTC_AlarmSubSecondValue));
+ assert_param(IS_ERTC_ALARM_SUB_SECOND_MASK(ERTC_AlarmSubSecondMask));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Configure the Alarm A or Alarm B Sub Second registers */
+ tmpreg = (uint32_t) (uint32_t)(ERTC_AlarmSubSecondValue) | (uint32_t)(ERTC_AlarmSubSecondMask);
+
+ if (ERTC_Alarm == ERTC_AlA)
+ {
+ /* Configure the Alarm A Sub Second register */
+ ERTC->ALASBS = tmpreg;
+ }
+ else
+ {
+ /* Configure the Alarm B Sub Second register */
+ ERTC->ALBSBS = tmpreg;
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+}
+
+/**
+ * @brief Gets the ERTC Alarm Sub seconds value.
+ * @param ERTC_Alarm: specifies the alarm to be read.
+ * This parameter can be one of the following values:
+ * @arg ERTC_AlA: to select Alarm A
+ * @arg ERTC_AlB: to select Alarm B
+ * @param None
+ * @retval ERTC Alarm Sub seconds value.
+ */
+uint32_t ERTC_GetAlarmSubSecond(uint32_t ERTC_Alarm)
+{
+ uint32_t tmpreg = 0;
+
+ /* Get the RTC_ALRMxR register */
+ if (ERTC_Alarm == ERTC_AlA)
+ {
+ tmpreg = (uint32_t)((ERTC->ALASBS) & ERTC_ALASBS_SBS);
+ }
+ else
+ {
+ tmpreg = (uint32_t)((ERTC->ALBSBS) & ERTC_ALBSBS_SBS);
+ }
+
+ return (tmpreg);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group4 WakeUp Timer configuration functions
+ * @brief WakeUp Timer configuration functions
+ *
+@verbatim
+ ===============================================================================
+ ##### WakeUp Timer configuration functions #####
+ ===============================================================================
+
+ [..] This section provide functions allowing to program and read the ERTC WakeUp.
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Configures the ERTC Wakeup clock source.
+ * @note The WakeUp Clock source can only be changed when the ERTC WakeUp
+ * is disabled (Use the ERTC_WakeUpCmd(DISABLE)).
+ * @param ERTC_WakeUpClock: Wakeup Clock source.
+ * This parameter can be one of the following values:
+ * @arg ERTC_WakeUpClockSelect_RTCCLK_Div16: ERTC Wakeup Counter Clock = RTCCLK/16
+ * @arg ERTC_WakeUpClockSelect_RTCCLK_Div8: ERTC Wakeup Counter Clock = RTCCLK/8
+ * @arg ERTC_WakeUpClockSelect_RTCCLK_Div4: ERTC Wakeup Counter Clock = RTCCLK/4
+ * @arg ERTC_WakeUpClockSelect_RTCCLK_Div2: ERTC Wakeup Counter Clock = RTCCLK/2
+ * @arg ERTC_WakeUpClockSelect_CK_SPRE_16bits: ERTC Wakeup Counter Clock = CK_SPRE
+ * @arg ERTC_WakeUpClockSelect_CK_SPRE_17bits: ERTC Wakeup Counter Clock = CK_SPRE
+ * @retval None
+ */
+void ERTC_WakeUpClockConfig(uint32_t ERTC_WakeUpClock)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_WAKEUP_CLOCK_SELECT(ERTC_WakeUpClock));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Clear the Wakeup Timer clock source bits in CTRL register */
+ ERTC->CTRL &= (uint32_t)~ERTC_CTRL_WACKSEL;
+
+ /* Configure the clock source */
+ ERTC->CTRL |= (uint32_t)ERTC_WakeUpClock;
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+}
+
+/**
+ * @brief Configures the ERTC Wakeup counter.
+ * @note The ERTC WakeUp counter can only be written when the ERTC WakeUp
+ * is disabled (Use the ERTC_WakeUpCmd(DISABLE)).
+ * @param ERTC_WakeUpCounter: specifies the WakeUp counter.
+ * This parameter can be a value from 0x0000 to 0xFFFF.
+ * @retval None
+ */
+void ERTC_SetWakeUpCounter(uint32_t ERTC_WakeUpCounter)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_WAKEUP_COUNTER(ERTC_WakeUpCounter));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Configure the Wakeup Timer counter */
+ ERTC->WATR = (uint32_t)ERTC_WakeUpCounter;
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+}
+
+/**
+ * @brief Returns the ERTC WakeUp timer counter value.
+ * @param None
+ * @retval The ERTC WakeUp Counter value.
+ */
+uint32_t ERTC_GetWakeUpCounter(void)
+{
+ /* Get the counter value */
+ return ((uint32_t)(ERTC->WATR & ERTC_WATR_WAREV));
+}
+
+/**
+ * @brief Enables or Disables the ERTC WakeUp timer.
+ * @param NewState: new state of the WakeUp timer.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+ErrorStatus ERTC_WakeUpCmd(FunctionalState NewState)
+{
+ __IO uint32_t wutcounter = 0x00;
+ uint32_t wutwfstatus = 0x00;
+ ErrorStatus status = ERROR;
+
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the Wakeup Timer */
+ ERTC->CTRL |= (uint32_t)ERTC_CTRL_WATE;
+ status = SUCCESS;
+ }
+ else
+ {
+ /* Disable the Wakeup Timer */
+ ERTC->CTRL &= (uint32_t)~ERTC_CTRL_WATE;
+ /* Wait till ERTC WUTWF flag is set and if Time out is reached exit */
+ do
+ {
+ wutwfstatus = ERTC->ISTS & ERTC_ISTS_WATWF;
+ wutcounter++;
+ } while((wutcounter != INITMODE_TMROUT) && (wutwfstatus == 0x00));
+
+ if ((ERTC->ISTS & ERTC_ISTS_WATWF) == RESET)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ status = SUCCESS;
+ }
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return status;
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group5 Daylight Saving configuration functions
+ * @brief Daylight Saving configuration functions
+ *
+@verbatim
+ ===============================================================================
+ ##### Daylight Saving configuration functions #####
+ ===============================================================================
+
+ [..] This section provide functions allowing to configure the ERTC DayLight Saving.
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Adds or substract one hour from the current time.
+ * @param RTC_DayLightSaveOperation: the value of hour adjustment.
+ * This parameter can be one of the following values:
+ * @arg ERTC_DayLightSaving_SUB1H: Substract one hour (winter time)
+ * @arg ERTC_DayLightSaving_ADD1H: Add one hour (summer time)
+ * @param ERTC_StoreOperation: Specifies the value to be written in the BCK bit
+ * in CTRL register to store the operation.
+ * This parameter can be one of the following values:
+ * @arg ERTC_StoreOperation_Reset: BCK Bit Reset
+ * @arg ERTC_StoreOperation_Set: BCK Bit Set
+ * @retval None
+ */
+void ERTC_DayLightSavingConfig(uint32_t ERTC_DayLightSaving, uint32_t ERTC_StoreOperation)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_DAYLIGHT_SAVING(ERTC_DayLightSaving));
+ assert_param(IS_ERTC_STORE_OPERATION(ERTC_StoreOperation));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Clear the bits to be configured */
+ ERTC->CTRL &= (uint32_t)~(ERTC_CTRL_BKP);
+
+ /* Configure the RTC_CR register */
+ ERTC->CTRL |= (uint32_t)(ERTC_DayLightSaving | ERTC_StoreOperation);
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+}
+
+/**
+ * @brief Returns the ERTC Day Light Saving stored operation.
+ * @param None
+ * @retval ERTC Day Light Saving stored operation.
+ * - ERTC_StoreOperation_Reset
+ * - ERTC_StoreOperation_Set
+ */
+uint32_t ERTC_GetStoreOperation(void)
+{
+ return (ERTC->CTRL & ERTC_CTRL_BKP);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group6 Output pin Configuration function
+ * @brief Output pin Configuration function
+ *
+@verbatim
+ ===============================================================================
+ ##### Output pin Configuration function #####
+ ===============================================================================
+
+ [..] This section provide functions allowing to configure the ERTC Output source.
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Configures the ERTC output source (AFO_ALARM).
+ * @param ERTC_Output: Specifies which signal will be routed to the ERTC output.
+ * This parameter can be one of the following values:
+ * @arg ERTC_Output_Disable: No output selected
+ * @arg ERTC_Output_AlarmA: signal of AlarmA mapped to output
+ * @arg ERTC_Output_AlarmB: signal of AlarmB mapped to output
+ * @arg ERTC_Output_WakeUp: signal of WakeUp mapped to output
+ * @param ERTC_OutputPolarity: Specifies the polarity of the output signal.
+ * This parameter can be one of the following:
+ * @arg ERTC_OutputPolarity_High: The output pin is high when the
+ * ALRAF/ALRBF/WUTF is high (depending on OSEL)
+ * @arg ERTC_OutputPolarity_Low: The output pin is low when the
+ * ALRAF/ALRBF/WUTF is high (depending on OSEL)
+ * @retval None
+ */
+void ERTC_OutputConfig(uint32_t ERTC_Output, uint32_t ERTC_OutputPolarity)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_OUTPUT(ERTC_Output));
+ assert_param(IS_ERTC_OUTPUT_OPOL(ERTC_OutputPolarity));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Clear the bits to be configured */
+ ERTC->CTRL &= (uint32_t)~(ERTC_CTRL_OSEL | ERTC_CTRL_OPOL);
+
+ /* Configure the output selection and polarity */
+ ERTC->CTRL |= (uint32_t)(ERTC_Output | ERTC_OutputPolarity);
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group7 Digital Calibration configuration functions
+ * @brief Coarse Calibration configuration functions
+ *
+@verbatim
+ ===============================================================================
+ ##### Digital Calibration configuration functions #####
+ ===============================================================================
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Configures the Coarse calibration parameters.
+ * @param ERTC_CalSign: specifies the sign of the coarse calibration value.
+ * This parameter can be one of the following values:
+ * @arg ERTC_DataCalSign_Positive: The value sign is positive
+ * @arg ERTC_DataCalSign_Negative: The value sign is negative
+ * @param Value: value of coarse calibration expressed in ppm (coded on 5 bits).
+ *
+ * @note This Calibration value should be between 0 and 63 when using negative
+ * sign with a 2-ppm step.
+ *
+ * @note This Calibration value should be between 0 and 126 when using positive
+ * sign with a 4-ppm step.
+ *
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC Coarse calibration are initialized
+ * - ERROR: ERTC Coarse calibration are not initialized
+ */
+ErrorStatus ERTC_CoarseCalConfig(uint32_t ERTC_CalSign, uint32_t Value)
+{
+ ErrorStatus status = ERROR;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_DATACAL_SIGN(ERTC_CalSign));
+ assert_param(IS_ERTC_DATACAL_VALUE(Value));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Set Initialization mode */
+ if (ERTC_EnterInitMode() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ /* Set the coarse calibration value */
+ ERTC->CAL = (uint32_t)(ERTC_CalSign | Value);
+ /* Exit Initialization mode */
+ ERTC_ExitInitMode();
+
+ status = SUCCESS;
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return status;
+}
+
+/**
+ * @brief Enables or disables the Coarse calibration process.
+ * @param NewState: new state of the Coarse calibration.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC Coarse calibration are enabled/disabled
+ * - ERROR: ERTC Coarse calibration are not enabled/disabled
+ */
+ErrorStatus ERTC_CoarseCalCmd(FunctionalState NewState)
+{
+ ErrorStatus status = ERROR;
+
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Set Initialization mode */
+ if (ERTC_EnterInitMode() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ if (NewState != DISABLE)
+ {
+ /* Enable the Coarse Calibration */
+ ERTC->CTRL |= (uint32_t)ERTC_CTRL_CDCE;
+ }
+ else
+ {
+ /* Disable the Coarse Calibration */
+ ERTC->CTRL &= (uint32_t)~ERTC_CTRL_CDCE;
+ }
+ /* Exit Initialization mode */
+ ERTC_ExitInitMode();
+
+ status = SUCCESS;
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return status;
+}
+
+/**
+ * @brief Enables or disables the ERTC clock to be output through the relative pin.
+ * @param NewState: new state of the digital calibration Output.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ERTC_CalOutputCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the ERTC clock output */
+ ERTC->CTRL |= (uint32_t)ERTC_CTRL_CALOE;
+ }
+ else
+ {
+ /* Disable the ERTC clock output */
+ ERTC->CTRL &= (uint32_t)~ERTC_CTRL_CALOE;
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+}
+
+/**
+ * @brief Configure the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
+ * @param ERTC_CalOutput : Select the Calibration output Selection .
+ * This parameter can be one of the following values:
+ * @arg ERTC_CalOutput_512Hz: A signal has a regular waveform at 512Hz.
+ * @arg ERTC_CalOutput_1Hz : A signal has a regular waveform at 1Hz.
+ * @retval None
+*/
+void ERTC_CalOutputConfig(uint32_t ERTC_CalOutput)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_CAL_OUTPUT(ERTC_CalOutput));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /*clear flags before configuration */
+ ERTC->CTRL &= (uint32_t)~(ERTC_CTRL_CALSEL);
+
+ /* Configure the RTC_CR register */
+ ERTC->CTRL |= (uint32_t)ERTC_CalOutput;
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+}
+
+/**
+ * @brief Configures the Smooth Calibration Settings.
+ * @param ERTC_SmoothCalPeriod : Select the Smooth Calibration Period.
+ * This parameter can be can be one of the following values:
+ * @arg ERTC_SmoothCalPeriod_32sec : The smooth calibration period is 32s.
+ * @arg ERTC_SmoothCalPeriod_16sec : The smooth calibration period is 16s.
+ * @arg ERTC_SmoothCalPeriod_8sec : The smooth calibration period is 8s.
+ * @param ERTC_SmoothCalPlusPulses : Select to Set or reset the CALP bit.
+ * This parameter can be one of the following values:
+ * @arg ERTC_SmoothCalAddPulses_Set : Add one RTCCLK pulse every 2**11 pulses.
+ * @arg ERTC_SmoothCalAddPulses_Reset: No RTCCLK pulses are added.
+ * @param ERTC_SmouthCalMinusPulsesValue: Select the value of CALM[8:0] bits.
+ * This parameter can be one any value from 0 to 0x000001FF.
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC Calib registers are configured
+ * - ERROR: ERTC Calib registers are not configured
+*/
+ErrorStatus ERTC_SmoothCalConfig(uint32_t ERTC_SmoothCalPeriod,
+ uint32_t ERTC_SmoothCalPlusPulses,
+ uint32_t ERTC_SmouthCalMinusPulsesValue)
+{
+ ErrorStatus status = ERROR;
+ uint32_t recalpfcount = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_SMOOTH_CAL_PERIOD(ERTC_SmoothCalPeriod));
+ assert_param(IS_ERTC_SMOOTH_CAL_ADD(ERTC_SmoothCalPlusPulses));
+ assert_param(IS_ERTC_SMOOTH_CAL_VALUE(ERTC_SmouthCalMinusPulsesValue));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* check if a calibration is pending*/
+ if ((ERTC->ISTS & ERTC_ISTS_RECALPDF) != RESET)
+ {
+ /* wait until the Calibration is completed*/
+ while (((ERTC->ISTS & ERTC_ISTS_RECALPDF) != RESET) && (recalpfcount != RECALPDF_TMROUT))
+ {
+ recalpfcount++;
+ }
+ }
+
+ /* check if the calibration pending is completed or if there is no calibration operation at all*/
+ if ((ERTC->ISTS & ERTC_ISTS_RECALPDF) == RESET)
+ {
+ /* Configure the Smooth calibration settings */
+ ERTC->CCR = (uint32_t)((uint32_t)ERTC_SmoothCalPeriod | (uint32_t)ERTC_SmoothCalPlusPulses | (uint32_t)ERTC_SmouthCalMinusPulsesValue);
+
+ status = SUCCESS;
+ }
+ else
+ {
+ status = ERROR;
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return (ErrorStatus)(status);
+}
+
+/**
+ * @}
+ */
+
+
+/** @defgroup RTC_Group8 TimeStamp configuration functions
+ * @brief TimeStamp configuration functions
+ *
+@verbatim
+ ===============================================================================
+ ##### TimeStamp configuration functions #####
+ ===============================================================================
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Enables or Disables the ERTC TimeStamp functionality with the
+ * specified time stamp pin stimulating edge.
+ * @param ERTC_TimeStampEdge: Specifies the pin edge on which the TimeStamp is
+ * activated.
+ * This parameter can be one of the following:
+ * @arg ERTC_TimeStampEdge_Rising: the Time stamp event occurs on the rising
+ * edge of the related pin.
+ * @arg ERTC_TimeStampEdge_Falling: the Time stamp event occurs on the
+ * falling edge of the related pin.
+ * @param NewState: new state of the TimeStamp.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ERTC_TimeStampCmd(uint32_t ERTC_TimeStampEdge, FunctionalState NewState)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_TIMESTAMP_EDGE(ERTC_TimeStampEdge));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ /* Get the RTC_CR register and clear the bits to be configured */
+ tmpreg = (uint32_t)(ERTC->CTRL & (uint32_t)~(ERTC_CTRL_TSEDGE | ERTC_CTRL_TSE));
+
+ /* Get the new configuration */
+ if (NewState != DISABLE)
+ {
+ tmpreg |= (uint32_t)(ERTC_TimeStampEdge | ERTC_CTRL_TSE);
+ }
+ else
+ {
+ tmpreg |= (uint32_t)(ERTC_TimeStampEdge);
+ }
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Configure the Time Stamp TSEDGE and Enable bits */
+ ERTC->CTRL = (uint32_t)tmpreg;
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+}
+
+/**
+ * @brief Get the ERTC TimeStamp value and masks.
+ * @param ERTC_Format: specifies the format of the output parameters.
+ * This parameter can be one of the following values:
+ * @arg ERTC_Format_BIN: Binary data format
+ * @arg ERTC_Format_BCD: BCD data format
+ * @param ERTC_StampTimeStruct: pointer to a ERTC_TimeType structure that will
+ * contains the TimeStamp time values.
+ * @param ERTC_StampDateStruct: pointer to a ERTC_DateType structure that will
+ * contains the TimeStamp date values.
+ * @retval None
+ */
+void ERTC_GetTimeStamp(uint32_t ERTC_Format, ERTC_TimeType* ERTC_StampTimeStruct,
+ ERTC_DateType* ERTC_StampDateStruct)
+{
+ uint32_t tmptime = 0, tmpdate = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_FORMAT(ERTC_Format));
+
+ /* Get the TimeStamp time and date registers values */
+ tmptime = (uint32_t)(ERTC->TSTM & ERTC_TIME_RESERVED_MASK);
+ tmpdate = (uint32_t)(ERTC->TSDT & ERTC_DATE_RESERVED_MASK);
+
+ /* Fill the Time structure fields with the read parameters */
+ ERTC_StampTimeStruct->ERTC_Hours = (uint8_t)((tmptime & (ERTC_TIME_HT | ERTC_TIME_HU)) >> 16);
+ ERTC_StampTimeStruct->ERTC_Minutes = (uint8_t)((tmptime & (ERTC_TIME_MT | ERTC_TIME_MU)) >> 8);
+ ERTC_StampTimeStruct->ERTC_Seconds = (uint8_t)(tmptime & (ERTC_TIME_ST | ERTC_TIME_SU));
+ ERTC_StampTimeStruct->ERTC_AMPM = (uint8_t)((tmptime & (ERTC_TIME_AMPM)) >> 16);
+
+ /* Fill the Date structure fields with the read parameters */
+ ERTC_StampDateStruct->ERTC_Year = 0;
+ ERTC_StampDateStruct->ERTC_Month = (uint8_t)((tmpdate & (ERTC_DATE_MT | ERTC_DATE_MU)) >> 8);
+ ERTC_StampDateStruct->ERTC_Date = (uint8_t)(tmpdate & (ERTC_DATE_DT | ERTC_DATE_DU));
+ ERTC_StampDateStruct->ERTC_WeekDay = (uint8_t)((tmpdate & (ERTC_DATE_WK)) >> 13);
+
+ /* Check the input parameters format */
+ if (ERTC_Format == ERTC_Format_BIN)
+ {
+ /* Convert the Time structure parameters to Binary format */
+ ERTC_StampTimeStruct->ERTC_Hours = (uint8_t)ERTC_Bcd2ToByte(ERTC_StampTimeStruct->ERTC_Hours);
+ ERTC_StampTimeStruct->ERTC_Minutes = (uint8_t)ERTC_Bcd2ToByte(ERTC_StampTimeStruct->ERTC_Minutes);
+ ERTC_StampTimeStruct->ERTC_Seconds = (uint8_t)ERTC_Bcd2ToByte(ERTC_StampTimeStruct->ERTC_Seconds);
+
+ /* Convert the Date structure parameters to Binary format */
+ ERTC_StampDateStruct->ERTC_Month = (uint8_t)ERTC_Bcd2ToByte(ERTC_StampDateStruct->ERTC_Month);
+ ERTC_StampDateStruct->ERTC_Date = (uint8_t)ERTC_Bcd2ToByte(ERTC_StampDateStruct->ERTC_Date);
+ ERTC_StampDateStruct->ERTC_WeekDay = (uint8_t)ERTC_Bcd2ToByte(ERTC_StampDateStruct->ERTC_WeekDay);
+ }
+}
+
+/**
+ * @brief Get the ERTC timestamp Sub seconds value.
+ * @param None
+ * @retval ERTC current timestamp Sub seconds value.
+ */
+uint32_t ERTC_GetTimeStampSubSecond(void)
+{
+ /* Get timestamp sub seconds values from the correspondent registers */
+ return (uint32_t)(ERTC->TSSBS);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group9 Tampers configuration functions
+ * @brief Tampers configuration functions
+ *
+@verbatim
+ ===============================================================================
+ ##### Tampers configuration functions #####
+ ===============================================================================
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Configures the select Tamper pin edge.
+ * @param ERTC_Tamper: Selected tamper pin.
+ * This parameter can be ERTC_TAMP_1 or ERTC_Tamper 2
+ * @param ERTC_TamperTrigger: Specifies the trigger on the tamper pin that
+ * stimulates tamper event.
+ * This parameter can be one of the following values:
+ * @arg ERTC_TamperTrig_RisingEdge: Rising Edge of the tamper pin causes tamper event.
+ * @arg ERTC_TamperTrig_FallingEdge: Falling Edge of the tamper pin causes tamper event.
+ * @arg ERTC_TamperTrig_LowLevel: Low Level of the tamper pin causes tamper event.
+ * @arg ERTC_TamperTrig_HighLevel: High Level of the tamper pin causes tamper event.
+ * @retval None
+ */
+void ERTC_TamperTriggerConfig(uint32_t ERTC_Tamper, uint32_t ERTC_TamperTrigger)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_TAMP(ERTC_Tamper));
+ assert_param(IS_ERTC_TAMPER_TRIG(ERTC_TamperTrigger));
+
+ if (ERTC_TamperTrigger == ERTC_TamperTrig_RisingEdge)
+ {
+ /* Configure the RTC_TAFCR register */
+ ERTC->TPAF &= (uint32_t)((uint32_t)~(ERTC_Tamper << 1));
+ }
+ else
+ {
+ /* Configure the RTC_TAFCR register */
+ ERTC->TPAF |= (uint32_t)(ERTC_Tamper << 1);
+ }
+}
+
+/**
+ * @brief Enables or Disables the Tamper detection.
+ * @param ERTC_Tamper: Selected tamper pin.
+ * This parameter can be ERTC_TAMP_1 or ERTC_TAMP_2
+ * @param NewState: new state of the tamper pin.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ERTC_TamperCmd(uint32_t ERTC_Tamper, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_TAMP(ERTC_Tamper));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected Tamper pin */
+ ERTC->TPAF |= (uint32_t)ERTC_Tamper;
+ }
+ else
+ {
+ /* Disable the selected Tamper pin */
+ ERTC->TPAF &= (uint32_t)~ERTC_Tamper;
+ }
+}
+
+/**
+ * @brief Configures the Tampers Filter.
+ * @param ERTC_TamperFilter: Specifies the tampers filter.
+ * This parameter can be one of the following values:
+ * @arg ERTC_TamperFilter_Disable: Tamper filter is disabled.
+ * @arg ERTC_TamperFilter_2Sample: Tamper is activated after 2 consecutive
+ * samples at the active level
+ * @arg ERTC_TamperFilter_4Sample: Tamper is activated after 4 consecutive
+ * samples at the active level
+ * @arg ERTC_TamperFilter_8Sample: Tamper is activated after 8 consecutive
+ * samples at the active level
+ * @retval None
+ */
+void ERTC_TamperFilterConfig(uint32_t ERTC_TamperFilter)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_TAMPER_FILTER(ERTC_TamperFilter));
+
+ /* Clear TAMPFLT[1:0] bits in the RTC_TAFCR register */
+ ERTC->TPAF &= (uint32_t)~(ERTC_TPAF_TMFLT);
+
+ /* Configure the RTC_TAFCR register */
+ ERTC->TPAF |= (uint32_t)ERTC_TamperFilter;
+}
+
+/**
+ * @brief Configures the Tampers Sampling Frequency.
+ * @param ERTC_TamperSamplingFreq: Specifies the tampers Sampling Frequency.
+ * This parameter can be one of the following values:
+ * @arg ERTC_TamperSamplingFreq_CLK_Div32768: Each of the tamper inputs are sampled
+ * with a frequency = RTCCLK / 32768
+ * @arg ERTC_TamperSamplingFreq_CLK_Div16384: Each of the tamper inputs are sampled
+ * with a frequency = RTCCLK / 16384
+ * @arg ERTC_TamperSamplingFreq_CLK_Div8192: Each of the tamper inputs are sampled
+ * with a frequency = RTCCLK / 8192
+ * @arg ERTC_TamperSamplingFreq_CLK_Div4096: Each of the tamper inputs are sampled
+ * with a frequency = RTCCLK / 4096
+ * @arg ERTC_TamperSamplingFreq_CLK_Div2048: Each of the tamper inputs are sampled
+ * with a frequency = RTCCLK / 2048
+ * @arg ERTC_TamperSamplingFreq_CLK_Div1024: Each of the tamper inputs are sampled
+ * with a frequency = RTCCLK / 1024
+ * @arg ERTC_TamperSamplingFreq_CLK_Div512: Each of the tamper inputs are sampled
+ * with a frequency = RTCCLK / 512
+ * @arg ERTC_TamperSamplingFreq_CLK_Div256: Each of the tamper inputs are sampled
+ * with a frequency = RTCCLK / 256
+ * @retval None
+ */
+void ERTC_TamperSamplingFreqConfig(uint32_t ERTC_TamperSamplingFreq)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_TAMPER_SAMPLING_FREQ(ERTC_TamperSamplingFreq));
+
+ /* Clear TAMPFREQ[2:0] bits in the RTC_TAFCR register */
+ ERTC->TPAF &= (uint32_t)~(ERTC_TPAF_TMFREQ);
+
+ /* Configure the RTC_TAFCR register */
+ ERTC->TPAF |= (uint32_t)ERTC_TamperSamplingFreq;
+}
+
+/**
+ * @brief Configures the Tampers Pins input Precharge Duration.
+ * @param ERTC_TamperPrechargeDuration: Specifies the Tampers Pins input
+ * Precharge Duration.
+ * This parameter can be one of the following values:
+ * @arg ERTC_TamperPrechargeDuration_1RTCCLK: Tamper pins are precharged before sampling during 1 RTCCLK cycle
+ * @arg ERTC_TamperPrechargeDuration_2RTCCLK: Tamper pins are precharged before sampling during 2 RTCCLK cycle
+ * @arg ERTC_TamperPrechargeDuration_4RTCCLK: Tamper pins are precharged before sampling during 4 RTCCLK cycle
+ * @arg ERTC_TamperPrechargeDuration_8RTCCLK: Tamper pins are precharged before sampling during 8 RTCCLK cycle
+ * @retval None
+ */
+void ERTC_TamperPinsPrechargeDuration(uint32_t ERTC_TamperPrechargeDuration)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_TAMPER_PRECHARGE_DURATION(ERTC_TamperPrechargeDuration));
+
+ /* Clear TAMPPRCH[1:0] bits in the RTC_TAFCR register */
+ ERTC->TPAF &= (uint32_t)~(ERTC_TPAF_TMPRCH);
+
+ /* Configure the RTC_TAFCR register */
+ ERTC->TPAF |= (uint32_t)ERTC_TamperPrechargeDuration;
+}
+
+/**
+ * @brief Enables or Disables the TimeStamp on Tamper Detection Event.
+ * @note The timestamp is valid even the TSE bit in tamper control register
+ * is reset.
+ * @param NewState: new state of the timestamp on tamper event.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ERTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Save timestamp on tamper detection event */
+ ERTC->TPAF |= (uint32_t)ERTC_TPAF_TMTS;
+ }
+ else
+ {
+ /* Tamper detection does not cause a timestamp to be saved */
+ ERTC->TPAF &= (uint32_t)~ERTC_TPAF_TMTS;
+ }
+}
+
+/**
+ * @brief Enables or Disables the Precharge of Tamper pin.
+ * @param NewState: new state of tamper pull up.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ERTC_TamperPullUpCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable precharge of the selected Tamper pin */
+ ERTC->TPAF &= (uint32_t)~ERTC_TPAF_TMPUDIS;
+ }
+ else
+ {
+ /* Disable precharge of the selected Tamper pin */
+ ERTC->TPAF |= (uint32_t)ERTC_TPAF_TMPUDIS;
+ }
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group10 Backup Data Registers configuration functions
+ * @brief Backup Data Registers configuration functions
+ *
+@verbatim
+ ===============================================================================
+ ##### Backup Data Registers configuration functions #####
+ ===============================================================================
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Writes a data in a specified ERTC Backup data register.
+ * @param ERTC_BKP_DT: ERTC Backup data Register number.
+ * This parameter can be: ERTC_BKP_DTx where x can be from 0 to 19 to
+ * specify the register.
+ * @param Data: Data to be written in the specified ERTC Backup data register.
+ * @retval None
+ */
+void ERTC_WriteBackupRegister(uint32_t ERTC_BKP_DT, uint32_t Data)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_BKP(ERTC_BKP_DT));
+
+ tmp = ERTC_BASE + 0x50;
+ tmp += (ERTC_BKP_DT * 4);
+
+ /* Write the specified register */
+ *(__IO uint32_t *)tmp = (uint32_t)Data;
+}
+
+/**
+ * @brief Reads data from the specified ERTC Backup data Register.
+ * @param ERTC_BKP_DT: ERTC Backup data Register number.
+ * This parameter can be: ERTC_BKP_DTx where x can be from 0 to 19 to
+ * specify the register.
+ * @retval None
+ */
+uint32_t ERTC_ReadBackupRegister(uint32_t ERTC_BKP_DT)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_BKP(ERTC_BKP_DT));
+
+ tmp = ERTC_BASE + 0x50;
+ tmp += (ERTC_BKP_DT * 4);
+
+ /* Read the specified register */
+ return (*(__IO uint32_t *)tmp);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group11 ERTC Tamper and TimeStamp Pins Selection and Output Type Config configuration functions
+ * @brief ERTC Tamper and TimeStamp Pins Selection and Output Type Config
+ * configuration functions
+ *
+@verbatim
+ ==================================================================================================
+ ##### ERTC Tamper and TimeStamp Pins Selection and Output Type Config configuration functions #####
+ ==================================================================================================
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Selects the ERTC Tamper Pin.
+ * @param ERTC_TamperPin: specifies the ERTC Tamper Pin.
+ * This parameter can be one of the following values:
+ * @arg ERTC_TAMPPIN_Default: RTC_AF1 is used as ERTC Tamper Pin.
+ * @arg ERTC_TAMPPIN_Pos1: RTC_AF2 is selected as ERTC Tamper Pin.
+ * @retval None
+ */
+void ERTC_TamperPinSelection(uint32_t ERTC_TamperPin)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_TAMP_PIN(ERTC_TamperPin));
+
+ ERTC->TPAF &= (uint32_t)~(ERTC_TPAF_TMPINSEL);
+ ERTC->TPAF |= (uint32_t)(ERTC_TamperPin);
+}
+
+/**
+ * @brief Selects the ERTC TimeStamp Pin.
+ * @param ERTC_TimeStampPin: specifies the ERTC TimeStamp Pin.
+ * This parameter can be one of the following values:
+ * @arg ERTC_TimeStampPin_PC13: PC13 is selected as ERTC TimeStamp Pin.
+ * @arg ERTC_TimeStampPin_PI8: PI8 is selected as ERTC TimeStamp Pin.
+ * @retval None
+ */
+void ERTC_TimeStampPinSelection(uint32_t ERTC_TimeStampPin)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_TIMESTAMP_PIN(ERTC_TimeStampPin));
+
+ ERTC->TPAF &= (uint32_t)~(ERTC_TPAF_TSINSEL);
+ ERTC->TPAF |= (uint32_t)(ERTC_TimeStampPin);
+}
+
+/**
+ * @brief Configures the ERTC Output Pin mode.
+ * @param ERTC_OutputType: specifies the ERTC Output (PC13) pin mode.
+ * This parameter can be one of the following values:
+ * @arg ERTC_OutputType_OpenDrain: ERTC Output (PC13) is configured in
+ * Open Drain mode.
+ * @arg ERTC_OutputType_PushPull: ERTC Output (PC13) is configured in
+ * Push Pull mode.
+ * @retval None
+ */
+void ERTC_OutputTypeConfig(uint32_t ERTC_OutputType)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_OUTPUT_TYPE(ERTC_OutputType));
+
+ ERTC->TPAF &= (uint32_t)~(ERTC_TPAF_ALAOUTTYPE);
+ ERTC->TPAF |= (uint32_t)(ERTC_OutputType);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group12 Shift control synchronisation functions
+ * @brief Shift control synchronisation functions
+ *
+@verbatim
+ ===============================================================================
+ ##### Shift control synchronisation functions #####
+ ===============================================================================
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Configures the Synchronization Shift Control Settings.
+ * @note When REFCKON is set, firmware must not write to Shift control register
+ * @param ERTC_ShiftAdd1S : Select to add or not 1 second to the time Calendar.
+ * This parameter can be one of the following values :
+ * @arg ERTC_ShiftAdd1S_Set : Add one second to the clock calendar.
+ * @arg ERTC_ShiftAdd1S_Reset: No effect.
+ * @param ERTC_ShiftSubFS: Select the number of Second Fractions to Substitute.
+ * This parameter can be one any value from 0 to 0x7FFF.
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: ERTC Shift registers are configured
+ * - ERROR: ERTC Shift registers are not configured
+*/
+ErrorStatus ERTC_SynchroShiftConfig(uint32_t ERTC_ShiftAdd1S, uint32_t ERTC_ShiftSubFS)
+{
+ ErrorStatus status = ERROR;
+ uint32_t shpfcount = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_SHIFT_ADD1S(ERTC_ShiftAdd1S));
+ assert_param(IS_ERTC_SHIFT_SUBFS(ERTC_ShiftSubFS));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ /* Check if a Shift is pending*/
+ if ((ERTC->ISTS & ERTC_ISTS_SFP) != RESET)
+ {
+ /* Wait until the shift is completed*/
+ while (((ERTC->ISTS & ERTC_ISTS_SFP) != RESET) && (shpfcount != SFP_TMROUT))
+ {
+ shpfcount++;
+ }
+ }
+
+ /* Check if the Shift pending is completed or if there is no Shift operation at all*/
+ if ((ERTC->ISTS & ERTC_ISTS_SFP) == RESET)
+ {
+ /* check if the reference clock detection is disabled */
+ if((ERTC->CTRL & ERTC_CTRL_RFCKON) == RESET)
+ {
+ /* Configure the Shift settings */
+ ERTC->SFCTR = (uint32_t)(uint32_t)(ERTC_ShiftSubFS) | (uint32_t)(ERTC_ShiftAdd1S);
+
+ if(ERTC_WaitForSynchro() == ERROR)
+ {
+ status = ERROR;
+ }
+ else
+ {
+ status = SUCCESS;
+ }
+ }
+ else
+ {
+ status = ERROR;
+ }
+ }
+ else
+ {
+ status = ERROR;
+ }
+
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+
+ return (ErrorStatus)(status);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Group13 Interrupts and flags management functions
+ * @brief Interrupts and flags management functions
+ *
+@verbatim
+ ===============================================================================
+ ##### Interrupts and flags management functions #####
+ ===============================================================================
+ [..] All ERTC interrupts are connected to the EXTI controller.
+
+ (+) To enable the ERTC Alarm interrupt, the following sequence is required:
+ (++) Configure and enable the EXTI Line 17 in interrupt mode and select
+ the rising edge sensitivity using the EXTI_Init() function.
+ (++) Configure and enable the ERTC_Alarm IRQ channel in the NVIC using the
+ NVIC_Init() function.
+ (++) Configure the ERTC to generate ERTC alarms (Alarm A and/or Alarm B) using
+ the ERTC_SetAlarmValue() and ERTC_AlarmCmd() functions.
+
+ (+) To enable the ERTC Wakeup interrupt, the following sequence is required:
+ (++) Configure and enable the EXTI Line 22 in interrupt mode and select the
+ rising edge sensitivity using the EXTI_Init() function.
+ (++) Configure and enable the RTC_WKUP IRQ channel in the NVIC using the
+ NVIC_Init() function.
+ (++) Configure the ERTC to generate the ERTC wakeup timer event using the
+ ERTC_WakeUpClockConfig(), ERTC_SetWakeUpCounter() and ERTC_WakeUpCmd()
+ functions.
+
+ (+) To enable the ERTC Tamper interrupt, the following sequence is required:
+ (++) Configure and enable the EXTI Line 21 in interrupt mode and select
+ the rising edge sensitivity using the EXTI_Init() function.
+ (++) Configure and enable the TAMP_STAMP IRQ channel in the NVIC using the
+ NVIC_Init() function.
+ (++) Configure the ERTC to detect the ERTC tamper event using the
+ ERTC_TamperTriggerConfig() and ERTC_TamperCmd() functions.
+
+ (+) To enable the ERTC TimeStamp interrupt, the following sequence is required:
+ (++) Configure and enable the EXTI Line 21 in interrupt mode and select the
+ rising edge sensitivity using the EXTI_Init() function.
+ (++) Configure and enable the TAMP_STAMP IRQ channel in the NVIC using the
+ NVIC_Init() function.
+ (++) Configure the ERTC to detect the ERTC time stamp event using the
+ ERTC_TimeStampCmd() functions.
+
+@endverbatim
+ * @{
+ */
+
+/**
+ * @brief Enables or disables the specified ERTC interrupts.
+ * @param ERTC_INT: specifies the ERTC interrupt sources to be enabled or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg ERTC_INT_TS: Time Stamp interrupt mask
+ * @arg ERTC_INT_WAT: WakeUp Timer interrupt mask
+ * @arg ERTC_INT_ALB: Alarm B interrupt mask
+ * @arg ERTC_INT_ALA: Alarm A interrupt mask
+ * @arg ERTC_INT_TAMP: Tamper event interrupt mask
+ * @param NewState: new state of the specified ERTC interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ERTC_INTConfig(uint32_t ERTC_INT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_CONFIG_INT(ERTC_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ /* Disable the write protection for ERTC registers */
+ ERTC->WPR = 0xCA;
+ ERTC->WPR = 0x53;
+
+ if (NewState != DISABLE)
+ {
+ /* Configure the Interrupts in the RTC_CR register */
+ ERTC->CTRL |= (uint32_t)(ERTC_INT & ~ERTC_TPAF_TMIE);
+ /* Configure the Tamper Interrupt in the RTC_TAFCR */
+ ERTC->TPAF |= (uint32_t)(ERTC_INT & ERTC_TPAF_TMIE);
+ }
+ else
+ {
+ /* Configure the Interrupts in the RTC_CR register */
+ ERTC->CTRL &= (uint32_t)~(ERTC_INT & (uint32_t)~ERTC_TPAF_TMIE);
+ /* Configure the Tamper Interrupt in the RTC_TAFCR */
+ ERTC->TPAF &= (uint32_t)~(ERTC_INT & ERTC_TPAF_TMIE);
+ }
+ /* Enable the write protection for ERTC registers */
+ ERTC->WPR = 0xFF;
+}
+
+/**
+ * @brief Checks whether the specified ERTC flag is set or not.
+ * @param ERTC_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg ERTC_FLAG_RECALPDF: RECALPF event flag.
+ * @arg ERTC_FLAG_TP1F: Tamper 1 event flag
+ * @arg ERTC_FLAG_TP2F: Tamper 2 event flag
+ * @arg ERTC_FLAG_TSOF: Time Stamp OverFlow flag
+ * @arg ERTC_FLAG_TSF: Time Stamp event flag
+ * @arg ERTC_FLAG_WATF: WakeUp Timer flag
+ * @arg ERTC_FLAG_ALBF: Alarm B flag
+ * @arg ERTC_FLAG_ALAF: Alarm A flag
+ * @arg ERTC_FLAG_INITF: Initialization mode flag
+ * @arg ERTC_FLAG_RSF: Registers Synchronized flag
+ * @arg ERTC_FLAG_INITS: Registers Configured flag
+ * @arg ERTC_FLAG_SFP: Shift operation pending flag.
+ * @arg ERTC_FLAG_WATWF: WakeUp Timer Write flag
+ * @arg ERTC_FLAG_ALBWF: Alarm B Write flag
+ * @arg ERTC_FLAG_ALAWF: Alarm A write flag
+ * @retval The new state of ERTC_FLAG (SET or RESET).
+ */
+FlagStatus ERTC_GetFlagStatus(uint32_t ERTC_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_GET_FLAG(ERTC_FLAG));
+
+ /* Get all the flags */
+ tmpreg = (uint32_t)(ERTC->ISTS & ERTC_FLAGS_MASK);
+
+ /* Return the status of the flag */
+ if ((tmpreg & ERTC_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the ERTC's pending flags.
+ * @param ERTC_FLAG: specifies the ERTC flag to clear.
+ * This parameter can be any combination of the following values:
+ * @arg ERTC_FLAG_TP1F: Tamper 1 event flag
+ * @arg ERTC_FLAG_TP2F: Tamper 2 event flag
+ * @arg ERTC_FLAG_TSOF: Time Stamp Overflow flag
+ * @arg ERTC_FLAG_TSF: Time Stamp event flag
+ * @arg ERTC_FLAG_WATF: WakeUp Timer flag
+ * @arg ERTC_FLAG_ALBF: Alarm B flag
+ * @arg ERTC_FLAG_ALAF: Alarm A flag
+ * @arg ERTC_FLAG_RSF: Registers Synchronized flag
+ * @retval None
+ */
+void ERTC_ClearFlag(uint32_t ERTC_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_ERTC_CLEAR_FLAG(ERTC_FLAG));
+
+ /* Clear the Flags in the RTC_ISR register */
+ ERTC->ISTS = (uint32_t)((uint32_t)(~((ERTC_FLAG | ERTC_ISTS_INITM)& 0x0000FFFF) | (uint32_t)(ERTC->ISTS & ERTC_ISTS_INITM)));
+}
+
+/**
+ * @brief Checks whether the specified ERTC interrupt has occurred or not.
+ * @param ERTC_INT: specifies the ERTC interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg ERTC_INT_TS: Time Stamp interrupt
+ * @arg ERTC_INT_WAT: WakeUp Timer interrupt
+ * @arg ERTC_INT_ALB: Alarm B interrupt
+ * @arg ERTC_INT_ALA: Alarm A interrupt
+ * @arg ERTC_INT_TAMP1: Tamper 1 event interrupt
+ * @arg ERTC_INT_TAMP2: Tamper 2 event interrupt
+ * @retval The new state of ERTC_INT (SET or RESET).
+ */
+ITStatus ERTC_GetINTStatus(uint32_t ERTC_INT)
+{
+ ITStatus bitstatus = RESET;
+ uint32_t tmpreg = 0, enablestatus = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_GET_INT(ERTC_INT));
+
+ /* Get the TAMPER Interrupt enable bit and pending bit */
+ tmpreg = (uint32_t)(ERTC->TPAF & (ERTC_TPAF_TMIE));
+
+ /* Get the Interrupt enable Status */
+ enablestatus = (uint32_t)((ERTC->CTRL & ERTC_INT) | (tmpreg & (ERTC_INT >> 15)) | (tmpreg & (ERTC_INT >> 16)));
+
+ /* Get the Interrupt pending bit */
+ tmpreg = (uint32_t)((ERTC->ISTS & (uint32_t)(ERTC_INT >> 4)));
+
+ /* Get the status of the Interrupt */
+ if ((enablestatus != (uint32_t)RESET) && ((tmpreg & 0x0000FFFF) != (uint32_t)RESET))
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the ERTC's interrupt pending bits.
+ * @param ERTC_INT: specifies the ERTC interrupt pending bit to clear.
+ * This parameter can be any combination of the following values:
+ * @arg ERTC_INT_TS: Time Stamp interrupt
+ * @arg ERTC_INT_WAT: WakeUp Timer interrupt
+ * @arg ERTC_INT_ALB: Alarm B interrupt
+ * @arg ERTC_INT_ALA: Alarm A interrupt
+ * @arg ERTC_INT_TAMP1: Tamper 1 event interrupt
+ * @arg ERTC_INT_TAMP2: Tamper 2 event interrupt
+ * @retval None
+ */
+void ERTC_ClearINTPendingBINT(uint32_t ERTC_INT)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_ERTC_CLEAR_INT(ERTC_INT));
+
+ /* Get the RTC_ISR Interrupt pending bits mask */
+ tmpreg = (uint32_t)(ERTC_INT >> 4);
+
+ /* Clear the interrupt pending bits in the RTC_ISR register */
+ ERTC->ISTS = (uint32_t)((uint32_t)(~((tmpreg | ERTC_ISTS_INITM)& 0x0000FFFF) | (uint32_t)(ERTC->ISTS & ERTC_ISTS_INITM)));
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @brief Converts a 2 digit decimal to BCD format.
+ * @param Value: Byte to be converted.
+ * @retval Converted byte
+ */
+static uint8_t ERTC_ByteToBcd2(uint8_t Value)
+{
+ uint8_t bcdhigh = 0;
+
+ while (Value >= 10)
+ {
+ bcdhigh++;
+ Value -= 10;
+ }
+
+ return ((uint8_t)(bcdhigh << 4) | Value);
+}
+
+/**
+ * @brief Convert from 2 digit BCD to Binary.
+ * @param Value: BCD value to be converted.
+ * @retval Converted word
+ */
+static uint8_t ERTC_Bcd2ToByte(uint8_t Value)
+{
+ uint8_t tmp = 0;
+ tmp = ((uint8_t)(Value & (uint8_t)0xF0) >> (uint8_t)0x4) * 10;
+ return (tmp + (Value & (uint8_t)0x0F));
+}
+
+/**
+ * @}
+ */
+
+#endif /* AT32F415xx */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_eth.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_eth.c
new file mode 100644
index 0000000000000000000000000000000000000000..555a54f226a8bec66ab50d4740e618573fd38a7d
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_eth.c
@@ -0,0 +1,3078 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_eth.c
+ * Description : at32f4xx ETH source file
+ * Date : 2019-12-16
+ * Version : V1.0.0
+ **************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_eth.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @brief ETH driver modules
+ * @{
+ */
+
+#if defined (AT32F407xx)
+
+/** @defgroup ETH_Private_TypesDefinitions
+ * @{
+ */
+/**
+ * @}
+ */
+
+
+/** @defgroup ETH_Private_Defines
+ * @{
+ */
+/* Global pointers on Tx and Rx descriptor used to track transmit and receive descriptors */
+ETH_DMADESCTypeDef *DMATxDescToSet;
+ETH_DMADESCTypeDef *DMARxDescToGet;
+ETH_DMADESCTypeDef *DMAPTPTxDescToSet;
+ETH_DMADESCTypeDef *DMAPTPRxDescToGet;
+
+/* ETHERNET MAC address offsets */
+#define ETH_MAC_ADDR_HBASE (ETH_MAC_BASE + 0x40) /* ETHERNET MAC address high offset */
+#define ETH_MAC_ADDR_LBASE (ETH_MAC_BASE + 0x44) /* ETHERNET MAC address low offset */
+
+/* ETHERNET MACMIIAR register Mask */
+#define ETH_MACMIIAR_CR_MASK ((uint32_t)0xFFFFFFE3)
+
+/* ETHERNET MACCR register Mask */
+#define ETH_MACCR_CLEAR_MASK ((uint32_t)0xFF20810F)
+
+/* ETHERNET MACFCR register Mask */
+#define ETH_MACFCR_CLEAR_MASK ((uint32_t)0x0000FF41)
+
+/* ETHERNET DMAOMR register Mask */
+#define ETH_DMAOMR_CLEAR_MASK ((uint32_t)0xF8DE3F23)
+
+/* ETHERNET Remote Wake-up frame register length */
+#define ETH_WAKEUP_REGISTER_LENGTH 8
+
+/* ETHERNET Missed frames counter Shift */
+#define ETH_DMA_RX_OVERFLOW_MISSEDFRAMES_COUNTERSHIFT 17
+
+/* ETHERNET DMA Tx descriptors Collision Count Shift */
+#define ETH_DMATXDESC_COLLISION_COUNTSHIFT 3
+
+/* ETHERNET DMA Tx descriptors Buffer2 Size Shift */
+#define ETH_DMARXDESC_BUFFER2_SIZESHIFT 16
+
+/* ETHERNET DMA Rx descriptors Frame Length Shift */
+#define ETH_DMARXDESC_FRAME_LENGTHSHIFT 16
+
+/* ETHERNET DMA Rx descriptors Buffer2 Size Shift */
+#define ETH_DMARXDESC_FRAMELENGTHSHIFT 16
+
+/* ETHERNET errors */
+#define ETH_ERROR ((uint32_t)0)
+#define ETH_SUCCESS ((uint32_t)1)
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Private_Macros
+ * @{
+ */
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Private_Variables
+ * @{
+ */
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Private_FunctionPrototypes
+ * @{
+ */
+
+#ifndef USE_Delay
+static void ETH_Delay(__IO uint32_t nCount);
+#endif /* USE_Delay*/
+
+/**
+ * @}
+ */
+
+/** @defgroup ETH_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the ETHERNET peripheral registers to their default reset values.
+ * @param None
+ * @retval None
+ */
+void ETH_DeInit(void)
+{
+ RCC_AHBPeriphResetCmd(RCC_AHBPERIPH_ETHMAC, ENABLE);
+ RCC_AHBPeriphResetCmd(RCC_AHBPERIPH_ETHMAC, DISABLE);
+}
+
+/**
+ * @brief Initializes the ETHERNET peripheral according to the specified
+ * parameters in the ETH_InitStruct .
+ * @param ETH_InitStruct: pointer to a ETH_InitType structure that contains
+ * the configuration information for the specified ETHERNET peripheral.
+ * @param PHYAddress: external PHY address
+ * @retval ETH_ERROR: Ethernet initialization failed
+ * ETH_SUCCESS: Ethernet successfully initialized
+ */
+uint32_t ETH_Init(ETH_InitType* ETH_InitStruct, uint16_t PHYAddress)
+{
+ uint32_t RegValue = 0, tmpreg = 0;
+ __IO uint32_t i = 0, addr = 0;
+ RCC_ClockType rcc_clocks;
+ uint32_t hclk = 60000000;
+ __IO uint32_t timeout = 0;
+ /* Check the parameters */
+ /* MAC --------------------------*/
+ assert_param(IS_ETH_AUTONEGOTIATION(ETH_InitStruct->ETH_AutoNegotiation));
+ assert_param(IS_ETH_WATCHDOG(ETH_InitStruct->ETH_Watchdog));
+ assert_param(IS_ETH_JABBER(ETH_InitStruct->ETH_Jabber));
+ assert_param(IS_ETH_INTER_FRAME_GAP(ETH_InitStruct->ETH_InterFrameGap));
+ assert_param(IS_ETH_CARRIER_SENSE(ETH_InitStruct->ETH_CarrierSense));
+ assert_param(IS_ETH_SPEED(ETH_InitStruct->ETH_Speed));
+ assert_param(IS_ETH_RECEIVE_OWN(ETH_InitStruct->ETH_ReceiveOwn));
+ assert_param(IS_ETH_LOOPBACK_MODE(ETH_InitStruct->ETH_LoopbackMode));
+ assert_param(IS_ETH_DUPLEX_MODE(ETH_InitStruct->ETH_Mode));
+ assert_param(IS_ETH_CHECKSUM_OFFLOAD(ETH_InitStruct->ETH_ChecksumOffload));
+ assert_param(IS_ETH_RETRY_TRANSMISSION(ETH_InitStruct->ETH_RetryTransmission));
+ assert_param(IS_ETH_AUTOMATIC_PADCRC_STRIP(ETH_InitStruct->ETH_AutomaticPadCRCStrip));
+ assert_param(IS_ETH_BACKOFF_LIMIT(ETH_InitStruct->ETH_BackOffLimit));
+ assert_param(IS_ETH_DEFERRAL_CHECK(ETH_InitStruct->ETH_DeferralCheck));
+ assert_param(IS_ETH_RECEIVE_ALL(ETH_InitStruct->ETH_ReceiveAll));
+ assert_param(IS_ETH_SOURCE_ADDR_FILTER(ETH_InitStruct->ETH_SourceAddrFilter));
+ assert_param(IS_ETH_CONTROL_FRAMES(ETH_InitStruct->ETH_PassControlFrames));
+ assert_param(IS_ETH_BROADCAST_FRAMES_RECEPTION(ETH_InitStruct->ETH_BroadcastFramesReception));
+ assert_param(IS_ETH_DESTINATION_ADDR_FILTER(ETH_InitStruct->ETH_DestinationAddrFilter));
+ assert_param(IS_ETH_PROMISCUOUS_MODE(ETH_InitStruct->ETH_PromiscuousMode));
+ assert_param(IS_ETH_MULTICAST_FRAMES_FILTER(ETH_InitStruct->ETH_MulticastFramesFilter));
+ assert_param(IS_ETH_UNICAST_FRAMES_FILTER(ETH_InitStruct->ETH_UnicastFramesFilter));
+ assert_param(IS_ETH_PAUSE_TIME(ETH_InitStruct->ETH_PauseTime));
+ assert_param(IS_ETH_ZEROQUANTA_PAUSE(ETH_InitStruct->ETH_ZeroQuantaPause));
+ assert_param(IS_ETH_PAUSE_LOW_THRESHOLD(ETH_InitStruct->ETH_PauseLowThreshold));
+ assert_param(IS_ETH_UNICAST_PAUSE_FRAME_DETECT(ETH_InitStruct->ETH_UnicastPauseFrameDetect));
+ assert_param(IS_ETH_RECEIVE_FLOWCONTROL(ETH_InitStruct->ETH_ReceiveFlowControl));
+ assert_param(IS_ETH_TRANSMIT_FLOWCONTROL(ETH_InitStruct->ETH_TransmitFlowControl));
+ assert_param(IS_ETH_VLAN_TAG_COMPARISON(ETH_InitStruct->ETH_VLANTagComparison));
+ assert_param(IS_ETH_VLAN_TAG_IDENTIFIER(ETH_InitStruct->ETH_VLANTagIdentifier));
+ /* DMA --------------------------*/
+ assert_param(IS_ETH_DROP_TCPIP_CHECKSUM_FRAME(ETH_InitStruct->ETH_DropTCPIPChecksumErrorFrame));
+ assert_param(IS_ETH_RECEIVE_STORE_FORWARD(ETH_InitStruct->ETH_ReceiveStoreForward));
+ assert_param(IS_ETH_FLUSH_RECEIVE_FRAME(ETH_InitStruct->ETH_FlushReceivedFrame));
+ assert_param(IS_ETH_TRANSMIT_STORE_FORWARD(ETH_InitStruct->ETH_TransmitStoreForward));
+ assert_param(IS_ETH_TRANSMIT_THRESHOLD_CONTROL(ETH_InitStruct->ETH_TransmitThresholdControl));
+ assert_param(IS_ETH_FORWARD_ERROR_FRAMES(ETH_InitStruct->ETH_ForwardErrorFrames));
+ assert_param(IS_ETH_FORWARD_UNDERSIZED_GOOD_FRAMES(ETH_InitStruct->ETH_ForwardUndersizedGoodFrames));
+ assert_param(IS_ETH_RECEIVE_THRESHOLD_CONTROL(ETH_InitStruct->ETH_ReceiveThresholdControl));
+ assert_param(IS_ETH_SECOND_FRAME_OPERATE(ETH_InitStruct->ETH_SecondFrameOperate));
+ assert_param(IS_ETH_ADDRESS_ALIGNED_BEATS(ETH_InitStruct->ETH_AddressAlignedBeats));
+ assert_param(IS_ETH_FIXED_BURST(ETH_InitStruct->ETH_FixedBurst));
+ assert_param(IS_ETH_RXDMA_BURST_LENGTH(ETH_InitStruct->ETH_RxDMABurstLength));
+ assert_param(IS_ETH_TXDMA_BURST_LENGTH(ETH_InitStruct->ETH_TxDMABurstLength));
+ assert_param(IS_ETH_DMA_DESC_SKIP_LENGTH(ETH_InitStruct->ETH_DescriptorSkipLength));
+ assert_param(IS_ETH_DMA_ARBITRATION_ROUNDROBIN_RXTX(ETH_InitStruct->ETH_DMAArbitration));
+ /*-------------------------------- MAC Config ------------------------------*/
+ /*---------------------- ETHERNET MACMIIAR Configuration -------------------*/
+ /* Get the ETHERNET MACMIIAR value */
+ tmpreg = ETH->MACMIIADDR;
+ /* Clear CTRLSTS1 Clock Range CR[2:0] bits */
+ tmpreg &= ETH_MACMIIAR_CR_MASK;
+ /* Get hclk frequency value */
+ RCC_GetClocksFreq(&rcc_clocks);
+ hclk = rcc_clocks.AHBCLK_Freq;
+ /* Set CR bits depending on hclk value */
+ if((hclk >= 20000000)&&(hclk < 35000000))
+ {
+ /* CTRLSTS1 Clock Range between 20-35 MHz */
+ tmpreg |= (uint32_t)ETH_MACMIIADDR_CLKR_DIV16;
+ }
+ else if((hclk >= 35000000)&&(hclk < 60000000))
+ {
+ /* CTRLSTS1 Clock Range between 35-60 MHz */
+ tmpreg |= (uint32_t)ETH_MACMIIADDR_CLKR_DIV26;
+ }
+ else if((hclk >= 60000000)&&(hclk < 100000000))
+ {
+ /* CSR Clock Range between 60-100 MHz */
+ tmpreg |= (uint32_t)ETH_MACMIIADDR_CLKR_DIV42;
+ }
+ else if((hclk >= 100000000)&&(hclk < 150000000))
+ {
+ /* CSR Clock Range between 100-150 MHz */
+ tmpreg |= (uint32_t)ETH_MACMIIADDR_CLKR_DIV62;
+ }
+ else if((hclk >= 150000000)&&(hclk < 250000000))
+ {
+ /* CSR Clock Range between 150-250 MHz */
+ tmpreg |= (uint32_t)ETH_MACMIIADDR_CLKR_DIV102;
+ }
+ else
+ {
+ /* CSR Clock Range between 250-300 MHz */
+ tmpreg |= (uint32_t)ETH_MACMIIADDR_CLKR_DIV124;
+ }
+
+
+ /* Write to ETHERNET MAC MIIAR: Configure the ETHERNET CTRLSTS1 Clock Range */
+ ETH->MACMIIADDR = (uint32_t)tmpreg;
+ /*-------------------- PHY initialization and configuration ----------------*/
+ /* Put the PHY in reset mode */
+ if(!(ETH_WritePHYRegister(PHYAddress, PHY_BCR, PHY_Reset)))
+ {
+ /* Return ERROR in case of write timeout */
+ return ETH_ERROR;
+ }
+
+ _eth_delay_(PHY_ResetDelay);
+
+ while (1) /*Wait Reset Complete*/
+ {
+ if ( (ETH_ReadPHYRegister(PHYAddress, PHY_BSR) & PHY_Reset) == 0 )
+ break;
+ _eth_delay_(PHY_ResetDelay);
+ }
+
+ if(ETH_InitStruct->ETH_AutoNegotiation != ETH_AutoNegotiation_Disable)
+ {
+ /* We wait for linked satus... */
+ do
+ {
+ timeout++;
+ } while (!(ETH_ReadPHYRegister(PHYAddress, PHY_BSR) & PHY_Linked_Status) && (timeout < PHY_READ_TO));
+ /* Return ERROR in case of timeout */
+ if(timeout == PHY_READ_TO)
+ {
+// return ETH_ERROR;
+ }
+ /* Reset Timeout counter */
+ timeout = 0;
+
+ /* Enable Auto-Negotiation */
+ if(!(ETH_WritePHYRegister(PHYAddress, PHY_BCR, PHY_AutoNegotiation)))
+ {
+ /* Return ERROR in case of write timeout */
+ return ETH_ERROR;
+ }
+
+ /* Wait until the autonegotiation will be completed */
+ do
+ {
+ timeout++;
+ } while (!(ETH_ReadPHYRegister(PHYAddress, PHY_BSR) & PHY_AutoNego_Complete) && (timeout < (uint32_t)PHY_READ_TO));
+
+ /* Return ERROR in case of timeout */
+ if(timeout == PHY_READ_TO)
+ {
+ return ETH_ERROR;
+ }
+
+ /*Get Auto-Negotiation Result*/
+ RegValue = ETH_ReadPHYRegister(PHYAddress, PHY_SR);
+
+ if((RegValue & PHY_FullDuplex_Speed_100_Status) != (uint32_t)RESET)
+ {
+ ETH_InitStruct->ETH_Mode = ETH_Mode_FullDuplex;
+ ETH_InitStruct->ETH_Speed = ETH_Speed_100M;
+ }
+ else if ((RegValue & PHY_HalfDuplex_Speed_100_Status) != (uint32_t)RESET)
+ {
+ ETH_InitStruct->ETH_Mode = ETH_Mode_HalfDuplex;
+ ETH_InitStruct->ETH_Speed = ETH_Speed_100M;
+ }
+ else if ((RegValue & PHY_FullDuplex_Speed_10_Status) != (uint32_t)RESET)
+ {
+ ETH_InitStruct->ETH_Mode = ETH_Mode_FullDuplex;
+ ETH_InitStruct->ETH_Speed = ETH_Speed_10M;
+ }
+ else if ((RegValue & PHY_HalfDuplex_Speed_10_Status) != (uint32_t)RESET)
+ {
+ ETH_InitStruct->ETH_Mode = ETH_Mode_HalfDuplex;
+ ETH_InitStruct->ETH_Speed = ETH_Speed_10M;
+ }
+ }
+ else
+ {
+ if(!ETH_WritePHYRegister(PHYAddress, PHY_BCR, ((uint16_t)(ETH_InitStruct->ETH_Mode >> 3) |
+ (uint16_t)(ETH_InitStruct->ETH_Speed >> 1))))
+ {
+ /* Return ERROR in case of write timeout */
+ return ETH_ERROR;
+ }
+ /* Delay to assure PHY configuration */
+ _eth_delay_(PHY_ConfigDelay);
+
+ }
+
+ /*------------------------ ETHERNET MACCR Configuration --------------------*/
+ /* Get the ETHERNET MACCR value */
+ tmpreg = ETH->MACCTRL;
+ /* Clear WD, PCE, PS, TE and RE bits */
+ tmpreg &= ETH_MACCR_CLEAR_MASK;
+ /* Set the WD bit according to ETH_Watchdog value */
+ /* Set the JD: bit according to ETH_Jabber value */
+ /* Set the IFG bit according to ETH_InterFrameGap value */
+ /* Set the DCRS bit according to ETH_CarrierSense value */
+ /* Set the FES bit according to ETH_Speed value */
+ /* Set the DO bit according to ETH_ReceiveOwn value */
+ /* Set the LM bit according to ETH_LoopbackMode value */
+ /* Set the DM bit according to ETH_Mode value */
+ /* Set the IPC bit according to ETH_ChecksumOffload value */
+ /* Set the DR bit according to ETH_RetryTransmission value */
+ /* Set the ACS bit according to ETH_AutomaticPadCRCStrip value */
+ /* Set the BL bit according to ETH_BackOffLimit value */
+ /* Set the DC bit according to ETH_DeferralCheck value */
+ tmpreg |= (uint32_t)(ETH_InitStruct->ETH_Watchdog |
+ ETH_InitStruct->ETH_Jabber |
+ ETH_InitStruct->ETH_InterFrameGap |
+ ETH_InitStruct->ETH_CarrierSense |
+ ETH_InitStruct->ETH_Speed |
+ ETH_InitStruct->ETH_ReceiveOwn |
+ ETH_InitStruct->ETH_LoopbackMode |
+ ETH_InitStruct->ETH_Mode |
+ ETH_InitStruct->ETH_ChecksumOffload |
+ ETH_InitStruct->ETH_RetryTransmission |
+ ETH_InitStruct->ETH_AutomaticPadCRCStrip |
+ ETH_InitStruct->ETH_BackOffLimit |
+ ETH_InitStruct->ETH_DeferralCheck);
+ /* Write to ETHERNET MACCR */
+ ETH->MACCTRL = (uint32_t)tmpreg;
+
+ /*----------------------- ETHERNET MACFFR Configuration --------------------*/
+ /* Set the RA bit according to ETH_ReceiveAll value */
+ /* Set the SAF and SAIF bits according to ETH_SourceAddrFilter value */
+ /* Set the PCF bit according to ETH_PassControlFrames value */
+ /* Set the DBF bit according to ETH_BroadcastFramesReception value */
+ /* Set the DAIF bit according to ETH_DestinationAddrFilter value */
+ /* Set the PR bit according to ETH_PromiscuousMode value */
+ /* Set the PM, HMC and HPF bits according to ETH_MulticastFramesFilter value */
+ /* Set the HUC and HPF bits according to ETH_UnicastFramesFilter value */
+ /* Write to ETHERNET MACFFR */
+ ETH->MACFRMF = (uint32_t)(ETH_InitStruct->ETH_ReceiveAll |
+ ETH_InitStruct->ETH_SourceAddrFilter |
+ ETH_InitStruct->ETH_PassControlFrames |
+ ETH_InitStruct->ETH_BroadcastFramesReception |
+ ETH_InitStruct->ETH_DestinationAddrFilter |
+ ETH_InitStruct->ETH_PromiscuousMode |
+ ETH_InitStruct->ETH_MulticastFramesFilter |
+ ETH_InitStruct->ETH_UnicastFramesFilter);
+ /*--------------- ETHERNET MACHTHR and MACHTLR Configuration ---------------*/
+ /* Write to ETHERNET MACHTHR */
+ ETH->MACHTH = (uint32_t)ETH_InitStruct->ETH_HashTableHigh;
+ /* Write to ETHERNET MACHTLR */
+ ETH->MACHTL = (uint32_t)ETH_InitStruct->ETH_HashTableLow;
+ /*----------------------- ETHERNET MACFCR Configuration --------------------*/
+ /* Get the ETHERNET MACFCR value */
+ tmpreg = ETH->MACFCTRL;
+ /* Clear xx bits */
+ tmpreg &= ETH_MACFCR_CLEAR_MASK;
+
+ /* Set the PT bit according to ETH_PauseTime value */
+ /* Set the DZPQ bit according to ETH_ZeroQuantaPause value */
+ /* Set the PLT bit according to ETH_PauseLowThreshold value */
+ /* Set the UP bit according to ETH_UnicastPauseFrameDetect value */
+ /* Set the RFE bit according to ETH_ReceiveFlowControl value */
+ /* Set the TFE bit according to ETH_TransmitFlowControl value */
+ tmpreg |= (uint32_t)((ETH_InitStruct->ETH_PauseTime << 16) |
+ ETH_InitStruct->ETH_ZeroQuantaPause |
+ ETH_InitStruct->ETH_PauseLowThreshold |
+ ETH_InitStruct->ETH_UnicastPauseFrameDetect |
+ ETH_InitStruct->ETH_ReceiveFlowControl |
+ ETH_InitStruct->ETH_TransmitFlowControl);
+ /* Write to ETHERNET MACFCR */
+ ETH->MACFCTRL = (uint32_t)tmpreg;
+ /*----------------------- ETHERNET MACVLANTR Configuration -----------------*/
+ /* Set the ETV bit according to ETH_VLANTagComparison value */
+ /* Set the VL bit according to ETH_VLANTagIdentifier value */
+ ETH->MACVLT = (uint32_t)(ETH_InitStruct->ETH_VLANTagComparison |
+ ETH_InitStruct->ETH_VLANTagIdentifier);
+
+ /*-------------------------------- DMA Config ------------------------------*/
+ /*----------------------- ETHERNET DMAOMR Configuration --------------------*/
+ /* Get the ETHERNET DMAOMR value */
+ tmpreg = ETH->DMAOPM;
+ /* Clear xx bits */
+ tmpreg &= ETH_DMAOMR_CLEAR_MASK;
+
+ /* Set the DT bit according to ETH_DropTCPIPChecksumErrorFrame value */
+ /* Set the RSF bit according to ETH_ReceiveStoreForward value */
+ /* Set the DFF bit according to ETH_FlushReceivedFrame value */
+ /* Set the TSF bit according to ETH_TransmitStoreForward value */
+ /* Set the TTC bit according to ETH_TransmitThresholdControl value */
+ /* Set the FEF bit according to ETH_ForwardErrorFrames value */
+ /* Set the FUF bit according to ETH_ForwardUndersizedGoodFrames value */
+ /* Set the ERTC bit according to ETH_ReceiveThresholdControl value */
+ /* Set the OSF bit according to ETH_SecondFrameOperate value */
+ tmpreg |= (uint32_t)(ETH_InitStruct->ETH_DropTCPIPChecksumErrorFrame |
+ ETH_InitStruct->ETH_ReceiveStoreForward |
+ ETH_InitStruct->ETH_FlushReceivedFrame |
+ ETH_InitStruct->ETH_TransmitStoreForward |
+ ETH_InitStruct->ETH_TransmitThresholdControl |
+ ETH_InitStruct->ETH_ForwardErrorFrames |
+ ETH_InitStruct->ETH_ForwardUndersizedGoodFrames |
+ ETH_InitStruct->ETH_ReceiveThresholdControl |
+ ETH_InitStruct->ETH_SecondFrameOperate);
+ /* Write to ETHERNET DMAOMR */
+ ETH->DMAOPM = (uint32_t)tmpreg;
+
+ /*----------------------- ETHERNET DMABMR Configuration --------------------*/
+ /* Set the AAL bit according to ETH_AddressAlignedBeats value */
+ /* Set the FB bit according to ETH_FixedBurst value */
+ /* Set the RPBL and 4*PBL bits according to ETH_RxDMABurstLength value */
+ /* Set the PBL and 4*PBL bits according to ETH_TxDMABurstLength value */
+ /* Set the DSL bit according to ETH_DesciptorSkipLength value */
+ /* Set the PR and DA bits according to ETH_DMAArbitration value */
+ ETH->DMABM = (uint32_t)(ETH_InitStruct->ETH_AddressAlignedBeats |
+ ETH_InitStruct->ETH_FixedBurst |
+ ETH_InitStruct->ETH_RxDMABurstLength | /* !! if 4xPBL is selected for Tx or Rx it is applied for the other */
+ ETH_InitStruct->ETH_TxDMABurstLength |
+ (ETH_InitStruct->ETH_DescriptorSkipLength << 2) |
+ ETH_InitStruct->ETH_DMAArbitration |
+ ETH_DMABM_USP); /* Enable use of separate PBL for Rx and Tx */
+ /* Return Ethernet configuration success */
+ return ETH_SUCCESS;
+}
+
+/**
+ * @brief Fills each ETH_InitStruct member with its default value.
+ * @param ETH_InitStruct: pointer to a ETH_InitType structure which will be initialized.
+ * @retval None
+ */
+void ETH_StructInit(ETH_InitType* ETH_InitStruct)
+{
+ /* ETH_InitStruct members default value */
+ /*------------------------ MAC -----------------------------------*/
+ ETH_InitStruct->ETH_AutoNegotiation = ETH_AutoNegotiation_Disable;
+ ETH_InitStruct->ETH_Watchdog = ETH_Watchdog_Enable;
+ ETH_InitStruct->ETH_Jabber = ETH_Jabber_Enable;
+ ETH_InitStruct->ETH_InterFrameGap = ETH_InterFrameGap_96Bit;
+ ETH_InitStruct->ETH_CarrierSense = ETH_CarrierSense_Enable;
+ ETH_InitStruct->ETH_Speed = ETH_Speed_10M;
+ ETH_InitStruct->ETH_ReceiveOwn = ETH_ReceiveOwn_Enable;
+ ETH_InitStruct->ETH_LoopbackMode = ETH_LoopbackMode_Disable;
+ ETH_InitStruct->ETH_Mode = ETH_Mode_HalfDuplex;
+ ETH_InitStruct->ETH_ChecksumOffload = ETH_ChecksumOffload_Disable;
+ ETH_InitStruct->ETH_RetryTransmission = ETH_RetryTransmission_Enable;
+ ETH_InitStruct->ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
+ ETH_InitStruct->ETH_BackOffLimit = ETH_BackOffLimit_10;
+ ETH_InitStruct->ETH_DeferralCheck = ETH_DeferralCheck_Disable;
+ ETH_InitStruct->ETH_ReceiveAll = ETH_ReceiveAll_Disable;
+ ETH_InitStruct->ETH_SourceAddrFilter = ETH_SourceAddrFilter_Disable;
+ ETH_InitStruct->ETH_PassControlFrames = ETH_PassControlFrames_BlockAll;
+ ETH_InitStruct->ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
+ ETH_InitStruct->ETH_DestinationAddrFilter = ETH_DestinationAddrFilter_Normal;
+ ETH_InitStruct->ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
+ ETH_InitStruct->ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
+ ETH_InitStruct->ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
+ ETH_InitStruct->ETH_HashTableHigh = 0x0;
+ ETH_InitStruct->ETH_HashTableLow = 0x0;
+ ETH_InitStruct->ETH_PauseTime = 0x0;
+ ETH_InitStruct->ETH_ZeroQuantaPause = ETH_ZeroQuantaPause_Disable;
+ ETH_InitStruct->ETH_PauseLowThreshold = ETH_PauseLowThreshold_Minus4;
+ ETH_InitStruct->ETH_UnicastPauseFrameDetect = ETH_UnicastPauseFrameDetect_Disable;
+ ETH_InitStruct->ETH_ReceiveFlowControl = ETH_ReceiveFlowControl_Disable;
+ ETH_InitStruct->ETH_TransmitFlowControl = ETH_TransmitFlowControl_Enable;
+ ETH_InitStruct->ETH_VLANTagComparison = ETH_VLANTagComparison_16Bit;
+ ETH_InitStruct->ETH_VLANTagIdentifier = 0x0;
+ /*------------------------ DMA -----------------------------------*/
+ ETH_InitStruct->ETH_DropTCPIPChecksumErrorFrame = ETH_DropTCPIPChecksumErrorFrame_Disable;
+ ETH_InitStruct->ETH_ReceiveStoreForward = ETH_ReceiveStoreForward_Enable;
+ ETH_InitStruct->ETH_FlushReceivedFrame = ETH_FlushReceivedFrame_Disable;
+ ETH_InitStruct->ETH_TransmitStoreForward = ETH_TransmitStoreForward_Enable;
+ ETH_InitStruct->ETH_TransmitThresholdControl = ETH_TransmitThresholdControl_64Bytes;
+ ETH_InitStruct->ETH_ForwardErrorFrames = ETH_ForwardErrorFrames_Disable;
+ ETH_InitStruct->ETH_ForwardUndersizedGoodFrames = ETH_ForwardUndersizedGoodFrames_Disable;
+ ETH_InitStruct->ETH_ReceiveThresholdControl = ETH_ReceiveThresholdControl_64Bytes;
+ ETH_InitStruct->ETH_SecondFrameOperate = ETH_SecondFrameOperate_Disable;
+ ETH_InitStruct->ETH_AddressAlignedBeats = ETH_AddressAlignedBeats_Enable;
+ ETH_InitStruct->ETH_FixedBurst = ETH_FixedBurst_Disable;
+ ETH_InitStruct->ETH_RxDMABurstLength = ETH_RxDMABurstLength_1Beat;
+ ETH_InitStruct->ETH_TxDMABurstLength = ETH_TxDMABurstLength_1Beat;
+ ETH_InitStruct->ETH_DescriptorSkipLength = 0x0;
+ ETH_InitStruct->ETH_DMAArbitration = ETH_DMAArbitration_RoundRobin_RxTx_1_1;
+}
+
+/**
+ * @brief Enables ENET MAC and DMA reception/transmission
+ * @param None
+ * @retval None
+ */
+void ETH_Start(void)
+{
+ /* Enable transmit state machine of the MAC for transmission on the MII */
+ ETH_MACTransmissionCmd(ENABLE);
+ /* Flush Transmit FIFO */
+ ETH_FlushTransmitFIFO();
+ /* Enable receive state machine of the MAC for reception from the MII */
+ ETH_MACReceptionCmd(ENABLE);
+
+ /* Start DMA transmission */
+ ETH_DMATransmissionCmd(ENABLE);
+ /* Start DMA reception */
+ ETH_DMAReceptionCmd(ENABLE);
+}
+
+/**
+ * @brief Transmits a packet, from application buffer, pointed by ppkt.
+ * @param ppkt: pointer to the application's packet buffer to transmit.
+ * @param FrameLength: Tx Packet size.
+ * @retval ETH_ERROR: in case of Tx desc owned by DMA
+ * ETH_SUCCESS: for correct transmission
+ */
+uint32_t ETH_HandleTxPkt(uint8_t *ppkt, uint16_t FrameLength)
+{
+ uint32_t offset = 0;
+
+ /* Check if the descriptor is owned by the ETHERNET DMA (when set) or CPU (when reset) */
+ if((DMATxDescToSet->Status & ETH_DMATxDesc_OWN) != (uint32_t)RESET)
+ {
+ /* Return ERROR: OWN bit set */
+ return ETH_ERROR;
+ }
+
+ /* Copy the frame to be sent into memory pointed by the current ETHERNET DMA Tx descriptor */
+ for(offset=0; offsetBuffer1Addr) + offset)) = (*(ppkt + offset));
+ }
+
+ /* Setting the Frame Length: bits[12:0] */
+ DMATxDescToSet->ControlBufferSize = (FrameLength & ETH_DMATxDesc_TBS1);
+ /* Setting the last segment and first segment bits (in this case a frame is transmitted in one descriptor) */
+ DMATxDescToSet->Status |= ETH_DMATxDesc_LS | ETH_DMATxDesc_FS;
+ /* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */
+ DMATxDescToSet->Status |= ETH_DMATxDesc_OWN;
+ /* When Tx Buffer unavailable flag is set: clear it and resume transmission */
+ if ((ETH->DMASTS & ETH_DMASTS_TBU) != (uint32_t)RESET)
+ {
+ /* Clear TBUS ETHERNET DMA flag */
+ ETH->DMASTS = ETH_DMASTS_TBU;
+ /* Resume DMA transmission*/
+ ETH->DMATPD = 0;
+ }
+
+ /* Update the ETHERNET DMA global Tx descriptor with next Tx decriptor */
+ /* Chained Mode */
+ if((DMATxDescToSet->Status & ETH_DMATxDesc_TCH) != (uint32_t)RESET)
+ {
+ /* Selects the next DMA Tx descriptor list for next buffer to send */
+ DMATxDescToSet = (ETH_DMADESCTypeDef*) (DMATxDescToSet->Buffer2NextDescAddr);
+ }
+ else /* Ring Mode */
+ {
+ if((DMATxDescToSet->Status & ETH_DMATxDesc_TER) != (uint32_t)RESET)
+ {
+ /* Selects the first DMA Tx descriptor for next buffer to send: last Tx descriptor was used */
+ DMATxDescToSet = (ETH_DMADESCTypeDef*) (ETH->DMATDLADDR);
+ }
+ else
+ {
+ /* Selects the next DMA Tx descriptor list for next buffer to send */
+ DMATxDescToSet = (ETH_DMADESCTypeDef*) ((uint32_t)DMATxDescToSet + 0x10 + ((ETH->DMABM & ETH_DMABM_DSL) >> 2));
+ }
+ }
+ /* Return SUCCESS */
+ return ETH_SUCCESS;
+}
+
+/**
+ * @brief Receives a packet and copies it to memory pointed by ppkt.
+ * @param ppkt: pointer to the application packet receive buffer.
+ * @retval ETH_ERROR: if there is error in reception
+ * framelength: received packet size if packet reception is correct
+ */
+uint32_t ETH_HandleRxPkt(uint8_t *ppkt)
+{
+ uint32_t offset = 0, framelength = 0;
+ /* Check if the descriptor is owned by the ETHERNET DMA (when set) or CPU (when reset) */
+ if((DMARxDescToGet->Status & ETH_DMARxDesc_OWN) != (uint32_t)RESET)
+ {
+ /* Return error: OWN bit set */
+ return ETH_ERROR;
+ }
+
+ if(((DMARxDescToGet->Status & ETH_DMARxDesc_ES) == (uint32_t)RESET) &&
+ ((DMARxDescToGet->Status & ETH_DMARxDesc_LS) != (uint32_t)RESET) &&
+ ((DMARxDescToGet->Status & ETH_DMARxDesc_FS) != (uint32_t)RESET))
+ {
+ /* Get the Frame Length of the received packet: substruct 4 bytes of the CRC */
+ framelength = ((DMARxDescToGet->Status & ETH_DMARxDesc_FL) >> ETH_DMARXDESC_FRAME_LENGTHSHIFT) - 4;
+ /* Copy the received frame into buffer from memory pointed by the current ETHERNET DMA Rx descriptor */
+ for(offset=0; offsetBuffer1Addr) + offset));
+ }
+ }
+ else
+ {
+ /* Return ERROR */
+ framelength = ETH_ERROR;
+ }
+ /* Set Own bit of the Rx descriptor Status: gives the buffer back to ETHERNET DMA */
+ DMARxDescToGet->Status = ETH_DMARxDesc_OWN;
+
+ /* When Rx Buffer unavailable flag is set: clear it and resume reception */
+ if ((ETH->DMASTS & ETH_DMASTS_RBU) != (uint32_t)RESET)
+ {
+ /* Clear RBUS ETHERNET DMA flag */
+ ETH->DMASTS = ETH_DMASTS_RBU;
+ /* Resume DMA reception */
+ ETH->DMARPD = 0;
+ }
+
+ /* Update the ETHERNET DMA global Rx descriptor with next Rx decriptor */
+ /* Chained Mode */
+ if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RCH) != (uint32_t)RESET)
+ {
+ /* Selects the next DMA Rx descriptor list for next buffer to read */
+ DMARxDescToGet = (ETH_DMADESCTypeDef*) (DMARxDescToGet->Buffer2NextDescAddr);
+ }
+ else /* Ring Mode */
+ {
+ if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RER) != (uint32_t)RESET)
+ {
+ /* Selects the first DMA Rx descriptor for next buffer to read: last Rx descriptor was used */
+ DMARxDescToGet = (ETH_DMADESCTypeDef*) (ETH->DMARDLADDR);
+ }
+ else
+ {
+ /* Selects the next DMA Rx descriptor list for next buffer to read */
+ DMARxDescToGet = (ETH_DMADESCTypeDef*) ((uint32_t)DMARxDescToGet + 0x10 + ((ETH->DMABM & ETH_DMABM_DSL) >> 2));
+ }
+ }
+
+ /* Return Frame Length/ERROR */
+ return (framelength);
+}
+
+/**
+ * @brief Get the size of received the received packet.
+ * @param None
+ * @retval framelength: received packet size
+ */
+uint32_t ETH_GetRxPktSize(void)
+{
+ uint32_t frameLength = 0;
+ if(((DMARxDescToGet->Status & ETH_DMARxDesc_OWN) == (uint32_t)RESET) &&
+ ((DMARxDescToGet->Status & ETH_DMARxDesc_ES) == (uint32_t)RESET) &&
+ ((DMARxDescToGet->Status & ETH_DMARxDesc_LS) != (uint32_t)RESET) &&
+ ((DMARxDescToGet->Status & ETH_DMARxDesc_FS) != (uint32_t)RESET))
+ {
+ /* Get the size of the packet: including 4 bytes of the CRC */
+ frameLength = ETH_GetDMARxDescFrameLength(DMARxDescToGet);
+ }
+
+ /* Return Frame Length */
+ return frameLength;
+}
+
+/**
+ * @brief Drop a Received packet (too small packet, etc...)
+ * @param None
+ * @retval None
+ */
+void ETH_DropRxPkt(void)
+{
+ /* Set Own bit of the Rx descriptor Status: gives the buffer back to ETHERNET DMA */
+ DMARxDescToGet->Status = ETH_DMARxDesc_OWN;
+ /* Chained Mode */
+ if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RCH) != (uint32_t)RESET)
+ {
+ /* Selects the next DMA Rx descriptor list for next buffer read */
+ DMARxDescToGet = (ETH_DMADESCTypeDef*) (DMARxDescToGet->Buffer2NextDescAddr);
+ }
+ else /* Ring Mode */
+ {
+ if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RER) != (uint32_t)RESET)
+ {
+ /* Selects the next DMA Rx descriptor list for next buffer read: this will
+ be the first Rx descriptor in this case */
+ DMARxDescToGet = (ETH_DMADESCTypeDef*) (ETH->DMARDLADDR);
+ }
+ else
+ {
+ /* Selects the next DMA Rx descriptor list for next buffer read */
+ DMARxDescToGet = (ETH_DMADESCTypeDef*) ((uint32_t)DMARxDescToGet + 0x10 + ((ETH->DMABM & ETH_DMABM_DSL) >> 2));
+ }
+ }
+}
+
+/*--------------------------------- PHY ------------------------------------*/
+/**
+ * @brief Read a PHY register
+ * @param PHYAddress: PHY device address, is the index of one of supported 32 PHY devices.
+ * This parameter can be one of the following values: 0,..,31
+ * @param PHYReg: PHY register address, is the index of one of the 32 PHY register.
+ * This parameter can be one of the following values:
+ * @arg PHY_BCR: Tranceiver Basic Control Register
+ * @arg PHY_BSR: Tranceiver Basic Status Register
+ * @arg PHY_SR : Tranceiver Status Register
+ * @arg More PHY register could be read depending on the used PHY
+ * @retval ETH_ERROR: in case of timeout
+ * MAC MIIDR register value: Data read from the selected PHY register (correct read )
+ */
+uint16_t ETH_ReadPHYRegister(uint16_t PHYAddress, uint16_t PHYReg)
+{
+ uint32_t tmpreg = 0;
+__IO uint32_t timeout = 0;
+ /* Check the parameters */
+ assert_param(IS_ETH_PHY_ADDRESS(PHYAddress));
+ assert_param(IS_ETH_PHY_REG(PHYReg));
+
+ /* Get the ETHERNET MACMIIAR value */
+ tmpreg = ETH->MACMIIADDR;
+ /* Keep only the CTRLSTS1 Clock Range CR[2:0] bits value */
+ tmpreg &= ~ETH_MACMIIAR_CR_MASK;
+ /* Prepare the MII address register value */
+ tmpreg |=(((uint32_t)PHYAddress<<11) & ETH_MACMIIADDR_PA); /* Set the PHY device address */
+ tmpreg |=(((uint32_t)PHYReg<<6) & ETH_MACMIIADDR_MII); /* Set the PHY register address */
+ tmpreg &= ~ETH_MACMIIADDR_MIIW; /* Set the read mode */
+ tmpreg |= ETH_MACMIIADDR_MIIB; /* Set the MII Busy bit */
+ /* Write the result value into the MII Address register */
+ ETH->MACMIIADDR = tmpreg;
+ /* Check for the Busy flag */
+ do
+ {
+ timeout++;
+ tmpreg = ETH->MACMIIADDR;
+ } while ((tmpreg & ETH_MACMIIADDR_MIIB) && (timeout < (uint32_t)PHY_READ_TO));
+ /* Return ERROR in case of timeout */
+ if(timeout == PHY_READ_TO)
+ {
+ return (uint16_t)ETH_ERROR;
+ }
+
+ /* Return data register value */
+ return (uint16_t)(ETH->MACMIIDT);
+}
+
+/**
+ * @brief Write to a PHY register
+ * @param PHYAddress: PHY device address, is the index of one of supported 32 PHY devices.
+ * This parameter can be one of the following values: 0,..,31
+ * @param PHYReg: PHY register address, is the index of one of the 32 PHY register.
+ * This parameter can be one of the following values:
+ * @arg PHY_BCR : Tranceiver Control Register
+ * @arg More PHY register could be written depending on the used PHY
+ * @param PHYValue: the value to write
+ * @retval ETH_ERROR: in case of timeout
+ * ETH_SUCCESS: for correct write
+ */
+uint32_t ETH_WritePHYRegister(uint16_t PHYAddress, uint16_t PHYReg, uint16_t PHYValue)
+{
+ uint32_t tmpreg = 0;
+ __IO uint32_t timeout = 0;
+ /* Check the parameters */
+ assert_param(IS_ETH_PHY_ADDRESS(PHYAddress));
+ assert_param(IS_ETH_PHY_REG(PHYReg));
+
+ /* Get the ETHERNET MACMIIAR value */
+ tmpreg = ETH->MACMIIADDR;
+ /* Keep only the CTRLSTS1 Clock Range CR[2:0] bits value */
+ tmpreg &= ~ETH_MACMIIAR_CR_MASK;
+ /* Prepare the MII register address value */
+ tmpreg |=(((uint32_t)PHYAddress<<11) & ETH_MACMIIADDR_PA); /* Set the PHY device address */
+ tmpreg |=(((uint32_t)PHYReg<<6) & ETH_MACMIIADDR_MII); /* Set the PHY register address */
+ tmpreg |= ETH_MACMIIADDR_MIIW; /* Set the write mode */
+ tmpreg |= ETH_MACMIIADDR_MIIB; /* Set the MII Busy bit */
+ /* Give the value to the MII data register */
+ ETH->MACMIIDT = PHYValue;
+ /* Write the result value into the MII Address register */
+ ETH->MACMIIADDR = tmpreg;
+ /* Check for the Busy flag */
+ do
+ {
+ timeout++;
+ tmpreg = ETH->MACMIIADDR;
+ } while ((tmpreg & ETH_MACMIIADDR_MIIB) && (timeout < (uint32_t)PHY_WRITE_TO));
+ /* Return ERROR in case of timeout */
+ if(timeout == PHY_WRITE_TO)
+ {
+ return ETH_ERROR;
+ }
+
+ /* Return SUCCESS */
+ return ETH_SUCCESS;
+}
+
+/**
+ * @brief Enables or disables the PHY loopBack mode.
+ * @Note: Don't be confused with ETH_MACLoopBackCmd function which enables internal
+ * loopback at MII level
+ * @param PHYAddress: PHY device address, is the index of one of supported 32 PHY devices.
+ * This parameter can be one of the following values:
+ * @param NewState: new state of the PHY loopBack mode.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval ETH_ERROR: in case of bad PHY configuration
+ * ETH_SUCCESS: for correct PHY configuration
+ */
+uint32_t ETH_PHYLoopBackCmd(uint16_t PHYAddress, FunctionalState NewState)
+{
+ uint16_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_ETH_PHY_ADDRESS(PHYAddress));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ /* Get the PHY configuration to update it */
+ tmpreg = ETH_ReadPHYRegister(PHYAddress, PHY_BCR);
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the PHY loopback mode */
+ tmpreg |= PHY_Loopback;
+ }
+ else
+ {
+ /* Disable the PHY loopback mode: normal mode */
+ tmpreg &= (uint16_t)(~(uint16_t)PHY_Loopback);
+ }
+ /* Update the PHY control register with the new configuration */
+ if(ETH_WritePHYRegister(PHYAddress, PHY_BCR, tmpreg) != (uint32_t)RESET)
+ {
+ return ETH_SUCCESS;
+ }
+ else
+ {
+ /* Return SUCCESS */
+ return ETH_ERROR;
+ }
+}
+
+/*--------------------------------- MAC ------------------------------------*/
+/**
+ * @brief Enables or disables the MAC transmission.
+ * @param NewState: new state of the MAC transmission.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_MACTransmissionCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the MAC transmission */
+ ETH->MACCTRL |= ETH_MACCTRL_TE;
+ }
+ else
+ {
+ /* Disable the MAC transmission */
+ ETH->MACCTRL &= ~ETH_MACCTRL_TE;
+ }
+}
+
+/**
+ * @brief Enables or disables the MAC reception.
+ * @param NewState: new state of the MAC reception.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_MACReceptionCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the MAC reception */
+ ETH->MACCTRL |= ETH_MACCTRL_RE;
+ }
+ else
+ {
+ /* Disable the MAC reception */
+ ETH->MACCTRL &= ~ETH_MACCTRL_RE;
+ }
+}
+
+/**
+ * @brief Checks whether the ETHERNET flow control busy bit is set or not.
+ * @param None
+ * @retval The new state of flow control busy status bit (SET or RESET).
+ */
+FlagStatus ETH_GetFlowControlBusyStatus(void)
+{
+ FlagStatus bitstatus = RESET;
+ /* The Flow Control register should not be written to until this bit is cleared */
+ if ((ETH->MACFCTRL & ETH_MACFCTRL_FCBBPA) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Initiate a Pause Control Frame (Full-duplex only).
+ * @param None
+ * @retval None
+ */
+void ETH_InitiatePauseControlFrame(void)
+{
+ /* When Set In full duplex MAC initiates pause control frame */
+ ETH->MACFCTRL |= ETH_MACFCTRL_FCBBPA;
+}
+
+/**
+ * @brief Enables or disables the MAC BackPressure operation activation (Half-duplex only).
+ * @param NewState: new state of the MAC BackPressure operation activation.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_BackPressureActivationCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Activate the MAC BackPressure operation */
+ /* In Half duplex: during backpressure, when the MAC receives a new frame,
+ the transmitter starts sending a JAM pattern resulting in a collision */
+ ETH->MACFCTRL |= ETH_MACFCTRL_FCBBPA;
+ }
+ else
+ {
+ /* Desactivate the MAC BackPressure operation */
+ ETH->MACFCTRL &= ~ETH_MACFCTRL_FCBBPA;
+ }
+}
+
+/**
+ * @brief Checks whether the specified ETHERNET MAC flag is set or not.
+ * @param ETH_MAC_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg ETH_MAC_FLAG_TST : Time stamp trigger flag
+ * @arg ETH_MAC_FLAG_MMCT : MMC transmit flag
+ * @arg ETH_MAC_FLAG_MMCR : MMC receive flag
+ * @arg ETH_MAC_FLAG_MMC : MMC flag
+ * @arg ETH_MAC_FLAG_PMT : PMT flag
+ * @retval The new state of ETHERNET MAC flag (SET or RESET).
+ */
+FlagStatus ETH_GetMACFlagStatus(uint32_t ETH_MAC_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ETH_MAC_GET_FLAG(ETH_MAC_FLAG));
+ if ((ETH->MACISTS & ETH_MAC_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Checks whether the specified ETHERNET MAC interrupt has occurred or not.
+ * @param ETH_MAC_IT: specifies the interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg ETH_MAC_INT_TST : Time stamp trigger interrupt
+ * @arg ETH_MAC_INT_MMCT : MMC transmit interrupt
+ * @arg ETH_MAC_INT_MMCR : MMC receive interrupt
+ * @arg ETH_MAC_INT_MMC : MMC interrupt
+ * @arg ETH_MAC_INT_PMT : PMT interrupt
+ * @retval The new state of ETHERNET MAC interrupt (SET or RESET).
+ */
+ITStatus ETH_GetMACITStatus(uint32_t ETH_MAC_IT)
+{
+ ITStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ETH_MAC_GET_IT(ETH_MAC_IT));
+ if ((ETH->MACISTS & ETH_MAC_IT) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Enables or disables the specified ETHERNET MAC interrupts.
+ * @param ETH_MAC_IT: specifies the ETHERNET MAC interrupt sources to be
+ * enabled or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg ETH_MAC_INT_TST : Time stamp trigger interrupt
+ * @arg ETH_MAC_INT_PMT : PMT interrupt
+ * @param NewState: new state of the specified ETHERNET MAC interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_MACITConfig(uint32_t ETH_MAC_IT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_MAC_IT(ETH_MAC_IT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ETHERNET MAC interrupts */
+ ETH->MACIM &= (~(uint32_t)ETH_MAC_IT);
+ }
+ else
+ {
+ /* Disable the selected ETHERNET MAC interrupts */
+ ETH->MACIM |= ETH_MAC_IT;
+ }
+}
+
+/**
+ * @brief Configures the selected MAC address.
+ * @param MacAddr: The MAC addres to configure.
+ * This parameter can be one of the following values:
+ * @arg ETH_MAC_Address0 : MAC Address0
+ * @arg ETH_MAC_Address1 : MAC Address1
+ * @arg ETH_MAC_Address2 : MAC Address2
+ * @arg ETH_MAC_Address3 : MAC Address3
+ * @param Addr: Pointer on MAC address buffer data (6 bytes).
+ * @retval None
+ */
+void ETH_MACAddressConfig(uint32_t MacAddr, uint8_t *Addr)
+{
+ uint32_t tmpreg;
+ /* Check the parameters */
+ assert_param(IS_ETH_MAC_ADDRESS0123(MacAddr));
+
+ /* Calculate the selectecd MAC address high register */
+ tmpreg = ((uint32_t)Addr[5] << 8) | (uint32_t)Addr[4];
+ /* Load the selectecd MAC address high register */
+ (*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + MacAddr)) = tmpreg;
+ /* Calculate the selectecd MAC address low register */
+ tmpreg = ((uint32_t)Addr[3] << 24) | ((uint32_t)Addr[2] << 16) | ((uint32_t)Addr[1] << 8) | Addr[0];
+
+ /* Load the selectecd MAC address low register */
+ (*(__IO uint32_t *) (ETH_MAC_ADDR_LBASE + MacAddr)) = tmpreg;
+}
+
+/**
+ * @brief Get the selected MAC address.
+ * @param MacAddr: The MAC addres to return.
+ * This parameter can be one of the following values:
+ * @arg ETH_MAC_Address0 : MAC Address0
+ * @arg ETH_MAC_Address1 : MAC Address1
+ * @arg ETH_MAC_Address2 : MAC Address2
+ * @arg ETH_MAC_Address3 : MAC Address3
+ * @param Addr: Pointer on MAC address buffer data (6 bytes).
+ * @retval None
+ */
+void ETH_GetMACAddress(uint32_t MacAddr, uint8_t *Addr)
+{
+ uint32_t tmpreg;
+ /* Check the parameters */
+ assert_param(IS_ETH_MAC_ADDRESS0123(MacAddr));
+
+ /* Get the selectecd MAC address high register */
+ tmpreg =(*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + MacAddr));
+
+ /* Calculate the selectecd MAC address buffer */
+ Addr[5] = ((tmpreg >> 8) & (uint8_t)0xFF);
+ Addr[4] = (tmpreg & (uint8_t)0xFF);
+ /* Load the selectecd MAC address low register */
+ tmpreg =(*(__IO uint32_t *) (ETH_MAC_ADDR_LBASE + MacAddr));
+ /* Calculate the selectecd MAC address buffer */
+ Addr[3] = ((tmpreg >> 24) & (uint8_t)0xFF);
+ Addr[2] = ((tmpreg >> 16) & (uint8_t)0xFF);
+ Addr[1] = ((tmpreg >> 8 ) & (uint8_t)0xFF);
+ Addr[0] = (tmpreg & (uint8_t)0xFF);
+}
+
+/**
+ * @brief Enables or disables the Address filter module uses the specified
+ * ETHERNET MAC address for perfect filtering
+ * @param MacAddr: specifies the ETHERNET MAC address to be used for prfect filtering.
+ * This parameter can be one of the following values:
+ * @arg ETH_MAC_Address1 : MAC Address1
+ * @arg ETH_MAC_Address2 : MAC Address2
+ * @arg ETH_MAC_Address3 : MAC Address3
+ * @param NewState: new state of the specified ETHERNET MAC address use.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_MACAddressPerfectFilterCmd(uint32_t MacAddr, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_MAC_ADDRESS123(MacAddr));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ETHERNET MAC address for perfect filtering */
+ (*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + MacAddr)) |= ETH_MACA1H_AEN;
+ }
+ else
+ {
+ /* Disable the selected ETHERNET MAC address for perfect filtering */
+ (*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + MacAddr)) &=(~(uint32_t)ETH_MACA1H_AEN);
+ }
+}
+
+/**
+ * @brief Set the filter ept_type for the specified ETHERNET MAC address
+ * @param MacAddr: specifies the ETHERNET MAC address
+ * This parameter can be one of the following values:
+ * @arg ETH_MAC_Address1 : MAC Address1
+ * @arg ETH_MAC_Address2 : MAC Address2
+ * @arg ETH_MAC_Address3 : MAC Address3
+ * @param Filter: specifies the used frame received field for comparaison
+ * This parameter can be one of the following values:
+ * @arg ETH_MAC_AddressFilter_SA : MAC Address is used to compare with the
+ * SA fields of the received frame.
+ * @arg ETH_MAC_AddressFilter_DA : MAC Address is used to compare with the
+ * DA fields of the received frame.
+ * @retval None
+ */
+void ETH_MACAddressFilterConfig(uint32_t MacAddr, uint32_t Filter)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_MAC_ADDRESS123(MacAddr));
+ assert_param(IS_ETH_MAC_ADDRESS_FILTER(Filter));
+
+ if (Filter != ETH_MAC_AddressFilter_DA)
+ {
+ /* The selected ETHERNET MAC address is used to compare with the SA fields of the
+ received frame. */
+ (*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + MacAddr)) |= ETH_MACA1H_SADDR;
+ }
+ else
+ {
+ /* The selected ETHERNET MAC address is used to compare with the DA fields of the
+ received frame. */
+ (*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + MacAddr)) &=(~(uint32_t)ETH_MACA1H_SADDR);
+ }
+}
+
+/**
+ * @brief Set the filter ept_type for the specified ETHERNET MAC address
+ * @param MacAddr: specifies the ETHERNET MAC address
+ * This parameter can be one of the following values:
+ * @arg ETH_MAC_Address1 : MAC Address1
+ * @arg ETH_MAC_Address2 : MAC Address2
+ * @arg ETH_MAC_Address3 : MAC Address3
+ * @param MaskByte: specifies the used address bytes for comparaison
+ * This parameter can be any combination of the following values:
+ * @arg ETH_MAC_AddressMask_Byte6 : Mask MAC Address high reg bits [15:8].
+ * @arg ETH_MAC_AddressMask_Byte5 : Mask MAC Address high reg bits [7:0].
+ * @arg ETH_MAC_AddressMask_Byte4 : Mask MAC Address low reg bits [31:24].
+ * @arg ETH_MAC_AddressMask_Byte3 : Mask MAC Address low reg bits [23:16].
+ * @arg ETH_MAC_AddressMask_Byte2 : Mask MAC Address low reg bits [15:8].
+ * @arg ETH_MAC_AddressMask_Byte1 : Mask MAC Address low reg bits [7:0].
+ * @retval None
+ */
+void ETH_MACAddressMaskBytesFilterConfig(uint32_t MacAddr, uint32_t MaskByte)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_MAC_ADDRESS123(MacAddr));
+ assert_param(IS_ETH_MAC_ADDRESS_MASK(MaskByte));
+
+ /* Clear MBC bits in the selected MAC address high register */
+ (*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + MacAddr)) &=(~(uint32_t)ETH_MACA1H_MBCTRL);
+ /* Set the selected Filetr mask bytes */
+ (*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + MacAddr)) |= MaskByte;
+}
+/*------------------------ DMA Tx/Rx Desciptors -----------------------------*/
+
+/**
+ * @brief Initializes the DMA Tx descriptors in chain mode.
+ * @param DMATxDescTab: Pointer on the first Tx desc list
+ * @param TxBuff: Pointer on the first TxBuffer list
+ * @param TxBuffCount: Number of the used Tx desc in the list
+ * @retval None
+ */
+void ETH_DMATxDescChainInit(ETH_DMADESCTypeDef *DMATxDescTab, uint8_t* TxBuff, uint32_t TxBuffCount)
+{
+ uint32_t i = 0;
+ ETH_DMADESCTypeDef *DMATxDesc;
+
+ /* Set the DMATxDescToSet pointer with the first one of the DMATxDescTab list */
+ DMATxDescToSet = DMATxDescTab;
+ /* Fill each DMATxDesc descriptor with the right values */
+ for(i=0; i < TxBuffCount; i++)
+ {
+ /* Get the pointer on the ith member of the Tx Desc list */
+ DMATxDesc = DMATxDescTab + i;
+ /* Set Second Address Chained bit */
+ DMATxDesc->Status = ETH_DMATxDesc_TCH;
+
+ /* Set Buffer1 address pointer */
+ DMATxDesc->Buffer1Addr = (uint32_t)(&TxBuff[i*ETH_MAX_PACKET_SIZE]);
+
+ /* Initialize the next descriptor with the Next Desciptor Polling Enable */
+ if(i < (TxBuffCount-1))
+ {
+ /* Set next descriptor address register with next descriptor base address */
+ DMATxDesc->Buffer2NextDescAddr = (uint32_t)(DMATxDescTab+i+1);
+ }
+ else
+ {
+ /* For last descriptor, set next descriptor address register equal to the first descriptor base address */
+ DMATxDesc->Buffer2NextDescAddr = (uint32_t) DMATxDescTab;
+ }
+ }
+
+ /* Set Transmit Desciptor List Address Register */
+ ETH->DMATDLADDR = (uint32_t) DMATxDescTab;
+}
+
+/**
+ * @brief Initializes the DMA Tx descriptors in ring mode.
+ * @param DMATxDescTab: Pointer on the first Tx desc list
+ * @param TxBuff1: Pointer on the first TxBuffer1 list
+ * @param TxBuff2: Pointer on the first TxBuffer2 list
+ * @param TxBuffCount: Number of the used Tx desc in the list
+ * Note: see decriptor skip length defined in ETH_DMA_InitStruct
+ * for the number of Words to skip between two unchained descriptors.
+ * @retval None
+ */
+void ETH_DMATxDescRingInit(ETH_DMADESCTypeDef *DMATxDescTab, uint8_t *TxBuff1, uint8_t *TxBuff2, uint32_t TxBuffCount)
+{
+ uint32_t i = 0;
+ ETH_DMADESCTypeDef *DMATxDesc;
+
+ /* Set the DMATxDescToSet pointer with the first one of the DMATxDescTab list */
+ DMATxDescToSet = DMATxDescTab;
+ /* Fill each DMATxDesc descriptor with the right values */
+ for(i=0; i < TxBuffCount; i++)
+ {
+ /* Get the pointer on the ith member of the Tx Desc list */
+ DMATxDesc = DMATxDescTab + i;
+ /* Set Buffer1 address pointer */
+ DMATxDesc->Buffer1Addr = (uint32_t)(&TxBuff1[i*ETH_MAX_PACKET_SIZE]);
+
+ /* Set Buffer2 address pointer */
+ DMATxDesc->Buffer2NextDescAddr = (uint32_t)(&TxBuff2[i*ETH_MAX_PACKET_SIZE]);
+
+ /* Set Transmit End of Ring bit for last descriptor: The DMA returns to the base
+ address of the list, creating a Desciptor Ring */
+ if(i == (TxBuffCount-1))
+ {
+ /* Set Transmit End of Ring bit */
+ DMATxDesc->Status = ETH_DMATxDesc_TER;
+ }
+ }
+
+ /* Set Transmit Desciptor List Address Register */
+ ETH->DMATDLADDR = (uint32_t) DMATxDescTab;
+}
+
+/**
+ * @brief Checks whether the specified ETHERNET DMA Tx Desc flag is set or not.
+ * @param DMATxDesc: pointer on a DMA Tx descriptor
+ * @param ETH_DMATxDescFlag: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg ETH_DMATxDesc_OWN : OWN bit: descriptor is owned by DMA engine
+ * @arg ETH_DMATxDesc_IC : Interrupt on completetion
+ * @arg ETH_DMATxDesc_LS : Last Segment
+ * @arg ETH_DMATxDesc_FS : First Segment
+ * @arg ETH_DMATxDesc_DC : Disable CRC
+ * @arg ETH_DMATxDesc_DP : Disable Pad
+ * @arg ETH_DMATxDesc_TTSE: Transmit Time Stamp Enable
+ * @arg ETH_DMATxDesc_TER : Transmit End of Ring
+ * @arg ETH_DMATxDesc_TCH : Second Address Chained
+ * @arg ETH_DMATxDesc_TTSS: Tx Time Stamp Status
+ * @arg ETH_DMATxDesc_IHE : IP Header Error
+ * @arg ETH_DMATxDesc_ES : Error summary
+ * @arg ETH_DMATxDesc_JT : Jabber Timeout
+ * @arg ETH_DMATxDesc_FF : Frame Flushed: DMA/MTL flushed the frame due to SW flush
+ * @arg ETH_DMATxDesc_PCE : Payload Checksum Error
+ * @arg ETH_DMATxDesc_LCA : Loss of Carrier: carrier lost during tramsmission
+ * @arg ETH_DMATxDesc_NC : No Carrier: no carrier signal from the tranceiver
+ * @arg ETH_DMATxDesc_LCO : Late Collision: transmission aborted due to collision
+ * @arg ETH_DMATxDesc_EC : Excessive Collision: transmission aborted after 16 collisions
+ * @arg ETH_DMATxDesc_VF : VLAN Frame
+ * @arg ETH_DMATxDesc_CC : Collision Count
+ * @arg ETH_DMATxDesc_ED : Excessive Deferral
+ * @arg ETH_DMATxDesc_UF : Underflow Error: late data arrival from the memory
+ * @arg ETH_DMATxDesc_DB : Deferred Bit
+ * @retval The new state of ETH_DMATxDescFlag (SET or RESET).
+ */
+FlagStatus ETH_GetDMATxDescFlagStatus(ETH_DMADESCTypeDef *DMATxDesc, uint32_t ETH_DMATxDescFlag)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ETH_DMATxDESC_GET_FLAG(ETH_DMATxDescFlag));
+
+ if ((DMATxDesc->Status & ETH_DMATxDescFlag) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Returns the specified ETHERNET DMA Tx Desc collision count.
+ * @param DMATxDesc: pointer on a DMA Tx descriptor
+ * @retval The Transmit descriptor collision counter value.
+ */
+uint32_t ETH_GetDMATxDescCollisionCount(ETH_DMADESCTypeDef *DMATxDesc)
+{
+ /* Return the Receive descriptor frame length */
+ return ((DMATxDesc->Status & ETH_DMATxDesc_CC) >> ETH_DMATXDESC_COLLISION_COUNTSHIFT);
+}
+
+/**
+ * @brief Set the specified DMA Tx Desc Own bit.
+ * @param DMATxDesc: Pointer on a Tx desc
+ * @retval None
+ */
+void ETH_SetDMATxDescOwnBit(ETH_DMADESCTypeDef *DMATxDesc)
+{
+ /* Set the DMA Tx Desc Own bit */
+ DMATxDesc->Status |= ETH_DMATxDesc_OWN;
+}
+
+/**
+ * @brief Enables or disables the specified DMA Tx Desc Transmit interrupt.
+ * @param DMATxDesc: Pointer on a Tx desc
+ * @param NewState: new state of the DMA Tx Desc transmit interrupt.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMATxDescTransmitITConfig(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the DMA Tx Desc Transmit interrupt */
+ DMATxDesc->Status |= ETH_DMATxDesc_IC;
+ }
+ else
+ {
+ /* Disable the DMA Tx Desc Transmit interrupt */
+ DMATxDesc->Status &=(~(uint32_t)ETH_DMATxDesc_IC);
+ }
+}
+
+/**
+ * @brief Enables or disables the specified DMA Tx Desc Transmit interrupt.
+ * @param DMATxDesc: Pointer on a Tx desc
+ * @param DMATxDesc_FrameSegment: specifies is the actual Tx desc contain last or first segment.
+ * This parameter can be one of the following values:
+ * @arg ETH_DMATxDesc_LastSegment : actual Tx desc contain last segment
+ * @arg ETH_DMATxDesc_FirstSegment : actual Tx desc contain first segment
+ * @retval None
+ */
+void ETH_DMATxDescFrameSegmentConfig(ETH_DMADESCTypeDef *DMATxDesc, uint32_t DMATxDesc_FrameSegment)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_DMA_TXDESC_SEGMENT(DMATxDesc_FrameSegment));
+
+ /* Selects the DMA Tx Desc Frame segment */
+ DMATxDesc->Status |= DMATxDesc_FrameSegment;
+}
+
+/**
+ * @brief Selects the specified ETHERNET DMA Tx Desc Checksum Insertion.
+ * @param DMATxDesc: pointer on a DMA Tx descriptor
+ * @param DMATxDesc_Checksum: specifies is the DMA Tx desc checksum insertion.
+ * This parameter can be one of the following values:
+ * @arg ETH_DMATxDesc_ChecksumByPass : Checksum bypass
+ * @arg ETH_DMATxDesc_ChecksumIPV4Header : IPv4 header checksum
+ * @arg ETH_DMATxDesc_ChecksumTCPUDPICMPSegment : TCP/UDP/ICMP checksum. Pseudo header checksum is assumed to be present
+ * @arg ETH_DMATxDesc_ChecksumTCPUDPICMPFull : TCP/UDP/ICMP checksum fully in hardware including pseudo header
+ * @retval None
+ */
+void ETH_DMATxDescChecksumInsertionConfig(ETH_DMADESCTypeDef *DMATxDesc, uint32_t DMATxDesc_Checksum)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_DMA_TXDESC_CHECKSUM(DMATxDesc_Checksum));
+
+ /* Set the selected DMA Tx desc checksum insertion control */
+ DMATxDesc->Status |= DMATxDesc_Checksum;
+}
+
+/**
+ * @brief Enables or disables the DMA Tx Desc CRC.
+ * @param DMATxDesc: pointer on a DMA Tx descriptor
+ * @param NewState: new state of the specified DMA Tx Desc CRC.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMATxDescCRCCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DMA Tx Desc CRC */
+ DMATxDesc->Status &= (~(uint32_t)ETH_DMATxDesc_DC);
+ }
+ else
+ {
+ /* Disable the selected DMA Tx Desc CRC */
+ DMATxDesc->Status |= ETH_DMATxDesc_DC;
+ }
+}
+
+/**
+ * @brief Enables or disables the DMA Tx Desc end of ring.
+ * @param DMATxDesc: pointer on a DMA Tx descriptor
+ * @param NewState: new state of the specified DMA Tx Desc end of ring.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMATxDescEndOfRingCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DMA Tx Desc end of ring */
+ DMATxDesc->Status |= ETH_DMATxDesc_TER;
+ }
+ else
+ {
+ /* Disable the selected DMA Tx Desc end of ring */
+ DMATxDesc->Status &= (~(uint32_t)ETH_DMATxDesc_TER);
+ }
+}
+
+/**
+ * @brief Enables or disables the DMA Tx Desc second address chained.
+ * @param DMATxDesc: pointer on a DMA Tx descriptor
+ * @param NewState: new state of the specified DMA Tx Desc second address chained.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMATxDescSecondAddressChainedCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DMA Tx Desc second address chained */
+ DMATxDesc->Status |= ETH_DMATxDesc_TCH;
+ }
+ else
+ {
+ /* Disable the selected DMA Tx Desc second address chained */
+ DMATxDesc->Status &=(~(uint32_t)ETH_DMATxDesc_TCH);
+ }
+}
+
+/**
+ * @brief Enables or disables the DMA Tx Desc padding for frame shorter than 64 bytes.
+ * @param DMATxDesc: pointer on a DMA Tx descriptor
+ * @param NewState: new state of the specified DMA Tx Desc padding for frame shorter than 64 bytes.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMATxDescShortFramePaddingCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DMA Tx Desc padding for frame shorter than 64 bytes */
+ DMATxDesc->Status &= (~(uint32_t)ETH_DMATxDesc_DP);
+ }
+ else
+ {
+ /* Disable the selected DMA Tx Desc padding for frame shorter than 64 bytes*/
+ DMATxDesc->Status |= ETH_DMATxDesc_DP;
+ }
+}
+
+/**
+ * @brief Enables or disables the DMA Tx Desc time stamp.
+ * @param DMATxDesc: pointer on a DMA Tx descriptor
+ * @param NewState: new state of the specified DMA Tx Desc time stamp.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMATxDescTimeStampCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DMA Tx Desc time stamp */
+ DMATxDesc->Status |= ETH_DMATxDesc_TTSE;
+ }
+ else
+ {
+ /* Disable the selected DMA Tx Desc time stamp */
+ DMATxDesc->Status &=(~(uint32_t)ETH_DMATxDesc_TTSE);
+ }
+}
+
+/**
+ * @brief Configures the specified DMA Tx Desc buffer1 and buffer2 sizes.
+ * @param DMATxDesc: Pointer on a Tx desc
+ * @param BufferSize1: specifies the Tx desc buffer1 size.
+ * @param BufferSize2: specifies the Tx desc buffer2 size (put "0" if not used).
+ * @retval None
+ */
+void ETH_DMATxDescBufferSizeConfig(ETH_DMADESCTypeDef *DMATxDesc, uint32_t BufferSize1, uint32_t BufferSize2)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_DMATxDESC_BUFFER_SIZE(BufferSize1));
+ assert_param(IS_ETH_DMATxDESC_BUFFER_SIZE(BufferSize2));
+
+ /* Set the DMA Tx Desc buffer1 and buffer2 sizes values */
+ DMATxDesc->ControlBufferSize |= (BufferSize1 | (BufferSize2 << ETH_DMARXDESC_BUFFER2_SIZESHIFT));
+}
+
+/**
+ * @brief Initializes the DMA Rx descriptors in chain mode.
+ * @param DMARxDescTab: Pointer on the first Rx desc list
+ * @param RxBuff: Pointer on the first RxBuffer list
+ * @param RxBuffCount: Number of the used Rx desc in the list
+ * @retval None
+ */
+void ETH_DMARxDescChainInit(ETH_DMADESCTypeDef *DMARxDescTab, uint8_t *RxBuff, uint32_t RxBuffCount)
+{
+ uint32_t i = 0;
+ ETH_DMADESCTypeDef *DMARxDesc;
+
+ /* Set the DMARxDescToGet pointer with the first one of the DMARxDescTab list */
+ DMARxDescToGet = DMARxDescTab;
+ /* Fill each DMARxDesc descriptor with the right values */
+ for(i=0; i < RxBuffCount; i++)
+ {
+ /* Get the pointer on the ith member of the Rx Desc list */
+ DMARxDesc = DMARxDescTab+i;
+ /* Set Own bit of the Rx descriptor Status */
+ DMARxDesc->Status = ETH_DMARxDesc_OWN;
+
+ /* Set Buffer1 size and Second Address Chained bit */
+ DMARxDesc->ControlBufferSize = ETH_DMARxDesc_RCH | (uint32_t)ETH_MAX_PACKET_SIZE;
+ /* Set Buffer1 address pointer */
+ DMARxDesc->Buffer1Addr = (uint32_t)(&RxBuff[i*ETH_MAX_PACKET_SIZE]);
+
+ /* Initialize the next descriptor with the Next Desciptor Polling Enable */
+ if(i < (RxBuffCount-1))
+ {
+ /* Set next descriptor address register with next descriptor base address */
+ DMARxDesc->Buffer2NextDescAddr = (uint32_t)(DMARxDescTab+i+1);
+ }
+ else
+ {
+ /* For last descriptor, set next descriptor address register equal to the first descriptor base address */
+ DMARxDesc->Buffer2NextDescAddr = (uint32_t)(DMARxDescTab);
+ }
+ }
+
+ /* Set Receive Desciptor List Address Register */
+ ETH->DMARDLADDR = (uint32_t) DMARxDescTab;
+}
+
+/**
+ * @brief Initializes the DMA Rx descriptors in ring mode.
+ * @param DMARxDescTab: Pointer on the first Rx desc list
+ * @param RxBuff1: Pointer on the first RxBuffer1 list
+ * @param RxBuff2: Pointer on the first RxBuffer2 list
+ * @param RxBuffCount: Number of the used Rx desc in the list
+ * Note: see decriptor skip length defined in ETH_DMA_InitStruct
+ * for the number of Words to skip between two unchained descriptors.
+ * @retval None
+ */
+void ETH_DMARxDescRingInit(ETH_DMADESCTypeDef *DMARxDescTab, uint8_t *RxBuff1, uint8_t *RxBuff2, uint32_t RxBuffCount)
+{
+ uint32_t i = 0;
+ ETH_DMADESCTypeDef *DMARxDesc;
+ /* Set the DMARxDescToGet pointer with the first one of the DMARxDescTab list */
+ DMARxDescToGet = DMARxDescTab;
+ /* Fill each DMARxDesc descriptor with the right values */
+ for(i=0; i < RxBuffCount; i++)
+ {
+ /* Get the pointer on the ith member of the Rx Desc list */
+ DMARxDesc = DMARxDescTab+i;
+ /* Set Own bit of the Rx descriptor Status */
+ DMARxDesc->Status = ETH_DMARxDesc_OWN;
+ /* Set Buffer1 size */
+ DMARxDesc->ControlBufferSize = ETH_MAX_PACKET_SIZE;
+ /* Set Buffer1 address pointer */
+ DMARxDesc->Buffer1Addr = (uint32_t)(&RxBuff1[i*ETH_MAX_PACKET_SIZE]);
+
+ /* Set Buffer2 address pointer */
+ DMARxDesc->Buffer2NextDescAddr = (uint32_t)(&RxBuff2[i*ETH_MAX_PACKET_SIZE]);
+
+ /* Set Receive End of Ring bit for last descriptor: The DMA returns to the base
+ address of the list, creating a Desciptor Ring */
+ if(i == (RxBuffCount-1))
+ {
+ /* Set Receive End of Ring bit */
+ DMARxDesc->ControlBufferSize |= ETH_DMARxDesc_RER;
+ }
+ }
+
+ /* Set Receive Desciptor List Address Register */
+ ETH->DMARDLADDR = (uint32_t) DMARxDescTab;
+}
+
+/**
+ * @brief Checks whether the specified ETHERNET Rx Desc flag is set or not.
+ * @param DMARxDesc: pointer on a DMA Rx descriptor
+ * @param ETH_DMARxDescFlag: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg ETH_DMARxDesc_OWN: OWN bit: descriptor is owned by DMA engine
+ * @arg ETH_DMARxDesc_AFM: DA Filter Fail for the rx frame
+ * @arg ETH_DMARxDesc_ES: Error summary
+ * @arg ETH_DMARxDesc_DE: Desciptor error: no more descriptors for receive frame
+ * @arg ETH_DMARxDesc_SAF: SA Filter Fail for the received frame
+ * @arg ETH_DMARxDesc_LE: Frame size not matching with length field
+ * @arg ETH_DMARxDesc_OE: Overflow Error: Frame was damaged due to buffer overflow
+ * @arg ETH_DMARxDesc_VLAN: VLAN Tag: received frame is a VLAN frame
+ * @arg ETH_DMARxDesc_FS: First descriptor of the frame
+ * @arg ETH_DMARxDesc_LS: Last descriptor of the frame
+ * @arg ETH_DMARxDesc_IPV4HCE: IPC Checksum Error/Giant Frame: Rx Ipv4 header checksum error
+ * @arg ETH_DMARxDesc_LC: Late collision occurred during reception
+ * @arg ETH_DMARxDesc_FT: Frame ept_type - Ethernet, otherwise 802.3
+ * @arg ETH_DMARxDesc_RWT: Receive Watchdog Timeout: watchdog timer expired during reception
+ * @arg ETH_DMARxDesc_RE: Receive error: error reported by MII interface
+ * @arg ETH_DMARxDesc_DE: Dribble bit error: frame contains non int multiple of 8 bits
+ * @arg ETH_DMARxDesc_CE: CRC error
+ * @arg ETH_DMARxDesc_MAMPCE: Rx MAC Address/Payload Checksum Error: Rx MAC address matched/ Rx Payload Checksum Error
+ * @retval The new state of ETH_DMARxDescFlag (SET or RESET).
+ */
+FlagStatus ETH_GetDMARxDescFlagStatus(ETH_DMADESCTypeDef *DMARxDesc, uint32_t ETH_DMARxDescFlag)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ETH_DMARxDESC_GET_FLAG(ETH_DMARxDescFlag));
+ if ((DMARxDesc->Status & ETH_DMARxDescFlag) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Set the specified DMA Rx Desc Own bit.
+ * @param DMARxDesc: Pointer on a Rx desc
+ * @retval None
+ */
+void ETH_SetDMARxDescOwnBit(ETH_DMADESCTypeDef *DMARxDesc)
+{
+ /* Set the DMA Rx Desc Own bit */
+ DMARxDesc->Status |= ETH_DMARxDesc_OWN;
+}
+
+/**
+ * @brief Returns the specified DMA Rx Desc frame length.
+ * @param DMARxDesc: pointer on a DMA Rx descriptor
+ * @retval The Rx descriptor received frame length.
+ */
+uint32_t ETH_GetDMARxDescFrameLength(ETH_DMADESCTypeDef *DMARxDesc)
+{
+ /* Return the Receive descriptor frame length */
+ return ((DMARxDesc->Status & ETH_DMARxDesc_FL) >> ETH_DMARXDESC_FRAME_LENGTHSHIFT);
+}
+
+/**
+ * @brief Enables or disables the specified DMA Rx Desc receive interrupt.
+ * @param DMARxDesc: Pointer on a Rx desc
+ * @param NewState: new state of the specified DMA Rx Desc interrupt.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMARxDescReceiveITConfig(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the DMA Rx Desc receive interrupt */
+ DMARxDesc->ControlBufferSize &=(~(uint32_t)ETH_DMARxDesc_DIC);
+ }
+ else
+ {
+ /* Disable the DMA Rx Desc receive interrupt */
+ DMARxDesc->ControlBufferSize |= ETH_DMARxDesc_DIC;
+ }
+}
+
+/**
+ * @brief Enables or disables the DMA Rx Desc end of ring.
+ * @param DMARxDesc: pointer on a DMA Rx descriptor
+ * @param NewState: new state of the specified DMA Rx Desc end of ring.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMARxDescEndOfRingCmd(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DMA Rx Desc end of ring */
+ DMARxDesc->ControlBufferSize |= ETH_DMARxDesc_RER;
+ }
+ else
+ {
+ /* Disable the selected DMA Rx Desc end of ring */
+ DMARxDesc->ControlBufferSize &=(~(uint32_t)ETH_DMARxDesc_RER);
+ }
+}
+
+/**
+ * @brief Enables or disables the DMA Rx Desc second address chained.
+ * @param DMARxDesc: pointer on a DMA Rx descriptor
+ * @param NewState: new state of the specified DMA Rx Desc second address chained.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMARxDescSecondAddressChainedCmd(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected DMA Rx Desc second address chained */
+ DMARxDesc->ControlBufferSize |= ETH_DMARxDesc_RCH;
+ }
+ else
+ {
+ /* Disable the selected DMA Rx Desc second address chained */
+ DMARxDesc->ControlBufferSize &=(~(uint32_t)ETH_DMARxDesc_RCH);
+ }
+}
+
+/**
+ * @brief Returns the specified ETHERNET DMA Rx Desc buffer size.
+ * @param DMARxDesc: pointer on a DMA Rx descriptor
+ * @param DMARxDesc_Buffer: specifies the DMA Rx Desc buffer.
+ * This parameter can be any one of the following values:
+ * @arg ETH_DMARxDesc_Buffer1 : DMA Rx Desc Buffer1
+ * @arg ETH_DMARxDesc_Buffer2 : DMA Rx Desc Buffer2
+ * @retval The Receive descriptor frame length.
+ */
+uint32_t ETH_GetDMARxDescBufferSize(ETH_DMADESCTypeDef *DMARxDesc, uint32_t DMARxDesc_Buffer)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_DMA_RXDESC_BUFFER(DMARxDesc_Buffer));
+
+ if(DMARxDesc_Buffer != ETH_DMARxDesc_Buffer1)
+ {
+ /* Return the DMA Rx Desc buffer2 size */
+ return ((DMARxDesc->ControlBufferSize & ETH_DMARxDesc_RBS2) >> ETH_DMARXDESC_BUFFER2_SIZESHIFT);
+ }
+ else
+ {
+ /* Return the DMA Rx Desc buffer1 size */
+ return (DMARxDesc->ControlBufferSize & ETH_DMARxDesc_RBS1);
+ }
+}
+
+/*--------------------------------- DMA ------------------------------------*/
+/**
+ * @brief Resets all MAC subsystem internal registers and logic.
+ * @param None
+ * @retval None
+ */
+void ETH_SoftwareReset(void)
+{
+ /* Set the SWR bit: resets all MAC subsystem internal registers and logic */
+ /* After reset all the registers holds their respective reset values */
+ ETH->DMABM |= ETH_DMABM_SWRST;
+}
+
+/**
+ * @brief Checks whether the ETHERNET software reset bit is set or not.
+ * @param None
+ * @retval The new state of DMA Bus Mode register SR bit (SET or RESET).
+ */
+FlagStatus ETH_GetSoftwareResetStatus(void)
+{
+ FlagStatus bitstatus = RESET;
+ if((ETH->DMABM & ETH_DMABM_SWRST) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Checks whether the specified ETHERNET DMA flag is set or not.
+ * @param ETH_DMA_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg ETH_DMA_FLAG_TST : Time-stamp trigger flag
+ * @arg ETH_DMA_FLAG_PMT : PMT flag
+ * @arg ETH_DMA_FLAG_MMC : MMC flag
+ * @arg ETH_DMA_FLAG_DataTransferError : Error bits 0-data buffer, 1-desc. access
+ * @arg ETH_DMA_FLAG_ReadWriteError : Error bits 0-write trnsf, 1-read transfr
+ * @arg ETH_DMA_FLAG_AccessError : Error bits 0-Rx DMA, 1-Tx DMA
+ * @arg ETH_DMA_FLAG_NIS : Normal interrupt summary flag
+ * @arg ETH_DMA_FLAG_AIS : Abnormal interrupt summary flag
+ * @arg ETH_DMA_FLAG_ER : Early receive flag
+ * @arg ETH_DMA_FLAG_FBE : Fatal bus error flag
+ * @arg ETH_DMA_FLAG_ET : Early transmit flag
+ * @arg ETH_DMA_FLAG_RWT : Receive watchdog timeout flag
+ * @arg ETH_DMA_FLAG_RPS : Receive process stopped flag
+ * @arg ETH_DMA_FLAG_RBU : Receive buffer unavailable flag
+ * @arg ETH_DMA_FLAG_R : Receive flag
+ * @arg ETH_DMA_FLAG_TU : Underflow flag
+ * @arg ETH_DMA_FLAG_RO : Overflow flag
+ * @arg ETH_DMA_FLAG_TJT : Transmit jabber timeout flag
+ * @arg ETH_DMA_FLAG_TBU : Transmit buffer unavailable flag
+ * @arg ETH_DMA_FLAG_TPS : Transmit process stopped flag
+ * @arg ETH_DMA_FLAG_T : Transmit flag
+ * @retval The new state of ETH_DMA_FLAG (SET or RESET).
+ */
+FlagStatus ETH_GetDMAFlagStatus(uint32_t ETH_DMA_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ETH_DMA_GET_IT(ETH_DMA_FLAG));
+ if ((ETH->DMASTS & ETH_DMA_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the ETHERNETs DMA pending flag.
+ * @param ETH_DMA_FLAG: specifies the flag to clear.
+ * This parameter can be any combination of the following values:
+ * @arg ETH_DMA_FLAG_NIS : Normal interrupt summary flag
+ * @arg ETH_DMA_FLAG_AIS : Abnormal interrupt summary flag
+ * @arg ETH_DMA_FLAG_ER : Early receive flag
+ * @arg ETH_DMA_FLAG_FBE : Fatal bus error flag
+ * @arg ETH_DMA_FLAG_ETI : Early transmit flag
+ * @arg ETH_DMA_FLAG_RWT : Receive watchdog timeout flag
+ * @arg ETH_DMA_FLAG_RPS : Receive process stopped flag
+ * @arg ETH_DMA_FLAG_RBU : Receive buffer unavailable flag
+ * @arg ETH_DMA_FLAG_R : Receive flag
+ * @arg ETH_DMA_FLAG_TU : Transmit Underflow flag
+ * @arg ETH_DMA_FLAG_RO : Receive Overflow flag
+ * @arg ETH_DMA_FLAG_TJT : Transmit jabber timeout flag
+ * @arg ETH_DMA_FLAG_TBU : Transmit buffer unavailable flag
+ * @arg ETH_DMA_FLAG_TPS : Transmit process stopped flag
+ * @arg ETH_DMA_FLAG_T : Transmit flag
+ * @retval None
+ */
+void ETH_DMAClearFlag(uint32_t ETH_DMA_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_DMA_FLAG(ETH_DMA_FLAG));
+
+ /* Clear the selected ETHERNET DMA FLAG */
+ ETH->DMASTS = (uint32_t) ETH_DMA_FLAG;
+}
+
+/**
+ * @brief Checks whether the specified ETHERNET DMA interrupt has occured or not.
+ * @param ETH_DMA_IT: specifies the interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg ETH_DMA_INT_TST : Time-stamp trigger interrupt
+ * @arg ETH_DMA_INT_PMT : PMT interrupt
+ * @arg ETH_DMA_INT_MMC : MMC interrupt
+ * @arg ETH_DMA_INT_NIS : Normal interrupt summary
+ * @arg ETH_DMA_INT_AIS : Abnormal interrupt summary
+ * @arg ETH_DMA_INT_ER : Early receive interrupt
+ * @arg ETH_DMA_INT_FBE : Fatal bus error interrupt
+ * @arg ETH_DMA_INT_ET : Early transmit interrupt
+ * @arg ETH_DMA_INT_RWT : Receive watchdog timeout interrupt
+ * @arg ETH_DMA_INT_RPS : Receive process stopped interrupt
+ * @arg ETH_DMA_INT_RBU : Receive buffer unavailable interrupt
+ * @arg ETH_DMA_INT_R : Receive interrupt
+ * @arg ETH_DMA_INT_TU : Underflow interrupt
+ * @arg ETH_DMA_INT_RO : Overflow interrupt
+ * @arg ETH_DMA_INT_TJT : Transmit jabber timeout interrupt
+ * @arg ETH_DMA_INT_TBU : Transmit buffer unavailable interrupt
+ * @arg ETH_DMA_INT_TPS : Transmit process stopped interrupt
+ * @arg ETH_DMA_INT_T : Transmit interrupt
+ * @retval The new state of ETH_DMA_IT (SET or RESET).
+ */
+ITStatus ETH_GetDMAITStatus(uint32_t ETH_DMA_IT)
+{
+ ITStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ETH_DMA_GET_IT(ETH_DMA_IT));
+ if ((ETH->DMASTS & ETH_DMA_IT) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the ETHERNETs DMA IT pending bit.
+ * @param ETH_DMA_IT: specifies the interrupt pending bit to clear.
+ * This parameter can be any combination of the following values:
+ * @arg ETH_DMA_INT_NIS : Normal interrupt summary
+ * @arg ETH_DMA_INT_AIS : Abnormal interrupt summary
+ * @arg ETH_DMA_INT_ER : Early receive interrupt
+ * @arg ETH_DMA_INT_FBE : Fatal bus error interrupt
+ * @arg ETH_DMA_IT_ETI : Early transmit interrupt
+ * @arg ETH_DMA_INT_RWT : Receive watchdog timeout interrupt
+ * @arg ETH_DMA_INT_RPS : Receive process stopped interrupt
+ * @arg ETH_DMA_INT_RBU : Receive buffer unavailable interrupt
+ * @arg ETH_DMA_INT_R : Receive interrupt
+ * @arg ETH_DMA_INT_TU : Transmit Underflow interrupt
+ * @arg ETH_DMA_INT_RO : Receive Overflow interrupt
+ * @arg ETH_DMA_INT_TJT : Transmit jabber timeout interrupt
+ * @arg ETH_DMA_INT_TBU : Transmit buffer unavailable interrupt
+ * @arg ETH_DMA_INT_TPS : Transmit process stopped interrupt
+ * @arg ETH_DMA_INT_T : Transmit interrupt
+ * @retval None
+ */
+void ETH_DMAClearITPendingBit(uint32_t ETH_DMA_IT)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_DMA_IT(ETH_DMA_IT));
+
+ /* Clear the selected ETHERNET DMA IT */
+ ETH->DMASTS = (uint32_t) ETH_DMA_IT;
+}
+
+/**
+ * @brief Returns the ETHERNET DMA Transmit Process State.
+ * @param None
+ * @retval The new ETHERNET DMA Transmit Process State:
+ * This can be one of the following values:
+ * - ETH_DMA_TransmitProcess_Stopped : Stopped - Reset or Stop Tx Command issued
+ * - ETH_DMA_TransmitProcess_Fetching : Running - fetching the Tx descriptor
+ * - ETH_DMA_TransmitProcess_Waiting : Running - waiting for status
+ * - ETH_DMA_TransmitProcess_Reading : unning - reading the data from host memory
+ * - ETH_DMA_TransmitProcess_Suspended : Suspended - Tx Desciptor unavailabe
+ * - ETH_DMA_TransmitProcess_Closing : Running - closing Rx descriptor
+ */
+uint32_t ETH_GetTransmitProcessState(void)
+{
+ return ((uint32_t)(ETH->DMASTS & ETH_DMASTS_TX));
+}
+
+/**
+ * @brief Returns the ETHERNET DMA Receive Process State.
+ * @param None
+ * @retval The new ETHERNET DMA Receive Process State:
+ * This can be one of the following values:
+ * - ETH_DMA_ReceiveProcess_Stopped : Stopped - Reset or Stop Rx Command issued
+ * - ETH_DMA_ReceiveProcess_Fetching : Running - fetching the Rx descriptor
+ * - ETH_DMA_ReceiveProcess_Waiting : Running - waiting for packet
+ * - ETH_DMA_ReceiveProcess_Suspended : Suspended - Rx Desciptor unavailable
+ * - ETH_DMA_ReceiveProcess_Closing : Running - closing descriptor
+ * - ETH_DMA_ReceiveProcess_Queuing : Running - queuing the recieve frame into host memory
+ */
+uint32_t ETH_GetReceiveProcessState(void)
+{
+ return ((uint32_t)(ETH->DMASTS & ETH_DMASTS_RECV));
+}
+
+/**
+ * @brief Clears the ETHERNET transmit FIFO.
+ * @param None
+ * @retval None
+ */
+void ETH_FlushTransmitFIFO(void)
+{
+ /* Set the Flush Transmit FIFO bit */
+ ETH->DMAOPM |= ETH_DMAOPM_FTXF;
+}
+
+/**
+ * @brief Checks whether the ETHERNET transmit FIFO bit is cleared or not.
+ * @param None
+ * @retval The new state of ETHERNET flush transmit FIFO bit (SET or RESET).
+ */
+FlagStatus ETH_GetFlushTransmitFIFOStatus(void)
+{
+ FlagStatus bitstatus = RESET;
+ if ((ETH->DMAOPM & ETH_DMAOPM_FTXF) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Enables or disables the DMA transmission.
+ * @param NewState: new state of the DMA transmission.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMATransmissionCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the DMA transmission */
+ ETH->DMAOPM |= ETH_DMAOPM_STXE;
+ }
+ else
+ {
+ /* Disable the DMA transmission */
+ ETH->DMAOPM &= ~ETH_DMAOPM_STXE;
+ }
+}
+
+/**
+ * @brief Enables or disables the DMA reception.
+ * @param NewState: new state of the DMA reception.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMAReceptionCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the DMA reception */
+ ETH->DMAOPM |= ETH_DMAOPM_SRXE;
+ }
+ else
+ {
+ /* Disable the DMA reception */
+ ETH->DMAOPM &= ~ETH_DMAOPM_SRXE;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified ETHERNET DMA interrupts.
+ * @param ETH_DMA_IT: specifies the ETHERNET DMA interrupt sources to be
+ * enabled or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg ETH_DMA_INT_NIS : Normal interrupt summary
+ * @arg ETH_DMA_INT_AIS : Abnormal interrupt summary
+ * @arg ETH_DMA_INT_ER : Early receive interrupt
+ * @arg ETH_DMA_INT_FBE : Fatal bus error interrupt
+ * @arg ETH_DMA_INT_ET : Early transmit interrupt
+ * @arg ETH_DMA_INT_RWT : Receive watchdog timeout interrupt
+ * @arg ETH_DMA_INT_RPS : Receive process stopped interrupt
+ * @arg ETH_DMA_INT_RBU : Receive buffer unavailable interrupt
+ * @arg ETH_DMA_INT_R : Receive interrupt
+ * @arg ETH_DMA_INT_TU : Underflow interrupt
+ * @arg ETH_DMA_INT_RO : Overflow interrupt
+ * @arg ETH_DMA_INT_TJT : Transmit jabber timeout interrupt
+ * @arg ETH_DMA_INT_TBU : Transmit buffer unavailable interrupt
+ * @arg ETH_DMA_INT_TPS : Transmit process stopped interrupt
+ * @arg ETH_DMA_INT_T : Transmit interrupt
+ * @param NewState: new state of the specified ETHERNET DMA interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_DMAITConfig(uint32_t ETH_DMA_IT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_DMA_IT(ETH_DMA_IT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ETHERNET DMA interrupts */
+ ETH->DMAIE |= ETH_DMA_IT;
+ }
+ else
+ {
+ /* Disable the selected ETHERNET DMA interrupts */
+ ETH->DMAIE &=(~(uint32_t)ETH_DMA_IT);
+ }
+}
+
+/**
+ * @brief Checks whether the specified ETHERNET DMA overflow flag is set or not.
+ * @param ETH_DMA_Overflow: specifies the DMA overflow flag to check.
+ * This parameter can be one of the following values:
+ * @arg ETH_DMA_Overflow_RxFIFOCounter : Overflow for FIFO Overflow Counter
+ * @arg ETH_DMA_Overflow_MissedFrameCounter : Overflow for Missed Frame Counter
+ * @retval The new state of ETHERNET DMA overflow Flag (SET or RESET).
+ */
+FlagStatus ETH_GetDMAOverflowStatus(uint32_t ETH_DMA_Overflow)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ETH_DMA_GET_OVERFLOW(ETH_DMA_Overflow));
+
+ if ((ETH->DMAMFBOCNT & ETH_DMA_Overflow) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Get the ETHERNET DMA Rx Overflow Missed Frame Counter value.
+ * @param None
+ * @retval The value of Rx overflow Missed Frame Counter.
+ */
+uint32_t ETH_GetRxOverflowMissedFrameCounter(void)
+{
+ return ((uint32_t)((ETH->DMAMFBOCNT & ETH_DMAMFBOCNT_MFA)>>ETH_DMA_RX_OVERFLOW_MISSEDFRAMES_COUNTERSHIFT));
+}
+
+/**
+ * @brief Get the ETHERNET DMA Buffer Unavailable Missed Frame Counter value.
+ * @param None
+ * @retval The value of Buffer unavailable Missed Frame Counter.
+ */
+uint32_t ETH_GetBufferUnavailableMissedFrameCounter(void)
+{
+ return ((uint32_t)(ETH->DMAMFBOCNT) & ETH_DMAMFBOCNT_MFC);
+}
+
+/**
+ * @brief Get the ETHERNET DMA DMACHTDR register value.
+ * @param None
+ * @retval The value of the current Tx desc start address.
+ */
+uint32_t ETH_GetCurrentTxDescStartAddress(void)
+{
+ return ((uint32_t)(ETH->DMACTD));
+}
+
+/**
+ * @brief Get the ETHERNET DMA DMACHRDR register value.
+ * @param None
+ * @retval The value of the current Rx desc start address.
+ */
+uint32_t ETH_GetCurrentRxDescStartAddress(void)
+{
+ return ((uint32_t)(ETH->DMACRD));
+}
+
+/**
+ * @brief Get the ETHERNET DMA DMACHTBAR register value.
+ * @param None
+ * @retval The value of the current Tx buffer address.
+ */
+uint32_t ETH_GetCurrentTxBufferAddress(void)
+{
+ return ((uint32_t)(ETH->DMACTBADDR));
+}
+
+/**
+ * @brief Get the ETHERNET DMA DMACHRBAR register value.
+ * @param None
+ * @retval The value of the current Rx buffer address.
+ */
+uint32_t ETH_GetCurrentRxBufferAddress(void)
+{
+ return ((uint32_t)(ETH->DMACRBADDR));
+}
+
+/**
+ * @brief Resumes the DMA Transmission by writing to the DmaTxPollDemand register
+ * (the data written could be anything). This forces the DMA to resume transmission.
+ * @param None
+ * @retval None.
+ */
+void ETH_ResumeDMATransmission(void)
+{
+ ETH->DMATPD = 0;
+}
+
+/**
+ * @brief Resumes the DMA Transmission by writing to the DmaRxPollDemand register
+ * (the data written could be anything). This forces the DMA to resume reception.
+ * @param None
+ * @retval None.
+ */
+void ETH_ResumeDMAReception(void)
+{
+ ETH->DMARPD = 0;
+}
+
+/*--------------------------------- PMT ------------------------------------*/
+/**
+ * @brief Reset Wakeup frame filter register pointer.
+ * @param None
+ * @retval None
+ */
+void ETH_ResetWakeUpFrameFilterRegisterPointer(void)
+{
+ /* Resets the Remote Wake-up Frame Filter register pointer to 0x0000 */
+ ETH->MACPMTCTRLSTS |= ETH_MACPMTCTRLSTS_WFFPR;
+}
+
+/**
+ * @brief Populates the remote wakeup frame registers.
+ * @param Buffer: Pointer on remote WakeUp Frame Filter Register buffer data (8 words).
+ * @retval None
+ */
+void ETH_SetWakeUpFrameFilterRegister(uint32_t *Buffer)
+{
+ uint32_t i = 0;
+
+ /* Fill Remote Wake-up Frame Filter register with Buffer data */
+ for(i =0; iMACRWFF = Buffer[i];
+ }
+}
+
+/**
+ * @brief Enables or disables any unicast packet filtered by the MAC address
+ * recognition to be a wake-up frame.
+ * @param NewState: new state of the MAC Global Unicast Wake-Up.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_GlobalUnicastWakeUpCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the MAC Global Unicast Wake-Up */
+ ETH->MACPMTCTRLSTS |= ETH_MACPMTCTRLSTS_GLBU;
+ }
+ else
+ {
+ /* Disable the MAC Global Unicast Wake-Up */
+ ETH->MACPMTCTRLSTS &= ~ETH_MACPMTCTRLSTS_GLBU;
+ }
+}
+
+/**
+ * @brief Checks whether the specified ETHERNET PMT flag is set or not.
+ * @param ETH_PMT_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg ETH_PMT_FLAG_WUFFRPR : Wake-Up Frame Filter Register Poniter Reset
+ * @arg ETH_PMT_FLAG_WUFR : Wake-Up Frame Received
+ * @arg ETH_PMT_FLAG_MPR : Magic Packet Received
+ * @retval The new state of ETHERNET PMT Flag (SET or RESET).
+ */
+FlagStatus ETH_GetPMTFlagStatus(uint32_t ETH_PMT_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ETH_PMT_GET_FLAG(ETH_PMT_FLAG));
+
+ if ((ETH->MACPMTCTRLSTS & ETH_PMT_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Enables or disables the MAC Wake-Up Frame Detection.
+ * @param NewState: new state of the MAC Wake-Up Frame Detection.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_WakeUpFrameDetectionCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the MAC Wake-Up Frame Detection */
+ ETH->MACPMTCTRLSTS |= ETH_MACPMTCTRLSTS_WFEN;
+ }
+ else
+ {
+ /* Disable the MAC Wake-Up Frame Detection */
+ ETH->MACPMTCTRLSTS &= ~ETH_MACPMTCTRLSTS_WFEN;
+ }
+}
+
+/**
+ * @brief Enables or disables the MAC Magic Packet Detection.
+ * @param NewState: new state of the MAC Magic Packet Detection.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_MagicPacketDetectionCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the MAC Magic Packet Detection */
+ ETH->MACPMTCTRLSTS |= ETH_MACPMTCTRLSTS_MPEN;
+ }
+ else
+ {
+ /* Disable the MAC Magic Packet Detection */
+ ETH->MACPMTCTRLSTS &= ~ETH_MACPMTCTRLSTS_MPEN;
+ }
+}
+
+/**
+ * @brief Enables or disables the MAC Power Down.
+ * @param NewState: new state of the MAC Power Down.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_PowerDownCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the MAC Power Down */
+ /* This puts the MAC in power down mode */
+ ETH->MACPMTCTRLSTS |= ETH_MACPMTCTRLSTS_PD;
+ }
+ else
+ {
+ /* Disable the MAC Power Down */
+ ETH->MACPMTCTRLSTS &= ~ETH_MACPMTCTRLSTS_PD;
+ }
+}
+
+/*--------------------------------- MMC ------------------------------------*/
+/**
+ * @brief Enables or disables the MMC Counter Freeze.
+ * @param NewState: new state of the MMC Counter Freeze.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_MMCCounterFreezeCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the MMC Counter Freeze */
+ ETH->MMCCTRL |= ETH_MMCCTRL_MCNTF;
+ }
+ else
+ {
+ /* Disable the MMC Counter Freeze */
+ ETH->MMCCTRL &= ~ETH_MMCCTRL_MCNTF;
+ }
+}
+
+/**
+ * @brief Enables or disables the MMC Reset On Read.
+ * @param NewState: new state of the MMC Reset On Read.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_MMCResetOnReadCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the MMC Counter reset on read */
+ ETH->MMCCTRL |= ETH_MMCCTRL_RSTOR;
+ }
+ else
+ {
+ /* Disable the MMC Counter reset on read */
+ ETH->MMCCTRL &= ~ETH_MMCCTRL_RSTOR;
+ }
+}
+
+/**
+ * @brief Enables or disables the MMC Counter Stop Rollover.
+ * @param NewState: new state of the MMC Counter Stop Rollover.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_MMCCounterRolloverCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Disable the MMC Counter Stop Rollover */
+ ETH->MMCCTRL &= ~ETH_MMCCTRL_CSR;
+ }
+ else
+ {
+ /* Enable the MMC Counter Stop Rollover */
+ ETH->MMCCTRL |= ETH_MMCCTRL_CSR;
+ }
+}
+
+/**
+ * @brief Resets the MMC Counters.
+ * @param None
+ * @retval None
+ */
+void ETH_MMCCountersReset(void)
+{
+ /* Resets the MMC Counters */
+ ETH->MMCCTRL |= ETH_MMCCTRL_CNTR;
+}
+
+/**
+ * @brief Enables or disables the specified ETHERNET MMC interrupts.
+ * @param ETH_MMC_IT: specifies the ETHERNET MMC interrupt sources to be enabled or disabled.
+ * This parameter can be any combination of Tx interrupt or
+ * any combination of Rx interrupt (but not both)of the following values:
+ * @arg ETH_MMC_INT_TGF : When Tx good frame counter reaches half the maximum value
+ * @arg ETH_MMC_INT_TGFMSC: When Tx good multi col counter reaches half the maximum value
+ * @arg ETH_MMC_INT_TGFSC : When Tx good single col counter reaches half the maximum value
+ * @arg ETH_MMC_INT_RGUF : When Rx good unicast frames counter reaches half the maximum value
+ * @arg ETH_MMC_INT_RFAE : When Rx alignment error counter reaches half the maximum value
+ * @arg ETH_MMC_INT_RFCE : When Rx crc error counter reaches half the maximum value
+ * @param NewState: new state of the specified ETHERNET MMC interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_MMCITConfig(uint32_t ETH_MMC_IT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_MMC_IT(ETH_MMC_IT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if ((ETH_MMC_IT & (uint32_t)0x10000000) != (uint32_t)RESET)
+ {
+ /* Remove egister mak from IT */
+ ETH_MMC_IT &= 0xEFFFFFFF;
+
+ /* ETHERNET MMC Rx interrupts selected */
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ETHERNET MMC interrupts */
+ ETH->MMCRIM &=(~(uint32_t)ETH_MMC_IT);
+ }
+ else
+ {
+ /* Disable the selected ETHERNET MMC interrupts */
+ ETH->MMCRIM |= ETH_MMC_IT;
+ }
+ }
+ else
+ {
+ /* ETHERNET MMC Tx interrupts selected */
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected ETHERNET MMC interrupts */
+ ETH->MMCTIM &=(~(uint32_t)ETH_MMC_IT);
+ }
+ else
+ {
+ /* Disable the selected ETHERNET MMC interrupts */
+ ETH->MMCTIM |= ETH_MMC_IT;
+ }
+ }
+}
+
+/**
+ * @brief Checks whether the specified ETHERNET MMC IT is set or not.
+ * @param ETH_MMC_IT: specifies the ETHERNET MMC interrupt.
+ * This parameter can be one of the following values:
+ * @arg ETH_MMC_IT_TxFCGC: When Tx good frame counter reaches half the maximum value
+ * @arg ETH_MMC_IT_TxMCGC: When Tx good multi col counter reaches half the maximum value
+ * @arg ETH_MMC_IT_TxSCGC: When Tx good single col counter reaches half the maximum value
+ * @arg ETH_MMC_IT_RxUGFC: When Rx good unicast frames counter reaches half the maximum value
+ * @arg ETH_MMC_IT_RxAEC : When Rx alignment error counter reaches half the maximum value
+ * @arg ETH_MMC_IT_RxCEC : When Rx crc error counter reaches half the maximum value
+ * @retval The value of ETHERNET MMC IT (SET or RESET).
+ */
+ITStatus ETH_GetMMCITStatus(uint32_t ETH_MMC_IT)
+{
+ ITStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ETH_MMC_GET_IT(ETH_MMC_IT));
+
+ if ((ETH_MMC_IT & (uint32_t)0x10000000) != (uint32_t)RESET)
+ {
+ /* ETHERNET MMC Rx interrupts selected */
+ /* Check if the ETHERNET MMC Rx selected interrupt is enabled and occured */
+ if ((((ETH->MMCRI & ETH_MMC_IT) != (uint32_t)RESET)) && ((ETH->MMCRIM & ETH_MMC_IT) != (uint32_t)RESET))
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ }
+ else
+ {
+ /* ETHERNET MMC Tx interrupts selected */
+ /* Check if the ETHERNET MMC Tx selected interrupt is enabled and occured */
+ if ((((ETH->MMCTI & ETH_MMC_IT) != (uint32_t)RESET)) && ((ETH->MMCRIM & ETH_MMC_IT) != (uint32_t)RESET))
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Get the specified ETHERNET MMC register value.
+ * @param ETH_MMCReg: specifies the ETHERNET MMC register.
+ * This parameter can be one of the following values:
+ * @arg ETH_MMCCR : MMC CR register
+ * @arg ETH_MMCRIR : MMC RIR register
+ * @arg ETH_MMCTIR : MMC TIR register
+ * @arg ETH_MMCRIMR : MMC RIMR register
+ * @arg ETH_MMCTIMR : MMC TIMR register
+ * @arg ETH_MMCTGFSCCR : MMC TGFSCCR register
+ * @arg ETH_MMCTGFMSCCR: MMC TGFMSCCR register
+ * @arg ETH_MMCTGFCR : MMC TGFCR register
+ * @arg ETH_MMCRFCECR : MMC RFCECR register
+ * @arg ETH_MMCRFAECR : MMC RFAECR register
+ * @arg ETH_MMCRGUFCR : MMC RGUFCRregister
+ * @retval The value of ETHERNET MMC Register value.
+ */
+uint32_t ETH_GetMMCRegister(uint32_t ETH_MMCReg)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_MMC_REGISTER(ETH_MMCReg));
+
+ /* Return the selected register value */
+ return (*(__IO uint32_t *)(ETH_MAC_BASE + ETH_MMCReg));
+}
+/*--------------------------------- PTP ------------------------------------*/
+
+/**
+ * @brief Updated the PTP block for fine correction with the Time Stamp Addend register value.
+ * @param None
+ * @retval None
+ */
+void ETH_EnablePTPTimeStampAddend(void)
+{
+ /* Enable the PTP block update with the Time Stamp Addend register value */
+ ETH->PTPTSCTRL |= ETH_PTPTSCTRL_TSARU;
+}
+
+/**
+ * @brief Enable the PTP Time Stamp interrupt trigger
+ * @param None
+ * @retval None
+ */
+void ETH_EnablePTPTimeStampInterruptTrigger(void)
+{
+ /* Enable the PTP target time interrupt */
+ ETH->PTPTSCTRL |= ETH_PTPTSCTRL_TSITE;
+}
+
+/**
+ * @brief Updated the PTP system time with the Time Stamp Update register value.
+ * @param None
+ * @retval None
+ */
+void ETH_EnablePTPTimeStampUpdate(void)
+{
+ /* Enable the PTP system time update with the Time Stamp Update register value */
+ ETH->PTPTSCTRL |= ETH_PTPTSCTRL_TSSTU;
+}
+
+/**
+ * @brief Initialize the PTP Time Stamp
+ * @param None
+ * @retval None
+ */
+void ETH_InitializePTPTimeStamp(void)
+{
+ /* Initialize the PTP Time Stamp */
+ ETH->PTPTSCTRL |= ETH_PTPTSCTRL_TSSTI;
+}
+
+/**
+ * @brief Selects the PTP Update method
+ * @param UpdateMethod: the PTP Update method
+ * This parameter can be one of the following values:
+ * @arg ETH_PTP_FineUpdate : Fine Update method
+ * @arg ETH_PTP_CoarseUpdate : Coarse Update method
+ * @retval None
+ */
+void ETH_PTPUpdateMethodConfig(uint32_t UpdateMethod)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_PTP_UPDATE(UpdateMethod));
+
+ if (UpdateMethod != ETH_PTP_CoarseUpdate)
+ {
+ /* Enable the PTP Fine Update method */
+ ETH->PTPTSCTRL |= ETH_PTPTSCTRL_TSFCU;
+ }
+ else
+ {
+ /* Disable the PTP Coarse Update method */
+ ETH->PTPTSCTRL &= (~(uint32_t)ETH_PTPTSCTRL_TSFCU);
+ }
+}
+
+/**
+ * @brief Enables or disables the PTP time stamp for transmit and receive frames.
+ * @param NewState: new state of the PTP time stamp for transmit and receive frames
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void ETH_PTPTimeStampCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the PTP time stamp for transmit and receive frames */
+ ETH->PTPTSCTRL |= ETH_PTPTSCTRL_TSE;
+ }
+ else
+ {
+ /* Disable the PTP time stamp for transmit and receive frames */
+ ETH->PTPTSCTRL &= (~(uint32_t)ETH_PTPTSCTRL_TSE);
+ }
+}
+
+/**
+ * @brief Checks whether the specified ETHERNET PTP flag is set or not.
+ * @param ETH_PTP_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg ETH_PTP_FLAG_TSARU : Addend Register Update
+ * @arg ETH_PTP_FLAG_TSITE : Time Stamp Interrupt Trigger Enable
+ * @arg ETH_PTP_FLAG_TSSTU : Time Stamp Update
+ * @arg ETH_PTP_FLAG_TSSTI : Time Stamp Initialize
+ * @retval The new state of ETHERNET PTP Flag (SET or RESET).
+ */
+FlagStatus ETH_GetPTPFlagStatus(uint32_t ETH_PTP_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_ETH_PTP_GET_FLAG(ETH_PTP_FLAG));
+
+ if ((ETH->PTPTSCTRL & ETH_PTP_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ return bitstatus;
+}
+
+/**
+ * @brief Sets the system time Sub-Second Increment value.
+ * @param SubSecondValue: specifies the PTP Sub-Second Increment Register value.
+ * @retval None
+ */
+void ETH_SetPTPSubSecondIncrement(uint32_t SubSecondValue)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_PTP_SUBSECOND_INCREMENT(SubSecondValue));
+ /* Set the PTP Sub-Second Increment Register */
+ ETH->PTPSSINC = SubSecondValue;
+}
+
+/**
+ * @brief Sets the Time Stamp update sign and values.
+ * @param Sign: specifies the PTP Time update value sign.
+ * This parameter can be one of the following values:
+ * @arg ETH_PTP_PositiveTime : positive time value.
+ * @arg ETH_PTP_NegativeTime : negative time value.
+ * @param SecondValue: specifies the PTP Time update second value.
+ * @param SubSecondValue: specifies the PTP Time update sub-second value.
+ * This parameter is a 31 bit value, bit32 correspond to the sign.
+ * @retval None
+ */
+void ETH_SetPTPTimeStampUpdate(uint32_t Sign, uint32_t SecondValue, uint32_t SubSecondValue)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_PTP_TIME_SIGN(Sign));
+ assert_param(IS_ETH_PTP_TIME_STAMP_UPDATE_SUBSECOND(SubSecondValue));
+ /* Set the PTP Time Update High Register */
+ ETH->PTPTSHUD = SecondValue;
+
+ /* Set the PTP Time Update Low Register with sign */
+ ETH->PTPTSLUD = Sign | SubSecondValue;
+}
+
+/**
+ * @brief Sets the Time Stamp Addend value.
+ * @param Value: specifies the PTP Time Stamp Addend Register value.
+ * @retval None
+ */
+void ETH_SetPTPTimeStampAddend(uint32_t Value)
+{
+ /* Set the PTP Time Stamp Addend Register */
+ ETH->PTPTSAD = Value;
+}
+
+/**
+ * @brief Sets the Target Time registers values.
+ * @param HighValue: specifies the PTP Target Time High Register value.
+ * @param LowValue: specifies the PTP Target Time Low Register value.
+ * @retval None
+ */
+void ETH_SetPTPTargetTime(uint32_t HighValue, uint32_t LowValue)
+{
+ /* Set the PTP Target Time High Register */
+ ETH->PTPTTH = HighValue;
+ /* Set the PTP Target Time Low Register */
+ ETH->PTPTTL = LowValue;
+}
+
+/**
+ * @brief Get the specified ETHERNET PTP register value.
+ * @param ETH_PTPReg: specifies the ETHERNET PTP register.
+ * This parameter can be one of the following values:
+ * @arg ETH_PTPTSCR : Sub-Second Increment Register
+ * @arg ETH_PTPSSIR : Sub-Second Increment Register
+ * @arg ETH_PTPTSHR : Time Stamp High Register
+ * @arg ETH_PTPTSLR : Time Stamp Low Register
+ * @arg ETH_PTPTSHUR : Time Stamp High Update Register
+ * @arg ETH_PTPTSLUR : Time Stamp Low Update Register
+ * @arg ETH_PTPTSAR : Time Stamp Addend Register
+ * @arg ETH_PTPTTHR : Target Time High Register
+ * @arg ETH_PTPTTLR : Target Time Low Register
+ * @retval The value of ETHERNET PTP Register value.
+ */
+uint32_t ETH_GetPTPRegister(uint32_t ETH_PTPReg)
+{
+ /* Check the parameters */
+ assert_param(IS_ETH_PTP_REGISTER(ETH_PTPReg));
+
+ /* Return the selected register value */
+ return (*(__IO uint32_t *)(ETH_MAC_BASE + ETH_PTPReg));
+}
+
+/**
+ * @brief Initializes the DMA Tx descriptors in chain mode with PTP.
+ * @param DMATxDescTab: Pointer on the first Tx desc list
+ * @param DMAPTPTxDescTab: Pointer on the first PTP Tx desc list
+ * @param TxBuff: Pointer on the first TxBuffer list
+ * @param TxBuffCount: Number of the used Tx desc in the list
+ * @retval None
+ */
+void ETH_DMAPTPTxDescChainInit(ETH_DMADESCTypeDef *DMATxDescTab, ETH_DMADESCTypeDef *DMAPTPTxDescTab,
+ uint8_t* TxBuff, uint32_t TxBuffCount)
+{
+ uint32_t i = 0;
+ ETH_DMADESCTypeDef *DMATxDesc;
+
+ /* Set the DMATxDescToSet pointer with the first one of the DMATxDescTab list */
+ DMATxDescToSet = DMATxDescTab;
+ DMAPTPTxDescToSet = DMAPTPTxDescTab;
+ /* Fill each DMATxDesc descriptor with the right values */
+ for(i=0; i < TxBuffCount; i++)
+ {
+ /* Get the pointer on the ith member of the Tx Desc list */
+ DMATxDesc = DMATxDescTab+i;
+ /* Set Second Address Chained bit and enable PTP */
+ DMATxDesc->Status = ETH_DMATxDesc_TCH | ETH_DMATxDesc_TTSE;
+
+ /* Set Buffer1 address pointer */
+ DMATxDesc->Buffer1Addr =(uint32_t)(&TxBuff[i*ETH_MAX_PACKET_SIZE]);
+
+ /* Initialize the next descriptor with the Next Desciptor Polling Enable */
+ if(i < (TxBuffCount-1))
+ {
+ /* Set next descriptor address register with next descriptor base address */
+ DMATxDesc->Buffer2NextDescAddr = (uint32_t)(DMATxDescTab+i+1);
+ }
+ else
+ {
+ /* For last descriptor, set next descriptor address register equal to the first descriptor base address */
+ DMATxDesc->Buffer2NextDescAddr = (uint32_t) DMATxDescTab;
+ }
+ /* make DMAPTPTxDescTab points to the same addresses as DMATxDescTab */
+ (&DMAPTPTxDescTab[i])->Buffer1Addr = DMATxDesc->Buffer1Addr;
+ (&DMAPTPTxDescTab[i])->Buffer2NextDescAddr = DMATxDesc->Buffer2NextDescAddr;
+ }
+ /* Store on the last DMAPTPTxDescTab desc status record the first list address */
+ (&DMAPTPTxDescTab[i-1])->Status = (uint32_t) DMAPTPTxDescTab;
+
+ /* Set Transmit Desciptor List Address Register */
+ ETH->DMATDLADDR = (uint32_t) DMATxDescTab;
+}
+
+/**
+ * @brief Initializes the DMA Rx descriptors in chain mode.
+ * @param DMARxDescTab: Pointer on the first Rx desc list
+ * @param DMAPTPRxDescTab: Pointer on the first PTP Rx desc list
+ * @param RxBuff: Pointer on the first RxBuffer list
+ * @param RxBuffCount: Number of the used Rx desc in the list
+ * @retval None
+ */
+void ETH_DMAPTPRxDescChainInit(ETH_DMADESCTypeDef *DMARxDescTab, ETH_DMADESCTypeDef *DMAPTPRxDescTab,
+ uint8_t *RxBuff, uint32_t RxBuffCount)
+{
+ uint32_t i = 0;
+ ETH_DMADESCTypeDef *DMARxDesc;
+
+ /* Set the DMARxDescToGet pointer with the first one of the DMARxDescTab list */
+ DMARxDescToGet = DMARxDescTab;
+ DMAPTPRxDescToGet = DMAPTPRxDescTab;
+ /* Fill each DMARxDesc descriptor with the right values */
+ for(i=0; i < RxBuffCount; i++)
+ {
+ /* Get the pointer on the ith member of the Rx Desc list */
+ DMARxDesc = DMARxDescTab+i;
+ /* Set Own bit of the Rx descriptor Status */
+ DMARxDesc->Status = ETH_DMARxDesc_OWN;
+
+ /* Set Buffer1 size and Second Address Chained bit */
+ DMARxDesc->ControlBufferSize = ETH_DMARxDesc_RCH | (uint32_t)ETH_MAX_PACKET_SIZE;
+ /* Set Buffer1 address pointer */
+ DMARxDesc->Buffer1Addr = (uint32_t)(&RxBuff[i*ETH_MAX_PACKET_SIZE]);
+
+ /* Initialize the next descriptor with the Next Desciptor Polling Enable */
+ if(i < (RxBuffCount-1))
+ {
+ /* Set next descriptor address register with next descriptor base address */
+ DMARxDesc->Buffer2NextDescAddr = (uint32_t)(DMARxDescTab+i+1);
+ }
+ else
+ {
+ /* For last descriptor, set next descriptor address register equal to the first descriptor base address */
+ DMARxDesc->Buffer2NextDescAddr = (uint32_t)(DMARxDescTab);
+ }
+ /* Make DMAPTPRxDescTab points to the same addresses as DMARxDescTab */
+ (&DMAPTPRxDescTab[i])->Buffer1Addr = DMARxDesc->Buffer1Addr;
+ (&DMAPTPRxDescTab[i])->Buffer2NextDescAddr = DMARxDesc->Buffer2NextDescAddr;
+ }
+ /* Store on the last DMAPTPRxDescTab desc status record the first list address */
+ (&DMAPTPRxDescTab[i-1])->Status = (uint32_t) DMAPTPRxDescTab;
+
+ /* Set Receive Desciptor List Address Register */
+ ETH->DMARDLADDR = (uint32_t) DMARxDescTab;
+}
+
+/**
+ * @brief Transmits a packet, from application buffer, pointed by ppkt with Time Stamp values.
+ * @param ppkt: pointer to application packet buffer to transmit.
+ * @param FrameLength: Tx Packet size.
+ * @param PTPTxTab: Pointer on the first PTP Tx table to store Time stamp values.
+ * @retval ETH_ERROR: in case of Tx desc owned by DMA
+ * ETH_SUCCESS: for correct transmission
+ */
+uint32_t ETH_HandlePTPTxPkt(uint8_t *ppkt, uint16_t FrameLength, uint32_t *PTPTxTab)
+{
+ uint32_t offset = 0, timeout = 0;
+ /* Check if the descriptor is owned by the ETHERNET DMA (when set) or CPU (when reset) */
+ if((DMATxDescToSet->Status & ETH_DMATxDesc_OWN) != (uint32_t)RESET)
+ {
+ /* Return ERROR: OWN bit set */
+ return ETH_ERROR;
+ }
+ /* Copy the frame to be sent into memory pointed by the current ETHERNET DMA Tx descriptor */
+ for(offset=0; offsetBuffer1Addr) + offset)) = (*(ppkt + offset));
+ }
+ /* Setting the Frame Length: bits[12:0] */
+ DMATxDescToSet->ControlBufferSize = (FrameLength & (uint32_t)0x1FFF);
+ /* Setting the last segment and first segment bits (in this case a frame is transmitted in one descriptor) */
+ DMATxDescToSet->Status |= ETH_DMATxDesc_LS | ETH_DMATxDesc_FS;
+ /* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */
+ DMATxDescToSet->Status |= ETH_DMATxDesc_OWN;
+ /* When Tx Buffer unavailable flag is set: clear it and resume transmission */
+ if ((ETH->DMASTS & ETH_DMASTS_TBU) != (uint32_t)RESET)
+ {
+ /* Clear TBUS ETHERNET DMA flag */
+ ETH->DMASTS = ETH_DMASTS_TBU;
+ /* Resume DMA transmission*/
+ ETH->DMATPD = 0;
+ }
+ /* Wait for ETH_DMATxDesc_TTSS flag to be set */
+ do
+ {
+ timeout++;
+ } while (!(DMATxDescToSet->Status & ETH_DMATxDesc_TTSS) && (timeout < 0xFFFF));
+ /* Return ERROR in case of timeout */
+ if(timeout == PHY_READ_TO)
+ {
+ return ETH_ERROR;
+ }
+ /* Clear the DMATxDescToSet status register TTSS flag */
+ DMATxDescToSet->Status &= ~ETH_DMATxDesc_TTSS;
+ *PTPTxTab++ = DMATxDescToSet->Buffer1Addr;
+ *PTPTxTab = DMATxDescToSet->Buffer2NextDescAddr;
+ /* Update the ENET DMA current descriptor */
+ /* Chained Mode */
+ if((DMATxDescToSet->Status & ETH_DMATxDesc_TCH) != (uint32_t)RESET)
+ {
+ /* Selects the next DMA Tx descriptor list for next buffer read */
+ DMATxDescToSet = (ETH_DMADESCTypeDef*) (DMAPTPTxDescToSet->Buffer2NextDescAddr);
+ if(DMAPTPTxDescToSet->Status != 0)
+ {
+ DMAPTPTxDescToSet = (ETH_DMADESCTypeDef*) (DMAPTPTxDescToSet->Status);
+ }
+ else
+ {
+ DMAPTPTxDescToSet++;
+ }
+ }
+ else /* Ring Mode */
+ {
+ if((DMATxDescToSet->Status & ETH_DMATxDesc_TER) != (uint32_t)RESET)
+ {
+ /* Selects the next DMA Tx descriptor list for next buffer read: this will
+ be the first Tx descriptor in this case */
+ DMATxDescToSet = (ETH_DMADESCTypeDef*) (ETH->DMATDLADDR);
+ DMAPTPTxDescToSet = (ETH_DMADESCTypeDef*) (ETH->DMATDLADDR);
+ }
+ else
+ {
+ /* Selects the next DMA Tx descriptor list for next buffer read */
+ DMATxDescToSet = (ETH_DMADESCTypeDef*) ((uint32_t)DMATxDescToSet + 0x10 + ((ETH->DMABM & ETH_DMABM_DSL) >> 2));
+ DMAPTPTxDescToSet = (ETH_DMADESCTypeDef*) ((uint32_t)DMAPTPTxDescToSet + 0x10 + ((ETH->DMABM & ETH_DMABM_DSL) >> 2));
+ }
+ }
+ /* Return SUCCESS */
+ return ETH_SUCCESS;
+}
+
+/**
+ * @brief Receives a packet and copies it to memory pointed by ppkt with Time Stamp values.
+ * @param ppkt: pointer to application packet receive buffer.
+ * @param PTPRxTab: Pointer on the first PTP Rx table to store Time stamp values.
+ * @retval ETH_ERROR: if there is error in reception
+ * framelength: received packet size if packet reception is correct
+ */
+uint32_t ETH_HandlePTPRxPkt(uint8_t *ppkt, uint32_t *PTPRxTab)
+{
+ uint32_t offset = 0, framelength = 0;
+ /* Check if the descriptor is owned by the ENET or CPU */
+ if((DMARxDescToGet->Status & ETH_DMARxDesc_OWN) != (uint32_t)RESET)
+ {
+ /* Return error: OWN bit set */
+ return ETH_ERROR;
+ }
+ if(((DMARxDescToGet->Status & ETH_DMARxDesc_ES) == (uint32_t)RESET) &&
+ ((DMARxDescToGet->Status & ETH_DMARxDesc_LS) != (uint32_t)RESET) &&
+ ((DMARxDescToGet->Status & ETH_DMARxDesc_FS) != (uint32_t)RESET))
+ {
+ /* Get the Frame Length of the received packet: substruct 4 bytes of the CRC */
+ framelength = ((DMARxDescToGet->Status & ETH_DMARxDesc_FL) >> ETH_DMARXDESC_FRAME_LENGTHSHIFT) - 4;
+ /* Copy the received frame into buffer from memory pointed by the current ETHERNET DMA Rx descriptor */
+ for(offset=0; offsetBuffer1Addr) + offset));
+ }
+ }
+ else
+ {
+ /* Return ERROR */
+ framelength = ETH_ERROR;
+ }
+ /* When Rx Buffer unavailable flag is set: clear it and resume reception */
+ if ((ETH->DMASTS & ETH_DMASTS_RBU) != (uint32_t)RESET)
+ {
+ /* Clear RBUS ETHERNET DMA flag */
+ ETH->DMASTS = ETH_DMASTS_RBU;
+ /* Resume DMA reception */
+ ETH->DMARPD = 0;
+ }
+ *PTPRxTab++ = DMARxDescToGet->Buffer1Addr;
+ *PTPRxTab = DMARxDescToGet->Buffer2NextDescAddr;
+ /* Set Own bit of the Rx descriptor Status: gives the buffer back to ETHERNET DMA */
+ DMARxDescToGet->Status |= ETH_DMARxDesc_OWN;
+ /* Update the ETHERNET DMA global Rx descriptor with next Rx decriptor */
+ /* Chained Mode */
+ if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RCH) != (uint32_t)RESET)
+ {
+ /* Selects the next DMA Rx descriptor list for next buffer read */
+ DMARxDescToGet = (ETH_DMADESCTypeDef*) (DMAPTPRxDescToGet->Buffer2NextDescAddr);
+ if(DMAPTPRxDescToGet->Status != 0)
+ {
+ DMAPTPRxDescToGet = (ETH_DMADESCTypeDef*) (DMAPTPRxDescToGet->Status);
+ }
+ else
+ {
+ DMAPTPRxDescToGet++;
+ }
+ }
+ else /* Ring Mode */
+ {
+ if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RER) != (uint32_t)RESET)
+ {
+ /* Selects the first DMA Rx descriptor for next buffer to read: last Rx descriptor was used */
+ DMARxDescToGet = (ETH_DMADESCTypeDef*) (ETH->DMARDLADDR);
+ }
+ else
+ {
+ /* Selects the next DMA Rx descriptor list for next buffer to read */
+ DMARxDescToGet = (ETH_DMADESCTypeDef*) ((uint32_t)DMARxDescToGet + 0x10 + ((ETH->DMABM & ETH_DMABM_DSL) >> 2));
+ }
+ }
+ /* Return Frame Length/ERROR */
+ return (framelength);
+}
+
+#ifndef USE_Delay
+/**
+ * @brief Inserts a delay time.
+ * @param nCount: specifies the delay time length.
+ * @retval None
+ */
+static void ETH_Delay(__IO uint32_t nCount)
+{
+ __IO uint32_t index = 0;
+ for(index = nCount; index != 0; index--)
+ {
+ }
+}
+#endif /* USE_Delay*/
+
+/**
+ * @}
+ */
+
+#endif /* AT32F407xx */
+
+/**
+ * @}
+ */
+
+/******************* (C) COPYRIGHT 2009 Artery Technology *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_exti.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_exti.c
new file mode 100644
index 0000000000000000000000000000000000000000..931478a8a88900577ff9bdecd2673d30423152e8
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_exti.c
@@ -0,0 +1,261 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_exti.c
+ * Description : at32f4xx EXTI source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_exti.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup EXTI
+ * @brief EXTI driver modules
+ * @{
+ */
+
+/** @defgroup EXTI_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup EXTI_Private_Defines
+ * @{
+ */
+
+#define EXTI_LINENONE ((uint32_t)0x00000) /* No interrupt selected */
+
+/**
+ * @}
+ */
+
+/** @defgroup EXTI_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup EXTI_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup EXTI_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup EXTI_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the EXTI peripheral registers to their default reset values.
+ * @param None
+ * @retval None
+ */
+void EXTI_Reset(void)
+{
+ EXTI->INTEN = 0x00000000;
+ EXTI->EVTEN = 0x00000000;
+ EXTI->RTRSEL = 0x00000000;
+ EXTI->FTRSEL = 0x00000000;
+ EXTI->PND = 0x007FFFFF;
+}
+
+/**
+ * @brief Initializes the EXTI peripheral according to the specified
+ * parameters in the EXTI_InitStruct.
+ * @param EXTI_InitStruct: pointer to a EXTI_InitType structure
+ * that contains the configuration information for the EXTI peripheral.
+ * @retval None
+ */
+void EXTI_Init(EXTI_InitType* EXTI_InitStruct)
+{
+ uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_EXTI_MODE(EXTI_InitStruct->EXTI_Mode));
+ assert_param(IS_EXTI_TRIGGER(EXTI_InitStruct->EXTI_Trigger));
+ assert_param(IS_EXTI_LINE(EXTI_InitStruct->EXTI_Line));
+ assert_param(IS_FUNCTIONAL_STATE(EXTI_InitStruct->EXTI_LineEnable));
+
+ tmp = (uint32_t)EXTI_BASE;
+
+ if (EXTI_InitStruct->EXTI_LineEnable != DISABLE)
+ {
+ /* Clear EXTI line configuration */
+ EXTI->INTEN &= ~EXTI_InitStruct->EXTI_Line;
+ EXTI->EVTEN &= ~EXTI_InitStruct->EXTI_Line;
+
+ tmp += EXTI_InitStruct->EXTI_Mode;
+
+ *(__IO uint32_t *) tmp |= EXTI_InitStruct->EXTI_Line;
+
+ /* Clear Rising Falling edge configuration */
+ EXTI->RTRSEL &= ~EXTI_InitStruct->EXTI_Line;
+ EXTI->FTRSEL &= ~EXTI_InitStruct->EXTI_Line;
+
+ /* Select the trigger for the selected external interrupts */
+ if (EXTI_InitStruct->EXTI_Trigger == EXTI_Trigger_Rising_Falling)
+ {
+ /* Rising Falling edge */
+ EXTI->RTRSEL |= EXTI_InitStruct->EXTI_Line;
+ EXTI->FTRSEL |= EXTI_InitStruct->EXTI_Line;
+ }
+ else
+ {
+ tmp = (uint32_t)EXTI_BASE;
+ tmp += EXTI_InitStruct->EXTI_Trigger;
+
+ *(__IO uint32_t *) tmp |= EXTI_InitStruct->EXTI_Line;
+ }
+ }
+ else
+ {
+ tmp += EXTI_InitStruct->EXTI_Mode;
+
+ /* Disable the selected external lines */
+ *(__IO uint32_t *) tmp &= ~EXTI_InitStruct->EXTI_Line;
+ }
+}
+
+/**
+ * @brief Fills each EXTI_InitStruct member with its reset value.
+ * @param EXTI_InitStruct: pointer to a EXTI_InitType structure which will
+ * be initialized.
+ * @retval None
+ */
+void EXTI_StructInit(EXTI_InitType* EXTI_InitStruct)
+{
+ EXTI_InitStruct->EXTI_Line = EXTI_LINENONE;
+ EXTI_InitStruct->EXTI_Mode = EXTI_Mode_Interrupt;
+ EXTI_InitStruct->EXTI_Trigger = EXTI_Trigger_Falling;
+ EXTI_InitStruct->EXTI_LineEnable = DISABLE;
+}
+
+/**
+ * @brief Generates a Software interrupt.
+ * @param EXTI_Line: specifies the EXTI lines to be enabled or disabled.
+ * This parameter can be any combination of EXTI_Linex where x can be (0..19).
+ * @retval None
+ */
+void EXTI_GenerateSWInt(uint32_t EXTI_Line)
+{
+ /* Check the parameters */
+ assert_param(IS_EXTI_LINE(EXTI_Line));
+
+ EXTI->SWIE |= EXTI_Line;
+}
+
+/**
+ * @brief Checks whether the specified EXTI line flag is set or not.
+ * @param EXTI_Line: specifies the EXTI line flag to check.
+ * This parameter can be:
+ * @arg EXTI_Linex: External interrupt line x where x(0..19)
+ * @retval The new state of EXTI_Line (SET or RESET).
+ */
+FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_GET_EXTI_LINE(EXTI_Line));
+
+ if ((EXTI->PND & EXTI_Line) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the EXTI's line pending flags.
+ * @param EXTI_Line: specifies the EXTI lines flags to clear.
+ * This parameter can be any combination of EXTI_Linex where x can be (0..19).
+ * @retval None
+ */
+void EXTI_ClearFlag(uint32_t EXTI_Line)
+{
+ /* Check the parameters */
+ assert_param(IS_EXTI_LINE(EXTI_Line));
+
+ EXTI->PND = EXTI_Line;
+}
+
+/**
+ * @brief Checks whether the specified EXTI line is asserted or not.
+ * @param EXTI_Line: specifies the EXTI line to check.
+ * This parameter can be:
+ * @arg EXTI_Linex: External interrupt line x where x(0..19)
+ * @retval The new state of EXTI_Line (SET or RESET).
+ */
+ITStatus EXTI_GetIntStatus(uint32_t EXTI_Line)
+{
+ ITStatus bitstatus = RESET;
+ uint32_t enablestatus = 0;
+ /* Check the parameters */
+ assert_param(IS_GET_EXTI_LINE(EXTI_Line));
+
+ enablestatus = EXTI->INTEN & EXTI_Line;
+
+ if (((EXTI->PND & EXTI_Line) != (uint32_t)RESET) && (enablestatus != (uint32_t)RESET))
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the EXTI's line pending bits.
+ * @param EXTI_Line: specifies the EXTI lines to clear.
+ * This parameter can be any combination of EXTI_Linex where x can be (0..19).
+ * @retval None
+ */
+void EXTI_ClearIntPendingBit(uint32_t EXTI_Line)
+{
+ /* Check the parameters */
+ assert_param(IS_EXTI_LINE(EXTI_Line));
+
+ EXTI->PND = EXTI_Line;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_flash.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_flash.c
new file mode 100644
index 0000000000000000000000000000000000000000..7bf0bd62607d6cd976bba4721df9bb7d308d74e2
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_flash.c
@@ -0,0 +1,2134 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_flash.c
+ * Description : at32f4xx FMC source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_flash.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup FLASH
+ * @brief FLASH driver modules
+ * @{
+ */
+
+/** @defgroup FLASH_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup FLASH_Private_Defines
+ * @{
+ */
+
+
+/* Flash Control Register bits */
+#define CTRL_PRGM_Set ((uint32_t)0x00000001)
+#define CTRL_PRGM_Rst ((uint32_t)0xFFFFFFFE)
+#define CTRL_PGERS_Set ((uint32_t)0x00000002)
+#define CTRL_PGERS_Rst ((uint32_t)0xFFFFFFFD)
+#define CTRL_CHPERS_Set ((uint32_t)0x00000004)
+#define CTRL_CHPERS_Rst ((uint32_t)0xFFFFFFFB)
+#define CTRL_UOBPRGM_Set ((uint32_t)0x00000010)
+#define CTRL_UOBPRGM_Rst ((uint32_t)0xFFFFFFEF)
+#define CTRL_UOBERS_Set ((uint32_t)0x00000020)
+#define CTRL_UOBERS_Rst ((uint32_t)0xFFFFFFDF)
+#define CTRL_STRT_Set ((uint32_t)0x00000040)
+#define CTRL_LCK_Set ((uint32_t)0x00000080)
+#define CTRL_UOBWE_Rst ((uint32_t)0xFFFFFDFF)
+
+/* FLASH Mask */
+#define RDPRT_Mask ((uint32_t)0x00000002)
+#define WRPRT0_Mask ((uint32_t)0x000000FF)
+#define WRPRT1_Mask ((uint32_t)0x0000FF00)
+#define WRPRT2_Mask ((uint32_t)0x00FF0000)
+#define WRPRT3_Mask ((uint32_t)0xFF000000)
+#define UOB_USR_BTOPT ((uint16_t)0x0008)
+
+#define OPTION_BYTE_PRT_Key ((uint16_t)0x00CC)
+
+/* FLASH Keys */
+#define RDPRT_Key ((uint16_t)0x00A5)
+#define FLASH_KEY1 ((uint32_t)0x45670123)
+#define FLASH_KEY2 ((uint32_t)0xCDEF89AB)
+#define SLIB_UNLOCK_KEY ((uint32_t)0xA35F6D24)
+
+/* FLASH BANK address */
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+#define FLASH_BNK1_SIZE ((uint32_t)0x80000)
+#define FLASH_BNK1_END_ADDR ((uint32_t)0x807FFFF)
+#else
+#define FLASH_BNK1_SIZE ((*((uint32_t*)0x1FFFF7E0)) * 1024)
+#define FLASH_BNK1_END_ADDR (((uint32_t)0x8000000) + FLASH_BNK1_SIZE - 1)
+#endif
+#define FLASH_BNK2_END_ADDR ((uint32_t)0x80FFFFF)
+#define FLASH_BNK3_START_ADDR ((uint32_t)0x8400000)
+#if defined (AT32F415xx)
+#define FLASH_SYSMEM_START_ADDR ((uint32_t)0x1FFFAC00)
+#define FLASH_SYSMEM_END_ADDR ((uint32_t)0x1FFFF3FF)
+#endif
+
+/* Delay definition */
+#define ERS_TIMEOUT ((uint32_t)0x10000000)
+#define PRGM_TIMEOUT ((uint32_t)0x0000F000)
+#define EXT_FLASH_ERS_TIMEOUT ((uint32_t)0xFFFFFFFF)
+#define EXT_FLASH_PRGM_TIMEOUT ((uint32_t)0x00080000)
+/**
+ * @}
+ */
+
+/** @defgroup FLASH_Private_Macros
+ * @{
+ */
+#define IS_SYS_BOOTLOADER() ((FLASH->SLIB_CDR0 & FLASH_SLIB_CDR0_BOOT_DIS) == 0x0)
+#define IS_RDP_DISABLE() (FLASH_GetReadProtectStatus() == RESET)
+
+#define IS_MAIN_SLIB() ((FLASH->SLIB_CDR0 & FLASH_SLIB_CDR0_SLIB_EN)? 1:0)
+#define IS_SYS_SLIB() ((FLASH->SLIB_CDR0 & FLASH_SLIB_CDR0_SYS_SLIB_EN)? TRUE:FALSE)
+#define IS_SLIB_DISABLE() (IS_MAIN_SLIB()? 0:1)
+/**
+ * @}
+ */
+
+/** @defgroup FLASH_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup FLASH_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup FLASH_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Unlocks the FLASH Controller.
+ * @note This function can be used for all at32f4xx devices.
+ * - For AT32F4xx XL-Density devices this function unlocks Bank1 and Bank2.
+ * - For all other devices it unlocks Bank1 and it is equivalent
+ * to FLASH_UnlockBank1 function..
+ * @param None
+ * @retval None
+ */
+void FLASH_Unlock(void)
+{
+ /* Authorize the FC of Bank1 Access */
+ FLASH->FCKEY = FLASH_KEY1;
+ FLASH->FCKEY = FLASH_KEY2;
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+ /* Authorize the FC of Bank2 Access */
+ FLASH->FCKEY2 = FLASH_KEY1;
+ FLASH->FCKEY2 = FLASH_KEY2;
+#endif
+}
+/**
+ * @brief Unlocks the FLASH Bank1 Controller.
+ * @note This function can be used for all at32f4xx devices.
+ * - For AT32F4xx XL-Density devices this function unlocks Bank1.
+ * - For all other devices it unlocks Bank1 and it is
+ * equivalent to FLASH_Unlock function.
+ * @param None
+ * @retval None
+ */
+void FLASH_UnlockBank1(void)
+{
+ /* Authorize the FC of Bank1 Access */
+ FLASH->FCKEY = FLASH_KEY1;
+ FLASH->FCKEY = FLASH_KEY2;
+}
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+/**
+ * @brief Unlocks the FLASH Bank2 Controller.
+ * @note This function can be used only for AT32F4xx XL-Density devices.
+ * @param None
+ * @retval None
+ */
+void FLASH_UnlockBank2(void)
+{
+ /* Authorize the FC of Bank2 Access */
+ FLASH->FCKEY2 = FLASH_KEY1;
+ FLASH->FCKEY2 = FLASH_KEY2;
+
+}
+#endif
+
+#if !defined (AT32F415xx)
+/**
+ * @brief Unlocks the FLASH Bank3 Controller for external flash.
+ * @note This function can not be used for AT32F415 devices.
+ * @param None
+ * @retval None
+ */
+void FLASH_UnlockBank3(void)
+{
+ /* Authorize the FC of Bank3 Access */
+ FLASH->FCKEY3 = FLASH_KEY1;
+ FLASH->FCKEY3 = FLASH_KEY2;
+}
+#endif
+
+/**
+ * @brief Locks the FLASH Controller.
+ * @note This function can be used for all at32f4xx devices.
+ * - For AT32F4xx XL-Density devices this function Locks Bank1 and Bank2.
+ * - For all other devices it Locks Bank1 and it is equivalent
+ * to FLASH_LockBank1 function.
+ * @param None
+ * @retval None
+ */
+void FLASH_Lock(void)
+{
+ /* Set the Lock Bit to lock the FC and the CTRL of Bank1 */
+ FLASH->CTRL |= CTRL_LCK_Set;
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+ /* Set the Lock Bit to lock the FC and the CTRL of Bank2 */
+ FLASH->CTRL2 |= CTRL_LCK_Set;
+#endif
+}
+
+/**
+ * @brief Locks the FLASH Bank1 Controller.
+ * @note this function can be used for all at32f4xx devices.
+ * - For AT32F4xx XL-Density devices this function Locks Bank1.
+ * - For all other devices it Locks Bank1 and it is equivalent
+ * to FLASH_Lock function.
+ * @param None
+ * @retval None
+ */
+void FLASH_LockBank1(void)
+{
+ /* Set the Lock Bit to lock the FC and the CTRL of Bank1 */
+ FLASH->CTRL |= CTRL_LCK_Set;
+}
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+/**
+ * @brief Locks the FLASH Bank2 Controller.
+ * @note This function can be used only for AT32F4xx XL-Density devices.
+ * @param None
+ * @retval None
+ */
+void FLASH_LockBank2(void)
+{
+ /* Set the Lock Bit to lock the FC and the CTRL of Bank2 */
+ FLASH->CTRL2 |= CTRL_LCK_Set;
+}
+#endif
+
+#if !defined (AT32F415xx)
+/**
+ * @brief Locks the FLASH Bank3 Controller for external flash.
+ * @note This function can not be used for AT32F415 devices.
+ * @param None
+ * @retval None
+ */
+void FLASH_LockBank3(void)
+{
+ /* Set the Lock Bit to lock the FC and the CTRL of Bank3 */
+ FLASH->CTRL3 |= CTRL_LCK_Set;
+}
+#endif
+
+/**
+ * @brief Erases a specified FLASH page.
+ * @note This function can be used for all at32f4xx devices.
+ * @param Page_Address: The page address to be erased.
+ * @retval FLASH Status: The returned value can be: FLASH_BSY, FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_ErasePage(uint32_t Page_Address)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ /* Check the parameters */
+ assert_param(IS_FLASH_ADDR(Page_Address));
+
+#if !defined (AT32F415xx)
+ /* BANK3 : External flash */
+ if(Page_Address >= FLASH_BNK3_START_ADDR)
+ {
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank3Process(EXT_FLASH_ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to erase the page */
+ FLASH->CTRL3 |= CTRL_PGERS_Set;
+ FLASH->ADDR3 = Page_Address;
+ FLASH->CTRL3 |= CTRL_STRT_Set;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank3Process(EXT_FLASH_ERS_TIMEOUT);
+
+ /* Disable the PGERS Bit */
+ FLASH->CTRL3 &= CTRL_PGERS_Rst;
+ }
+
+ return status;
+ }
+#endif
+#if defined (AT32F415xx)
+ if(Page_Address >= FLASH_SYSMEM_START_ADDR && Page_Address <= FLASH_SYSMEM_END_ADDR)
+ {
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to erase the page */
+ FLASH->CTRL |= CTRL_PGERS_Set;
+ FLASH->ADDR = Page_Address;
+ FLASH->CTRL |= CTRL_STRT_Set;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ /* Disable the PGERS Bit */
+ FLASH->CTRL &= CTRL_PGERS_Rst;
+ }
+ }
+#endif
+
+ if(Page_Address <= FLASH_BNK1_END_ADDR)
+ {
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank1Process(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to erase the page */
+ FLASH->CTRL |= CTRL_PGERS_Set;
+ FLASH->ADDR = Page_Address;
+ FLASH->CTRL |= CTRL_STRT_Set;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank1Process(ERS_TIMEOUT);
+
+ /* Disable the PGERS Bit */
+ FLASH->CTRL &= CTRL_PGERS_Rst;
+ }
+ }
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+ else if((Page_Address > FLASH_BNK1_END_ADDR)&&(Page_Address <= FLASH_BNK2_END_ADDR))
+ {
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank2Process(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to erase the page */
+ FLASH->CTRL2 |= CTRL_PGERS_Set;
+ FLASH->ADDR2 = Page_Address;
+ FLASH->CTRL2 |= CTRL_STRT_Set;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank2Process(ERS_TIMEOUT);
+
+ /* Disable the PGERS Bit */
+ FLASH->CTRL2 &= CTRL_PGERS_Rst;
+ }
+ }
+#endif
+
+ /* Return the Erase Status */
+ return status;
+}
+
+/**
+ * @brief Erases all internal FLASH pages.
+ * @note This function can be used for all at32f4xx devices.
+ * This function will not erase external flash pages.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_EraseAllPages(void)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank1Process(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to erase all pages */
+ FLASH->CTRL |= CTRL_CHPERS_Set;
+ FLASH->CTRL |= CTRL_STRT_Set;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank1Process(ERS_TIMEOUT);
+
+ /* Disable the CHPERS Bit */
+ FLASH->CTRL &= CTRL_CHPERS_Rst;
+ }
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to erase all pages */
+ FLASH->CTRL2 |= CTRL_CHPERS_Set;
+ FLASH->CTRL2 |= CTRL_STRT_Set;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank2Process(ERS_TIMEOUT);
+
+ /* Disable the CHPERS Bit */
+ FLASH->CTRL2 &= CTRL_CHPERS_Rst;
+ }
+
+#else
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to erase all pages */
+ FLASH->CTRL |= CTRL_CHPERS_Set;
+ FLASH->CTRL |= CTRL_STRT_Set;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ /* Disable the CHPERS Bit */
+ FLASH->CTRL &= CTRL_CHPERS_Rst;
+ }
+
+#endif
+
+ /* Return the Erase Status */
+ return status;
+}
+
+/**
+ * @brief Erases all Bank1 FLASH pages.
+ * @note This function can be used for all at32f4xx devices.
+ * - For AT32F4xx XL-Density devices this function erases all Bank1 pages.
+ * - For all other devices it erases all Bank1 pages and it is equivalent
+ * to FLASH_EraseAllPages function.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_EraseBank1AllPages(void)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank1Process(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to erase all pages */
+ FLASH->CTRL |= CTRL_CHPERS_Set;
+ FLASH->CTRL |= CTRL_STRT_Set;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank1Process(ERS_TIMEOUT);
+
+ /* Disable the CHPERS Bit */
+ FLASH->CTRL &= CTRL_CHPERS_Rst;
+ }
+
+ /* Return the Erase Status */
+ return status;
+}
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+/**
+ * @brief Erases all Bank2 FLASH pages.
+ * @note This function can be used only for at32f4xx XL-Density devices.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_EraseBank2AllPages(void)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank2Process(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to erase all pages */
+ FLASH->CTRL2 |= CTRL_CHPERS_Set;
+ FLASH->CTRL2 |= CTRL_STRT_Set;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank2Process(ERS_TIMEOUT);
+
+ /* Disable the CHPERS Bit */
+ FLASH->CTRL2 &= CTRL_CHPERS_Rst;
+ }
+
+ /* Return the Erase Status */
+ return status;
+}
+#endif
+
+#if !defined (AT32F415xx)
+/**
+ * @brief Erases all Bank3 FLASH pages.
+ * @note This function can not be used for AT32F415 devices.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_EraseBank3AllPages(void)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ if(FLASH_GetSlibState())
+ return FLASH_PGRM_FLR;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank3Process(EXT_FLASH_ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to erase all pages */
+ FLASH->CTRL3 |= CTRL_CHPERS_Set;
+ FLASH->CTRL3 |= CTRL_STRT_Set;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank3Process(EXT_FLASH_ERS_TIMEOUT);
+
+ /* Disable the CHPERS Bit */
+ FLASH->CTRL3 &= CTRL_CHPERS_Rst;
+ }
+
+ /* Return the Erase Status */
+ return status;
+}
+#endif
+
+/**
+ * @brief Erases the FLASH option bytes.
+ * @note This functions erases all option bytes except the Read protection (RDP).
+ * @note This function can be used for all at32f4xx devices.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_EraseUserOptionBytes(void)
+{
+ uint16_t rdptmp = RDPRT_Key;
+
+ FLASH_Status status = FLASH_PRC_DONE;
+
+ /* Get the actual read protection Option Byte value */
+ if(FLASH_GetReadProtectStatus() != RESET)
+ {
+ rdptmp = 0x00;
+ }
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* Authorize the small information block programming */
+ FLASH->OPTKEYR = FLASH_KEY1;
+ FLASH->OPTKEYR = FLASH_KEY2;
+
+ /* if the previous process is completed, continue to erase the option bytes */
+ FLASH->CTRL |= CTRL_UOBERS_Set;
+ FLASH->CTRL |= CTRL_STRT_Set;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the erase process is completed, disable the UOBERS Bit */
+ FLASH->CTRL &= CTRL_UOBERS_Rst;
+
+ /* Enable the Option Bytes Programming process */
+ FLASH->CTRL |= CTRL_UOBPRGM_Set;
+ /* Restore the last read protection Option Byte value */
+ UOPTB->RDPRT = (uint16_t)rdptmp;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ if(status != FLASH_TIMEOUT)
+ {
+ /* if the program process is completed, disable the UOBPRGM Bit */
+ FLASH->CTRL &= CTRL_UOBPRGM_Rst;
+ }
+ }
+ else
+ {
+ if (status != FLASH_TIMEOUT)
+ {
+ /* Disable the UOBPRGM Bit */
+ FLASH->CTRL &= CTRL_UOBPRGM_Rst;
+ }
+ }
+ }
+
+ /* Return the erase status */
+ return status;
+}
+
+/**
+ * @brief Programs a word at a specified address.
+ * @note This function can be used for all at32f4xx devices.
+ * @param Address: specifies the address to be programmed.
+ * @param Data: specifies the data to be programmed.
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_FLASH_ADDR(Address));
+
+#if !defined (AT32F415xx)
+ if (Address >= FLASH_BNK3_START_ADDR)
+ {
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank3Process(PRGM_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ FLASH->CTRL3 |= CTRL_PRGM_Set;
+
+ *(__IO uint32_t*) Address = Data;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank3Process(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL3 &= CTRL_PRGM_Rst;
+ }
+
+ return status;
+ }
+#endif
+#if defined (AT32F415xx)
+ if(Address >= FLASH_SYSMEM_START_ADDR && Address <= FLASH_SYSMEM_END_ADDR)
+ {
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to program the new data */
+ FLASH->CTRL |= CTRL_PRGM_Set;
+
+ *(__IO uint32_t*)Address = Data;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL &= CTRL_PRGM_Rst;
+ }
+ }
+#endif
+
+ if(Address <= FLASH_BNK1_END_ADDR)
+ {
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank1Process(PRGM_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ FLASH->CTRL |= CTRL_PRGM_Set;
+
+ *(__IO uint32_t*) Address = Data;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL &= CTRL_PRGM_Rst;
+ }
+ }
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+ else if((Address > FLASH_BNK1_END_ADDR)&&(Address <= FLASH_BNK2_END_ADDR))
+ {
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank2Process(PRGM_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ FLASH->CTRL2 |= CTRL_PRGM_Set;
+
+ *(__IO uint32_t*) Address = Data;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank2Process(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL2 &= CTRL_PRGM_Rst;
+ }
+ }
+#endif
+
+ /* Return the Program Status */
+ return status;
+}
+
+/**
+ * @brief Programs a half word at a specified address.
+ * @note This function can be used for all at32f4xx devices.
+ * @param Address: specifies the address to be programmed.
+ * @param Data: specifies the data to be programmed.
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ /* Check the parameters */
+ assert_param(IS_FLASH_ADDR(Address));
+
+#if !defined (AT32F415xx)
+ if (Address >= FLASH_BNK3_START_ADDR)
+ {
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank3Process(PRGM_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to program the new data */
+ FLASH->CTRL3 |= CTRL_PRGM_Set;
+
+ *(__IO uint16_t*)Address = Data;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank3Process(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL3 &= CTRL_PRGM_Rst;
+ }
+ return status;
+ }
+#endif
+#if defined (AT32F415xx)
+ if(Address >= FLASH_SYSMEM_START_ADDR && Address <= FLASH_SYSMEM_END_ADDR)
+ {
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to program the new data */
+ FLASH->CTRL |= CTRL_PRGM_Set;
+
+ *(__IO uint16_t*)Address = Data;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL &= CTRL_PRGM_Rst;
+ }
+ }
+#endif
+
+ /* Wait for last process to be completed */
+ if(Address <= FLASH_BNK1_END_ADDR)
+ {
+ status = FLASH_WaitForBank1Process(PRGM_TIMEOUT);
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to program the new data */
+ FLASH->CTRL |= CTRL_PRGM_Set;
+
+ *(__IO uint16_t*)Address = Data;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank1Process(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL &= CTRL_PRGM_Rst;
+ }
+ }
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+ else if((Address > FLASH_BNK1_END_ADDR)&&(Address <= FLASH_BNK2_END_ADDR))
+ {
+ status = FLASH_WaitForBank2Process(PRGM_TIMEOUT);
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to program the new data */
+ FLASH->CTRL2 |= CTRL_PRGM_Set;
+
+ *(__IO uint16_t*)Address = Data;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank2Process(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL2 &= CTRL_PRGM_Rst;
+ }
+ }
+#endif
+
+ /* Return the Program Status */
+ return status;
+}
+
+/**
+ * @brief Programs a byte at a specified address.
+ * @note This function can be used for all at32f4xx devices.
+ This function cannot be used to program bank3.
+ * @param Address: specifies the address to be programmed.
+ * @param Data: specifies the data to be programmed.
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_ProgramByte(uint32_t Address, uint8_t Data)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ /* Check the parameters */
+ assert_param(IS_FLASH_ADDR(Address));
+
+#if !defined (AT32F415xx)
+ if (Address >= FLASH_BNK3_START_ADDR)
+ {
+ /* This function cannot be used to program bank3 */
+ return FLASH_WRPRT_FLR;
+ }
+#endif
+#if defined (AT32F415xx)
+ if(Address >= FLASH_SYSMEM_START_ADDR && Address <= FLASH_SYSMEM_END_ADDR)
+ {
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to program the new data */
+ FLASH->CTRL |= CTRL_PRGM_Set;
+
+ *(__IO uint8_t*)Address = Data;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL &= CTRL_PRGM_Rst;
+ }
+ }
+#endif
+
+ if(Address <= FLASH_BNK1_END_ADDR)
+ {
+ status = FLASH_WaitForBank1Process(PRGM_TIMEOUT);
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to program the new data */
+ FLASH->CTRL |= CTRL_PRGM_Set;
+
+ *(__IO uint8_t*)Address = Data;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank1Process(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL &= CTRL_PRGM_Rst;
+ }
+ }
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+ else if((Address > FLASH_BNK1_END_ADDR)&&(Address <= FLASH_BNK2_END_ADDR))
+ {
+ status = FLASH_WaitForBank2Process(PRGM_TIMEOUT);
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the previous process is completed, continue to program the new data */
+ FLASH->CTRL2 |= CTRL_PRGM_Set;
+
+ *(__IO uint8_t*)Address = Data;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForBank2Process(PRGM_TIMEOUT);
+
+ /* Disable the PRGM Bit */
+ FLASH->CTRL2 &= CTRL_PRGM_Rst;
+ }
+ }
+#endif
+ /* Return the Program Status */
+ return status;
+}
+
+/**
+ * @brief Programs a half word at a specified Option Byte Data address.
+ * @note This function can be used for all at32f4xx devices.
+ * @param Address: specifies the address to be programmed.
+ * @param Data: specifies the data to be programmed.
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_ProgramUserOptionByteData(uint32_t Address, uint8_t Data)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* Authorize the small information block programming */
+ FLASH->OPTKEYR = FLASH_KEY1;
+ FLASH->OPTKEYR = FLASH_KEY2;
+ /* Enables the Option Bytes Programming process */
+ FLASH->CTRL |= CTRL_UOBPRGM_Set;
+ *(__IO uint16_t*)Address = Data;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ if(status != FLASH_TIMEOUT)
+ {
+ /* if the program process is completed, disable the UOBPRGM Bit */
+ FLASH->CTRL &= CTRL_UOBPRGM_Rst;
+ }
+ }
+
+ /* Return the Option Byte Data Program Status */
+ return status;
+}
+
+/**
+ * @brief Write protects the desired pages
+ * @note This function can be used for all at32f4xx devices.
+ * @param FLASH_Pages: specifies the address of the pages to be write protected.
+ * This parameter can be:
+ * @arg For @b AT32F415xx devices: value between FLASH_WRPRT_PAGE_0to1 and
+ * FLASH_WRPRT_PAGE_60to61 or FLASH_WRPRT_PAGE_62to63 or FLASH_WRPRT_PAGE_62to127
+ * @arg For @b AT32F4xx Medium-density_devices: value between FLASH_WRPRT_PAGE_0to3 and
+ * FLASH_WRPRT_PAGE_60to63 or FLASH_WRPRT_PAGE_124to127
+ * @arg For @b AT32F4xx High-density_devices: value between FLASH_WRPRT_PAGE_0to1 and
+ * FLASH_WRPRT_PAGE_60to61 or FLASH_WRPRT_PAGE_62to127 or FLASH_WRPRT_PAGE_62to255
+ * @arg For @b AT32F4xx XL-density_devices: value between FLASH_WRPRT_PAGE_0to1 and
+ * FLASH_WRPRT_PAGE_60to61 or FLASH_WRPRT_PAGE_62to511
+ * @arg FLASH_WRPRT_AllPAGES
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_EnableWriteProtect(uint32_t FLASH_Pages)
+{
+ uint16_t WRP0_Data = 0xFFFF, WRP1_Data = 0xFFFF, WRP2_Data = 0xFFFF, WRP3_Data = 0xFFFF;
+
+ FLASH_Status status = FLASH_PRC_DONE;
+
+ /* Check the parameters */
+ assert_param(IS_FLASH_WRPRT_PAGES(FLASH_Pages));
+
+ FLASH_Pages = (uint32_t)(~FLASH_Pages);
+ WRP0_Data = (uint16_t)(FLASH_Pages & WRPRT0_Mask);
+ WRP1_Data = (uint16_t)((FLASH_Pages & WRPRT1_Mask) >> 8);
+ WRP2_Data = (uint16_t)((FLASH_Pages & WRPRT2_Mask) >> 16);
+ WRP3_Data = (uint16_t)((FLASH_Pages & WRPRT3_Mask) >> 24);
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* Authorizes the small information block programming */
+ FLASH->OPTKEYR = FLASH_KEY1;
+ FLASH->OPTKEYR = FLASH_KEY2;
+ FLASH->CTRL |= CTRL_UOBPRGM_Set;
+
+ if(WRP0_Data != 0xFF)
+ {
+ UOPTB->WRPRT0 = WRP0_Data;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ }
+
+ if((status == FLASH_PRC_DONE) && (WRP1_Data != 0xFF))
+ {
+ UOPTB->WRPRT1 = WRP1_Data;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ }
+
+ if((status == FLASH_PRC_DONE) && (WRP2_Data != 0xFF))
+ {
+ UOPTB->WRPRT2 = WRP2_Data;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ }
+
+ if((status == FLASH_PRC_DONE) && (WRP3_Data != 0xFF))
+ {
+ UOPTB->WRPRT3 = WRP3_Data;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ }
+
+ if(status != FLASH_TIMEOUT)
+ {
+ /* if the program process is completed, disable the UOBPRGM Bit */
+ FLASH->CTRL &= CTRL_UOBPRGM_Rst;
+ }
+ }
+
+ /* Return the write protection process Status */
+ return status;
+}
+
+/**
+ * @brief Enables or disables the read out protection.
+ * @note If the user has already programmed the other option bytes before calling
+ * this function, he must re-program them since this function erases all option bytes.
+ * @note This function can be used for all at32f4xx devices.
+ * @param Newstate: new state of the ReadOut Protection.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_ReadProtectConfig(FunctionalState NewState)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* Authorizes the small information block programming */
+ FLASH->OPTKEYR = FLASH_KEY1;
+ FLASH->OPTKEYR = FLASH_KEY2;
+ FLASH->CTRL |= CTRL_UOBERS_Set;
+ FLASH->CTRL |= CTRL_STRT_Set;
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* if the erase process is completed, disable the UOBERS Bit */
+ FLASH->CTRL &= CTRL_UOBERS_Rst;
+ /* Enable the Option Bytes Programming process */
+ FLASH->CTRL |= CTRL_UOBPRGM_Set;
+
+ if(NewState != DISABLE)
+ {
+ UOPTB->RDPRT = 0x00;
+ }
+ else
+ {
+ UOPTB->RDPRT = RDPRT_Key;
+ }
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(status != FLASH_TIMEOUT)
+ {
+ /* if the program process is completed, disable the UOBPRGM Bit */
+ FLASH->CTRL &= CTRL_UOBPRGM_Rst;
+ }
+ }
+ else
+ {
+ if(status != FLASH_TIMEOUT)
+ {
+ /* Disable the UOBERS Bit */
+ FLASH->CTRL &= CTRL_UOBERS_Rst;
+ }
+ }
+ }
+
+ /* Return the protection process Status */
+ return status;
+}
+
+/**
+ * @brief Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY.
+ * @note This function can be used for all at32f4xx devices.
+ * @param UOB_IWDG: Selects the IWDG mode
+ * This parameter can be one of the following values:
+ * @arg UOB_SW_IWDG: Software IWDG selected
+ * @arg UOB_HW_IWDG: Hardware IWDG selected
+ * @param UOB_STOP: Reset event when entering STOP mode.
+ * This parameter can be one of the following values:
+ * @arg UOB_NO_RST_STP: No reset generated when entering in STOP
+ * @arg UOB_RST_STP: Reset generated when entering in STOP
+ * @param UOB_STDBY: Reset event when entering Standby mode.
+ * This parameter can be one of the following values:
+ * @arg UOB_NO_RST_STDBY: No reset generated when entering in STANDBY
+ * @arg UOB_RST_STDBY: Reset generated when entering in STANDBY
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_UserOptionByteConfig(uint16_t UOB_IWDG, uint16_t UOB_STOP, uint16_t UOB_STDBY)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+
+ /* Check the parameters */
+ assert_param(IS_UOB_IWDG_CFG(UOB_IWDG));
+ assert_param(IS_UOB_STOP_CFG(UOB_STOP));
+ assert_param(IS_UOB_STDBY_CFG(UOB_STDBY));
+
+ /* Authorize the small information block programming */
+ FLASH->OPTKEYR = FLASH_KEY1;
+ FLASH->OPTKEYR = FLASH_KEY2;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* Enable the Option Bytes Programming process */
+ FLASH->CTRL |= CTRL_UOBPRGM_Set;
+
+ UOPTB->USR = UOB_IWDG | (uint16_t)(UOB_STOP | (uint16_t)(UOB_STDBY | ((uint16_t)0xF8)));
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ if(status != FLASH_TIMEOUT)
+ {
+ /* if the program process is completed, disable the UOBPRGM Bit */
+ FLASH->CTRL &= CTRL_UOBPRGM_Rst;
+ }
+ }
+
+ /* Return the Option Byte program Status */
+ return status;
+}
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+/**
+ * @brief Configures to boot from Bank1 or Bank2.
+ * @note This function can be used only for at32f403_XL density devices.
+ * @param FLASH_BOOT: select the FLASH Bank to boot from.
+ * This parameter can be one of the following values:
+ * @arg FLASH_BOOT_FROM_BANK1: At startup, if boot pins are set in boot from user Flash
+ * position and this parameter is selected the device will boot from Bank1(Default).
+ * @arg FLASH_BOOT_FROM_BANK2: At startup, if boot pins are set in boot from user Flash
+ * position and this parameter is selected the device will boot from Bank2 or Bank1,
+ * depending on the activation of the bank. The active banks are checked in
+ * the following order: Bank2, followed by Bank1.
+ * The active bank is recognized by the value programmed at the base address
+ * of the respective bank (corresponding to the initial stack pointer value
+ * in the interrupt vector table).
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_BootOptConfig(uint16_t FLASH_BOOT)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ assert_param(IS_FLASH_BOOT_CFG(FLASH_BOOT));
+ /* Authorize the small information block programming */
+ FLASH->OPTKEYR = FLASH_KEY1;
+ FLASH->OPTKEYR = FLASH_KEY2;
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* Enable the Option Bytes Programming process */
+ FLASH->CTRL |= CTRL_UOBPRGM_Set;
+
+ if(FLASH_BOOT == FLASH_BOOT_FROM_BANK1)
+ {
+ UOPTB->USR |= UOB_USR_BTOPT;
+ }
+ else
+ {
+ UOPTB->USR &= (uint16_t)(~(uint16_t)(UOB_USR_BTOPT));
+ }
+
+ /* Wait for last process to be completed */
+ status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ if(status != FLASH_TIMEOUT)
+ {
+ /* if the program process is completed, disable the UOBPRGM Bit */
+ FLASH->CTRL &= CTRL_UOBPRGM_Rst;
+ }
+ }
+
+ /* Return the Option Byte program Status */
+ return status;
+}
+#endif
+
+/**
+ * @brief Returns the FLASH User Option Bytes values.
+ * @note This function can be used for all at32f4xx devices.
+ * @param None
+ * @retval The FLASH User Option Bytes values:IWDG_SW(Bit0), RST_STOP(Bit1)
+ * and RST_STDBY(Bit2).
+ */
+uint32_t FLASH_GetUserOptionByte(void)
+{
+ /* Return the User Option Byte */
+ return (uint32_t)(FLASH->UOB >> 2);
+}
+
+/**
+ * @brief Returns the FLASH Write Protection Option Bytes Register value.
+ * @note This function can be used for all at32f4xx devices.
+ * @param None
+ * @retval The FLASH Write Protection Option Bytes Register value
+ */
+uint32_t FLASH_GetWriteProtectStatus(void)
+{
+ /* Return the Flash write protection Register value */
+ return (uint32_t)(FLASH->WRPRT);
+}
+
+/**
+ * @brief Checks whether the FLASH Read Out Protection Status is set or not.
+ * @note This function can be used for all at32f4xx devices.
+ * @param None
+ * @retval FLASH ReadOut Protection Status(SET or RESET)
+ */
+FlagStatus FLASH_GetReadProtectStatus(void)
+{
+ FlagStatus readoutstatus = RESET;
+
+ if ((FLASH->UOB & RDPRT_Mask) != (uint32_t)RESET)
+ {
+ readoutstatus = SET;
+ }
+ else
+ {
+ readoutstatus = RESET;
+ }
+
+ return readoutstatus;
+}
+
+/**
+ * @brief Enables or disables the specified FLASH interrupts.
+ * @note This function can be used for all at32f4xx devices.
+ * - For AT32F4xx XL-Density devices, enables or disables the specified FLASH interrupts
+ for Bank1 and Bank2.
+ * - For other devices it enables or disables the specified FLASH interrupts for Bank1.
+ * @param FLASH_INT: specifies the FLASH interrupt sources to be enabled or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg FLASH_INT_FLR: FLASH Error Interrupt
+ * @arg FLASH_INT_PRCDN: FLASH end of process Interrupt
+ * @param NewState: new state of the specified Flash interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void FLASH_INTConfig(uint32_t FLASH_INT, FunctionalState NewState)
+{
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+ /* Check the parameters */
+ assert_param(IS_FLASH_INT(FLASH_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if((FLASH_INT & FLASH_INT_BANK2) != 0x0)
+ {
+ if(NewState != DISABLE)
+ {
+ /* Enable the interrupt sources */
+ FLASH->CTRL2 |= (FLASH_INT & FLASH_INT_BANK2_MASK);
+ }
+ else
+ {
+ /* Disable the interrupt sources */
+ FLASH->CTRL2 &= ~(uint32_t)(FLASH_INT & FLASH_INT_BANK2_MASK);
+ }
+ }
+ else if((FLASH_INT & FLASH_INT_BANK3) != 0x0)
+ {
+ if(NewState != DISABLE)
+ {
+ /* Enable the interrupt sources */
+ FLASH->CTRL3 |= (FLASH_INT & FLASH_INT_BANK3_MASK);
+ }
+ else
+ {
+ /* Disable the interrupt sources */
+ FLASH->CTRL3 &= ~(uint32_t)(FLASH_INT & FLASH_INT_BANK3_MASK);
+ }
+ }
+ else
+ {
+ if(NewState != DISABLE)
+ {
+ /* Enable the interrupt sources */
+ FLASH->CTRL |= FLASH_INT;
+ }
+ else
+ {
+ /* Disable the interrupt sources */
+ FLASH->CTRL &= ~(uint32_t)FLASH_INT;
+ }
+ }
+
+#else
+ /* Check the parameters */
+ assert_param(IS_FLASH_INT(FLASH_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+#if !defined (AT32F415xx)
+ if((FLASH_INT & FLASH_INT_BANK3) != 0x0)
+ {
+ if(NewState != DISABLE)
+ {
+ /* Enable the interrupt sources */
+ FLASH->CTRL3 |= (FLASH_INT & FLASH_INT_BANK3_MASK);
+ }
+ else
+ {
+ /* Disable the interrupt sources */
+ FLASH->CTRL3 &= ~(uint32_t)(FLASH_INT & FLASH_INT_BANK3_MASK);
+ }
+ }
+ else
+ {
+ if(NewState != DISABLE)
+ {
+ /* Enable the interrupt sources */
+ FLASH->CTRL |= FLASH_INT;
+ }
+ else
+ {
+ /* Disable the interrupt sources */
+ FLASH->CTRL &= ~(uint32_t)FLASH_INT;
+ }
+ }
+#else
+ if(NewState != DISABLE)
+ {
+ /* Enable the interrupt sources */
+ FLASH->CTRL |= FLASH_INT;
+ }
+ else
+ {
+ /* Disable the interrupt sources */
+ FLASH->CTRL &= ~(uint32_t)FLASH_INT;
+ }
+#endif
+
+#endif
+}
+
+/**
+ * @brief Checks whether the specified FLASH flag is set or not.
+ * @note This function can be used for all at32f4xx devices.
+ * - For AT32F4xx XL-Density devices, this function checks whether the specified
+ * Bank1 or Bank2 flag is set or not.
+ * - For other devices, it checks whether the specified Bank1 flag is
+ * set or not.
+ * @param FLASH_FLAG: specifies the FLASH flag to check.
+ * This parameter can be one of the following values:
+ * @arg FLASH_FLAG_BSY: FLASH Busy flag
+ * @arg FLASH_FLAG_PRGMFLR: FLASH Program error flag
+ * @arg FLASH_FLAG_WRPRTFLR: FLASH Write protected error flag
+ * @arg FLASH_FLAG_PRCDN: FLASH End of Operation flag
+ * @arg FLASH_FLAG_UOBFLR: FLASH Option Byte error flag
+ * @retval The new state of FLASH_FLAG (SET or RESET).
+ */
+FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+ /* Check the parameters */
+ assert_param(IS_FLASH_GET_FLAG(FLASH_FLAG)) ;
+
+ if(FLASH_FLAG == FLASH_FLAG_UOBFLR)
+ {
+ if((FLASH->UOB & FLASH_FLAG_UOBFLR) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ }
+ else
+ {
+ if((FLASH_FLAG & FLASH_FLAG_BANK3) != 0x0)
+ {
+ if((FLASH->STS3 & FLASH_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ }
+ else if((FLASH_FLAG & FLASH_FLAG_BANK2) != 0x0)
+ {
+ if((FLASH->STS2 & FLASH_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ }
+ else
+ {
+ if((FLASH->STS & FLASH_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ }
+ }
+
+#else
+ /* Check the parameters */
+ assert_param(IS_FLASH_GET_FLAG(FLASH_FLAG)) ;
+
+ if(FLASH_FLAG == FLASH_FLAG_UOBFLR)
+ {
+ if((FLASH->UOB & FLASH_FLAG_UOBFLR) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ }
+ else
+ {
+#if !defined (AT32F415xx)
+ if((FLASH_FLAG & FLASH_FLAG_BANK3) != 0x0)
+ {
+ if((FLASH->STS3 & FLASH_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ }
+ else
+ {
+ if((FLASH->STS & FLASH_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+ }
+#else
+ if((FLASH->STS & FLASH_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+#endif
+ }
+
+#endif
+
+ /* Return the new state of FLASH_FLAG (SET or RESET) */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the FLASH's pending flags.
+ * @note This function can be used for all at32f4xx devices.
+ * - For AT32F4xx XL-Density devices, this function clears Bank1 or Bank2 pending flags
+ * - For other devices, it clears Bank1 pending flags.
+ * @param FLASH_FLAG: specifies the FLASH flags to clear.
+ * This parameter can be any combination of the following values:
+ * @arg FLASH_FLAG_PRGMFLR: FLASH Program error flag
+ * @arg FLASH_FLAG_WRPRTFLR: FLASH Write protected error flag
+ * @arg FLASH_FLAG_PRCDN: FLASH End of Operation flag
+ * @retval None
+ */
+void FLASH_ClearFlag(uint32_t FLASH_FLAG)
+{
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+ /* Check the parameters */
+ assert_param(IS_FLASH_CLEAR_FLAG(FLASH_FLAG)) ;
+
+ if((FLASH_FLAG & FLASH_FLAG_BANK3) != 0x0)
+ {
+ /* Clear the flags */
+ FLASH->STS3 = FLASH_FLAG;
+ }
+ else if ((FLASH_FLAG & FLASH_FLAG_BANK2) != 0x0)
+ {
+ /* Clear the flags */
+ FLASH->STS2 = FLASH_FLAG;
+ }
+ else
+ {
+ /* Clear the flags */
+ FLASH->STS = FLASH_FLAG;
+ }
+
+#else
+ /* Check the parameters */
+ assert_param(IS_FLASH_CLEAR_FLAG(FLASH_FLAG)) ;
+
+#if !defined (AT32F415xx)
+ if((FLASH_FLAG & FLASH_FLAG_BANK3) != 0x0)
+ {
+ /* Clear the flags */
+ FLASH->STS3 = FLASH_FLAG;
+ }
+ else
+ {
+ /* Clear the flags */
+ FLASH->STS = FLASH_FLAG;
+ }
+#else
+ /* Clear the flags */
+ FLASH->STS = FLASH_FLAG;
+#endif
+
+#endif
+}
+
+/**
+ * @brief Returns the FLASH Status.
+ * @note This function can be used for all at32f4xx devices, it is equivalent
+ * to FLASH_GetBank1Status function.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_BSY, FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR or FLASH_PRC_DONE
+ */
+FLASH_Status FLASH_GetStatus(void)
+{
+ FLASH_Status flashstatus = FLASH_PRC_DONE;
+
+ if((FLASH->STS & FLASH_FLAG_BSY) == FLASH_FLAG_BSY)
+ {
+ flashstatus = FLASH_BSY;
+ }
+ else if((FLASH->STS & FLASH_FLAG_PRGMFLR) != 0)
+ {
+ flashstatus = FLASH_PGRM_FLR;
+ }
+ else if((FLASH->STS & FLASH_FLAG_WRPRTFLR) != 0 )
+ {
+ flashstatus = FLASH_WRPRT_FLR;
+ }
+ else
+ {
+ flashstatus = FLASH_PRC_DONE;
+ }
+
+ /* Return the Flash Status */
+ return flashstatus;
+}
+
+/**
+ * @brief Returns the FLASH Bank1 Status.
+ * @note This function can be used for all at32f4xx devices, it is equivalent
+ * to FLASH_GetStatus function.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_BSY, FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR or FLASH_PRC_DONE
+ */
+FLASH_Status FLASH_GetBank1Status(void)
+{
+ FLASH_Status flashstatus = FLASH_PRC_DONE;
+
+ if((FLASH->STS & FLASH_FLAG_BNK1_BSY) == FLASH_FLAG_BSY)
+ {
+ flashstatus = FLASH_BSY;
+ }
+ else if((FLASH->STS & FLASH_FLAG_BNK1_PRGMFLR) != 0)
+ {
+ flashstatus = FLASH_PGRM_FLR;
+ }
+ else if((FLASH->STS & FLASH_FLAG_BNK1_WRPRTFLR) != 0 )
+ {
+ flashstatus = FLASH_WRPRT_FLR;
+ }
+ else
+ {
+ flashstatus = FLASH_PRC_DONE;
+ }
+
+ /* Return the Flash Status */
+ return flashstatus;
+}
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+/**
+ * @brief Returns the FLASH Bank2 Status.
+ * @note This function can be used for at32f4xx XL-Density devices.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_BSY, FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR or FLASH_PRC_DONE
+ */
+FLASH_Status FLASH_GetBank2Status(void)
+{
+ FLASH_Status flashstatus = FLASH_PRC_DONE;
+
+ if((FLASH->STS2 & (FLASH_FLAG_BNK2_BSY & FLASH_INT_BANK2_MASK)) == (FLASH_FLAG_BNK2_BSY & FLASH_INT_BANK2_MASK))
+ {
+ flashstatus = FLASH_BSY;
+ }
+ else if((FLASH->STS2 & (FLASH_FLAG_BNK2_PRGMFLR & FLASH_INT_BANK2_MASK)) != 0)
+ {
+ flashstatus = FLASH_PGRM_FLR;
+ }
+ else if((FLASH->STS2 & (FLASH_FLAG_BNK2_WRPRTFLR & ~FLASH_INT_BANK2)) != 0 )
+ {
+ flashstatus = FLASH_WRPRT_FLR;
+ }
+ else
+ {
+ flashstatus = FLASH_PRC_DONE;
+ }
+
+ /* Return the Flash Status */
+ return flashstatus;
+}
+#endif
+
+#if !defined (AT32F415xx)
+/**
+ * @brief Returns the FLASH Bank3 Status.
+ * @note This function can not be used for AT32F415 devices, it is equivalent
+ * to FLASH_GetStatus function.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_BSY, FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR or FLASH_PRC_DONE
+ */
+FLASH_Status FLASH_GetBank3Status(void)
+{
+ FLASH_Status flashstatus = FLASH_PRC_DONE;
+
+
+ if((FLASH->STS3 & (FLASH_FLAG_BNK3_BSY & FLASH_INT_BANK3_MASK)) == (FLASH_FLAG_BNK3_BSY & FLASH_INT_BANK3_MASK))
+ {
+ flashstatus = FLASH_BSY;
+ }
+ else if((FLASH->STS3 & (FLASH_FLAG_BNK3_PRGMFLR & FLASH_INT_BANK3_MASK)) != 0)
+ {
+ flashstatus = FLASH_PGRM_FLR;
+ }
+ else if((FLASH->STS3 & (FLASH_FLAG_BNK3_WRPRTFLR & FLASH_INT_BANK3_MASK)) != 0 )
+ {
+ flashstatus = FLASH_WRPRT_FLR;
+ }
+ else
+ {
+ flashstatus = FLASH_PRC_DONE;
+ }
+
+ /* Return the Flash Status */
+ return flashstatus;
+}
+#endif
+
+/**
+ * @brief Waits for a Flash process to complete or a TIMEOUT to occur.
+ * @note This function can be used for all at32f4xx devices,
+ * it is equivalent to FLASH_WaitForBank1Process.
+ * - For AT32F4xx XL-Density devices this function waits for a Bank1 Flash process
+ * to complete or a TIMEOUT to occur.
+ * - For all other devices it waits for a Flash process to complete
+ * or a TIMEOUT to occur.
+ * @param Timeout: FLASH programming Timeout
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_WaitForProcess(uint32_t Timeout)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+
+ /* Check for the Flash Status */
+ status = FLASH_GetBank1Status();
+
+ /* Wait for a Flash process to complete or a TIMEOUT to occur */
+ while((status == FLASH_BSY) && (Timeout != 0x00))
+ {
+ status = FLASH_GetBank1Status();
+ Timeout--;
+ }
+
+ if(Timeout == 0x00 )
+ {
+ status = FLASH_TIMEOUT;
+ }
+
+ /* Return the process status */
+ return status;
+}
+
+/**
+ * @brief Waits for a Flash process on Bank1 to complete or a TIMEOUT to occur.
+ * @note This function can be used for all at32f4xx devices,
+ * it is equivalent to FLASH_WaitForProcess.
+ * @param Timeout: FLASH programming Timeout
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_WaitForBank1Process(uint32_t Timeout)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+
+ /* Check for the Flash Status */
+ status = FLASH_GetBank1Status();
+
+ /* Wait for a Flash process to complete or a TIMEOUT to occur */
+ while((status == FLASH_FLAG_BNK1_BSY) && (Timeout != 0x00))
+ {
+ status = FLASH_GetBank1Status();
+ Timeout--;
+ }
+
+ if(Timeout == 0x00 )
+ {
+ status = FLASH_TIMEOUT;
+ }
+
+ /* Return the process status */
+ return status;
+}
+
+#if defined(AT32F403Cx_XL) || defined(AT32F403Rx_XL) || defined(AT32F403Vx_XL) || defined(AT32F403Zx_XL) || \
+ defined(AT32F403ACGU7) || defined(AT32F403ACGT7) || defined(AT32F403ARGT7) || defined(AT32F403AVGT7) || \
+ defined(AT32F407RGT7) || defined(AT32F407VGT7)
+/**
+ * @brief Waits for a Flash process on Bank2 to complete or a TIMEOUT to occur.
+ * @note This function can be used only for at32f4xx XL-Density devices.
+ * @param Timeout: FLASH programming Timeout
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_WaitForBank2Process(uint32_t Timeout)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+
+ /* Check for the Flash Status */
+ status = FLASH_GetBank2Status();
+
+ /* Wait for a Flash process to complete or a TIMEOUT to occur */
+ while((status == (FLASH_FLAG_BNK2_BSY & FLASH_INT_BANK2_MASK)) && (Timeout != 0x00))
+ {
+ status = FLASH_GetBank2Status();
+ Timeout--;
+ }
+
+ if(Timeout == 0x00 )
+ {
+ status = FLASH_TIMEOUT;
+ }
+
+ /* Return the process status */
+ return status;
+}
+#endif
+
+#if !defined (AT32F415xx)
+/**
+ * @brief Waits for a Flash process on Bank3 to complete or a TIMEOUT to occur.
+ * @note This function can not be used for AT32F415 devices.
+ * @param Timeout: FLASH programming Timeout
+ * @retval FLASH Status: The returned value can be: FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_WaitForBank3Process(uint32_t Timeout)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+
+ /* Check for the Flash Status */
+ status = FLASH_GetBank3Status();
+
+ /* Wait for a Flash process to complete or a TIMEOUT to occur */
+ while((status == (FLASH_FLAG_BNK3_BSY & FLASH_INT_BANK3_MASK)) && (Timeout != 0x00))
+ {
+ status = FLASH_GetBank3Status();
+ Timeout--;
+ }
+
+ if(Timeout == 0x00 )
+ {
+ status = FLASH_TIMEOUT;
+ }
+
+ /* Return the process status */
+ return status;
+}
+#endif
+
+#if !defined (AT32F415xx)
+/**
+ * @brief To set the end address of encrypted data in BANK3.
+ * When the address is larger than this value, the writing data will be
+ * directly written to BANK3 without encryption.
+ * @note This function can not be used for AT32F415 devices.
+ * @param EndAddress: The end address of encrypted data in BANK3
+ * @retval: None
+ */
+void FLASH_Bank3EncEndAddrConfig(uint32_t EndAddress)
+{
+ assert_param(IS_IN_FLASH_BANK3_RANGE(EndAddress));
+ if((UOPTB->BANK3SCRKEY[0]==0xFFFFFFFF) && (UOPTB->BANK3SCRKEY[1]==0xFFFFFFFF) && \
+ (UOPTB->BANK3SCRKEY[2]==0xFFFFFFFF) && (UOPTB->BANK3SCRKEY[3]==0xFFFFFFFF))
+ return;
+ if((UOPTB->BANK3SCRKEY[0]==0xFF00FF00) && (UOPTB->BANK3SCRKEY[1]==0xFF00FF00) && \
+ (UOPTB->BANK3SCRKEY[2]==0xFF00FF00) && (UOPTB->BANK3SCRKEY[3]==0xFF00FF00))
+ return;
+ if((UOPTB->BANK3SCRKEY[0]==0x00FF00FF) && (UOPTB->BANK3SCRKEY[1]==0x00FF00FF) && \
+ (UOPTB->BANK3SCRKEY[2]==0x00FF00FF) && (UOPTB->BANK3SCRKEY[3]==0x00FF00FF))
+ return;
+ FLASH->DA = EndAddress;
+}
+#endif
+
+/**
+ * @brief Enable SLIB in Main Block
+ * @note This function can be used for all AT32F4xx devices.
+ * @param Psw: SLIB Password
+ * StartPage:SLIB Start Page
+ * DataPage: SLIB data Start Page
+ * EndPage: SLIB End Page
+ * => SLIB Range = Page#N to Page#C
+ * @retval FLASH Status: The returned value can be: FLASH_BSY, FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_SlibMainEnable(uint32_t Psw, uint16_t StartPage, uint16_t DataStartPage, uint16_t EndPage)
+{
+ uint32_t SlibRange;
+ FLASH_Status Status = FLASH_PRC_DONE;
+
+ assert_param(IS_SLIB_DISABLE());
+ assert_param((Psw != 0xFFFFFFFF)&&(Psw != 0x00000000));
+ assert_param((StartPage >= 1)&&(StartPage <= 127));
+ assert_param((DataStartPage >= 1)&&(DataStartPage <= 127));
+ assert_param((EndPage >= 1)&&(EndPage <= 127));
+
+ /* Wait for last process to be completed */
+ Status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ /*check param limits*/
+ if((StartPage>=DataStartPage) || ((DataStartPage>EndPage)&&(DataStartPage!=0x7FF)) || (StartPage>EndPage))
+ return Status;
+
+ SlibRange = ((uint32_t)DataStartPage<<11&FLASH_SLIB_DATA_START_PAGE) | ((uint32_t)EndPage<<22&FLASH_SLIB_END_PAGE) | ((uint32_t)StartPage&FLASH_SLIB_START_PAGE);
+
+ if(Status == FLASH_PRC_DONE)
+ {
+ /* Unlock SLIB CFG register */
+ FLASH->SLIB_KEYR = SLIB_UNLOCK_KEY;
+
+ /* Configure SLIB, set PSW and RANGE */
+ FLASH->SLIB_SET_PSW = Psw;
+ Status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+
+ FLASH->SLIB_SET_RANGE = SlibRange;
+ Status = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ }
+ return Status;
+}
+
+/**
+ * @brief Disable SLIB when SLIB enabled
+ * @note This function can be used for all AT32F4xx devices.
+ * @param Psw: SLIB Password
+ * @retval SUCCESS or ERROR
+ */
+uint32_t FLASH_SlibDisable(uint32_t Psw)
+{
+ FLASH_Status Status = FLASH_PRC_DONE;
+
+ assert_param(!IS_SLIB_DISABLE());
+
+ /* Write Password to disable SLIB */
+ FLASH->SLIB_PSW = Psw;
+ Status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(Status == FLASH_PRC_DONE)
+ {
+ if(FLASH->SLIB_PSW_STS & FLASH_SLIB_PSWSTS_PSW_OK)
+ return SUCCESS;
+ else
+ return ERROR;
+ }
+
+ return ERROR;
+}
+
+#if !defined (AT32F415xx)
+/**
+ * @brief Get the value of current remaining SLIB CFG count (range: 256~0)
+ * @note This function can not be used for AT32F415 devices.
+ * @param None
+ * @retval uint32_t
+ */
+uint32_t FLASH_GetSlibCurCnt(void)
+{
+ return ((FLASH->SLIB_PSW_STS & FLASH_SLIB_CNT) >> 16);
+}
+#endif
+
+/**
+ * @brief Get the SLIB state
+ * @note This function can be used for all AT32F4xx devices.
+ * @param None
+ * @retval ENABLE or DISABLE
+ */
+uint8_t FLASH_GetSlibState(void)
+{
+ if(FLASH->SLIB_CDR0&FLASH_SLIB_CDR0_SLIB_EN)
+ return ENABLE;
+ else
+ return DISABLE;
+}
+
+/**
+ * @brief Get the start page of SLIB
+ * @note This function can be used for all AT32F4xx devices
+ * @param None
+ * @retval uint16_t
+ */
+uint16_t FLASH_GetSlibStartPage(void)
+{
+ return (uint16_t)((FLASH->SLIB_CDR1&FLASH_SLIB_SET_START_PAGE)>>0);
+}
+
+/**
+ * @brief Get the data start page of SLIB
+ * @note This function can be used for all AT32F4xx devices
+ * @param None
+ * @retval uint16_t
+ */
+uint16_t FLASH_GetSlibDataStartPage(void)
+{
+ return (uint16_t)((FLASH->SLIB_CDR1&FLASH_SLIB_SET_DATA_START_PAGE)>>11);
+}
+
+/**
+ * @brief Get the end page of SLIB
+ * @note This function can be used for all AT32F4xx devices
+ * @param None
+ * @retval uint16_t
+ */
+uint16_t FLASH_GetSlibEndPage(void)
+{
+ return (uint16_t)((FLASH->SLIB_CDR1&FLASH_SLIB_SET_END_PAGE)>>22);
+}
+
+#if defined (AT32F415xx)
+/**
+ * @brief Configure System Memory as AP mode
+ * @note This function can be used only for AT32F415 device.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_BSY, FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_SYS_AP(void)
+{
+ volatile FLASH_Status tStatus = FLASH_PRC_DONE;
+
+ assert_param(IS_SLIB_DISABLE());
+ assert_param(IS_RDP_DISABLE());
+
+ if((FLASH->SLIB_CDR0 & FLASH_SLIB_CDR0_BOOT_DIS) == 0)
+ {
+ FLASH->SLIB_KEYR = SLIB_UNLOCK_KEY;
+ while((FLASH->SLIB_PSW_STS & FLASH_SLIB_UNLOCK) == 0);
+ FLASH->SYS_BOOT_DIS_SET = 0;
+ tStatus = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ }
+ return tStatus;
+}
+#endif /* AT32F415xx */
+
+#if defined (AT32F415xx)
+/**
+ * @brief Enable SLIB in System Memory
+ * @note This function can be used only for AT32F415 device.
+ * @param Psw: SLIB Password
+ * data_start_page: SLIB data Start Page
+ * @retval FLASH Status: The returned value can be: FLASH_BSY, FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_SlibSysEnable(uint32_t Psw,uint8_t data_start_page)
+{
+ volatile FLASH_Status tStatus = FLASH_PRC_DONE;
+ assert_param(IS_SLIB_DISABLE());
+
+ /* Wait for last process to be completed */
+ tStatus = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ /* Unlock SLIB CFG register */
+ FLASH->SLIB_KEYR = SLIB_UNLOCK_KEY;
+ while((FLASH->SLIB_PSW_STS & FLASH_SLIB_UNLOCK) == 0);
+
+ /* make sure System Memory as AP mode */
+ if(FLASH->SLIB_CDR0 & FLASH_SLIB_CDR0_BOOT_DIS)
+ {
+ FLASH->SYS_SLIB_SET = (data_start_page<<16)+0x5AA5;
+ tStatus = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ FLASH->SLIB_SET_PSW = Psw;
+ tStatus = FLASH_WaitForProcess(PRGM_TIMEOUT);
+ }
+
+ return tStatus;
+}
+#endif /* AT32F415xx */
+
+#if defined (AT32F415xx)
+/**
+ * @brief Check whether the option byte protection is set or not.
+ * @note This function can be used only for AT32F415 device.
+ * @param None
+ * @retval Flash option byte protection status(SET or RESET)
+ */
+FlagStatus FLASH_GetOptionByteProtectStatus(void)
+{
+ FlagStatus status = RESET;
+
+ if ((FLASH->UOB & FLASH_UOB_RDPRTEN) != (uint32_t)RESET)
+ {
+ if ((FLASH->UOB & FLASH_UOB_OPTION_BYTE_PRT_EN) != (uint32_t)RESET)
+ {
+ status = SET;
+ }
+ }
+
+ return status;
+}
+#endif /* AT32F415xx */
+
+#if defined (AT32F415xx)
+/**
+ * @brief Configure the option byte protection.
+ * @note If the user has already programmed the other option bytes before calling
+ * this function, he must re-program them since this function erases all option bytes.
+ * @note This function can be used only for AT32F415 device.
+ * @param None
+ * @retval FLASH Status: The returned value can be: FLASH_BSY, FLASH_PGRM_FLR,
+ * FLASH_WRPRT_FLR, FLASH_PRC_DONE or FLASH_TIMEOUT.
+ */
+FLASH_Status FLASH_RDPandOptionByteProtectEnable(void)
+{
+ FLASH_Status status = FLASH_PRC_DONE;
+ /* Check the parameters */
+
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ /* Unlock OTP2 */
+ FLASH->OPTKEYR = FLASH_KEY1;
+ FLASH->OPTKEYR = FLASH_KEY2;
+
+ /* Erase OTP2 */
+ FLASH->CTRL |= CTRL_UOBERS_Set;
+ FLASH->CTRL |= CTRL_STRT_Set;
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(status == FLASH_PRC_DONE)
+ {
+ FLASH->CTRL &= CTRL_UOBERS_Rst;
+
+ /* Program OTP2 */
+ FLASH->CTRL |= CTRL_UOBPRGM_Set;
+ UOPTB->RDPRT = OPTION_BYTE_PRT_Key;
+ status = FLASH_WaitForProcess(ERS_TIMEOUT);
+
+ if(status != FLASH_TIMEOUT)
+ {
+ FLASH->CTRL &= CTRL_UOBPRGM_Rst;
+ }
+ }
+ else
+ {
+ if(status != FLASH_TIMEOUT)
+ {
+ FLASH->CTRL &= CTRL_UOBERS_Rst;
+ }
+ }
+
+ /* Disable OTP write enable bit */
+ FLASH->CTRL &= CTRL_UOBWE_Rst;
+ }
+ return status;
+}
+#endif /* AT32F415xx */
+
+#if defined (AT32F415xx)
+/**
+ * @brief Disable the option byte protection.
+ * @note This function can be used only for AT32F415 device.
+ * @param None
+ * @retval None
+ */
+void FLASH_OptionByteProtectDisable(void)
+{
+ volatile FLASH_Status tStatus = FLASH_PRC_DONE;
+
+ if (FLASH_GetOptionByteProtectStatus() != SET)
+ {
+ /* option byte protection is not set */
+ return;
+ }
+ FLASH->CTRL |= FLASH_CTRL_OPTION_BYTE_PRT_DIS_TRIG;
+ tStatus = FLASH_WaitForProcess(ERS_TIMEOUT);
+}
+#endif /* AT32F415xx */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_gpio.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_gpio.c
new file mode 100644
index 0000000000000000000000000000000000000000..fdb54cd7fba5611095eb71b9ec23b7f1366909c0
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_gpio.c
@@ -0,0 +1,1166 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_gpio.c
+ * Description : at32f4xx GPIO source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_gpio.h"
+#include "at32f4xx_rcc.h"
+#include
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup GPIO
+ * @brief GPIO driver modules
+ * @{
+ */
+
+/** @defgroup GPIO_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup GPIO_Private_Defines
+ * @{
+ */
+
+/* ------------ RCC registers bit address in the alias region ----------------*/
+#define AFIO_OFFSET (AFIO_BASE - PERIPH_BASE)
+
+/* --- EVENTCR Register -----*/
+
+/* Alias word address of EVOE bit */
+#define EVCR_OFFSET (AFIO_OFFSET + 0x00)
+#define EVOE_BitNumber ((uint8_t)0x07)
+#define EVCR_EVOE_BB (PERIPH_BB_BASE + (EVCR_OFFSET * 32) + (EVOE_BitNumber * 4))
+
+
+/* --- MAPR Register ---*/
+/* Alias word address of MII_RMII_SEL bit */
+#define MAP_OFFSET (AFIO_OFFSET + 0x04)
+#define MII_RMII_SEL_BitNumber ((u8)0x17)
+#define MAPR_MII_RMII_SEL_BB (PERIPH_BB_BASE + (MAP_OFFSET * 32) + (MII_RMII_SEL_BitNumber * 4))
+
+
+#define EVCR_PORTPINCONFIG_MASK ((uint16_t)0xFF80)
+#define LSB_MASK ((uint16_t)0xFFFF)
+#define DBGAFR_POSITION_MASK ((uint32_t)0x000F0000)
+#define DBGAFR_SWJCONF_MASK ((uint32_t)0xF0FFFFFF)
+#define DBGAFR_LOCATION_MASK ((uint32_t)0x00200000)
+#define DBGAFR_NUMBITS_MASK ((uint32_t)0x00100000)
+/**
+ * @}
+ */
+
+/** @defgroup GPIO_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup GPIO_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup GPIO_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup GPIO_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the GPIOx peripheral registers to their default reset values.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @retval None
+ */
+void GPIO_Reset(GPIO_Type* GPIOx)
+{
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+
+ if (GPIOx == GPIOA)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOA, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOA, DISABLE);
+ }
+ else if (GPIOx == GPIOB)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOB, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOB, DISABLE);
+ }
+ else if (GPIOx == GPIOC)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOC, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOC, DISABLE);
+ }
+ else if (GPIOx == GPIOD)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOD, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOD, DISABLE);
+ }
+#if defined (AT32F403xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+ else if (GPIOx == GPIOE)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOE, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOE, DISABLE);
+ }
+#endif
+#if !defined (AT32F403Axx) && !defined (AT32F407xx)
+ else if (GPIOx == GPIOF)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOF, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOF, DISABLE);
+ }
+#endif
+#ifdef AT32F403xx
+ else if (GPIOx == GPIOG)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOG, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_GPIOG, DISABLE);
+ }
+#endif
+}
+
+/**
+ * @brief Deinitializes the Alternate Functions (remap, event control
+ * and EXTI configuration) registers to their default reset values.
+ * @param None
+ * @retval None
+ */
+void GPIO_AFIOReset(void)
+{
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_AFIO, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_AFIO, DISABLE);
+}
+
+/**
+ * @brief Initializes the GPIOx peripheral according to the specified
+ * parameters in the GPIO_InitStruct.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @param GPIO_InitStruct: pointer to a GPIO_InitType structure that
+ * contains the configuration information for the specified GPIO peripheral.
+ * @retval None
+ */
+void GPIO_Init(GPIO_Type* GPIOx, GPIO_InitType* GPIO_InitStruct)
+{
+ uint32_t currentmode = 0x00, currentpin = 0x00, pinpos = 0x00, pos = 0x00;
+ uint32_t tmpreg = 0x00, pinmask = 0x00;
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+ assert_param(IS_GPIO_MDE(GPIO_InitStruct->GPIO_Mode));
+ assert_param(IS_GPIO_PINS(GPIO_InitStruct->GPIO_Pins));
+
+ /*---------------------------- GPIO Mode Configuration -----------------------*/
+ currentmode = ((uint32_t)GPIO_InitStruct->GPIO_Mode) & ((uint32_t)0x0F);
+
+ if ((((uint32_t)GPIO_InitStruct->GPIO_Mode) & ((uint32_t)0x10)) != 0x00)
+ {
+ /* Check the parameters */
+ assert_param(IS_GPIO_MAXSPEED(GPIO_InitStruct->GPIO_MaxSpeed));
+ /* Output mode */
+ currentmode |= (uint32_t)GPIO_InitStruct->GPIO_MaxSpeed;
+ }
+
+ /*---------------------------- GPIO CRL Configuration ------------------------*/
+ /* Configure the eight low port pins */
+ if (((uint32_t)GPIO_InitStruct->GPIO_Pins & ((uint32_t)0x00FF)) != 0x00)
+ {
+ tmpreg = GPIOx->CTRLL;
+
+ for (pinpos = 0x00; pinpos < 0x08; pinpos++)
+ {
+ pos = ((uint32_t)0x01) << pinpos;
+ /* Get the port pins position */
+ currentpin = (GPIO_InitStruct->GPIO_Pins) & pos;
+
+ if (currentpin == pos)
+ {
+ pos = pinpos << 2;
+ /* Clear the corresponding low control register bits */
+ pinmask = ((uint32_t)0x0F) << pos;
+ tmpreg &= ~pinmask;
+ /* Write the mode configuration in the corresponding bits */
+ tmpreg |= (currentmode << pos);
+
+ /* Reset the corresponding ODR bit */
+ if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IN_PD)
+ {
+ GPIOx->BRE = (((uint32_t)0x01) << pinpos);
+ }
+ else
+ {
+ /* Set the corresponding ODR bit */
+ if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IN_PU)
+ {
+ GPIOx->BSRE = (((uint32_t)0x01) << pinpos);
+ }
+ }
+ }
+ }
+
+ GPIOx->CTRLL = tmpreg;
+ }
+
+ /*---------------------------- GPIO CRH Configuration ------------------------*/
+ /* Configure the eight high port pins */
+ if (GPIO_InitStruct->GPIO_Pins > 0x00FF)
+ {
+ tmpreg = GPIOx->CTRLH;
+
+ for (pinpos = 0x00; pinpos < 0x08; pinpos++)
+ {
+ pos = (((uint32_t)0x01) << (pinpos + 0x08));
+ /* Get the port pins position */
+ currentpin = ((GPIO_InitStruct->GPIO_Pins) & pos);
+
+ if (currentpin == pos)
+ {
+ pos = pinpos << 2;
+ /* Clear the corresponding high control register bits */
+ pinmask = ((uint32_t)0x0F) << pos;
+ tmpreg &= ~pinmask;
+ /* Write the mode configuration in the corresponding bits */
+ tmpreg |= (currentmode << pos);
+
+ /* Reset the corresponding ODR bit */
+ if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IN_PD)
+ {
+ GPIOx->BRE = (((uint32_t)0x01) << (pinpos + 0x08));
+ }
+
+ /* Set the corresponding ODR bit */
+ if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IN_PU)
+ {
+ GPIOx->BSRE = (((uint32_t)0x01) << (pinpos + 0x08));
+ }
+ }
+ }
+
+ GPIOx->CTRLH = tmpreg;
+ }
+}
+
+/**
+ * @brief Fills each GPIO_InitStruct member with its default value.
+ * @param GPIO_InitStruct : pointer to a GPIO_InitType structure which will
+ * be initialized.
+ * @retval None
+ */
+void GPIO_StructInit(GPIO_InitType* GPIO_InitStruct)
+{
+ /* Reset GPIO init structure parameters values */
+ GPIO_InitStruct->GPIO_Pins = GPIO_Pins_All;
+ GPIO_InitStruct->GPIO_MaxSpeed = GPIO_MaxSpeed_2MHz;
+ GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING;
+}
+
+/**
+ * @brief Reads the specified input port pin.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @param GPIO_Pin: specifies the port bit to read.
+ * This parameter can be GPIO_Pin_x where x can be (0..15).
+ * @retval The input port pin value.
+ */
+uint8_t GPIO_ReadInputDataBit(GPIO_Type* GPIOx, uint16_t GPIO_Pin)
+{
+ uint8_t bitstatus = 0x00;
+
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+ assert_param(IS_GET_GPIO_PINS(GPIO_Pin));
+
+ if ((GPIOx->IPTDT & GPIO_Pin) != (uint32_t)Bit_RESET)
+ {
+ bitstatus = (uint8_t)Bit_SET;
+ }
+ else
+ {
+ bitstatus = (uint8_t)Bit_RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Reads the specified GPIO input data port.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @retval GPIO input data port value.
+ */
+uint16_t GPIO_ReadInputData(GPIO_Type* GPIOx)
+{
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+
+ return ((uint16_t)GPIOx->IPTDT);
+}
+
+/**
+ * @brief Reads the specified output data port bit.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @param GPIO_Pin: specifies the port bit to read.
+ * This parameter can be GPIO_Pin_x where x can be (0..15).
+ * @retval The output port pin value.
+ */
+uint8_t GPIO_ReadOutputDataBit(GPIO_Type* GPIOx, uint16_t GPIO_Pin)
+{
+ uint8_t bitstatus = 0x00;
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+ assert_param(IS_GET_GPIO_PINS(GPIO_Pin));
+
+ if ((GPIOx->OPTDT & GPIO_Pin) != (uint32_t)Bit_RESET)
+ {
+ bitstatus = (uint8_t)Bit_SET;
+ }
+ else
+ {
+ bitstatus = (uint8_t)Bit_RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Reads the specified GPIO output data port.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @retval GPIO output data port value.
+ */
+uint16_t GPIO_ReadOutputData(GPIO_Type* GPIOx)
+{
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+
+ return ((uint16_t)GPIOx->OPTDT);
+}
+
+/**
+ * @brief Sets the selected data port bits.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @param GPIO_Pin: specifies the port bits to be written.
+ * This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
+ * @retval None
+ */
+void GPIO_SetBits(GPIO_Type* GPIOx, uint16_t GPIO_Pin)
+{
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+ assert_param(IS_GPIO_PINS(GPIO_Pin));
+
+ GPIOx->BSRE = GPIO_Pin;
+}
+
+/**
+ * @brief Clears the selected data port bits.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @param GPIO_Pin: specifies the port bits to be written.
+ * This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
+ * @retval None
+ */
+void GPIO_ResetBits(GPIO_Type* GPIOx, uint16_t GPIO_Pin)
+{
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+ assert_param(IS_GPIO_PINS(GPIO_Pin));
+
+ GPIOx->BRE = GPIO_Pin;
+}
+
+/**
+ * @brief Sets or clears the selected data port bit.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @param GPIO_Pin: specifies the port bit to be written.
+ * This parameter can be one of GPIO_Pin_x where x can be (0..15).
+ * @param BitVal: specifies the value to be written to the selected bit.
+ * This parameter can be one of the BitState enum values:
+ * @arg Bit_RESET: to clear the port pin
+ * @arg Bit_SET: to set the port pin
+ * @retval None
+ */
+void GPIO_WriteBit(GPIO_Type* GPIOx, uint16_t GPIO_Pin, BitState BitVal)
+{
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+ assert_param(IS_GET_GPIO_PINS(GPIO_Pin));
+ assert_param(IS_GPIO_BIT_STATE(BitVal));
+
+ if (BitVal != Bit_RESET)
+ {
+ GPIOx->BSRE = GPIO_Pin;
+ }
+ else
+ {
+ GPIOx->BRE = GPIO_Pin;
+ }
+}
+
+/**
+ * @brief Writes data to the specified GPIO data port.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @param PortVal: specifies the value to be written to the port output data register.
+ * @retval None
+ */
+void GPIO_Write(GPIO_Type* GPIOx, uint16_t PortVal)
+{
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+
+ GPIOx->OPTDT = PortVal;
+}
+
+/**
+ * @brief Locks GPIO Pins configuration registers.
+ * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
+ * @param GPIO_Pin: specifies the port bit to be written.
+ * This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
+ * @retval None
+ */
+void GPIO_PinsLockConfig(GPIO_Type* GPIOx, uint16_t GPIO_Pin)
+{
+ uint32_t tmp = 0x00010000;
+
+ /* Check the parameters */
+ assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
+ assert_param(IS_GPIO_PINS(GPIO_Pin));
+
+ tmp |= GPIO_Pin;
+ /* Set LCKK bit */
+ GPIOx->LOCK = tmp;
+ /* Reset LCKK bit */
+ GPIOx->LOCK = GPIO_Pin;
+ /* Set LCKK bit */
+ GPIOx->LOCK = tmp;
+ /* Read LCKK bit*/
+ tmp = GPIOx->LOCK;
+ /* Read LCKK bit*/
+ tmp = GPIOx->LOCK;
+}
+
+/**
+ * @brief Selects the GPIO pin used as Event output.
+ * @param GPIO_PortSource: selects the GPIO port to be used as source
+ * for Event output.
+ * This parameter can be GPIO_PortSourceGPIOx where x can be (A..E).
+ * @param GPIO_PinSource: specifies the pin for the Event output.
+ * This parameter can be GPIO_PinSourcex where x can be (0..15).
+ * @retval None
+ */
+void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
+{
+ uint32_t tmpreg = 0x00;
+ /* Check the parameters */
+ assert_param(IS_GPIO_EVENTOUT_PORT_SOURCE(GPIO_PortSource));
+ assert_param(IS_GPIO_PINS_SOURCE(GPIO_PinSource));
+
+ tmpreg = AFIO->EVCTRL;
+ /* Clear the PORT[6:4] and PIN[3:0] bits */
+ tmpreg &= EVCR_PORTPINCONFIG_MASK;
+ tmpreg |= (uint32_t)GPIO_PortSource << 0x04;
+ tmpreg |= GPIO_PinSource;
+ AFIO->EVCTRL = tmpreg;
+}
+
+/**
+ * @brief Enables or disables the Event Output.
+ * @param NewState: new state of the Event output.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void GPIO_EventOutputCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ *(__IO uint32_t *) EVCR_EVOE_BB = (uint32_t)NewState;
+}
+
+/**
+ * @brief Changes the mapping of the specified pin.
+ * @param GPIO_Remap: selects the pin to remap.
+ * This parameter can be one of the following values:
+ * @arg GPIO_Remap01_SPI1 : SPI1 Alternate Function mapping01
+ * @arg GPIO_Remap10_SPI1 : SPI1 Alternate Function mapping10
+ * @arg GPIO_Remap_I2C1 : I2C1 Alternate Function mapping
+ * @arg GPIO_Remap_USART1 : USART1 Alternate Function mapping
+ * @arg GPIO_Remap_USART2 : USART2 Alternate Function mapping
+ * @arg GPIO_PartialRemap_USART3 : USART3 Partial Alternate Function mapping
+ * @arg GPIO_FullRemap_USART3 : USART3 Full Alternate Function mapping
+ * @arg GPIO_PartialRemap_TMR1 : TMR1 Partial Alternate Function mapping
+ * @arg GPIO_FullRemap_TMR1 : TMR1 Full Alternate Function mapping
+ * @arg GPIO_PartialRemap1_TMR2 : TMR2 Partial1 Alternate Function mapping
+ * @arg GPIO_PartialRemap2_TMR2 : TMR2 Partial2 Alternate Function mapping
+ * @arg GPIO_FullRemap_TMR2 : TMR2 Full Alternate Function mapping
+ * @arg GPIO_PartialRemap_TMR3 : TMR3 Partial Alternate Function mapping
+ * @arg GPIO_FullRemap_TMR3 : TMR3 Full Alternate Function mapping
+ * @arg GPIO_Remap_TMR4 : TMR4 Alternate Function mapping
+ * @arg GPIO_Remap1_CAN1 : CAN1 Alternate Function mapping
+ * @arg GPIO_Remap2_CAN1 : CAN1 Alternate Function mapping
+ * @arg GPIO_Remap_PD01 : PD01 Alternate Function mapping
+ * @arg GPIO_Remap_TMR5CH4_LSI : LSI connected to TMR5 Channel4 input capture for calibration
+ * @arg GPIO_Remap_ADC1_EXTRGINJ : ADC1 External Trigger Injected Conversion remapping
+ * @arg GPIO_Remap_ADC1_EXTRGREG : ADC1 External Trigger Regular Conversion remapping
+ * @arg GPIO_Remap_ADC2_EXTRGINJ : ADC2 External Trigger Injected Conversion remapping
+ * @arg GPIO_Remap_ADC2_EXTRGREG : ADC2 External Trigger Regular Conversion remapping
+ * @arg GPIO_Remap_SWJ_NoJNTRST : Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST
+ * @arg GPIO_Remap_SWJ_JTAGDisable : JTAG-DP Disabled and SW-DP Enabled
+ * @arg GPIO_Remap_SWJ_AllDisable : Full SWJ Disabled (JTAG-DP + SW-DP)
+ * @arg GPIO_Remap_TMR15 : TMR15 Alternate Function mapping
+ * @arg GPIO_Remap_TMR9 : TMR9 Alternate Function mapping
+ * @arg GPIO_Remap_TMR10 : TMR10 Alternate Function mapping
+ * @arg GPIO_Remap_TMR11 : TMR11 Alternate Function mapping
+ * @arg GPIO_Remap_TMR13 : TMR13 Alternate Function mapping
+ * @arg GPIO_Remap_TMR14 : TMR14 Alternate Function mapping
+ * @arg GPIO_Remap_XMC_NADV : XMC_NADV Alternate Function mapping
+ * @arg GPIO_Remap_SPI4 : SPI4 Alternate Function mapping
+ * @arg GPIO_Remap_I2C3 : I2C3 Alternate Function mapping
+ * @arg GPIO_Remap01_SDIO2 : SDIO2 Alternate Function mapping 01:CK/CMD Remaped None,D0~D3 Remaped to PA4~PA7.
+ * @arg GPIO_Remap10_SDIO2 : SDIO2 Alternate Function mapping 10:CK/CMD Remaped to PA2/PA3,D0~D3 Remaped None.
+ * @arg GPIO_Remap11_SDIO2 : SDIO2 Alternate Function mapping 11:CK/CMD Remaped to PA2/PA3,D0~D3 Remaped to PA4~PA7.
+ * @arg GPIO_Remap_EXT_FLASH : EXT_FLASH Alternate Function mapping
+
+ * @arg AFIO_MAP3_TMR9_0010 : TMR9 Alternate Function mapping:
+ * @arg AFIO_MAP3_TMR10_0010 : TMR10 Alternate Function mapping:
+ * @arg AFIO_MAP3_TMR11_0010 : TMR11 Alternate Function mapping:
+ * @arg AFIO_MAP4_TMR1_0001 : TMR1 Alternate Function mapping
+ * @arg AFIO_MAP4_TMR2_0001 : TMR2 Alternate Function mapping 0001
+ * @arg AFIO_MAP4_TMR2_0010 : TMR2 Alternate Function mapping 0010
+ * @arg AFIO_MAP4_TMR2_0011 : TMR2 Alternate Function mapping 0011
+ * @arg AFIO_MAP4_TMR3_0010 : TMR3 Alternate Function mapping 0010
+ * @arg AFIO_MAP4_TMR3_0011 : TMR3 Alternate Function mapping 0011
+ * @arg AFIO_MAP4_TMR5_0001 : TMR5 Alternate Function mapping 0001: CH1/CH2
+ * @arg AFIO_MAP4_TMR5_1000 : TMR5 Alternate Function mapping 1000: CH4
+ * @arg AFIO_MAP4_TMR5_1001 : TMR5 Alternate Function mapping 1001: CH1/CH2+CH4
+ * @arg AFIO_MAP5_I2C1_0001 : I2C1 Alternate Function mapping 0001
+ * @arg AFIO_MAP5_I2C1_0011 : I2C1 Alternate Function mapping 0011
+ * @arg AFIO_MAP5_I2C2_0001 : I2C2 Alternate Function mapping 0001
+ * @arg AFIO_MAP5_I2C2_0010 : I2C2 Alternate Function mapping 0010
+ * @arg AFIO_MAP5_I2C2_0011 : I2C2 Alternate Function mapping 0011
+ * @arg AFIO_MAP5_SPI1_0001 : SPI1 Alternate Function mapping
+ * @arg AFIO_MAP5_SPI2_0001 : SPI2 Alternate Function mapping
+ * @arg AFIO_MAP6_CAN1_0010 : CAN1 Alternate Function mapping
+ * @arg AFIO_MAP6_CAN2_0001 : CAN2 Alternate Function mapping
+ * @arg AFIO_MAP6_SDIO_0100 : SDIO Alternate Function mapping 100
+ * @arg AFIO_MAP6_SDIO_0101 : SDIO Alternate Function mapping 101
+ * @arg AFIO_MAP6_SDIO_0110 : SDIO Alternate Function mapping 110
+ * @arg AFIO_MAP6_SDIO_0111 : SDIO Alternate Function mapping 111
+ * @arg AFIO_MAP6_USART1_0001 : USART1 Alternate Function mapping
+ * @arg AFIO_MAP6_USART3_0001 : USART3 Partial Alternate Function mapping
+ * @arg AFIO_MAP6_UART4_0001 : UART4 Alternate Function mapping
+ * @arg AFIO_MAP7_SPIF_1000 : EXT_FLASH Alternate Function mapping
+ * @arg AFIO_MAP7_SPIF_1001 : EXT_FLASH Alternate Function enable
+ * @arg AFIO_MAP7_ADC1_0001 : ADC1 External Trigger Injected Conversion remapping
+ * @arg AFIO_MAP7_ADC1_0010 : ADC1 External Trigger Regular Conversion remapping
+ * @arg AFIO_MAP7_ADC1_0011 : ADC1 External Trigger Regular & Injected Conversion remapping
+ * @arg AFIO_MAP7_ADC2_0001 : ADC2 External Trigger Injected Conversion remapping
+ * @arg AFIO_MAP7_ADC2_0010 : ADC2 External Trigger Regular Conversion remapping
+ * @arg AFIO_MAP7_ADC2_0011 : ADC2 External Trigger Regular & Injected Conversion remapping
+ * @arg AFIO_MAP7_SWJTAG_0001 : Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST
+ * @arg AFIO_MAP7_SWJTAG_0010 : JTAG-DP Disabled and SW-DP Enabled
+ * @arg AFIO_MAP7_SWJTAG_0100 : Full SWJ Disabled (JTAG-DP + SW-DP)
+ * @arg AFIO_MAP7_PD01_0001 : PD01 Alternate Function mapping
+ * @param NewState: new state of the port pin remapping.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void GPIO_PinsRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState)
+{
+#ifndef AT32F403xx
+ if(IS_GREMAP(GPIO_Remap))
+ {
+ uint32_t reg_ost = 0x00, bit_ost = 0x00, Remap_Addr, Remap_val;
+ volatile uint32_t *AFIO_MAPx;
+
+ /* Calculate the remap register value by parameter GPIO_Remap */
+ Remap_Addr = GPIO_Remap & 0x7FFFFFFF;
+ reg_ost = Remap_Addr >> 7;
+ Remap_Addr &= 0x7f;
+ bit_ost = Remap_Addr >> 4;
+ Remap_Addr &= 0x0f;
+
+#ifdef AT32F415xx
+ if(reg_ost != AFIO_MAP8)
+ Remap_val = Remap_Addr << (bit_ost * 4);
+ else
+ Remap_val = Remap_Addr << (bit_ost/2 * 4);
+#else
+ Remap_val = Remap_Addr << (bit_ost * 4);
+#endif
+
+ switch(reg_ost)
+ {
+ case AFIO_MAP3:
+ AFIO_MAPx = &(AFIO->MAP3);
+ break;
+
+ case AFIO_MAP4:
+ AFIO_MAPx = &(AFIO->MAP4);
+ break;
+
+ case AFIO_MAP5:
+ AFIO_MAPx = &(AFIO->MAP5);
+ break;
+
+ case AFIO_MAP6:
+ AFIO_MAPx = &(AFIO->MAP6);
+ break;
+
+ case AFIO_MAP7:
+ AFIO_MAPx = &(AFIO->MAP7);
+ break;
+
+#ifndef AT32F413xx
+ case AFIO_MAP8:
+ AFIO_MAPx = &(AFIO->MAP8);
+ break;
+#endif
+
+ default:
+ break;
+ }
+
+ if(bit_ost == BITS0)
+ {
+#ifdef AT32F415xx
+ if(reg_ost == AFIO_MAP8)
+ {
+ *AFIO_MAPx &= 0xFFFFFFFC;
+ }else
+ {
+ *AFIO_MAPx &= OFFSET_MASK0;
+ }
+#else
+ *AFIO_MAPx &= OFFSET_MASK0;
+#endif
+ }
+ else if(bit_ost == BITS1)
+ {
+ #ifdef AT32F415xx
+ if(reg_ost == AFIO_MAP8)
+ {
+ *AFIO_MAPx &= 0xFFFFFFF3;
+ }else
+ {
+ *AFIO_MAPx &= OFFSET_MASK1;
+ }
+ #elif defined (AT32F403Axx) || defined (AT32F407xx)
+ if(reg_ost == AFIO_MAP4)
+ {
+ if(Remap_Addr > 4)
+ {
+ *AFIO_MAPx &= 0xFFFFFF3F;
+ }else
+ {
+ *AFIO_MAPx &= 0xFFFFFFCF;
+ }
+ }else
+ {
+ *AFIO_MAPx &= OFFSET_MASK1;
+ }
+ #else
+ *AFIO_MAPx &= OFFSET_MASK1;
+ #endif
+ }
+ else if(bit_ost == BITS2)
+ {
+#ifdef AT32F415xx
+ if(reg_ost == AFIO_MAP8)
+ {
+ *AFIO_MAPx &= 0xFFFFFFCF;
+ }else
+ {
+ *AFIO_MAPx &= OFFSET_MASK2;
+ }
+#else
+ *AFIO_MAPx &= OFFSET_MASK2;
+#endif
+ }
+ else if(bit_ost == BITS3)
+ {
+#ifdef AT32F415xx
+ if(reg_ost == AFIO_MAP8)
+ {
+ *AFIO_MAPx &= 0xFFFFFF3F;
+ }else
+ {
+ *AFIO_MAPx &= OFFSET_MASK3;
+ }
+#else
+ *AFIO_MAPx &= OFFSET_MASK3;
+#endif
+ }
+ else if(bit_ost == BITS4)
+ {
+ *AFIO_MAPx &= OFFSET_MASK4;
+ }
+ else if(bit_ost == BITS5)
+ {
+ *AFIO_MAPx &= OFFSET_MASK5;
+ }
+ else if(bit_ost == BITS6)
+ {
+ *AFIO_MAPx &= OFFSET_MASK6;
+ }
+ else if(bit_ost == BITS7)
+ {
+ *AFIO_MAPx &= OFFSET_MASK7;
+ }
+
+ if(NewState == ENABLE)
+ {
+ *AFIO_MAPx |= Remap_val;
+ }
+
+ }
+ else
+#endif
+ {
+ /* Check the parameters */
+ assert_param(IS_GPIO_REMAP(GPIO_Remap));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ switch(GPIO_Remap)
+ {
+ case GPIO_Remap_I2C1:
+ case GPIO_Remap_USART1:
+ case GPIO_Remap_PD01:
+ case GPIO_Remap_TMR5CH4_LSI:
+ case GPIO_Remap_ADC1_EXTRGINJ:
+ case GPIO_Remap_ADC1_EXTRGREG:
+#if defined (AT32F403xx) || defined (AT32F403Axx) || defined (AT32F407xx)
+ case GPIO_Remap_USART2:
+ case GPIO_Remap_TMR4:
+#endif
+#ifndef AT32F415xx
+ case GPIO_Remap_ADC2_EXTRGINJ:
+ case GPIO_Remap_ADC2_EXTRGREG:
+#endif
+ AFIO->MAP &= ~GPIO_Remap;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap;
+ }
+
+ break;
+
+ case GPIO_Remap01_SPI1:
+ AFIO->MAP &= 0x7FFFFFFE;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap01_SPI1;
+ }
+
+ break;
+
+#ifdef AT32F403xx
+ case GPIO_Remap10_SPI1:
+ AFIO->MAP &= 0x7FFFFFFE;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap10_SPI1;
+ }
+
+ break;
+#endif
+
+ case GPIO_PartialRemap_USART3:
+ AFIO->MAP &= 0xFFFFFFCF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_PartialRemap_USART3;
+ }
+
+ break;
+
+#ifdef AT32F415xx
+ case GPIO_PartialRemap2_USART3:
+ AFIO->MAP &= 0xFFFFFFCF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_PartialRemap2_USART3;
+ }
+
+ break;
+
+ case GPIO_PartialRemap2_TMR1:
+ AFIO->MAP &= 0xFFFFFF3F;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_PartialRemap2_TMR1;
+ }
+
+ break;
+#endif
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || defined (AT32F407xx)
+ case GPIO_FullRemap_USART3:
+ AFIO->MAP &= 0xFFFFFFCF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_FullRemap_USART3;
+ }
+
+ break;
+#endif
+
+ case GPIO_PartialRemap_TMR1:
+ AFIO->MAP &= 0xFFFFFF3F;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_PartialRemap_TMR1;
+ }
+
+ break;
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || defined (AT32F407xx)
+ case GPIO_FullRemap_TMR1:
+ AFIO->MAP &= 0xFFFFFF3F;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_FullRemap_TMR1;
+ }
+
+ break;
+#endif
+
+ case GPIO_PartialRemap1_TMR2:
+ AFIO->MAP &= 0xFFFFFCFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_PartialRemap1_TMR2;
+ }
+
+ break;
+
+ case GPIO_PartialRemap2_TMR2:
+ AFIO->MAP &= 0xFFFFFCFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_PartialRemap2_TMR2;
+ }
+
+ break;
+
+ case GPIO_FullRemap_TMR2:
+ AFIO->MAP &= 0xFFFFFCFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_FullRemap_TMR2;
+ }
+
+ break;
+
+ case GPIO_PartialRemap_TMR3:
+ AFIO->MAP &= 0xFFFFF3FF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_PartialRemap_TMR3;
+ }
+
+ break;
+
+ case GPIO_FullRemap_TMR3:
+ AFIO->MAP &= 0xFFFFF3FF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_FullRemap_TMR3;
+ }
+
+ break;
+
+ case GPIO_Remap1_CAN1:
+ AFIO->MAP &= 0xFFFF9FFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap1_CAN1;
+ }
+
+ break;
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || defined (AT32F407xx)
+ case GPIO_Remap2_CAN1:
+ AFIO->MAP &= 0xFFFF9FFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap2_CAN1;
+ }
+
+ break;
+#endif
+
+ case GPIO_Remap_SWJ_NoJNTRST:
+ AFIO->MAP &= 0xF8FFFFFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap_SWJ_NoJNTRST;
+ }
+
+ break;
+
+ case GPIO_Remap_SWJ_JTAGDisable:
+ AFIO->MAP &= 0xF8FFFFFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap_SWJ_JTAGDisable;
+ }
+
+ break;
+
+ case GPIO_Remap_SWJ_AllDisable:
+ AFIO->MAP &= 0xF8FFFFFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap_SWJ_AllDisable;
+ }
+
+ break;
+
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+ case GPIO_Remap_PTP_PPS:
+ AFIO->MAP &= ~GPIO_Remap_PTP_PPS;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap_PTP_PPS;
+ }
+
+ break;
+
+ case GPIO_Remap_TMR2ITR1:
+ AFIO->MAP &= ~GPIO_Remap_TMR2ITR1;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap_TMR2ITR1;
+ }
+
+ break;
+
+ case GPIO_Remap_SPI3:
+ AFIO->MAP &= ~GPIO_Remap_SPI3;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap_SPI3;
+ }
+
+ break;
+
+ case GPIO_Remap_MII_RMII:
+ AFIO->MAP &= ~GPIO_Remap_MII_RMII;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap_MII_RMII;
+ }
+
+ break;
+
+ case GPIO_Remap_CAN2:
+ AFIO->MAP &= ~GPIO_Remap_CAN2;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap_CAN2;
+ }
+
+ break;
+
+ case GPIO_Remap_ETH:
+ AFIO->MAP &= ~GPIO_Remap_ETH;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP |= GPIO_Remap_ETH;
+ }
+
+ break;
+#endif
+
+#if defined (AT32F403xx)
+ case GPIO_Remap_TMR15:
+ case GPIO_Remap_TMR10:
+ case GPIO_Remap_TMR11:
+ case GPIO_Remap_TMR13:
+ case GPIO_Remap_TMR14:
+ AFIO->MAP2 &= ~(GPIO_Remap & 0x003FFFFF);
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP2 |= (GPIO_Remap & 0x003FFFFF);
+ }
+
+ break;
+#endif
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || defined (AT32F407xx)
+ case GPIO_Remap_TMR9:
+ case GPIO_Remap_XMC_NADV:
+ case GPIO_Remap_SPI4:
+ case GPIO_Remap_I2C3:
+ case GPIO_Remap_EXT_FLASH:
+ AFIO->MAP2 &= ~(GPIO_Remap & 0x003FFFFF);
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP2 |= (GPIO_Remap & 0x003FFFFF);
+ }
+
+ break;
+
+ case GPIO_Remap01_SDIO2:
+ AFIO->MAP2 &= 0xFFE7FFFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP2 |= (GPIO_Remap01_SDIO2 & 0x003FFFFF);
+ }
+
+ break;
+
+ case GPIO_Remap10_SDIO2:
+ AFIO->MAP2 &= 0xFFE7FFFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP2 |= (GPIO_Remap10_SDIO2 & 0x003FFFFF);
+ }
+
+ break;
+
+ case GPIO_Remap11_SDIO2:
+ AFIO->MAP2 &= 0xFFE7FFFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP2 |= (GPIO_Remap11_SDIO2 & 0x003FFFFF);
+ }
+
+ break;
+#elif defined (AT32F413xx)
+ case GPIO_Remap_EXT_FLASH:
+ AFIO->MAP2 &= ~(GPIO_Remap & 0x003FFFFF);
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP2 |= (GPIO_Remap & 0x003FFFFF);
+ }
+
+ break;
+#elif defined (AT32F415xx)
+ case GPIO_Remap01_COMP:
+ AFIO->MAP2 &= 0xF3FFFFFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP2 |= (GPIO_Remap01_COMP & 0xBFFFFFFF);
+ }
+
+ break;
+
+ case GPIO_Remap10_COMP:
+ AFIO->MAP2 &= 0xF3FFFFFF;
+
+ if(NewState == ENABLE)
+ {
+ AFIO->MAP2 |= (GPIO_Remap10_COMP & 0xBFFFFFFF);
+ }
+
+ break;
+#endif
+
+ default:
+ break;
+ }
+ }
+}
+
+/**
+ * @brief Selects the GPIO pin used as EXTI Line.
+ * @param GPIO_PortSource: selects the GPIO port to be used as source for EXTI lines.
+ * This parameter can be GPIO_PortSourceGPIOx where x can be (A..G).
+ * @param GPIO_PinSource: specifies the EXTI line to be configured.
+ * This parameter can be GPIO_PinSourcex where x can be (0..15).
+ * @retval None
+ */
+void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
+{
+ uint32_t tmp = 0x00;
+ /* Check the parameters */
+ assert_param(IS_GPIO_EXTI_PORT_SOURCE(GPIO_PortSource));
+ assert_param(IS_GPIO_PINS_SOURCE(GPIO_PinSource));
+
+ tmp = ((uint32_t)0x0F) << (0x04 * (GPIO_PinSource & (uint8_t)0x03));
+ AFIO->EXTIC[GPIO_PinSource >> 0x02] &= ~tmp;
+ AFIO->EXTIC[GPIO_PinSource >> 0x02] |= (((uint32_t)GPIO_PortSource) << (0x04 * (GPIO_PinSource & (uint8_t)0x03)));
+}
+
+/**
+ * @brief Selects the Ethernet media interface.
+ * @note This function applies only to AT32 Connectivity line devices.
+ * @param GPIO_ETH_MediaInterface: specifies the Media Interface mode.
+ * This parameter can be one of the following values:
+ * @arg GPIO_ETH_MediaInterface_MII: MII mode
+ * @arg GPIO_ETH_MediaInterface_RMII: RMII mode
+ * @retval None
+ */
+void GPIO_ETH_MediaInterfaceConfig(uint32_t GPIO_ETH_MediaInterface)
+{
+ assert_param(IS_GPIO_ETH_MEDIA_INTERFACE(GPIO_ETH_MediaInterface));
+ /* Configure MII_RMII selection bit */
+ *(__IO uint32_t *) MAPR_MII_RMII_SEL_BB = GPIO_ETH_MediaInterface;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_i2c.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_i2c.c
new file mode 100644
index 0000000000000000000000000000000000000000..02f237e169e2a1d53fb0423ba8f5ece3718afed2
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_i2c.c
@@ -0,0 +1,1251 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_i2c.c
+ * Description : at32f4xx I2C source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_i2c.h"
+#include "at32f4xx_rcc.h"
+
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup I2C
+ * @brief I2C driver modules
+ * @{
+ */
+
+/** @defgroup I2C_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup I2C_Private_Defines
+ * @{
+ */
+
+/* I2C SPE mask */
+#define CTRL1_PEN_Set ((uint16_t)0x0001)
+#define CTRL1_PEN_Reset ((uint16_t)0xFFFE)
+
+/* I2C START mask */
+#define CTRL1_STARTGEN_Set ((uint16_t)0x0100)
+#define CTRL1_STARTGEN_Reset ((uint16_t)0xFEFF)
+
+/* I2C STOP mask */
+#define CTRL1_STOPGEN_Set ((uint16_t)0x0200)
+#define CTRL1_STOPGEN_Reset ((uint16_t)0xFDFF)
+
+/* I2C ACK mask */
+#define CTRL1_ACKEN_Set ((uint16_t)0x0400)
+#define CTRL1_ACKEN_Reset ((uint16_t)0xFBFF)
+
+/* I2C ENGC mask */
+#define CTRL1_GCEN_Set ((uint16_t)0x0040)
+#define CTRL1_GCEN_Reset ((uint16_t)0xFFBF)
+
+/* I2C SWRST mask */
+#define CTRL1_SWRESET_Set ((uint16_t)0x8000)
+#define CTRL1_SWRESET_Reset ((uint16_t)0x7FFF)
+
+/* I2C PEC mask */
+#define CTRL1_PECTRA_Set ((uint16_t)0x1000)
+#define CTRL1_PECTRA_Reset ((uint16_t)0xEFFF)
+
+/* I2C ENPEC mask */
+#define CTRL1_PECEN_Set ((uint16_t)0x0020)
+#define CTRL1_PECEN_Reset ((uint16_t)0xFFDF)
+
+/* I2C ENARP mask */
+#define CTRL1_ARPEN_Set ((uint16_t)0x0010)
+#define CTRL1_ARPEN_Reset ((uint16_t)0xFFEF)
+
+/* I2C NOSTRETCH mask */
+#define CTRL1_NOCLKSTRETCH_Set ((uint16_t)0x0080)
+#define CTRL1_NOCLKSTRETCH_Reset ((uint16_t)0xFF7F)
+
+/* I2C registers Masks */
+#define CTRL1_CLEAR_MASK ((uint16_t)0xFBF5)
+
+/* I2C DMAEN mask */
+#define CTRL2_DMAEN_Set ((uint16_t)0x0800)
+#define CTRL2_DMAEN_Reset ((uint16_t)0xF7FF)
+
+/* I2C LAST mask */
+#define CTRL2_DMALAST_Set ((uint16_t)0x1000)
+#define CTRL2_DMALAST_Reset ((uint16_t)0xEFFF)
+
+/* I2C FREQ mask */
+#define CTRL2_CLKFREQ_Reset ((uint16_t)0xFF00)
+
+/* I2C ADD0 mask */
+#define OADDR1_ADDR0_Set ((uint16_t)0x0001)
+#define OADDR1_ADDR0_Reset ((uint16_t)0xFFFE)
+
+/* I2C ENDUAL mask */
+#define OADDR2_DUALEN_Set ((uint16_t)0x0001)
+#define OADDR2_DUALEN_Reset ((uint16_t)0xFFFE)
+
+/* I2C ADD2 mask */
+#define OADDR2_ADDR2_Reset ((uint16_t)0xFF01)
+
+/* I2C F/S mask */
+#define CLKCTRL_FSMODE_Set ((uint16_t)0x8000)
+
+/* I2C CCR mask */
+#define CLKCTRL_CLKCTRL_Set ((uint16_t)0x0FFF)
+
+/* I2C FLAG mask */
+#define FLAG_Mask ((uint32_t)0x00FFFFFF)
+
+/* I2C Interrupt Enable mask */
+#define INTEN_Mask ((uint32_t)0x07000000)
+
+/**
+ * @}
+ */
+
+/** @defgroup I2C_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup I2C_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup I2C_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup I2C_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the I2Cx peripheral registers to their default reset values.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @retval None
+ */
+void I2C_DeInit(I2C_Type* I2Cx)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+
+ if (I2Cx == I2C1)
+ {
+ /* Enable I2C1 reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_I2C1, ENABLE);
+ /* Release I2C1 from reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_I2C1, DISABLE);
+ }
+ else if (I2Cx == I2C2)
+ {
+ /* Enable I2C2 reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_I2C2, ENABLE);
+ /* Release I2C2 from reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_I2C2, DISABLE);
+ }
+#ifdef AT32F403xx
+ else if (I2Cx == I2C3)
+ {
+ /* Enable I2C3 reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_I2C3, ENABLE);
+ /* Release I2C3 from reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_I2C3, DISABLE);
+ }
+#endif
+}
+
+/**
+ * @brief Initializes the I2Cx peripheral according to the specified
+ * parameters in the I2C_InitStruct.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_InitStruct: pointer to a I2C_InitType structure that
+ * contains the configuration information for the specified I2C peripheral.
+ * @retval None
+ */
+void I2C_Init(I2C_Type* I2Cx, I2C_InitType* I2C_InitStruct)
+{
+ uint16_t tmpreg = 0, freqrange = 0;
+ uint16_t result = 0x04;
+ uint32_t pclk1 = 8000000;
+ RCC_ClockType rcc_clocks;
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_BIT_RATE(I2C_InitStruct->I2C_BitRate));
+ assert_param(IS_I2C_MODE(I2C_InitStruct->I2C_Mode));
+ assert_param(IS_I2C_FM_DUTY_CYCLE(I2C_InitStruct->I2C_FmDutyCycle));
+ assert_param(IS_I2C_OWN_ADDRESS1(I2C_InitStruct->I2C_OwnAddr1));
+ assert_param(IS_I2C_ACK_STATE(I2C_InitStruct->I2C_Ack));
+ assert_param(IS_I2C_ADDR_MODE(I2C_InitStruct->I2C_AddrMode));
+
+ /*---------------------------- I2Cx CTRL2 Configuration ------------------------*/
+ /* Get the I2Cx CTRL2 value */
+ tmpreg = I2Cx->CTRL2;
+ /* Clear frequency FREQ[7:0] bits */
+ tmpreg &= CTRL2_CLKFREQ_Reset;
+ /* Get pclk1 frequency value */
+ RCC_GetClocksFreq(&rcc_clocks);
+ pclk1 = rcc_clocks.APB1CLK_Freq;
+ /* Set frequency bits depending on pclk1 value */
+ freqrange = (uint16_t)(pclk1 / 1000000);
+ tmpreg |= freqrange;
+ /* Write to I2Cx CTRL2 */
+ I2Cx->CTRL2 = tmpreg;
+
+ /*---------------------------- I2Cx CCR Configuration ------------------------*/
+ /* Disable the selected I2C peripheral to configure TRISE */
+ I2Cx->CTRL1 &= CTRL1_PEN_Reset;
+ /* Reset tmpreg value */
+ /* Clear F/S, DUTY and CCR[11:0] bits */
+ tmpreg = 0;
+
+ /* Configure speed in standard mode */
+ if (I2C_InitStruct->I2C_BitRate <= 100000)
+ {
+ /* Standard mode speed calculate */
+ result = (uint16_t)(pclk1 / (I2C_InitStruct->I2C_BitRate << 1));
+
+ /* Test if CCR value is under 0x4*/
+ if (result < 0x04)
+ {
+ /* Set minimum allowed value */
+ result = 0x04;
+ }
+
+ /* Set speed value for standard mode */
+ tmpreg |= result;
+ /* Set Maximum Rise Time for standard mode */
+ I2Cx->TMRISE = freqrange + 1;
+ }
+ /* Configure speed in fast mode */
+ else /*(I2C_InitStruct->I2C_ClockSpeed <= 400000)*/
+ {
+ if (I2C_InitStruct->I2C_FmDutyCycle == I2C_FmDutyCycle_2_1)
+ {
+ /* Fast mode speed calculate: Tlow/Thigh = 2 */
+ result = (uint16_t)(pclk1 / (I2C_InitStruct->I2C_BitRate * 3));
+ }
+ else /*I2C_InitStruct->I2C_DutyCycle == I2C_FmDutyCycle_16_9*/
+ {
+ /* Fast mode speed calculate: Tlow/Thigh = 16/9 */
+ result = (uint16_t)(pclk1 / (I2C_InitStruct->I2C_BitRate * 25));
+ /* Set DUTY bit */
+ result |= I2C_FmDutyCycle_16_9;
+ }
+
+ /* Test if CCR value is under 0x1*/
+ if ((result & CLKCTRL_CLKCTRL_Set) == 0)
+ {
+ /* Set minimum allowed value */
+ result |= (uint16_t)0x0001;
+ }
+
+ /* Set speed value and set F/S bit for fast mode */
+ tmpreg |= (uint16_t)(result | CLKCTRL_FSMODE_Set);
+ /* Set Maximum Rise Time for fast mode */
+ I2Cx->TMRISE = (uint16_t)(((freqrange * (uint16_t)300) / (uint16_t)1000) + (uint16_t)1);
+ }
+
+ /* Write to I2Cx CCR */
+ I2Cx->CLKCTRL = tmpreg;
+ /* Enable the selected I2C peripheral */
+ I2Cx->CTRL1 |= CTRL1_PEN_Set;
+
+ /*---------------------------- I2Cx CTRL1 Configuration ------------------------*/
+ /* Get the I2Cx CTRL1 value */
+ tmpreg = I2Cx->CTRL1;
+ /* Clear ACK, SMBTYPE and SMBUS bits */
+ tmpreg &= CTRL1_CLEAR_MASK;
+ /* Configure I2Cx: mode and acknowledgement */
+ /* Set SMBTYPE and SMBUS bits according to I2C_Mode value */
+ /* Set ACK bit according to I2C_Ack value */
+ tmpreg |= (uint16_t)((uint32_t)I2C_InitStruct->I2C_Mode | I2C_InitStruct->I2C_Ack);
+ /* Write to I2Cx CTRL1 */
+ I2Cx->CTRL1 = tmpreg;
+
+ /*---------------------------- I2Cx OAR1 Configuration -----------------------*/
+ /* Set I2Cx Own Address1 and acknowledged address */
+ I2Cx->OADDR1 = (I2C_InitStruct->I2C_AddrMode | I2C_InitStruct->I2C_OwnAddr1);
+}
+
+/**
+ * @brief Fills each I2C_InitStruct member with its default value.
+ * @param I2C_InitStruct: pointer to an I2C_InitType structure which will be initialized.
+ * @retval None
+ */
+void I2C_StructInit(I2C_InitType* I2C_InitStruct)
+{
+ /*---------------- Reset I2C init structure parameters values ----------------*/
+ /* initialize the I2C_ClockSpeed member */
+ I2C_InitStruct->I2C_BitRate = 5000;
+ /* Initialize the I2C_Mode member */
+ I2C_InitStruct->I2C_Mode = I2C_Mode_I2CDevice;
+ /* Initialize the I2C_DutyCycle member */
+ I2C_InitStruct->I2C_FmDutyCycle = I2C_FmDutyCycle_2_1;
+ /* Initialize the I2C_OwnAddress1 member */
+ I2C_InitStruct->I2C_OwnAddr1 = 0;
+ /* Initialize the I2C_Ack member */
+ I2C_InitStruct->I2C_Ack = I2C_Ack_Disable;
+ /* Initialize the I2C_AcknowledgedAddress member */
+ I2C_InitStruct->I2C_AddrMode = I2C_AddrMode_7bit;
+}
+
+/**
+ * @brief Enables or disables the specified I2C peripheral.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2Cx peripheral.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_Cmd(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected I2C peripheral */
+ I2Cx->CTRL1 |= CTRL1_PEN_Set;
+ }
+ else
+ {
+ /* Disable the selected I2C peripheral */
+ I2Cx->CTRL1 &= CTRL1_PEN_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified I2C DMA requests.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2C DMA transfer.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_DMACmd(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected I2C DMA requests */
+ I2Cx->CTRL2 |= CTRL2_DMAEN_Set;
+ }
+ else
+ {
+ /* Disable the selected I2C DMA requests */
+ I2Cx->CTRL2 &= CTRL2_DMAEN_Reset;
+ }
+}
+
+/**
+ * @brief Specifies if the next DMA transfer will be the last one.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2C DMA last transfer.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_DMALastTransferCmd(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Next DMA transfer is the last transfer */
+ I2Cx->CTRL2 |= CTRL2_DMALAST_Set;
+ }
+ else
+ {
+ /* Next DMA transfer is not the last transfer */
+ I2Cx->CTRL2 &= CTRL2_DMALAST_Reset;
+ }
+}
+
+/**
+ * @brief Generates I2Cx communication START condition.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2C START condition generation.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None.
+ */
+void I2C_GenerateSTART(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Generate a START condition */
+ I2Cx->CTRL1 |= CTRL1_STARTGEN_Set;
+ }
+ else
+ {
+ /* Disable the START condition generation */
+ I2Cx->CTRL1 &= CTRL1_STARTGEN_Reset;
+ }
+}
+
+/**
+ * @brief Generates I2Cx communication STOP condition.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2C STOP condition generation.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None.
+ */
+void I2C_GenerateSTOP(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Generate a STOP condition */
+ I2Cx->CTRL1 |= CTRL1_STOPGEN_Set;
+ }
+ else
+ {
+ /* Disable the STOP condition generation */
+ I2Cx->CTRL1 &= CTRL1_STOPGEN_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified I2C acknowledge feature.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2C Acknowledgement.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None.
+ */
+void I2C_AcknowledgeConfig(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the acknowledgement */
+ I2Cx->CTRL1 |= CTRL1_ACKEN_Set;
+ }
+ else
+ {
+ /* Disable the acknowledgement */
+ I2Cx->CTRL1 &= CTRL1_ACKEN_Reset;
+ }
+}
+
+/**
+ * @brief Configures the specified I2C own address2.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param Address: specifies the 7bit I2C own address2.
+ * @retval None.
+ */
+void I2C_OwnAddress2Config(I2C_Type* I2Cx, uint8_t Address)
+{
+ uint16_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+
+ /* Get the old register value */
+ tmpreg = I2Cx->OADDR2;
+
+ /* Reset I2Cx Own address2 bit [7:1] */
+ tmpreg &= OADDR2_ADDR2_Reset;
+
+ /* Set I2Cx Own address2 */
+ tmpreg |= (uint16_t)((uint16_t)Address & (uint16_t)0x00FE);
+
+ /* Store the new register value */
+ I2Cx->OADDR2 = tmpreg;
+}
+
+/**
+ * @brief Enables or disables the specified I2C dual addressing mode.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2C dual addressing mode.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_DualAddressCmd(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable dual addressing mode */
+ I2Cx->OADDR2 |= OADDR2_DUALEN_Set;
+ }
+ else
+ {
+ /* Disable dual addressing mode */
+ I2Cx->OADDR2 &= OADDR2_DUALEN_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified I2C general call feature.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2C General call.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_GeneralCallCmd(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable generall call */
+ I2Cx->CTRL1 |= CTRL1_GCEN_Set;
+ }
+ else
+ {
+ /* Disable generall call */
+ I2Cx->CTRL1 &= CTRL1_GCEN_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified I2C interrupts.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_INT: specifies the I2C interrupts sources to be enabled or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg I2C_INT_BUF: Buffer interrupt mask
+ * @arg I2C_INT_EVT: Event interrupt mask
+ * @arg I2C_INT_ERR: Error interrupt mask
+ * @param NewState: new state of the specified I2C interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_INTConfig(I2C_Type* I2Cx, uint16_t I2C_INT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ assert_param(IS_I2C_CONFIG_INT(I2C_INT));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected I2C interrupts */
+ I2Cx->CTRL2 |= I2C_INT;
+ }
+ else
+ {
+ /* Disable the selected I2C interrupts */
+ I2Cx->CTRL2 &= (uint16_t)~I2C_INT;
+ }
+}
+
+/**
+ * @brief Sends a data byte through the I2Cx peripheral.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param Data: Byte to be transmitted..
+ * @retval None
+ */
+void I2C_SendData(I2C_Type* I2Cx, uint8_t Data)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ /* Write in the DR register the data to be sent */
+ I2Cx->DT = Data;
+}
+
+/**
+ * @brief Returns the most recent received data by the I2Cx peripheral.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @retval The value of the received data.
+ */
+uint8_t I2C_ReceiveData(I2C_Type* I2Cx)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ /* Return the data in the DR register */
+ return (uint8_t)I2Cx->DT;
+}
+
+/**
+ * @brief Transmits the address byte to select the slave device.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param Address: specifies the slave address which will be transmitted
+ * @param I2C_Direction: specifies whether the I2C device will be a
+ * Transmitter or a Receiver. This parameter can be one of the following values
+ * @arg I2C_Direction_Transmit: Transmitter mode
+ * @arg I2C_Direction_Receive: Receiver mode
+ * @retval None.
+ */
+void I2C_Send7bitAddress(I2C_Type* I2Cx, uint8_t Address, uint8_t I2C_Direction)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_DIRECTION(I2C_Direction));
+
+ /* Test on the direction to set/reset the read/write bit */
+ if (I2C_Direction != I2C_Direction_Transmit)
+ {
+ /* Set the address bit0 for read */
+ Address |= OADDR1_ADDR0_Set;
+ }
+ else
+ {
+ /* Reset the address bit0 for write */
+ Address &= OADDR1_ADDR0_Reset;
+ }
+
+ /* Send the address */
+ I2Cx->DT = Address;
+}
+
+/**
+ * @brief Reads the specified I2C register and returns its value.
+ * @param I2C_Register: specifies the register to read.
+ * This parameter can be one of the following values:
+ * @arg I2C_Register_CTRL1: CTRL1 register.
+ * @arg I2C_Register_CTRL2: CTRL2 register.
+ * @arg I2C_Register_OADDR1: OAR1 register.
+ * @arg I2C_Register_OADDR2: OAR2 register.
+ * @arg I2C_Register_DT: DR register.
+ * @arg I2C_Register_STS1: SR1 register.
+ * @arg I2C_Register_STS2: SR2 register.
+ * @arg I2C_Register_CLKCTRL: CCR register.
+ * @arg I2C_Register_TMRISE: TRISE register.
+ * @retval The value of the read register.
+ */
+uint16_t I2C_ReadRegister(I2C_Type* I2Cx, uint8_t I2C_Register)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_REGISTER(I2C_Register));
+
+ tmp = (uint32_t) I2Cx;
+ tmp += I2C_Register;
+
+ /* Return the selected register value */
+ return (*(__IO uint16_t *) tmp);
+}
+
+/**
+ * @brief Enables or disables the specified I2C software reset.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2C software reset.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_SoftwareResetCmd(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Peripheral under reset */
+ I2Cx->CTRL1 |= CTRL1_SWRESET_Set;
+ }
+ else
+ {
+ /* Peripheral not under reset */
+ I2Cx->CTRL1 &= CTRL1_SWRESET_Reset;
+ }
+}
+
+/**
+ * @brief Selects the specified I2C NACK position in master receiver mode.
+ * This function is useful in I2C Master Receiver mode when the number
+ * of data to be received is equal to 2. In this case, this function
+ * should be called (with parameter I2C_NACKPosition_Next) before data
+ * reception starts,as described in the 2-byte reception procedure
+ * recommended in Reference Manual in Section: Master receiver.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_NACKPosition: specifies the NACK position.
+ * This parameter can be one of the following values:
+ * @arg I2C_NACKPosition_Next: indicates that the next byte will be the last
+ * received byte.
+ * @arg I2C_NACKPosition_Current: indicates that current byte is the last
+ * received byte.
+ *
+ * @note This function configures the same bit (POS) as I2C_PECPositionConfig()
+ * but is intended to be used in I2C mode while I2C_PECPositionConfig()
+ * is intended to used in SMBUS mode.
+ *
+ * @retval None
+ */
+void I2C_NACKPositionConfig(I2C_Type* I2Cx, uint16_t I2C_NACKPosition)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_NACK_POSITION(I2C_NACKPosition));
+
+ /* Check the input parameter */
+ if (I2C_NACKPosition == I2C_NACKPosition_Next)
+ {
+ /* Next byte in shift register is the last received byte */
+ I2Cx->CTRL1 |= I2C_NACKPosition_Next;
+ }
+ else
+ {
+ /* Current byte in shift register is the last received byte */
+ I2Cx->CTRL1 &= I2C_NACKPosition_Current;
+ }
+}
+
+/**
+ * @brief Drives the SMBusAlert pin high or low for the specified I2C.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_SMBusAlert: specifies SMBAlert pin level.
+ * This parameter can be one of the following values:
+ * @arg I2C_SMBusAlert_Low: SMBAlert pin driven low
+ * @arg I2C_SMBusAlert_High: SMBAlert pin driven high
+ * @retval None
+ */
+void I2C_SMBusAlertConfig(I2C_Type* I2Cx, uint16_t I2C_SMBusAlert)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_SMBUS_ALERT(I2C_SMBusAlert));
+
+ if (I2C_SMBusAlert == I2C_SMBusAlert_Low)
+ {
+ /* Drive the SMBusAlert pin Low */
+ I2Cx->CTRL1 |= I2C_SMBusAlert_Low;
+ }
+ else
+ {
+ /* Drive the SMBusAlert pin High */
+ I2Cx->CTRL1 &= I2C_SMBusAlert_High;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified I2C PEC transfer.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2C PEC transmission.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_TransmitPEC(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected I2C PEC transmission */
+ I2Cx->CTRL1 |= CTRL1_PECTRA_Set;
+ }
+ else
+ {
+ /* Disable the selected I2C PEC transmission */
+ I2Cx->CTRL1 &= CTRL1_PECTRA_Reset;
+ }
+}
+
+/**
+ * @brief Selects the specified I2C PEC position.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_PECPosition: specifies the PEC position.
+ * This parameter can be one of the following values:
+ * @arg I2C_PECPosition_Next: indicates that the next byte is PEC
+ * @arg I2C_PECPosition_Current: indicates that current byte is PEC
+ *
+ * @note This function configures the same bit (POS) as I2C_NACKPositionConfig()
+ * but is intended to be used in SMBUS mode while I2C_NACKPositionConfig()
+ * is intended to used in I2C mode.
+ *
+ * @retval None
+ */
+void I2C_PECPositionConfig(I2C_Type* I2Cx, uint16_t I2C_PECPosition)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_PEC_POSITION(I2C_PECPosition));
+
+ if (I2C_PECPosition == I2C_PECPosition_Next)
+ {
+ /* Next byte in shift register is PEC */
+ I2Cx->CTRL1 |= I2C_PECPosition_Next;
+ }
+ else
+ {
+ /* Current byte in shift register is PEC */
+ I2Cx->CTRL1 &= I2C_PECPosition_Current;
+ }
+}
+
+/**
+ * @brief Enables or disables the PEC value calculation of the transferred bytes.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2Cx PEC value calculation.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_CalculatePEC(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected I2C PEC calculation */
+ I2Cx->CTRL1 |= CTRL1_PECEN_Set;
+ }
+ else
+ {
+ /* Disable the selected I2C PEC calculation */
+ I2Cx->CTRL1 &= CTRL1_PECEN_Reset;
+ }
+}
+
+/**
+ * @brief Returns the PEC value for the specified I2C.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @retval The PEC value.
+ */
+uint8_t I2C_GetPEC(I2C_Type* I2Cx)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ /* Return the selected I2C PEC value */
+ return ((I2Cx->STS2) >> 8);
+}
+
+/**
+ * @brief Enables or disables the specified I2C ARP.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2Cx ARP.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_ARPCmd(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected I2C ARP */
+ I2Cx->CTRL1 |= CTRL1_ARPEN_Set;
+ }
+ else
+ {
+ /* Disable the selected I2C ARP */
+ I2Cx->CTRL1 &= CTRL1_ARPEN_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified I2C Clock stretching.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param NewState: new state of the I2Cx Clock stretching.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2C_StretchClockCmd(I2C_Type* I2Cx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState == DISABLE)
+ {
+ /* Enable the selected I2C Clock stretching */
+ I2Cx->CTRL1 |= CTRL1_NOCLKSTRETCH_Set;
+ }
+ else
+ {
+ /* Disable the selected I2C Clock stretching */
+ I2Cx->CTRL1 &= CTRL1_NOCLKSTRETCH_Reset;
+ }
+}
+
+/**
+ * @brief Selects the specified I2C fast mode duty cycle.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_DutyCycle: specifies the fast mode duty cycle.
+ * This parameter can be one of the following values:
+ * @arg I2C_FmDutyCycle_2_1: I2C fast mode Tlow/Thigh = 2
+ * @arg I2C_FmDutyCycle_16_9: I2C fast mode Tlow/Thigh = 16/9
+ * @retval None
+ */
+void I2C_FastModeDutyCycleConfig(I2C_Type* I2Cx, uint16_t I2C_DutyCycle)
+{
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_FM_DUTY_CYCLE(I2C_DutyCycle));
+
+ if (I2C_DutyCycle != I2C_FmDutyCycle_16_9)
+ {
+ /* I2C fast mode Tlow/Thigh=2 */
+ I2Cx->CLKCTRL &= I2C_FmDutyCycle_2_1;
+ }
+ else
+ {
+ /* I2C fast mode Tlow/Thigh=16/9 */
+ I2Cx->CLKCTRL |= I2C_FmDutyCycle_16_9;
+ }
+}
+
+/**
+ * @brief Checks whether the last I2Cx Event is equal to the one passed
+ * as parameter.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_EVENT: specifies the event to be checked.
+ * This parameter can be one of the following values:
+ * @arg I2C_EVENT_SLAVE_ADDRESS_TRANSMITTER_MATCHED : EV1
+ * @arg I2C_EVENT_SLAVE_ADDRESS_RECEIVER_MATCHED : EV1
+ * @arg I2C_EVENT_SLAVE_SECONDADDRESS_TRANSMITTER_MATCHED : EV1
+ * @arg I2C_EVENT_SLAVE_SECONDADDRESS_RECEIVER_MATCHED : EV1
+ * @arg I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED : EV1
+ * @arg I2C_EVENT_SLAVE_DATA_RECEIVED : EV2
+ * @arg (I2C_EVENT_SLAVE_DATA_RECEIVED | I2C_FLAG_DUALF) : EV2
+ * @arg (I2C_EVENT_SLAVE_DATA_RECEIVED | I2C_FLAG_GCADDRF) : EV2
+ * @arg I2C_EVENT_SLAVE_DATA_TRANSMITTED : EV3
+ * @arg (I2C_EVENT_SLAVE_DATA_TRANSMITTED | I2C_FLAG_DUALF) : EV3
+ * @arg (I2C_EVENT_SLAVE_DATA_TRANSMITTED | I2C_FLAG_GCADDRF) : EV3
+ * @arg I2C_EVENT_SLAVE_ACK_FAILURE_DETECTED : EV3_2
+ * @arg I2C_EVENT_SLAVE_STOP_DETECTED : EV4
+ * @arg I2C_EVENT_MASTER_START_GENERATED : EV5
+ * @arg I2C_EVENT_MASTER_ADDRESS | I2C_EVENT_MASTER_TRANSMITTER : EV6
+ * @arg I2C_EVENT_MASTER_ADDRESS_WITH_RECEIVER : EV6
+ * @arg I2C_EVENT_MASTER_DATA_RECEIVED : EV7
+ * @arg I2C_EVENT_MASTER_DATA_TRANSMITTING : EV8
+ * @arg I2C_EVENT_MASTER_DATA_TRANSMITTED : EV8_2
+ * @arg I2C_EVENT_MASTER_ADDRESS10_GENERATED : EV9
+ *
+ * @note: For detailed description of Events, please refer to section
+ * I2C_Events in at32f4xx_i2c.h file.
+ *
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: Last event is equal to the I2C_EVENT
+ * - ERROR: Last event is different from the I2C_EVENT
+ */
+ErrorStatus I2C_CheckEvent(I2C_Type* I2Cx, uint32_t I2C_EVENT)
+{
+ uint32_t lastevent = 0;
+ uint32_t flag1 = 0, flag2 = 0;
+ ErrorStatus status = ERROR;
+
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_EVENT(I2C_EVENT));
+
+ /* Read the I2Cx status register */
+ flag1 = I2Cx->STS1;
+ flag2 = I2Cx->STS2;
+ flag2 = flag2 << 16;
+
+ /* Get the last event value from I2C status register */
+ lastevent = (flag1 | flag2) & FLAG_Mask;
+
+ /* Check whether the last event contains the I2C_EVENT */
+ if ((lastevent & I2C_EVENT) == I2C_EVENT)
+ {
+ /* SUCCESS: last event is equal to I2C_EVENT */
+ status = SUCCESS;
+ }
+ else
+ {
+ /* ERROR: last event is different from I2C_EVENT */
+ status = ERROR;
+ }
+
+ /* Return status */
+ return status;
+}
+
+/**
+ * @brief Returns the last I2Cx Event.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ *
+ * @note: For detailed description of Events, please refer to section
+ * I2C_Events in at32f4xx_i2c.h file.
+ *
+ * @retval The last event
+ */
+uint32_t I2C_GetLastEvent(I2C_Type* I2Cx)
+{
+ uint32_t lastevent = 0;
+ uint32_t flag1 = 0, flag2 = 0;
+
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+
+ /* Read the I2Cx status register */
+ flag1 = I2Cx->STS1;
+ flag2 = I2Cx->STS2;
+ flag2 = flag2 << 16;
+
+ /* Get the last event value from I2C status register */
+ lastevent = (flag1 | flag2) & FLAG_Mask;
+
+ /* Return status */
+ return lastevent;
+}
+
+/**
+ * @brief Checks whether the specified I2C flag is set or not.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg I2C_FLAG_DUALF: Dual flag (Slave mode)
+ * @arg I2C_FLAG_SMBHOSTADDRF: SMBus host header (Slave mode)
+ * @arg I2C_FLAG_SMBDEFTADDRF: SMBus default header (Slave mode)
+ * @arg I2C_FLAG_GCADDRF: General call header flag (Slave mode)
+ * @arg I2C_FLAG_TRF: Transmitter/Receiver flag
+ * @arg I2C_FLAG_BUSYF: Bus busy flag
+ * @arg I2C_FLAG_MSF: Master/Slave flag
+ * @arg I2C_FLAG_SMBALERTF: SMBus Alert flag
+ * @arg I2C_FLAG_TIMOUT: Timeout or Tlow error flag
+ * @arg I2C_FLAG_PECERR: PEC error in reception flag
+ * @arg I2C_FLAG_OVRUN: Overrun/Underrun flag (Slave mode)
+ * @arg I2C_FLAG_ACKFAIL: Acknowledge failure flag
+ * @arg I2C_FLAG_ARLOST: Arbitration lost flag (Master mode)
+ * @arg I2C_FLAG_BUSERR: Bus error flag
+ * @arg I2C_FLAG_TDE: Data register empty flag (Transmitter)
+ * @arg I2C_FLAG_RDNE: Data register not empty (Receiver) flag
+ * @arg I2C_FLAG_STOPF: Stop detection flag (Slave mode)
+ * @arg I2C_FLAG_ADDR10F: 10-bit header sent flag (Master mode)
+ * @arg I2C_FLAG_BTFF: Byte transfer finished flag
+ * @arg I2C_FLAG_ADDRF: Address sent flag (Master mode) "ADSL"
+ * Address matched flag (Slave mode)"ENDA"
+ * @arg I2C_FLAG_STARTF: Start bit flag (Master mode)
+ * @retval The new state of I2C_FLAG (SET or RESET).
+ */
+FlagStatus I2C_GetFlagStatus(I2C_Type* I2Cx, uint32_t I2C_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ __IO uint32_t i2creg = 0, i2cxbase = 0;
+
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_GET_FLAG(I2C_FLAG));
+
+ /* Get the I2Cx peripheral base address */
+ i2cxbase = (uint32_t)I2Cx;
+
+ /* Read flag register index */
+ i2creg = I2C_FLAG >> 28;
+
+ /* Get bit[23:0] of the flag */
+ I2C_FLAG &= FLAG_Mask;
+
+ if(i2creg != 0)
+ {
+ /* Get the I2Cx SR1 register address */
+ i2cxbase += 0x14;
+ }
+ else
+ {
+ /* Flag in I2Cx SR2 Register */
+ I2C_FLAG = (uint32_t)(I2C_FLAG >> 16);
+ /* Get the I2Cx SR2 register address */
+ i2cxbase += 0x18;
+ }
+
+ if(((*(__IO uint32_t *)i2cxbase) & I2C_FLAG) != (uint32_t)RESET)
+ {
+ /* I2C_FLAG is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* I2C_FLAG is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the I2C_FLAG status */
+ return bitstatus;
+}
+
+
+
+/**
+ * @brief Clears the I2Cx's pending flags.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_FLAG: specifies the flag to clear.
+ * This parameter can be any combination of the following values:
+ * @arg I2C_FLAG_SMBALERTF: SMBus Alert flag
+ * @arg I2C_FLAG_TIMOUT: Timeout or Tlow error flag
+ * @arg I2C_FLAG_PECERR: PEC error in reception flag
+ * @arg I2C_FLAG_OVRUN: Overrun/Underrun flag (Slave mode)
+ * @arg I2C_FLAG_ACKFAIL: Acknowledge failure flag
+ * @arg I2C_FLAG_ARLOST: Arbitration lost flag (Master mode)
+ * @arg I2C_FLAG_BUSERR: Bus error flag
+ *
+ * @note
+ * - STOPF (STOP detection) is cleared by software sequence: a read operation
+ * to I2C_SR1 register (I2C_GetFlagStatus()) followed by a write operation
+ * to I2C_CTRL1 register (I2C_Cmd() to re-enable the I2C peripheral).
+ * - ADD10 (10-bit header sent) is cleared by software sequence: a read
+ * operation to I2C_SR1 (I2C_GetFlagStatus()) followed by writing the
+ * second byte of the address in DR register.
+ * - BTF (Byte Transfer Finished) is cleared by software sequence: a read
+ * operation to I2C_SR1 register (I2C_GetFlagStatus()) followed by a
+ * read/write to I2C_DR register (I2C_SendData()).
+ * - ADDR (Address sent) is cleared by software sequence: a read operation to
+ * I2C_SR1 register (I2C_GetFlagStatus()) followed by a read operation to
+ * I2C_SR2 register ((void)(I2Cx->SR2)).
+ * - SB (Start Bit) is cleared software sequence: a read operation to I2C_SR1
+ * register (I2C_GetFlagStatus()) followed by a write operation to I2C_DR
+ * register (I2C_SendData()).
+ * @retval None
+ */
+void I2C_ClearFlag(I2C_Type* I2Cx, uint32_t I2C_FLAG)
+{
+ uint32_t flagpos = 0;
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_CLEAR_FLAG(I2C_FLAG));
+ /* Get the I2C flag position */
+ flagpos = I2C_FLAG & FLAG_Mask;
+ /* Clear the selected I2C flag */
+ I2Cx->STS1 = (uint16_t)~flagpos;
+}
+
+/**
+ * @brief Checks whether the specified I2C interrupt has occurred or not.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_INT: specifies the interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg I2C_INT_SMBALERTF: SMBus Alert flag
+ * @arg I2C_INT_TIMOUT: Timeout or Tlow error flag
+ * @arg I2C_INT_PECERR: PEC error in reception flag
+ * @arg I2C_INT_OVRUN: Overrun/Underrun flag (Slave mode)
+ * @arg I2C_INT_ACKFAIL: Acknowledge failure flag
+ * @arg I2C_INT_ARLOST: Arbitration lost flag (Master mode)
+ * @arg I2C_INT_BUSERR: Bus error flag
+ * @arg I2C_INT_TDE: Data register empty flag (Transmitter)
+ * @arg I2C_INT_RDNE: Data register not empty (Receiver) flag
+ * @arg I2C_INT_STOPF: Stop detection flag (Slave mode)
+ * @arg I2C_INT_ADDR10F: 10-bit header sent flag (Master mode)
+ * @arg I2C_INT_BTFF: Byte transfer finished flag
+ * @arg I2C_INT_ADDRF: Address sent flag (Master mode) "ADSL"
+ * Address matched flag (Slave mode)"ENDAD"
+ * @arg I2C_INT_STARTF: Start bit flag (Master mode)
+ * @retval The new state of I2C_INT (SET or RESET).
+ */
+ITStatus I2C_GetINTStatus(I2C_Type* I2Cx, uint32_t I2C_INT)
+{
+ ITStatus bitstatus = RESET;
+ uint32_t enablestatus = 0;
+
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_GET_INT(I2C_INT));
+
+ /* Check if the interrupt source is enabled or not */
+ enablestatus = (uint32_t)(((I2C_INT & INTEN_Mask) >> 16) & (I2Cx->CTRL2)) ;
+
+ /* Get bit[23:0] of the flag */
+ I2C_INT &= FLAG_Mask;
+
+ /* Check the status of the specified I2C flag */
+ if (((I2Cx->STS1 & I2C_INT) != (uint32_t)RESET) && enablestatus)
+ {
+ /* I2C_INT is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* I2C_INT is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the I2C_INT status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the I2Cx interrupt pending bits.
+ * @param I2Cx: where x can be 1, 2 or 3 to select the I2C peripheral.
+ * @param I2C_INT: specifies the interrupt pending bit to clear.
+ * This parameter can be any combination of the following values:
+ * @arg I2C_INT_SMBALERTF: SMBus Alert interrupt
+ * @arg I2C_INT_TIMOUT: Timeout or Tlow error interrupt
+ * @arg I2C_INT_PECERR: PEC error in reception interrupt
+ * @arg I2C_INT_OVRUN: Overrun/Underrun interrupt (Slave mode)
+ * @arg I2C_INT_ACKFAIL: Acknowledge failure interrupt
+ * @arg I2C_INT_ARLOST: Arbitration lost interrupt (Master mode)
+ * @arg I2C_INT_BUSERR: Bus error interrupt
+ *
+ * @note
+ * - STOPF (STOP detection) is cleared by software sequence: a read operation
+ * to I2C_SR1 register (I2C_GetINTStatus()) followed by a write operation to
+ * I2C_CTRL1 register (I2C_Cmd() to re-enable the I2C peripheral).
+ * - ADD10 (10-bit header sent) is cleared by software sequence: a read
+ * operation to I2C_SR1 (I2C_GetINTStatus()) followed by writing the second
+ * byte of the address in I2C_DR register.
+ * - BTF (Byte Transfer Finished) is cleared by software sequence: a read
+ * operation to I2C_SR1 register (I2C_GetINTStatus()) followed by a
+ * read/write to I2C_DR register (I2C_SendData()).
+ * - ADDR (Address sent) is cleared by software sequence: a read operation to
+ * I2C_SR1 register (I2C_GetINTStatus()) followed by a read operation to
+ * I2C_SR2 register ((void)(I2Cx->SR2)).
+ * - SB (Start Bit) is cleared by software sequence: a read operation to
+ * I2C_SR1 register (I2C_GetINTStatus()) followed by a write operation to
+ * I2C_DR register (I2C_SendData()).
+ * @retval None
+ */
+void I2C_ClearITPendingBit(I2C_Type* I2Cx, uint32_t I2C_INT)
+{
+ uint32_t flagpos = 0;
+ /* Check the parameters */
+ assert_param(IS_I2C_ALL_PERIPH(I2Cx));
+ assert_param(IS_I2C_CLEAR_INT(I2C_INT));
+ /* Get the I2C flag position */
+ flagpos = I2C_INT & FLAG_Mask;
+ /* Clear the selected I2C flag */
+ I2Cx->STS1 = (uint16_t)~flagpos;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_iwdg.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_iwdg.c
new file mode 100644
index 0000000000000000000000000000000000000000..00684f93a80bbf92df877880386b780d9a456124
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_iwdg.c
@@ -0,0 +1,181 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_iwdg.c
+ * Description : at32f4xx IWDG source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_iwdg.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup IWDG
+ * @brief IWDG driver modules
+ * @{
+ */
+
+/** @defgroup IWDG_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup IWDG_Private_Defines
+ * @{
+ */
+
+/* ---------------------- IWDG registers bit mask ----------------------------*/
+
+/* KR register bit mask */
+#define KR_KEY_Reload ((uint16_t)0xAAAA)
+#define KR_KEY_Enable ((uint16_t)0xCCCC)
+
+/**
+ * @}
+ */
+
+/** @defgroup IWDG_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup IWDG_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup IWDG_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup IWDG_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Enables or disables write access to IWDG_PR and IWDG_RLR registers.
+ * @param IWDG_WriteAccess: new state of write access to IWDG_PR and IWDG_RLR registers.
+ * This parameter can be one of the following values:
+ * @arg IWDG_KeyRegWrite_Enable: Enable write access to IWDG_PR and IWDG_RLR registers
+ * @arg IWDG_KeyRegWrite_Disable: Disable write access to IWDG_PR and IWDG_RLR registers
+ * @retval None
+ */
+void IWDG_KeyRegWrite(uint16_t IWDG_WriteAccess)
+{
+ /* Check the parameters */
+ assert_param(IS_IWDG_KEY_REG_WRITE(IWDG_WriteAccess));
+ IWDG->KEY = IWDG_WriteAccess;
+}
+
+/**
+ * @brief Sets IWDG Prescaler value.
+ * @param IWDG_Prescaler: specifies the IWDG Prescaler value.
+ * This parameter can be one of the following values:
+ * @arg IWDG_Psc_4: IWDG prescaler set to 4
+ * @arg IWDG_Psc_8: IWDG prescaler set to 8
+ * @arg IWDG_Psc_16: IWDG prescaler set to 16
+ * @arg IWDG_Psc_32: IWDG prescaler set to 32
+ * @arg IWDG_Psc_64: IWDG prescaler set to 64
+ * @arg IWDG_Psc_128: IWDG prescaler set to 128
+ * @arg IWDG_Psc_256: IWDG prescaler set to 256
+ * @retval None
+ */
+void IWDG_SetPrescaler(uint8_t IWDG_Prescaler)
+{
+ /* Check the parameters */
+ assert_param(IS_IWDG_PSC(IWDG_Prescaler));
+ IWDG->PSC = IWDG_Prescaler;
+}
+
+/**
+ * @brief Sets IWDG Reload value.
+ * @param Reload: specifies the IWDG Reload value.
+ * This parameter must be a number between 0 and 0x0FFF.
+ * @retval None
+ */
+void IWDG_SetReload(uint16_t Reload)
+{
+ /* Check the parameters */
+ assert_param(IS_IWDG_RLD(Reload));
+ IWDG->RLD = Reload;
+}
+
+/**
+ * @brief Reloads IWDG counter with value defined in the reload register
+ * (write access to IWDG_PR and IWDG_RLR registers disabled).
+ * @param None
+ * @retval None
+ */
+void IWDG_ReloadCounter(void)
+{
+ IWDG->KEY = KR_KEY_Reload;
+}
+
+/**
+ * @brief Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled).
+ * @param None
+ * @retval None
+ */
+void IWDG_Enable(void)
+{
+ IWDG->KEY = KR_KEY_Enable;
+}
+
+/**
+ * @brief Checks whether the specified IWDG flag is set or not.
+ * @param IWDG_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg IWDG_FLAG_PSCF: Prescaler Value Update on going
+ * @arg IWDG_FLAG_RLDF: Reload Value Update on going
+ * @retval The new state of IWDG_FLAG (SET or RESET).
+ */
+FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_IWDG_FLAG(IWDG_FLAG));
+
+ if ((IWDG->STS & IWDG_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ /* Return the flag status */
+ return bitstatus;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_pwr.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_pwr.c
new file mode 100644
index 0000000000000000000000000000000000000000..8cae1a2fb1e708c4ae3d0f61f58c5064f16d5155
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_pwr.c
@@ -0,0 +1,377 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_pwr.c
+ * Description : at32f4xx PWR source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_pwr.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup PWR
+ * @brief PWR driver modules
+ * @{
+ */
+
+/** @defgroup PWR_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup PWR_Private_Defines
+ * @{
+ */
+
+/* --------- PWR registers bit address in the alias region ---------- */
+#define PWR_OFFSET (PWR_BASE - PERIPH_BASE)
+
+/* --- CTRL Register ---*/
+
+/* Alias word address of DBP bit */
+#define CTRL_OFFSET (PWR_OFFSET + 0x00)
+#define DBP_BitNumber 0x08
+#define CTRL_DBP_BB (PERIPH_BB_BASE + (CTRL_OFFSET * 32) + (DBP_BitNumber * 4))
+
+/* Alias word address of PVDE bit */
+#define PVDE_BitNumber 0x04
+#define CTRL_PVDE_BB (PERIPH_BB_BASE + (CTRL_OFFSET * 32) + (PVDE_BitNumber * 4))
+
+/* --- CTRLSTS Register ---*/
+
+/* Alias word address of EWUP bit */
+#define CTRLSTS_OFFSET (PWR_OFFSET + 0x04)
+#define EWUP_BitNumber 0x08
+#define CTRLSTS_EWUP_BB (PERIPH_BB_BASE + (CTRLSTS_OFFSET * 32) + (EWUP_BitNumber * 4))
+
+/* ------------------ PWR registers bit mask ------------------------ */
+
+/* CTRL register bit mask */
+#if defined (AT32F403xx) || defined (AT32F413xx)
+ #define CTRL_DS_MASK ((uint32_t)0xFFFFFFFD)
+#else
+ #define CTRL_DS_MASK ((uint32_t)0xFFFFFFFC)
+#endif
+#define CTRL_PVDS_MASK ((uint32_t)0xFFFFFF1F)
+
+
+/**
+ * @}
+ */
+
+/** @defgroup PWR_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup PWR_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup PWR_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup PWR_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the PWR peripheral registers to their default reset values.
+ * @param None
+ * @retval None
+ */
+void PWR_Reset(void)
+{
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_PWR, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_PWR, DISABLE);
+}
+
+/**
+ * @brief Enables or disables access to the RTC and backup registers.
+ * @param NewState: new state of the access to the RTC and backup registers.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void PWR_BackupAccessCtrl(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) CTRL_DBP_BB = (uint32_t)NewState;
+}
+
+/**
+ * @brief Enables or disables the Power Voltage Detector(PVD).
+ * @param NewState: new state of the PVD.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void PWR_PVDCtrl(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) CTRL_PVDE_BB = (uint32_t)NewState;
+}
+
+/**
+ * @brief Configures the voltage threshold detected by the Power Voltage Detector(PVD).
+ * @param PWR_PVDLevel: specifies the PVD detection level
+ * This parameter can be one of the following values:
+ * @arg PWR_PVDS_2V2: PVD detection level set to 2.2V
+ * @arg PWR_PVDS_2V3: PVD detection level set to 2.3V
+ * @arg PWR_PVDS_2V4: PVD detection level set to 2.4V
+ * @arg PWR_PVDS_2V5: PVD detection level set to 2.5V
+ * @arg PWR_PVDS_2V6: PVD detection level set to 2.6V
+ * @arg PWR_PVDS_2V7: PVD detection level set to 2.7V
+ * @arg PWR_PVDS_2V8: PVD detection level set to 2.8V
+ * @arg PWR_PVDS_2V9: PVD detection level set to 2.9V
+ * @retval None
+ */
+void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_PWR_PVD_LEVEL(PWR_PVDLevel));
+ tmpreg = PWR->CTRL;
+ /* Clear PLS[7:5] bits */
+ tmpreg &= CTRL_PVDS_MASK;
+ /* Set PLS[7:5] bits according to PWR_PVDLevel value */
+ tmpreg |= PWR_PVDLevel;
+ /* Store the new value */
+ PWR->CTRL = tmpreg;
+}
+
+/**
+ * @brief Enables or disables the WakeUp Pin functionality.
+ * @param NewState: new state of the WakeUp Pin functionality.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void PWR_WakeUpPinCtrl(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) CTRLSTS_EWUP_BB = (uint32_t)NewState;
+}
+
+/**
+ * @brief Enters Sleep mode.
+ * @note In Sleep mode, all I/O pins keep the same state as in Run mode.
+ * @param PWR_SLEEPEntry: specifies if SLEEP mode in entered with WFI or WFE instruction.
+ * This parameter can be one of the following values:
+ * @arg PWR_SLEEPEntry_WFI: enter SLEEP mode with WFI instruction
+ * @arg PWR_SLEEPEntry_WFE: enter SLEEP mode with WFE instruction
+ * @retval None
+ */
+void PWR_EnterSleepMode(uint8_t PWR_SLEEPEntry)
+{
+ /* Check the parameters */
+ assert_param(IS_PWR_SLEEP_ENTRY(PWR_SLEEPEntry));
+
+ /* Clear SLEEPDEEP bit of Cortex System Control Register */
+ SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP_Msk);
+
+ /* Select SLEEP mode entry -------------------------------------------------*/
+ if(PWR_SLEEPEntry == PWR_SLEEPEntry_WFI)
+ {
+ /* Request Wait For Interrupt */
+ __WFI();
+ }
+ else
+ {
+ /* Request Wait For Event */
+ __SEV();
+ __WFE();
+ __WFE();
+ }
+}
+
+#if defined (AT32F403xx) || defined (AT32F413xx)
+/**
+ * @brief Enters STOP mode.
+ * @param PWR_STOPEntry: specifies if STOP mode in entered with WFI or WFE instruction.
+ * This parameter can be one of the following values:
+ * @arg PWR_STOPEntry_WFI: enter STOP mode with WFI instruction
+ * @arg PWR_STOPEntry_WFE: enter STOP mode with WFE instruction
+ * @retval None
+ */
+void PWR_EnterSTOPMode(uint8_t PWR_STOPEntry)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_PWR_STOP_ENTRY(PWR_STOPEntry));
+
+ /* Select the regulator state in STOP mode ---------------------------------*/
+ tmpreg = PWR->CTRL;
+ /* Clear PDDS bit */
+ tmpreg &= CTRL_DS_MASK;
+ /* Store the new value */
+ PWR->CTRL = tmpreg;
+ /* Set SLEEPDEEP bit of Cortex System Control Register */
+ SCB->SCR |= SCB_SCR_SLEEPDEEP;
+
+ /* Select STOP mode entry --------------------------------------------------*/
+ if(PWR_STOPEntry == PWR_STOPEntry_WFI)
+ {
+ /* Request Wait For Interrupt */
+ __WFI();
+ }
+ else
+ {
+ /* Request Wait For Event */
+ __SEV();
+ __WFE();
+ __WFE();
+ }
+
+ /* Reset SLEEPDEEP bit of Cortex System Control Register */
+ SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP);
+}
+#else
+/**
+ * @brief Enters STOP mode.
+ * @param PWR_Regulator: specifies the regulator state in STOP mode.
+ * This parameter can be one of the following values:
+ * @arg PWR_Regulator_ON: STOP mode with regulator ON
+ * @param PWR_STOPEntry: specifies if STOP mode in entered with WFI or WFE instruction.
+ * This parameter can be one of the following values:
+ * @arg PWR_STOPEntry_WFI: enter STOP mode with WFI instruction
+ * @arg PWR_STOPEntry_WFE: enter STOP mode with WFE instruction
+ * @retval None
+ */
+void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_PWR_REGULATOR(PWR_Regulator));
+ assert_param(IS_PWR_STOP_ENTRY(PWR_STOPEntry));
+
+ /* Select the regulator state in STOP mode ---------------------------------*/
+ tmpreg = PWR->CTRL;
+ /* Clear PDDS bit */
+ tmpreg &= CTRL_DS_MASK;
+ /* Set PWR_Regulator value */
+ tmpreg |= PWR_Regulator;
+ /* Store the new value */
+ PWR->CTRL = tmpreg;
+ /* Set SLEEPDEEP bit of Cortex System Control Register */
+ SCB->SCR |= SCB_SCR_SLEEPDEEP;
+
+ /* Select STOP mode entry --------------------------------------------------*/
+ if(PWR_STOPEntry == PWR_STOPEntry_WFI)
+ {
+ /* Request Wait For Interrupt */
+ __WFI();
+ }
+ else
+ {
+ /* Request Wait For Event */
+ __SEV();
+ __WFE();
+ __WFE();
+ }
+
+ /* Reset SLEEPDEEP bit of Cortex System Control Register */
+ SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP);
+}
+#endif
+
+/**
+ * @brief Enters STANDBY mode.
+ * @param None
+ * @retval None
+ */
+void PWR_EnterSTANDBYMode(void)
+{
+ /* Clear Wake-up flag */
+ PWR->CTRL |= PWR_CTRL_CLWUF;
+ /* Select STANDBY mode */
+ PWR->CTRL |= PWR_CTRL_PDDS;
+ /* Set SLEEPDEEP bit of Cortex System Control Register */
+ SCB->SCR |= SCB_SCR_SLEEPDEEP;
+ /* This option is used to ensure that store operations are completed */
+#if defined ( __CC_ARM )
+ __force_stores();
+#endif
+ /* Request Wait For Interrupt */
+ __WFI();
+}
+
+/**
+ * @brief Checks whether the specified PWR flag is set or not.
+ * @param PWR_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg PWR_FLAG_WUF: Wake Up flag
+ * @arg PWR_FLAG_SBF: StandBy flag
+ * @arg PWR_FLAG_PVDO: PVD Output
+ * @retval The new state of PWR_FLAG (SET or RESET).
+ */
+FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_PWR_GET_FLAG(PWR_FLAG));
+
+ if ((PWR->CTRLSTS & PWR_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ /* Return the flag status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the PWR's pending flags.
+ * @param PWR_FLAG: specifies the flag to clear.
+ * This parameter can be one of the following values:
+ * @arg PWR_FLAG_WUF: Wake Up flag
+ * @arg PWR_FLAG_SBF: StandBy flag
+ * @retval None
+ */
+void PWR_ClearFlag(uint32_t PWR_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_PWR_CLEAR_FLAG(PWR_FLAG));
+
+ PWR->CTRL |= PWR_FLAG << 2;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_rcc.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_rcc.c
new file mode 100644
index 0000000000000000000000000000000000000000..8ed6af63929edaaa16a71f5e3475178cede28f2b
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_rcc.c
@@ -0,0 +1,1468 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_rcc.c
+ * Description : at32f4xx RCC source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup RCC
+ * @brief RCC driver modules
+ * @{
+ */
+
+/** @defgroup RCC_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup RCC_Private_Defines
+ * @{
+ */
+
+/* ------------ RCC registers bit address in the alias region ----------- */
+#define RCC_OFFSET (RCC_BASE - PERIPH_BASE)
+
+/* --- CTRL Register ---*/
+
+/* Alias word address of HSIEN bit */
+#define CTRL_OFFSET (RCC_OFFSET + 0x00)
+#define HSIEN_BitPos 0x00
+#define CTRL_HSIEN_BB (PERIPH_BB_BASE + (CTRL_OFFSET * 32) + (HSIEN_BitPos * 4))
+
+/* Alias word address of PLLEN bit */
+#define PLLEN_BitPos 0x18
+#define CTRL_PLLEN_BB (PERIPH_BB_BASE + (CTRL_OFFSET * 32) + (PLLEN_BitPos * 4))
+
+/* Alias word address of HSECFDEN bit */
+#define HSECFDEN_BitPos 0x13
+#define CTRL_HSECFDEN_BB (PERIPH_BB_BASE + (CTRL_OFFSET * 32) + (HSECFDEN_BitPos * 4))
+
+#define HSICAL_BitPos (8)
+#if defined (AT32F403xx)
+#define HSITWK_BitPos (3)
+#else
+#define HSITWK_BitPos (2)
+#endif
+
+/* --- CFG Register ---*/
+
+/* Alias word address of USBPSC bit */
+#define CFG_OFFSET (RCC_OFFSET + 0x04)
+
+/* --- BDC Register ---*/
+#if defined (AT32F415xx)
+/* Alias word address of ERTCEN bit */
+#define BDC_OFFSET (RCC_OFFSET + 0x20)
+#define ERTCEN_BitPos 0x0F
+#define BDC_ERTCEN_BB (PERIPH_BB_BASE + (BDC_OFFSET * 32) + (ERTCEN_BitPos * 4))
+#else
+/* Alias word address of RTCEN bit */
+#define BDC_OFFSET (RCC_OFFSET + 0x20)
+#define RTCEN_BitPos 0x0F
+#define BDC_RTCEN_BB (PERIPH_BB_BASE + (BDC_OFFSET * 32) + (RTCEN_BitPos * 4))
+#endif
+
+/* Alias word address of BDRST bit */
+#define BDRST_BitPos 0x10
+#define BDC_BDRST_BB (PERIPH_BB_BASE + (BDC_OFFSET * 32) + (BDRST_BitPos * 4))
+
+/* --- CTRLSTS Register ---*/
+
+/* Alias word address of LSIEN bit */
+#define CTRLSTS_OFFSET (RCC_OFFSET + 0x24)
+#define LSIEN_BitPos 0x00
+#define CTRLSTS_LSIEN_BB (PERIPH_BB_BASE + (CTRLSTS_OFFSET * 32) + (LSIEN_BitPos * 4))
+
+#define MISC_OFFSET (RCC_OFFSET + 0x30)
+
+/* ---------------------- RCC registers bit mask ------------------------ */
+
+/* CFG register bit mask */
+#define CFG_PLL_Mask RCC_CFG_PLLCFG_MASK
+
+#define CFG_ADCPSC_Pos ((uint32_t)14)
+#define CFG_ADCPSCBit2_IdxMask ((uint32_t)4)
+
+#define CFG_ADCPSC_Rst_Mask ((uint32_t)~RCC_CFG_ADCPSC)
+#define CFG_ADCPSC_Set_Mask ((uint32_t)0x0000C000)
+#define CFG_ADCPSCBit2_Set_Mask ((uint32_t)0x10000000)
+
+/* RCC Flag Mask */
+#define FLAG_Mask ((uint8_t)0x1F)
+
+/* CLKINT register byte 2 (Bits[15:8]) base address */
+#define CLKINT_BYTE2_EN_ADDR ((uint32_t)0x40021009)
+
+/* CLKINT register byte 3 (Bits[23:16]) base address */
+#define CLKINT_BYTE3_CLR_ADDR ((uint32_t)0x4002100A)
+
+/* BDC register base address */
+#define BDC_BYTE0_LSE_ADDR (PERIPH_BASE + BDC_OFFSET)
+
+/* MISC register base address */
+#define MISC_BYTE0_HSICALKEY_ADDR (PERIPH_BASE + MISC_OFFSET)
+#define MISC_HSICAL_ENABLE_KEY ((uint8_t)0x5A)
+#define MISC_HSICAL_DISABLE_KEY ((uint8_t)0x0)
+
+/**
+ * @}
+ */
+
+/** @defgroup RCC_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup RCC_Private_Variables
+ * @{
+ */
+static __I uint8_t APBAHBPscTable[8] = {1, 2, 3, 4, 6, 7, 8, 9};
+static __I uint8_t ADCPscTable[8] = {2, 4, 6, 8, 2, 12, 8, 16};
+
+/**
+ * @}
+ */
+
+/** @defgroup RCC_Private_FunctionPrototypes
+ * @{
+ */
+static void RCC_HSEENDelay(uint32_t);
+
+/**
+ * @}
+ */
+
+/** @defgroup RCC_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Resets the RCC clock configuration to the default reset state.
+ * @param None
+ * @retval None
+ */
+void RCC_Reset(void)
+{
+ /* Set HSIEN bit */
+ RCC->CTRL |= (uint32_t)0x00000001;
+
+ /* Reset SYSCLKSEL, AHBPSC, APB1PSC, APB2PSC, ADCPSC and CLKOUT bits */
+ RCC->CFG &= (uint32_t)0xE8FF0000;
+
+ /* Reset HSEEN, HSECFDEN and PLLEN bits */
+ RCC->CTRL &= (uint32_t)0xFEF6FFFF;
+
+ /* Reset HSEBYPS bit */
+ RCC->CTRL &= (uint32_t)0xFFFBFFFF;
+
+ /* Reset PLLRC, PLLHSEPSC, PLLMUL, PLLFREQRANGE, and USBPSC bits */
+ RCC->CFG &= (uint32_t)0x1700FFFF;
+
+ /* Disable all interrupts and clear pending bits */
+ RCC->CLKINT = 0x009F0000;
+
+ /* Reset USB768B, CLKOUT[3], HSICAL_KEY[7:0] */
+ RCC->MISC &= 0xFEFEFF00;
+}
+
+/**
+ * @brief Configures the External High Speed oscillator (HSE).
+ * @note HSE can not be stopped if it is used directly or through the PLL as system clock.
+ * @param RCC_HSE: specifies the new state of the HSE.
+ * This parameter can be one of the following values:
+ * @arg RCC_HSE_DISABLE: HSE oscillator OFF
+ * @arg RCC_HSE_ENABLE: HSE oscillator ON
+ * @arg RCC_HSE_BYPASS: HSE oscillator bypassed with external clock
+ * @retval None
+ */
+void RCC_HSEConfig(uint32_t RCC_HSE)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_HSE(RCC_HSE));
+ /* Reset HSEEN and HSEBYPS bits before configuring the HSE ------------------*/
+ /* Reset HSEEN bit */
+ RCC->CTRL &= ~RCC_CTRL_HSEEN;
+ /* Reset HSEBYPS bit */
+ RCC->CTRL &= ~RCC_CTRL_HSEBYPS;
+
+ /* Configure HSE (RCC_HSE_DISABLE is already covered by the code section above) */
+ switch(RCC_HSE)
+ {
+ case RCC_HSE_ENABLE:
+ /* Set HSEEN bit */
+ RCC->CTRL |= RCC_CTRL_HSEEN;
+ break;
+
+ case RCC_HSE_BYPASS:
+ /* Set HSEBYPS and HSEEN bits */
+ RCC->CTRL |= RCC_CTRL_HSEBYPS | RCC_CTRL_HSEEN;
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
+ * @brief Waits for HSE start-up.
+ * @param None
+ * @retval An ErrorStatus enumuration value:
+ * - SUCCESS: HSE oscillator is stable and ready to use
+ * - ERROR: HSE oscillator not yet ready
+ */
+ErrorStatus RCC_WaitForHSEStable(void)
+{
+ __IO uint32_t StartUpCounter = 0;
+ ErrorStatus status = ERROR;
+ FlagStatus HSEStatus = RESET;
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC_GetFlagStatus(RCC_FLAG_HSESTBL);
+ StartUpCounter++;
+ }
+ while((StartUpCounter != HSE_STARTUP_TIMEOUT) && (HSEStatus == RESET));
+
+ /* Delay for HSE Stable */
+ RCC_HSEENDelay(HSE_STABLE_DELAY);
+
+ if (RCC_GetFlagStatus(RCC_FLAG_HSESTBL) != RESET)
+ {
+ status = SUCCESS;
+ }
+ else
+ {
+ status = ERROR;
+ }
+
+ return (status);
+}
+
+/**
+ * @brief Adjusts the Internal High Speed oscillator (HSI) calibration value.
+ * @param HSITweakValue: specifies the calibration trimming value.
+ * This parameter must be a number between 0 and 0x1F.
+ * @retval None
+ */
+void RCC_SetHSITweakValue(uint8_t HSITweakValue)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_RCC_TWEAK_VALUE(HSITweakValue));
+ tmpreg = RCC->CTRL;
+ /* Clear HSITWK[4:0] bits */
+ tmpreg &= ~RCC_CTRL_HSITWK;
+ /* Set the HSITWK[4:0] bits according to HSITweakValue value */
+ tmpreg |= (uint32_t)HSITweakValue << HSITWK_BitPos;
+ /* Store the new value */
+ RCC->CTRL = tmpreg;
+}
+
+
+/**
+ * @brief Adjusts the Internal High Speed oscillator (HSI) calibration value.
+ * @param HSICalibValue: specifies the calibration value.
+ * This parameter must be a number between 0 and 0xFF.
+ * @retval None
+ */
+void RCC_SetHSICalibValue(uint8_t HSICalibValue)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_RCC_CALIB_VALUE(HSICalibValue));
+
+ /* Enable write HSICAL */
+ *(__IO uint8_t *) MISC_BYTE0_HSICALKEY_ADDR = MISC_HSICAL_ENABLE_KEY;
+
+ /* Get RCC_CTRL and clear HSICAL bits */
+ tmpreg = RCC->CTRL & (~RCC_CTRL_HSICAL);
+ /* Set the HSICAL[7:0] bits according to HSICalibValue value */
+ tmpreg |= (uint32_t)HSICalibValue << HSICAL_BitPos;
+ /* Store the new value */
+ RCC->CTRL = tmpreg;
+
+ /* Disable write HSICAL */
+ *(__IO uint8_t *) MISC_BYTE0_HSICALKEY_ADDR = MISC_HSICAL_DISABLE_KEY;
+}
+
+
+/**
+ * @brief Enables or disables the Internal High Speed oscillator (HSI).
+ * @note HSI can not be stopped if it is used directly or through the PLL as system clock.
+ * @param NewState: new state of the HSI. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_HSICmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) CTRL_HSIEN_BB = (uint32_t)NewState;
+}
+
+/**
+ * @brief Configures the PLL clock source and multiplication factor.
+ * @note This function must be used only when the PLL is disabled.
+ * @param RCC_PLLRefClk: specifies the PLL entry clock source.
+ * This parameter can be one of the following values:
+ * @arg RCC_PLLRefClk_HSI_Div2: HSI oscillator clock divided by 2 selected as PLL clock entry
+ * @arg RCC_PLLRefClk_HSE_Div1: HSE oscillator clock selected as PLL clock entry
+ * @arg RCC_PLLRefClk_HSE_Div2: HSE oscillator clock divided by 2 selected as PLL clock entry
+ * @param RCC_PLLMult: specifies the PLL multiplication factor.
+ * This parameter can be RCC_PLLMult_x where x:[2,64]
+ * @param RCC_PLLRange: specifies the PLL frequency range
+ * @arg RCC_Range_LessEqual_72Mhz: When PLL output is less than or equal to 72 MHz.
+ * @arg RCC_Range_GreatThan_72Mhz: When PLL output is greater than 72 MHz.
+ *
+ * @retval None
+ */
+void RCC_PLLConfig(uint32_t RCC_PLLRefClk, uint32_t RCC_PLLMult, uint32_t RCC_PLLRange)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_RCC_PLL_CFG(RCC_PLLRefClk));
+ assert_param(IS_RCC_PLL_MULT(RCC_PLLMult));
+ assert_param(IS_RCC_PLL_RANGE(RCC_PLLRange));
+
+ tmpreg = RCC->CFG;
+ /* Clear PLLRC, PLLHSEPSC and PLLMULT[5:0] bits */
+ tmpreg &= CFG_PLL_Mask;
+ /* Set the PLL configuration bits */
+ tmpreg |= RCC_PLLRefClk | RCC_PLLMult | RCC_PLLRange;
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+}
+
+/**
+ * @brief Enables or disables the PLL.
+ * @note The PLL can not be disabled if it is used as system clock.
+ * @param NewState: new state of the PLL. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_PLLCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ *(__IO uint32_t *) CTRL_PLLEN_BB = (uint32_t)NewState;
+}
+
+/**
+ * @brief Configures the system clock (SYSCLK).
+ * @param RCC_SYSCLKSelect: specifies the clock source used as system clock.
+ * This parameter can be one of the following values:
+ * @arg RCC_SYSCLKSelction_HSI: HSI selected as system clock
+ * @arg RCC_SYSCLKSelction_HSE: HSE selected as system clock
+ * @arg RCC_SYSCLKSelction_PLL: PLL selected as system clock
+ * @retval None
+ */
+void RCC_SYSCLKConfig(uint32_t RCC_SYSCLKSelect)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_RCC_SYSCLK_CFG(RCC_SYSCLKSelect));
+ tmpreg = RCC->CFG;
+ /* Clear SYSCLKSEL[1:0] bits */
+ tmpreg &= ~RCC_CFG_SYSCLKSEL;
+ /* Set SYSCLKSEL[1:0] bits according to RCC_SYSCLKSelect value */
+ tmpreg |= RCC_SYSCLKSelect;
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+}
+
+/**
+ * @brief Returns the clock source used as system clock.
+ * @param None
+ * @retval The clock source used as system clock. The returned value can
+ * be one of the following:
+ * - 0x00: HSI used as system clock
+ * - 0x04: HSE used as system clock
+ * - 0x08: PLL used as system clock
+ */
+uint8_t RCC_GetSYSCLKSelction(void)
+{
+ return ((uint8_t)(RCC->CFG & RCC_CFG_SYSCLKSTS));
+}
+
+/**
+ * @brief Configures the AHB clock (HCLK).
+ * @param RCC_SYSCLK_Div: defines the AHB clock divider. This clock is derived from
+ * the system clock (SYSCLK).
+ * This parameter can be one of the following values:
+ * @arg RCC_SYSCLK_Div1: AHB clock = SYSCLK
+ * @arg RCC_SYSCLK_Div2: AHB clock = SYSCLK/2
+ * @arg RCC_SYSCLK_Div4: AHB clock = SYSCLK/4
+ * @arg RCC_SYSCLK_Div8: AHB clock = SYSCLK/8
+ * @arg RCC_SYSCLK_Div16: AHB clock = SYSCLK/16
+ * @arg RCC_SYSCLK_Div64: AHB clock = SYSCLK/64
+ * @arg RCC_SYSCLK_Div128: AHB clock = SYSCLK/128
+ * @arg RCC_SYSCLK_Div256: AHB clock = SYSCLK/256
+ * @arg RCC_SYSCLK_Div512: AHB clock = SYSCLK/512
+ * @retval None
+ */
+void RCC_AHBCLKConfig(uint32_t RCC_SYSCLK_Div)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_RCC_AHBCLK(RCC_SYSCLK_Div));
+ tmpreg = RCC->CFG;
+ /* Clear AHBPSC[3:0] bits */
+ tmpreg &= ~RCC_CFG_AHBPSC;
+ /* Set AHBPSC[3:0] bits according to RCC_SYSCLK_Div value */
+ tmpreg |= RCC_SYSCLK_Div;
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+}
+
+/**
+ * @brief Configures the Low Speed APB clock (PCLK1).
+ * @param RCC_HCLK_Div: defines the APB1 clock divider. This clock is derived from
+ * the AHB clock (HCLK).
+ * This parameter can be one of the following values:
+ * @arg RCC_AHBCLK_Div1: APB1 clock = HCLK
+ * @arg RCC_AHBCLK_Div2: APB1 clock = HCLK/2
+ * @arg RCC_AHBCLK_Div4: APB1 clock = HCLK/4
+ * @arg RCC_AHBCLK_Div8: APB1 clock = HCLK/8
+ * @arg RCC_AHBCLK_Div16: APB1 clock = HCLK/16
+ * @retval None
+ */
+void RCC_APB1CLKConfig(uint32_t RCC_HCLK_Div)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_RCC_APBCLK(RCC_HCLK_Div));
+ tmpreg = RCC->CFG;
+ /* Clear APB1PSC[2:0] bits */
+ tmpreg &= ~RCC_CFG_APB1PSC;
+ /* Set APB1PSC[2:0] bits according to RCC_HCLK_Div value */
+ tmpreg |= RCC_HCLK_Div;
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+}
+
+/**
+ * @brief Configures the High Speed APB clock (PCLK2).
+ * @param RCC_HCLK_Div: defines the APB2 clock divider. This clock is derived from
+ * the AHB clock (HCLK).
+ * This parameter can be one of the following values:
+ * @arg RCC_AHBCLK_Div1: APB2 clock = HCLK
+ * @arg RCC_AHBCLK_Div2: APB2 clock = HCLK/2
+ * @arg RCC_AHBCLK_Div4: APB2 clock = HCLK/4
+ * @arg RCC_AHBCLK_Div8: APB2 clock = HCLK/8
+ * @arg RCC_AHBCLK_Div16: APB2 clock = HCLK/16
+ * @retval None
+ */
+void RCC_APB2CLKConfig(uint32_t RCC_HCLK_Div)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_RCC_APBCLK(RCC_HCLK_Div));
+ tmpreg = RCC->CFG;
+ /* Clear APB2PSC[2:0] bits */
+ tmpreg &= ~RCC_CFG_APB2PSC;
+ /* Set APB2PSC[2:0] bits according to RCC_HCLK_Div value */
+ tmpreg |= RCC_HCLK_Div << 3;
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+}
+
+/**
+ * @brief Enables or disables the specified RCC interrupts.
+ * @param RCC_INT: specifies the RCC interrupt sources to be enabled or disabled.
+ * this parameter can be any combination of the following values.
+ * @arg RCC_INT_LSISTBL: LSI ready interrupt
+ * @arg RCC_INT_LSESTBL: LSE ready interrupt
+ * @arg RCC_INT_HSISTBL: HSI ready interrupt
+ * @arg RCC_INT_HSESTBL: HSE ready interrupt
+ * @arg RCC_INT_PLLSTBL: PLL ready interrupt
+ *
+ * @param NewState: new state of the specified RCC interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_INTConfig(uint8_t RCC_INT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_INT_EN(RCC_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Perform Byte access to RCC_CLKINT bits to enable the selected interrupts */
+ *(__IO uint8_t *) CLKINT_BYTE2_EN_ADDR |= RCC_INT;
+ }
+ else
+ {
+ /* Perform Byte access to RCC_CLKINT bits to disable the selected interrupts */
+ *(__IO uint8_t *) CLKINT_BYTE2_EN_ADDR &= (uint8_t)~RCC_INT;
+ }
+}
+
+/**
+ * @brief Configures the USB clock (USBCLK).
+ * @param RCC_USBCLKSelect: specifies the USB clock source. This clock is
+ * derived from the PLL output.
+ * This parameter can be one of the following values:
+ * @arg RCC_USBCLKSelection_PLL_Div1_5: PLL clock divided by 1.5 selected as USB clock source
+ * @arg RCC_USBCLKSelection_PLL_Div1: PLL clock selected as USB clock source
+ * @arg RCC_USBCLKSelection_PLL_Div2_5: PLL clock divided by 2.5 selected as USB clock source
+ * @arg RCC_USBCLKSelection_PLL_Div2: PLL clock divided by 2 selected as USB clock source
+ * @arg RCC_USBCLKSelection_PLL_Div3_5: PLL clock divided by 3.5 selected as USB clock source
+ * @arg RCC_USBCLKSelection_PLL_Div3: PLL clock divided by 3 selected as USB clock source
+ * @arg RCC_USBCLKSelection_PLL_Div4: PLL clock divided by 4 selected as USB clock source
+ * @retval None
+ */
+void RCC_USBCLKConfig(uint32_t RCC_USBCLKSelect)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_RCC_USBCLK_CFG(RCC_USBCLKSelect));
+
+ tmpreg = RCC->CFG;
+ /* Clear USBPSC[2:0] bits */
+ tmpreg &= ~RCC_CFG_USBPSC;
+ /* Set USBPSC[2:0] bits according to RCC_USBCLKSelect value */
+ tmpreg |= RCC_USBCLKSelect;
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+}
+
+/**
+ * @brief Configures the ADC clock (ADCCLK).
+ * @param RCC_PCLK2_Div: defines the ADC clock divider. This clock is derived from
+ * the APB2 clock (PCLK2).
+ * This parameter can be one of the following values:
+ * @arg RCC_APB2CLK_Div2: ADC clock = PCLK2/2
+ * @arg RCC_APB2CLK_Div4: ADC clock = PCLK2/4
+ * @arg RCC_APB2CLK_Div6: ADC clock = PCLK2/6
+ * @arg RCC_APB2CLK_Div8: ADC clock = PCLK2/8
+ * @arg RCC_APB2CLK_Div12: ADC clock = PCLK2/12
+ * @arg RCC_APB2CLK_Div16: ADC clock = PCLK2/16
+ * @retval None
+ */
+void RCC_ADCCLKConfig(uint32_t RCC_PCLK2_Div)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_RCC_ADCCLK(RCC_PCLK2_Div));
+ tmpreg = RCC->CFG;
+ /* Clear ADCPSC[2:0] bits */
+ tmpreg &= CFG_ADCPSC_Rst_Mask;
+ /* Set ADCPSC[2:0] bits according to RCC_PCLK2_Div value */
+ tmpreg |= RCC_PCLK2_Div;
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+}
+
+/**
+ * @brief Configures the External Low Speed oscillator (LSE).
+ * @param RCC_LSE: specifies the new state of the LSE.
+ * This parameter can be one of the following values:
+ * @arg RCC_LSE_DISABLE: LSE oscillator OFF
+ * @arg RCC_LSE_ENABLE: LSE oscillator ON
+ * @arg RCC_LSE_BYPASS: LSE oscillator bypassed with external clock
+ * @retval None
+ */
+void RCC_LSEConfig(uint8_t RCC_LSE)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_LSE(RCC_LSE));
+ /* Reset LSEEN and LSEBYPS bits before configuring the LSE ------------------*/
+ /* Reset LSEEN bit */
+ *(__IO uint8_t *) BDC_BYTE0_LSE_ADDR = RCC_LSE_DISABLE;
+ /* Reset LSEBYPS bit */
+ *(__IO uint8_t *) BDC_BYTE0_LSE_ADDR = RCC_LSE_DISABLE;
+
+ /* Configure LSE (RCC_LSE_DISABLE is already covered by the code section above) */
+ switch(RCC_LSE)
+ {
+ case RCC_LSE_ENABLE:
+ /* Set LSEEN bit */
+ *(__IO uint8_t *) BDC_BYTE0_LSE_ADDR = RCC_LSE_ENABLE;
+ break;
+
+ case RCC_LSE_BYPASS:
+ /* Set LSEBYPS and LSEEN bits */
+ *(__IO uint8_t *) BDC_BYTE0_LSE_ADDR = RCC_LSE_BYPASS | RCC_LSE_ENABLE;
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
+ * @brief Enables or disables the Internal Low Speed oscillator (LSI).
+ * @note LSI can not be disabled if the IWDG is running.
+ * @param NewState: new state of the LSI. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_LSICmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) CTRLSTS_LSIEN_BB = (uint32_t)NewState;
+}
+
+#if defined (AT32F415xx)
+/**
+ * @brief Configures the ERTC clock (ERTCCLK).
+ * @note Once the ERTC clock is selected it can't be changed unless the Backup domain is reset.
+ * @param RCC_ERTCCLKSelect: specifies the ERTC clock source.
+ * This parameter can be one of the following values:
+ * @arg RCC_ERTCCLKSelection_LSE: LSE selected as ERTC clock
+ * @arg RCC_ERTCCLKSelection_LSI: LSI selected as ERTC clock
+ * @arg RCC_ERTCCLKSelection_HSE_Div128: HSE clock divided by 128 selected as ERTC clock
+ * @retval None
+ */
+void RCC_ERTCCLKConfig(uint32_t RCC_ERTCCLKSelect)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_ERTCCLK_SEL(RCC_ERTCCLKSelect));
+ /* Select the RTC clock source */
+ RCC->BDC |= RCC_ERTCCLKSelect;
+}
+#else
+/**
+ * @brief Configures the RTC clock (RTCCLK).
+ * @note Once the RTC clock is selected it can't be changed unless the Backup domain is reset.
+ * @param RCC_RTCCLKSelect: specifies the RTC clock source.
+ * This parameter can be one of the following values:
+ * @arg RCC_RTCCLKSelection_LSE: LSE selected as RTC clock
+ * @arg RCC_RTCCLKSelection_LSI: LSI selected as RTC clock
+ * @arg RCC_RTCCLKSelection_HSE_Div128: HSE clock divided by 128 selected as RTC clock
+ * @retval None
+ */
+void RCC_RTCCLKConfig(uint32_t RCC_RTCCLKSelect)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_RTCCLK_SEL(RCC_RTCCLKSelect));
+ /* Select the RTC clock source */
+ RCC->BDC |= RCC_RTCCLKSelect;
+}
+#endif
+
+#if defined (AT32F415xx)
+/**
+ * @brief Enables or disables the ERTC clock.
+ * @note This function must be used only after the ERTC clock was selected using the RCC_ERTCCLKConfig function.
+ * @param NewState: new state of the ERTC clock. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_ERTCCLKCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) BDC_ERTCEN_BB = (uint32_t)NewState;
+}
+#else
+/**
+ * @brief Enables or disables the RTC clock.
+ * @note This function must be used only after the RTC clock was selected using the RCC_RTCCLKConfig function.
+ * @param NewState: new state of the RTC clock. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_RTCCLKCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) BDC_RTCEN_BB = (uint32_t)NewState;
+}
+#endif
+/**
+ * @brief Returns the frequencies of different on chip clocks.
+ * @param RCC_Clocks: pointer to a RCC_ClockType structure which will hold
+ * the clocks frequencies.
+ * @note The result of this function could be not correct when using
+ * fractional value for HSE crystal.
+ * @retval None
+ */
+void RCC_GetClocksFreq(RCC_ClockType* RCC_Clocks)
+{
+#if defined (AT32F415xx)
+ uint32_t pllcfgen = 0, pllfref = 0, pllns = 0, pllms = 0, pllfr = 0;
+ uint32_t retfref = 0, retfr = 0;
+#endif
+ uint32_t tmp = 0, pllmult = 0, pllrefclk = 0, psc = 0;
+
+ /* Get SYSCLK source -------------------------------------------------------*/
+ tmp = RCC->CFG & RCC_CFG_SYSCLKSTS;
+
+ switch (tmp)
+ {
+ case 0x00: /* HSI used as system clock */
+ RCC_Clocks->SYSCLK_Freq = HSI_VALUE;
+ break;
+
+ case 0x04: /* HSE used as system clock */
+ RCC_Clocks->SYSCLK_Freq = HSE_VALUE;
+ break;
+
+ case 0x08: /* PLL used as system clock */
+#if defined (AT32F415xx)
+ /* Get_ClocksFreq for PLLconfig2 */
+ pllcfgen = BIT_READ(RCC->PLL, PLL_CFGEN_MASK);
+
+ if(pllcfgen == PLL_CFGEN_ENABLE)
+ {
+ pllfref = BIT_READ(RCC->PLL, PLL_FREF_MASK);
+ pllns = BIT_READ(RCC->PLL, PLL_NS_MASK);
+ pllms = BIT_READ(RCC->PLL, PLL_MS_MASK);
+ pllfr = BIT_READ(RCC->PLL, PLL_FR_MASK);
+
+ RCC_FREF_VALUE(pllfref, retfref);
+ RCC_FR_VALUE(pllfr, retfr);
+
+ RCC_Clocks->SYSCLK_Freq = (retfref * (pllns >> PLL_NS_POS)) / \
+ ((pllms >> PLL_MS_POS) * retfr) * 1000000;
+ }else
+#endif
+ {
+ /* Get PLL clock source and multiplication factor ----------------------*/
+ pllmult = BIT_READ(RCC->CFG, RCC_CFG_PLLMULT);
+ pllrefclk = RCC->CFG & RCC_CFG_PLLRC;
+ pllmult = RCC_GET_PLLMULT(pllmult);
+
+ if (pllrefclk == 0x00)
+ {
+ /* HSI oscillator clock divided by 2 selected as PLL clock entry */
+ RCC_Clocks->SYSCLK_Freq = (HSI_VALUE >> 1) * pllmult;
+ }
+ else
+ {
+ /* HSE selected as PLL clock entry */
+ if ((RCC->CFG & RCC_CFG_PLLHSEPSC) != (uint32_t)RESET)
+ {
+ /* HSE oscillator clock divided by 2 */
+ RCC_Clocks->SYSCLK_Freq = (HSE_VALUE >> 1) * pllmult;
+ }
+ else
+ {
+ RCC_Clocks->SYSCLK_Freq = HSE_VALUE * pllmult;
+ }
+ }
+ }
+#if !defined (AT32F415xx)
+ if (((RCC->CFG & RCC_CFG_PLLRANGE) == 0) && (RCC_Clocks->SYSCLK_Freq > RCC_PLL_RANGE))
+ {
+ /* Not setup PLLRANGE, fixed in 72 MHz */
+ RCC_Clocks->SYSCLK_Freq = RCC_PLL_RANGE;
+ }
+#endif
+ break;
+
+ default:
+ RCC_Clocks->SYSCLK_Freq = HSI_VALUE;
+ break;
+ }
+
+ /* Compute HCLK, PCLK1, PCLK2 and ADCCLK clocks frequencies ----------------*/
+ /* Get HCLK prescaler */
+ tmp = (RCC->CFG & (RCC_CFG_AHBPSC ^ RCC_CFG_AHBPSC_3)) >> 4;
+ psc = (RCC->CFG & RCC_CFG_AHBPSC_3) ? APBAHBPscTable[tmp] : 0;
+
+ /* HCLK clock frequency */
+ RCC_Clocks->AHBCLK_Freq = RCC_Clocks->SYSCLK_Freq >> psc;
+ /* Get PCLK1 prescaler */
+ tmp = (RCC->CFG & (RCC_CFG_APB1PSC ^ RCC_CFG_APB1PSC_2)) >> 8;
+ psc = (RCC->CFG & RCC_CFG_APB1PSC_2) ? APBAHBPscTable[tmp] : 0;
+ /* PCLK1 clock frequency */
+ RCC_Clocks->APB1CLK_Freq = RCC_Clocks->AHBCLK_Freq >> psc;
+ /* Get PCLK2 prescaler */
+ tmp = (RCC->CFG & (RCC_CFG_APB2PSC ^ RCC_CFG_APB2PSC_2)) >> 11;
+ psc = (RCC->CFG & RCC_CFG_APB2PSC_2) ? APBAHBPscTable[tmp] : 0;
+ /* PCLK2 clock frequency */
+ RCC_Clocks->APB2CLK_Freq = RCC_Clocks->AHBCLK_Freq >> psc;
+
+ /* Get ADCCLK prescaler */
+ tmp = (RCC->CFG & CFG_ADCPSC_Set_Mask) >> CFG_ADCPSC_Pos;
+
+ if (RCC->CFG & CFG_ADCPSCBit2_Set_Mask)
+ {
+ tmp |= CFG_ADCPSCBit2_IdxMask;
+ }
+
+ psc = ADCPscTable[tmp];
+ /* ADCCLK clock frequency */
+ RCC_Clocks->ADCCLK_Freq = RCC_Clocks->APB2CLK_Freq / psc;
+}
+
+/**
+ * @brief Enables or disables the AHB peripheral clock.
+ * @param RCC_AHBPeriph: specifies the AHB peripheral to gates its clock.
+ * This parameter can be any combination of the
+ * following values:
+ * @arg RCC_AHBPERIPH_DMA1
+ * @arg RCC_AHBPERIPH_DMA2
+ * @arg RCC_AHBPERIPH_SRAM
+ * @arg RCC_AHBPERIPH_FLASH
+ * @arg RCC_AHBPERIPH_CRC
+ * @arg RCC_AHBPERIPH_XMC
+ * @arg RCC_AHBPERIPH_SDIO1
+ * @arg RCC_AHBPERIPH_SDIO2
+ *
+ * @note SRAM and FLASH clock can be disabled only during sleep mode.
+ * @param NewState: new state of the specified peripheral clock.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_AHB_PERIPH(RCC_AHBPeriph));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ RCC->AHBEN |= RCC_AHBPeriph;
+ }
+ else
+ {
+ RCC->AHBEN &= ~RCC_AHBPeriph;
+ }
+}
+
+/**
+ * @brief Enables or disables the High Speed APB (APB2) peripheral clock.
+ * @param RCC_APB2Periph: specifies the APB2 peripheral to gates its clock.
+ * This parameter can be any combination of the following values:
+ * @arg RCC_APB2PERIPH_AFIO, RCC_APB2PERIPH_GPIOA, RCC_APB2PERIPH_GPIOB,
+ * RCC_APB2PERIPH_GPIOC, RCC_APB2PERIPH_GPIOD, RCC_APB2PERIPH_GPIOE,
+ * RCC_APB2PERIPH_GPIOF, RCC_APB2PERIPH_GPIOG, RCC_APB2PERIPH_ADC1,
+ * RCC_APB2PERIPH_ADC2, RCC_APB2PERIPH_TMR1, RCC_APB2PERIPH_SPI1,
+ * RCC_APB2PERIPH_TMR8, RCC_APB2PERIPH_USART1, RCC_APB2PERIPH_ADC3,
+ * RCC_APB2PERIPH_TMR15, RCC_APB2PERIPH_TMR9, RCC_APB2PERIPH_TMR10,
+ * RCC_APB2PERIPH_TMR11
+ * @param NewState: new state of the specified peripheral clock.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ RCC->APB2EN |= RCC_APB2Periph;
+ }
+ else
+ {
+ RCC->APB2EN &= ~RCC_APB2Periph;
+ }
+}
+
+/**
+ * @brief Enables or disables the Low Speed APB (APB1) peripheral clock.
+ * @param RCC_APB1Periph: specifies the APB1 peripheral to gates its clock.
+ * This parameter can be any combination of the following values:
+ * @arg RCC_APB1PERIPH_TMR2, RCC_APB1PERIPH_TMR3, RCC_APB1PERIPH_TMR4,
+ * RCC_APB1PERIPH_TMR5, RCC_APB1PERIPH_TMR6, RCC_APB1PERIPH_TMR7,
+ * RCC_APB1PERIPH_WWDG, RCC_APB1PERIPH_SPI2, RCC_APB1PERIPH_SPI3,
+ * RCC_APB1PERIPH_SPI4, RCC_APB1PERIPH_USART2, RCC_APB1PERIPH_USART3,
+ * RCC_APB1Periph_USART4, RCC_APB1Periph_USART5, RCC_APB1PERIPH_I2C1,
+ * RCC_APB1PERIPH_I2C2, RCC_APB1PERIPH_I2C3, RCC_APB1PERIPH_USB,
+ * RCC_APB1PERIPH_CAN1, RCC_APB1PERIPH_BKP, RCC_APB1PERIPH_PWR,
+ * RCC_APB1PERIPH_DAC, RCC_APB1PERIPH_TMR12, RCC_APB1PERIPH_TMR13,
+ * RCC_APB1PERIPH_TMR14
+ * @param NewState: new state of the specified peripheral clock.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ RCC->APB1EN |= RCC_APB1Periph;
+ }
+ else
+ {
+ RCC->APB1EN &= ~RCC_APB1Periph;
+ }
+}
+
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+/**
+ * @brief Forces or releases High Speed AHB Bus reset.
+ * @param RCC_AHBPeriph: specifies the AHB peripheral to reset.
+ * This parameter can be any combination of the following values:
+ * @arg RCC_AHBPERIPH_ETHMAC
+ * @param NewState: new state of the specified peripheral reset.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_AHBPeriphResetCmd(uint32_t RCC_AHBPeriph, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_AHB_PERIPH(RCC_AHBPeriph));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ RCC->AHBRST |= RCC_AHBPeriph;
+ }
+ else
+ {
+ RCC->AHBRST &= ~RCC_AHBPeriph;
+ }
+}
+#endif
+
+/**
+ * @brief Forces or releases High Speed APB (APB2) peripheral reset.
+ * @param RCC_APB2Periph: specifies the APB2 peripheral to reset.
+ * This parameter can be any combination of the following values:
+ * @arg RCC_APB2PERIPH_AFIO, RCC_APB2PERIPH_GPIOA, RCC_APB2PERIPH_GPIOB,
+ * RCC_APB2PERIPH_GPIOC, RCC_APB2PERIPH_GPIOD, RCC_APB2PERIPH_GPIOE,
+ * RCC_APB2PERIPH_GPIOF, RCC_APB2PERIPH_GPIOG, RCC_APB2PERIPH_ADC1,
+ * RCC_APB2PERIPH_ADC2, RCC_APB2PERIPH_TMR1, RCC_APB2PERIPH_SPI1,
+ * RCC_APB2PERIPH_TMR8, RCC_APB2PERIPH_USART1, RCC_APB2PERIPH_ADC3,
+ * RCC_APB2PERIPH_TMR15, RCC_APB2PERIPH_TMR9, RCC_APB2PERIPH_TMR10,
+ * RCC_APB2PERIPH_TMR11
+ * @param NewState: new state of the specified peripheral reset.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ RCC->APB2RST |= RCC_APB2Periph;
+ }
+ else
+ {
+ RCC->APB2RST &= ~RCC_APB2Periph;
+ }
+}
+
+/**
+ * @brief Forces or releases Low Speed APB (APB1) peripheral reset.
+ * @param RCC_APB1Periph: specifies the APB1 peripheral to reset.
+ * This parameter can be any combination of the following values:
+ * @arg RCC_APB1PERIPH_TMR2, RCC_APB1PERIPH_TMR3, RCC_APB1PERIPH_TMR4,
+ * RCC_APB1PERIPH_TMR5, RCC_APB1PERIPH_TMR6, RCC_APB1PERIPH_TMR7,
+ * RCC_APB1PERIPH_WWDG, RCC_APB1PERIPH_SPI2, RCC_APB1PERIPH_SPI3,
+ * RCC_APB1PERIPH_SPI4, RCC_APB1PERIPH_USART2, RCC_APB1PERIPH_USART3,
+ * RCC_APB1Periph_USART4, RCC_APB1Periph_USART5, RCC_APB1PERIPH_I2C1,
+ * RCC_APB1PERIPH_I2C2, RCC_APB1PERIPH_I2C3, RCC_APB1PERIPH_USB,
+ * RCC_APB1PERIPH_CAN1, RCC_APB1PERIPH_BKP, RCC_APB1PERIPH_PWR,
+ * RCC_APB1PERIPH_DAC, RCC_APB1PERIPH_TMR12, RCC_APB1PERIPH_TMR13,
+ * RCC_APB1PERIPH_TMR14
+ * @param NewState: new state of the specified peripheral clock.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ RCC->APB1RST |= RCC_APB1Periph;
+ }
+ else
+ {
+ RCC->APB1RST &= ~RCC_APB1Periph;
+ }
+}
+
+/**
+ * @brief Forces or releases the Backup domain reset.
+ * @param NewState: new state of the Backup domain reset.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_BackupResetCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) BDC_BDRST_BB = (uint32_t)NewState;
+}
+
+/**
+ * @brief Enables or disables the Clock Security System.
+ * @param NewState: new state of the Clock Security System..
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_HSEClockFailureDetectorCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ *(__IO uint32_t *) CTRL_HSECFDEN_BB = (uint32_t)NewState;
+}
+
+#if defined (AT32F403xx)
+/**
+ * @brief Selects the clock source to output on CLKOUT pin.
+ * @param RCC_CLKOUT: specifies the clock source to output.
+ * This parameter can be one of the following values:
+ * @arg RCC_CLKOUT_NOCLK: No clock selected
+ * @arg RCC_CLKOUT_SYSCLK: System clock selected
+ * @arg RCC_CLKOUT_HSI: HSI oscillator clock selected
+ * @arg RCC_CLKOUT_HSE: HSE oscillator clock selected
+ * @arg RCC_CLKOUT_PLL_Div2: PLL clock divided by 2 selected
+ * @arg RCC_CLKOUT_PLL_Div4: PLL clock divided by 4 selected
+ * @arg RCC_CLKOUT_USB: USB clock selected
+ * @arg RCC_CLKOUT_ADC: ADC clock selected
+ * @retval None
+ */
+void RCC_CLKOUTConfig(uint32_t RCC_CLKOUT)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_RCC_CLKOUT(RCC_CLKOUT));
+
+ if((RCC_CLKOUT >> 28) == 0)
+ {
+ // Clear CLKOUT[3];
+ RCC->MISC &= ~RCC_MISC_CLKOUT_3;
+
+ tmpreg = RCC->CFG;
+ /* Clear CLKOUT[2:0] bits */
+ tmpreg &= ~RCC_CFG_CLKOUT;
+ /* Set CLKOUT[2:0] bits according to RCC_CLKOUT value */
+ tmpreg |= RCC_CLKOUT;
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+ }
+ else if((RCC_CLKOUT >> 28) == 1)
+ {
+ // Set CLKOUT[3];
+ RCC->MISC &= ~RCC_MISC_CLKOUT_3;
+ RCC->MISC |= RCC_MISC_CLKOUT_3;
+
+ tmpreg = RCC->CFG;
+ /* Clear CLKOUT[2:0] bits */
+ tmpreg &= ~RCC_CFG_CLKOUT;
+ /* Set CLKOUT[2:0] bits according to RCC_CLKOUT value */
+ tmpreg |= (RCC_CLKOUT & 0xFFFFFFF);
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+ }
+}
+#else
+/**
+ * @brief Selects the clock source to output on CLKOUT pin.
+ * @param RCC_CLKOUT: specifies the clock source to output.
+ * This parameter can be one of the following values:
+ * @arg RCC_CLKOUT_NOCLK: No clock selected
+ * @arg RCC_CLKOUT_SYSCLK: System clock selected
+ * @arg RCC_CLKOUT_HSI: HSI oscillator clock selected
+ * @arg RCC_CLKOUT_HSE: HSE oscillator clock selected
+ * @arg RCC_CLKOUT_PLL_Div2: PLL clock divided by 2 selected
+ * @arg RCC_CLKOUT_PLL_Div4: PLL clock divided by 4 selected
+ * @arg RCC_CLKOUT_USB: USB clock selected
+ * @arg RCC_CLKOUT_ADC: ADC clock selected
+ * @note Just only at32f413xx & at32f415xx
+ * @arg RCC_CLKOUT_LSI: LSI clock selected
+ * @arg RCC_CLKOUT_LSE: LSE clock selected
+ * @param RCC_CLKOUTPRE: specifies the clock output prescaler.
+ * This parameter can be one of the following values:
+ * @arg RCC_MCOPRE_1 : division by 1 applied to CLKOUT clock
+ * @arg RCC_MCOPRE_2 : division by 2 applied to CLKOUT clock
+ * @arg RCC_MCOPRE_4 : division by 4 applied to CLKOUT clock
+ * @arg RCC_MCOPRE_8 : division by 8 applied to CLKOUT clock
+ * @arg RCC_MCOPRE_16 : division by 16 applied to CLKOUT clock
+ * @arg RCC_MCOPRE_64 : division by 64 applied to CLKOUT clock
+ * @arg RCC_MCOPRE_128: division by 128 applied to CLKOUT clock
+ * @arg RCC_MCOPRE_256: division by 256 applied to CLKOUT clock
+ * @arg RCC_MCOPRE_512: division by 512 applied to CLKOUT clock
+ * @retval None
+ */
+void RCC_CLKOUTConfig(uint32_t RCC_CLKOUT, uint32_t RCC_CLKOUTPRE)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_RCC_CLKOUT(RCC_CLKOUT));
+ assert_param(IS_RCC_MCO(RCC_CLKOUTPRE));
+
+ /* Config MCOPRE */
+ RCC->MISC &= ~RCC_MCOPRE_MASK;
+ RCC->MISC |= RCC_CLKOUTPRE;
+
+ if((RCC_CLKOUT >> 28) == 0)
+ {
+ // Clear CLKOUT[3];
+ RCC->MISC &= ~RCC_MISC_CLKOUT_3;
+
+ tmpreg = RCC->CFG;
+ /* Clear CLKOUT[2:0] bits */
+ tmpreg &= ~RCC_CFG_CLKOUT;
+ /* Set CLKOUT[2:0] bits according to RCC_CLKOUT value */
+ tmpreg |= RCC_CLKOUT;
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+ }
+ else if((RCC_CLKOUT >> 28) == 1)
+ {
+ // Set CLKOUT[3];
+ RCC->MISC &= ~RCC_MISC_CLKOUT_3;
+ RCC->MISC |= RCC_MISC_CLKOUT_3;
+
+ tmpreg = RCC->CFG;
+ /* Clear CLKOUT[2:0] bits */
+ tmpreg &= ~RCC_CFG_CLKOUT;
+ /* Set CLKOUT[2:0] bits according to RCC_CLKOUT value */
+ tmpreg |= (RCC_CLKOUT & 0xFFFFFFF);
+ /* Store the new value */
+ RCC->CFG = tmpreg;
+ }
+}
+#endif
+/**
+ * @brief Checks whether the specified RCC flag is set or not.
+ * @param RCC_Flag: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg RCC_FLAG_HSISTBL: HSI oscillator clock ready
+ * @arg RCC_FLAG_HSESTBL: HSE oscillator clock ready
+ * @arg RCC_FLAG_PLLSTBL: PLL clock ready
+ * @arg RCC_FLAG_LSESTBL: LSE oscillator clock ready
+ * @arg RCC_FLAG_LSISTBL: LSI oscillator clock ready
+ * @arg RCC_FLAG_PINRST: Pin reset
+ * @arg RCC_FLAG_PORST: POR/PDR reset
+ * @arg RCC_FLAG_SWRST: Software reset
+ * @arg RCC_FLAG_IWDGRST: Independent Watchdog reset
+ * @arg RCC_FLAG_WWDGRST: Window Watchdog reset
+ * @arg RCC_FLAG_LPRST: Low Power reset
+ *
+ * @retval The new state of RCC_Flag (SET or RESET).
+ */
+FlagStatus RCC_GetFlagStatus(uint8_t RCC_Flag)
+{
+ uint32_t tmp = 0;
+ uint32_t statusreg = 0;
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_RCC_FLAG(RCC_Flag));
+
+ /* Get the RCC register index */
+ tmp = RCC_Flag >> 5;
+
+ if (tmp == 1) /* The flag to check is in CTRL register */
+ {
+ statusreg = RCC->CTRL;
+ }
+ else if (tmp == 2) /* The flag to check is in BDC register */
+ {
+ statusreg = RCC->BDC;
+ }
+ else /* The flag to check is in CTRLSTS register */
+ {
+ statusreg = RCC->CTRLSTS;
+ }
+
+ /* Get the flag position */
+ tmp = RCC_Flag & FLAG_Mask;
+
+ if ((statusreg & ((uint32_t)1 << tmp)) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ /* Return the flag status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the RCC reset flags.
+ * @note The reset flags are: RCC_FLAG_PINRST, RCC_FLAG_PORST, RCC_FLAG_SWRST,
+ * RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST, RCC_FLAG_LPRST
+ * @param None
+ * @retval None
+ */
+void RCC_ClearFlag(void)
+{
+ /* Set RSTFC bit to clear the reset flags */
+ RCC->CTRLSTS |= RCC_CTRLSTS_RSTFC;
+}
+
+/**
+ * @brief Checks whether the specified RCC interrupt has occurred or not.
+ * @param RCC_INT: specifies the RCC interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg RCC_INT_LSISTBL: LSI ready interrupt
+ * @arg RCC_INT_LSESTBL: LSE ready interrupt
+ * @arg RCC_INT_HSISTBL: HSI ready interrupt
+ * @arg RCC_INT_HSESTBL: HSE ready interrupt
+ * @arg RCC_INT_PLLSTBL: PLL ready interrupt
+ * @arg RCC_INT_HSECFD: Clock Security System interrupt
+ *
+ * @retval The new state of RCC_INT (SET or RESET).
+ */
+ITStatus RCC_GetINTStatus(uint8_t RCC_INT)
+{
+ ITStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_RCC_INT_STS(RCC_INT));
+
+ /* Check the status of the specified RCC interrupt */
+ if ((RCC->CLKINT & RCC_INT) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ /* Return the RCC_INT status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the RCC's interrupt pending bits.
+ * @param RCC_INT: specifies the interrupt pending bit to clear.
+ * This parameter can be any combination of the
+ * following values:
+ * @arg RCC_INT_LSISTBL: LSI ready interrupt
+ * @arg RCC_INT_LSESTBL: LSE ready interrupt
+ * @arg RCC_INT_HSISTBL: HSI ready interrupt
+ * @arg RCC_INT_HSESTBL: HSE ready interrupt
+ * @arg RCC_INT_PLLSTBL: PLL ready interrupt
+ *
+ * @arg RCC_INT_HSECFD: Clock Security System interrupt
+ * @retval None
+ */
+void RCC_ClearINTPendingBit(uint8_t RCC_INT)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_INT_CLR(RCC_INT));
+
+ /* Perform Byte access to RCC_CLKINT[23:16] bits to clear the selected interrupt
+ pending bits */
+ *(__IO uint8_t *) CLKINT_BYTE3_CLR_ADDR = RCC_INT;
+}
+
+/**
+ * @brief Delay After HSE Enable,.
+ * @param delay: Number Of Nops.
+ * @retval None
+ */
+static void RCC_HSEENDelay(uint32_t delay)
+{
+ uint32_t i;
+
+ for(i = 0; i < delay; i++)
+ ;
+}
+
+#if defined (AT32F413xx) || defined (AT32F415xx) || \
+ defined (AT32F403Axx)|| defined (AT32F407xx)
+/**
+ * @brief Enables or disables the Auto Step Mode.
+ * @note This function called when sysclk greater than 108Mhz.
+ * @param NewState: new state of the Step Mode. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_StepModeCmd(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ if(ENABLE == NewState)
+ {
+ RCC->MISC2 |= RCC_MISC2_AUTO_STEP_EN;
+ }
+ else
+ {
+ RCC->MISC2 &= ~RCC_MISC2_AUTO_STEP_EN;
+ }
+}
+
+/**
+ * @brief Enables or disables to get USB clock source from HSI 48M directly.
+ * @note Attention: If enable, the hsi clock frequency also has fixed 48M.
+ * @param NewState: new state of the USB clock source. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_HSI2USB48M(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ if(ENABLE == NewState)
+ {
+ RCC->MISC |= RCC_MISC_HSI_DIV_EN;
+ RCC->MISC2 |= RCC_MISC2_HSI_FOR_USB;
+ }
+ else
+ {
+ RCC->MISC &= ~RCC_MISC_HSI_DIV_EN;
+ RCC->MISC2 &= ~RCC_MISC2_HSI_FOR_USB;
+ }
+}
+#endif
+
+#if defined (AT32F403Axx)|| defined (AT32F407xx)
+/**
+ * @brief HSE Divider configura.
+ * @note This function config HSE divider.
+ * @param HSEDiv: RCC_HSE_DIV_2. HSE divider 2 for pll.
+ * RCC_HSE_DIV_3. HSE divider 3 for pll.
+ * RCC_HSE_DIV_4. HSE divider 4 for pll.
+ * RCC_HSE_DIV_5. HSE divider 5 for pll.
+ * @retval None
+ */
+void RCC_HSEDivConfig(uint32_t HSEDiv)
+{
+ /* Check the parameters */
+ assert_param(IS_RCC_HSEDIV(HSEDiv));
+
+ RCC->MISC2 &= ~RCC_HSE_DIV_MASK;
+ RCC->MISC2 |= HSEDiv;
+}
+#endif
+
+#if defined (AT32F413xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+/**
+ * @brief Enables or disables the USB INT remap.
+ * @note Remap the default USB_HP_IRQn & USB_LP_IRQn (19,20) to other IRQns(73, 74).
+ * @param NewState: new state of the USB INT remap. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_USBINTRemap(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ if(ENABLE == NewState)
+ {
+ RCC->INTCTRL |= RCC_INTCTRL_USB_INT_CTRL;
+ }
+ else
+ {
+ RCC->INTCTRL &= ~RCC_INTCTRL_USB_INT_CTRL;
+ }
+}
+
+/**
+ * @brief Enables or disables MCO output to TMR10_CH0.
+ * @note This function can enable MCO inner connect to TMR10_CH0.
+ * @param NewState: new state of the MCO to TMR10_CH0. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RCC_MCO2TMR10(FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ if(ENABLE == NewState)
+ {
+ RCC->TEST |= RCC_TEST_MCO2TMR_EN;
+ }
+ else
+ {
+ RCC->TEST &= ~RCC_TEST_MCO2TMR_EN;
+ }
+}
+#endif
+
+#if defined (AT32F415xx)
+/**
+ * @brief Config pll with RCC_PLL.
+ * @note This function can usd RCC_PLL register to config pll, not RCC_CFG_MULT.
+ * PLL_freq_n_Mhz * PLL_ns
+ * PLL clock = -------------------------------
+ * PLL_ms * PLL_fr_n
+ * ATTEMTION:
+ * 31 <= PLL_ns <= 500
+ * 1 <= PLL_ms <= 15
+ *
+ * PLL_freq_n_Mhz * PLL_ns
+ * 500Mhz <= ------------------------------ <= 1000Mhz
+ * PLL_ms
+ * @param PLL_fref: The freqence of PLL source clock.
+ * @arg PLL_FREF_4M : reference clock 4Mhz
+ * @arg PLL_FREF_6M : reference clock 6Mhz
+ * @arg PLL_FREF_8M : reference clock 8Mhz
+ * @arg PLL_FREF_12M: reference clock 12Mhz
+ * @arg PLL_FREF_16M: reference clock 16Mhz
+ * @arg PLL_FREF_25M: reference clock 25Mhz
+ * @param PLL_ns: PLL register ns value.
+ * @param PLL_ms: PLL register ms value.
+ * @param PLL_fr: VCO output divider
+ * @arg PLL_FR_1 : output divider 1
+ * @arg PLL_FR_2 : output divider 2
+ * @arg PLL_FR_4 : output divider 4
+ * @arg PLL_FR_8 : output divider 8
+ * @arg PLL_FR_16: output divider 16
+ * @arg PLL_FR_32: output divider 32
+ * @retval None
+ */
+void RCC_PLLconfig2(uint32_t PLL_fref, uint32_t PLL_ns, uint32_t PLL_ms, uint32_t PLL_fr)
+{
+ volatile uint32_t result = 0;
+ uint32_t pll_reg = 0, ret = 0;
+
+ assert_param(IS_RCC_FR(PLL_fr));
+ assert_param(IS_RCC_FREF(PLL_fref));
+ assert_param(IS_RCC_NS_VALUE(PLL_ns));
+ assert_param(IS_RCC_MS_VALUE(PLL_ms));
+
+ RCC_FREF_VALUE(PLL_fref, ret);
+
+ result = PLL_ns * ret / PLL_ms;
+
+ assert_param(IS_RCC_RESULT_VALUE(result));
+
+ pll_reg = RCC->PLL;
+
+ /* Clear PLL */
+ pll_reg &= ~(PLL_FR_MASK | PLL_MS_MASK | PLL_NS_MASK | PLL_FREF_MASK | PLL_CFGEN_MASK);
+
+ /* Config pll */
+ pll_reg |= (PLL_fref | (PLL_ns << PLL_NS_POS) | (PLL_ms << PLL_MS_POS) | PLL_fr);
+
+ /* Enable PLLGEN */
+ pll_reg |= PLL_CFGEN_ENABLE;
+
+ RCC->PLL = pll_reg;
+}
+#endif
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_rtc.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_rtc.c
new file mode 100644
index 0000000000000000000000000000000000000000..078e3d9260a71dc3fbad2929565abe542f8248d4
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_rtc.c
@@ -0,0 +1,337 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_rtc.c
+ * Description : at32f4xx RTC source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_rtc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup RTC
+ * @brief RTC driver modules
+ * @{
+ */
+
+#if defined (AT32F403xx) || defined (AT32F413xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+
+/** @defgroup RTC_Private_TypesDefinitions
+ * @{
+ */
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Private_Defines
+ * @{
+ */
+#define RTC_LSB_MASK ((uint32_t)0x0000FFFF) /*!< RTC LSB Mask */
+#define DIVH_MSB_MASK ((uint32_t)0x000F0000) /*!< RTC Prescaler MSB Mask */
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup RTC_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Enables or disables the specified RTC interrupts.
+ * @param RTC_INT: specifies the RTC interrupts sources to be enabled or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg RTC_INT_OV: Overflow interrupt
+ * @arg RTC_INT_ALA: Alarm interrupt
+ * @arg RTC_INT_PACE: Second interrupt
+ * @param NewState: new state of the specified RTC interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void RTC_INTConfig(uint16_t RTC_INT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_RTC_INT(RTC_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ RTC->CTRLH |= RTC_INT;
+ }
+ else
+ {
+ RTC->CTRLH &= (uint16_t)~RTC_INT;
+ }
+}
+
+/**
+ * @brief Enters the RTC configuration mode.
+ * @param None
+ * @retval None
+ */
+void RTC_EnterConfigMode(void)
+{
+ /* Set the CNF flag to enter in the Configuration Mode */
+ RTC->CTRLL |= RTC_CTRLL_CMF;
+}
+
+/**
+ * @brief Exits from the RTC configuration mode.
+ * @param None
+ * @retval None
+ */
+void RTC_ExitConfigMode(void)
+{
+ /* Reset the CNF flag to exit from the Configuration Mode */
+ RTC->CTRLL &= (uint16_t)~((uint16_t)RTC_CTRLL_CMF);
+}
+
+/**
+ * @brief Gets the RTC counter value.
+ * @param None
+ * @retval RTC counter value.
+ */
+uint32_t RTC_GetCounter(void)
+{
+ uint16_t tmp = 0;
+ tmp = RTC->CNTL;
+ return (((uint32_t)RTC->CNTH << 16 ) | tmp) ;
+}
+
+/**
+ * @brief Sets the RTC counter value.
+ * @param CounterValue: RTC counter new value.
+ * @retval None
+ */
+void RTC_SetCounter(uint32_t CounterValue)
+{
+ RTC_EnterConfigMode();
+ /* Set RTC COUNTER MSB word */
+ RTC->CNTH = CounterValue >> 16;
+ /* Set RTC COUNTER LSB word */
+ RTC->CNTL = (CounterValue & RTC_LSB_MASK);
+ RTC_ExitConfigMode();
+}
+
+/**
+ * @brief Sets the RTC prescaler value.
+ * @param PrescalerValue: RTC prescaler new value.
+ * @retval None
+ */
+void RTC_SetDIV(uint32_t PrescalerValue)
+{
+ /* Check the parameters */
+ assert_param(IS_RTC_DIV(PrescalerValue));
+
+ RTC_EnterConfigMode();
+ /* Set RTC PRESCALER MSB word */
+ RTC->DIVH = (PrescalerValue & DIVH_MSB_MASK) >> 16;
+ /* Set RTC PRESCALER LSB word */
+ RTC->DIVL = (PrescalerValue & RTC_LSB_MASK);
+ RTC_ExitConfigMode();
+}
+
+/**
+ * @brief Sets the RTC alarm value.
+ * @param AlarmValue: RTC alarm new value.
+ * @retval None
+ */
+void RTC_SetAlarmValue(uint32_t AlarmValue)
+{
+ RTC_EnterConfigMode();
+ /* Set the ALARM MSB word */
+ RTC->ALAH = AlarmValue >> 16;
+ /* Set the ALARM LSB word */
+ RTC->ALAL = (AlarmValue & RTC_LSB_MASK);
+ RTC_ExitConfigMode();
+}
+
+/**
+ * @brief Gets the RTC divider value.
+ * @param None
+ * @retval RTC Divider value.
+ */
+uint32_t RTC_GetDivider(void)
+{
+ uint32_t tmp = 0x00;
+ tmp = ((uint32_t)RTC->DIVCNTH & (uint32_t)0x000F) << 16;
+ tmp |= RTC->DIVCNTL;
+ return tmp;
+}
+
+/**
+ * @brief Waits until last write operation on RTC registers has finished.
+ * @note This function must be called before any write to RTC registers.
+ * @param None
+ * @retval None
+ */
+void RTC_WaitForLastTask(void)
+{
+ /* Loop until RTOFF flag is set */
+ while ((RTC->CTRLL & RTC_FLAG_RTF) == (uint16_t)RESET)
+ {
+ }
+}
+
+/**
+ * @brief Waits until the RTC registers (RTC_CNT, RTC_ALR and RTC_PRL)
+ * are synchronized with RTC APB clock.
+ * @note This function must be called before any read operation after an APB reset
+ * or an APB clock stop.
+ * @param None
+ * @retval None
+ */
+void RTC_WaitForSynchro(void)
+{
+ /* Clear RSF flag */
+ RTC->CTRLL &= (uint16_t)~RTC_FLAG_RSYNF;
+
+ /* Loop until RSF flag is set */
+ while ((RTC->CTRLL & RTC_FLAG_RSYNF) == (uint16_t)RESET)
+ {
+ }
+}
+
+/**
+ * @brief Checks whether the specified RTC flag is set or not.
+ * @param RTC_FLAG: specifies the flag to check.
+ * This parameter can be one the following values:
+ * @arg RTC_FLAG_RTF: RTC Operation OFF flag
+ * @arg RTC_FLAG_RSYNF: Registers Synchronized flag
+ * @arg RTC_FLAG_OV: Overflow flag
+ * @arg RTC_FLAG_ALA: Alarm flag
+ * @arg RTC_FLAG_PACE: Second flag
+ * @retval The new state of RTC_FLAG (SET or RESET).
+ */
+FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+
+ /* Check the parameters */
+ assert_param(IS_RTC_GET_FLAG(RTC_FLAG));
+
+ if ((RTC->CTRLL & RTC_FLAG) != (uint16_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the RTC's pending flags.
+ * @param RTC_FLAG: specifies the flag to clear.
+ * This parameter can be any combination of the following values:
+ * @arg RTC_FLAG_RSYNF: Registers Synchronized flag. This flag is cleared only after
+ * an APB reset or an APB Clock stop.
+ * @arg RTC_FLAG_OV: Overflow flag
+ * @arg RTC_FLAG_ALA: Alarm flag
+ * @arg RTC_FLAG_PACE: Second flag
+ * @retval None
+ */
+void RTC_ClearFlag(uint16_t RTC_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_RTC_CLEAR_FLAG(RTC_FLAG));
+
+ /* Clear the corresponding RTC flag */
+ RTC->CTRLL &= (uint16_t)~RTC_FLAG;
+}
+
+/**
+ * @brief Checks whether the specified RTC interrupt has occurred or not.
+ * @param RTC_INT: specifies the RTC interrupts sources to check.
+ * This parameter can be one of the following values:
+ * @arg RTC_INT_OV: Overflow interrupt
+ * @arg RTC_INT_ALA: Alarm interrupt
+ * @arg RTC_INT_PACE: Second interrupt
+ * @retval The new state of the RTC_INT (SET or RESET).
+ */
+ITStatus RTC_GetINTStatus(uint16_t RTC_INT)
+{
+ ITStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_RTC_GET_INT(RTC_INT));
+
+ bitstatus = (ITStatus)(RTC->CTRLL & RTC_INT);
+
+ if (((RTC->CTRLH & RTC_INT) != (uint16_t)RESET) && (bitstatus != (uint16_t)RESET))
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the RTC's interrupt pending bits.
+ * @param RTC_INT: specifies the interrupt pending bit to clear.
+ * This parameter can be any combination of the following values:
+ * @arg RTC_INT_OV: Overflow interrupt
+ * @arg RTC_INT_ALA: Alarm interrupt
+ * @arg RTC_INT_PACE: Second interrupt
+ * @retval None
+ */
+void RTC_ClearINTPendingBit(uint16_t RTC_INT)
+{
+ /* Check the parameters */
+ assert_param(IS_RTC_INT(RTC_INT));
+
+ /* Clear the corresponding RTC pending bit */
+ RTC->CTRLL &= (uint16_t)~RTC_INT;
+}
+
+/**
+ * @}
+ */
+
+#endif /* AT32F403xx || AT32F413xx || AT32F403Axx || AT32F407xx */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_sdio.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_sdio.c
new file mode 100644
index 0000000000000000000000000000000000000000..f6706307d8c49aa2b3eea3fe2a632dcab3fbfb37
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_sdio.c
@@ -0,0 +1,913 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_sdio.c
+ * Description : at32f4xx SDIO source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_sdio.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup SDIO
+ * @brief SDIO driver modules
+ * @{
+ */
+
+/** @defgroup SDIO_Private_TypesDefinitions
+ * @{
+ */
+
+/* --- CLKCR Register ---*/
+
+/* SDIO CLKEN mask */
+#define CLKCTRL_CLKEN_Set ((uint32_t)0x00000100)
+#define CLKCTRL_CLKEN_Rst ((uint32_t)0xFFFFFEFF)
+
+
+/* --- CMD Register ---*/
+
+/* SDIO SDIOSUSPEND mask */
+#define CMD_SDIOSUSP_Set ((uint32_t)0x00000800)
+#define CMD_SDIOSUSP_Rst ((uint32_t)0xFFFFF7FF)
+
+/* SDIO ENCMDCOMPL mask */
+#define CMD_CMPLSGNLEN_Set ((uint32_t)0x00001000)
+#define CMD_CMPLSGNLEN_Rst ((uint32_t)0xFFFFEFFF)
+
+/* SDIO INTDIS mask */
+#define CMD_INTDIS_Set ((uint32_t)0x00002000)
+#define CMD_INTDIS_Rst ((uint32_t)0xFFFFDFFF)
+
+/* SDIO ATACMD mask */
+#define CMD_ATACMD_Set ((uint32_t)0x00004000)
+#define CMD_ATACMD_Rst ((uint32_t)0xFFFFBFFF)
+
+
+/* --- DTCTRL Register ---*/
+
+/* SDIO ATACMD mask */
+#define DTCTRL_DMAEN_Set ((uint32_t)0x00000008)
+#define DTCTRL_DMAEN_Rst ((uint32_t)0xFFFFFFF7)
+
+/* SDIO RWSTART mask */
+#define DTCTRL_RWSTART_Set ((uint32_t)0x00000100)
+#define DTCTRL_RWSTART_Rst ((uint32_t)0xFFFFFEFF)
+
+/* SDIO RWSTOP mask */
+#define DTCTRL_RWSTOP_Set ((uint32_t)0x00000200)
+#define DTCTRL_RWSTOP_Rst ((uint32_t)0xFFFFFDFF)
+
+/* SDIO RWMOD mask */
+#define DTCTRL_RWMOD_Set ((uint32_t)0x00000400)
+
+/* SDIO SDIOEN mask */
+#define DTCTRL_SDIOEN_Set ((uint32_t)0x00000800)
+#define DTCTRL_SDIOEN_Rst ((uint32_t)0xFFFFF7FF)
+
+/* ---------------------- SDIO registers bit mask ------------------------ */
+
+/* --- CLKCR Register ---*/
+
+/* CLKCR register clear mask */
+#define CLKCTRL_CLEAR_MASK ((uint32_t)0xFFFE0100)
+
+/* --- PWRCTRL Register ---*/
+
+/* SDIO PWRCTRL Mask */
+#define PWR_PWRCTRL_MASK ((uint32_t)0xFFFFFFFC)
+
+/* --- DTCTRL Register ---*/
+
+/* SDIO DTCTRL Clear Mask */
+#define DTCTRL_CLEAR_MASK ((uint32_t)0xFFFFFF08)
+#define DTCTRL_RWMOD_MASK ((uint32_t)0xFFFFFBFF)
+
+/* --- CMD Register ---*/
+
+/* CMD Register clear mask */
+#define CMD_CLEAR_MASK ((uint32_t)0xFFFFF800)
+
+/* SDIO RESP Registers Address Offset */
+#define SDIO_RSP_ADDR_OFFSET ((uint32_t)0x14)
+
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Private_Defines
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SDIO_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the SDIO peripheral registers to their default reset values.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @retval None
+ */
+void SDIO_Reset(SDIO_Type * SDIOx)
+{
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ SDIOx->POWER = 0x00000000;
+ SDIOx->CLKCTRL = 0x00000000;
+ SDIOx->ARG = 0x00000000;
+ SDIOx->CMD = 0x00000000;
+ SDIOx->DTTMR = 0x00000000;
+ SDIOx->DTLEN = 0x00000000;
+ SDIOx->DTCTRL = 0x00000000;
+ SDIOx->INTCLR = 0x00C007FF;
+ SDIOx->INTEN = 0x00000000;
+}
+
+/**
+ * @brief Initializes the SDIO peripheral according to the specified
+ * parameters in the SDIO_InitStruct.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_InitStruct : pointer to a SDIO_InitType structure
+ * that contains the configuration information for the SDIO peripheral.
+ * @retval None
+ */
+void SDIO_Init(SDIO_Type * SDIOx, SDIO_InitType* SDIO_InitStruct)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_CLK_EDGE(SDIO_InitStruct->SDIO_ClkEdge));
+ assert_param(IS_SDIO_CLK_BYPASS(SDIO_InitStruct->SDIO_ClkBypass));
+ assert_param(IS_SDIO_CLK_POWER_SAVE(SDIO_InitStruct->SDIO_ClkPowerSave));
+ assert_param(IS_SDIO_BUS_WIDTH(SDIO_InitStruct->SDIO_BusWidth));
+ assert_param(IS_SDIO_FLOW_CTRL(SDIO_InitStruct->SDIO_FlowCtrl));
+
+ /*---------------------------- SDIO CLKCR Configuration ------------------------*/
+ /* Get the SDIOx CLKCR value */
+ tmpreg = SDIOx->CLKCTRL;
+
+ /* Clear CLKDIV, PWRSAV, BYPASS, WIDBUS, NEGEDGE, HWFC_EN bits */
+ tmpreg &= CLKCTRL_CLEAR_MASK;
+
+ /* Set PWRSAV bit according to SDIO_ClockPowerSave value */
+ /* Set BYPASS bit according to SDIO_ClockBypass value */
+ /* Set WIDBUS bits according to SDIO_BusWide value */
+ /* Set NEGEDGE bits according to SDIO_ClockEdge value */
+ /* Set HWFC_EN bits according to SDIO_HardwareFlowControl value */
+ tmpreg |= (SDIO_InitStruct->SDIO_ClkPowerSave | SDIO_InitStruct->SDIO_ClkBypass |
+ SDIO_InitStruct->SDIO_BusWidth | SDIO_InitStruct->SDIO_ClkEdge | SDIO_InitStruct->SDIO_FlowCtrl);
+
+ /* Set CLKDIV bits according to SDIO_ClockDiv value */
+ tmpreg |= ((SDIO_InitStruct->SDIO_ClkPsc & 0x00FF) | ((SDIO_InitStruct->SDIO_ClkPsc & 0x0300) << 7));
+ /* Write to SDIOx CLKCR */
+ SDIOx->CLKCTRL = tmpreg;
+}
+
+/**
+ * @brief Fills each SDIO_InitStruct member with its default value.
+ * @param SDIO_InitStruct: pointer to an SDIO_InitType structure which
+ * will be initialized.
+ * @retval None
+ */
+void SDIO_StructInit(SDIO_InitType* SDIO_InitStruct)
+{
+ /* SDIO_InitStruct members default value */
+ SDIO_InitStruct->SDIO_ClkPsc = 0x00;
+ SDIO_InitStruct->SDIO_ClkEdge = SDIO_ClkEdge_Rising;
+ SDIO_InitStruct->SDIO_ClkBypass = SDIO_ClkBypass_Disable;
+ SDIO_InitStruct->SDIO_ClkPowerSave = SDIO_ClkPowerSave_Disable;
+ SDIO_InitStruct->SDIO_BusWidth = SDIO_BusWidth_1b;
+ SDIO_InitStruct->SDIO_FlowCtrl = SDIO_FlowCtrl_Disable;
+}
+
+/**
+ * @brief Enables or disables the SDIO Clock.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param NewState: new state of the SDIO Clock. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SDIO_ClockCmd(SDIO_Type * SDIOx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the SDIO Clock. */
+ SDIOx->CLKCTRL |= CLKCTRL_CLKEN_Set;
+ }
+ else
+ {
+ /* Disable the SDIO Clock. */
+ SDIOx->CLKCTRL &= CLKCTRL_CLKEN_Rst;
+ }
+}
+
+/**
+ * @brief Sets the power status of the controller.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_PowerState: new state of the Power state.
+ * This parameter can be one of the following values:
+ * @arg SDIO_PowerSave_OFF
+ * @arg SDIO_PowerSave_ON
+ * @retval None
+ */
+void SDIO_SetPowerSaveState(SDIO_Type * SDIOx, uint32_t SDIO_PowerState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_POWER_SAVE(SDIO_PowerState));
+
+ SDIOx->POWER &= PWR_PWRCTRL_MASK;
+ SDIOx->POWER |= SDIO_PowerState;
+}
+
+/**
+ * @brief Gets the power status of the controller.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @retval Power status of the controller. The returned value can
+ * be one of the following:
+ * - 0x00: Power OFF
+ * - 0x02: Power UP
+ * - 0x03: Power ON
+ */
+uint32_t SDIO_GetPowerSaveState(SDIO_Type * SDIOx)
+{
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ return (SDIOx->POWER & (~PWR_PWRCTRL_MASK));
+}
+
+/**
+ * @brief Enables or disables the SDIO interrupts.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_INT: specifies the SDIO interrupt sources to be enabled or disabled.
+ * This parameter can be one or a combination of the following values:
+ * @arg SDIO_INT_CMDFAIL: Command response received (CRC check failed) interrupt
+ * @arg SDIO_INT_DTFAIL: Data block sent/received (CRC check failed) interrupt
+ * @arg SDIO_INT_CMDTIMEOUT: Command response timeout interrupt
+ * @arg SDIO_INT_DTTIMEOUT: Data timeout interrupt
+ * @arg SDIO_INT_TXERRU: Transmit FIFO underrun error interrupt
+ * @arg SDIO_INT_RXERRO: Received FIFO overrun error interrupt
+ * @arg SDIO_INT_CMDRSPCMPL: Command response received (CRC check passed) interrupt
+ * @arg SDIO_INT_CMDCMPL: Command sent (no response required) interrupt
+ * @arg SDIO_INT_DTCMPL: Data end (data counter, SDIDCOUNT, is zero) interrupt
+ * @arg SDIO_INT_SBITERR: Start bit not detected on all data signals in wide bus mode interrupt
+ * @arg SDIO_INT_DTBLKCMPL: Data block sent/received (CRC check passed) interrupt
+ * @arg SDIO_INT_DOCMD: Command transfer in progress interrupt
+ * @arg SDIO_INT_DOTX: Data transmit in progress interrupt
+ * @arg SDIO_INT_DORX: Data receive in progress interrupt
+ * @arg SDIO_INT_TXBUF_H: Transmit FIFO Half Empty interrupt
+ * @arg SDIO_INT_RXBUF_H: Receive FIFO Half Full interrupt
+ * @arg SDIO_INT_TXBUF_F: Transmit FIFO full interrupt
+ * @arg SDIO_INT_RXBUF_F: Receive FIFO full interrupt
+ * @arg SDIO_INT_TXBUF_E: Transmit FIFO empty interrupt
+ * @arg SDIO_INT_RXBUF_E: Receive FIFO empty interrupt
+ * @arg SDIO_INT_TXBUF: Data available in transmit FIFO interrupt
+ * @arg SDIO_INT_RXBUF: Data available in receive FIFO interrupt
+ * @arg SDIO_INT_SDIOIF: SD I/O interrupt received interrupt
+ * @arg SDIO_INT_ATACMPL: CE-ATA command completion signal received for CMD61 interrupt
+ * @param NewState: new state of the specified SDIO interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SDIO_INTConfig(SDIO_Type * SDIOx, uint32_t SDIO_INT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_INT(SDIO_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the SDIO interrupts */
+ SDIOx->INTEN |= SDIO_INT;
+ }
+ else
+ {
+ /* Disable the SDIO interrupts */
+ SDIOx->INTEN &= ~SDIO_INT;
+ }
+}
+
+/**
+ * @brief Enables or disables the SDIO DMA request.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param NewState: new state of the selected SDIO DMA request.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SDIO_DMACmd(SDIO_Type * SDIOx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected SDIO DMA request. */
+ SDIOx->DTCTRL |= DTCTRL_DMAEN_Set;
+ }
+ else
+ {
+ /* Disable the selected SDIO DMA request. */
+ SDIOx->DTCTRL &= DTCTRL_DMAEN_Rst;
+ }
+}
+
+/**
+ * @brief Initializes the SDIO Command according to the specified
+ * parameters in the SDIO_CmdInitStruct and send the command.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_CmdInitStruct : pointer to a SDIO_CmdInitType
+ * structure that contains the configuration information for the SDIO command.
+ * @retval None
+ */
+void SDIO_SendCommand(SDIO_Type * SDIOx, SDIO_CmdInitType *SDIO_CmdInitStruct)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_CMD_IDX(SDIO_CmdInitStruct->SDIO_CmdIdx));
+ assert_param(IS_SDIO_RSP_TYPE(SDIO_CmdInitStruct->SDIO_Resp));
+ assert_param(IS_SDIO_WAIT(SDIO_CmdInitStruct->SDIO_Wait));
+ assert_param(IS_SDIO_CPSM(SDIO_CmdInitStruct->SDIO_CPSM));
+
+ /*---------------------------- SDIOx ARG Configuration ------------------------*/
+ /* Set the SDIOx Argument value */
+ SDIOx->ARG = SDIO_CmdInitStruct->SDIO_Argu;
+
+ /*---------------------------- SDIOx CMD Configuration ------------------------*/
+ /* Get the SDIOx CMD value */
+ tmpreg = SDIOx->CMD;
+ /* Clear CMDINDEX, WAITRESP, WAITINT, WAITPEND, CPSMEN bits */
+ tmpreg &= CMD_CLEAR_MASK;
+ /* Set CMDINDEX bits according to SDIO_CmdIndex value */
+ /* Set WAITRESP bits according to SDIO_Response value */
+ /* Set WAITINT and WAITPEND bits according to SDIO_Wait value */
+ /* Set CPSMEN bits according to SDIO_CPSM value */
+ tmpreg |= (uint32_t)SDIO_CmdInitStruct->SDIO_CmdIdx | SDIO_CmdInitStruct->SDIO_Resp
+ | SDIO_CmdInitStruct->SDIO_Wait | SDIO_CmdInitStruct->SDIO_CPSM;
+
+ /* Write to SDIOx CMD */
+ SDIOx->CMD = tmpreg;
+}
+
+/**
+ * @brief Fills each SDIO_CmdInitStruct member with its default value.
+ * @param SDIO_CmdInitStruct: pointer to an SDIO_CmdInitType
+ * structure which will be initialized.
+ * @retval None
+ */
+void SDIO_CmdStructInit(SDIO_CmdInitType* SDIO_CmdInitStruct)
+{
+ /* SDIO_CmdInitStruct members default value */
+ SDIO_CmdInitStruct->SDIO_Argu = 0x00;
+ SDIO_CmdInitStruct->SDIO_CmdIdx = 0x00;
+ SDIO_CmdInitStruct->SDIO_Resp = SDIO_Rsp_No;
+ SDIO_CmdInitStruct->SDIO_Wait = SDIO_Wait_No;
+ SDIO_CmdInitStruct->SDIO_CPSM = SDIO_CPSM_Disable;
+}
+
+/**
+ * @brief Returns command index of last command for which response received.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @retval Returns the command index of the last command response received.
+ */
+uint8_t SDIO_GetCommandResponse(SDIO_Type * SDIOx)
+{
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ return (uint8_t)(SDIOx->RSPCMD);
+}
+
+/**
+ * @brief Returns response received from the card for the last command.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_RESP: Specifies the SDIO response register.
+ * This parameter can be one of the following values:
+ * @arg SDIO_RSP1: Response Register 1
+ * @arg SDIO_RSP2: Response Register 2
+ * @arg SDIO_RSP3: Response Register 3
+ * @arg SDIO_RSP4: Response Register 4
+ * @retval The Corresponding response register value.
+ */
+uint32_t SDIO_GetResponse(SDIO_Type * SDIOx, uint32_t SDIO_RESP)
+{
+ __IO uint32_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_RSP(SDIO_RESP));
+
+ tmp = (uint32_t)&SDIOx->RSP1 + SDIO_RESP;
+
+ return (*(__IO uint32_t *) tmp);
+}
+
+/**
+ * @brief Initializes the SDIO data path according to the specified
+ * parameters in the SDIO_DataInitStruct.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_DataInitStruct : pointer to a SDIO_DataInitType structure that
+ * contains the configuration information for the SDIO command.
+ * @retval None
+ */
+void SDIO_DataConfig(SDIO_Type * SDIOx, SDIO_DataInitType* SDIO_DataInitStruct)
+{
+ uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_DATA_LEN(SDIO_DataInitStruct->SDIO_DataLen));
+ assert_param(IS_SDIO_BLK_SIZE(SDIO_DataInitStruct->SDIO_DataBlkSize));
+ assert_param(IS_SDIO_TRANSFER_DIR(SDIO_DataInitStruct->SDIO_TransferDir));
+ assert_param(IS_SDIO_TRANSFER_MODE(SDIO_DataInitStruct->SDIO_TransferMode));
+ assert_param(IS_SDIO_DPSM(SDIO_DataInitStruct->SDIO_DPSM));
+
+ /*---------------------------- SDIO DTIMER Configuration ---------------------*/
+ /* Set the SDIOx Data TimeOut value */
+ SDIOx->DTTMR = SDIO_DataInitStruct->SDIO_DataTimeOut;
+
+ /*---------------------------- SDIOx DLEN Configuration -----------------------*/
+ /* Set the SDIOx DataLength value */
+ SDIOx->DTLEN = SDIO_DataInitStruct->SDIO_DataLen;
+
+ /*---------------------------- SDIO DTCTRL Configuration ----------------------*/
+ /* Get the SDIOx DTCTRL value */
+ tmpreg = SDIOx->DTCTRL;
+ /* Clear DEN, DTMODE, DTDIR and DBCKSIZE bits */
+ tmpreg &= DTCTRL_CLEAR_MASK;
+ /* Set DEN bit according to SDIO_DPSM value */
+ /* Set DTMODE bit according to SDIO_TransferMode value */
+ /* Set DTDIR bit according to SDIO_TransferDir value */
+ /* Set DBCKSIZE bits according to SDIO_DataBlockSize value */
+ tmpreg |= (uint32_t)SDIO_DataInitStruct->SDIO_DataBlkSize | SDIO_DataInitStruct->SDIO_TransferDir
+ | SDIO_DataInitStruct->SDIO_TransferMode | SDIO_DataInitStruct->SDIO_DPSM;
+
+ /* Write to SDIOx DTCTRL */
+ SDIOx->DTCTRL = tmpreg;
+}
+
+/**
+ * @brief Fills each SDIO_DataInitStruct member with its default value.
+ * @param SDIO_DataInitStruct: pointer to an SDIO_DataInitType structure which
+ * will be initialized.
+ * @retval None
+ */
+void SDIO_DataStructInit(SDIO_DataInitType* SDIO_DataInitStruct)
+{
+ /* SDIO_DataInitStruct members default value */
+ SDIO_DataInitStruct->SDIO_DataTimeOut = 0xFFFFFFFF;
+ SDIO_DataInitStruct->SDIO_DataLen = 0x00;
+ SDIO_DataInitStruct->SDIO_DataBlkSize = SDIO_DataBlkSize_1b;
+ SDIO_DataInitStruct->SDIO_TransferDir = SDIO_TransferDir_ToCard;
+ SDIO_DataInitStruct->SDIO_TransferMode = SDIO_TransferMode_Block;
+ SDIO_DataInitStruct->SDIO_DPSM = SDIO_DPSM_Disable;
+}
+
+/**
+ * @brief Returns number of remaining data bytes to be transferred.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @retval Number of remaining data bytes to be transferred
+ */
+uint32_t SDIO_GetDataCounter(SDIO_Type * SDIOx)
+{
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ return SDIOx->DTCNTR;
+}
+
+/**
+ * @brief Read one data word from Rx FIFO.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @retval Data received
+ */
+uint32_t SDIO_ReadData(SDIO_Type * SDIOx)
+{
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ return SDIOx->BUF;
+}
+
+/**
+ * @brief Write one data word to Tx FIFO.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param Data: 32-bit data word to write.
+ * @retval None
+ */
+void SDIO_WriteData(SDIO_Type * SDIOx, uint32_t Data)
+{
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ SDIOx->BUF = Data;
+}
+
+/**
+ * @brief Returns the number of words left to be written to or read from FIFO.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @retval Remaining number of words.
+ */
+uint32_t SDIO_GetBUFCount(SDIO_Type * SDIOx)
+{
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ return SDIOx->BUFCNTR;
+}
+
+/**
+ * @brief Starts the SD I/O Read Wait operation.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param NewState: new state of the Start SDIO Read Wait operation.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SDIO_StartSDIOReadWait(SDIO_Type * SDIOx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the Start SDIO Read Wait operation. */
+ SDIOx->DTCTRL |= DTCTRL_RWSTART_Set;
+ }
+ else
+ {
+ /* Disable the Start SDIO Read Wait operation. */
+ SDIOx->DTCTRL &= DTCTRL_RWSTART_Rst;
+ }
+}
+
+/**
+ * @brief Stops the SD I/O Read Wait operation.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param NewState: new state of the Stop SDIO Read Wait operation.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SDIO_StopSDIOReadWait(SDIO_Type * SDIOx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the Stop SDIO Read Wait operation. */
+ SDIOx->DTCTRL |= DTCTRL_RWSTOP_Set;
+ }
+ else
+ {
+ /* Disable the Stop SDIO Read Wait operation. */
+ SDIOx->DTCTRL &= DTCTRL_RWSTOP_Rst;
+ }
+}
+
+/**
+ * @brief Sets one of the two options of inserting read wait interval.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_ReadWaitMode: SD I/O Read Wait operation mode.
+ * This parameter can be:
+ * @arg SDIO_ReadWaitMode_CLK: Read Wait control by stopping SDIOCLK
+ * @arg SDIO_ReadWaitMode_DATA2: Read Wait control using SDIO_DATA2
+ * @retval None
+ */
+void SDIO_SetSDIOReadWaitMode(SDIO_Type * SDIOx, uint32_t SDIO_ReadWaitMode)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_READWAIT_MODE(SDIO_ReadWaitMode));
+
+ SDIOx->DTCTRL &= DTCTRL_RWMOD_MASK;
+
+ SDIOx->DTCTRL |= SDIO_ReadWaitMode;
+}
+
+/**
+ * @brief Enables or disables the SD I/O Mode Operation.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param NewState: new state of SDIO specific operation.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SDIO_SetSDIOOperation(SDIO_Type * SDIOx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable SDIO specific operation. */
+ SDIOx->DTCTRL |= DTCTRL_SDIOEN_Set;
+ }
+ else
+ {
+ /* Disable SDIO specific operation. */
+ SDIOx->DTCTRL &= DTCTRL_SDIOEN_Rst;
+ }
+}
+
+/**
+ * @brief Enables or disables the SD I/O Mode suspend command sending.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param NewState: new state of the SD I/O Mode suspend command.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SDIO_SendSDIOSuspendCmd(SDIO_Type * SDIOx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable SD I/O Mode suspend command. */
+ SDIOx->CMD |= CMD_SDIOSUSP_Set;
+ }
+ else
+ {
+ /* Disable SD I/O Mode suspend command. */
+ SDIOx->CMD &= CMD_SDIOSUSP_Rst;
+ }
+}
+
+/**
+ * @brief Enables or disables the command completion signal.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param NewState: new state of command completion signal.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SDIO_CommandCompletionCmd(SDIO_Type * SDIOx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the command completion signal. */
+ SDIOx->CMD |= CMD_CMPLSGNLEN_Set;
+ }
+ else
+ {
+ /* Disable the command completion signal. */
+ SDIOx->CMD &= CMD_CMPLSGNLEN_Rst;
+ }
+}
+
+/**
+ * @brief Enables or disables the CE-ATA interrupt.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param NewState: new state of CE-ATA interrupt. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SDIO_ATAINTCmd(SDIO_Type * SDIOx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable ATA Interrupt. */
+ SDIOx->CMD &= CMD_INTDIS_Rst;
+ }
+ else
+ {
+ /* Disable CE-ATA command. */
+ SDIOx->CMD |= CMD_INTDIS_Set;
+ }
+}
+
+/**
+ * @brief Sends CE-ATA command (CMD61).
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param NewState: new state of CE-ATA command. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SDIO_SendATACmd(SDIO_Type * SDIOx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable CE-ATA command. */
+ SDIOx->CMD |= CMD_ATACMD_Set;
+ }
+ else
+ {
+ /* Disable CE-ATA command. */
+ SDIOx->CMD &= CMD_ATACMD_Rst;
+ }
+}
+
+/**
+ * @brief Checks whether the specified SDIO flag is set or not.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg SDIO_FLG_CMDFAIL: Command response received (CRC check failed)
+ * @arg SDIO_FLG_DTFAIL: Data block sent/received (CRC check failed)
+ * @arg SDIO_FLG_CMDTIMEOUT: Command response timeout
+ * @arg SDIO_FLG_DTTIMEOUT: Data timeout
+ * @arg SDIO_FLG_TXERRU: Transmit FIFO underrun error
+ * @arg SDIO_FLG_RXERRO: Received FIFO overrun error
+ * @arg SDIO_FLG_CMDRSPCMPL: Command response received (CRC check passed)
+ * @arg SDIO_FLG_CMDCMPL: Command sent (no response required)
+ * @arg SDIO_FLG_DTCMPL: Data end (data counter, SDIDCOUNT, is zero)
+ * @arg SDIO_FLG_SBITERR: Start bit not detected on all data signals in wide bus mode.
+ * @arg SDIO_FLG_DTBLKCMPL: Data block sent/received (CRC check passed)
+ * @arg SDIO_FLG_DOCMD: Command transfer in progress
+ * @arg SDIO_FLG_DOTX: Data transmit in progress
+ * @arg SDIO_FLG_DORX: Data receive in progress
+ * @arg SDIO_FLG_TXBUF_H: Transmit FIFO Half Empty
+ * @arg SDIO_FLG_RXBUF_H: Receive FIFO Half Full
+ * @arg SDIO_FLG_TXBUF_F: Transmit FIFO full
+ * @arg SDIO_FLG_RXBUF_F: Receive FIFO full
+ * @arg SDIO_FLG_TXBUF_E: Transmit FIFO empty
+ * @arg SDIO_FLG_RXBUF_E: Receive FIFO empty
+ * @arg SDIO_FLG_TXBUF: Data available in transmit FIFO
+ * @arg SDIO_FLG_RXBUF: Data available in receive FIFO
+ * @arg SDIO_FLG_SDIOIF: SD I/O interrupt received
+ * @arg SDIO_FLG_ATACMPL: CE-ATA command completion signal received for CMD61
+ * @retval The new state of SDIO_FLAG (SET or RESET).
+ */
+FlagStatus SDIO_GetFlagStatus(SDIO_Type * SDIOx, uint32_t SDIO_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_FLG(SDIO_FLAG));
+
+ if ((SDIOx->STS & SDIO_FLAG) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the SDIO's pending flags.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_FLAG: specifies the flag to clear.
+ * This parameter can be one or a combination of the following values:
+ * @arg SDIO_FLG_CMDFAIL: Command response received (CRC check failed)
+ * @arg SDIO_FLG_DTFAIL: Data block sent/received (CRC check failed)
+ * @arg SDIO_FLG_CMDTIMEOUT: Command response timeout
+ * @arg SDIO_FLG_DTTIMEOUT: Data timeout
+ * @arg SDIO_FLG_TXERRU: Transmit FIFO underrun error
+ * @arg SDIO_FLG_RXERRO: Received FIFO overrun error
+ * @arg SDIO_FLG_CMDRSPCMPL: Command response received (CRC check passed)
+ * @arg SDIO_FLG_CMDCMPL: Command sent (no response required)
+ * @arg SDIO_FLG_DTCMPL: Data end (data counter, SDIDCOUNT, is zero)
+ * @arg SDIO_FLG_SBITERR: Start bit not detected on all data signals in wide bus mode
+ * @arg SDIO_FLG_DTBLKCMPL: Data block sent/received (CRC check passed)
+ * @arg SDIO_FLG_SDIOIF: SD I/O interrupt received
+ * @arg SDIO_FLG_ATACMPL: CE-ATA command completion signal received for CMD61
+ * @retval None
+ */
+void SDIO_ClearFlag(SDIO_Type * SDIOx, uint32_t SDIO_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_CLEAR_FLG(SDIO_FLAG));
+
+ SDIOx->INTCLR = SDIO_FLAG;
+}
+
+/**
+ * @brief Checks whether the specified SDIO interrupt has occurred or not.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_INT: specifies the SDIO interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg SDIO_INT_CMDFAIL: Command response received (CRC check failed) interrupt
+ * @arg SDIO_INT_DTFAIL: Data block sent/received (CRC check failed) interrupt
+ * @arg SDIO_INT_CMDTIMEOUT: Command response timeout interrupt
+ * @arg SDIO_INT_DTTIMEOUT: Data timeout interrupt
+ * @arg SDIO_INT_TXERRU: Transmit FIFO underrun error interrupt
+ * @arg SDIO_INT_RXERRO: Received FIFO overrun error interrupt
+ * @arg SDIO_INT_CMDRSPCMPL: Command response received (CRC check passed) interrupt
+ * @arg SDIO_INT_CMDCMPL: Command sent (no response required) interrupt
+ * @arg SDIO_INT_DTCMPL: Data end (data counter, SDIDCOUNT, is zero) interrupt
+ * @arg SDIO_INT_SBITERR: Start bit not detected on all data signals in wide bus mode interrupt
+ * @arg SDIO_INT_DTBLKCMPL: Data block sent/received (CRC check passed) interrupt
+ * @arg SDIO_INT_DOCMD: Command transfer in progress interrupt
+ * @arg SDIO_INT_DOTX: Data transmit in progress interrupt
+ * @arg SDIO_INT_DORX: Data receive in progress interrupt
+ * @arg SDIO_INT_TXBUF_H: Transmit FIFO Half Empty interrupt
+ * @arg SDIO_INT_RXBUF_H: Receive FIFO Half Full interrupt
+ * @arg SDIO_INT_TXBUF_F: Transmit FIFO full interrupt
+ * @arg SDIO_INT_RXBUF_F: Receive FIFO full interrupt
+ * @arg SDIO_INT_TXBUF_E: Transmit FIFO empty interrupt
+ * @arg SDIO_INT_RXBUF_E: Receive FIFO empty interrupt
+ * @arg SDIO_INT_TXBUF: Data available in transmit FIFO interrupt
+ * @arg SDIO_INT_RXBUF: Data available in receive FIFO interrupt
+ * @arg SDIO_INT_SDIOIF: SD I/O interrupt received interrupt
+ * @arg SDIO_INT_ATACMPL: CE-ATA command completion signal received for CMD61 interrupt
+ * @retval The new state of SDIO_INT (SET or RESET).
+ */
+ITStatus SDIO_GetINTStatus(SDIO_Type * SDIOx, uint32_t SDIO_INT)
+{
+ ITStatus bitstatus = RESET;
+
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_GET_INT(SDIO_INT));
+
+ if ((SDIOx->STS & SDIO_INT) != (uint32_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the SDIO's interrupt pending bits.
+ * @param SDIOx: where x can be 1 or 2 to select the SDIO peripheral.
+ * @param SDIO_INT: specifies the interrupt pending bit to clear.
+ * This parameter can be one or a combination of the following values:
+ * @arg SDIO_INT_CMDFAIL: Command response received (CRC check failed) interrupt
+ * @arg SDIO_INT_DTFAIL: Data block sent/received (CRC check failed) interrupt
+ * @arg SDIO_INT_CMDTIMEOUT: Command response timeout interrupt
+ * @arg SDIO_INT_DTTIMEOUT: Data timeout interrupt
+ * @arg SDIO_INT_TXERRU: Transmit FIFO underrun error interrupt
+ * @arg SDIO_INT_RXERRO: Received FIFO overrun error interrupt
+ * @arg SDIO_INT_CMDRSPCMPL: Command response received (CRC check passed) interrupt
+ * @arg SDIO_INT_CMDCMPL: Command sent (no response required) interrupt
+ * @arg SDIO_INT_DTCMPL: Data end (data counter, SDIDCOUNT, is zero) interrupt
+ * @arg SDIO_INT_SBITERR: Start bit not detected on all data signals in wide bus mode interrupt
+ * @arg SDIO_INT_SDIOIF: SD I/O interrupt received interrupt
+ * @arg SDIO_INT_ATACMPL: CE-ATA command completion signal received for CMD61
+ * @retval None
+ */
+void SDIO_ClearINTPendingBit(SDIO_Type * SDIOx, uint32_t SDIO_INT)
+{
+ /* Check the parameters */
+ assert_param(IS_SDIO_ALL_PERIPH(SDIOx));
+ assert_param(IS_SDIO_CLEAR_INT(SDIO_INT));
+
+ SDIOx->INTCLR = SDIO_INT;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_spi.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_spi.c
new file mode 100644
index 0000000000000000000000000000000000000000..34c52806a4068fe2a64d470eb4de0e18b9a29cd1
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_spi.c
@@ -0,0 +1,897 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_spi.c
+ * Description : at32f4xx SPI source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_spi.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup SPI
+ * @brief SPI driver modules
+ * @{
+ */
+
+/** @defgroup SPI_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+
+/** @defgroup SPI_Private_Defines
+ * @{
+ */
+
+/* SPI SPE mask */
+#define CTRL1_SPIEN_SET ((uint16_t)0x0040)
+#define CTRL1_SPIEN_RESET ((uint16_t)0xFFBF)
+
+/* I2S I2SE mask */
+#define I2SCTRL_I2SEN_SET ((uint16_t)0x0400)
+#define I2SCTRL_I2SEN_RESET ((uint16_t)0xFBFF)
+
+/* SPI CRCNext mask */
+#define CTRL1_CTN_SET ((uint16_t)0x1000)
+
+/* SPI CRCEN mask */
+#define CTRL1_CCE_SET ((uint16_t)0x2000)
+#define CTRL1_CCE_RESET ((uint16_t)0xDFFF)
+
+/* SPI SSOE mask */
+#define CTRL2_NSSOE_SET ((uint16_t)0x0004)
+#define CTRL2_NSSOE_RESET ((uint16_t)0xFFFB)
+
+/* SPI registers Masks */
+#define CTRL1_CLEAR_MASK ((uint16_t)0x3040)
+#define I2SCTRL_CLEAR_MASK ((uint16_t)0xF040)
+
+/* SPI or I2S mode selection masks */
+#define SPI_MODE_SEL ((uint16_t)0xF7FF)
+#define I2S_MODE_SEL ((uint16_t)0x0800)
+
+/* I2S clock source selection masks */
+#define I2S2_CLK_SRC ((uint32_t)(0x00020000))
+#define I2S3_CLK_SRC ((uint32_t)(0x00040000))
+#define I2S_MUL_MASK ((uint32_t)(0x0000F000))
+#define I2S_DIV_MASK ((uint32_t)(0x000000F0))
+
+/**
+ * @}
+ */
+
+/** @defgroup SPI_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SPI_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SPI_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup SPI_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the SPIx peripheral registers to their default
+ * reset values (Affects also the I2Ss).
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @retval None
+ */
+void SPI_I2S_Reset(SPI_Type* SPIx)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+
+ if (SPIx == SPI1)
+ {
+ /* Enable SPI1 reset state */
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_SPI1, ENABLE);
+ /* Release SPI1 from reset state */
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_SPI1, DISABLE);
+ }
+ else if (SPIx == SPI2)
+ {
+ /* Enable SPI2 reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_SPI2, ENABLE);
+ /* Release SPI2 from reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_SPI2, DISABLE);
+ }
+#if defined (AT32F403xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+ else if (SPIx == SPI3)
+ {
+ /* Enable SPI3 reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_SPI3, ENABLE);
+ /* Release SPI3 from reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_SPI3, DISABLE);
+ }
+ else if (SPIx == SPI4)
+ {
+ /* Enable SPI4 reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_SPI4, ENABLE);
+ /* Release SPI4 from reset state */
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_SPI4, DISABLE);
+ }
+#endif
+}
+
+/**
+ * @brief Initializes the SPIx peripheral according to the specified
+ * parameters in the SPI_InitStruct.
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @param SPI_InitStruct: pointer to a SPI_InitType structure that
+ * contains the configuration information for the specified SPI peripheral.
+ * @retval None
+ */
+void SPI_Init(SPI_Type* SPIx, SPI_InitType* SPI_InitStruct)
+{
+ uint16_t tmpreg = 0;
+
+ /* check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+
+ /* Check the SPI parameters */
+ assert_param(IS_SPI_TRANS_MODE(SPI_InitStruct->SPI_TransMode));
+ assert_param(IS_SPI_MODE(SPI_InitStruct->SPI_Mode));
+ assert_param(IS_SPI_FRAMESIZE(SPI_InitStruct->SPI_FrameSize));
+ assert_param(IS_SPI_CPOL(SPI_InitStruct->SPI_CPOL));
+ assert_param(IS_SPI_CPHA(SPI_InitStruct->SPI_CPHA));
+ assert_param(IS_SPI_NSSSEL(SPI_InitStruct->SPI_NSSSEL));
+ assert_param(IS_SPI_MCLKP(SPI_InitStruct->SPI_MCLKP));
+ assert_param(IS_SPI_FIRST_BIT(SPI_InitStruct->SPI_FirstBit));
+ assert_param(IS_SPI_CPOLY(SPI_InitStruct->SPI_CPOLY));
+
+ /*---------------------------- SPIx CTRL1 Configuration ------------------------*/
+ /* Get the SPIx CTRL1 value */
+ tmpreg = SPIx->CTRL1;
+ /* Clear BIDIMode, BIDIOE, RxONLY, SSM, SSI, LSBFirst, BR, MSTR, CPOL and CPHA bits */
+ tmpreg &= CTRL1_CLEAR_MASK;
+ /* Configure SPIx: direction, NSS management, first transmitted bit, BaudRate prescaler
+ master/salve mode, CPOL and CPHA */
+ /* Set BIDImode, BIDIOE and RxONLY bits according to SPI_Direction value */
+ /* Set SSM, SSI and MSTR bits according to SPI_Mode and SPI_NSS values */
+ /* Set LSBFirst bit according to SPI_FirstBit value */
+ /* Set BR bits according to SPI_BaudRatePrescaler value */
+ /* Set CPOL bit according to SPI_CPOL value */
+ /* Set CPHA bit according to SPI_CPHA value */
+
+ if (SPI_InitStruct->SPI_MCLKP & SPI_MCLKP_OVER_256)
+ {
+ /* MCLKP is over 256 */
+ SPIx->CTRL2 |= SPI_CTRL2_MCLKP_3;
+ }
+ else
+ {
+ SPIx->CTRL2 &= ~SPI_CTRL2_MCLKP_3;
+ }
+
+ tmpreg |= (uint16_t)((uint32_t)SPI_InitStruct->SPI_TransMode | SPI_InitStruct->SPI_Mode |
+ SPI_InitStruct->SPI_FrameSize | SPI_InitStruct->SPI_CPOL |
+ SPI_InitStruct->SPI_CPHA | SPI_InitStruct->SPI_NSSSEL |
+ (SPI_InitStruct->SPI_MCLKP & 0x7FFF) | SPI_InitStruct->SPI_FirstBit);
+ /* Write to SPIx CTRL1 */
+ SPIx->CTRL1 = tmpreg;
+
+
+ /* Activate the SPI mode (Reset I2SMOD bit in I2SCFGR register) */
+ SPIx->I2SCTRL &= SPI_MODE_SEL;
+
+ /*---------------------------- SPIx CRCPOLY Configuration --------------------*/
+ /* Write to SPIx CRCPOLY */
+ SPIx->CPOLY = SPI_InitStruct->SPI_CPOLY;
+}
+
+/**
+ * @brief Initializes the SPIx peripheral according to the specified
+ * parameters in the I2S_InitStruct.
+ * @param SPIx: where x can be 2, 3, or 4 to select the SPI peripheral
+ * (configured in I2S mode).
+ * @param I2S_InitStruct: pointer to an I2S_InitType structure that
+ * contains the configuration information for the specified SPI peripheral
+ * configured in I2S mode.
+ * @note
+ * The function calculates the optimal prescaler needed to obtain the most
+ * accurate audio frequency (depending on the I2S clock source, the PLL values
+ * and the product configuration). But in case the prescaler value is greater
+ * than 511, the default value (0x02) will be configured instead. *
+ * @retval None
+ */
+void I2S_Init(SPI_Type* SPIx, I2S_InitType* I2S_InitStruct)
+{
+ uint16_t tmpreg = 0, i2sdiv = 2, i2sodd = 0, packetlength = 1;
+ uint32_t tmp = 0;
+ RCC_ClockType RCC_Clocks;
+ uint32_t sourceclock = 0;
+
+ /* Check the I2S parameters */
+ assert_param(IS_SPI_I2S_PERIPH(SPIx));
+ assert_param(IS_I2S_MODE(I2S_InitStruct->I2S_Mode));
+ assert_param(IS_I2S_AUDIOPROTOCOL(I2S_InitStruct->I2s_AudioProtocol));
+ assert_param(IS_I2S_FRAMEFORMAT(I2S_InitStruct->I2S_FrameFormat));
+ assert_param(IS_I2S_MCLKOE(I2S_InitStruct->I2S_MCLKOE));
+ assert_param(IS_I2S_AUDIO_FREQ(I2S_InitStruct->I2S_AudioFreq));
+ assert_param(IS_I2S_CPOL(I2S_InitStruct->I2S_CPOL));
+
+ /*----------------------- SPIx I2SCFGR & I2SPR Configuration -----------------*/
+ /* Clear I2SMOD, I2SE, I2SCFG, PCMSYNC, I2SSTD, CKPOL, DATLEN and CHLEN bits */
+ SPIx->I2SCTRL &= I2SCTRL_CLEAR_MASK;
+ SPIx->I2SCLKP = 0x0002;
+
+ /* Get the I2SCFGR register value */
+ tmpreg = SPIx->I2SCTRL;
+
+ /* If the default value has to be written, reinitialize i2sdiv and i2sodd*/
+ if(I2S_InitStruct->I2S_AudioFreq == I2S_AUDIOFREQ_DEFAULT)
+ {
+ i2sodd = (uint16_t)0;
+ i2sdiv = (uint16_t)2;
+ }
+ /* If the requested audio frequency is not the default, compute the prescaler */
+ else
+ {
+ /* Check the frame length (For the Prescaler computing) */
+ if(I2S_InitStruct->I2S_FrameFormat == I2S_FRAMEFORMAT_DL16BIT_CHL16BIT)
+ {
+ /* Packet length is 16 bits */
+ packetlength = 1;
+ }
+ else
+ {
+ /* Packet length is 32 bits */
+ packetlength = 2;
+ }
+
+ /* Get the I2S clock source mask depending on the peripheral number */
+ if(((uint32_t)SPIx) == SPI2_BASE)
+ {
+ /* The mask is relative to I2S2 */
+ tmp = I2S2_CLK_SRC;
+ }
+ else
+ {
+ /* The mask is relative to I2S3 */
+ tmp = I2S3_CLK_SRC;
+ }
+
+ /* Check the I2S clock source configuration depending on the Device */
+ /* I2S Clock source is System clock: Get System Clock frequency */
+ RCC_GetClocksFreq(&RCC_Clocks);
+
+ /* Get the source clock value: based on System Clock value */
+ sourceclock = RCC_Clocks.SYSCLK_Freq;
+
+ /* Compute the Real divider depending on the MCLK output state with a floating point */
+ if(I2S_InitStruct->I2S_MCLKOE == I2S_MCLKOE_ENABLE)
+ {
+ /* MCLK output is enabled */
+ tmp = (uint16_t)(((((sourceclock / 256) * 10) / I2S_InitStruct->I2S_AudioFreq)) + 5);
+ }
+ else
+ {
+ /* MCLK output is disabled */
+ tmp = (uint16_t)(((((sourceclock / (32 * packetlength)) * 10 ) / I2S_InitStruct->I2S_AudioFreq)) + 5);
+ }
+
+ /* Remove the floating point */
+ tmp = tmp / 10;
+
+ /* Check the parity of the divider */
+ i2sodd = (uint16_t)(tmp & (uint16_t)0x0001);
+
+ /* Compute the i2sdiv prescaler */
+ i2sdiv = (uint16_t)((tmp - i2sodd) / 2);
+
+ /* Get the Mask for the Odd bit (SPI_I2SPR[8]) register */
+ i2sodd = (uint16_t) (i2sodd << 8);
+ }
+
+ /* Test if the divider is 1 or 0 or greater than 0xFF */
+ if ((i2sdiv < 2) || (i2sdiv > I2S_DIV_VALUE_MAX))
+ {
+ /* Set the default values */
+ i2sdiv = 2;
+ i2sodd = 0;
+ }
+ else if (i2sdiv & I2S_DIV_EXT_VALUE_MASK)
+ {
+ /* Shift I2SDIV[9:8] to SPI_I2SCLKP[11:10] */
+ i2sdiv |= ((i2sdiv & I2S_DIV_EXT_VALUE_MASK) << I2S_DIV_EXT_VALUE_LSHIFT_OFFSET);
+ i2sdiv &= ~I2S_DIV_EXT_VALUE_MASK;
+ }
+
+ /* Write to SPIx I2SPR register the computed value */
+ SPIx->I2SCLKP = (uint16_t)(i2sdiv | (uint16_t)(i2sodd | (uint16_t)I2S_InitStruct->I2S_MCLKOE));
+
+ /* Configure the I2S with the SPI_InitStruct values */
+ tmpreg |= (uint16_t)(I2S_MODE_SEL | (uint16_t)(I2S_InitStruct->I2S_Mode | \
+ (uint16_t)(I2S_InitStruct->I2s_AudioProtocol | (uint16_t)(I2S_InitStruct->I2S_FrameFormat | \
+ (uint16_t)I2S_InitStruct->I2S_CPOL))));
+
+ /* Write to SPIx I2SCFGR */
+ SPIx->I2SCTRL = tmpreg;
+}
+
+/**
+ * @brief Fills each SPI_InitStruct member with its default value.
+ * @param SPI_InitStruct : pointer to a SPI_InitType structure which will be initialized.
+ * @retval None
+ */
+void SPI_DefaultInitParaConfig(SPI_InitType* SPI_InitStruct)
+{
+ /*--------------- Reset SPI init structure parameters values -----------------*/
+ /* Initialize the SPI_Direction member */
+ SPI_InitStruct->SPI_TransMode = SPI_TRANSMODE_FULLDUPLEX;
+ /* initialize the SPI_Mode member */
+ SPI_InitStruct->SPI_Mode = SPI_MODE_SLAVE;
+ /* initialize the SPI_DataSize member */
+ SPI_InitStruct->SPI_FrameSize = SPI_FRAMESIZE_8BIT;
+ /* Initialize the SPI_CPOL member */
+ SPI_InitStruct->SPI_CPOL = SPI_CPOL_LOW;
+ /* Initialize the SPI_CPHA member */
+ SPI_InitStruct->SPI_CPHA = SPI_CPHA_1EDGE;
+ /* Initialize the SPI_NSS member */
+ SPI_InitStruct->SPI_NSSSEL = SPI_NSSSEL_HARD;
+ /* Initialize the SPI_BaudRatePrescaler member */
+ SPI_InitStruct->SPI_MCLKP = SPI_MCLKP_2;
+ /* Initialize the SPI_FirstBit member */
+ SPI_InitStruct->SPI_FirstBit = SPI_FIRSTBIT_MSB;
+ /* Initialize the SPI_CRCPolynomial member */
+ SPI_InitStruct->SPI_CPOLY = 7;
+}
+
+/**
+ * @brief Fills each I2S_InitStruct member with its default value.
+ * @param I2S_InitStruct : pointer to a I2S_InitType structure which will be initialized.
+ * @retval None
+ */
+void I2S_DefaultInit(I2S_InitType* I2S_InitStruct)
+{
+ /*--------------- Reset I2S init structure parameters values -----------------*/
+ /* Initialize the I2S_Mode member */
+ I2S_InitStruct->I2S_Mode = I2S_MODE_SLAVETX;
+
+ /* Initialize the I2S_Standard member */
+ I2S_InitStruct->I2s_AudioProtocol = I2S_AUDIOPROTOCOL_PHILLIPS;
+
+ /* Initialize the I2S_DataFormat member */
+ I2S_InitStruct->I2S_FrameFormat = I2S_FRAMEFORMAT_DL16BIT_CHL16BIT;
+
+ /* Initialize the I2S_MCLKOutput member */
+ I2S_InitStruct->I2S_MCLKOE = I2S_MCLKOE_DISABLE;
+
+ /* Initialize the I2S_AudioFreq member */
+ I2S_InitStruct->I2S_AudioFreq = I2S_AUDIOFREQ_DEFAULT;
+
+ /* Initialize the I2S_CPOL member */
+ I2S_InitStruct->I2S_CPOL = I2S_CPOL_LOW;
+}
+
+/**
+ * @brief Enables or disables the specified SPI peripheral.
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @param NewState: new state of the SPIx peripheral.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SPI_Enable(SPI_Type* SPIx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected SPI peripheral */
+ SPIx->CTRL1 |= CTRL1_SPIEN_SET;
+ }
+ else
+ {
+ /* Disable the selected SPI peripheral */
+ SPIx->CTRL1 &= CTRL1_SPIEN_RESET;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified SPI peripheral (in I2S mode).
+ * @param SPIx: where x can be 2, 3, or 4 to select the SPI peripheral.
+ * @param NewState: new state of the SPIx peripheral.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void I2S_Enable(SPI_Type* SPIx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_I2S_PERIPH(SPIx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected SPI peripheral (in I2S mode) */
+ SPIx->I2SCTRL |= I2SCTRL_I2SEN_SET;
+ }
+ else
+ {
+ /* Disable the selected SPI peripheral (in I2S mode) */
+ SPIx->I2SCTRL &= I2SCTRL_I2SEN_RESET;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified SPI/I2S interrupts.
+ * @param SPIx: where x can be
+ * - 1, 2, 3, or 4 in SPI mode
+ * - 2, 3, or 4 in I2S mode
+ * @param SPI_I2S_INT: specifies the SPI/I2S interrupt source to be enabled or disabled.
+ * This parameter can be one of the following values:
+ * @arg SPI_I2S_INT_TE: Tx buffer empty interrupt mask
+ * @arg SPI_I2S_INT_RNE: Rx buffer not empty interrupt mask
+ * @arg SPI_I2S_INT_ERR: Error interrupt mask
+ * @param NewState: new state of the specified SPI/I2S interrupt.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SPI_I2S_INTConfig(SPI_Type* SPIx, uint8_t SPI_I2S_INT, FunctionalState NewState)
+{
+ uint16_t itpos = 0, itmask = 0 ;
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ assert_param(IS_SPI_I2S_CONFIG_INT(SPI_I2S_INT));
+
+ /* Get the SPI/I2S INT index */
+ itpos = SPI_I2S_INT >> 4;
+
+ /* Set the INT mask */
+ itmask = (uint16_t)1 << (uint16_t)itpos;
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected SPI/I2S interrupt */
+ SPIx->CTRL2 |= itmask;
+ }
+ else
+ {
+ /* Disable the selected SPI/I2S interrupt */
+ SPIx->CTRL2 &= (uint16_t)~itmask;
+ }
+}
+
+/**
+ * @brief Enables or disables the SPIx/I2Sx DMA interface.
+ * @param SPIx: where x can be
+ * - 1, 2, 3, or 4 in SPI mode
+ * - 2, 3, or 4 in I2S mode
+ * @param SPI_I2S_DMAReq: specifies the SPI/I2S DMA transfer request to be enabled or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg SPI_I2S_DMA_TX: Tx buffer DMA transfer request
+ * @arg SPI_I2S_DMA_RX: Rx buffer DMA transfer request
+ * @param NewState: new state of the selected SPI/I2S DMA transfer request.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SPI_I2S_DMAEnable(SPI_Type* SPIx, uint16_t SPI_I2S_DMAReq, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+ assert_param(IS_SPI_I2S_DMA(SPI_I2S_DMAReq));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected SPI/I2S DMA requests */
+ SPIx->CTRL2 |= SPI_I2S_DMAReq;
+ }
+ else
+ {
+ /* Disable the selected SPI/I2S DMA requests */
+ SPIx->CTRL2 &= (uint16_t)~SPI_I2S_DMAReq;
+ }
+}
+
+/**
+ * @brief Transmits a Data through the SPIx/I2Sx peripheral.
+ * @param SPIx: where x can be
+ * - 1, 2, 3, or 4 in SPI mode
+ * - 2, 3, or 4 in I2S mode
+ * @param Data : Data to be transmitted.
+ * @retval None
+ */
+void SPI_I2S_TxData(SPI_Type* SPIx, uint16_t Data)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+
+ /* Write in the DR register the data to be sent */
+ SPIx->DT = Data;
+}
+
+/**
+ * @brief Returns the most recent received data by the SPIx/I2Sx peripheral.
+ * @param SPIx: where x can be
+ * - 1, 2, 3, or 4 in SPI mode
+ * - 2, 3, or 4 in I2S mode
+ * @retval The value of the received data.
+ */
+uint16_t SPI_I2S_RxData(SPI_Type* SPIx)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+
+ /* Return the data in the DR register */
+ return SPIx->DT;
+}
+
+/**
+ * @brief Configures internally by software the NSS pin for the selected SPI.
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @param SPI_NSSInternalSoft: specifies the SPI NSS internal state.
+ * This parameter can be one of the following values:
+ * @arg SPI_ISS_SET: Set NSS pin internally
+ * @arg SPI_ISS_RESET: Reset NSS pin internally
+ * @retval None
+ */
+void SPI_NSSInternalSoftwareConfig(SPI_Type* SPIx, uint16_t SPI_NSSInternalSoft)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_SPI_ISS(SPI_NSSInternalSoft));
+
+ if (SPI_NSSInternalSoft != SPI_ISS_RESET)
+ {
+ /* Set NSS pin internally by software */
+ SPIx->CTRL1 |= SPI_ISS_SET;
+ }
+ else
+ {
+ /* Reset NSS pin internally by software */
+ SPIx->CTRL1 &= SPI_ISS_RESET;
+ }
+}
+
+/**
+ * @brief Enables or disables the SS output for the selected SPI.
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @param NewState: new state of the SPIx SS output.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SPI_NSSHardwareOutputEnable(SPI_Type* SPIx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected SPI SS output */
+ SPIx->CTRL2 |= CTRL2_NSSOE_SET;
+ }
+ else
+ {
+ /* Disable the selected SPI SS output */
+ SPIx->CTRL2 &= CTRL2_NSSOE_RESET;
+ }
+}
+
+/**
+ * @brief Configures the data size for the selected SPI.
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @param SPI_DataSize: specifies the SPI data size.
+ * This parameter can be one of the following values:
+ * @arg SPI_FRAMESIZE_16BIT: Set data frame format to 16bit
+ * @arg SPI_FRAMESIZE_8BIT: Set data frame format to 8bit
+ * @retval None
+ */
+void SPI_FrameSizeConfig(SPI_Type* SPIx, uint16_t SPI_DataSize)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_SPI_FRAMESIZE(SPI_DataSize));
+ /* Clear DFF bit */
+ SPIx->CTRL1 &= (uint16_t)~SPI_FRAMESIZE_16BIT;
+ /* Set new DFF bit value */
+ SPIx->CTRL1 |= SPI_DataSize;
+}
+
+/**
+ * @brief Transmit the SPIx CRC value.
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @retval None
+ */
+void SPI_TxCRC(SPI_Type* SPIx)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+
+ /* Enable the selected SPI CRC transmission */
+ SPIx->CTRL1 |= CTRL1_CTN_SET;
+}
+
+/**
+ * @brief Enables or disables the CRC value calculation of the transferred bytes.
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @param NewState: new state of the SPIx CRC value calculation.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void SPI_CRCEN(SPI_Type* SPIx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected SPI CRC calculation */
+ SPIx->CTRL1 |= CTRL1_CCE_SET;
+ }
+ else
+ {
+ /* Disable the selected SPI CRC calculation */
+ SPIx->CTRL1 &= CTRL1_CCE_RESET;
+ }
+}
+
+/**
+ * @brief Returns the transmit or the receive CRC register value for the specified SPI.
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @param SPI_CRC: specifies the CRC register to be read.
+ * This parameter can be one of the following values:
+ * @arg SPI_CRC_TX: Selects Tx CRC register
+ * @arg SPI_CRC_RX: Selects Rx CRC register
+ * @retval The selected CRC register value..
+ */
+uint16_t SPI_GetCRC(SPI_Type* SPIx, uint8_t SPI_CRC)
+{
+ uint16_t crcreg = 0;
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_SPI_CRC(SPI_CRC));
+
+ if (SPI_CRC != SPI_CRC_RX)
+ {
+ /* Get the Tx CRC register */
+ crcreg = SPIx->TCRC;
+ }
+ else
+ {
+ /* Get the Rx CRC register */
+ crcreg = SPIx->RCRC;
+ }
+
+ /* Return the selected CRC register */
+ return crcreg;
+}
+
+/**
+ * @brief Returns the CRC Polynomial register value for the specified SPI.
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @retval The CRC Polynomial register value.
+ */
+uint16_t SPI_GetCRCPolynomial(SPI_Type* SPIx)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+
+ /* Return the CRC polynomial register */
+ return SPIx->CPOLY;
+}
+
+/**
+ * @brief Selects the data transfer direction in bi-directional mode for the specified SPI.
+ * @param SPIx: where x can be 1, 2, 3 or 4 to select the SPI peripheral.
+ * @param SPI_Direction: specifies the data transfer direction in bi-directional mode.
+ * This parameter can be one of the following values:
+ * @arg SPI_HALFDUPLEX_TX: Selects Tx transmission direction
+ * @arg SPI_HALFDUPLEX_RX: Selects Rx receive direction
+ * @retval None
+ */
+void SPI_HalfDuplexTransModeConfig(SPI_Type* SPIx, uint16_t SPI_Direction)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_SPI_DIRECTION(SPI_Direction));
+
+ if (SPI_Direction == SPI_HALFDUPLEX_TX)
+ {
+ /* Set the Tx only mode */
+ SPIx->CTRL1 |= SPI_HALFDUPLEX_TX;
+ }
+ else
+ {
+ /* Set the Rx only mode */
+ SPIx->CTRL1 &= SPI_HALFDUPLEX_RX;
+ }
+}
+
+/**
+ * @brief Checks whether the specified SPI/I2S flag is set or not.
+ * @param SPIx: where x can be
+ * - 1, 2, 3, or 4 in SPI mode
+ * - 2, 3, or 4 in I2S mode
+ * @param SPI_I2S_FLAG: specifies the SPI/I2S flag to check.
+ * This parameter can be one of the following values:
+ * @arg SPI_I2S_FLAG_TE: Transmit buffer empty flag.
+ * @arg SPI_I2S_FLAG_RNE: Receive buffer not empty flag.
+ * @arg SPI_I2S_FLAG_BUSY: Busy flag.
+ * @arg SPI_I2S_FLAG_OVR: Overrun flag.
+ * @arg SPI_FLAG_MODF: Mode Fault flag.
+ * @arg SPI_FLAG_CERR: CRC Error flag.
+ * @arg I2S_FLAG_UDR: Underrun Error flag.
+ * @arg I2S_FLAG_CS: Channel Side flag.
+ * @retval The new state of SPI_I2S_FLAG (SET or RESET).
+ */
+FlagStatus SPI_I2S_GetFlagStatus(SPI_Type* SPIx, uint16_t SPI_I2S_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_SPI_I2S_GET_FLAG(SPI_I2S_FLAG));
+
+ /* Check the status of the specified SPI/I2S flag */
+ if ((SPIx->STS & SPI_I2S_FLAG) != (uint16_t)RESET)
+ {
+ /* SPI_I2S_FLAG is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* SPI_I2S_FLAG is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the SPI_I2S_FLAG status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the SPIx CRC Error (CRCERR) flag.
+ * @param SPIx: where x can be
+ * - 1, 2, 3, or 4 in SPI mode
+ * @param SPI_I2S_FLAG: specifies the SPI flag to clear.
+ * This function clears only CRCERR flag.
+ * @note
+ * - OVR (OverRun error) flag is cleared by software sequence: a read
+ * operation to SPI_DT register (SPI_I2S_RxData()) followed by a read
+ * operation to SPI_STS register (SPI_I2S_GetFlagStatus()).
+ * - UDR (UnderRun error) flag is cleared by a read operation to
+ * SPI_STS register (SPI_I2S_GetFlagStatus()).
+ * - MODF (Mode Fault) flag is cleared by software sequence: a read/write
+ * operation to SPI_STS register (SPI_I2S_GetFlagStatus()) followed by a
+ * write operation to SPI_CTRL1 register (SPI_Enable() to enable the SPI).
+ * @retval None
+ */
+void SPI_I2S_ClearFlag(SPI_Type* SPIx, uint16_t SPI_I2S_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_SPI_I2S_CLEAR_FLAG(SPI_I2S_FLAG));
+
+ /* Clear the selected SPI CRC Error (CRCERR) flag */
+ SPIx->STS = (uint16_t)~SPI_I2S_FLAG;
+}
+
+/**
+ * @brief Checks whether the specified SPI/I2S interrupt has occurred or not.
+ * @param SPIx: where x can be
+ * - 1, 2, 3, or 4 in SPI mode
+ * - 2, 3, or 4 in I2S mode
+ * @param SPI_I2S_INT: specifies the SPI/I2S interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg SPI_I2S_INT_TE: Transmit buffer empty interrupt.
+ * @arg SPI_I2S_INT_RNE: Receive buffer not empty interrupt.
+ * @arg SPI_I2S_INT_OVR: Overrun interrupt.
+ * @arg SPI_INT_MODF: Mode Fault interrupt.
+ * @arg SPI_INT_CERR: CRC Error interrupt.
+ * @arg I2S_INT_UDR: Underrun Error interrupt.
+ * @retval The new state of SPI_I2S_INT (SET or RESET).
+ */
+ITStatus SPI_I2S_GetITStatus(SPI_Type* SPIx, uint8_t SPI_I2S_INT)
+{
+ ITStatus bitstatus = RESET;
+ uint16_t itpos = 0, itmask = 0, enablestatus = 0;
+
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_SPI_I2S_GET_INT(SPI_I2S_INT));
+
+ /* Get the SPI/I2S INT index */
+ itpos = 0x01 << (SPI_I2S_INT & 0x0F);
+
+ /* Get the SPI/I2S INT mask */
+ itmask = SPI_I2S_INT >> 4;
+
+ /* Set the INT mask */
+ itmask = 0x01 << itmask;
+
+ /* Get the SPI_I2S_INT enable bit status */
+ enablestatus = (SPIx->CTRL2 & itmask) ;
+
+ /* Check the status of the specified SPI/I2S interrupt */
+ if (((SPIx->STS & itpos) != (uint16_t)RESET) && enablestatus)
+ {
+ /* SPI_I2S_INT is set */
+ bitstatus = SET;
+ }
+ else
+ {
+ /* SPI_I2S_INT is reset */
+ bitstatus = RESET;
+ }
+
+ /* Return the SPI_I2S_INT status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the SPIx CRC Error (CRCERR) interrupt pending bit.
+ * @param SPIx: where x can be
+ * - 1, 2, 3, or 4 in SPI mode
+ * @param SPI_I2S_INT: specifies the SPI interrupt pending bit to clear.
+ * This function clears only CRCERR interrupt pending bit.
+ * @note
+ * - OVR (OverRun Error) interrupt pending bit is cleared by software
+ * sequence: a read operation to SPI_DT register (SPI_I2S_RxData())
+ * followed by a read operation to SPI_STS register (SPI_I2S_GetITStatus()).
+ * - UDR (UnderRun Error) interrupt pending bit is cleared by a read
+ * operation to SPI_STS register (SPI_I2S_GetITStatus()).
+ * - MODF (Mode Fault) interrupt pending bit is cleared by software sequence:
+ * a read/write operation to SPI_STS register (SPI_I2S_GetITStatus())
+ * followed by a write operation to SPI_CTRL1 register (SPI_Enable() to enable
+ * the SPI).
+ * @retval None
+ */
+void SPI_I2S_ClearINTPendingBit(SPI_Type* SPIx, uint8_t SPI_I2S_INT)
+{
+ uint16_t itpos = 0;
+ /* Check the parameters */
+ assert_param(IS_SPI_ALL_PERIPH(SPIx));
+ assert_param(IS_SPI_I2S_CLEAR_INT(SPI_I2S_INT));
+
+ /* Get the SPI INT index */
+ itpos = 0x01 << (SPI_I2S_INT & 0x0F);
+
+ /* Clear the selected SPI CRC Error (CRCERR) interrupt pending bit */
+ SPIx->STS = (uint16_t)~itpos;
+}
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_tim.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_tim.c
new file mode 100644
index 0000000000000000000000000000000000000000..c4c7ea34136ff1aaaa8b7df7d9c7ead6c6c977f8
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_tim.c
@@ -0,0 +1,2997 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_tim.c
+ * Description : at32f4xx TTMER source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_tim.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup TMR
+ * @brief TMR driver modules
+ * @{
+ */
+
+/** @defgroup TMR_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Private_Defines
+ * @{
+ */
+
+/* ---------------------- TMR registers bit mask ------------------------ */
+#define SMC_ETR_Mask ((uint16_t)0x00FF)
+#define CCMR_Offset ((uint16_t)0x0018)
+#define CCE_CCE_Set ((uint16_t)0x0001)
+#define CCE_CCNE_Set ((uint16_t)0x0004)
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Private_FunctionPrototypes
+ * @{
+ */
+
+static void TI1_Config(TMR_Type* TMRx, uint16_t TMR_ICPolarity, uint16_t TMR_ICSelection,
+ uint16_t TMR_ICFilter);
+static void TI2_Config(TMR_Type* TMRx, uint16_t TMR_ICPolarity, uint16_t TMR_ICSelection,
+ uint16_t TMR_ICFilter);
+static void TI3_Config(TMR_Type* TMRx, uint16_t TMR_ICPolarity, uint16_t TMR_ICSelection,
+ uint16_t TMR_ICFilter);
+static void TI4_Config(TMR_Type* TMRx, uint16_t TMR_ICPolarity, uint16_t TMR_ICSelection,
+ uint16_t TMR_ICFilter);
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup TMR_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the TMRx peripheral registers to their default reset values.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @retval None
+ */
+void TMR_Reset(TMR_Type* TMRx)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+
+ if (TMRx == TMR1)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR1, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR1, DISABLE);
+ }
+ else if (TMRx == TMR2)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR2, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR2, DISABLE);
+ }
+ else if (TMRx == TMR3)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR3, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR3, DISABLE);
+ }
+ else if (TMRx == TMR4)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR4, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR4, DISABLE);
+ }
+ else if (TMRx == TMR5)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR5, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR5, DISABLE);
+ }
+#if defined (AT32F403xx)
+ else if (TMRx == TMR6)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR6, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR6, DISABLE);
+ }
+ else if (TMRx == TMR7)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR7, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR7, DISABLE);
+ }
+#endif
+#if defined (AT32F403xx) || defined (AT32F413xx)
+ else if (TMRx == TMR8)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR8, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR8, DISABLE);
+ }
+#endif
+ else if (TMRx == TMR9)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR9, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR9, DISABLE);
+ }
+ else if (TMRx == TMR10)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR10, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR10, DISABLE);
+ }
+ else if (TMRx == TMR11)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR11, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR11, DISABLE);
+ }
+#if defined (AT32F403xx)
+ else if (TMRx == TMR12)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR12, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR12, DISABLE);
+ }
+ else if (TMRx == TMR13)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR13, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR13, DISABLE);
+ }
+ else if (TMRx == TMR14)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR14, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_TMR14, DISABLE);
+ }
+ else if (TMRx == TMR15)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR15, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_TMR15, DISABLE);
+ }
+#endif
+}
+
+/**
+ * @brief Initializes the TMRx Time Base Unit peripheral according to
+ * the specified parameters in the TMR_TimeBaseInitStruct.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param TMR_TimeBaseInitStruct: pointer to a TMR_TimerBaseInitType
+ * structure that contains the configuration information for the
+ * specified TMR peripheral.
+ * @retval None
+ */
+void TMR_TimeBaseInit(TMR_Type* TMRx, TMR_TimerBaseInitType* TMR_TimeBaseInitStruct)
+{
+ uint16_t tmpcr1 = 0;
+
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_TMR_COUNTER_DIR(TMR_TimeBaseInitStruct->TMR_CounterMode));
+ assert_param(IS_TMR_CKD_DIV(TMR_TimeBaseInitStruct->TMR_ClockDivision));
+
+ tmpcr1 = TMRx->CTRL1;
+
+ if((TMRx == TMR1) || (TMRx == TMR2) ||
+#if !defined (AT32F415xx)
+ (TMRx == TMR8) ||
+#endif
+#if defined (AT32F403xx)
+ (TMRx == TMR15) ||
+#endif
+ (TMRx == TMR3) || (TMRx == TMR4) || (TMRx == TMR5))
+ {
+ /* Select the Counter Mode */
+ tmpcr1 &= (uint16_t)(~((uint16_t)(TMR_CTRL1_DIR | TMR_CTRL1_CMSEL)));
+ tmpcr1 |= (uint32_t)TMR_TimeBaseInitStruct->TMR_CounterMode;
+ }
+
+#ifdef AT32F403xx
+ if((TMRx != TMR6) && (TMRx != TMR7))
+ {
+ /* Set the clock division */
+ tmpcr1 &= (uint16_t)(~((uint16_t)TMR_CTRL1_CLKDIV));
+ tmpcr1 |= (uint32_t)TMR_TimeBaseInitStruct->TMR_ClockDivision;
+ }
+#endif
+
+ TMRx->CTRL1 = tmpcr1;
+
+ /* Set the Autoreload value */
+ TMRx->AR = TMR_TimeBaseInitStruct->TMR_Period ;
+
+ /* Set the Prescaler value */
+ TMRx->DIV = TMR_TimeBaseInitStruct->TMR_DIV;
+
+#ifdef AT32F415xx
+ if (TMRx == TMR1)
+#elif defined AT32F413xx
+ if ((TMRx == TMR1) || (TMRx == TMR8))
+#elif defined AT32F403xx
+ if ((TMRx == TMR1) || (TMRx == TMR8) || (TMRx == TMR15))
+#endif
+ {
+ /* Set the Repetition Counter value */
+ TMRx->RC = TMR_TimeBaseInitStruct->TMR_RepetitionCounter;
+ }
+
+ /* Generate an update event to reload the Prescaler and the Repetition counter
+ values immediately */
+ TMRx->EVEG = TMR_DIVReloadMode_Immediate;
+}
+
+/**
+ * @brief Initializes the TIMx Plus Mode according to the specified
+ * parameters.
+ * @param TIMx: where x can be 2 or 5 to select the TIM peripheral.
+ * @param TIMx_PLUS_MODE_STATE: eable or disable the plus mode
+ * @ex TMR_Plus_Mode_Enable
+ * TMR_Plus_Mode_Disable
+ * @retval None
+ */
+void TMR_SelectPlusMode(TMR_Type* TMRx, uint16_t TMRx_PLUS_MODE_STATE)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_PLUSMODE_PERIPH(TMRx));
+ assert_param(IS_TMR_PLUS_MODE_STATE(TMRx_PLUS_MODE_STATE));
+ /*Config TIMx plus mode*/
+ if((TMRx == TMR2) || (TMRx == TMR5))
+ {
+ /*Enable*/
+ if(TMRx_PLUS_MODE_STATE)
+ {
+ TMRx->CTRL1 &= (uint16_t)(~((uint16_t)TMR_Plus_Mode_Enable));
+ TMRx->CTRL1 |= TMRx_PLUS_MODE_STATE;
+ }
+ /*Disable*/
+ else
+ {
+ TMRx->CTRL1 &= (uint16_t)(~((uint16_t)TMR_Plus_Mode_Enable));
+ TMRx->CTRL1 |= TMRx_PLUS_MODE_STATE;
+ }
+ }
+}
+
+
+
+/**
+ * @brief Initializes the TMRx Channel1 according to the specified
+ * parameters in the TMR_OCInitStruct.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param TMR_OCInitStruct: pointer to a TMR_OCInitType structure
+ * that contains the configuration information for the specified TMR peripheral.
+ * @retval None
+ */
+void TMR_OC1Init(TMR_Type* TMRx, TMR_OCInitType* TMR_OCInitStruct)
+{
+ uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
+
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ assert_param(IS_TMR_OC_MODE(TMR_OCInitStruct->TMR_OCMode));
+ assert_param(IS_TMR_OUTPUT_STATE(TMR_OCInitStruct->TMR_OutputState));
+ assert_param(IS_TMR_OC_POLARITY(TMR_OCInitStruct->TMR_OCPolarity));
+ /* Disable the Channel 1: Reset the CC1E Bit */
+ TMRx->CCE &= (uint16_t)(~(uint16_t)TMR_CCE_C1EN);
+ /* Get the TMRx CCE register value */
+ tmpccer = TMRx->CCE;
+ /* Get the TMRx CR2 register value */
+ tmpcr2 = TMRx->CTRL2;
+
+ /* Get the TMRx CCMR1 register value */
+ tmpccmrx = TMRx->CCM1;
+
+ /* Reset the Output Compare Mode Bits */
+ tmpccmrx &= (uint16_t)(~((uint16_t)TMR_CCM1_OC1MODE));
+ tmpccmrx &= (uint16_t)(~((uint16_t)TMR_CCM1_C1SEL));
+
+ /* Select the Output Compare Mode */
+ tmpccmrx |= TMR_OCInitStruct->TMR_OCMode;
+
+ /* Reset the Output Polarity level */
+ tmpccer &= (uint16_t)(~((uint16_t)TMR_CCE_C1P));
+ /* Set the Output Compare Polarity */
+ tmpccer |= TMR_OCInitStruct->TMR_OCPolarity;
+
+ /* Set the Output State */
+ tmpccer |= TMR_OCInitStruct->TMR_OutputState;
+
+#ifdef AT32F415xx
+ if (TMRx == TMR1)
+#elif defined AT32F413xx
+ if ((TMRx == TMR1) || (TMRx == TMR8))
+#elif defined AT32F403xx
+ if ((TMRx == TMR1) || (TMRx == TMR8) || (TMRx == TMR15))
+#endif
+ {
+ assert_param(IS_TMR_OUTPUTN_STATE(TMR_OCInitStruct->TMR_OutputNState));
+ assert_param(IS_TMR_OCN_POLARITY(TMR_OCInitStruct->TMR_OCNPolarity));
+ assert_param(IS_TMR_OCNIDLE_STATE(TMR_OCInitStruct->TMR_OCNIdleState));
+ assert_param(IS_TMR_OCIDLE_STATE(TMR_OCInitStruct->TMR_OCIdleState));
+
+ /* Reset the Output N Polarity level */
+ tmpccer &= (uint16_t)(~((uint16_t)TMR_CCE_C1NP));
+ /* Set the Output N Polarity */
+ tmpccer |= TMR_OCInitStruct->TMR_OCNPolarity;
+
+ /* Reset the Output N State */
+ tmpccer &= (uint16_t)(~((uint16_t)TMR_CCE_C1NEN));
+ /* Set the Output N State */
+ tmpccer |= TMR_OCInitStruct->TMR_OutputNState;
+
+ /* Reset the Output Compare and Output Compare N IDLE State */
+ tmpcr2 &= (uint16_t)(~((uint16_t)TMR_CTRL2_OC1IS));
+ tmpcr2 &= (uint16_t)(~((uint16_t)TMR_CTRL2_OC1NIS));
+
+ /* Set the Output Idle state */
+ tmpcr2 |= TMR_OCInitStruct->TMR_OCIdleState;
+ /* Set the Output N Idle state */
+ tmpcr2 |= TMR_OCInitStruct->TMR_OCNIdleState;
+ }
+
+ /* Write to TMRx CR2 */
+ TMRx->CTRL2 = tmpcr2;
+
+ /* Write to TMRx CCMR1 */
+ TMRx->CCM1 = tmpccmrx;
+
+ /* Set the Capture Compare Register value */
+ TMRx->CC1 = TMR_OCInitStruct->TMR_Pulse;
+
+ /* Write to TMRx CCE */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Initializes the TMRx Channel2 according to the specified
+ * parameters in the TMR_OCInitStruct.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select
+ * the TMR peripheral.
+ * @param TMR_OCInitStruct: pointer to a TMR_OCInitType structure
+ * that contains the configuration information for the specified TMR peripheral.
+ * @retval None
+ */
+void TMR_OC2Init(TMR_Type* TMRx, TMR_OCInitType* TMR_OCInitStruct)
+{
+ uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
+
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_OC_MODE(TMR_OCInitStruct->TMR_OCMode));
+ assert_param(IS_TMR_OUTPUT_STATE(TMR_OCInitStruct->TMR_OutputState));
+ assert_param(IS_TMR_OC_POLARITY(TMR_OCInitStruct->TMR_OCPolarity));
+ /* Disable the Channel 2: Reset the CC2E Bit */
+ TMRx->CCE &= (uint16_t)(~((uint16_t)TMR_CCE_C2EN));
+
+ /* Get the TMRx CCE register value */
+ tmpccer = TMRx->CCE;
+ /* Get the TMRx CR2 register value */
+ tmpcr2 = TMRx->CTRL2;
+
+ /* Get the TMRx CCMR1 register value */
+ tmpccmrx = TMRx->CCM1;
+
+ /* Reset the Output Compare mode and Capture/Compare selection Bits */
+ tmpccmrx &= (uint16_t)(~((uint16_t)TMR_CCM1_OC2MODE));
+ tmpccmrx &= (uint16_t)(~((uint16_t)TMR_CCM1_C2SEL));
+
+ /* Select the Output Compare Mode */
+ tmpccmrx |= (uint16_t)(TMR_OCInitStruct->TMR_OCMode << 8);
+
+ /* Reset the Output Polarity level */
+ tmpccer &= (uint16_t)(~((uint16_t)TMR_CCE_C2P));
+ /* Set the Output Compare Polarity */
+ tmpccer |= (uint16_t)(TMR_OCInitStruct->TMR_OCPolarity << 4);
+
+ /* Set the Output State */
+ tmpccer |= (uint16_t)(TMR_OCInitStruct->TMR_OutputState << 4);
+
+#ifdef AT32F415xx
+ if (TMRx == TMR1)
+#elif defined AT32F413xx
+ if ((TMRx == TMR1) || (TMRx == TMR8))
+#elif defined AT32F403xx
+ if ((TMRx == TMR1) || (TMRx == TMR8) || (TMRx == TMR15))
+#endif
+ {
+ assert_param(IS_TMR_OUTPUTN_STATE(TMR_OCInitStruct->TMR_OutputNState));
+ assert_param(IS_TMR_OCN_POLARITY(TMR_OCInitStruct->TMR_OCNPolarity));
+ assert_param(IS_TMR_OCNIDLE_STATE(TMR_OCInitStruct->TMR_OCNIdleState));
+ assert_param(IS_TMR_OCIDLE_STATE(TMR_OCInitStruct->TMR_OCIdleState));
+
+ /* Reset the Output N Polarity level */
+ tmpccer &= (uint16_t)(~((uint16_t)TMR_CCE_C2NP));
+ /* Set the Output N Polarity */
+ tmpccer |= (uint16_t)(TMR_OCInitStruct->TMR_OCNPolarity << 4);
+
+ /* Reset the Output N State */
+ tmpccer &= (uint16_t)(~((uint16_t)TMR_CCE_C2NEN));
+ /* Set the Output N State */
+ tmpccer |= (uint16_t)(TMR_OCInitStruct->TMR_OutputNState << 4);
+
+ /* Reset the Output Compare and Output Compare N IDLE State */
+ tmpcr2 &= (uint16_t)(~((uint16_t)TMR_CTRL2_OC2IS));
+ tmpcr2 &= (uint16_t)(~((uint16_t)TMR_CTRL2_OC2NIS));
+
+ /* Set the Output Idle state */
+ tmpcr2 |= (uint16_t)(TMR_OCInitStruct->TMR_OCIdleState << 2);
+ /* Set the Output N Idle state */
+ tmpcr2 |= (uint16_t)(TMR_OCInitStruct->TMR_OCNIdleState << 2);
+ }
+
+ /* Write to TMRx CR2 */
+ TMRx->CTRL2 = tmpcr2;
+
+ /* Write to TMRx CCMR1 */
+ TMRx->CCM1 = tmpccmrx;
+
+ /* Set the Capture Compare Register value */
+ TMRx->CC2 = TMR_OCInitStruct->TMR_Pulse;
+
+ /* Write to TMRx CCE */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Initializes the TMRx Channel3 according to the specified
+ * parameters in the TMR_OCInitStruct.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCInitStruct: pointer to a TMR_OCInitType structure
+ * that contains the configuration information for the specified TMR peripheral.
+ * @retval None
+ */
+void TMR_OC3Init(TMR_Type* TMRx, TMR_OCInitType* TMR_OCInitStruct)
+{
+ uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
+
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OC_MODE(TMR_OCInitStruct->TMR_OCMode));
+ assert_param(IS_TMR_OUTPUT_STATE(TMR_OCInitStruct->TMR_OutputState));
+ assert_param(IS_TMR_OC_POLARITY(TMR_OCInitStruct->TMR_OCPolarity));
+ /* Disable the Channel 2: Reset the CC2E Bit */
+ TMRx->CCE &= (uint16_t)(~((uint16_t)TMR_CCE_C3EN));
+
+ /* Get the TMRx CCE register value */
+ tmpccer = TMRx->CCE;
+ /* Get the TMRx CR2 register value */
+ tmpcr2 = TMRx->CTRL2;
+
+ /* Get the TMRx CCMR2 register value */
+ tmpccmrx = TMRx->CCM2;
+
+ /* Reset the Output Compare mode and Capture/Compare selection Bits */
+ tmpccmrx &= (uint16_t)(~((uint16_t)TMR_CCM2_OC3MODE));
+ tmpccmrx &= (uint16_t)(~((uint16_t)TMR_CCM2_C3SEL));
+ /* Select the Output Compare Mode */
+ tmpccmrx |= TMR_OCInitStruct->TMR_OCMode;
+
+ /* Reset the Output Polarity level */
+ tmpccer &= (uint16_t)(~((uint16_t)TMR_CCE_C3P));
+ /* Set the Output Compare Polarity */
+ tmpccer |= (uint16_t)(TMR_OCInitStruct->TMR_OCPolarity << 8);
+
+ /* Set the Output State */
+ tmpccer |= (uint16_t)(TMR_OCInitStruct->TMR_OutputState << 8);
+
+#ifdef AT32F415xx
+ if (TMRx == TMR1)
+#elif defined AT32F413xx
+ if ((TMRx == TMR1) || (TMRx == TMR8))
+#elif defined AT32F403xx
+ if ((TMRx == TMR1) || (TMRx == TMR8) || (TMRx == TMR15))
+#endif
+ {
+ assert_param(IS_TMR_OUTPUTN_STATE(TMR_OCInitStruct->TMR_OutputNState));
+ assert_param(IS_TMR_OCN_POLARITY(TMR_OCInitStruct->TMR_OCNPolarity));
+ assert_param(IS_TMR_OCNIDLE_STATE(TMR_OCInitStruct->TMR_OCNIdleState));
+ assert_param(IS_TMR_OCIDLE_STATE(TMR_OCInitStruct->TMR_OCIdleState));
+
+ /* Reset the Output N Polarity level */
+ tmpccer &= (uint16_t)(~((uint16_t)TMR_CCE_C3NP));
+ /* Set the Output N Polarity */
+ tmpccer |= (uint16_t)(TMR_OCInitStruct->TMR_OCNPolarity << 8);
+ /* Reset the Output N State */
+ tmpccer &= (uint16_t)(~((uint16_t)TMR_CCE_C3NEN));
+
+ /* Set the Output N State */
+ tmpccer |= (uint16_t)(TMR_OCInitStruct->TMR_OutputNState << 8);
+ /* Reset the Output Compare and Output Compare N IDLE State */
+ tmpcr2 &= (uint16_t)(~((uint16_t)TMR_CTRL2_OC3IS));
+ tmpcr2 &= (uint16_t)(~((uint16_t)TMR_CTRL2_OC3NIS));
+ /* Set the Output Idle state */
+ tmpcr2 |= (uint16_t)(TMR_OCInitStruct->TMR_OCIdleState << 4);
+ /* Set the Output N Idle state */
+ tmpcr2 |= (uint16_t)(TMR_OCInitStruct->TMR_OCNIdleState << 4);
+ }
+
+ /* Write to TMRx CR2 */
+ TMRx->CTRL2 = tmpcr2;
+
+ /* Write to TMRx CCMR2 */
+ TMRx->CCM2 = tmpccmrx;
+
+ /* Set the Capture Compare Register value */
+ TMRx->CC3 = TMR_OCInitStruct->TMR_Pulse;
+
+ /* Write to TMRx CCE */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Initializes the TMRx Channel4 according to the specified
+ * parameters in the TMR_OCInitStruct.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCInitStruct: pointer to a TMR_OCInitType structure
+ * that contains the configuration information for the specified TMR peripheral.
+ * @retval None
+ */
+void TMR_OC4Init(TMR_Type* TMRx, TMR_OCInitType* TMR_OCInitStruct)
+{
+ uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
+
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OC_MODE(TMR_OCInitStruct->TMR_OCMode));
+ assert_param(IS_TMR_OUTPUT_STATE(TMR_OCInitStruct->TMR_OutputState));
+ assert_param(IS_TMR_OC_POLARITY(TMR_OCInitStruct->TMR_OCPolarity));
+ /* Disable the Channel 2: Reset the CC4E Bit */
+ TMRx->CCE &= (uint16_t)(~((uint16_t)TMR_CCE_C4EN));
+
+ /* Get the TMRx CCE register value */
+ tmpccer = TMRx->CCE;
+ /* Get the TMRx CR2 register value */
+ tmpcr2 = TMRx->CTRL2;
+
+ /* Get the TMRx CCMR2 register value */
+ tmpccmrx = TMRx->CCM2;
+
+ /* Reset the Output Compare mode and Capture/Compare selection Bits */
+ tmpccmrx &= (uint16_t)(~((uint16_t)TMR_CCM2_OC4MODE));
+ tmpccmrx &= (uint16_t)(~((uint16_t)TMR_CCM2_CC4S));
+
+ /* Select the Output Compare Mode */
+ tmpccmrx |= (uint16_t)(TMR_OCInitStruct->TMR_OCMode << 8);
+
+ /* Reset the Output Polarity level */
+ tmpccer &= (uint16_t)(~((uint16_t)TMR_CCE_C4P));
+ /* Set the Output Compare Polarity */
+ tmpccer |= (uint16_t)(TMR_OCInitStruct->TMR_OCPolarity << 12);
+
+ /* Set the Output State */
+ tmpccer |= (uint16_t)(TMR_OCInitStruct->TMR_OutputState << 12);
+
+#ifdef AT32F415xx
+ if (TMRx == TMR1)
+#elif defined AT32F413xx
+ if ((TMRx == TMR1) || (TMRx == TMR8))
+#elif defined AT32F403xx
+ if ((TMRx == TMR1) || (TMRx == TMR8) || (TMRx == TMR15))
+#endif
+ {
+ assert_param(IS_TMR_OCIDLE_STATE(TMR_OCInitStruct->TMR_OCIdleState));
+ /* Reset the Output Compare IDLE State */
+ tmpcr2 &= (uint16_t)(~((uint16_t)TMR_CTRL2_OC4IS));
+ /* Set the Output Idle state */
+ tmpcr2 |= (uint16_t)(TMR_OCInitStruct->TMR_OCIdleState << 6);
+ }
+
+ /* Write to TMRx CR2 */
+ TMRx->CTRL2 = tmpcr2;
+
+ /* Write to TMRx CCMR2 */
+ TMRx->CCM2 = tmpccmrx;
+
+ /* Set the Capture Compare Register value */
+ TMRx->CC4 = TMR_OCInitStruct->TMR_Pulse;
+
+ /* Write to TMRx CCE */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Initializes the TMR peripheral according to the specified
+ * parameters in the TMR_ICInitStruct.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param TMR_ICInitStruct: pointer to a TMR_ICInitType structure
+ * that contains the configuration information for the specified TMR peripheral.
+ * @retval None
+ */
+void TMR_ICInit(TMR_Type* TMRx, TMR_ICInitType* TMR_ICInitStruct)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_CHANNEL(TMR_ICInitStruct->TMR_Channel));
+ assert_param(IS_TMR_IC_SELECTION(TMR_ICInitStruct->TMR_ICSelection));
+ assert_param(IS_TMR_IC_DIV(TMR_ICInitStruct->TMR_ICDIV));
+ assert_param(IS_TMR_IC_FILTER(TMR_ICInitStruct->TMR_ICFilter));
+
+ if((TMRx == TMR1) || (TMRx == TMR2) ||
+#if !defined (AT32F415xx)
+ (TMRx == TMR8) ||
+#endif
+#if defined (AT32F403xx)
+ (TMRx == TMR15) ||
+#endif
+
+ (TMRx == TMR3) || (TMRx == TMR4) || (TMRx == TMR5))
+ {
+ assert_param(IS_TMR_IC_POLARITY(TMR_ICInitStruct->TMR_ICPolarity));
+ }
+ else
+ {
+ assert_param(IS_TMR_IC_POLARITY_LITE(TMR_ICInitStruct->TMR_ICPolarity));
+ }
+
+ if (TMR_ICInitStruct->TMR_Channel == TMR_Channel_1)
+ {
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ /* TI1 Configuration */
+ TI1_Config(TMRx, TMR_ICInitStruct->TMR_ICPolarity,
+ TMR_ICInitStruct->TMR_ICSelection,
+ TMR_ICInitStruct->TMR_ICFilter);
+ /* Set the Input Capture Prescaler value */
+ TMR_SetIC1DIV(TMRx, TMR_ICInitStruct->TMR_ICDIV);
+ }
+ else if (TMR_ICInitStruct->TMR_Channel == TMR_Channel_2)
+ {
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ /* TI2 Configuration */
+ TI2_Config(TMRx, TMR_ICInitStruct->TMR_ICPolarity,
+ TMR_ICInitStruct->TMR_ICSelection,
+ TMR_ICInitStruct->TMR_ICFilter);
+ /* Set the Input Capture Prescaler value */
+ TMR_SetIC2DIV(TMRx, TMR_ICInitStruct->TMR_ICDIV);
+ }
+ else if (TMR_ICInitStruct->TMR_Channel == TMR_Channel_3)
+ {
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ /* TI3 Configuration */
+ TI3_Config(TMRx, TMR_ICInitStruct->TMR_ICPolarity,
+ TMR_ICInitStruct->TMR_ICSelection,
+ TMR_ICInitStruct->TMR_ICFilter);
+ /* Set the Input Capture Prescaler value */
+ TMR_SetIC3DIV(TMRx, TMR_ICInitStruct->TMR_ICDIV);
+ }
+ else
+ {
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ /* TI4 Configuration */
+ TI4_Config(TMRx, TMR_ICInitStruct->TMR_ICPolarity,
+ TMR_ICInitStruct->TMR_ICSelection,
+ TMR_ICInitStruct->TMR_ICFilter);
+ /* Set the Input Capture Prescaler value */
+ TMR_SetIC4DIV(TMRx, TMR_ICInitStruct->TMR_ICDIV);
+ }
+}
+
+/**
+ * @brief Configures the TMR peripheral according to the specified
+ * parameters in the TMR_ICInitStruct to measure an external PWM signal.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_ICInitStruct: pointer to a TMR_ICInitType structure
+ * that contains the configuration information for the specified TMR peripheral.
+ * @retval None
+ */
+void TMR_PWMIConfig(TMR_Type* TMRx, TMR_ICInitType* TMR_ICInitStruct)
+{
+ uint16_t icoppositepolarity = TMR_ICPolarity_Rising;
+ uint16_t icoppositeselection = TMR_ICSelection_DirectTI;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+
+ /* Select the Opposite Input Polarity */
+ if (TMR_ICInitStruct->TMR_ICPolarity == TMR_ICPolarity_Rising)
+ {
+ icoppositepolarity = TMR_ICPolarity_Falling;
+ }
+ else
+ {
+ icoppositepolarity = TMR_ICPolarity_Rising;
+ }
+
+ /* Select the Opposite Input */
+ if (TMR_ICInitStruct->TMR_ICSelection == TMR_ICSelection_DirectTI)
+ {
+ icoppositeselection = TMR_ICSelection_IndirectTI;
+ }
+ else
+ {
+ icoppositeselection = TMR_ICSelection_DirectTI;
+ }
+
+ if (TMR_ICInitStruct->TMR_Channel == TMR_Channel_1)
+ {
+ /* TI1 Configuration */
+ TI1_Config(TMRx, TMR_ICInitStruct->TMR_ICPolarity, TMR_ICInitStruct->TMR_ICSelection,
+ TMR_ICInitStruct->TMR_ICFilter);
+ /* Set the Input Capture Prescaler value */
+ TMR_SetIC1DIV(TMRx, TMR_ICInitStruct->TMR_ICDIV);
+ /* TI2 Configuration */
+ TI2_Config(TMRx, icoppositepolarity, icoppositeselection, TMR_ICInitStruct->TMR_ICFilter);
+ /* Set the Input Capture Prescaler value */
+ TMR_SetIC2DIV(TMRx, TMR_ICInitStruct->TMR_ICDIV);
+ }
+ else
+ {
+ /* TI2 Configuration */
+ TI2_Config(TMRx, TMR_ICInitStruct->TMR_ICPolarity, TMR_ICInitStruct->TMR_ICSelection,
+ TMR_ICInitStruct->TMR_ICFilter);
+ /* Set the Input Capture Prescaler value */
+ TMR_SetIC2DIV(TMRx, TMR_ICInitStruct->TMR_ICDIV);
+ /* TI1 Configuration */
+ TI1_Config(TMRx, icoppositepolarity, icoppositeselection, TMR_ICInitStruct->TMR_ICFilter);
+ /* Set the Input Capture Prescaler value */
+ TMR_SetIC1DIV(TMRx, TMR_ICInitStruct->TMR_ICDIV);
+ }
+}
+
+/**
+ * @brief Configures the: Break feature, dead time, Lock level, the OSSI,
+ * the OSSR State and the AOE(automatic output enable).
+ * @param TMRx: where x can be 1 or 8 to select the TMR
+ * @param TMR_BDTRInitStruct: pointer to a TMR_BRKDTInitType structure that
+ * contains the BDTR Register configuration information for the TMR peripheral.
+ * @retval None
+ */
+void TMR_BRKDTConfig(TMR_Type* TMRx, TMR_BRKDTInitType *TMR_BDTRInitStruct)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST2_PERIPH(TMRx));
+ assert_param(IS_TMR_OSIMR_STATE(TMR_BDTRInitStruct->TMR_OSIMRState));
+ assert_param(IS_TMR_OSIMI_STATE(TMR_BDTRInitStruct->TMR_OSIMIState));
+ assert_param(IS_TMR_LOCK_grade(TMR_BDTRInitStruct->TMR_LOCKgrade));
+ assert_param(IS_TMR_BREAK_STATE(TMR_BDTRInitStruct->TMR_Break));
+ assert_param(IS_TMR_BREAK_POLARITY(TMR_BDTRInitStruct->TMR_BreakPolarity));
+ assert_param(IS_TMR_AUTOMATIC_OUTPUT_STATE(TMR_BDTRInitStruct->TMR_AutomaticOutput));
+ /* Set the Lock level, the Break enable Bit and the Ploarity, the OSSR State,
+ the OSSI State, the dead time value and the Automatic Output Enable Bit */
+ TMRx->BRKDT = (uint32_t)TMR_BDTRInitStruct->TMR_OSIMRState | TMR_BDTRInitStruct->TMR_OSIMIState |
+ TMR_BDTRInitStruct->TMR_LOCKgrade | TMR_BDTRInitStruct->TMR_DeadTime |
+ TMR_BDTRInitStruct->TMR_Break | TMR_BDTRInitStruct->TMR_BreakPolarity |
+ TMR_BDTRInitStruct->TMR_AutomaticOutput;
+}
+
+/**
+ * @brief Fills each TMR_TimeBaseInitStruct member with its default value.
+ * @param TMR_TimeBaseInitStruct : pointer to a TMR_TimerBaseInitType
+ * structure which will be initialized.
+ * @retval None
+ */
+void TMR_TimeBaseStructInit(TMR_TimerBaseInitType* TMR_TimeBaseInitStruct)
+{
+ /* Set the default configuration */
+ TMR_TimeBaseInitStruct->TMR_Period = 0xFFFF;
+ TMR_TimeBaseInitStruct->TMR_DIV = 0x0000;
+ TMR_TimeBaseInitStruct->TMR_ClockDivision = TMR_CKD_DIV1;
+ TMR_TimeBaseInitStruct->TMR_CounterMode = TMR_CounterDIR_Up;
+ TMR_TimeBaseInitStruct->TMR_RepetitionCounter = 0x0000;
+}
+
+/**
+ * @brief Fills each TMR_OCInitStruct member with its default value.
+ * @param TMR_OCInitStruct : pointer to a TMR_OCInitType structure which will
+ * be initialized.
+ * @retval None
+ */
+void TMR_OCStructInit(TMR_OCInitType* TMR_OCInitStruct)
+{
+ /* Set the default configuration */
+ TMR_OCInitStruct->TMR_OCMode = TMR_OCMode_Timing;
+ TMR_OCInitStruct->TMR_OutputState = TMR_OutputState_Disable;
+ TMR_OCInitStruct->TMR_OutputNState = TMR_OutputNState_Disable;
+ TMR_OCInitStruct->TMR_Pulse = 0x0000;
+ TMR_OCInitStruct->TMR_OCPolarity = TMR_OCPolarity_High;
+ TMR_OCInitStruct->TMR_OCNPolarity = TMR_OCPolarity_High;
+ TMR_OCInitStruct->TMR_OCIdleState = TMR_OCIdleState_Reset;
+ TMR_OCInitStruct->TMR_OCNIdleState = TMR_OCNIdleState_Reset;
+}
+
+/**
+ * @brief Fills each TMR_ICInitStruct member with its default value.
+ * @param TMR_ICInitStruct: pointer to a TMR_ICInitType structure which will
+ * be initialized.
+ * @retval None
+ */
+void TMR_ICStructInit(TMR_ICInitType* TMR_ICInitStruct)
+{
+ /* Set the default configuration */
+ TMR_ICInitStruct->TMR_Channel = TMR_Channel_1;
+ TMR_ICInitStruct->TMR_ICPolarity = TMR_ICPolarity_Rising;
+ TMR_ICInitStruct->TMR_ICSelection = TMR_ICSelection_DirectTI;
+ TMR_ICInitStruct->TMR_ICDIV = TMR_ICDIV_DIV1;
+ TMR_ICInitStruct->TMR_ICFilter = 0x00;
+}
+
+/**
+ * @brief Fills each TMR_BDTRInitStruct member with its default value.
+ * @param TMR_BDTRInitStruct: pointer to a TMR_BRKDTInitType structure which
+ * will be initialized.
+ * @retval None
+ */
+void TMR_BRKDTStructInit(TMR_BRKDTInitType* TMR_BDTRInitStruct)
+{
+ /* Set the default configuration */
+ TMR_BDTRInitStruct->TMR_OSIMRState = TMR_OSIMRState_Disable;
+ TMR_BDTRInitStruct->TMR_OSIMIState = TMR_OSIMIState_Disable;
+ TMR_BDTRInitStruct->TMR_LOCKgrade = TMR_LOCKgrade_OFF;
+ TMR_BDTRInitStruct->TMR_DeadTime = 0x00;
+ TMR_BDTRInitStruct->TMR_Break = TMR_Break_Disable;
+ TMR_BDTRInitStruct->TMR_BreakPolarity = TMR_BreakPolarity_Low;
+ TMR_BDTRInitStruct->TMR_AutomaticOutput = TMR_AutomaticOutput_Disable;
+}
+
+/**
+ * @brief Enables or disables the specified TMR peripheral.
+ * @param TMRx: where x can be 1 to 15 to select the TMRx peripheral.
+ * @param NewState: new state of the TMRx peripheral.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void TMR_Cmd(TMR_Type* TMRx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the TMR Counter */
+ TMRx->CTRL1 |= TMR_CTRL1_CNTEN;
+ }
+ else
+ {
+ /* Disable the TMR Counter */
+ TMRx->CTRL1 &= (uint16_t)(~((uint16_t)TMR_CTRL1_CNTEN));
+ }
+}
+
+/**
+ * @brief Enables or disables the TMR peripheral Main Outputs.
+ * @param TMRx: where x can be 1, 8, 15 to select the TMRx peripheral.
+ * @param NewState: new state of the TMR peripheral Main Outputs.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void TMR_CtrlPWMOutputs(TMR_Type* TMRx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST2_PERIPH(TMRx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the TMR Main Output */
+ TMRx->BRKDT |= TMR_BRKDT_MOEN;
+ }
+ else
+ {
+ /* Disable the TMR Main Output */
+ TMRx->BRKDT &= (uint16_t)(~((uint16_t)TMR_BRKDT_MOEN));
+ }
+}
+
+/**
+ * @brief Enables or disables the specified TMR interrupts.
+ * @param TMRx: where x can be 1 to 15 to select the TMRx peripheral.
+ * @param TMR_INT: specifies the TMR interrupts sources to be enabled or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg TMR_INT_Overflow: TMR update Interrupt source
+ * @arg TMR_INT_CC1: TMR Capture Compare 1 Interrupt source
+ * @arg TMR_INT_CC2: TMR Capture Compare 2 Interrupt source
+ * @arg TMR_INT_CC3: TMR Capture Compare 3 Interrupt source
+ * @arg TMR_INT_CC4: TMR Capture Compare 4 Interrupt source
+ * @arg TMR_INT_HALL: TMR Commutation Interrupt source
+ * @arg TMR_INT_Trigger: TMR Trigger Interrupt source
+ * @arg TMR_INT_Break: TMR Break Interrupt source
+ * @note
+ * - TMR6 and TMR7 can only generate an update interrupt.
+ * - TMR9, TMR12 and TMR15 can have only TMR_INT_Overflow, TMR_INT_CC1,
+ * TMR_INT_CC2 or TMR_INT_Trigger.
+ * - TMR10, TMR11, TMR13, TMR14 can have TMR_INT_Overflow or TMR_INT_CC1.
+ * - TMR_INT_Break is used only with TMR1, TMR8 and TMR15.
+ * - TMR_INT_HALL is used only with TMR1, TMR8, TMR15.
+ * @param NewState: new state of the TMR interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void TMR_INTConfig(TMR_Type* TMRx, uint16_t TMR_INT, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_TMR_INT(TMR_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the Interrupt sources */
+ TMRx->DIE |= TMR_INT;
+ }
+ else
+ {
+ /* Disable the Interrupt sources */
+ TMRx->DIE &= (uint16_t)~TMR_INT;
+ }
+}
+
+/**
+ * @brief Configures the TMRx event to be generate by software.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param TMR_EventSource: specifies the event source.
+ * This parameter can be one or more of the following values:
+ * @arg TMR_EventSource_Update: Timer update Event source
+ * @arg TMR_EventSource_CC1: Timer Capture Compare 1 Event source
+ * @arg TMR_EventSource_CC2: Timer Capture Compare 2 Event source
+ * @arg TMR_EventSource_CC3: Timer Capture Compare 3 Event source
+ * @arg TMR_EventSource_CC4: Timer Capture Compare 4 Event source
+ * @arg TMR_EventSource_HALL: Timer COM event source
+ * @arg TMR_EventSource_Trigger: Timer Trigger Event source
+ * @arg TMR_EventSource_Break: Timer Break event source
+ * @note
+ * - TMR6 and TMR7 can only generate an update event.
+ * - TMR_EventSource_HALL and TMR_EventSource_Break are used only with TMR1 and TMR8.
+ * @retval None
+ */
+void TMR_GenerateEvent(TMR_Type* TMRx, uint16_t TMR_EventSource)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_TMR_EVENT_SOURCE(TMR_EventSource));
+
+ /* Set the event sources */
+ TMRx->EVEG = TMR_EventSource;
+}
+
+/**
+ * @brief Configures the TMRx's DMA interface.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 15 to select
+ * the TMR peripheral.
+ * @param TMR_DMABase: DMA Base address.
+ * This parameter can be one of the following values:
+ * @arg TMR_DMABase_CTRL1, TMR_DMABase_CTRL2, TMR_DMABase_SMC,
+ * TMR_DMABase_DIE, TMR_DMABase_STS, TMR_DMABase_EVEG,
+ * TMR_DMABase_CCM1, TMR_DMABase_CCM2, TMR_DMABase_CCE,
+ * TMR_DMABase_CNT, TMR_DMABase_DIV, TMR_DMABase_AR,
+ * TMR_DMABase_RC, TMR_DMABase_CC1, TMR_DMABase_CC2,
+ * TMR_DMABase_CC3, TMR_DMABase_CC4, TMR_DMABase_BRKDT,
+ * TMR_DMABase_DMAC.
+ * @param TMR_DMABurstLength: DMA Burst length.
+ * This parameter can be one value between:
+ * TMR_DMABurstLength_1Transfer and TMR_DMABurstLength_18Transfers.
+ * @retval None
+ */
+void TMR_DMAConfig(TMR_Type* TMRx, uint16_t TMR_DMABase, uint16_t TMR_DMABurstLength)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST4_PERIPH(TMRx));
+ assert_param(IS_TMR_DMA_BASE(TMR_DMABase));
+ assert_param(IS_TMR_DMA_LENGTH(TMR_DMABurstLength));
+ /* Set the DMA Base and the DMA Burst Length */
+ TMRx->DMAC = TMR_DMABase | TMR_DMABurstLength;
+}
+
+/**
+ * @brief Enables or disables the TMRx's DMA Requests.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 6, 7, 8, 15
+ * to select the TMR peripheral.
+ * @param TMR_DMASource: specifies the DMA Request sources.
+ * This parameter can be any combination of the following values:
+ * @arg TMR_DMA_Update: TMR update Interrupt source
+ * @arg TMR_DMA_CC1: TMR Capture Compare 1 DMA source
+ * @arg TMR_DMA_CC2: TMR Capture Compare 2 DMA source
+ * @arg TMR_DMA_CC3: TMR Capture Compare 3 DMA source
+ * @arg TMR_DMA_CC4: TMR Capture Compare 4 DMA source
+ * @arg TMR_DMA_HALL: TMR Commutation DMA source
+ * @arg TMR_DMA_Trigger: TMR Trigger DMA source
+ * @param NewState: new state of the DMA Request sources.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void TMR_DMACmd(TMR_Type* TMRx, uint16_t TMR_DMASource, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST9_PERIPH(TMRx));
+ assert_param(IS_TMR_DMA_SOURCE(TMR_DMASource));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the DMA sources */
+ TMRx->DIE |= TMR_DMASource;
+ }
+ else
+ {
+ /* Disable the DMA sources */
+ TMRx->DIE &= (uint16_t)~TMR_DMASource;
+ }
+}
+
+/**
+ * @brief Configures the TMRx internal Clock
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15
+ * to select the TMR peripheral.
+ * @retval None
+ */
+void TMR_InternalClockConfig(TMR_Type* TMRx)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ /* Disable slave mode to clock the prescaler directly with the internal clock */
+ TMRx->SMC &= (uint16_t)(~((uint16_t)TMR_SMC_SMSEL));
+}
+
+/**
+ * @brief Configures the TMRx Internal Trigger as External Clock
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_ITRSource: Trigger source.
+ * This parameter can be one of the following values:
+ * @param TMR_TRGSEL_ITR0: Internal Trigger 0
+ * @param TMR_TRGSEL_ITR1: Internal Trigger 1
+ * @param TMR_TRGSEL_ITR2: Internal Trigger 2
+ * @param TMR_TRGSEL_ITR3: Internal Trigger 3
+ * @retval None
+ */
+void TMR_ITRxExternalClockConfig(TMR_Type* TMRx, uint16_t TMR_InputTriggerSource)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_INTERNAL_TRIGGER_SELECTION(TMR_InputTriggerSource));
+ /* Select the Internal Trigger */
+ TMR_SelectInputTrigger(TMRx, TMR_InputTriggerSource);
+ /* Select the External clock mode1 */
+ TMRx->SMC |= TMR_SlaveMode_External1;
+}
+
+/**
+ * @brief Configures the TMRx Trigger as External Clock
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_TIxExternalCLKSource: Trigger source.
+ * This parameter can be one of the following values:
+ * @arg TMR_TIxExternalCLK1Source_TI1ED: TI1 Edge Detector
+ * @arg TMR_TIxExternalCLK1Source_TI1: Filtered Timer Input 1
+ * @arg TMR_TIxExternalCLK1Source_TI2: Filtered Timer Input 2
+ * @param TMR_ICPolarity: specifies the TIx Polarity.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICPolarity_Rising
+ * @arg TMR_ICPolarity_Falling
+ * @param ICFilter : specifies the filter value.
+ * This parameter must be a value between 0x0 and 0xF.
+ * @retval None
+ */
+void TMR_TIxExternalClockConfig(TMR_Type* TMRx, uint16_t TMR_TIxExternalCLKSource,
+ uint16_t TMR_ICPolarity, uint16_t ICFilter)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_TIXCLK_SOURCE(TMR_TIxExternalCLKSource));
+ assert_param(IS_TMR_IC_POLARITY(TMR_ICPolarity));
+ assert_param(IS_TMR_IC_FILTER(ICFilter));
+
+ /* Configure the Timer Input Clock Source */
+ if (TMR_TIxExternalCLKSource == TMR_TIxExternalCLK1Source_TI2)
+ {
+ TI2_Config(TMRx, TMR_ICPolarity, TMR_ICSelection_DirectTI, ICFilter);
+ }
+ else
+ {
+ TI1_Config(TMRx, TMR_ICPolarity, TMR_ICSelection_DirectTI, ICFilter);
+ }
+
+ /* Select the Trigger source */
+ TMR_SelectInputTrigger(TMRx, TMR_TIxExternalCLKSource);
+ /* Select the External clock mode1 */
+ TMRx->SMC |= TMR_SlaveMode_External1;
+}
+
+/**
+ * @brief Configures the External clock Mode1
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_ExtTRGPrescaler: The external Trigger Prescaler.
+ * This parameter can be one of the following values:
+ * @arg TMR_ExtTRGDIV_OFF: ETRP Prescaler OFF.
+ * @arg TMR_ExtTRGDIV_DIV2: ETRP frequency divided by 2.
+ * @arg TMR_ExtTRGDIV_DIV4: ETRP frequency divided by 4.
+ * @arg TMR_ExtTRGDIV_DIV8: ETRP frequency divided by 8.
+ * @param TMR_ExtTRGPolarity: The external Trigger Polarity.
+ * This parameter can be one of the following values:
+ * @arg TMR_ExtTRGPolarity_Inverted: active low or falling edge active.
+ * @arg TMR_ExtTRGPolarity_NonInverted: active high or rising edge active.
+ * @param ExtTRGFilter: External Trigger Filter.
+ * This parameter must be a value between 0x00 and 0x0F
+ * @retval None
+ */
+void TMR_ETRClockMode1Config(TMR_Type* TMRx, uint16_t TMR_ExtTRGPrescaler, uint16_t TMR_ExtTRGPolarity,
+ uint16_t ExtTRGFilter)
+{
+ uint16_t tmpsmcr = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_EXT_DIV(TMR_ExtTRGPrescaler));
+ assert_param(IS_TMR_EXT_POLARITY(TMR_ExtTRGPolarity));
+ assert_param(IS_TMR_EXT_FILTER(ExtTRGFilter));
+ /* Configure the ETR Clock source */
+ TMR_ETRConfig(TMRx, TMR_ExtTRGPrescaler, TMR_ExtTRGPolarity, ExtTRGFilter);
+
+ /* Get the TMRx SMCR register value */
+ tmpsmcr = TMRx->SMC;
+ /* Reset the SMS Bits */
+ tmpsmcr &= (uint16_t)(~((uint16_t)TMR_SMC_SMSEL));
+ /* Select the External clock mode1 */
+ tmpsmcr |= TMR_SlaveMode_External1;
+ /* Select the Trigger selection : ETRF */
+ tmpsmcr &= (uint16_t)(~((uint16_t)TMR_SMC_TRGSEL));
+ tmpsmcr |= TMR_TRGSEL_ETRF;
+ /* Write to TMRx SMCR */
+ TMRx->SMC = tmpsmcr;
+}
+
+/**
+ * @brief Configures the External clock Mode2
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_ExtTRGPrescaler: The external Trigger Prescaler.
+ * This parameter can be one of the following values:
+ * @arg TMR_ExtTRGDIV_OFF: ETRP Prescaler OFF.
+ * @arg TMR_ExtTRGDIV_DIV2: ETRP frequency divided by 2.
+ * @arg TMR_ExtTRGDIV_DIV4: ETRP frequency divided by 4.
+ * @arg TMR_ExtTRGDIV_DIV8: ETRP frequency divided by 8.
+ * @param TMR_ExtTRGPolarity: The external Trigger Polarity.
+ * This parameter can be one of the following values:
+ * @arg TMR_ExtTRGPolarity_Inverted: active low or falling edge active.
+ * @arg TMR_ExtTRGPolarity_NonInverted: active high or rising edge active.
+ * @param ExtTRGFilter: External Trigger Filter.
+ * This parameter must be a value between 0x00 and 0x0F
+ * @retval None
+ */
+void TMR_ETRClockMode2Config(TMR_Type* TMRx, uint16_t TMR_ExtTRGPrescaler,
+ uint16_t TMR_ExtTRGPolarity, uint16_t ExtTRGFilter)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_EXT_DIV(TMR_ExtTRGPrescaler));
+ assert_param(IS_TMR_EXT_POLARITY(TMR_ExtTRGPolarity));
+ assert_param(IS_TMR_EXT_FILTER(ExtTRGFilter));
+ /* Configure the ETR Clock source */
+ TMR_ETRConfig(TMRx, TMR_ExtTRGPrescaler, TMR_ExtTRGPolarity, ExtTRGFilter);
+ /* Enable the External clock mode2 */
+ TMRx->SMC |= TMR_SMC_ECLKEN;
+}
+
+/**
+ * @brief Configures the TMRx External Trigger (ETR).
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_ExtTRGPrescaler: The external Trigger Prescaler.
+ * This parameter can be one of the following values:
+ * @arg TMR_ExtTRGDIV_OFF: ETRP Prescaler OFF.
+ * @arg TMR_ExtTRGDIV_DIV2: ETRP frequency divided by 2.
+ * @arg TMR_ExtTRGDIV_DIV4: ETRP frequency divided by 4.
+ * @arg TMR_ExtTRGDIV_DIV8: ETRP frequency divided by 8.
+ * @param TMR_ExtTRGPolarity: The external Trigger Polarity.
+ * This parameter can be one of the following values:
+ * @arg TMR_ExtTRGPolarity_Inverted: active low or falling edge active.
+ * @arg TMR_ExtTRGPolarity_NonInverted: active high or rising edge active.
+ * @param ExtTRGFilter: External Trigger Filter.
+ * This parameter must be a value between 0x00 and 0x0F
+ * @retval None
+ */
+void TMR_ETRConfig(TMR_Type* TMRx, uint16_t TMR_ExtTRGPrescaler, uint16_t TMR_ExtTRGPolarity,
+ uint16_t ExtTRGFilter)
+{
+ uint16_t tmpsmcr = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_EXT_DIV(TMR_ExtTRGPrescaler));
+ assert_param(IS_TMR_EXT_POLARITY(TMR_ExtTRGPolarity));
+ assert_param(IS_TMR_EXT_FILTER(ExtTRGFilter));
+ tmpsmcr = TMRx->SMC;
+ /* Reset the ETR Bits */
+ tmpsmcr &= SMC_ETR_Mask;
+ /* Set the Prescaler, the Filter value and the Polarity */
+ tmpsmcr |= (uint16_t)(TMR_ExtTRGPrescaler | (uint16_t)(TMR_ExtTRGPolarity | (uint16_t)(ExtTRGFilter << (uint16_t)8)));
+ /* Write to TMRx SMCR */
+ TMRx->SMC = tmpsmcr;
+}
+
+/**
+ * @brief Configures the TMRx Prescaler.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param Prescaler: specifies the Prescaler Register value
+ * @param TMR_PSCReloadMode: specifies the TMR Prescaler Reload mode
+ * This parameter can be one of the following values:
+ * @arg TMR_DIVReloadMode_Update: The Prescaler is loaded at the update event.
+ * @arg TMR_DIVReloadMode_Immediate: The Prescaler is loaded immediately.
+ * @retval None
+ */
+void TMR_DIVConfig(TMR_Type* TMRx, uint16_t Prescaler, uint16_t TMR_PSCReloadMode)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_TMR_DIV_RELOAD(TMR_PSCReloadMode));
+ /* Set the Prescaler value */
+ TMRx->DIV = Prescaler;
+ /* Set or reset the UG Bit */
+ TMRx->EVEG = TMR_PSCReloadMode;
+}
+
+/**
+ * @brief Specifies the TMRx Counter Mode to be used.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_CounterMode: specifies the Counter Mode to be used
+ * This parameter can be one of the following values:
+ * @arg TMR_CounterDIR_Up: TMR Up Counting Mode
+ * @arg TMR_CounterDIR_Down: TMR Down Counting Mode
+ * @arg TMR_CounterDIR_CenterAligned1: TMR Center Aligned Mode1
+ * @arg TMR_CounterDIR_CenterAligned2: TMR Center Aligned Mode2
+ * @arg TMR_CounterDIR_CenterAligned3: TMR Center Aligned Mode3
+ * @retval None
+ */
+void TMR_CounterModeConfig(TMR_Type* TMRx, uint16_t TMR_CounterMode)
+{
+ uint16_t tmpcr1 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_COUNTER_DIR(TMR_CounterMode));
+ tmpcr1 = TMRx->CTRL1;
+ /* Reset the CMS and DIR Bits */
+ tmpcr1 &= (uint16_t)(~((uint16_t)(TMR_CTRL1_DIR | TMR_CTRL1_CMSEL)));
+ /* Set the Counter Mode */
+ tmpcr1 |= TMR_CounterMode;
+ /* Write to TMRx CR1 register */
+ TMRx->CTRL1 = tmpcr1;
+}
+
+/**
+ * @brief Selects the Input Trigger source
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_InputTriggerSource: The Input Trigger source.
+ * This parameter can be one of the following values:
+ * @arg TMR_TRGSEL_ITR0: Internal Trigger 0
+ * @arg TMR_TRGSEL_ITR1: Internal Trigger 1
+ * @arg TMR_TRGSEL_ITR2: Internal Trigger 2
+ * @arg TMR_TRGSEL_ITR3: Internal Trigger 3
+ * @arg TMR_TRGSEL_TI1F_ED: TI1 Edge Detector
+ * @arg TMR_TRGSEL_TI1FP1: Filtered Timer Input 1
+ * @arg TMR_TRGSEL_TI2FP2: Filtered Timer Input 2
+ * @arg TMR_TRGSEL_ETRF: External Trigger input
+ * @retval None
+ */
+void TMR_SelectInputTrigger(TMR_Type* TMRx, uint16_t TMR_InputTriggerSource)
+{
+ uint16_t tmpsmcr = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_TRIGGER_SELECTION(TMR_InputTriggerSource));
+ /* Get the TMRx SMCR register value */
+ tmpsmcr = TMRx->SMC;
+ /* Reset the TS Bits */
+ tmpsmcr &= (uint16_t)(~((uint16_t)TMR_SMC_TRGSEL));
+ /* Set the Input Trigger source */
+ tmpsmcr |= TMR_InputTriggerSource;
+ /* Write to TMRx SMCR */
+ TMRx->SMC = tmpsmcr;
+}
+
+/**
+ * @brief Configures the TMRx Encoder Interface.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_EncoderMode: specifies the TMRx Encoder Mode.
+ * This parameter can be one of the following values:
+ * @arg TMR_EncoderMode_TI1: Counter counts on TI1FP1 edge depending on TI2FP2 level.
+ * @arg TMR_EncoderMode_TI2: Counter counts on TI2FP2 edge depending on TI1FP1 level.
+ * @arg TMR_EncoderMode_TI12: Counter counts on both TI1FP1 and TI2FP2 edges depending
+ * on the level of the other input.
+ * @param TMR_IC1Polarity: specifies the IC1 Polarity
+ * This parameter can be one of the following values:
+ * @arg TMR_ICPolarity_Falling: IC Falling edge.
+ * @arg TMR_ICPolarity_Rising: IC Rising edge.
+ * @param TMR_IC2Polarity: specifies the IC2 Polarity
+ * This parameter can be one of the following values:
+ * @arg TMR_ICPolarity_Falling: IC Falling edge.
+ * @arg TMR_ICPolarity_Rising: IC Rising edge.
+ * @retval None
+ */
+void TMR_EncoderInterfaceConfig(TMR_Type* TMRx, uint16_t TMR_EncoderMode,
+ uint16_t TMR_IC1Polarity, uint16_t TMR_IC2Polarity)
+{
+ uint16_t tmpsmcr = 0;
+ uint16_t tmpccmr1 = 0;
+ uint16_t tmpccer = 0;
+
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST5_PERIPH(TMRx));
+ assert_param(IS_TMR_ENCODER_MODE(TMR_EncoderMode));
+ assert_param(IS_TMR_IC_POLARITY(TMR_IC1Polarity));
+ assert_param(IS_TMR_IC_POLARITY(TMR_IC2Polarity));
+
+ /* Get the TMRx SMCR register value */
+ tmpsmcr = TMRx->SMC;
+
+ /* Get the TMRx CCMR1 register value */
+ tmpccmr1 = TMRx->CCM1;
+
+ /* Get the TMRx CCE register value */
+ tmpccer = TMRx->CCE;
+
+ /* Set the encoder Mode */
+ tmpsmcr &= (uint16_t)(~((uint16_t)TMR_SMC_SMSEL));
+ tmpsmcr |= TMR_EncoderMode;
+
+ /* Select the Capture Compare 1 and the Capture Compare 2 as input */
+ tmpccmr1 &= (uint16_t)(((uint16_t)~((uint16_t)TMR_CCM1_C1SEL)) & (uint16_t)(~((uint16_t)TMR_CCM1_C2SEL)));
+ tmpccmr1 |= TMR_CCM1_C1SEL_0 | TMR_CCM1_C2SEL_0;
+
+ /* Set the TI1 and the TI2 Polarities */
+ tmpccer &= (uint16_t)(((uint16_t)~((uint16_t)TMR_CCE_C1P)) & ((uint16_t)~((uint16_t)TMR_CCE_C2P)));
+ tmpccer |= (uint16_t)(TMR_IC1Polarity | (uint16_t)(TMR_IC2Polarity << (uint16_t)4));
+
+ /* Write to TMRx SMCR */
+ TMRx->SMC = tmpsmcr;
+ /* Write to TMRx CCMR1 */
+ TMRx->CCM1 = tmpccmr1;
+ /* Write to TMRx CCE */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Forces the TMRx output 1 waveform to active or inactive level.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param TMR_ForcedAction: specifies the forced Action to be set to the output waveform.
+ * This parameter can be one of the following values:
+ * @arg TMR_ForcedAction_Active: Force active level on OC1REF
+ * @arg TMR_ForcedAction_InActive: Force inactive level on OC1REF.
+ * @retval None
+ */
+void TMR_ForcedOC1Config(TMR_Type* TMRx, uint16_t TMR_ForcedAction)
+{
+ uint16_t tmpccmr1 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ assert_param(IS_TMR_FORCED_ACTION(TMR_ForcedAction));
+ tmpccmr1 = TMRx->CCM1;
+ /* Reset the OC1M Bits */
+ tmpccmr1 &= (uint16_t)~((uint16_t)TMR_CCM1_OC1MODE);
+ /* Configure The Forced output Mode */
+ tmpccmr1 |= TMR_ForcedAction;
+ /* Write to TMRx CCMR1 register */
+ TMRx->CCM1 = tmpccmr1;
+}
+
+/**
+ * @brief Forces the TMRx output 2 waveform to active or inactive level.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_ForcedAction: specifies the forced Action to be set to the output waveform.
+ * This parameter can be one of the following values:
+ * @arg TMR_ForcedAction_Active: Force active level on OC2REF
+ * @arg TMR_ForcedAction_InActive: Force inactive level on OC2REF.
+ * @retval None
+ */
+void TMR_ForcedOC2Config(TMR_Type* TMRx, uint16_t TMR_ForcedAction)
+{
+ uint16_t tmpccmr1 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_FORCED_ACTION(TMR_ForcedAction));
+ tmpccmr1 = TMRx->CCM1;
+ /* Reset the OC2M Bits */
+ tmpccmr1 &= (uint16_t)~((uint16_t)TMR_CCM1_OC2MODE);
+ /* Configure The Forced output Mode */
+ tmpccmr1 |= (uint16_t)(TMR_ForcedAction << 8);
+ /* Write to TMRx CCMR1 register */
+ TMRx->CCM1 = tmpccmr1;
+}
+
+/**
+ * @brief Forces the TMRx output 3 waveform to active or inactive level.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_ForcedAction: specifies the forced Action to be set to the output waveform.
+ * This parameter can be one of the following values:
+ * @arg TMR_ForcedAction_Active: Force active level on OC3REF
+ * @arg TMR_ForcedAction_InActive: Force inactive level on OC3REF.
+ * @retval None
+ */
+void TMR_ForcedOC3Config(TMR_Type* TMRx, uint16_t TMR_ForcedAction)
+{
+ uint16_t tmpccmr2 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_FORCED_ACTION(TMR_ForcedAction));
+ tmpccmr2 = TMRx->CCM2;
+ /* Reset the OC1M Bits */
+ tmpccmr2 &= (uint16_t)~((uint16_t)TMR_CCM2_OC3MODE);
+ /* Configure The Forced output Mode */
+ tmpccmr2 |= TMR_ForcedAction;
+ /* Write to TMRx CCMR2 register */
+ TMRx->CCM2 = tmpccmr2;
+}
+
+/**
+ * @brief Forces the TMRx output 4 waveform to active or inactive level.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_ForcedAction: specifies the forced Action to be set to the output waveform.
+ * This parameter can be one of the following values:
+ * @arg TMR_ForcedAction_Active: Force active level on OC4REF
+ * @arg TMR_ForcedAction_InActive: Force inactive level on OC4REF.
+ * @retval None
+ */
+void TMR_ForcedOC4Config(TMR_Type* TMRx, uint16_t TMR_ForcedAction)
+{
+ uint16_t tmpccmr2 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_FORCED_ACTION(TMR_ForcedAction));
+ tmpccmr2 = TMRx->CCM2;
+ /* Reset the OC2M Bits */
+ tmpccmr2 &= (uint16_t)~((uint16_t)TMR_CCM2_OC4MODE);
+ /* Configure The Forced output Mode */
+ tmpccmr2 |= (uint16_t)(TMR_ForcedAction << 8);
+ /* Write to TMRx CCMR2 register */
+ TMRx->CCM2 = tmpccmr2;
+}
+
+/**
+ * @brief Enables or disables TMRx peripheral Preload register on ARR.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param NewState: new state of the TMRx peripheral Preload register
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void TMR_ARPreloadConfig(TMR_Type* TMRx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Set the ARR Preload Bit */
+ TMRx->CTRL1 |= TMR_CTRL1_ARPEN;
+ }
+ else
+ {
+ /* Reset the ARR Preload Bit */
+ TMRx->CTRL1 &= (uint16_t)~((uint16_t)TMR_CTRL1_ARPEN);
+ }
+}
+
+/**
+ * @brief Selects the TMR peripheral Commutation event.
+ * @param TMRx: where x can be 1, 8, 15 to select the TMRx peripheral
+ * @param NewState: new state of the Commutation event.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void TMR_SelectHALL(TMR_Type* TMRx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST2_PERIPH(TMRx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Set the COM Bit */
+ TMRx->CTRL2 |= TMR_CTRL2_CUSEL;
+ }
+ else
+ {
+ /* Reset the COM Bit */
+ TMRx->CTRL2 &= (uint16_t)~((uint16_t)TMR_CTRL2_CUSEL);
+ }
+}
+
+/**
+ * @brief Selects the TMRx peripheral Capture Compare DMA source.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 15 to select
+ * the TMR peripheral.
+ * @param NewState: new state of the Capture Compare DMA source
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void TMR_SelectCCDMA(TMR_Type* TMRx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST4_PERIPH(TMRx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Set the CCDS Bit */
+ TMRx->CTRL2 |= TMR_CTRL2_CDSEL;
+ }
+ else
+ {
+ /* Reset the CCDS Bit */
+ TMRx->CTRL2 &= (uint16_t)~((uint16_t)TMR_CTRL2_CDSEL);
+ }
+}
+
+/**
+ * @brief Sets or Resets the TMR peripheral Capture Compare Preload Control bit.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8 or 15
+ * to select the TMRx peripheral
+ * @param NewState: new state of the Capture Compare Preload Control bit
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void TMR_CCPreloadControl(TMR_Type* TMRx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST5_PERIPH(TMRx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Set the CCPC Bit */
+ TMRx->CTRL2 |= TMR_CTRL2_CPC;
+ }
+ else
+ {
+ /* Reset the CCPC Bit */
+ TMRx->CTRL2 &= (uint16_t)~((uint16_t)TMR_CTRL2_CPC);
+ }
+}
+
+/**
+ * @brief Enables or disables the TMRx peripheral Preload register on CCR1.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param TMR_OCPreload: new state of the TMRx peripheral Preload register
+ * This parameter can be one of the following values:
+ * @arg TMR_OCPreload_Enable
+ * @arg TMR_OCPreload_Disable
+ * @retval None
+ */
+void TMR_OC1PreloadConfig(TMR_Type* TMRx, uint16_t TMR_OCPreload)
+{
+ uint16_t tmpccmr1 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ assert_param(IS_TMR_OCPRELOAD_STATE(TMR_OCPreload));
+ tmpccmr1 = TMRx->CCM1;
+ /* Reset the OC1PE Bit */
+ tmpccmr1 &= (uint16_t)~((uint16_t)TMR_CCM1_OC1PEN);
+ /* Enable or Disable the Output Compare Preload feature */
+ tmpccmr1 |= TMR_OCPreload;
+ /* Write to TMRx CCMR1 register */
+ TMRx->CCM1 = tmpccmr1;
+}
+
+/**
+ * @brief Enables or disables the TMRx peripheral Preload register on CCR2.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select
+ * the TMR peripheral.
+ * @param TMR_OCPreload: new state of the TMRx peripheral Preload register
+ * This parameter can be one of the following values:
+ * @arg TMR_OCPreload_Enable
+ * @arg TMR_OCPreload_Disable
+ * @retval None
+ */
+void TMR_OC2PreloadConfig(TMR_Type* TMRx, uint16_t TMR_OCPreload)
+{
+ uint16_t tmpccmr1 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_OCPRELOAD_STATE(TMR_OCPreload));
+ tmpccmr1 = TMRx->CCM1;
+ /* Reset the OC2PE Bit */
+ tmpccmr1 &= (uint16_t)~((uint16_t)TMR_CCM1_OC2PEN);
+ /* Enable or Disable the Output Compare Preload feature */
+ tmpccmr1 |= (uint16_t)(TMR_OCPreload << 8);
+ /* Write to TMRx CCMR1 register */
+ TMRx->CCM1 = tmpccmr1;
+}
+
+/**
+ * @brief Enables or disables the TMRx peripheral Preload register on CCR3.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCPreload: new state of the TMRx peripheral Preload register
+ * This parameter can be one of the following values:
+ * @arg TMR_OCPreload_Enable
+ * @arg TMR_OCPreload_Disable
+ * @retval None
+ */
+void TMR_OC3PreloadConfig(TMR_Type* TMRx, uint16_t TMR_OCPreload)
+{
+ uint16_t tmpccmr2 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OCPRELOAD_STATE(TMR_OCPreload));
+ tmpccmr2 = TMRx->CCM2;
+ /* Reset the OC3PE Bit */
+ tmpccmr2 &= (uint16_t)~((uint16_t)TMR_CCM2_OC3PEN);
+ /* Enable or Disable the Output Compare Preload feature */
+ tmpccmr2 |= TMR_OCPreload;
+ /* Write to TMRx CCMR2 register */
+ TMRx->CCM2 = tmpccmr2;
+}
+
+/**
+ * @brief Enables or disables the TMRx peripheral Preload register on CCR4.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCPreload: new state of the TMRx peripheral Preload register
+ * This parameter can be one of the following values:
+ * @arg TMR_OCPreload_Enable
+ * @arg TMR_OCPreload_Disable
+ * @retval None
+ */
+void TMR_OC4PreloadConfig(TMR_Type* TMRx, uint16_t TMR_OCPreload)
+{
+ uint16_t tmpccmr2 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OCPRELOAD_STATE(TMR_OCPreload));
+ tmpccmr2 = TMRx->CCM2;
+ /* Reset the OC4PE Bit */
+ tmpccmr2 &= (uint16_t)~((uint16_t)TMR_CCM2_OC4PE);
+ /* Enable or Disable the Output Compare Preload feature */
+ tmpccmr2 |= (uint16_t)(TMR_OCPreload << 8);
+ /* Write to TMRx CCMR2 register */
+ TMRx->CCM2 = tmpccmr2;
+}
+
+/**
+ * @brief Configures the TMRx Output Compare 1 Fast feature.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param TMR_OCFast: new state of the Output Compare Fast Enable Bit.
+ * This parameter can be one of the following values:
+ * @arg TMR_OCFast_Enable: TMR output compare fast enable
+ * @arg TMR_OCFast_Disable: TMR output compare fast disable
+ * @retval None
+ */
+void TMR_OC1FastConfig(TMR_Type* TMRx, uint16_t TMR_OCFast)
+{
+ uint16_t tmpccmr1 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ assert_param(IS_TMR_OCFAST_STATE(TMR_OCFast));
+ /* Get the TMRx CCMR1 register value */
+ tmpccmr1 = TMRx->CCM1;
+ /* Reset the OC1FE Bit */
+ tmpccmr1 &= (uint16_t)~((uint16_t)TMR_CCM1_OC1FEN);
+ /* Enable or Disable the Output Compare Fast Bit */
+ tmpccmr1 |= TMR_OCFast;
+ /* Write to TMRx CCMR1 */
+ TMRx->CCM1 = tmpccmr1;
+}
+
+/**
+ * @brief Configures the TMRx Output Compare 2 Fast feature.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select
+ * the TMR peripheral.
+ * @param TMR_OCFast: new state of the Output Compare Fast Enable Bit.
+ * This parameter can be one of the following values:
+ * @arg TMR_OCFast_Enable: TMR output compare fast enable
+ * @arg TMR_OCFast_Disable: TMR output compare fast disable
+ * @retval None
+ */
+void TMR_OC2FastConfig(TMR_Type* TMRx, uint16_t TMR_OCFast)
+{
+ uint16_t tmpccmr1 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_OCFAST_STATE(TMR_OCFast));
+ /* Get the TMRx CCMR1 register value */
+ tmpccmr1 = TMRx->CCM1;
+ /* Reset the OC2FE Bit */
+ tmpccmr1 &= (uint16_t)~((uint16_t)TMR_CCM1_OC2FNE);
+ /* Enable or Disable the Output Compare Fast Bit */
+ tmpccmr1 |= (uint16_t)(TMR_OCFast << 8);
+ /* Write to TMRx CCMR1 */
+ TMRx->CCM1 = tmpccmr1;
+}
+
+/**
+ * @brief Configures the TMRx Output Compare 3 Fast feature.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCFast: new state of the Output Compare Fast Enable Bit.
+ * This parameter can be one of the following values:
+ * @arg TMR_OCFast_Enable: TMR output compare fast enable
+ * @arg TMR_OCFast_Disable: TMR output compare fast disable
+ * @retval None
+ */
+void TMR_OC3FastConfig(TMR_Type* TMRx, uint16_t TMR_OCFast)
+{
+ uint16_t tmpccmr2 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OCFAST_STATE(TMR_OCFast));
+ /* Get the TMRx CCMR2 register value */
+ tmpccmr2 = TMRx->CCM2;
+ /* Reset the OC3FE Bit */
+ tmpccmr2 &= (uint16_t)~((uint16_t)TMR_CCM2_OC3FEN);
+ /* Enable or Disable the Output Compare Fast Bit */
+ tmpccmr2 |= TMR_OCFast;
+ /* Write to TMRx CCMR2 */
+ TMRx->CCM2 = tmpccmr2;
+}
+
+/**
+ * @brief Configures the TMRx Output Compare 4 Fast feature.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCFast: new state of the Output Compare Fast Enable Bit.
+ * This parameter can be one of the following values:
+ * @arg TMR_OCFast_Enable: TMR output compare fast enable
+ * @arg TMR_OCFast_Disable: TMR output compare fast disable
+ * @retval None
+ */
+void TMR_OC4FastConfig(TMR_Type* TMRx, uint16_t TMR_OCFast)
+{
+ uint16_t tmpccmr2 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OCFAST_STATE(TMR_OCFast));
+ /* Get the TMRx CCMR2 register value */
+ tmpccmr2 = TMRx->CCM2;
+ /* Reset the OC4FE Bit */
+ tmpccmr2 &= (uint16_t)~((uint16_t)TMR_CCM2_OC4FE);
+ /* Enable or Disable the Output Compare Fast Bit */
+ tmpccmr2 |= (uint16_t)(TMR_OCFast << 8);
+ /* Write to TMRx CCMR2 */
+ TMRx->CCM2 = tmpccmr2;
+}
+
+/**
+ * @brief Clears or safeguards the OCREF1 signal on an external event
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCClear: new state of the Output Compare Clear Enable Bit.
+ * This parameter can be one of the following values:
+ * @arg TMR_OCClear_Enable: TMR Output clear enable
+ * @arg TMR_OCClear_Disable: TMR Output clear disable
+ * @retval None
+ */
+void TMR_ClearOC1Ref(TMR_Type* TMRx, uint16_t TMR_OCClear)
+{
+ uint16_t tmpccmr1 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OCCLEAR_STATE(TMR_OCClear));
+
+ tmpccmr1 = TMRx->CCM1;
+
+ /* Reset the OC1CE Bit */
+ tmpccmr1 &= (uint16_t)~((uint16_t)TMR_CCM1_C1CDIS);
+ /* Enable or Disable the Output Compare Clear Bit */
+ tmpccmr1 |= TMR_OCClear;
+ /* Write to TMRx CCMR1 register */
+ TMRx->CCM1 = tmpccmr1;
+}
+
+/**
+ * @brief Clears or safeguards the OCREF2 signal on an external event
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCClear: new state of the Output Compare Clear Enable Bit.
+ * This parameter can be one of the following values:
+ * @arg TMR_OCClear_Enable: TMR Output clear enable
+ * @arg TMR_OCClear_Disable: TMR Output clear disable
+ * @retval None
+ */
+void TMR_ClearOC2Ref(TMR_Type* TMRx, uint16_t TMR_OCClear)
+{
+ uint16_t tmpccmr1 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OCCLEAR_STATE(TMR_OCClear));
+ tmpccmr1 = TMRx->CCM1;
+ /* Reset the OC2CE Bit */
+ tmpccmr1 &= (uint16_t)~((uint16_t)TMR_CCM1_OC2CDIS);
+ /* Enable or Disable the Output Compare Clear Bit */
+ tmpccmr1 |= (uint16_t)(TMR_OCClear << 8);
+ /* Write to TMRx CCMR1 register */
+ TMRx->CCM1 = tmpccmr1;
+}
+
+/**
+ * @brief Clears or safeguards the OCREF3 signal on an external event
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCClear: new state of the Output Compare Clear Enable Bit.
+ * This parameter can be one of the following values:
+ * @arg TMR_OCClear_Enable: TMR Output clear enable
+ * @arg TMR_OCClear_Disable: TMR Output clear disable
+ * @retval None
+ */
+void TMR_ClearOC3Ref(TMR_Type* TMRx, uint16_t TMR_OCClear)
+{
+ uint16_t tmpccmr2 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OCCLEAR_STATE(TMR_OCClear));
+ tmpccmr2 = TMRx->CCM2;
+ /* Reset the OC3CE Bit */
+ tmpccmr2 &= (uint16_t)~((uint16_t)TMR_CCM2_OC3CDIS);
+ /* Enable or Disable the Output Compare Clear Bit */
+ tmpccmr2 |= TMR_OCClear;
+ /* Write to TMRx CCMR2 register */
+ TMRx->CCM2 = tmpccmr2;
+}
+
+/**
+ * @brief Clears or safeguards the OCREF4 signal on an external event
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCClear: new state of the Output Compare Clear Enable Bit.
+ * This parameter can be one of the following values:
+ * @arg TMR_OCClear_Enable: TMR Output clear enable
+ * @arg TMR_OCClear_Disable: TMR Output clear disable
+ * @retval None
+ */
+void TMR_ClearOC4Ref(TMR_Type* TMRx, uint16_t TMR_OCClear)
+{
+ uint16_t tmpccmr2 = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OCCLEAR_STATE(TMR_OCClear));
+ tmpccmr2 = TMRx->CCM2;
+ /* Reset the OC4CE Bit */
+ tmpccmr2 &= (uint16_t)~((uint16_t)TMR_CCM2_OC4CDIS);
+ /* Enable or Disable the Output Compare Clear Bit */
+ tmpccmr2 |= (uint16_t)(TMR_OCClear << 8);
+ /* Write to TMRx CCMR2 register */
+ TMRx->CCM2 = tmpccmr2;
+}
+
+/**
+ * @brief Configures the TMRx channel 1 polarity.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param TMR_OCPolarity: specifies the OC1 Polarity
+ * This parameter can be one of the following values:
+ * @arg TMR_OCPolarity_High: Output Compare active high
+ * @arg TMR_OCPolarity_Low: Output Compare active low
+ * @retval None
+ */
+void TMR_OC1PolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCPolarity)
+{
+ uint16_t tmpccer = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ assert_param(IS_TMR_OC_POLARITY(TMR_OCPolarity));
+ tmpccer = TMRx->CCE;
+ /* Set or Reset the CC1P Bit */
+ tmpccer &= (uint16_t)~((uint16_t)TMR_CCE_C1P);
+ tmpccer |= TMR_OCPolarity;
+ /* Write to TMRx CCE register */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Configures the TMRx Channel 1N polarity.
+ * @param TMRx: where x can be 1, 8, 15 to select the TMR peripheral.
+ * @param TMR_OCNPolarity: specifies the OC1N Polarity
+ * This parameter can be one of the following values:
+ * @arg TMR_OCNPolarity_High: Output Compare active high
+ * @arg TMR_OCNPolarity_Low: Output Compare active low
+ * @retval None
+ */
+void TMR_OC1NPolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCNPolarity)
+{
+ uint16_t tmpccer = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST2_PERIPH(TMRx));
+ assert_param(IS_TMR_OCN_POLARITY(TMR_OCNPolarity));
+
+ tmpccer = TMRx->CCE;
+ /* Set or Reset the CC1NP Bit */
+ tmpccer &= (uint16_t)~((uint16_t)TMR_CCE_C1NP);
+ tmpccer |= TMR_OCNPolarity;
+ /* Write to TMRx CCE register */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Configures the TMRx channel 2 polarity.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_OCPolarity: specifies the OC2 Polarity
+ * This parameter can be one of the following values:
+ * @arg TMR_OCPolarity_High: Output Compare active high
+ * @arg TMR_OCPolarity_Low: Output Compare active low
+ * @retval None
+ */
+void TMR_OC2PolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCPolarity)
+{
+ uint16_t tmpccer = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_OC_POLARITY(TMR_OCPolarity));
+ tmpccer = TMRx->CCE;
+ /* Set or Reset the CC2P Bit */
+ tmpccer &= (uint16_t)~((uint16_t)TMR_CCE_C2P);
+ tmpccer |= (uint16_t)(TMR_OCPolarity << 4);
+ /* Write to TMRx CCE register */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Configures the TMRx Channel 2N polarity.
+ * @param TMRx: where x can be 1 or 8 to select the TMR peripheral.
+ * @param TMR_OCNPolarity: specifies the OC2N Polarity
+ * This parameter can be one of the following values:
+ * @arg TMR_OCNPolarity_High: Output Compare active high
+ * @arg TMR_OCNPolarity_Low: Output Compare active low
+ * @retval None
+ */
+void TMR_OC2NPolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCNPolarity)
+{
+ uint16_t tmpccer = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST1_PERIPH(TMRx));
+ assert_param(IS_TMR_OCN_POLARITY(TMR_OCNPolarity));
+
+ tmpccer = TMRx->CCE;
+ /* Set or Reset the CC2NP Bit */
+ tmpccer &= (uint16_t)~((uint16_t)TMR_CCE_C2NP);
+ tmpccer |= (uint16_t)(TMR_OCNPolarity << 4);
+ /* Write to TMRx CCE register */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Configures the TMRx channel 3 polarity.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCPolarity: specifies the OC3 Polarity
+ * This parameter can be one of the following values:
+ * @arg TMR_OCPolarity_High: Output Compare active high
+ * @arg TMR_OCPolarity_Low: Output Compare active low
+ * @retval None
+ */
+void TMR_OC3PolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCPolarity)
+{
+ uint16_t tmpccer = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OC_POLARITY(TMR_OCPolarity));
+ tmpccer = TMRx->CCE;
+ /* Set or Reset the CC3P Bit */
+ tmpccer &= (uint16_t)~((uint16_t)TMR_CCE_C3P);
+ tmpccer |= (uint16_t)(TMR_OCPolarity << 8);
+ /* Write to TMRx CCE register */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Configures the TMRx Channel 3N polarity.
+ * @param TMRx: where x can be 1 or 8 to select the TMR peripheral.
+ * @param TMR_OCNPolarity: specifies the OC3N Polarity
+ * This parameter can be one of the following values:
+ * @arg TMR_OCNPolarity_High: Output Compare active high
+ * @arg TMR_OCNPolarity_Low: Output Compare active low
+ * @retval None
+ */
+void TMR_OC3NPolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCNPolarity)
+{
+ uint16_t tmpccer = 0;
+
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST1_PERIPH(TMRx));
+ assert_param(IS_TMR_OCN_POLARITY(TMR_OCNPolarity));
+
+ tmpccer = TMRx->CCE;
+ /* Set or Reset the CC3NP Bit */
+ tmpccer &= (uint16_t)~((uint16_t)TMR_CCE_C3NP);
+ tmpccer |= (uint16_t)(TMR_OCNPolarity << 8);
+ /* Write to TMRx CCER register */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Configures the TMRx channel 4 polarity.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_OCPolarity: specifies the OC4 Polarity
+ * This parameter can be one of the following values:
+ * @arg TMR_OCPolarity_High: Output Compare active high
+ * @arg TMR_OCPolarity_Low: Output Compare active low
+ * @retval None
+ */
+void TMR_OC4PolarityConfig(TMR_Type* TMRx, uint16_t TMR_OCPolarity)
+{
+ uint16_t tmpccer = 0;
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_OC_POLARITY(TMR_OCPolarity));
+ tmpccer = TMRx->CCE;
+ /* Set or Reset the CC4P Bit */
+ tmpccer &= (uint16_t)~((uint16_t)TMR_CCE_C4P);
+ tmpccer |= (uint16_t)(TMR_OCPolarity << 12);
+ /* Write to TMRx CCE register */
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Enables or disables the TMR Capture Compare Channel x.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param TMR_Channel: specifies the TMR Channel
+ * This parameter can be one of the following values:
+ * @arg TMR_Channel_1: TMR Channel 1
+ * @arg TMR_Channel_2: TMR Channel 2
+ * @arg TMR_Channel_3: TMR Channel 3
+ * @arg TMR_Channel_4: TMR Channel 4
+ * @param TMR_CCx: specifies the TMR Channel CCxE bit new state.
+ * This parameter can be: TMR_CCx_Enable or TMR_CCx_Disable.
+ * @retval None
+ */
+void TMR_CCxCmd(TMR_Type* TMRx, uint16_t TMR_Channel, uint16_t TMR_CCx)
+{
+ uint16_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ assert_param(IS_TMR_CHANNEL(TMR_Channel));
+ assert_param(IS_TMR_CCX(TMR_CCx));
+
+ tmp = CCE_CCE_Set << TMR_Channel;
+
+ /* Reset the CCxE Bit */
+ TMRx->CCE &= (uint16_t)~ tmp;
+
+ /* Set or reset the CCxE Bit */
+ TMRx->CCE |= (uint16_t)(TMR_CCx << TMR_Channel);
+}
+
+/**
+ * @brief Enables or disables the TMR Capture Compare Channel xN.
+ * @param TMRx: where x can be 1, 8, 15 to select the TMR peripheral.
+ * @param TMR_Channel: specifies the TMR Channel
+ * This parameter can be one of the following values:
+ * @arg TMR_Channel_1: TMR Channel 1
+ * @arg TMR_Channel_2: TMR Channel 2
+ * @arg TMR_Channel_3: TMR Channel 3
+ * @param TMR_CCxN: specifies the TMR Channel CCxNE bit new state.
+ * This parameter can be: TMR_CCxN_Enable or TMR_CCxN_Disable.
+ * @retval None
+ */
+void TMR_CCxNCmd(TMR_Type* TMRx, uint16_t TMR_Channel, uint16_t TMR_CCxN)
+{
+ uint16_t tmp = 0;
+
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST2_PERIPH(TMRx));
+ assert_param(IS_TMR_COMPLEMENTARY_CHANNEL(TMR_Channel));
+ assert_param(IS_TMR_CCXN(TMR_CCxN));
+
+ tmp = CCE_CCNE_Set << TMR_Channel;
+
+ /* Reset the CCxNE Bit */
+ TMRx->CCE &= (uint16_t) ~tmp;
+
+ /* Set or reset the CCxNE Bit */
+ TMRx->CCE |= (uint16_t)(TMR_CCxN << TMR_Channel);
+}
+
+/**
+ * @brief Selects the TMR Output Compare Mode.
+ * @note This function disables the selected channel before changing the Output
+ * Compare Mode.
+ * User has to enable this channel using TMR_CCxCmd and TMR_CCxNCmd functions.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param TMR_Channel: specifies the TMR Channel
+ * This parameter can be one of the following values:
+ * @arg TMR_Channel_1: TMR Channel 1
+ * @arg TMR_Channel_2: TMR Channel 2
+ * @arg TMR_Channel_3: TMR Channel 3
+ * @arg TMR_Channel_4: TMR Channel 4
+ * @param TMR_OCMode: specifies the TMR Output Compare Mode.
+ * This parameter can be one of the following values:
+ * @arg TMR_OCMode_Timing
+ * @arg TMR_OCMode_Active
+ * @arg TMR_OCMode_Toggle
+ * @arg TMR_OCMode_PWM1
+ * @arg TMR_OCMode_PWM2
+ * @arg TMR_ForcedAction_Active
+ * @arg TMR_ForcedAction_InActive
+ * @retval None
+ */
+void TMR_SelectOCxM(TMR_Type* TMRx, uint16_t TMR_Channel, uint16_t TMR_OCMode)
+{
+ uint32_t tmp = 0;
+ uint16_t tmp1 = 0;
+
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ assert_param(IS_TMR_CHANNEL(TMR_Channel));
+ assert_param(IS_TMR_OCM(TMR_OCMode));
+
+ tmp = (uint32_t) TMRx;
+ tmp += CCMR_Offset;
+
+ tmp1 = CCE_CCE_Set << (uint16_t)TMR_Channel;
+
+ /* Disable the Channel: Reset the CCxE Bit */
+ TMRx->CCE &= (uint16_t) ~tmp1;
+
+ if((TMR_Channel == TMR_Channel_1) || (TMR_Channel == TMR_Channel_3))
+ {
+ tmp += (TMR_Channel >> 1);
+
+ /* Reset the OCxM bits in the CCMRx register */
+ *(__IO uint32_t *) tmp &= (uint32_t)~((uint32_t)TMR_CCM1_OC1MODE);
+
+ /* Configure the OCxM bits in the CCMRx register */
+ *(__IO uint32_t *) tmp |= TMR_OCMode;
+ }
+ else
+ {
+ tmp += (uint16_t)(TMR_Channel - (uint16_t)4) >> (uint16_t)1;
+
+ /* Reset the OCxM bits in the CCMRx register */
+ *(__IO uint32_t *) tmp &= (uint32_t)~((uint32_t)TMR_CCM1_OC2MODE);
+
+ /* Configure the OCxM bits in the CCMRx register */
+ *(__IO uint32_t *) tmp |= (uint16_t)(TMR_OCMode << 8);
+ }
+}
+
+/**
+ * @brief Enables or Disables the TMRx Update event.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param NewState: new state of the TMRx UDIS bit
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void TMR_UpdateDisableConfig(TMR_Type* TMRx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Set the Update Disable Bit */
+ TMRx->CTRL1 |= TMR_CTRL1_UEVDIS;
+ }
+ else
+ {
+ /* Reset the Update Disable Bit */
+ TMRx->CTRL1 &= (uint16_t)~((uint16_t)TMR_CTRL1_UEVDIS);
+ }
+}
+
+/**
+ * @brief Configures the TMRx Update Request Interrupt source.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param TMR_UpdateSource: specifies the Update source.
+ * This parameter can be one of the following values:
+ * @arg TMR_UpdateSource_Regular: Source of update is the counter overflow/underflow
+ or the setting of UG bit, or an update generation
+ through the slave mode controller.
+ * @arg TMR_UpdateSource_Global: Source of update is counter overflow/underflow.
+ * @retval None
+ */
+void TMR_UpdateRequestConfig(TMR_Type* TMRx, uint16_t TMR_UpdateSource)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_TMR_UPDATE_SOURCE(TMR_UpdateSource));
+
+ if (TMR_UpdateSource != TMR_UpdateSource_Global)
+ {
+ /* Set the URS Bit */
+ TMRx->CTRL1 |= TMR_CTRL1_UVERS;
+ }
+ else
+ {
+ /* Reset the URS Bit */
+ TMRx->CTRL1 &= (uint16_t)~((uint16_t)TMR_CTRL1_UVERS);
+ }
+}
+
+/**
+ * @brief Enables or disables the TMRx's Hall sensor interface.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param NewState: new state of the TMRx Hall sensor interface.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void TMR_SelectHallSensor(TMR_Type* TMRx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Set the TI1S Bit */
+ TMRx->CTRL2 |= TMR_CTRL2_TI1SEL;
+ }
+ else
+ {
+ /* Reset the TI1S Bit */
+ TMRx->CTRL2 &= (uint16_t)~((uint16_t)TMR_CTRL2_TI1SEL);
+ }
+}
+
+/**
+ * @brief Selects the TMRx's One Pulse Mode.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param TMR_OPMode: specifies the OPM Mode to be used.
+ * This parameter can be one of the following values:
+ * @arg TMR_OPMode_Once
+ * @arg TMR_OPMode_Repetitive
+ * @retval None
+ */
+void TMR_SelectOnePulseMode(TMR_Type* TMRx, uint16_t TMR_OPMode)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_TMR_OPM_MODE(TMR_OPMode));
+ /* Reset the OPM Bit */
+ TMRx->CTRL1 &= (uint16_t)~((uint16_t)TMR_CTRL1_OPMODE);
+ /* Configure the OPM Mode */
+ TMRx->CTRL1 |= TMR_OPMode;
+}
+
+/**
+ * @brief Selects the TMRx Trigger Output Mode.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 6, 7, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_TRGOSource: specifies the Trigger Output source.
+ * This paramter can be one of the following values:
+ *
+ * - For all TMRx
+ * @arg TMR_TRGOSource_Reset: The UG bit in the TMR_EGR register is used as the trigger output (TRGO).
+ * @arg TMR_TRGOSource_Enable: The Counter Enable CEN is used as the trigger output (TRGO).
+ * @arg TMR_TRGOSource_Update: The update event is selected as the trigger output (TRGO).
+ *
+ * - For all TMRx except TMR6 and TMR7
+ * @arg TMR_TRGOSource_OC1: The trigger output sends a positive pulse when the CC1IF flag
+ * is to be set, as soon as a capture or compare match occurs (TRGO).
+ * @arg TMR_TRGOSource_OC1Ref: OC1REF signal is used as the trigger output (TRGO).
+ * @arg TMR_TRGOSource_OC2Ref: OC2REF signal is used as the trigger output (TRGO).
+ * @arg TMR_TRGOSource_OC3Ref: OC3REF signal is used as the trigger output (TRGO).
+ * @arg TMR_TRGOSource_OC4Ref: OC4REF signal is used as the trigger output (TRGO).
+ *
+ * @retval None
+ */
+void TMR_SelectOutputTrigger(TMR_Type* TMRx, uint16_t TMR_TRGOSource)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST7_PERIPH(TMRx));
+ assert_param(IS_TMR_TRGO_SOURCE(TMR_TRGOSource));
+ /* Reset the MMS Bits */
+ TMRx->CTRL2 &= (uint16_t)~((uint16_t)TMR_CTRL2_MMSEL);
+ /* Select the TRGO source */
+ TMRx->CTRL2 |= TMR_TRGOSource;
+}
+
+/**
+ * @brief Selects the TMRx Slave Mode.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_SlaveMode: specifies the Timer Slave Mode.
+ * This parameter can be one of the following values:
+ * @arg TMR_SlaveMode_Reset: Rising edge of the selected trigger signal (TRGI) re-initializes
+ * the counter and triggers an update of the registers.
+ * @arg TMR_SlaveMode_Gate: The counter clock is enabled when the trigger signal (TRGI) is high.
+ * @arg TMR_SlaveMode_Trigger: The counter starts at a rising edge of the trigger TRGI.
+ * @arg TMR_SlaveMode_External1: Rising edges of the selected trigger (TRGI) clock the counter.
+ * @retval None
+ */
+void TMR_SelectSlaveMode(TMR_Type* TMRx, uint16_t TMR_SlaveMode)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_SLAVE_MODE(TMR_SlaveMode));
+ /* Reset the SMS Bits */
+ TMRx->SMC &= (uint16_t)~((uint16_t)TMR_SMC_SMSEL);
+ /* Select the Slave Mode */
+ TMRx->SMC |= TMR_SlaveMode;
+}
+
+/**
+ * @brief Sets or Resets the TMRx Master/Slave Mode.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_MasterSlaveMode: specifies the Timer Master Slave Mode.
+ * This parameter can be one of the following values:
+ * @arg TMR_MasterSlaveMode_Enable: synchronization between the current timer
+ * and its slaves (through TRGO).
+ * @arg TMR_MasterSlaveMode_Disable: No action
+ * @retval None
+ */
+void TMR_SelectMasterSlaveMode(TMR_Type* TMRx, uint16_t TMR_MasterSlaveMode)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_MSMODE_STATE(TMR_MasterSlaveMode));
+ /* Reset the MSM Bit */
+ TMRx->SMC &= (uint16_t)~((uint16_t)TMR_SMC_MSMODE);
+
+ /* Set or Reset the MSM Bit */
+ TMRx->SMC |= TMR_MasterSlaveMode;
+}
+
+/**
+ * @brief Sets the TMRx Counter Register value
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param Counter: specifies the Counter register new value.
+ * @retval None
+ */
+void TMR_SetCounter(TMR_Type* TMRx, uint32_t Counter)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ /* Set the Counter Register value */
+ TMRx->CNT = Counter;
+}
+
+/**
+ * @brief Sets the TMRx Autoreload Register value
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param Autoreload: specifies the Autoreload register new value.
+ * @retval None
+ */
+void TMR_SetAutoreload(TMR_Type* TMRx, uint32_t Autoreload)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ /* Set the Autoreload Register value */
+ TMRx->AR = Autoreload;
+}
+
+/**
+ * @brief Sets the TMRx Capture Compare1 Register value
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param Compare1: specifies the Capture Compare1 register new value.
+ * @retval None
+ */
+void TMR_SetCompare1(TMR_Type* TMRx, uint32_t Compare1)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ /* Set the Capture Compare1 Register value */
+ TMRx->CC1 = Compare1;
+}
+
+/**
+ * @brief Sets the TMRx Capture Compare2 Register value
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @param Compare2: specifies the Capture Compare2 register new value.
+ * @retval None
+ */
+void TMR_SetCompare2(TMR_Type* TMRx, uint32_t Compare2)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ /* Set the Capture Compare2 Register value */
+ TMRx->CC2 = Compare2;
+}
+
+/**
+ * @brief Sets the TMRx Capture Compare3 Register value
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param Compare3: specifies the Capture Compare3 register new value.
+ * @retval None
+ */
+void TMR_SetCompare3(TMR_Type* TMRx, uint32_t Compare3)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ /* Set the Capture Compare3 Register value */
+ TMRx->CC3 = Compare3;
+}
+
+/**
+ * @brief Sets the TMRx Capture Compare4 Register value
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param Compare4: specifies the Capture Compare4 register new value.
+ * @retval None
+ */
+void TMR_SetCompare4(TMR_Type* TMRx, uint32_t Compare4)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ /* Set the Capture Compare4 Register value */
+ TMRx->CC4 = Compare4;
+}
+
+/**
+ * @brief Sets the TMRx Input Capture 1 prescaler.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param TMR_ICPSC: specifies the Input Capture1 prescaler new value.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICDIV_DIV1: no prescaler
+ * @arg TMR_ICDIV_DIV2: capture is done once every 2 events
+ * @arg TMR_ICDIV_DIV4: capture is done once every 4 events
+ * @arg TMR_ICDIV_DIV8: capture is done once every 8 events
+ * @retval None
+ */
+void TMR_SetIC1DIV(TMR_Type* TMRx, uint16_t TMR_ICPSC)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ assert_param(IS_TMR_IC_DIV(TMR_ICPSC));
+ /* Reset the IC1PSC Bits */
+ TMRx->CCM1 &= (uint16_t)~((uint16_t)TMR_CCM1_IC1DIV);
+ /* Set the IC1PSC value */
+ TMRx->CCM1 |= TMR_ICPSC;
+}
+
+/**
+ * @brief Sets the TMRx Input Capture 2 prescaler.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_ICPSC: specifies the Input Capture2 prescaler new value.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICDIV_DIV1: no prescaler
+ * @arg TMR_ICDIV_DIV2: capture is done once every 2 events
+ * @arg TMR_ICDIV_DIV4: capture is done once every 4 events
+ * @arg TMR_ICDIV_DIV8: capture is done once every 8 events
+ * @retval None
+ */
+void TMR_SetIC2DIV(TMR_Type* TMRx, uint16_t TMR_ICPSC)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ assert_param(IS_TMR_IC_DIV(TMR_ICPSC));
+ /* Reset the IC2PSC Bits */
+ TMRx->CCM1 &= (uint16_t)~((uint16_t)TMR_CCM1_IC2DIV);
+ /* Set the IC2PSC value */
+ TMRx->CCM1 |= (uint16_t)(TMR_ICPSC << 8);
+}
+
+/**
+ * @brief Sets the TMRx Input Capture 3 prescaler.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_ICPSC: specifies the Input Capture3 prescaler new value.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICDIV_DIV1: no prescaler
+ * @arg TMR_ICDIV_DIV2: capture is done once every 2 events
+ * @arg TMR_ICDIV_DIV4: capture is done once every 4 events
+ * @arg TMR_ICDIV_DIV8: capture is done once every 8 events
+ * @retval None
+ */
+void TMR_SetIC3DIV(TMR_Type* TMRx, uint16_t TMR_ICPSC)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_IC_DIV(TMR_ICPSC));
+ /* Reset the IC3PSC Bits */
+ TMRx->CCM2 &= (uint16_t)~((uint16_t)TMR_CCM2_IC3DIV);
+ /* Set the IC3PSC value */
+ TMRx->CCM2 |= TMR_ICPSC;
+}
+
+/**
+ * @brief Sets the TMRx Input Capture 4 prescaler.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_ICPSC: specifies the Input Capture4 prescaler new value.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICDIV_DIV1: no prescaler
+ * @arg TMR_ICDIV_DIV2: capture is done once every 2 events
+ * @arg TMR_ICDIV_DIV4: capture is done once every 4 events
+ * @arg TMR_ICDIV_DIV8: capture is done once every 8 events
+ * @retval None
+ */
+void TMR_SetIC4DIV(TMR_Type* TMRx, uint16_t TMR_ICPSC)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ assert_param(IS_TMR_IC_DIV(TMR_ICPSC));
+ /* Reset the IC4PSC Bits */
+ TMRx->CCM2 &= (uint16_t)~((uint16_t)TMR_CCM2_IC4DIV);
+ /* Set the IC4PSC value */
+ TMRx->CCM2 |= (uint16_t)(TMR_ICPSC << 8);
+}
+
+/**
+ * @brief Sets the TMRx Clock Division value.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select
+ * the TMR peripheral.
+ * @param TMR_CKD: specifies the clock division value.
+ * This parameter can be one of the following value:
+ * @arg TMR_CKD_DIV1: TDTS = Tck_tim
+ * @arg TMR_CKD_DIV2: TDTS = 2*Tck_tim
+ * @arg TMR_CKD_DIV4: TDTS = 4*Tck_tim
+ * @retval None
+ */
+void TMR_SetClockDivision(TMR_Type* TMRx, uint16_t TMR_CKD)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ assert_param(IS_TMR_CKD_DIV(TMR_CKD));
+ /* Reset the CKD Bits */
+ TMRx->CTRL1 &= (uint16_t)~((uint16_t)TMR_CTRL1_CLKDIV);
+ /* Set the CKD value */
+ TMRx->CTRL1 |= TMR_CKD;
+}
+
+/**
+ * @brief Gets the TMRx Input Capture 1 value.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @retval Capture Compare 1 Register value.
+ */
+uint32_t TMR_GetCapture1(TMR_Type* TMRx)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST8_PERIPH(TMRx));
+ /* Get the Capture 1 Register value */
+ return TMRx->CC1;
+}
+
+/**
+ * @brief Gets the TMRx Input Capture 2 value.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @retval Capture Compare 2 Register value.
+ */
+uint32_t TMR_GetCapture2(TMR_Type* TMRx)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST6_PERIPH(TMRx));
+ /* Get the Capture 2 Register value */
+ return TMRx->CC2;
+}
+
+/**
+ * @brief Gets the TMRx Input Capture 3 value.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @retval Capture Compare 3 Register value.
+ */
+uint32_t TMR_GetCapture3(TMR_Type* TMRx)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ /* Get the Capture 3 Register value */
+ return TMRx->CC3;
+}
+
+/**
+ * @brief Gets the TMRx Input Capture 4 value.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @retval Capture Compare 4 Register value.
+ */
+uint32_t TMR_GetCapture4(TMR_Type* TMRx)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_LIST3_PERIPH(TMRx));
+ /* Get the Capture 4 Register value */
+ return TMRx->CC4;
+}
+
+/**
+ * @brief Gets the TMRx Counter value.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @retval Counter Register value.
+ */
+uint32_t TMR_GetCounter(TMR_Type* TMRx)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ /* Get the Counter Register value */
+ return TMRx->CNT;
+}
+
+/**
+ * @brief Gets the TMRx Prescaler value.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @retval Prescaler Register value.
+ */
+uint16_t TMR_GetDIV(TMR_Type* TMRx)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ /* Get the Prescaler Register value */
+ return TMRx->DIV;
+}
+
+/**
+ * @brief Checks whether the specified TMR flag is set or not.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param TMR_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg TMR_FLAG_Update: TMR update Flag
+ * @arg TMR_FLAG_CC1: TMR Capture Compare 1 Flag
+ * @arg TMR_FLAG_CC2: TMR Capture Compare 2 Flag
+ * @arg TMR_FLAG_CC3: TMR Capture Compare 3 Flag
+ * @arg TMR_FLAG_CC4: TMR Capture Compare 4 Flag
+ * @arg TMR_FLAG_HALL: TMR Commutation Flag
+ * @arg TMR_FLAG_Trigger: TMR Trigger Flag
+ * @arg TMR_FLAG_Break: TMR Break Flag
+ * @arg TMR_FLAG_C1OF: TMR Capture Compare 1 overcapture Flag
+ * @arg TMR_FLAG_C2OF: TMR Capture Compare 2 overcapture Flag
+ * @arg TMR_FLAG_C3OF: TMR Capture Compare 3 overcapture Flag
+ * @arg TMR_FLAG_C4OF: TMR Capture Compare 4 overcapture Flag
+ * @note
+ * - TMR6 and TMR7 can have only one update flag.
+ * - TMR9, TMR12 and TMR15 can have only TMR_FLAG_Update, TMR_FLAG_CC1,
+ * TMR_FLAG_CC2 or TMR_FLAG_Trigger.
+ * - TMR10, TMR11, TMR13, TMR14 can have TMR_FLAG_Update or TMR_FLAG_CC1.
+ * - TMR_FLAG_Break is used only with TMR1, TMR8 and TMR15.
+ * - TMR_FLAG_HALL is used only with TMR1, TMR8, TMR15.
+ * @retval The new state of TMR_FLAG (SET or RESET).
+ */
+FlagStatus TMR_GetFlagStatus(TMR_Type* TMRx, uint16_t TMR_FLAG)
+{
+ ITStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_TMR_GET_FLAG(TMR_FLAG));
+
+ if ((TMRx->STS & TMR_FLAG) != (uint16_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the TMRx's pending flags.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param TMR_FLAG: specifies the flag bit to clear.
+ * This parameter can be any combination of the following values:
+ * @arg TMR_FLAG_Update: TMR update Flag
+ * @arg TMR_FLAG_CC1: TMR Capture Compare 1 Flag
+ * @arg TMR_FLAG_CC2: TMR Capture Compare 2 Flag
+ * @arg TMR_FLAG_CC3: TMR Capture Compare 3 Flag
+ * @arg TMR_FLAG_CC4: TMR Capture Compare 4 Flag
+ * @arg TMR_FLAG_HALL: TMR Commutation Flag
+ * @arg TMR_FLAG_Trigger: TMR Trigger Flag
+ * @arg TMR_FLAG_Break: TMR Break Flag
+ * @arg TMR_FLAG_C1OF: TMR Capture Compare 1 overcapture Flag
+ * @arg TMR_FLAG_C2OF: TMR Capture Compare 2 overcapture Flag
+ * @arg TMR_FLAG_C3OF: TMR Capture Compare 3 overcapture Flag
+ * @arg TMR_FLAG_C4OF: TMR Capture Compare 4 overcapture Flag
+ * @note
+ * - TMR6 and TMR7 can have only one update flag.
+ * - TMR9, TMR12 and TMR15 can have only TMR_FLAG_Update, TMR_FLAG_CC1,
+ * TMR_FLAG_CC2 or TMR_FLAG_Trigger.
+ * - TMR10, TMR11, TMR13, TMR14 can have TMR_FLAG_Update or TMR_FLAG_CC1.
+ * - TMR_FLAG_Break is used only with TMR1, TMR8 and TMR15.
+ * - TMR_FLAG_HALL is used only with TMR1, TMR8, TMR15.
+ * @retval None
+ */
+void TMR_ClearFlag(TMR_Type* TMRx, uint16_t TMR_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_TMR_CLEAR_FLAG(TMR_FLAG));
+
+ /* Clear the flags */
+ TMRx->STS = (uint16_t)~TMR_FLAG;
+}
+
+/**
+ * @brief Checks whether the TMR interrupt has occurred or not.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param TMR_INT: specifies the TMR interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg TMR_INT_Overflow: TMR update Interrupt source
+ * @arg TMR_INT_CC1: TMR Capture Compare 1 Interrupt source
+ * @arg TMR_INT_CC2: TMR Capture Compare 2 Interrupt source
+ * @arg TMR_INT_CC3: TMR Capture Compare 3 Interrupt source
+ * @arg TMR_INT_CC4: TMR Capture Compare 4 Interrupt source
+ * @arg TMR_INT_HALL: TMR Commutation Interrupt source
+ * @arg TMR_INT_Trigger: TMR Trigger Interrupt source
+ * @arg TMR_INT_Break: TMR Break Interrupt source
+ * @note
+ * - TMR6 and TMR7 can generate only an update interrupt.
+ * - TMR9, TMR12 and TMR15 can have only TMR_INT_Overflow, TMR_INT_CC1,
+ * TMR_INT_CC2 or TMR_INT_Trigger.
+ * - TMR10, TMR11, TMR13, TMR14 can have TMR_INT_Overflow or TMR_INT_CC1.
+ * - TMR_INT_Break is used only with TMR1, TMR8 and TMR15.
+ * - TMR_INT_HALL is used only with TMR1, TMR8, TMR15.
+ * @retval The new state of the TMR_INT(SET or RESET).
+ */
+ITStatus TMR_GetINTStatus(TMR_Type* TMRx, uint16_t TMR_INT)
+{
+ ITStatus bitstatus = RESET;
+ uint16_t itstatus = 0x0, itenable = 0x0;
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_TMR_GET_INT(TMR_INT));
+
+ itstatus = TMRx->STS & TMR_INT;
+
+ itenable = TMRx->DIE & TMR_INT;
+
+ if ((itstatus != (uint16_t)RESET) && (itenable != (uint16_t)RESET))
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the TMRx's interrupt pending bits.
+ * @param TMRx: where x can be 1 to 15 to select the TMR peripheral.
+ * @param TMR_INT: specifies the pending bit to clear.
+ * This parameter can be any combination of the following values:
+ * @arg TMR_INT_Overflow: TMR1 update Interrupt source
+ * @arg TMR_INT_CC1: TMR Capture Compare 1 Interrupt source
+ * @arg TMR_INT_CC2: TMR Capture Compare 2 Interrupt source
+ * @arg TMR_INT_CC3: TMR Capture Compare 3 Interrupt source
+ * @arg TMR_INT_CC4: TMR Capture Compare 4 Interrupt source
+ * @arg TMR_INT_HALL: TMR Commutation Interrupt source
+ * @arg TMR_INT_Trigger: TMR Trigger Interrupt source
+ * @arg TMR_INT_Break: TMR Break Interrupt source
+ * @note
+ * - TMR6 and TMR7 can generate only an update interrupt.
+ * - TMR9, TMR12 and TMR15 can have only TMR_INT_Overflow, TMR_INT_CC1,
+ * TMR_INT_CC2 or TMR_INT_Trigger.
+ * - TMR10, TMR11, TMR13, TMR14 can have TMR_INT_Overflow or TMR_INT_CC1.
+ * - TMR_INT_Break is used only with TMR1, TMR8 and TMR15.
+ * - TMR_INT_HALL is used only with TMR1, TMR8, TMR15.
+ * @retval None
+ */
+void TMR_ClearITPendingBit(TMR_Type* TMRx, uint16_t TMR_INT)
+{
+ /* Check the parameters */
+ assert_param(IS_TMR_ALL_PERIPH(TMRx));
+ assert_param(IS_TMR_INT(TMR_INT));
+ /* Clear the INT pending Bit */
+ TMRx->STS = (uint16_t)~TMR_INT;
+}
+
+/**
+ * @brief Configure the TI1 as Input.
+ * @param TMRx: where x can be 1 to 15 except 6 and 7 to select the TMR peripheral.
+ * @param TMR_ICPolarity : The Input Polarity.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICPolarity_Rising
+ * @arg TMR_ICPolarity_Falling
+ * @param TMR_ICSelection: specifies the input to be used.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICSelection_DirectTI: TMR Input 1 is selected to be connected to IC1.
+ * @arg TMR_ICSelection_IndirectTI: TMR Input 1 is selected to be connected to IC2.
+ * @arg TMR_ICSelection_TRC: TMR Input 1 is selected to be connected to TRC.
+ * @param TMR_ICFilter: Specifies the Input Capture Filter.
+ * This parameter must be a value between 0x00 and 0x0F.
+ * @retval None
+ */
+static void TI1_Config(TMR_Type* TMRx, uint16_t TMR_ICPolarity, uint16_t TMR_ICSelection,
+ uint16_t TMR_ICFilter)
+{
+ uint16_t tmpccmr1 = 0, tmpccer = 0;
+ /* Disable the Channel 1: Reset the CC1E Bit */
+ TMRx->CCE &= (uint16_t)~((uint16_t)TMR_CCE_C1EN);
+ tmpccmr1 = TMRx->CCM1;
+ tmpccer = TMRx->CCE;
+ /* Select the Input and set the filter */
+ tmpccmr1 &= (uint16_t)(((uint16_t)~((uint16_t)TMR_CCM1_C1SEL)) & ((uint16_t)~((uint16_t)TMR_CCM1_IC1F)));
+ tmpccmr1 |= (uint16_t)(TMR_ICSelection | (uint16_t)(TMR_ICFilter << (uint16_t)4));
+
+
+ if((TMRx == TMR1) || (TMRx == TMR2) ||
+#if !defined (AT32F415xx)
+ (TMRx == TMR8) ||
+#endif
+#if defined (AT32F403xx)
+ (TMRx == TMR15) ||
+#endif
+ (TMRx == TMR3) || (TMRx == TMR4) || (TMRx == TMR5))
+ {
+ /* Select the Polarity and set the CC1E Bit */
+ tmpccer &= (uint16_t)~((uint16_t)(TMR_CCE_C1P));
+ tmpccer |= (uint16_t)(TMR_ICPolarity | (uint16_t)TMR_CCE_C1EN);
+ }
+ else
+ {
+ /* Select the Polarity and set the CC1E Bit */
+ tmpccer &= (uint16_t)~((uint16_t)(TMR_CCE_C1P | TMR_CCE_C1NP));
+ tmpccer |= (uint16_t)(TMR_ICPolarity | (uint16_t)TMR_CCE_C1EN);
+ }
+
+ /* Write to TMRx CCMR1 and CCE registers */
+ TMRx->CCM1 = tmpccmr1;
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Configure the TI2 as Input.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5, 8, 9, 12 or 15 to select the TMR peripheral.
+ * @param TMR_ICPolarity : The Input Polarity.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICPolarity_Rising
+ * @arg TMR_ICPolarity_Falling
+ * @param TMR_ICSelection: specifies the input to be used.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICSelection_DirectTI: TMR Input 2 is selected to be connected to IC2.
+ * @arg TMR_ICSelection_IndirectTI: TMR Input 2 is selected to be connected to IC1.
+ * @arg TMR_ICSelection_TRC: TMR Input 2 is selected to be connected to TRC.
+ * @param TMR_ICFilter: Specifies the Input Capture Filter.
+ * This parameter must be a value between 0x00 and 0x0F.
+ * @retval None
+ */
+static void TI2_Config(TMR_Type* TMRx, uint16_t TMR_ICPolarity, uint16_t TMR_ICSelection,
+ uint16_t TMR_ICFilter)
+{
+ uint16_t tmpccmr1 = 0, tmpccer = 0, tmp = 0;
+ /* Disable the Channel 2: Reset the CC2E Bit */
+ TMRx->CCE &= (uint16_t)~((uint16_t)TMR_CCE_C2EN);
+ tmpccmr1 = TMRx->CCM1;
+ tmpccer = TMRx->CCE;
+ tmp = (uint16_t)(TMR_ICPolarity << 4);
+ /* Select the Input and set the filter */
+ tmpccmr1 &= (uint16_t)(((uint16_t)~((uint16_t)TMR_CCM1_C2SEL)) & ((uint16_t)~((uint16_t)TMR_CCM1_IC2DF)));
+ tmpccmr1 |= (uint16_t)(TMR_ICFilter << 12);
+ tmpccmr1 |= (uint16_t)(TMR_ICSelection << 8);
+
+ if((TMRx == TMR1) || (TMRx == TMR2) ||
+#if !defined (AT32F415xx)
+ (TMRx == TMR8) ||
+#endif
+#if defined (AT32F403xx)
+ (TMRx == TMR15) ||
+#endif
+ (TMRx == TMR3) || (TMRx == TMR4) || (TMRx == TMR5))
+ {
+ /* Select the Polarity and set the CC2E Bit */
+ tmpccer &= (uint16_t)~((uint16_t)(TMR_CCE_C2P));
+ tmpccer |= (uint16_t)(tmp | (uint16_t)TMR_CCE_C2EN);
+ }
+ else
+ {
+ /* Select the Polarity and set the CC2E Bit */
+ tmpccer &= (uint16_t)~((uint16_t)(TMR_CCE_C2P | TMR_CCE_C2NP));
+ tmpccer |= (uint16_t)(tmp | (uint16_t)TMR_CCE_C2EN);
+ }
+
+ /* Write to TMRx CCMR1 and CCE registers */
+ TMRx->CCM1 = tmpccmr1 ;
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Configure the TI3 as Input.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_ICPolarity : The Input Polarity.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICPolarity_Rising
+ * @arg TMR_ICPolarity_Falling
+ * @param TMR_ICSelection: specifies the input to be used.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICSelection_DirectTI: TMR Input 3 is selected to be connected to IC3.
+ * @arg TMR_ICSelection_IndirectTI: TMR Input 3 is selected to be connected to IC4.
+ * @arg TMR_ICSelection_TRC: TMR Input 3 is selected to be connected to TRC.
+ * @param TMR_ICFilter: Specifies the Input Capture Filter.
+ * This parameter must be a value between 0x00 and 0x0F.
+ * @retval None
+ */
+static void TI3_Config(TMR_Type* TMRx, uint16_t TMR_ICPolarity, uint16_t TMR_ICSelection,
+ uint16_t TMR_ICFilter)
+{
+ uint16_t tmpccmr2 = 0, tmpccer = 0, tmp = 0;
+ /* Disable the Channel 3: Reset the CC3E Bit */
+ TMRx->CCE &= (uint16_t)~((uint16_t)TMR_CCE_C3EN);
+ tmpccmr2 = TMRx->CCM2;
+ tmpccer = TMRx->CCE;
+ tmp = (uint16_t)(TMR_ICPolarity << 8);
+ /* Select the Input and set the filter */
+ tmpccmr2 &= (uint16_t)(((uint16_t)~((uint16_t)TMR_CCM2_C3SEL)) & ((uint16_t)~((uint16_t)TMR_CCM2_IC3DF)));
+ tmpccmr2 |= (uint16_t)(TMR_ICSelection | (uint16_t)(TMR_ICFilter << (uint16_t)4));
+
+ if((TMRx == TMR1) || (TMRx == TMR2) ||
+#if !defined (AT32F415xx)
+ (TMRx == TMR8) ||
+#endif
+#if defined (AT32F403xx)
+ (TMRx == TMR15) ||
+#endif
+ (TMRx == TMR3) || (TMRx == TMR4) || (TMRx == TMR5))
+ {
+ /* Select the Polarity and set the CC3E Bit */
+ tmpccer &= (uint16_t)~((uint16_t)(TMR_CCE_C3P));
+ tmpccer |= (uint16_t)(tmp | (uint16_t)TMR_CCE_C3EN);
+ }
+ else
+ {
+ /* Select the Polarity and set the CC3E Bit */
+ tmpccer &= (uint16_t)~((uint16_t)(TMR_CCE_C3P | TMR_CCE_C3NP));
+ tmpccer |= (uint16_t)(tmp | (uint16_t)TMR_CCE_C3EN);
+ }
+
+ /* Write to TMRx CCMR2 and CCE registers */
+ TMRx->CCM2 = tmpccmr2;
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @brief Configure the TI4 as Input.
+ * @param TMRx: where x can be 1, 2, 3, 4, 5 or 8 to select the TMR peripheral.
+ * @param TMR_ICPolarity : The Input Polarity.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICPolarity_Rising
+ * @arg TMR_ICPolarity_Falling
+ * @param TMR_ICSelection: specifies the input to be used.
+ * This parameter can be one of the following values:
+ * @arg TMR_ICSelection_DirectTI: TMR Input 4 is selected to be connected to IC4.
+ * @arg TMR_ICSelection_IndirectTI: TMR Input 4 is selected to be connected to IC3.
+ * @arg TMR_ICSelection_TRC: TMR Input 4 is selected to be connected to TRC.
+ * @param TMR_ICFilter: Specifies the Input Capture Filter.
+ * This parameter must be a value between 0x00 and 0x0F.
+ * @retval None
+ */
+static void TI4_Config(TMR_Type* TMRx, uint16_t TMR_ICPolarity, uint16_t TMR_ICSelection,
+ uint16_t TMR_ICFilter)
+{
+ uint16_t tmpccmr2 = 0, tmpccer = 0, tmp = 0;
+
+ /* Disable the Channel 4: Reset the CC4E Bit */
+ TMRx->CCE &= (uint16_t)~((uint16_t)TMR_CCE_C4EN);
+ tmpccmr2 = TMRx->CCM2;
+ tmpccer = TMRx->CCE;
+ tmp = (uint16_t)(TMR_ICPolarity << 12);
+ /* Select the Input and set the filter */
+ tmpccmr2 &= (uint16_t)((uint16_t)(~(uint16_t)TMR_CCM2_CC4S) & ((uint16_t)~((uint16_t)TMR_CCM2_IC4DF)));
+ tmpccmr2 |= (uint16_t)(TMR_ICSelection << 8);
+ tmpccmr2 |= (uint16_t)(TMR_ICFilter << 12);
+
+ if((TMRx == TMR1) || (TMRx == TMR2) ||
+#if !defined (AT32F415xx)
+ (TMRx == TMR8) ||
+#endif
+#if defined (AT32F403xx)
+ (TMRx == TMR15) ||
+#endif
+ (TMRx == TMR3) || (TMRx == TMR4) || (TMRx == TMR5))
+ {
+ /* Select the Polarity and set the CC4E Bit */
+ tmpccer &= (uint16_t)~((uint16_t)(TMR_CCE_C4P));
+ tmpccer |= (uint16_t)(tmp | (uint16_t)TMR_CCE_C4EN);
+ }
+ else
+ {
+ /* Select the Polarity and set the CC4E Bit */
+ tmpccer &= (uint16_t)~((uint16_t)(TMR_CCE_C3P | TMR_CCE_C4NP));
+ tmpccer |= (uint16_t)(tmp | (uint16_t)TMR_CCE_C4EN);
+ }
+
+ /* Write to TMRx CCMR2 and CCE registers */
+ TMRx->CCM2 = tmpccmr2;
+ TMRx->CCE = tmpccer;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_usart.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_usart.c
new file mode 100644
index 0000000000000000000000000000000000000000..14a72dd96e5015d5249ddb853a7a74ad258ad920
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_usart.c
@@ -0,0 +1,1056 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_usart.c
+ * Description : at32f4xx USART source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_usart.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup USART
+ * @brief USART driver modules
+ * @{
+ */
+
+/** @defgroup USART_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_Private_Defines
+ * @{
+ */
+
+#define CTRL1_UEN_Set ((uint16_t)0x2000) /*!< USART Enable Mask */
+#define CTRL1_UEN_Reset ((uint16_t)0xDFFF) /*!< USART Disable Mask */
+
+#define CTRL1_WUMODE_Mask ((uint16_t)0xF7FF) /*!< USART WakeUp Method Mask */
+
+#define CTRL1_RECMUTE_Set ((uint16_t)0x0002) /*!< USART mute mode Enable Mask */
+#define CTRL1_RECMUTE_Reset ((uint16_t)0xFFFD) /*!< USART mute mode Enable Mask */
+#define CTRL1_SBRK_Set ((uint16_t)0x0001) /*!< USART Break Character send Mask */
+#define CTRL1_CLEAR_MASK ((uint16_t)0xE9F3) /*!< USART CTRL1 Mask */
+#define CTRL2_ADDRESS_Mask ((uint16_t)0xFFF0) /*!< USART address Mask */
+
+#define CTRL2_LINEN_Set ((uint16_t)0x4000) /*!< USART LIN Enable Mask */
+#define CTRL2_LINEN_Reset ((uint16_t)0xBFFF) /*!< USART LIN Disable Mask */
+
+#define CTRL2_LBDLEN_Mask ((uint16_t)0xFFDF) /*!< USART LIN Break detection Mask */
+#define CTRL2_STOPB_CLEAR_Mask ((uint16_t)0xCFFF) /*!< USART CTRL2 STOP Bits Mask */
+#define CTRL2_CLOCK_CLEAR_Mask ((uint16_t)0xF0FF) /*!< USART CTRL2 Clock Mask */
+
+#define CTRL3_SCMEN_Set ((uint16_t)0x0020) /*!< USART SC Enable Mask */
+#define CTRL3_SCMEN_Reset ((uint16_t)0xFFDF) /*!< USART SC Disable Mask */
+
+#define CTRL3_NACKEN_Set ((uint16_t)0x0010) /*!< USART SC NACK Enable Mask */
+#define CTRL3_NACKEN_Reset ((uint16_t)0xFFEF) /*!< USART SC NACK Disable Mask */
+
+#define CTRL3_HALFSEL_Set ((uint16_t)0x0008) /*!< USART Half-Duplex Enable Mask */
+#define CTRL3_HALFSEL_Reset ((uint16_t)0xFFF7) /*!< USART Half-Duplex Disable Mask */
+
+#define CTRL3_IRDALP_Mask ((uint16_t)0xFFFB) /*!< USART IrDA LowPower mode Mask */
+#define CTRL3_CLEAR_Mask ((uint16_t)0xFCFF) /*!< USART CR3 Mask */
+
+#define CTRL3_IRDAEN_Set ((uint16_t)0x0002) /*!< USART IrDA Enable Mask */
+#define CTRL3_IRDAEN_Reset ((uint16_t)0xFFFD) /*!< USART IrDA Disable Mask */
+#define GTPR_LSB_Mask ((uint16_t)0x00FF) /*!< Guard Time Register LSB Mask */
+#define GTPR_MSB_Mask ((uint16_t)0xFF00) /*!< Guard Time Register MSB Mask */
+#define INT_Mask ((uint16_t)0x001F) /*!< USART Interrupt Mask */
+
+/* USART OverSampling-8 Mask */
+#define CTRL1_OVER8_Set ((u16)0x8000) /* USART OVER8 mode Enable Mask */
+#define CTRL1_OVER8_Reset ((u16)0x7FFF) /* USART OVER8 mode Disable Mask */
+
+/* USART One Bit Sampling Mask */
+#define CTRL3_ONEBITE_Set ((u16)0x0800) /* USART ONEBITE mode Enable Mask */
+#define CTRL3_ONEBITE_Reset ((u16)0xF7FF) /* USART ONEBITE mode Disable Mask */
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the USARTx peripheral registers to their default reset values.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @retval None
+ */
+void USART_Reset(USART_Type* USARTx)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+
+ if (USARTx == USART1)
+ {
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_USART1, ENABLE);
+ RCC_APB2PeriphResetCmd(RCC_APB2PERIPH_USART1, DISABLE);
+ }
+ else if (USARTx == USART2)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_USART2, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_USART2, DISABLE);
+ }
+ else if (USARTx == USART3)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_USART3, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_USART3, DISABLE);
+ }
+ else if (USARTx == UART4)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_UART4, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_UART4, DISABLE);
+ }
+ else if (USARTx == UART5)
+ {
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_UART5, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_UART5, DISABLE);
+ }
+}
+
+/**
+ * @brief Initializes the USARTx peripheral according to the specified
+ * parameters in the USART_InitStruct .
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_InitStruct: pointer to a USART_InitType structure
+ * that contains the configuration information for the specified USART
+ * peripheral.
+ * @retval None
+ */
+void USART_Init(USART_Type* USARTx, USART_InitType* USART_InitStruct)
+{
+ uint32_t tmpreg = 0x00, apbclock = 0x00;
+ uint32_t integerdivider = 0x00;
+ uint32_t fractionaldivider = 0x00;
+ uint32_t usartxbase = 0;
+ RCC_ClockType RCC_ClocksStatus;
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_BAUDRATE(USART_InitStruct->USART_BaudRate));
+ assert_param(IS_USART_WORD_LENGTH(USART_InitStruct->USART_WordLength));
+ assert_param(IS_USART_STOPBITS(USART_InitStruct->USART_StopBits));
+ assert_param(IS_USART_PARITY(USART_InitStruct->USART_Parity));
+ assert_param(IS_USART_MODE(USART_InitStruct->USART_Mode));
+ assert_param(IS_USART_HARDWARE_FLOW_CONTROL(USART_InitStruct->USART_HardwareFlowControl));
+
+ /* The hardware flow control is available only for USART1, USART2 and USART3 */
+ if (USART_InitStruct->USART_HardwareFlowControl != USART_HardwareFlowControl_None)
+ {
+ assert_param(IS_USART_123_PERIPH(USARTx));
+ }
+
+ usartxbase = (uint32_t)USARTx;
+
+ /*---------------------------- USART CTRL2 Configuration -----------------------*/
+ tmpreg = USARTx->CTRL2;
+ /* Clear STOP[13:12] bits */
+ tmpreg &= CTRL2_STOPB_CLEAR_Mask;
+ /* Configure the USART Stop Bits, Clock, CPOL, CPHA and LastBit ------------*/
+ /* Set STOP[13:12] bits according to USART_StopBits value */
+ tmpreg |= (uint32_t)USART_InitStruct->USART_StopBits;
+
+ /* Write to USART CTRL2 */
+ USARTx->CTRL2 = (uint16_t)tmpreg;
+
+ /*---------------------------- USART CTRL1 Configuration -----------------------*/
+ tmpreg = USARTx->CTRL1;
+ /* Clear M, PCE, PS, TE and RE bits */
+ tmpreg &= CTRL1_CLEAR_MASK;
+ /* Configure the USART Word Length, Parity and mode ----------------------- */
+ /* Set the M bits according to USART_WordLength value */
+ /* Set PCE and PS bits according to USART_Parity value */
+ /* Set TE and RE bits according to USART_Mode value */
+ tmpreg |= (uint32_t)USART_InitStruct->USART_WordLength | USART_InitStruct->USART_Parity |
+ USART_InitStruct->USART_Mode;
+ /* Write to USART CTRL1 */
+ USARTx->CTRL1 = (uint16_t)tmpreg;
+
+ /*---------------------------- USART CR3 Configuration -----------------------*/
+ tmpreg = USARTx->CTRL3;
+ /* Clear CTSE and RTSE bits */
+ tmpreg &= CTRL3_CLEAR_Mask;
+ /* Configure the USART HFC -------------------------------------------------*/
+ /* Set CTSE and RTSE bits according to USART_HardwareFlowControl value */
+ tmpreg |= USART_InitStruct->USART_HardwareFlowControl;
+ /* Write to USART CR3 */
+ USARTx->CTRL3 = (uint16_t)tmpreg;
+
+ /*---------------------------- USART BRR Configuration -----------------------*/
+ /* Configure the USART Baud Rate -------------------------------------------*/
+ RCC_GetClocksFreq(&RCC_ClocksStatus);
+
+ if (usartxbase == USART1_BASE)
+ {
+ apbclock = RCC_ClocksStatus.APB2CLK_Freq;
+ }
+ else
+ {
+ apbclock = RCC_ClocksStatus.APB1CLK_Freq;
+ }
+
+ /* Determine the integer part */
+ if ((USARTx->CTRL1 & CTRL1_OVER8_Set) != 0)
+ {
+ /* Integer part computing in case Oversampling mode is 8 Samples */
+ integerdivider = ((25 * apbclock) / (2 * (USART_InitStruct->USART_BaudRate)));
+ }
+ else /* if ((USARTx->CTRL1 & CTRL1_OVER8_Set) == 0) */
+ {
+ /* Integer part computing in case Oversampling mode is 16 Samples */
+ integerdivider = ((25 * apbclock) / (4 * (USART_InitStruct->USART_BaudRate)));
+ }
+
+ tmpreg = (integerdivider / 100) << 4;
+
+ /* Determine the fractional part */
+ fractionaldivider = integerdivider - (100 * (tmpreg >> 4));
+
+ /* Implement the fractional part in the register */
+ if ((USARTx->CTRL1 & CTRL1_OVER8_Set) != 0)
+ {
+ tmpreg |= ((((fractionaldivider * 8) + 50) / 100)) & ((uint8_t)0x07);
+ }
+ else /* if ((USARTx->CTRL1 & CTRL1_OVER8_Set) == 0) */
+ {
+ tmpreg |= ((((fractionaldivider * 16) + 50) / 100)) & ((uint8_t)0x0F);
+ }
+
+ /* Write to USART BRR */
+ USARTx->BAUDR = (uint16_t)tmpreg;
+}
+
+/**
+ * @brief Fills each USART_InitStruct member with its default value.
+ * @param USART_InitStruct: pointer to a USART_InitType structure
+ * which will be initialized.
+ * @retval None
+ */
+void USART_StructInit(USART_InitType* USART_InitStruct)
+{
+ /* USART_InitStruct members default value */
+ USART_InitStruct->USART_BaudRate = 9600;
+ USART_InitStruct->USART_WordLength = USART_WordLength_8b;
+ USART_InitStruct->USART_StopBits = USART_StopBits_1;
+ USART_InitStruct->USART_Parity = USART_Parity_No ;
+ USART_InitStruct->USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
+ USART_InitStruct->USART_HardwareFlowControl = USART_HardwareFlowControl_None;
+}
+
+/**
+ * @brief Initializes the USARTx peripheral Clock according to the
+ * specified parameters in the USART_ClockInitStruct .
+ * @param USARTx: where x can be 1, 2, 3 to select the USART peripheral.
+ * @param USART_ClockInitStruct: pointer to a USART_ClockInitType
+ * structure that contains the configuration information for the specified
+ * USART peripheral.
+ * @note The Smart Card and Synchronous modes are not available for UART4 and UART5.
+ * @retval None
+ */
+void USART_ClockInit(USART_Type* USARTx, USART_ClockInitType* USART_ClockInitStruct)
+{
+ uint32_t tmpreg = 0x00;
+ /* Check the parameters */
+ assert_param(IS_USART_123_PERIPH(USARTx));
+ assert_param(IS_USART_CLOCK(USART_ClockInitStruct->USART_Clock));
+ assert_param(IS_USART_CPOL(USART_ClockInitStruct->USART_CPOL));
+ assert_param(IS_USART_CPHA(USART_ClockInitStruct->USART_CPHA));
+ assert_param(IS_USART_LASTBIT(USART_ClockInitStruct->USART_LastBit));
+
+ /*---------------------------- USART CTRL2 Configuration -----------------------*/
+ tmpreg = USARTx->CTRL2;
+ /* Clear CLKEN, CPOL, CPHA and LBCL bits */
+ tmpreg &= CTRL2_CLOCK_CLEAR_Mask;
+ /* Configure the USART Clock, CPOL, CPHA and LastBit ------------*/
+ /* Set CLKEN bit according to USART_Clock value */
+ /* Set CPOL bit according to USART_CPOL value */
+ /* Set CPHA bit according to USART_CPHA value */
+ /* Set LBCL bit according to USART_LastBit value */
+ tmpreg |= (uint32_t)USART_ClockInitStruct->USART_Clock | USART_ClockInitStruct->USART_CPOL |
+ USART_ClockInitStruct->USART_CPHA | USART_ClockInitStruct->USART_LastBit;
+ /* Write to USART CTRL2 */
+ USARTx->CTRL2 = (uint16_t)tmpreg;
+}
+
+/**
+ * @brief Fills each USART_ClockInitStruct member with its default value.
+ * @param USART_ClockInitStruct: pointer to a USART_ClockInitType
+ * structure which will be initialized.
+ * @retval None
+ */
+void USART_ClockStructInit(USART_ClockInitType* USART_ClockInitStruct)
+{
+ /* USART_ClockInitStruct members default value */
+ USART_ClockInitStruct->USART_Clock = USART_Clock_Disable;
+ USART_ClockInitStruct->USART_CPOL = USART_CPOL_Low;
+ USART_ClockInitStruct->USART_CPHA = USART_CPHA_1Edge;
+ USART_ClockInitStruct->USART_LastBit = USART_LastBit_Disable;
+}
+
+/**
+ * @brief Enables or disables the specified USART peripheral.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param NewState: new state of the USARTx peripheral.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void USART_Cmd(USART_Type* USARTx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected USART by setting the UE bit in the CTRL1 register */
+ USARTx->CTRL1 |= CTRL1_UEN_Set;
+ }
+ else
+ {
+ /* Disable the selected USART by clearing the UE bit in the CTRL1 register */
+ USARTx->CTRL1 &= CTRL1_UEN_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified USART interrupts.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_INT: specifies the USART interrupt sources to be enabled or disabled.
+ * This parameter can be one of the following values:
+ * @arg USART_INT_CTSF: CTS change interrupt (not available for UART4 and UART5)
+ * @arg USART_INT_LBDF: LIN Break detection interrupt
+ * @arg USART_INT_TDE: Transmit Data Register empty interrupt
+ * @arg USART_INT_TRAC: Transmission complete interrupt
+ * @arg USART_INT_RDNE: Receive Data register not empty interrupt
+ * @arg USART_INT_IDLEF: Idle line detection interrupt
+ * @arg USART_INT_PERR: Parity Error interrupt
+ * @arg USART_INT_ERR: Error interrupt(Frame error, noise error, overrun error)
+ * @param NewState: new state of the specified USARTx interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void USART_INTConfig(USART_Type* USARTx, uint16_t USART_INT, FunctionalState NewState)
+{
+ uint32_t usartreg = 0x00, itpos = 0x00, itmask = 0x00;
+ uint32_t usartxbase = 0x00;
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_CONFIG_INT(USART_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ /* The CTS interrupt is not available for UART4 and UART5 */
+ if (USART_INT == USART_INT_CTSF)
+ {
+ assert_param(IS_USART_123_PERIPH(USARTx));
+ }
+
+ usartxbase = (uint32_t)USARTx;
+
+ /* Get the USART register index */
+ usartreg = (((uint8_t)USART_INT) >> 0x05);
+
+ /* Get the interrupt position */
+ itpos = USART_INT & INT_Mask;
+ itmask = (((uint32_t)0x01) << itpos);
+
+ if (usartreg == 0x01) /* The INT is in CTRL1 register */
+ {
+ usartxbase += 0x0C;
+ }
+ else if (usartreg == 0x02) /* The INT is in CTRL2 register */
+ {
+ usartxbase += 0x10;
+ }
+ else /* The INT is in CR3 register */
+ {
+ usartxbase += 0x14;
+ }
+
+ if (NewState != DISABLE)
+ {
+ *(__IO uint32_t*)usartxbase |= itmask;
+ }
+ else
+ {
+ *(__IO uint32_t*)usartxbase &= ~itmask;
+ }
+}
+
+/**
+ * @brief Enables or disables the USART's DMA interface.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_DMAReq: specifies the DMA request.
+ * This parameter can be any combination of the following values:
+ * @arg USART_DMAReq_Tx: USART DMA transmit request
+ * @arg USART_DMAReq_Rx: USART DMA receive request
+ * @param NewState: new state of the DMA Request sources.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void USART_DMACmd(USART_Type* USARTx, uint16_t USART_DMAReq, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_DMAREQ(USART_DMAReq));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the DMA transfer for selected requests by setting the DMAT and/or
+ DMAR bits in the USART CR3 register */
+ USARTx->CTRL3 |= USART_DMAReq;
+ }
+ else
+ {
+ /* Disable the DMA transfer for selected requests by clearing the DMAT and/or
+ DMAR bits in the USART CR3 register */
+ USARTx->CTRL3 &= (uint16_t)~USART_DMAReq;
+ }
+}
+
+/**
+ * @brief Sets the address of the USART node.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_Address: Indicates the address of the USART node.
+ * @retval None
+ */
+void USART_SetAddress(USART_Type* USARTx, uint8_t USART_Address)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_ADDRESS(USART_Address));
+
+ /* Clear the USART address */
+ USARTx->CTRL2 &= CTRL2_ADDRESS_Mask;
+ /* Set the USART address node */
+ USARTx->CTRL2 |= USART_Address;
+}
+
+/**
+ * @brief Selects the USART WakeUp method.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_WakeUp: specifies the USART wakeup method.
+ * This parameter can be one of the following values:
+ * @arg USART_WakeUp_IdleLine: WakeUp by an idle line detection
+ * @arg USART_WakeUp_AddressMark: WakeUp by an address mark
+ * @retval None
+ */
+void USART_WakeUpConfig(USART_Type* USARTx, uint16_t USART_WakeUp)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_WAKEUP(USART_WakeUp));
+
+ USARTx->CTRL1 &= CTRL1_WUMODE_Mask;
+ USARTx->CTRL1 |= USART_WakeUp;
+}
+
+/**
+ * @brief Determines if the USART is in mute mode or not.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param NewState: new state of the USART mute mode.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void USART_ReceiverWakeUpCmd(USART_Type* USARTx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the USART mute mode by setting the RWU bit in the CTRL1 register */
+ USARTx->CTRL1 |= CTRL1_RECMUTE_Set;
+ }
+ else
+ {
+ /* Disable the USART mute mode by clearing the RWU bit in the CTRL1 register */
+ USARTx->CTRL1 &= CTRL1_RECMUTE_Reset;
+ }
+}
+
+/**
+ * @brief Sets the USART LIN Break detection length.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_LINBreakDetectLength: specifies the LIN break detection length.
+ * This parameter can be one of the following values:
+ * @arg USART_LINBreakDetectLength_10b: 10-bit break detection
+ * @arg USART_LINBreakDetectLength_11b: 11-bit break detection
+ * @retval None
+ */
+void USART_LINBreakDetectLengthConfig(USART_Type* USARTx, uint16_t USART_LINBreakDetectLength)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_LIN_BREAK_DETECT_LENGTH(USART_LINBreakDetectLength));
+
+ USARTx->CTRL2 &= CTRL2_LBDLEN_Mask;
+ USARTx->CTRL2 |= USART_LINBreakDetectLength;
+}
+
+/**
+ * @brief Enables or disables the USARTs LIN mode.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param NewState: new state of the USART LIN mode.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void USART_LINCmd(USART_Type* USARTx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the LIN mode by setting the LINEN bit in the CTRL2 register */
+ USARTx->CTRL2 |= CTRL2_LINEN_Set;
+ }
+ else
+ {
+ /* Disable the LIN mode by clearing the LINEN bit in the CTRL2 register */
+ USARTx->CTRL2 &= CTRL2_LINEN_Reset;
+ }
+}
+
+/**
+ * @brief Transmits single data through the USARTx peripheral.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param Data: the data to transmit.
+ * @retval None
+ */
+void USART_SendData(USART_Type* USARTx, uint16_t Data)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_DATA(Data));
+
+ /* Transmit Data */
+ USARTx->DT = (Data & (uint16_t)0x01FF);
+}
+
+/**
+ * @brief Returns the most recent received data by the USARTx peripheral.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @retval The received data.
+ */
+uint16_t USART_ReceiveData(USART_Type* USARTx)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+
+ /* Receive Data */
+ return (uint16_t)(USARTx->DT & (uint16_t)0x01FF);
+}
+
+/**
+ * @brief Transmits break characters.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @retval None
+ */
+void USART_SendBreak(USART_Type* USARTx)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+
+ /* Send break characters */
+ USARTx->CTRL1 |= CTRL1_SBRK_Set;
+}
+
+/**
+ * @brief Sets the specified USART guard time.
+ * @param USARTx: where x can be 1, 2 or 3 to select the USART peripheral.
+ * @param USART_GuardTime: specifies the guard time.
+ * @note The guard time bits are not available for UART4 and UART5.
+ * @retval None
+ */
+void USART_SetGuardTime(USART_Type* USARTx, uint8_t USART_GuardTime)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_123_PERIPH(USARTx));
+
+ /* Clear the USART Guard time */
+ USARTx->GTP &= GTPR_LSB_Mask;
+ /* Set the USART guard time */
+ USARTx->GTP |= (uint16_t)((uint16_t)USART_GuardTime << 0x08);
+}
+
+/**
+ * @brief Sets the system clock prescaler.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_Prescaler: specifies the prescaler clock.
+ * @note The function is used for IrDA mode with UART4 and UART5.
+ * @retval None
+ */
+void USART_SetPrescaler(USART_Type* USARTx, uint8_t USART_Prescaler)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+
+ /* Clear the USART prescaler */
+ USARTx->GTP &= GTPR_MSB_Mask;
+ /* Set the USART prescaler */
+ USARTx->GTP |= USART_Prescaler;
+}
+
+/**
+ * @brief Enables or disables the USARTs Smart Card mode.
+ * @param USARTx: where x can be 1, 2 or 3 to select the USART peripheral.
+ * @param NewState: new state of the Smart Card mode.
+ * This parameter can be: ENABLE or DISABLE.
+ * @note The Smart Card mode is not available for UART4 and UART5.
+ * @retval None
+ */
+void USART_SmartCardCmd(USART_Type* USARTx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_123_PERIPH(USARTx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the SC mode by setting the SCEN bit in the CR3 register */
+ USARTx->CTRL3 |= CTRL3_SCMEN_Set;
+ }
+ else
+ {
+ /* Disable the SC mode by clearing the SCEN bit in the CR3 register */
+ USARTx->CTRL3 &= CTRL3_SCMEN_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables NACK transmission.
+ * @param USARTx: where x can be 1, 2 or 3 to select the USART peripheral.
+ * @param NewState: new state of the NACK transmission.
+ * This parameter can be: ENABLE or DISABLE.
+ * @note The Smart Card mode is not available for UART4 and UART5.
+ * @retval None
+ */
+void USART_SmartCardNACKCmd(USART_Type* USARTx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_123_PERIPH(USARTx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the NACK transmission by setting the NACK bit in the CR3 register */
+ USARTx->CTRL3 |= CTRL3_NACKEN_Set;
+ }
+ else
+ {
+ /* Disable the NACK transmission by clearing the NACK bit in the CR3 register */
+ USARTx->CTRL3 &= CTRL3_NACKEN_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables the USARTs Half Duplex communication.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param NewState: new state of the USART Communication.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void USART_HalfDuplexCmd(USART_Type* USARTx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the Half-Duplex mode by setting the HDSEL bit in the CR3 register */
+ USARTx->CTRL3 |= CTRL3_HALFSEL_Set;
+ }
+ else
+ {
+ /* Disable the Half-Duplex mode by clearing the HDSEL bit in the CR3 register */
+ USARTx->CTRL3 &= CTRL3_HALFSEL_Reset;
+ }
+}
+
+
+/**
+ * @brief Enables or disables the USART's 8x oversampling mode.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param NewState: new state of the USART one bit sampling method.
+ * This parameter can be: ENABLE or DISABLE.
+ * @note
+ * This function has to be called before calling USART_Init()
+ * function in order to have correct baudrate Divider value.
+ * @retval None
+ */
+void USART_OverSampling8Cmd(USART_Type* USARTx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the 8x Oversampling mode by setting the OVER8 bit in the CTRL1 register */
+ USARTx->CTRL1 |= CTRL1_OVER8_Set;
+ }
+ else
+ {
+ /* Disable the 8x Oversampling mode by clearing the OVER8 bit in the CTRL1 register */
+ USARTx->CTRL1 &= CTRL1_OVER8_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables the USART's one bit sampling method.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param NewState: new state of the USART one bit sampling method.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void USART_OneBitMethodCmd(USART_Type* USARTx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the one bit method by setting the ONEBITE bit in the CR3 register */
+ USARTx->CTRL3 |= CTRL3_ONEBITE_Set;
+ }
+ else
+ {
+ /* Disable tthe one bit method by clearing the ONEBITE bit in the CR3 register */
+ USARTx->CTRL3 &= CTRL3_ONEBITE_Reset;
+ }
+}
+
+/**
+ * @brief Configures the USART's IrDA interface.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_IrDAMode: specifies the IrDA mode.
+ * This parameter can be one of the following values:
+ * @arg USART_IrDAMode_LowPower
+ * @arg USART_IrDAMode_Normal
+ * @retval None
+ */
+void USART_IrDAConfig(USART_Type* USARTx, uint16_t USART_IrDAMode)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_IRDA_MODE(USART_IrDAMode));
+
+ USARTx->CTRL3 &= CTRL3_IRDALP_Mask;
+ USARTx->CTRL3 |= USART_IrDAMode;
+}
+
+/**
+ * @brief Enables or disables the USART's IrDA interface.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param NewState: new state of the IrDA mode.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void USART_IrDACmd(USART_Type* USARTx, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the IrDA mode by setting the IREN bit in the CR3 register */
+ USARTx->CTRL3 |= CTRL3_IRDAEN_Set;
+ }
+ else
+ {
+ /* Disable the IrDA mode by clearing the IREN bit in the CR3 register */
+ USARTx->CTRL3 &= CTRL3_IRDAEN_Reset;
+ }
+}
+
+/**
+ * @brief Checks whether the specified USART flag is set or not.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg USART_FLAG_CTSF: CTS Change flag (not available for UART4 and UART5)
+ * @arg USART_FLAG_LBDF: LIN Break detection flag
+ * @arg USART_FLAG_TDE: Transmit data register empty flag
+ * @arg USART_FLAG_TRAC: Transmission Complete flag
+ * @arg USART_FLAG_RDNE: Receive data register not empty flag
+ * @arg USART_FLAG_IDLEF: Idle Line detection flag
+ * @arg USART_FLAG_ORERR: OverRun Error flag
+ * @arg USART_FLAG_NERR: Noise Error flag
+ * @arg USART_FLAG_FERR: Framing Error flag
+ * @arg USART_FLAG_PERR: Parity Error flag
+ * @retval The new state of USART_FLAG (SET or RESET).
+ */
+FlagStatus USART_GetFlagStatus(USART_Type* USARTx, uint16_t USART_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_FLAG(USART_FLAG));
+
+ /* The CTS flag is not available for UART4 and UART5 */
+ if (USART_FLAG == USART_FLAG_CTSF)
+ {
+ assert_param(IS_USART_123_PERIPH(USARTx));
+ }
+
+ if ((USARTx->STS & USART_FLAG) != (uint16_t)RESET)
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the USARTx's pending flags.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_FLAG: specifies the flag to clear.
+ * This parameter can be any combination of the following values:
+ * @arg USART_FLAG_CTSF: CTS Change flag (not available for UART4 and UART5).
+ * @arg USART_FLAG_LBDF: LIN Break detection flag.
+ * @arg USART_FLAG_TRAC: Transmission Complete flag.
+ * @arg USART_FLAG_RDNE: Receive data register not empty flag.
+ *
+ * @note
+ * - PE (Parity error), FE (Framing error), NE (Noise error), ORE (OverRun
+ * error) and IDLE (Idle line detected) flags are cleared by software
+ * sequence: a read operation to USART_SR register (USART_GetFlagStatus())
+ * followed by a read operation to USART_DR register (USART_ReceiveData()).
+ * - RXNE flag can be also cleared by a read to the USART_DR register
+ * (USART_ReceiveData()).
+ * - TC flag can be also cleared by software sequence: a read operation to
+ * USART_SR register (USART_GetFlagStatus()) followed by a write operation
+ * to USART_DR register (USART_SendData()).
+ * - TXE flag is cleared only by a write to the USART_DR register
+ * (USART_SendData()).
+ * @retval None
+ */
+void USART_ClearFlag(USART_Type* USARTx, uint16_t USART_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_CLEAR_FLAG(USART_FLAG));
+
+ /* The CTS flag is not available for UART4 and UART5 */
+ if ((USART_FLAG & USART_FLAG_CTSF) == USART_FLAG_CTSF)
+ {
+ assert_param(IS_USART_123_PERIPH(USARTx));
+ }
+
+ USARTx->STS = (uint16_t)~USART_FLAG;
+}
+
+/**
+ * @brief Checks whether the specified USART interrupt has occurred or not.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_INT: specifies the USART interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg USART_INT_CTSF: CTS change interrupt (not available for UART4 and UART5)
+ * @arg USART_INT_LBDF: LIN Break detection interrupt
+ * @arg USART_INT_TDE: Tansmit Data Register empty interrupt
+ * @arg USART_INT_TRAC: Transmission complete interrupt
+ * @arg USART_INT_RDNE: Receive Data register not empty interrupt
+ * @arg USART_INT_IDLEF: Idle line detection interrupt
+ * @arg USART_INT_ORERR: OverRun Error interrupt
+ * @arg USART_INT_NERR: Noise Error interrupt
+ * @arg USART_INT_FERR: Framing Error interrupt
+ * @arg USART_INT_PERR: Parity Error interrupt
+ * @retval The new state of USART_INT (SET or RESET).
+ */
+ITStatus USART_GetITStatus(USART_Type* USARTx, uint16_t USART_INT)
+{
+ uint32_t bitpos = 0x00, itmask = 0x00, usartreg = 0x00;
+ ITStatus bitstatus = RESET;
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_GET_INT(USART_INT));
+
+ /* The CTS interrupt is not available for UART4 and UART5 */
+ if (USART_INT == USART_INT_CTSF)
+ {
+ assert_param(IS_USART_123_PERIPH(USARTx));
+ }
+
+ /* Get the USART register index */
+ usartreg = (((uint8_t)USART_INT) >> 0x05);
+ /* Get the interrupt position */
+ itmask = USART_INT & INT_Mask;
+ itmask = (uint32_t)0x01 << itmask;
+
+ if (usartreg == 0x01) /* The INT is in CTRL1 register */
+ {
+ itmask &= USARTx->CTRL1;
+ }
+ else if (usartreg == 0x02) /* The INT is in CTRL2 register */
+ {
+ itmask &= USARTx->CTRL2;
+ }
+ else /* The INT is in CR3 register */
+ {
+ itmask &= USARTx->CTRL3;
+ }
+
+ bitpos = USART_INT >> 0x08;
+ bitpos = (uint32_t)0x01 << bitpos;
+ bitpos &= USARTx->STS;
+
+ if ((itmask != (uint16_t)RESET) && (bitpos != (uint16_t)RESET))
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the USARTx's interrupt pending bits.
+ * @param USARTx: Select the USART or the UART peripheral.
+ * This parameter can be one of the following values:
+ * USART1, USART2, USART3, UART4 or UART5.
+ * @param USART_INT: specifies the interrupt pending bit to clear.
+ * This parameter can be one of the following values:
+ * @arg USART_INT_CTSF: CTS change interrupt (not available for UART4 and UART5)
+ * @arg USART_INT_LBDF: LIN Break detection interrupt
+ * @arg USART_INT_TRAC: Transmission complete interrupt.
+ * @arg USART_INT_RDNE: Receive Data register not empty interrupt.
+ *
+ * @note
+ * - PE (Parity error), FE (Framing error), NE (Noise error), ORE (OverRun
+ * error) and IDLE (Idle line detected) pending bits are cleared by
+ * software sequence: a read operation to USART_SR register
+ * (USART_GetITStatus()) followed by a read operation to USART_DR register
+ * (USART_ReceiveData()).
+ * - RXNE pending bit can be also cleared by a read to the USART_DR register
+ * (USART_ReceiveData()).
+ * - TC pending bit can be also cleared by software sequence: a read
+ * operation to USART_SR register (USART_GetITStatus()) followed by a write
+ * operation to USART_DR register (USART_SendData()).
+ * - TXE pending bit is cleared only by a write to the USART_DR register
+ * (USART_SendData()).
+ * @retval None
+ */
+void USART_ClearITPendingBit(USART_Type* USARTx, uint16_t USART_INT)
+{
+ uint16_t bitpos = 0x00, itmask = 0x00;
+ /* Check the parameters */
+ assert_param(IS_USART_ALL_PERIPH(USARTx));
+ assert_param(IS_USART_CLEAR_INT(USART_INT));
+
+ /* The CTS interrupt is not available for UART4 and UART5 */
+ if (USART_INT == USART_INT_CTSF)
+ {
+ assert_param(IS_USART_123_PERIPH(USARTx));
+ }
+
+ bitpos = USART_INT >> 0x08;
+ itmask = ((uint16_t)0x01 << (uint16_t)bitpos);
+ USARTx->STS = (uint16_t)~itmask;
+}
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_wwdg.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_wwdg.c
new file mode 100644
index 0000000000000000000000000000000000000000..115563314544b74e8c42778826c184b825bb7b95
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_wwdg.c
@@ -0,0 +1,213 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_wwdg.c
+ * Description : at32f4xx WWDG source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_wwdg.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup WWDG
+ * @brief WWDG driver modules
+ * @{
+ */
+
+/** @defgroup WWDG_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup WWDG_Private_Defines
+ * @{
+ */
+
+/* ----------- WWDG registers bit address in the alias region ----------- */
+#define WWDG_OFFSET (WWDG_BASE - PERIPH_BASE)
+
+/* Alias word address of EWI bit */
+#define CFG_OFFSET (WWDG_OFFSET + 0x04)
+#define EWIEN_BitPos 0x09
+#define CFG_EWIEN_BBMAP (PERIPH_BB_BASE + (CFG_OFFSET * 32) + (EWIEN_BitPos * 4))
+
+/* --------------------- WWDG registers bit mask ------------------------ */
+
+/* CR register bit mask */
+#define CTRL_EN_Set ((uint32_t)0x00000080)
+
+/* CFR register bit mask */
+#define CFG_PSC_Mask ((uint32_t)0xFFFFFE7F)
+#define CFG_WCNTR_Mask ((uint32_t)0xFFFFFF80)
+#define BIT_Mask ((uint8_t)0x7F)
+
+/**
+ * @}
+ */
+
+/** @defgroup WWDG_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup WWDG_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup WWDG_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup WWDG_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the WWDG peripheral registers to their default reset values.
+ * @param None
+ * @retval None
+ */
+void WWDG_Reset(void)
+{
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_WWDG, ENABLE);
+ RCC_APB1PeriphResetCmd(RCC_APB1PERIPH_WWDG, DISABLE);
+}
+
+/**
+ * @brief Sets the WWDG Prescaler.
+ * @param WWDG_Prescaler: specifies the WWDG Prescaler.
+ * This parameter can be one of the following values:
+ * @arg WWDG_Psc_1: WWDG counter clock = (PCLK1/4096)/1
+ * @arg WWDG_Psc_2: WWDG counter clock = (PCLK1/4096)/2
+ * @arg WWDG_Psc_4: WWDG counter clock = (PCLK1/4096)/4
+ * @arg WWDG_Psc_8: WWDG counter clock = (PCLK1/4096)/8
+ * @retval None
+ */
+void WWDG_SetPrescaler(uint32_t WWDG_Prescaler)
+{
+ uint32_t tmpreg = 0;
+ /* Check the parameters */
+ assert_param(IS_WWDG_PSC(WWDG_Prescaler));
+ /* Clear WDGTB[1:0] bits */
+ tmpreg = WWDG->CFG & CFG_PSC_Mask;
+ /* Set WDGTB[1:0] bits according to WWDG_Prescaler value */
+ tmpreg |= WWDG_Prescaler;
+ /* Store the new value */
+ WWDG->CFG = tmpreg;
+}
+
+/**
+ * @brief Sets the WWDG window value.
+ * @param WindowValue: specifies the window value to be compared to the downcounter.
+ * This parameter value must be lower than 0x80.
+ * @retval None
+ */
+void WWDG_SetWindowCounter(uint8_t WindowValue)
+{
+ __IO uint32_t tmpreg = 0;
+
+ /* Check the parameters */
+ assert_param(IS_WWDG_WCNTR(WindowValue));
+ /* Clear W[6:0] bits */
+
+ tmpreg = WWDG->CFG & CFG_WCNTR_Mask;
+
+ /* Set W[6:0] bits according to WindowValue value */
+ tmpreg |= WindowValue & (uint32_t) BIT_Mask;
+
+ /* Store the new value */
+ WWDG->CFG = tmpreg;
+}
+
+/**
+ * @brief Enables the WWDG Early Wakeup interrupt(EWI).
+ * @param None
+ * @retval None
+ */
+void WWDG_EnableINT(void)
+{
+ *(__IO uint32_t *) CFG_EWIEN_BBMAP = (uint32_t)ENABLE;
+}
+
+/**
+ * @brief Sets the WWDG counter value.
+ * @param Counter: specifies the watchdog counter value.
+ * This parameter must be a number between 0x40 and 0x7F.
+ * @retval None
+ */
+void WWDG_SetCounter(uint8_t Counter)
+{
+ /* Check the parameters */
+ assert_param(IS_WWDG_CNTR(Counter));
+ /* Write to T[6:0] bits to configure the counter value, no need to do
+ a read-modify-write; writing a 0 to WDGA bit does nothing */
+ WWDG->CTRL = Counter & BIT_Mask;
+}
+
+/**
+ * @brief Enables WWDG and load the counter value.
+ * @param Counter: specifies the watchdog counter value.
+ * This parameter must be a number between 0x40 and 0x7F.
+ * @retval None
+ */
+void WWDG_Enable(uint8_t Counter)
+{
+ /* Check the parameters */
+ assert_param(IS_WWDG_CNTR(Counter));
+ WWDG->CTRL = CTRL_EN_Set | Counter;
+}
+
+/**
+ * @brief Checks whether the Early Wakeup interrupt flag is set or not.
+ * @param None
+ * @retval The new state of the Early Wakeup interrupt flag (SET or RESET)
+ */
+FlagStatus WWDG_GetFlagStatus(void)
+{
+ return (FlagStatus)(WWDG->STS);
+}
+
+/**
+ * @brief Clears Early Wakeup interrupt flag.
+ * @param None
+ * @retval None
+ */
+void WWDG_ClearFlag(void)
+{
+ WWDG->STS = (uint32_t)RESET;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_xmc.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_xmc.c
new file mode 100644
index 0000000000000000000000000000000000000000..df8cefe1252a128e9ad9cb146494785cff110560
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/at32f4xx_xmc.c
@@ -0,0 +1,884 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_xmc.c
+ * Description : at32f4xx XMC source file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "at32f4xx_xmc.h"
+#include "at32f4xx_rcc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup XMC
+ * @brief XMC driver modules
+ * @{
+ */
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || defined (AT32F407xx)
+
+/** @defgroup XMC_Private_TypesDefinitions
+ * @{
+ */
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Private_Defines
+ * @{
+ */
+
+/* --------------------- XMC registers bit mask ---------------------------- */
+
+/* XMC BCRx Mask */
+#define BK1CTRLx_EN_Set ((uint32_t)0x00000001)
+#define BK1CTRLx_EN_Reset ((uint32_t)0x000FFFFE)
+#define BK1CTRLx_NOREN_Set ((uint32_t)0x00000040)
+
+/* XMC PCRx Mask */
+#define BKxCTRL_EN_Set ((uint32_t)0x00000004)
+#define BKxCTRL_EN_Reset ((uint32_t)0x000FFFFB)
+#define BKxCTRL_ECCEN_Set ((uint32_t)0x00000040)
+#define BKxCTRL_ECCEN_Reset ((uint32_t)0x000FFFBF)
+#define BKxCTRL_Device_NAND ((uint32_t)0x00000008)
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup XMC_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Deinitializes the XMC NOR/SRAM Banks registers to their default
+ * reset values.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank1_NORSRAM1: XMC Bank1 NOR/SRAM1
+ * @arg XMC_Bank1_NORSRAM2: XMC Bank1 NOR/SRAM2
+ * @arg XMC_Bank1_NORSRAM3: XMC Bank1 NOR/SRAM3
+ * @arg XMC_Bank1_NORSRAM4: XMC Bank1 NOR/SRAM4
+ * @retval None
+ */
+void XMC_NORSRAMReset(uint32_t XMC_Bank)
+{
+ /* Check the parameter */
+ assert_param(IS_XMC_NORSRAM_REGION(XMC_Bank));
+
+ /* XMC_Bank1_NORSRAM1 */
+ if(XMC_Bank == XMC_Bank1_NORSRAM1)
+ {
+ XMC_Bank1->BK1CTRLR[XMC_Bank] = 0x000030DB;
+ }
+ /* XMC_Bank1_NORSRAM2, XMC_Bank1_NORSRAM3 or XMC_Bank1_NORSRAM4 */
+ else
+ {
+ XMC_Bank1->BK1CTRLR[XMC_Bank] = 0x000030D2;
+ }
+
+ XMC_Bank1->BK1CTRLR[XMC_Bank + 1] = 0x0FFFFFFF;
+ XMC_Bank1E->BK1TMGWR[XMC_Bank] = 0x0FFFFFFF;
+}
+
+/**
+ * @brief Deinitializes the XMC NAND Banks registers to their default reset values.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank2_NAND: XMC Bank2 NAND
+ * @arg XMC_Bank3_NAND: XMC Bank3 NAND
+ * @retval None
+ */
+void XMC_NANDReset(uint32_t XMC_Bank)
+{
+ /* Check the parameter */
+ assert_param(IS_XMC_NAND_BANK(XMC_Bank));
+
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ /* Set the XMC_Bank2 registers to their reset values */
+ XMC_Bank2->BK2CTRL = 0x00000018;
+ XMC_Bank2->BK2STS = 0x00000040;
+ XMC_Bank2->BK2TMGMEM = 0xFCFCFCFC;
+ XMC_Bank2->BK2TMGATT = 0xFCFCFCFC;
+ }
+ /* XMC_Bank3_NAND */
+ else
+ {
+ /* Set the XMC_Bank3 registers to their reset values */
+ XMC_Bank3->BK3CTRL = 0x00000018;
+ XMC_Bank3->BK3STS = 0x00000040;
+ XMC_Bank3->BK3TMGMEM = 0xFCFCFCFC;
+ XMC_Bank3->BK3TMGATT = 0xFCFCFCFC;
+ }
+}
+
+/**
+ * @brief Deinitializes the XMC PCCARD Bank registers to their default reset values.
+ * @param None
+ * @retval None
+ */
+void XMC_PCCARDReset(void)
+{
+ /* Set the XMC_Bank4 registers to their reset values */
+ XMC_Bank4->BK4CTRL = 0x00000018;
+ XMC_Bank4->BK4STS = 0x00000000;
+ XMC_Bank4->BK4TMGMEM = 0xFCFCFCFC;
+ XMC_Bank4->BK4TMGATT = 0xFCFCFCFC;
+ XMC_Bank4->BK4TMGIO = 0xFCFCFCFC;
+}
+
+/**
+ * @brief Initializes the XMC NOR/SRAM Banks according to the specified
+ * parameters in the XMC_NORSRAMInitStruct.
+ * @param XMC_NORSRAMInitStruct : pointer to a XMC_NORSRAMInitType
+ * structure that contains the configuration information for
+ * the XMC NOR/SRAM specified Banks.
+ * @retval None
+ */
+void XMC_NORSRAMInit(XMC_NORSRAMInitType* XMC_NORSRAMInitStruct)
+{
+ /* Check the parameters */
+ assert_param(IS_XMC_NORSRAM_REGION(XMC_NORSRAMInitStruct->XMC_Bank));
+ assert_param(IS_XMC_MUX(XMC_NORSRAMInitStruct->XMC_DataAdrMux));
+ assert_param(IS_XMC_DEVICE(XMC_NORSRAMInitStruct->XMC_Dev));
+ assert_param(IS_XMC_BUS_TYPE(XMC_NORSRAMInitStruct->XMC_BusType));
+ assert_param(IS_XMC_BURSTMODE(XMC_NORSRAMInitStruct->XMC_EnableBurstMode));
+ assert_param(IS_XMC_ASYNWAIT(XMC_NORSRAMInitStruct->XMC_EnableAsynWait));
+ assert_param(IS_XMC_WAIT_SIGNAL_LEVEL(XMC_NORSRAMInitStruct->XMC_WaitSignalLv));
+ assert_param(IS_XMC_BURSTMODE_SPLIT(XMC_NORSRAMInitStruct->XMC_EnableBurstModeSplit));
+ assert_param(IS_XMC_WAIT_SIGNAL_CONFIG(XMC_NORSRAMInitStruct->XMC_WaitSignalConfig));
+ assert_param(IS_XMC_WRITE_OPERATION(XMC_NORSRAMInitStruct->XMC_EnableWrite));
+ assert_param(IS_XMC_WAIT_SIGNAL(XMC_NORSRAMInitStruct->XMC_EnableWaitSignal));
+ assert_param(IS_XMC_WRITE_TIMING(XMC_NORSRAMInitStruct->XMC_EnableWriteTiming));
+ assert_param(IS_XMC_WRITE_BURST_SYN(XMC_NORSRAMInitStruct->XMC_WriteBurstSyn));
+ assert_param(IS_XMC_ADDRESS_OP_TIME(XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_AdrOpTime));
+ assert_param(IS_XMC_ADDRESS_HOLD_TIME(XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_AdrHoldTime));
+ assert_param(IS_XMC_DATA_OP_TIME(XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_DataOpTime));
+ assert_param(IS_XMC_INTERVAL_BETWEEN_OP_TIME(XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_IntervalBetweenOP));
+ assert_param(IS_XMC_CLK_DIV(XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_CLKPsc));
+ assert_param(IS_XMC_DATA_STABLE_TIME(XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_DataStableTime));
+ assert_param(IS_XMC_MODE(XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_Mode));
+
+ /* Bank1 NOR/SRAM control register configuration */
+ XMC_Bank1->BK1CTRLR[XMC_NORSRAMInitStruct->XMC_Bank] =
+ (uint32_t)XMC_NORSRAMInitStruct->XMC_DataAdrMux |
+ XMC_NORSRAMInitStruct->XMC_Dev |
+ XMC_NORSRAMInitStruct->XMC_BusType |
+ XMC_NORSRAMInitStruct->XMC_EnableBurstMode |
+ XMC_NORSRAMInitStruct->XMC_EnableAsynWait |
+ XMC_NORSRAMInitStruct->XMC_WaitSignalLv |
+ XMC_NORSRAMInitStruct->XMC_EnableBurstModeSplit |
+ XMC_NORSRAMInitStruct->XMC_WaitSignalConfig |
+ XMC_NORSRAMInitStruct->XMC_EnableWrite |
+ XMC_NORSRAMInitStruct->XMC_EnableWaitSignal |
+ XMC_NORSRAMInitStruct->XMC_EnableWriteTiming |
+ XMC_NORSRAMInitStruct->XMC_WriteBurstSyn;
+
+ if(XMC_NORSRAMInitStruct->XMC_Dev == XMC_Dev_NOR)
+ {
+ XMC_Bank1->BK1CTRLR[XMC_NORSRAMInitStruct->XMC_Bank] |= (uint32_t)BK1CTRLx_NOREN_Set;
+ }
+
+ /* Bank1 NOR/SRAM timing register configuration */
+ XMC_Bank1->BK1CTRLR[XMC_NORSRAMInitStruct->XMC_Bank + 1] =
+ (uint32_t)XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_AdrOpTime |
+ (XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_AdrHoldTime << 4) |
+ (XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_DataOpTime << 8) |
+ (XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_IntervalBetweenOP << 16) |
+ (XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_CLKPsc << 20) |
+ (XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_DataStableTime << 24) |
+ XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_Mode;
+
+
+ /* Bank1 NOR/SRAM timing register for write configuration, if extended mode is used */
+ if(XMC_NORSRAMInitStruct->XMC_EnableWriteTiming == XMC_WriteTiming_Enable)
+ {
+ assert_param(IS_XMC_ADDRESS_OP_TIME(XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_AdrOpTime));
+ assert_param(IS_XMC_ADDRESS_HOLD_TIME(XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_AdrHoldTime));
+ assert_param(IS_XMC_DATA_OP_TIME(XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_DataOpTime));
+ assert_param(IS_XMC_CLK_DIV(XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_CLKPsc));
+ assert_param(IS_XMC_DATA_STABLE_TIME(XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_DataStableTime));
+ assert_param(IS_XMC_MODE(XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_Mode));
+ XMC_Bank1E->BK1TMGWR[XMC_NORSRAMInitStruct->XMC_Bank] =
+ (uint32_t)XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_AdrOpTime |
+ (XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_AdrHoldTime << 4 ) |
+ (XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_DataOpTime << 8) |
+ (XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_CLKPsc << 20) |
+ (XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_DataStableTime << 24) |
+ XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_Mode;
+ }
+ else
+ {
+ XMC_Bank1E->BK1TMGWR[XMC_NORSRAMInitStruct->XMC_Bank] = 0x0FFFFFFF;
+ }
+}
+
+/**
+ * @brief Initializes the XMC NAND Banks according to the specified
+ * parameters in the XMC_NANDInitStruct.
+ * @param XMC_NANDInitStruct : pointer to a XMC_NANDInitType
+ * structure that contains the configuration information for the XMC
+ * NAND specified Banks.
+ * @retval None
+ */
+void XMC_NANDInit(XMC_NANDInitType* XMC_NANDInitStruct)
+{
+ uint32_t tmppcr = 0x00000000, tmppmem = 0x00000000, tmppatt = 0x00000000;
+
+ /* Check the parameters */
+ assert_param( IS_XMC_NAND_BANK(XMC_NANDInitStruct->XMC_Bank));
+ assert_param( IS_XMC_WAIT_OPERATION(XMC_NANDInitStruct->XMC_EnableWait));
+ assert_param( IS_XMC_BUS_TYPE(XMC_NANDInitStruct->XMC_BusType));
+ assert_param( IS_XMC_ECC_OPERATION(XMC_NANDInitStruct->XMC_EnableECC));
+ assert_param( IS_XMC_ECCPAGE_SIZE(XMC_NANDInitStruct->XMC_ECCPageSize));
+ assert_param( IS_XMC_DELAY_CR_TIME(XMC_NANDInitStruct->XMC_DelayTimeCR));
+ assert_param( IS_XMC_DELAY_AR_TIME(XMC_NANDInitStruct->XMC_DelayTimeAR));
+ assert_param(IS_XMC_SETUP_TIME(XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_SetupTime));
+ assert_param(IS_XMC_OP_TIME(XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_OpTime));
+ assert_param(IS_XMC_HOLD_TIME(XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_HoldTime));
+ assert_param(IS_XMC_WRITE_SETUP_TIME(XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_WriteSetupTime));
+ assert_param(IS_XMC_SETUP_TIME(XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_SetupTime));
+ assert_param(IS_XMC_OP_TIME(XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_OpTime));
+ assert_param(IS_XMC_HOLD_TIME(XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_HoldTime));
+ assert_param(IS_XMC_WRITE_SETUP_TIME(XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_WriteSetupTime));
+
+ /* Set the tmppcr value according to XMC_NANDInitStruct parameters */
+ tmppcr = (uint32_t)XMC_NANDInitStruct->XMC_EnableWait |
+ BKxCTRL_Device_NAND |
+ XMC_NANDInitStruct->XMC_BusType |
+ XMC_NANDInitStruct->XMC_EnableECC |
+ XMC_NANDInitStruct->XMC_ECCPageSize |
+ (XMC_NANDInitStruct->XMC_DelayTimeCR << 9 ) |
+ (XMC_NANDInitStruct->XMC_DelayTimeAR << 13);
+
+ /* Set tmppmem value according to XMC_CommonSpaceTimingStructure parameters */
+ tmppmem = (uint32_t)XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_SetupTime |
+ (XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_OpTime << 8) |
+ (XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_HoldTime << 16) |
+ (XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_WriteSetupTime << 24);
+
+ /* Set tmppatt value according to XMC_AttributeSpaceTimingStructure parameters */
+ tmppatt = (uint32_t)XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_SetupTime |
+ (XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_OpTime << 8) |
+ (XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_HoldTime << 16) |
+ (XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_WriteSetupTime << 24);
+
+ if(XMC_NANDInitStruct->XMC_Bank == XMC_Bank2_NAND)
+ {
+ /* XMC_Bank2_NAND registers configuration */
+ XMC_Bank2->BK2CTRL = tmppcr;
+ XMC_Bank2->BK2TMGMEM = tmppmem;
+ XMC_Bank2->BK2TMGATT = tmppatt;
+ }
+ else
+ {
+ /* XMC_Bank3_NAND registers configuration */
+ XMC_Bank3->BK3CTRL = tmppcr;
+ XMC_Bank3->BK3TMGMEM = tmppmem;
+ XMC_Bank3->BK3TMGATT = tmppatt;
+ }
+}
+
+/**
+ * @brief Initializes the XMC PCCARD Bank according to the specified
+ * parameters in the XMC_PCCARDInitStruct.
+ * @param XMC_PCCARDInitStruct : pointer to a XMC_PCCARDInitType
+ * structure that contains the configuration information for the XMC
+ * PCCARD Bank.
+ * @retval None
+ */
+void XMC_PCCARDInit(XMC_PCCARDInitType* XMC_PCCARDInitStruct)
+{
+ /* Check the parameters */
+ assert_param(IS_XMC_WAIT_OPERATION(XMC_PCCARDInitStruct->XMC_EnableWait));
+ assert_param(IS_XMC_DELAY_CR_TIME(XMC_PCCARDInitStruct->XMC_DelayTimeCR));
+ assert_param(IS_XMC_DELAY_AR_TIME(XMC_PCCARDInitStruct->XMC_DelayTimeAR));
+
+ assert_param(IS_XMC_SETUP_TIME(XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_SetupTime));
+ assert_param(IS_XMC_OP_TIME(XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_OpTime));
+ assert_param(IS_XMC_HOLD_TIME(XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_HoldTime));
+ assert_param(IS_XMC_WRITE_SETUP_TIME(XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_WriteSetupTime));
+
+ assert_param(IS_XMC_SETUP_TIME(XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_SetupTime));
+ assert_param(IS_XMC_OP_TIME(XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_OpTime));
+ assert_param(IS_XMC_HOLD_TIME(XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_HoldTime));
+ assert_param(IS_XMC_WRITE_SETUP_TIME(XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_WriteSetupTime));
+ assert_param(IS_XMC_SETUP_TIME(XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_SetupTime));
+ assert_param(IS_XMC_OP_TIME(XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_OpTime));
+ assert_param(IS_XMC_HOLD_TIME(XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_HoldTime));
+ assert_param(IS_XMC_WRITE_SETUP_TIME(XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_WriteSetupTime));
+
+ /* Set the PCR4 register value according to XMC_PCCARDInitStruct parameters */
+ XMC_Bank4->BK4CTRL = (uint32_t)XMC_PCCARDInitStruct->XMC_EnableWait |
+ XMC_BusType_16b |
+ (XMC_PCCARDInitStruct->XMC_DelayTimeCR << 9) |
+ (XMC_PCCARDInitStruct->XMC_DelayTimeAR << 13);
+
+ /* Set PMEM4 register value according to XMC_CommonSpaceTimingStructure parameters */
+ XMC_Bank4->BK4TMGMEM = (uint32_t)XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_SetupTime |
+ (XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_OpTime << 8) |
+ (XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_HoldTime << 16) |
+ (XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_WriteSetupTime << 24);
+
+ /* Set PATT4 register value according to XMC_AttributeSpaceTimingStructure parameters */
+ XMC_Bank4->BK4TMGATT = (uint32_t)XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_SetupTime |
+ (XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_OpTime << 8) |
+ (XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_HoldTime << 16) |
+ (XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_WriteSetupTime << 24);
+
+ /* Set PIO4 register value according to XMC_IOSpaceTimingStructure parameters */
+ XMC_Bank4->BK4TMGIO = (uint32_t)XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_SetupTime |
+ (XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_OpTime << 8) |
+ (XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_HoldTime << 16) |
+ (XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_WriteSetupTime << 24);
+}
+
+/**
+ * @brief Fills each XMC_NORSRAMInitStruct member with its default value.
+ * @param XMC_NORSRAMInitStruct: pointer to a XMC_NORSRAMInitType
+ * structure which will be initialized.
+ * @retval None
+ */
+void XMC_NORSRAMStructInit(XMC_NORSRAMInitType* XMC_NORSRAMInitStruct)
+{
+ /* Reset NOR/SRAM Init structure parameters values */
+ XMC_NORSRAMInitStruct->XMC_Bank = XMC_Bank1_NORSRAM1;
+ XMC_NORSRAMInitStruct->XMC_DataAdrMux = XMC_DataAdrMux_Enable;
+ XMC_NORSRAMInitStruct->XMC_Dev = XMC_Dev_SRAM;
+ XMC_NORSRAMInitStruct->XMC_BusType = XMC_BusType_8b;
+ XMC_NORSRAMInitStruct->XMC_EnableBurstMode = XMC_BurstMode_Disable;
+ XMC_NORSRAMInitStruct->XMC_EnableAsynWait = XMC_AsynWait_Disable;
+ XMC_NORSRAMInitStruct->XMC_WaitSignalLv = XMC_WaitSignalLv_Low;
+ XMC_NORSRAMInitStruct->XMC_EnableBurstModeSplit = XMC_BurstModeSplit_Disable;
+ XMC_NORSRAMInitStruct->XMC_WaitSignalConfig = XMC_WaitSignalConfig_BeforeWaitState;
+ XMC_NORSRAMInitStruct->XMC_EnableWrite = XMC_WriteOperation_Enable;
+ XMC_NORSRAMInitStruct->XMC_EnableWaitSignal = XMC_WaitSignal_Enable;
+ XMC_NORSRAMInitStruct->XMC_EnableWriteTiming = XMC_WriteTiming_Disable;
+ XMC_NORSRAMInitStruct->XMC_WriteBurstSyn = XMC_WriteBurstSyn_Disable;
+ XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_AdrOpTime = 0xF;
+ XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_AdrHoldTime = 0xF;
+ XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_DataOpTime = 0xFF;
+ XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_IntervalBetweenOP = 0xF;
+ XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_CLKPsc = 0xF;
+ XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_DataStableTime = 0xF;
+ XMC_NORSRAMInitStruct->XMC_RWTimingStruct->XMC_Mode = XMC_Mode_A;
+ XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_AdrOpTime = 0xF;
+ XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_AdrHoldTime = 0xF;
+ XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_DataOpTime = 0xFF;
+ XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_IntervalBetweenOP = 0xF;
+ XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_CLKPsc = 0xF;
+ XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_DataStableTime = 0xF;
+ XMC_NORSRAMInitStruct->XMC_WTimingStruct->XMC_Mode = XMC_Mode_A;
+}
+
+/**
+ * @brief Fills each XMC_NANDInitStruct member with its default value.
+ * @param XMC_NANDInitStruct: pointer to a XMC_NANDInitType
+ * structure which will be initialized.
+ * @retval None
+ */
+void XMC_NANDStructInit(XMC_NANDInitType* XMC_NANDInitStruct)
+{
+ /* Reset NAND Init structure parameters values */
+ XMC_NANDInitStruct->XMC_Bank = XMC_Bank2_NAND;
+ XMC_NANDInitStruct->XMC_EnableWait = XMC_WaitOperation_Disable;
+ XMC_NANDInitStruct->XMC_BusType = XMC_BusType_8b;
+ XMC_NANDInitStruct->XMC_EnableECC = XMC_ECCOperation_Disable;
+ XMC_NANDInitStruct->XMC_ECCPageSize = XMC_ECCPageSize_256Bytes;
+ XMC_NANDInitStruct->XMC_DelayTimeCR = 0x0;
+ XMC_NANDInitStruct->XMC_DelayTimeAR = 0x0;
+ XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_SetupTime = 0xFC;
+ XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_OpTime = 0xFC;
+ XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_HoldTime = 0xFC;
+ XMC_NANDInitStruct->XMC_CommonSpaceTimingStruct->XMC_WriteSetupTime = 0xFC;
+ XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_SetupTime = 0xFC;
+ XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_OpTime = 0xFC;
+ XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_HoldTime = 0xFC;
+ XMC_NANDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_WriteSetupTime = 0xFC;
+}
+
+/**
+ * @brief Fills each XMC_PCCARDInitStruct member with its default value.
+ * @param XMC_PCCARDInitStruct: pointer to a XMC_PCCARDInitType
+ * structure which will be initialized.
+ * @retval None
+ */
+void XMC_PCCARDStructInit(XMC_PCCARDInitType* XMC_PCCARDInitStruct)
+{
+ /* Reset PCCARD Init structure parameters values */
+ XMC_PCCARDInitStruct->XMC_EnableWait = XMC_WaitOperation_Disable;
+ XMC_PCCARDInitStruct->XMC_DelayTimeCR = 0x0;
+ XMC_PCCARDInitStruct->XMC_DelayTimeAR = 0x0;
+ XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_SetupTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_OpTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_HoldTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_CommonSpaceTimingStruct->XMC_WriteSetupTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_SetupTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_OpTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_HoldTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_AttributeSpaceTimingStruct->XMC_WriteSetupTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_SetupTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_OpTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_HoldTime = 0xFC;
+ XMC_PCCARDInitStruct->XMC_IOSpaceTimingStruct->XMC_WriteSetupTime = 0xFC;
+}
+
+/**
+ * @brief Config the bus turnaround phase
+ * @param XMC_SubBank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_SubBank1_NORSRAM1: XMC SubBank1 NOR/SRAM1
+ * @arg XMC_SubBank1_NORSRAM2: XMC SubBank1 NOR/SRAM2
+ * @arg XMC_SubBank1_NORSRAM3: XMC SubBank1 NOR/SRAM3
+ * @arg XMC_SubBank1_NORSRAM4: XMC SubBank1 NOR/SRAM4
+ * @param W2W_Timing: Bus turnaround phase for consecutive write duration.from 0 to 255 HCLK, default:8 HCLK
+ * @param R2R_Timing: Bus turnaround phase for consecutive read duration.from 0 to 255 HCLK, default:8 HCLK
+ * @retval None
+ */
+void XMC_ExtTimingConfig(uint32_t XMC_SubBank, uint8_t W2W_Timing, uint8_t R2R_Timing)
+{
+ assert_param(IS_XMC_Sub_NORSRAM_REGION(XMC_SubBank));
+
+ XMC_Bank1H->BK1EXT[XMC_SubBank] &= 0;
+ XMC_Bank1H->BK1EXT[XMC_SubBank] |= (W2W_Timing|(R2R_Timing<<8));
+}
+
+/**
+ * @brief Enables or disables the specified NOR/SRAM Memory Bank.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank1_NORSRAM1: XMC Bank1 NOR/SRAM1
+ * @arg XMC_Bank1_NORSRAM2: XMC Bank1 NOR/SRAM2
+ * @arg XMC_Bank1_NORSRAM3: XMC Bank1 NOR/SRAM3
+ * @arg XMC_Bank1_NORSRAM4: XMC Bank1 NOR/SRAM4
+ * @param NewState: new state of the XMC_Bank. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void XMC_NORSRAMCmd(uint32_t XMC_Bank, FunctionalState NewState)
+{
+ assert_param(IS_XMC_NORSRAM_REGION(XMC_Bank));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected NOR/SRAM Bank by setting the PBKEN bit in the BCRx register */
+ XMC_Bank1->BK1CTRLR[XMC_Bank] |= BK1CTRLx_EN_Set;
+ }
+ else
+ {
+ /* Disable the selected NOR/SRAM Bank by clearing the PBKEN bit in the BCRx register */
+ XMC_Bank1->BK1CTRLR[XMC_Bank] &= BK1CTRLx_EN_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables the specified NAND Memory Bank.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank2_NAND: XMC Bank2 NAND
+ * @arg XMC_Bank3_NAND: XMC Bank3 NAND
+ * @param NewState: new state of the XMC_Bank. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void XMC_NANDCmd(uint32_t XMC_Bank, FunctionalState NewState)
+{
+ assert_param(IS_XMC_NAND_BANK(XMC_Bank));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected NAND Bank by setting the PBKEN bit in the PCRx register */
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ XMC_Bank2->BK2CTRL |= BKxCTRL_EN_Set;
+ }
+ else
+ {
+ XMC_Bank3->BK3CTRL |= BKxCTRL_EN_Set;
+ }
+ }
+ else
+ {
+ /* Disable the selected NAND Bank by clearing the PBKEN bit in the PCRx register */
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ XMC_Bank2->BK2CTRL &= BKxCTRL_EN_Reset;
+ }
+ else
+ {
+ XMC_Bank3->BK3CTRL &= BKxCTRL_EN_Reset;
+ }
+ }
+}
+
+/**
+ * @brief Enables or disables the PCCARD Memory Bank.
+ * @param NewState: new state of the PCCARD Memory Bank.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void XMC_PCCARDCmd(FunctionalState NewState)
+{
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the PCCARD Bank by setting the PBKEN bit in the PCR4 register */
+ XMC_Bank4->BK4CTRL |= BKxCTRL_EN_Set;
+ }
+ else
+ {
+ /* Disable the PCCARD Bank by clearing the PBKEN bit in the PCR4 register */
+ XMC_Bank4->BK4CTRL &= BKxCTRL_EN_Reset;
+ }
+}
+
+/**
+ * @brief Enables or disables the XMC NAND ECC feature.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank2_NAND: XMC Bank2 NAND
+ * @arg XMC_Bank3_NAND: XMC Bank3 NAND
+ * @param NewState: new state of the XMC NAND ECC feature.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void XMC_NANDECCCmd(uint32_t XMC_Bank, FunctionalState NewState)
+{
+ assert_param(IS_XMC_NAND_BANK(XMC_Bank));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected NAND Bank ECC function by setting the ECCEN bit in the PCRx register */
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ XMC_Bank2->BK2CTRL |= BKxCTRL_ECCEN_Set;
+ }
+ else
+ {
+ XMC_Bank3->BK3CTRL |= BKxCTRL_ECCEN_Set;
+ }
+ }
+ else
+ {
+ /* Disable the selected NAND Bank ECC function by clearing the ECCEN bit in the PCRx register */
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ XMC_Bank2->BK2CTRL &= BKxCTRL_ECCEN_Reset;
+ }
+ else
+ {
+ XMC_Bank3->BK3CTRL &= BKxCTRL_ECCEN_Reset;
+ }
+ }
+}
+
+/**
+ * @brief Returns the error correction code register value.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank2_NAND: XMC Bank2 NAND
+ * @arg XMC_Bank3_NAND: XMC Bank3 NAND
+ * @retval The Error Correction Code (ECC) value.
+ */
+uint32_t XMC_GetECC(uint32_t XMC_Bank)
+{
+ uint32_t eccval = 0x00000000;
+
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ /* Get the BK2ECC register value */
+ eccval = XMC_Bank2->BK2ECC;
+ }
+ else
+ {
+ /* Get the BK3ECC register value */
+ eccval = XMC_Bank3->BK3ECC;
+ }
+
+ /* Return the error correction code value */
+ return(eccval);
+}
+
+/**
+ * @brief Enables or disables the specified XMC interrupts.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank2_NAND: XMC Bank2 NAND
+ * @arg XMC_Bank3_NAND: XMC Bank3 NAND
+ * @arg XMC_Bank4_PCCARD: XMC Bank4 PCCARD
+ * @param XMC_INT: specifies the XMC interrupt sources to be enabled or disabled.
+ * This parameter can be any combination of the following values:
+ * @arg XMC_INT_RisingEdge: Rising edge detection interrupt.
+ * @arg XMC_INT_Level: Level edge detection interrupt.
+ * @arg XMC_INT_FallingEdge: Falling edge detection interrupt.
+ * @param NewState: new state of the specified XMC interrupts.
+ * This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void XMC_INTConfig(uint32_t XMC_Bank, uint32_t XMC_INT, FunctionalState NewState)
+{
+ assert_param(IS_XMC_INT_BANK(XMC_Bank));
+ assert_param(IS_XMC_INT(XMC_INT));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ /* Enable the selected XMC_Bank2 interrupts */
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ XMC_Bank2->BK2STS |= XMC_INT;
+ }
+ /* Enable the selected XMC_Bank3 interrupts */
+ else if (XMC_Bank == XMC_Bank3_NAND)
+ {
+ XMC_Bank3->BK3STS |= XMC_INT;
+ }
+ /* Enable the selected XMC_Bank4 interrupts */
+ else
+ {
+ XMC_Bank4->BK4STS |= XMC_INT;
+ }
+ }
+ else
+ {
+ /* Disable the selected XMC_Bank2 interrupts */
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+
+ XMC_Bank2->BK2STS &= (uint32_t)~XMC_INT;
+ }
+ /* Disable the selected XMC_Bank3 interrupts */
+ else if (XMC_Bank == XMC_Bank3_NAND)
+ {
+ XMC_Bank3->BK3STS &= (uint32_t)~XMC_INT;
+ }
+ /* Disable the selected XMC_Bank4 interrupts */
+ else
+ {
+ XMC_Bank4->BK4STS &= (uint32_t)~XMC_INT;
+ }
+ }
+}
+
+/**
+ * @brief Checks whether the specified XMC flag is set or not.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank2_NAND: XMC Bank2 NAND
+ * @arg XMC_Bank3_NAND: XMC Bank3 NAND
+ * @arg XMC_Bank4_PCCARD: XMC Bank4 PCCARD
+ * @param XMC_FLAG: specifies the flag to check.
+ * This parameter can be one of the following values:
+ * @arg XMC_FLAG_RisingEdge: Rising egde detection Flag.
+ * @arg XMC_FLAG_Level: Level detection Flag.
+ * @arg XMC_FLAG_FallingEdge: Falling egde detection Flag.
+ * @arg XMC_FLAG_FEMPT: Fifo empty Flag.
+ * @retval The new state of XMC_FLAG (SET or RESET).
+ */
+FlagStatus XMC_GetFlagStatus(uint32_t XMC_Bank, uint32_t XMC_FLAG)
+{
+ FlagStatus bitstatus = RESET;
+ uint32_t tmpsr = 0x00000000;
+
+ /* Check the parameters */
+ assert_param(IS_XMC_GETFLAG_BANK(XMC_Bank));
+ assert_param(IS_XMC_GET_FLAG(XMC_FLAG));
+
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ tmpsr = XMC_Bank2->BK2STS;
+ }
+ else if(XMC_Bank == XMC_Bank3_NAND)
+ {
+ tmpsr = XMC_Bank3->BK3STS;
+ }
+ /* XMC_Bank4_PCCARD*/
+ else
+ {
+ tmpsr = XMC_Bank4->BK4STS;
+ }
+
+ /* Get the flag status */
+ if ((tmpsr & XMC_FLAG) != (uint16_t)RESET )
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ /* Return the flag status */
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the XMC's pending flags.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank2_NAND: XMC Bank2 NAND
+ * @arg XMC_Bank3_NAND: XMC Bank3 NAND
+ * @arg XMC_Bank4_PCCARD: XMC Bank4 PCCARD
+ * @param XMC_FLAG: specifies the flag to clear.
+ * This parameter can be any combination of the following values:
+ * @arg XMC_FLAG_RisingEdge: Rising egde detection Flag.
+ * @arg XMC_FLAG_Level: Level detection Flag.
+ * @arg XMC_FLAG_FallingEdge: Falling egde detection Flag.
+ * @retval None
+ */
+void XMC_ClearFlag(uint32_t XMC_Bank, uint32_t XMC_FLAG)
+{
+ /* Check the parameters */
+ assert_param(IS_XMC_GETFLAG_BANK(XMC_Bank));
+ assert_param(IS_XMC_CLEAR_FLAG(XMC_FLAG)) ;
+
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ XMC_Bank2->BK2STS &= ~XMC_FLAG;
+ }
+ else if(XMC_Bank == XMC_Bank3_NAND)
+ {
+ XMC_Bank3->BK3STS &= ~XMC_FLAG;
+ }
+ /* XMC_Bank4_PCCARD*/
+ else
+ {
+ XMC_Bank4->BK4STS &= ~XMC_FLAG;
+ }
+}
+
+/**
+ * @brief Checks whether the specified XMC interrupt has occurred or not.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank2_NAND: XMC Bank2 NAND
+ * @arg XMC_Bank3_NAND: XMC Bank3 NAND
+ * @arg XMC_Bank4_PCCARD: XMC Bank4 PCCARD
+ * @param XMC_INT: specifies the XMC interrupt source to check.
+ * This parameter can be one of the following values:
+ * @arg XMC_INT_RisingEdge: Rising edge detection interrupt.
+ * @arg XMC_INT_Level: Level edge detection interrupt.
+ * @arg XMC_INT_FallingEdge: Falling edge detection interrupt.
+ * @retval The new state of XMC_INT (SET or RESET).
+ */
+ITStatus XMC_GetINTStatus(uint32_t XMC_Bank, uint32_t XMC_INT)
+{
+ ITStatus bitstatus = RESET;
+ uint32_t tmpsr = 0x0, itstatus = 0x0, itenable = 0x0;
+
+ /* Check the parameters */
+ assert_param(IS_XMC_INT_BANK(XMC_Bank));
+ assert_param(IS_XMC_GET_INT(XMC_INT));
+
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ tmpsr = XMC_Bank2->BK2STS;
+ }
+ else if(XMC_Bank == XMC_Bank3_NAND)
+ {
+ tmpsr = XMC_Bank3->BK3STS;
+ }
+ /* XMC_Bank4_PCCARD*/
+ else
+ {
+ tmpsr = XMC_Bank4->BK4STS;
+ }
+
+ itstatus = tmpsr & XMC_INT;
+
+ itenable = tmpsr & (XMC_INT >> 3);
+
+ if ((itstatus != (uint32_t)RESET) && (itenable != (uint32_t)RESET))
+ {
+ bitstatus = SET;
+ }
+ else
+ {
+ bitstatus = RESET;
+ }
+
+ return bitstatus;
+}
+
+/**
+ * @brief Clears the XMC's interrupt pending bits.
+ * @param XMC_Bank: specifies the XMC Bank to be used
+ * This parameter can be one of the following values:
+ * @arg XMC_Bank2_NAND: XMC Bank2 NAND
+ * @arg XMC_Bank3_NAND: XMC Bank3 NAND
+ * @arg XMC_Bank4_PCCARD: XMC Bank4 PCCARD
+ * @param XMC_INT: specifies the interrupt pending bit to clear.
+ * This parameter can be any combination of the following values:
+ * @arg XMC_INT_RisingEdge: Rising edge detection interrupt.
+ * @arg XMC_INT_Level: Level edge detection interrupt.
+ * @arg XMC_INT_FallingEdge: Falling edge detection interrupt.
+ * @retval None
+ */
+void XMC_ClearINTPendingBit(uint32_t XMC_Bank, uint32_t XMC_INT)
+{
+ /* Check the parameters */
+ assert_param(IS_XMC_INT_BANK(XMC_Bank));
+ assert_param(IS_XMC_INT(XMC_INT));
+
+ if(XMC_Bank == XMC_Bank2_NAND)
+ {
+ XMC_Bank2->BK2STS &= ~(XMC_INT >> 3);
+ }
+ else if(XMC_Bank == XMC_Bank3_NAND)
+ {
+ XMC_Bank3->BK3STS &= ~(XMC_INT >> 3);
+ }
+ /* XMC_Bank4_PCCARD*/
+ else
+ {
+ XMC_Bank4->BK4STS &= ~(XMC_INT >> 3);
+ }
+}
+
+/**
+ * @}
+ */
+
+#endif /* AT32F403xx || AT32F403Axx || AT32F407xx */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/misc.c b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/misc.c
new file mode 100644
index 0000000000000000000000000000000000000000..85c0663d62be2aa433e00e0998ab3ce2fc4f35f7
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/AT32F4xx_StdPeriph_Driver/src/misc.c
@@ -0,0 +1,214 @@
+/**
+ **************************************************************************
+ * File Name : misc.c
+ * Description : at32f4xx MISC source file
+ * Date : 2018-10-08
+ * Version : V1.0.5
+ **************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "misc.h"
+
+/** @addtogroup at32f4xx_StdPeriph_Driver
+ * @{
+ */
+
+/** @defgroup MISC
+ * @brief MISC driver modules
+ * @{
+ */
+
+/** @defgroup MISC_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup MISC_Private_Defines
+ * @{
+ */
+
+#define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000)
+/**
+ * @}
+ */
+
+/** @defgroup MISC_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup MISC_Private_Variables
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup MISC_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @defgroup MISC_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Configures the priority grouping: pre-emption priority and subpriority.
+ * @param NVIC_PriorityGroup: specifies the priority grouping bits length.
+ * This parameter can be one of the following values:
+ * @arg NVIC_PriorityGroup_0: 0 bits for pre-emption priority
+ * 4 bits for subpriority
+ * @arg NVIC_PriorityGroup_1: 1 bits for pre-emption priority
+ * 3 bits for subpriority
+ * @arg NVIC_PriorityGroup_2: 2 bits for pre-emption priority
+ * 2 bits for subpriority
+ * @arg NVIC_PriorityGroup_3: 3 bits for pre-emption priority
+ * 1 bits for subpriority
+ * @arg NVIC_PriorityGroup_4: 4 bits for pre-emption priority
+ * 0 bits for subpriority
+ * @retval None
+ */
+void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup)
+{
+ /* Check the parameters */
+ assert_param(IS_NVIC_PRIORITY_GROUP(NVIC_PriorityGroup));
+
+ /* Set the PRIGROUP[10:8] bits according to NVIC_PriorityGroup value */
+ SCB->AIRCR = AIRCR_VECTKEY_MASK | NVIC_PriorityGroup;
+}
+
+/**
+ * @brief Initializes the NVIC peripheral according to the specified
+ * parameters in the NVIC_InitStruct.
+ * @param NVIC_InitStruct: pointer to a NVIC_InitType structure that contains
+ * the configuration information for the specified NVIC peripheral.
+ * @retval None
+ */
+void NVIC_Init(NVIC_InitType* NVIC_InitStruct)
+{
+ uint32_t tmppriority = 0x00, tmppre = 0x00, tmpsub = 0x0F;
+
+ /* Check the parameters */
+ assert_param(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd));
+ assert_param(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority));
+ assert_param(IS_NVIC_SUB_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelSubPriority));
+
+ if (NVIC_InitStruct->NVIC_IRQChannelCmd != DISABLE)
+ {
+ /* Compute the Corresponding IRQ Priority --------------------------------*/
+ tmppriority = (0x700 - ((SCB->AIRCR) & (uint32_t)0x700)) >> 0x08;
+ tmppre = (0x4 - tmppriority);
+ tmpsub = tmpsub >> tmppriority;
+
+ tmppriority = (uint32_t)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre;
+ tmppriority |= NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub;
+ tmppriority = tmppriority << 0x04;
+
+ NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority;
+
+ /* Enable the Selected IRQ Channels --------------------------------------*/
+ NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
+ (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
+ }
+ else
+ {
+ /* Disable the Selected IRQ Channels -------------------------------------*/
+ NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
+ (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
+ }
+}
+
+/**
+ * @brief Sets the vector table location and Offset.
+ * @param NVIC_VectTab: specifies if the vector table is in RAM or FLASH memory.
+ * This parameter can be one of the following values:
+ * @arg NVIC_VectTab_RAM
+ * @arg NVIC_VectTab_FLASH
+ * @param Offset: Vector Table base offset field. This value must be a multiple
+ * of 0x200.
+ * @retval None
+ */
+void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset)
+{
+ /* Check the parameters */
+ assert_param(IS_NVIC_VECTTAB(NVIC_VectTab));
+ assert_param(IS_NVIC_OFFSET(Offset));
+
+ SCB->VTOR = NVIC_VectTab | (Offset & (uint32_t)0x1FFFFF80);
+}
+
+/**
+ * @brief Selects the condition for the system to enter low power mode.
+ * @param LowPowerMode: Specifies the new mode for the system to enter low power mode.
+ * This parameter can be one of the following values:
+ * @arg NVIC_LP_SEVONPEND
+ * @arg NVIC_LP_SLEEPDEEP
+ * @arg NVIC_LP_SLEEPONEXIT
+ * @param NewState: new state of LP condition. This parameter can be: ENABLE or DISABLE.
+ * @retval None
+ */
+void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState)
+{
+ /* Check the parameters */
+ assert_param(IS_NVIC_LP(LowPowerMode));
+ assert_param(IS_FUNCTIONAL_STATE(NewState));
+
+ if (NewState != DISABLE)
+ {
+ SCB->SCR |= LowPowerMode;
+ }
+ else
+ {
+ SCB->SCR &= (uint32_t)(~(uint32_t)LowPowerMode);
+ }
+}
+
+/**
+ * @brief Configures the SysTick clock source.
+ * @param SysTick_CLKSource: specifies the SysTick clock source.
+ * This parameter can be one of the following values:
+ * @arg SysTick_CLKSource_HCLK_Div8: AHB clock divided by 8 selected as SysTick clock source.
+ * @arg SysTick_CLKSource_HCLK: AHB clock selected as SysTick clock source.
+ * @retval None
+ */
+void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource)
+{
+ /* Check the parameters */
+ assert_param(IS_SYSTICK_CLK_SOURCE(SysTick_CLKSource));
+
+ if (SysTick_CLKSource == SysTick_CLKSource_HCLK)
+ {
+ SysTick->CTRL |= SysTick_CLKSource_HCLK;
+ }
+ else
+ {
+ SysTick->CTRL &= SysTick_CLKSource_HCLK_Div8;
+ }
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/inc/at32f4xx.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/inc/at32f4xx.h
new file mode 100644
index 0000000000000000000000000000000000000000..9cd0149e811568f1ebe305d2d4385342756f511b
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/inc/at32f4xx.h
@@ -0,0 +1,9908 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx.h
+ * Description : at32f4xx peripheral access layer header file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup at32f4xx
+ * @{
+ */
+
+#ifndef __AT32F4xx_H
+#define __AT32F4xx_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup Library_configuration_section
+ * @{
+ */
+
+/* Uncomment the line below according to the target AT32 device used in your
+ application
+ */
+#if !defined (AT32F403Cx_MD) && !defined (AT32F403Cx_HD) && \
+ !defined (AT32F403Cx_XL) && !defined (AT32F403Rx_HD) && \
+ !defined (AT32F403Rx_XL) && !defined (AT32F403Vx_HD) && \
+ !defined (AT32F403Vx_XL) && !defined (AT32F403Zx_HD) && \
+ !defined (AT32F403Zx_XL) && \
+ !defined (AT32F413Kx_MD) && !defined (AT32F413Kx_HD) && \
+ !defined (AT32F413Cx_MD) && !defined (AT32F413Cx_HD) && \
+ !defined (AT32F413Rx_MD) && !defined (AT32F413Rx_HD) && \
+ !defined (AT32FEBKCx_MD) && !defined (TS32F401CBU7) && \
+ !defined (AT32F415C8T7) && !defined (AT32F415CBT7) && !defined (AT32F415CCT7) && \
+ !defined (AT32F415CBU7) && !defined (AT32F415CCU7) && !defined (AT32F415R8T7) && \
+ !defined (AT32F415RBT7) && !defined (AT32F415RCT7) && !defined (AT32F415K8U7_4)&& \
+ !defined (AT32F415KBU7_4)&& !defined (AT32F415KCU7_4)&& !defined (AT32F415R8T7_7)&& \
+ !defined (AT32F415RBT7_7)&& !defined (AT32F415RCT7_7)&& \
+ !defined (AT32F407RGT7) && !defined (AT32F407VGT7) && !defined (AT32F407RCT7) && \
+ !defined (AT32F407VCT7) && \
+ !defined (AT32F403AVCT7) && !defined (AT32F403ARCT7) && !defined (AT32F403ACCT7) && \
+ !defined (AT32F403ACCU7) && !defined (AT32F403AVGT7) && !defined (AT32F403ACGT7) && \
+ !defined (AT32F403ARGT7) && !defined (AT32F403ACGU7) && !defined (AT32F403AVET7) && \
+ !defined (AT32F403ARET7) && !defined (AT32F403ACEU7) && !defined (AT32F403ACET7)
+/* #define AT32F403Cx_MD */ /*!< AT32F403Cx_MD: LQFP48, Medium density devices: AT32F403CB */
+/* #define AT32F403Cx_HD */ /*!< AT32F403Cx_HD: LQFP48, High density devices: AT32F403CC, AT32F403CE */
+/* #define AT32F403Cx_XL */ /*!< AT32F403Cx_XL: LQFP48, XL-density devices: AT32F403CG */
+/* #define AT32F403Rx_HD */ /*!< AT32F403Rx_HD: LQFP64, High density devices: AT32F403RC, AT32F403RE */
+/* #define AT32F403Rx_XL */ /*!< AT32F403Rx_XL: LQFP64, XL-density devices: AT32F403RG */
+/* #define AT32F403Vx_HD */ /*!< AT32F403Vx_HD: LQFP100, High density devices: AT32F403VC, AT32F403VE */
+/* #define AT32F403Vx_XL */ /*!< AT32F403Vx_XL: LQFP100, XL-density devices: AT32F403VG */
+/* #define AT32F403Zx_HD */ /*!< AT32F403Zx_HD: LQFP144, High density devices: AT32F403ZC, AT32F403ZE */
+/* #define AT32F403Zx_XL */ /*!< AT32F403Zx_XL: LQFP144, XL-density devices: AT32F403ZG */
+
+/* #define AT32F413Kx_MD */ /*!< AT32F413Kx_MD: LQFP32, Medium density devices: AT32F413KB */
+/* #define AT32F413Kx_HD */ /*!< AT32F413Kx_HD: LQFP32, High density devices: AT32F413KC */
+/* #define AT32F413Cx_MD */ /*!< AT32F413Cx_MD: LQFP48, Medium density devices: AT32F413C8, AT32F413CB */
+/* #define AT32F413Cx_HD */ /*!< AT32F413Cx_HD: LQFP48, High density devices: AT32F413CC */
+/* #define AT32F413Rx_MD */ /*!< AT32F413Rx_MD: LQFP64, Medium density devices: AT32F413RB */
+/* #define AT32F413Rx_HD */ /*!< AT32F413Rx_HD: LQFP64, High density devices: AT32F413RC */
+/* #define AT32FEBKCx_MD */ /*!< AT32FEBKCx_MD: LQFP48, Medium density devices: AT32FEBKC8*/
+/* #define TS32F401CBU7 */ /*!< TS32F401CBU7: QFN48, Medium density devices: TS32F401CBU7 */
+
+/* #define AT32F415C8T7 */ /*!< AT32F415C8T7: LQFP48, Medium density devices: AT32F415C8T7 */
+/* #define AT32F415CBT7 */ /*!< AT32F415CBT7: LQFP48, Medium density devices: AT32F415CBT7 */
+/* #define AT32F415CCT7 */ /*!< AT32F415CCT7: LQFP48, High density devices: AT32F415CCT7 */
+/* #define AT32F415CBU7 */ /*!< AT32F415CBU7: QFN48, Medium density devices: AT32F415CBU7 */
+/* #define AT32F415CCU7 */ /*!< AT32F415CCU7: QFN48, High density devices: AT32F415CCU7 */
+/* #define AT32F415R8T7 */ /*!< AT32F415R8T7: LQFP64, Medium density devices: AT32F415R8T7 */
+/* #define AT32F415RBT7 */ /*!< AT32F415RBT7: LQFP64, Medium density devices: AT32F415RBT7 */
+/* #define AT32F415RCT7 */ /*!< AT32F415RCT7: LQFP64, High density devices: AT32F415RCT7 */
+/* #define AT32F415K8U7_4 */ /*!< AT32F415K8U7_4: QFN32, Medium density devices: AT32F415K8U7_4 */
+/* #define AT32F415KBU7_4 */ /*!< AT32F415KBU7_4: QFN32, Medium density devices: AT32F415KBU7_4 */
+/* #define AT32F415KCU7_4 */ /*!< AT32F415KCU7_4: QFN32, High density devices: AT32F415KCU7_4 */
+/* #define AT32F415R8T7_7 */ /*!< AT32F415R8T7_7: LQFP64, Medium density devices: AT32F415R8T7_7 */
+/* #define AT32F415RBT7_7 */ /*!< AT32F415RBT7_7: LQFP64, Medium density devices: AT32F415RBT7_7 */
+/* #define AT32F415RCT7_7 */ /*!< AT32F415RCT7_7: LQFP64, High density devices: AT32F415RCT7_7 */
+
+/* #define AT32F407RGT7 */ /*!< AT32F407RGT7: LQFP64, XL-density devices: AT32F407RGT7 */
+/* #define AT32F407VGT7 */ /*!< AT32F407VGT7: LQFP100, XL-density devices: AT32F407VGT7 */
+/* #define AT32F407RET7 */ /*!< AT32F407RET7: LQFP64, XL-density devices: AT32F407RET7 */
+/* #define AT32F407VET7 */ /*!< AT32F407VET7: LQFP100, XL-density devices: AT32F407VET7 */
+/* #define AT32F407RCT7 */ /*!< AT32F407RCT7: LQFP64, High density devices: AT32F407RCT7 */
+/* #define AT32F407VCT7 */ /*!< AT32F407VCT7: LQFP100, High density devices: AT32F407VCT7 */
+
+/* #define AT32F403AVCT7 */ /*!< AT32F403AVCT7: LQFP100, High density devices: AT32F403AVCT7 */
+/* #define AT32F403ARCT7 */ /*!< AT32F403ARCT7: LQFP64, High density devices: AT32F403ARCT7 */
+/* #define AT32F403ACCT7 */ /*!< AT32F403ACCT7: LQFP48, High density devices: AT32F403ACCT7 */
+/* #define AT32F403ACCU7 */ /*!< AT32F403ACCU7: QFN48, High density devices: AT32F403ACCU7 */
+/* #define AT32F403AVET7 */ /*!< AT32F403AVET7: LQFP100, XL-density devices: AT32F403AVET7 */
+/* #define AT32F403ARET7 */ /*!< AT32F403ARET7: LQFP64, XL-density devices: AT32F403ARET7 */
+/* #define AT32F403ACET7 */ /*!< AT32F403ACET7: LQFP48, XL-density devices: AT32F403ACET7 */
+/* #define AT32F403ACEU7 */ /*!< AT32F403ACEU7: QFN48, XL-density devices: AT32F403ACEU7 */
+/* #define AT32F403AVGT7 */ /*!< AT32F403AVGT7: LQFP100, XL-density devices: AT32F403AVGT7 */
+/* #define AT32F403ACGT7 */ /*!< AT32F403ACGT7: LQFP48, XL-density devices: AT32F403ACGT7 */
+/* #define AT32F403ARGT7 */ /*!< AT32F403ARGT7: LQFP64, XL-density devices: AT32F403ARGT7 */
+/* #define AT32F403ACGU7 */ /*!< AT32F403ACGU7: QFN48, XL-density devices: AT32F403ACGU7 */
+
+#endif
+/* Tip: To avoid modifying this file each time you need to switch between these
+ devices, you can define the device in your toolchain compiler preprocessor.
+
+ - Medium-density devices are at32f4xx microcontrollers where
+ the Flash memory density ranges between 64 and 128 Kbytes.
+ - High-density devices are at32f4xx microcontrollers where
+ the Flash memory density ranges between 256 and 512 Kbytes.
+ - XL-density devices are at32f4xx microcontrollers where
+ the Flash memory density ranges between 512 and 1024 Kbytes.
+ */
+
+#if !defined (AT32F403Cx_MD) && !defined (AT32F403Cx_HD) && \
+ !defined (AT32F403Cx_XL) && !defined (AT32F403Rx_HD) && \
+ !defined (AT32F403Rx_XL) && !defined (AT32F403Vx_HD) && \
+ !defined (AT32F403Vx_XL) && !defined (AT32F403Zx_HD) && \
+ !defined (AT32F403Zx_XL) && \
+ !defined (AT32F413Kx_MD) && !defined (AT32F413Kx_HD) && \
+ !defined (AT32F413Cx_MD) && !defined (AT32F413Cx_HD) && \
+ !defined (AT32F413Rx_MD) && !defined (AT32F413Rx_HD) && \
+ !defined (AT32FEBKCx_MD) && !defined (TS32F401CBU7) && \
+ !defined (AT32F415C8T7) && !defined (AT32F415CBT7) && !defined (AT32F415CCT7) && \
+ !defined (AT32F415CBU7) && !defined (AT32F415CCU7) && !defined (AT32F415R8T7) && \
+ !defined (AT32F415RBT7) && !defined (AT32F415RCT7) && !defined (AT32F415K8U7_4)&& \
+ !defined (AT32F415KBU7_4)&& !defined (AT32F415KCU7_4)&& !defined (AT32F415R8T7_7)&& \
+ !defined (AT32F415RBT7_7)&& !defined (AT32F415RCT7_7)&& \
+ !defined (AT32F407RGT7) && !defined (AT32F407VGT7) && !defined (AT32F407RCT7) && \
+ !defined (AT32F407VCT7) && !defined (AT32F407RET7) && !defined (AT32F407VET7) && \
+ !defined (AT32F403AVCT7) && !defined (AT32F403ARCT7) && !defined (AT32F403ACCT7) && \
+ !defined (AT32F403ACCU7) && !defined (AT32F403AVGT7) && !defined (AT32F403ACGT7) && \
+ !defined (AT32F403ARGT7) && !defined (AT32F403ACGU7) && !defined (AT32F403AVET7) && \
+ !defined (AT32F403ARET7) && !defined (AT32F403ACET7) && !defined (AT32F403ACEU7)
+#error "Please select first the target at32f4xx device used in your application (in at32f4xx.h file)"
+#endif
+
+#if defined (AT32F403Cx_MD) || defined (AT32F403Cx_HD) || \
+ defined (AT32F403Cx_XL) || defined (AT32F403Rx_HD) || \
+ defined (AT32F403Rx_XL) || defined (AT32F403Vx_HD) || \
+ defined (AT32F403Vx_XL) || defined (AT32F403Zx_HD) || \
+ defined (AT32F403Zx_XL)
+
+ #define AT32F403xx
+#endif
+
+#if defined (AT32F413Kx_MD) || defined (AT32F413Kx_HD) || \
+ defined (AT32F413Cx_MD) || defined (AT32F413Cx_HD) || \
+ defined (AT32F413Rx_MD) || defined (AT32F413Rx_HD) || \
+ defined (AT32FEBKCx_MD) || defined (TS32F401CBU7)
+
+ #define AT32F413xx
+#endif
+
+#if defined (AT32F415C8T7) || defined (AT32F415CBT7) || defined (AT32F415CCT7) || \
+ defined (AT32F415CBU7) || defined (AT32F415CCU7) || defined (AT32F415R8T7) || \
+ defined (AT32F415RBT7) || defined (AT32F415RCT7) || defined (AT32F415K8U7_4)|| \
+ defined (AT32F415KBU7_4)|| defined (AT32F415KCU7_4)|| defined (AT32F415R8T7_7)|| \
+ defined (AT32F415RBT7_7)|| defined (AT32F415RCT7_7)
+
+ #define AT32F415xx
+#endif
+
+#if defined (AT32F407RGT7) || defined (AT32F407VGT7) || defined (AT32F407RCT7) || \
+ defined (AT32F407VCT7) || defined (AT32F407VET7) || defined (AT32F407RET7)
+
+ #define AT32F407xx
+#endif
+
+#if defined (AT32F403AVCT7) || defined (AT32F403ARCT7) || defined (AT32F403ACCT7) || \
+ defined (AT32F403ACCU7) || defined (AT32F403AVGT7) || defined (AT32F403ACGT7) || \
+ defined (AT32F403ARGT7) || defined (AT32F403ACGU7) || defined (AT32F403AVET7) || \
+ defined (AT32F403ACET7) || defined (AT32F403ARET7) || defined (AT32F403ACEU7)
+
+ #define AT32F403Axx
+#endif
+
+#if !defined USE_STDPERIPH_DRIVER
+/**
+ * @brief Comment the line below if you will not use the peripherals drivers.
+ In this case, these drivers will not be included and the application code will
+ be based on direct access to peripherals registers
+ */
+ #ifdef _RTE_
+ #include "RTE_Components.h"
+ #ifdef RTE_DEVICE_STDPERIPH_FRAMEWORK
+ #define USE_STDPERIPH_DRIVER
+ #endif
+ #endif
+#endif
+
+#if !defined LIBRARY_VERSION
+/**
+ * @brief Comment the line below if you will not use the peripherals drivers.
+ In this case, these drivers will not be included and the application code will
+ be based on direct access to peripherals registers
+ */
+/*#define LIBRARY_VERSION*/
+#endif
+
+/**
+ * @brief In the following line adjust the value of External High Speed oscillator (HSE)
+ used in your application
+
+ Tip: To avoid modifying this file each time you need to use different HSE, you
+ can define the HSE value in your toolchain compiler preprocessor.
+ */
+#if !defined HSE_VALUE
+#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+
+/**
+ * @brief In the following line adjust the External High Speed oscillator (HSE) Startup
+ Timeout value
+ */
+#define HSE_STARTUP_TIMEOUT ((uint16_t)0x3000) /*!< Time out for HSE start up */
+
+#define HSI_VALUE ((uint32_t)8000000) /*!< Value of the Internal oscillator in Hz*/
+
+/**
+ * @brief at32f4xx Standard Peripheral Library version number
+ */
+#define __AT32F4xx_LIBRARY_VERSION_MAIN (0x01) /*!< [31:24] main version */
+#define __AT32F4xx_LIBRARY_VERSION_MIDDLE (0x00) /*!< [23:16] middle version */
+#define __AT32F4xx_LIBRARY_VERSION_MINOR (0x01) /*!< [15:8] minor version */
+#define __AT32F4xx_LIBRARY_VERSION_RC (0x00) /*!< [7:0] release candidate */
+#define __AT32F4xx_LIBRARY_VERSION ( (__AT32F4xx_LIBRARY_VERSION_MAIN << 24)\
+ |(__AT32F4xx_LIBRARY_VERSION_MIDDLE << 16)\
+ |(__AT32F4xx_LIBRARY_VERSION_MINOR << 8)\
+ |(__AT32F4xx_LIBRARY_VERSION_RC))
+
+/**
+ * @}
+ */
+
+/** @addtogroup Configuration_section_for_CMSIS
+ * @{
+ */
+
+/**
+ * @brief Configuration of the Cortex-M4 Processor and Core Peripherals
+ */
+#define __CM4_REV 0x0001U /*!< Core revision r0p1 */
+#define __MPU_PRESENT 0 /*!< AT32 devices do not provide an MPU */
+#define __NVIC_PRIO_BITS 4 /*!< AT32 uses 4 Bits for the Priority Levels */
+#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
+#define __FPU_PRESENT 1U /*!< FPU present */
+
+/**
+ * @brief at32f4xx Interrupt Number Definition, according to the selected device
+ * in @ref Library_configuration_section
+ */
+typedef enum IRQn
+{
+ /****** Cortex-M4 Processor Exceptions Numbers ***************************************************/
+ Reset_IRQn = -15, /*!< 1 Reset Vector, invoked on Power up and warm reset */
+ NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
+ HardFault_IRQn = -13, /*!< 3 Hard Fault, all classes of Fault */
+ MemoryManagement_IRQn = -12, /*!< 4 Cortex-M4 Memory Management Interrupt */
+ BusFault_IRQn = -11, /*!< 5 Cortex-M4 Bus Fault Interrupt */
+ UsageFault_IRQn = -10, /*!< 6 Cortex-M4 Usage Fault Interrupt */
+ SVCall_IRQn = -5, /*!< 11 Cortex-M4 SV Call Interrupt */
+ DebugMonitor_IRQn = -4, /*!< 12 Cortex-M4 Debug Monitor Interrupt */
+ PendSV_IRQn = -2, /*!< 14 Cortex-M4 Pend SV Interrupt */
+ SysTick_IRQn = -1, /*!< 15 Cortex-M4 System Tick Interrupt */
+
+ /****** AT32 specific Interrupt Numbers *********************************************************/
+ WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */
+ PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */
+#ifdef AT32F415xx
+ TAMP_STAMP_IRQn = 2, /*!< Tamper and TimeStamp interrupts through the EXTI line*/
+ ERTC_WKUP_IRQn = 3, /*!< ERTC Wakeup interrupt through the EXTI line */
+#else
+ TAMPER_IRQn = 2, /*!< Tamper Interrupt */
+ RTC_IRQn = 3, /*!< RTC global Interrupt */
+#endif
+ FLASH_IRQn = 4, /*!< FLASH global Interrupt */
+ RCC_IRQn = 5, /*!< RCC global Interrupt */
+ EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */
+ EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */
+ EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */
+ EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */
+ EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */
+ DMA1_Channel1_IRQn = 11, /*!< DMA1 Channel 1 global Interrupt */
+ DMA1_Channel2_IRQn = 12, /*!< DMA1 Channel 2 global Interrupt */
+ DMA1_Channel3_IRQn = 13, /*!< DMA1 Channel 3 global Interrupt */
+ DMA1_Channel4_IRQn = 14, /*!< DMA1 Channel 4 global Interrupt */
+ DMA1_Channel5_IRQn = 15, /*!< DMA1 Channel 5 global Interrupt */
+ DMA1_Channel6_IRQn = 16, /*!< DMA1 Channel 6 global Interrupt */
+ DMA1_Channel7_IRQn = 17, /*!< DMA1 Channel 7 global Interrupt */
+
+#ifdef AT32F403Cx_MD
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+#endif /* AT32F403Cx_MD */
+
+#ifdef AT32F403Cx_HD
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+#endif /* AT32F403Cx_HD */
+
+#ifdef AT32F403Cx_XL
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+#endif /* AT32F403Cx_XL */
+
+#ifdef AT32F403Rx_HD
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ SDIO1_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+#endif /* AT32F403Rx_HD */
+
+#ifdef AT32F403Rx_XL
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ SDIO1_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+#endif /* AT32F403Rx_XL */
+
+#ifdef AT32F403Vx_HD
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ XMC_IRQn = 48, /*!< XMC global Interrupt */
+ SDIO1_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+ SPI4_IRQn = 63, /*!< SPI4 global Interrupt */
+#endif /* AT32F403Vx_HD */
+
+#ifdef AT32F403Vx_XL
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ XMC_IRQn = 48, /*!< XMC global Interrupt */
+ SDIO1_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+ SPI4_IRQn = 63, /*!< SPI4 global Interrupt */
+#endif /* AT32F403Vx_XL */
+
+#ifdef AT32F403Zx_HD
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ XMC_IRQn = 48, /*!< XMC global Interrupt */
+ SDIO1_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+ SPI4_IRQn = 63, /*!< SPI4 global Interrupt */
+ TMR15_BRK_IRQn = 64, /*!< TMR15 Break interrupt */
+ TMR15_OV_IRQn = 65, /*!< TMR15 Update interrupt */
+ TMR15_TRG_HALL_IRQn = 66, /*!< TMR15 Trigger and Commutation Interrupt */
+ TMR15_CC_IRQn = 67 /*!< TMR15 Capture Compare Interrupt */
+#endif /* AT32F403Zx_HD */
+
+#ifdef AT32F403Zx_XL
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ XMC_IRQn = 48, /*!< XMC global Interrupt */
+ SDIO1_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+ SPI4_IRQn = 63, /*!< SPI4 global Interrupt */
+ TMR15_BRK_IRQn = 64, /*!< TMR15 Break interrupt */
+ TMR15_OV_IRQn = 65, /*!< TMR15 Update interrupt */
+ TMR15_TRG_HALL_IRQn = 66, /*!< TMR15 Trigger and Commutation Interrupt */
+ TMR15_CC_IRQn = 67 /*!< TMR15 Capture Compare Interrupt */
+#endif /* AT32F403Zx_XL */
+
+#if defined (AT32F413Kx_MD) || defined (AT32F413Kx_HD)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ SDIO_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ ACC_IRQn = 72, /*!< ACC interrupt */
+ USB_HP_IRQn = 73, /*!< USB Device High Priority Interrupts */
+ USB_LP_IRQn = 74, /*!< USB Device Low Priority Interrupts */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel6 and Channel7 global interrupts */
+#endif /* AT32F413Kx_MD || AT32F413Kx_HD */
+
+#if defined (AT32F413Cx_MD) || defined (TS32F401CBU7)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ SDIO_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ CAN2_TX_IRQn = 68, /*!< CAN2 TX Interrupt */
+ CAN2_RX0_IRQn = 69, /*!< CAN2 RX0 Interrupt */
+ CAN2_RX1_IRQn = 70, /*!< CAN2 RX1 Interrupt */
+ CAN2_SCE_IRQn = 71, /*!< CAN2 SCE Interrupt */
+ ACC_IRQn = 72, /*!< ACC interrupt */
+ USB_HP_IRQn = 73, /*!< USB Device High Priority Interrupts */
+ USB_LP_IRQn = 74, /*!< USB Device Low Priority Interrupts */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel6 and Channel7 global interrupts */
+#endif /* AT32F413Cx_MD || TS32F401CBU7 */
+
+#if defined (AT32F413Cx_HD)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ SDIO_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ CAN2_TX_IRQn = 68, /*!< CAN2 TX Interrupt */
+ CAN2_RX0_IRQn = 69, /*!< CAN2 RX0 Interrupt */
+ CAN2_RX1_IRQn = 70, /*!< CAN2 RX1 Interrupt */
+ CAN2_SCE_IRQn = 71, /*!< CAN2 SCE Interrupt */
+ ACC_IRQn = 72, /*!< ACC interrupt */
+ USB_HP_IRQn = 73, /*!< USB Device High Priority Interrupts */
+ USB_LP_IRQn = 74, /*!< USB Device Low Priority Interrupts */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel6 and Channel7 global interrupts */
+#endif /*AT32F413Cx_HD */
+
+#if defined (AT32F413Rx_MD)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ SDIO_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ CAN2_TX_IRQn = 68, /*!< CAN2 TX Interrupt */
+ CAN2_RX0_IRQn = 69, /*!< CAN2 RX0 Interrupt */
+ CAN2_RX1_IRQn = 70, /*!< CAN2 RX1 Interrupt */
+ CAN2_SCE_IRQn = 71, /*!< CAN2 SCE Interrupt */
+ ACC_IRQn = 72, /*!< ACC interrupt */
+ USB_HP_IRQn = 73, /*!< USB Device High Priority Interrupts */
+ USB_LP_IRQn = 74, /*!< USB Device Low Priority Interrupts */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel6 and Channel7 global interrupts */
+#endif /* AT32F413Rx_MD*/
+
+#if defined (AT32F413Rx_HD)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_HALL_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ SDIO_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ CAN2_TX_IRQn = 68, /*!< CAN2 TX Interrupt */
+ CAN2_RX0_IRQn = 69, /*!< CAN2 RX0 Interrupt */
+ CAN2_RX1_IRQn = 70, /*!< CAN2 RX1 Interrupt */
+ CAN2_SCE_IRQn = 71, /*!< CAN2 SCE Interrupt */
+ ACC_IRQn = 72, /*!< ACC interrupt */
+ USB_HP_IRQn = 73, /*!< USB Device High Priority Interrupts */
+ USB_LP_IRQn = 74, /*!< USB Device Low Priority Interrupts */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel6 and Channel7 global interrupts */
+#endif /*AT32F413Rx_HD */
+
+#if defined (AT32FEBKCx_MD)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ USB_HP_IRQn = 73, /*!< USB Device High Priority Interrupts */
+ USB_LP_IRQn = 74, /*!< USB Device Low Priority Interrupts */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel6 and Channel7 global interrupts */
+#endif /* AT32FEBKCx_MD*/
+
+#if defined (AT32F415K8U7_4) || defined (AT32F415KBU7_4) || defined (AT32F415KCU7_4)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ CAN1_TX_IRQn = 19, /*!< CAN1 TX Interrupts */
+ CAN1_RX0_IRQn = 20, /*!< CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ ERTCAlarm_IRQn = 41, /*!< ERTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ SDIO_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ USBOTG_IRQn = 67, /*!< USBOTG interrupt */
+ COMP1_IRQn = 70, /*!< Compare1 Interrupts */
+ COMP2_IRQn = 71, /*!< Compare2 Interrupts */
+ ACC_IRQn = 72, /*!< ACC interrupt */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel6 and Channel7 global interrupts */
+#endif /* AT32F415K8U7_4 || AT32F415KBU7_4 || AT32F415KCU7_4 */
+
+#if defined (AT32F415C8T7) || defined (AT32F415CBT7) || defined (AT32F415CCT7) ||\
+ defined (AT32F415CBU7) || defined (AT32F415CCU7)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ CAN1_TX_IRQn = 19, /*!< CAN1 TX Interrupts */
+ CAN1_RX0_IRQn = 20, /*!< CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ ERTCAlarm_IRQn = 41, /*!< ERTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ SDIO_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ USBOTG_IRQn = 67, /*!< USBOTG interrupt */
+ COMP1_IRQn = 70, /*!< Compare1 Interrupts */
+ COMP2_IRQn = 71, /*!< Compare2 Interrupts */
+ ACC_IRQn = 72, /*!< ACC interrupt */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel6 and Channel7 global interrupts */
+#endif /* AT32F415C8T7 || AT32F415CBT7 || AT32F415CCT7 || AT32F415CBU7 || AT32F415CCU7 */
+
+#if defined (AT32F415R8T7) || defined (AT32F415R8T7_7) || \
+ defined (AT32F415RBT7) || defined (AT32F415RBT7_7) || \
+ defined (AT32F415RCT7) || defined (AT32F415RCT7_7)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ CAN1_TX_IRQn = 19, /*!< CAN1 TX Interrupts */
+ CAN1_RX0_IRQn = 20, /*!< CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_HALL_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ ERTCAlarm_IRQn = 41, /*!< ERTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ SDIO_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ USBOTG_IRQn = 67, /*!< USBOTG interrupt */
+ COMP1_IRQn = 70, /*!< Compare1 Interrupts */
+ COMP2_IRQn = 71, /*!< Compare2 Interrupts */
+ ACC_IRQn = 72, /*!< ACC interrupt */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel6 and Channel7 global interrupts */
+#endif /* AT32F415R8T7 || AT32F415R8T7_7 || AT32F415RBT7 || AT32F415RBT7_7 || AT32F415RCT7 || AT32F415RCT7_7 */
+
+#if defined (AT32F403AVCT7) || defined (AT32F403ARCT7) || \
+ defined (AT32F403AVET7) || defined (AT32F403ARET7) || \
+ defined (AT32F403AVGT7) || defined (AT32F403ARGT7)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_COM_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_I2S2EXT_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_COM_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ XMC_IRQn = 48, /*!< XMC global Interrupt */
+ SDIO1_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_I2S3EXT_IRQn = 51, /*!< SPI3 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+ SPI4_IRQn = 63, /*!< SPI4 global Interrupt */
+ CAN2_TX_IRQn = 68, /*!< CAN2 Tx interrupt */
+ CAN2_RX0_IRQn = 69, /*!< CAN2 Rx0 interrupt */
+ CAN2_RX1_IRQn = 70, /*!< CAN2 Rx1 Interrupt */
+ CAN2_SCE_IRQn = 71, /*!< CAN2 SCE Interrupt */
+ ACC_IRQn = 72, /*!< ACC Interrupt */
+ USB_HP_IRQn = 73, /*!< USB HP Interrupt */
+ USB_LP_IRQn = 74, /*!< USB LP Interrupt */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel 6 and Channel 7 global Interrupt */
+ USART6_IRQn = 76, /*!< USART6 Interrupt */
+ UART7_IRQn = 77, /*!< UART7 Interrupt */
+ UART8_IRQn = 78, /*!< UART8 Interrupt */
+#endif /* AT32F403AVCT7 || AT32F403ARCT7 || AT32F403AVGT7 || \
+ AT32F403ARGT7 || AT32F403AVET7 || AT32F403ARET7 */
+
+
+#if defined (AT32F403ACCT7) || defined (AT32F403ACCU7) || \
+ defined (AT32F403ACET7) || defined (AT32F403ACEU7) || \
+ defined (AT32F403ACGT7) || defined (AT32F403ACGU7)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_COM_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_I2S2EXT_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_COM_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_I2S3EXT_IRQn = 51, /*!< SPI3 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+ SPI4_IRQn = 63, /*!< SPI4 global Interrupt */
+ CAN2_TX_IRQn = 68, /*!< CAN2 Tx interrupt */
+ CAN2_RX0_IRQn = 69, /*!< CAN2 Rx0 interrupt */
+ CAN2_RX1_IRQn = 70, /*!< CAN2 Rx1 Interrupt */
+ CAN2_SCE_IRQn = 71, /*!< CAN2 SCE Interrupt */
+ ACC_IRQn = 72, /*!< ACC Interrupt */
+ USB_HP_IRQn = 73, /*!< USB HP Interrupt */
+ USB_LP_IRQn = 74, /*!< USB LP Interrupt */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel 6 and Channel 7 global Interrupt */
+ USART6_IRQn = 76, /*!< USART6 Interrupt */
+ UART7_IRQn = 77, /*!< UART7 Interrupt */
+#endif /* AT32F403ACCT7 || AT32F403ACCU7 || AT32F403ACGT7 || \
+ AT32F403ACGU7 || AT32F403ACEU7 || AT32F403ACET7 */
+
+#if defined (AT32F407VCT7) || defined (AT32F407RCT7) || \
+ defined (AT32F407VET7) || defined (AT32F407RET7) || \
+ defined (AT32F407VGT7) || defined (AT32F407RGT7)
+ ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
+ USB_HP_CAN1_TX_IRQn = 19, /*!< USB Device High Priority or CAN1 TX Interrupts */
+ USB_LP_CAN1_RX0_IRQn = 20, /*!< USB Device Low Priority or CAN1 RX0 Interrupts */
+ CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt */
+ CAN1_SCE_IRQn = 22, /*!< CAN1 SCE Interrupt */
+ EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
+ TMR1_BRK_TMR9_IRQn = 24, /*!< TMR1 Break Interrupt */
+ TMR1_OV_TMR10_IRQn = 25, /*!< TMR1 Update Interrupt */
+ TMR1_TRG_COM_TMR11_IRQn = 26, /*!< TMR1 Trigger and Commutation Interrupt */
+ TMR1_CC_IRQn = 27, /*!< TMR1 Capture Compare Interrupt */
+ TMR2_GLOBAL_IRQn = 28, /*!< TMR2 global Interrupt */
+ TMR3_GLOBAL_IRQn = 29, /*!< TMR3 global Interrupt */
+ TMR4_GLOBAL_IRQn = 30, /*!< TMR4 global Interrupt */
+ I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
+ I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
+ I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
+ I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
+ SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
+ SPI2_I2S2EXT_IRQn = 36, /*!< SPI2 global Interrupt */
+ USART1_IRQn = 37, /*!< USART1 global Interrupt */
+ USART2_IRQn = 38, /*!< USART2 global Interrupt */
+ USART3_IRQn = 39, /*!< USART3 global Interrupt */
+ EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
+ RTCAlarm_IRQn = 41, /*!< RTC Alarm through EXTI Line Interrupt */
+ USBWakeUp_IRQn = 42, /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */
+ TMR8_BRK_TMR12_IRQn = 43, /*!< TMR8 Break Interrupt */
+ TMR8_OV_TMR13_IRQn = 44, /*!< TMR8 Update Interrupt */
+ TMR8_TRG_COM_TMR14_IRQn = 45, /*!< TMR8 Trigger and Commutation Interrupt */
+ TMR8_CC_IRQn = 46, /*!< TMR8 Capture Compare Interrupt */
+ ADC3_IRQn = 47, /*!< ADC3 global Interrupt */
+ XMC_IRQn = 48, /*!< XMC global Interrupt */
+ SDIO1_IRQn = 49, /*!< SDIO global Interrupt */
+ TMR5_GLOBAL_IRQn = 50, /*!< TMR5 global Interrupt */
+ SPI3_I2S3EXT_IRQn = 51, /*!< SPI3 global Interrupt */
+ UART4_IRQn = 52, /*!< UART4 global Interrupt */
+ UART5_IRQn = 53, /*!< UART5 global Interrupt */
+ TMR6_GLOBAL_IRQn = 54, /*!< TMR6 global Interrupt */
+ TMR7_GLOBAL_IRQn = 55, /*!< TMR7 global Interrupt */
+ DMA2_Channel1_IRQn = 56, /*!< DMA2 Channel 1 global Interrupt */
+ DMA2_Channel2_IRQn = 57, /*!< DMA2 Channel 2 global Interrupt */
+ DMA2_Channel3_IRQn = 58, /*!< DMA2 Channel 3 global Interrupt */
+ DMA2_Channel4_5_IRQn = 59, /*!< DMA2 Channel 4 and Channel 5 global Interrupt */
+ SDIO2_IRQn = 60, /*!< SDIO2 global Interrupt */
+ I2C3_EV_IRQn = 61, /*!< I2C3 event interrupt */
+ I2C3_ER_IRQn = 62, /*!< I2C3 error interrupt */
+ SPI4_IRQn = 63, /*!< SPI4 global Interrupt */
+ CAN2_TX_IRQn = 68, /*!< CAN2 Tx interrupt */
+ CAN2_RX0_IRQn = 69, /*!< CAN2 Rx0 interrupt */
+ CAN2_RX1_IRQn = 70, /*!< CAN2 Rx1 Interrupt */
+ CAN2_SCE_IRQn = 71, /*!< CAN2 SCE Interrupt */
+ ACC_IRQn = 72, /*!< ACC Interrupt */
+ USB_HP_IRQn = 73, /*!< USB HP Interrupt */
+ USB_LP_IRQn = 74, /*!< USB LP Interrupt */
+ DMA2_Channel6_7_IRQn = 75, /*!< DMA2 Channel 6 and Channel 7 global Interrupt */
+ USART6_IRQn = 76, /*!< USART6 Interrupt */
+ UART7_IRQn = 77, /*!< UART7 Interrupt */
+ UART8_IRQn = 78, /*!< UART8 Interrupt */
+ ETH_IRQn = 79, /*!< ETH Interrupt */
+ ETH_WKUP_IRQn = 80, /*!< ETH Wakeup Interrupt */
+#endif /* AT32F407VCT7 || AT32F407RCT7 || AT32F407VGT7 || \
+ AT32F407RGT7 || AT32F407RET7 || AT32F407VET7 */
+
+} IRQn_Type;
+
+/**
+ * @}
+ */
+
+#include "core_cm4.h"
+#include "system_at32f4xx.h"
+#include
+
+/** @addtogroup Exported_types
+ * @{
+ */
+
+typedef int32_t INT32;
+typedef int16_t INT16;
+typedef int8_t INT8;
+typedef uint32_t UINT32;
+typedef uint16_t UINT16;
+typedef uint8_t UINT8;
+
+/** at32f4xx Standard Peripheral Library old types (maintained for legacy purpose) */
+typedef int32_t s32;
+typedef int16_t s16;
+typedef int8_t s8;
+
+typedef const int32_t sc32; /*!< Read Only */
+typedef const int16_t sc16; /*!< Read Only */
+typedef const int8_t sc8; /*!< Read Only */
+
+typedef __IO int32_t vs32;
+typedef __IO int16_t vs16;
+typedef __IO int8_t vs8;
+
+typedef __I int32_t vsc32; /*!< Read Only */
+typedef __I int16_t vsc16; /*!< Read Only */
+typedef __I int8_t vsc8; /*!< Read Only */
+
+typedef uint32_t u32;
+typedef uint16_t u16;
+typedef uint8_t u8;
+
+typedef const uint32_t uc32; /*!< Read Only */
+typedef const uint16_t uc16; /*!< Read Only */
+typedef const uint8_t uc8; /*!< Read Only */
+
+typedef __IO uint32_t vu32;
+typedef __IO uint16_t vu16;
+typedef __IO uint8_t vu8;
+
+typedef __I uint32_t vuc32; /*!< Read Only */
+typedef __I uint16_t vuc16; /*!< Read Only */
+typedef __I uint8_t vuc8; /*!< Read Only */
+
+typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;
+
+typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
+#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
+
+typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
+
+/** at32f4xx Standard Peripheral Library old definitions (maintained for legacy purpose) */
+#define HSEStartUp_TimeOut HSE_STARTUP_TIMEOUT
+#define HSE_Value HSE_VALUE
+#define HSI_Value HSI_VALUE
+/**
+ * @}
+ */
+
+/** @addtogroup Peripheral_registers_structures
+ * @{
+ */
+
+/**
+ * @brief HSI Auto Clock Calibration
+ */
+typedef struct
+{
+ __IO uint32_t STS;
+ __IO uint32_t CTRL1;
+ __IO uint32_t CTRL2;
+ __IO uint32_t C1;
+ __IO uint32_t C2;
+ __IO uint32_t C3;
+} ACC_Type;
+
+/**
+ * @brief Analog to Digital Converter
+ */
+typedef struct
+{
+ __IO uint32_t STS;
+ __IO uint32_t CTRL1;
+ __IO uint32_t CTRL2;
+ __IO uint32_t SMPT1;
+ __IO uint32_t SMPT2;
+ __IO uint32_t JOFS1;
+ __IO uint32_t JOFS2;
+ __IO uint32_t JOFS3;
+ __IO uint32_t JOFS4;
+ __IO uint32_t WHTR;
+ __IO uint32_t WLTR;
+ __IO uint32_t RSQ1;
+ __IO uint32_t RSQ2;
+ __IO uint32_t RSQ3;
+ __IO uint32_t JSQ;
+ __IO uint32_t JDOR1;
+ __IO uint32_t JDOR2;
+ __IO uint32_t JDOR3;
+ __IO uint32_t JDOR4;
+ __IO uint32_t RDOR;
+} ADC_Type;
+
+/**
+ * @brief Backup Registers
+ */
+#if !defined (AT32F415xx)
+typedef struct
+{
+ uint32_t RESERVED0;
+ __IO uint16_t DT1;
+ uint16_t RESERVED1;
+ __IO uint16_t DT2;
+ uint16_t RESERVED2;
+ __IO uint16_t DT3;
+ uint16_t RESERVED3;
+ __IO uint16_t DT4;
+ uint16_t RESERVED4;
+ __IO uint16_t DT5;
+ uint16_t RESERVED5;
+ __IO uint16_t DT6;
+ uint16_t RESERVED6;
+ __IO uint16_t DT7;
+ uint16_t RESERVED7;
+ __IO uint16_t DT8;
+ uint16_t RESERVED8;
+ __IO uint16_t DT9;
+ uint16_t RESERVED9;
+ __IO uint16_t DT10;
+ uint16_t RESERVED10;
+ __IO uint16_t RTCCAL;
+ uint16_t RESERVED11;
+ __IO uint16_t CTRL;
+ uint16_t RESERVED12;
+ __IO uint16_t CTRLSTS;
+ uint16_t RESERVED13[5];
+ __IO uint16_t DT11;
+ uint16_t RESERVED14;
+ __IO uint16_t DT12;
+ uint16_t RESERVED15;
+ __IO uint16_t DT13;
+ uint16_t RESERVED16;
+ __IO uint16_t DT14;
+ uint16_t RESERVED17;
+ __IO uint16_t DT15;
+ uint16_t RESERVED18;
+ __IO uint16_t DT16;
+ uint16_t RESERVED19;
+ __IO uint16_t DT17;
+ uint16_t RESERVED20;
+ __IO uint16_t DT18;
+ uint16_t RESERVED21;
+ __IO uint16_t DT19;
+ uint16_t RESERVED22;
+ __IO uint16_t DT20;
+ uint16_t RESERVED23;
+ __IO uint16_t DT21;
+ uint16_t RESERVED24;
+ __IO uint16_t DT22;
+ uint16_t RESERVED25;
+ __IO uint16_t DT23;
+ uint16_t RESERVED26;
+ __IO uint16_t DT24;
+ uint16_t RESERVED27;
+ __IO uint16_t DT25;
+ uint16_t RESERVED28;
+ __IO uint16_t DT26;
+ uint16_t RESERVED29;
+ __IO uint16_t DT27;
+ uint16_t RESERVED30;
+ __IO uint16_t DT28;
+ uint16_t RESERVED31;
+ __IO uint16_t DT29;
+ uint16_t RESERVED32;
+ __IO uint16_t DT30;
+ uint16_t RESERVED33;
+ __IO uint16_t DT31;
+ uint16_t RESERVED34;
+ __IO uint16_t DT32;
+ uint16_t RESERVED35;
+ __IO uint16_t DT33;
+ uint16_t RESERVED36;
+ __IO uint16_t DT34;
+ uint16_t RESERVED37;
+ __IO uint16_t DT35;
+ uint16_t RESERVED38;
+ __IO uint16_t DT36;
+ uint16_t RESERVED39;
+ __IO uint16_t DT37;
+ uint16_t RESERVED40;
+ __IO uint16_t DT38;
+ uint16_t RESERVED41;
+ __IO uint16_t DT39;
+ uint16_t RESERVED42;
+ __IO uint16_t DT40;
+ uint16_t RESERVED43;
+ __IO uint16_t DT41;
+ uint16_t RESERVED44;
+ __IO uint16_t DT42;
+ uint16_t RESERVED45;
+} BKP_Type;
+#endif
+
+/**
+ * @brief Controller Area Network TxMailBox
+ */
+typedef struct
+{
+ __IO uint32_t TMI;
+ __IO uint32_t TDT;
+ __IO uint32_t TDL;
+ __IO uint32_t TDH;
+} CAN_TxMailBox_Type;
+
+/**
+ * @brief Controller Area Network FIFOMailBox
+ */
+typedef struct
+{
+ __IO uint32_t RFI;
+ __IO uint32_t RDT;
+ __IO uint32_t RDL;
+ __IO uint32_t RDH;
+} CAN_FIFOMailBox_Type;
+
+/**
+ * @brief Controller Area Network FilterRegister
+ */
+typedef struct
+{
+ __IO uint32_t FBR1;
+ __IO uint32_t FBR2;
+} CAN_FilterRegister_Type;
+
+/**
+ * @brief Controller Area Network
+ */
+typedef struct
+{
+ __IO uint32_t MCTRL;
+ __IO uint32_t MSTS;
+ __IO uint32_t TSTS;
+ __IO uint32_t RF0;
+ __IO uint32_t RF1;
+ __IO uint32_t INTEN;
+ __IO uint32_t ESTS;
+ __IO uint32_t BTMG;
+ uint32_t RESERVED0[88];
+ CAN_TxMailBox_Type TxMailBox[3];
+ CAN_FIFOMailBox_Type FIFOMailBox[2];
+ uint32_t RESERVED1[12];
+ __IO uint32_t FM;
+ __IO uint32_t FM1;
+ uint32_t RESERVED2;
+ __IO uint32_t FS1;
+ uint32_t RESERVED3;
+ __IO uint32_t FFA1;
+ uint32_t RESERVED4;
+ __IO uint32_t FA1;
+ uint32_t RESERVED5[8];
+ CAN_FilterRegister_Type FilterRegister[14];
+} CAN_Type;
+
+/**
+ * @brief Comparator
+ */
+typedef struct
+{
+ __IO uint32_t CTRLSTS1; /*!< COMP comparator control and status register, Address offset: 0x1C */
+ __IO uint32_t CTRLSTS2;
+ __IO uint32_t G_FILTER_EN;
+ __IO uint32_t HIGH_PULSE;
+ __IO uint32_t LOW_PULSE;
+} COMP_Type;
+
+/**
+ * @brief CRC calculation unit
+ */
+typedef struct
+{
+ __IO uint32_t DT;
+ __IO uint8_t IDT;
+ uint8_t RESERVED0;
+ uint16_t RESERVED1;
+ __IO uint32_t CTRL;
+} CRC_Type;
+
+/**
+ * @brief Digital to Analog Converter
+ */
+typedef struct
+{
+ __IO uint32_t CTRL;
+ __IO uint32_t SWTRG;
+ __IO uint32_t HDR12R1;
+ __IO uint32_t HDR12L1;
+ __IO uint32_t HDR8R1;
+ __IO uint32_t HDR12R2;
+ __IO uint32_t HDR12L2;
+ __IO uint32_t HDR8R2;
+ __IO uint32_t HDR12RD;
+ __IO uint32_t HDR12LD;
+ __IO uint32_t HDR8RD;
+ __IO uint32_t ODT1;
+ __IO uint32_t ODT2;
+} DAC_Type;
+
+/**
+ * @brief MCU Debug
+ */
+typedef struct
+{
+ __IO uint32_t IDCR;
+ __IO uint32_t CTRL;
+} MCUDBG_Type;
+
+/**
+ * @brief DMA Controller
+ */
+typedef struct
+{
+ __IO uint32_t CHCTRL;
+ __IO uint32_t TCNT;
+ __IO uint32_t CPBA;
+ __IO uint32_t CMBA;
+} DMA_Channel_Type;
+
+typedef struct
+{
+ __IO uint32_t ISTS;
+ __IO uint32_t ICLR;
+ uint32_t RESERVED[38];
+ __IO uint32_t DMA_SRC_SEL0;
+ __IO uint32_t DMA_SRC_SEL1;
+} DMA_Type;
+
+/**
+ * @brief External Interrupt/Event Controller
+ */
+typedef struct
+{
+ __IO uint32_t INTEN;
+ __IO uint32_t EVTEN;
+ __IO uint32_t RTRSEL;
+ __IO uint32_t FTRSEL;
+ __IO uint32_t SWIE;
+ __IO uint32_t PND;
+} EXTI_Type;
+
+/**
+ * @brief FLASH Registers
+ */
+typedef struct
+{
+ __IO uint32_t ACR;
+ __IO uint32_t FCKEY;
+ __IO uint32_t OPTKEYR;
+ __IO uint32_t STS;
+ __IO uint32_t CTRL;
+ __IO uint32_t ADDR;
+ uint32_t RESERVED0;
+ __IO uint32_t UOB;
+ __IO uint32_t WRPRT;
+ uint32_t RESERVED1[8];
+ __IO uint32_t FCKEY2;
+ uint32_t RESERVED2;
+ __IO uint32_t STS2;
+ __IO uint32_t CTRL2;
+ __IO uint32_t ADDR2;
+ uint32_t RESERVED3[7];
+#if defined (AT32F415xx)
+ __IO uint32_t SLIB_CDR0;
+ __IO uint32_t SLIB_CDR1;
+ __IO uint32_t SLIB_PSW;
+ __IO uint32_t SLIB_PSW_STS;
+ __IO uint32_t CRC_AR;
+ __IO uint32_t CRC_CR;
+ __IO uint32_t CRC_OUTR;
+ uint32_t RESERVED4[3];
+#else
+ uint32_t RESERVED5[4];
+ __IO uint32_t FCKEY3;
+ __IO uint32_t B3SEL;
+ __IO uint32_t STS3;
+ __IO uint32_t CTRL3;
+ __IO uint32_t ADDR3;
+ __IO uint32_t DA;
+#endif
+ uint32_t RESERVED6[12];
+#if defined (AT32F415xx)
+ uint32_t RESERVED7[6];
+#else
+ __IO uint32_t SLIB_CDR0;
+ __IO uint32_t SLIB_CDR1;
+ __IO uint32_t SLIB_PSW;
+ __IO uint32_t SLIB_PSW_STS;
+ __IO uint32_t SLIB_SET_PSW;
+ __IO uint32_t SLIB_SET_RANGE;
+#endif
+ uint32_t RESERVED8[3];
+#if defined (AT32F415xx)
+ uint32_t RESERVED9[3];
+#else
+ __IO uint32_t SLIB_KEYR;
+ __IO uint32_t CRC_DR;
+ __IO uint32_t CRC_OUTR;
+#endif
+#if defined (AT32F415xx)
+ uint32_t RESERVED10[25];
+ __IO uint32_t SLIB_SET_PSW;
+ __IO uint32_t SLIB_SET_RANGE;
+ __IO uint32_t SYS_SLIB_SET;
+ __IO uint32_t SYS_BOOT_DIS_SET;
+ __IO uint32_t SLIB_KEYR;
+#endif
+} FLASH_Type;
+
+/**
+ * @brief Option Bytes Registers
+ */
+typedef struct
+{
+ __IO uint16_t RDPRT;
+ __IO uint16_t USR;
+ __IO uint16_t DATA0;
+ __IO uint16_t DATA1;
+ __IO uint16_t WRPRT0;
+ __IO uint16_t WRPRT1;
+ __IO uint16_t WRPRT2;
+ __IO uint16_t WRPRT3;
+#if !defined (AT32F415xx)
+ __IO uint16_t EOPB0;
+ __IO uint16_t EOPB1;
+ __IO uint16_t HID[4];
+ __IO uint32_t Reserved;
+ __IO uint32_t BANK3SCRKEY[4];
+#endif
+} UOB_Type;
+
+/**
+ * @brief Flexible Static Memory Controller
+ */
+typedef struct
+{
+ __IO uint32_t BK1CTRLR[8];
+} XMC_Bank1_Type;
+
+/**
+ * @brief Flexible Static Memory Controller Bank1E
+ */
+typedef struct
+{
+ __IO uint32_t BK1TMGWR[7];
+} XMC_Bank1Ext_Type;
+
+/**
+ * @brief Flexible Static Memory Controller Bank1H
+ */
+typedef struct
+{
+ __IO uint32_t BK1EXT[4];
+} XMC_Bank1Hide_Type;
+
+/**
+ * @brief Flexible Static Memory Controller Bank2
+ */
+typedef struct
+{
+ __IO uint32_t BK2CTRL;
+ __IO uint32_t BK2STS;
+ __IO uint32_t BK2TMGMEM;
+ __IO uint32_t BK2TMGATT;
+ uint32_t RESERVED0;
+ __IO uint32_t BK2ECC;
+} XMC_Bank2_Type;
+
+/**
+ * @brief Flexible Static Memory Controller Bank3
+ */
+typedef struct
+{
+ __IO uint32_t BK3CTRL;
+ __IO uint32_t BK3STS;
+ __IO uint32_t BK3TMGMEM;
+ __IO uint32_t BK3TMGATT;
+ uint32_t RESERVED0;
+ __IO uint32_t BK3ECC;
+} XMC_Bank3_Type;
+
+/**
+ * @brief Flexible Static Memory Controller Bank4
+ */
+typedef struct
+{
+ __IO uint32_t BK4CTRL;
+ __IO uint32_t BK4STS;
+ __IO uint32_t BK4TMGMEM;
+ __IO uint32_t BK4TMGATT;
+ __IO uint32_t BK4TMGIO;
+} XMC_Bank4_Type;
+
+/**
+ * @brief General Purpose I/O
+ */
+typedef struct
+{
+ __IO uint32_t CTRLL;
+ __IO uint32_t CTRLH;
+ __IO uint32_t IPTDT;
+ __IO uint32_t OPTDT;
+ __IO uint32_t BSRE;
+ __IO uint32_t BRE;
+ __IO uint32_t LOCK;
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+ uint32_t RESERVED0;
+ __IO uint32_t SRCTR;
+ uint32_t RESERVED1;
+ uint32_t RESERVED2;
+ uint32_t RESERVED3;
+ uint32_t RESERVED4;
+ uint32_t RESERVED5;
+ uint32_t RESERVED6;
+ __IO uint32_t HDRV;
+#endif
+} GPIO_Type;
+
+/**
+ * @brief Alternate Function I/O
+ */
+typedef struct
+{
+ __IO uint32_t EVCTRL;
+ __IO uint32_t MAP;
+ __IO uint32_t EXTIC[4];
+ uint32_t RESERVED0;
+ __IO uint32_t MAP2;
+#ifndef AT32F403xx
+ __IO uint32_t MAP3;
+ __IO uint32_t MAP4;
+ __IO uint32_t MAP5;
+ __IO uint32_t MAP6;
+ __IO uint32_t MAP7;
+#ifndef AT32F413xx
+ __IO uint32_t MAP8;
+#endif
+#endif
+} AFIO_Type;
+
+/**
+ * @brief Inter Integrated Circuit Interface
+ */
+typedef struct
+{
+ __IO uint16_t CTRL1;
+ uint16_t RESERVED0;
+ __IO uint16_t CTRL2;
+ uint16_t RESERVED1;
+ __IO uint16_t OADDR1;
+ uint16_t RESERVED2;
+ __IO uint16_t OADDR2;
+ uint16_t RESERVED3;
+ __IO uint16_t DT;
+ uint16_t RESERVED4;
+ __IO uint16_t STS1;
+ uint16_t RESERVED5;
+ __IO uint16_t STS2;
+ uint16_t RESERVED6;
+ __IO uint16_t CLKCTRL;
+ uint16_t RESERVED7;
+ __IO uint16_t TMRISE;
+ uint16_t RESERVED8;
+} I2C_Type;
+
+/**
+ * @brief Independent WATCHDOG
+ */
+typedef struct
+{
+ __IO uint32_t KEY;
+ __IO uint32_t PSC;
+ __IO uint32_t RLD;
+ __IO uint32_t STS;
+} IWDG_Type;
+
+/**
+ * @brief Power Control
+ */
+typedef struct
+{
+ __IO uint32_t CTRL;
+ __IO uint32_t CTRLSTS;
+} PWR_Type;
+
+/**
+ * @brief Reset and Clock Control
+ */
+typedef struct
+{
+ __IO uint32_t CTRL;
+ __IO uint32_t CFG;
+ __IO uint32_t CLKINT;
+ __IO uint32_t APB2RST;
+ __IO uint32_t APB1RST;
+ __IO uint32_t AHBEN;
+ __IO uint32_t APB2EN;
+ __IO uint32_t APB1EN;
+ __IO uint32_t BDC;
+ __IO uint32_t CTRLSTS;
+#if defined (AT32F415xx)
+ __IO uint32_t AHBRST;
+ __IO uint32_t PLL;
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+ __IO uint32_t AHBRST;
+ __IO uint32_t RESERVED;
+#else
+ __IO uint32_t RESERVED[2];
+#endif
+ __IO uint32_t MISC;
+#if defined (AT32F413xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+ __IO uint32_t RESERVED1[7];
+ __IO uint32_t TEST;
+ __IO uint32_t MISC2;
+ __IO uint32_t RESERVED2;
+ __IO uint32_t INTCTRL;
+#elif defined (AT32F415xx)
+ __IO uint32_t RESERVED1[8];
+ __IO uint32_t MISC2;
+#endif
+} RCC_Type;
+
+/**
+ * @brief Real-Time Clock
+ */
+#if defined (AT32F415xx)
+typedef struct
+{
+ __IO uint32_t TIME; /*!< ERTC time register, Address offset: 0x00 */
+ __IO uint32_t DATE; /*!< ERTC date register, Address offset: 0x04 */
+ __IO uint32_t CTRL; /*!< ERTC control register, Address offset: 0x08 */
+ __IO uint32_t ISTS; /*!< ERTC initialization and status register, Address offset: 0x0C */
+ __IO uint32_t PSC; /*!< ERTC prescaler register, Address offset: 0x10 */
+ __IO uint32_t WATR; /*!< ERTC wakeup timer register, Address offset: 0x14 */
+ __IO uint32_t CAL; /*!< ERTC calibration register, Address offset: 0x18 */
+ __IO uint32_t ALA; /*!< ERTC alarm A register, Address offset: 0x1C */
+ __IO uint32_t ALB; /*!< ERTC alarm B register, Address offset: 0x20 */
+ __IO uint32_t WPR; /*!< ERTC write protection register, Address offset: 0x24 */
+ __IO uint32_t SBSR; /*!< ERTC sub second register, Address offset: 0x28 */
+ __IO uint32_t SFCTR; /*!< ERTC shift control register, Address offset: 0x2C */
+ __IO uint32_t TSTM; /*!< ERTC time stamp time register, Address offset: 0x30 */
+ __IO uint32_t TSDT; /*!< ERTC time stamp date register, Address offset: 0x34 */
+ __IO uint32_t TSSBS; /*!< ERTC time-stamp sub second register, Address offset: 0x38 */
+ __IO uint32_t CCR; /*!< ERTC calibration register, Address offset: 0x3C */
+ __IO uint32_t TPAF; /*!< ERTC tamper and alternate function configuration register, Address offset: 0x40 */
+ __IO uint32_t ALASBS; /*!< ERTC alarm A sub second register, Address offset: 0x44 */
+ __IO uint32_t ALBSBS; /*!< ERTC alarm B sub second register, Address offset: 0x48 */
+ uint32_t RESERVED7; /*!< Reserved, 0x4C */
+ __IO uint32_t BKP0DT; /*!< ERTC backup register 1, Address offset: 0x50 */
+ __IO uint32_t BKP1DT; /*!< ERTC backup register 1, Address offset: 0x54 */
+ __IO uint32_t BKP2DT; /*!< ERTC backup register 2, Address offset: 0x58 */
+ __IO uint32_t BKP3DT; /*!< ERTC backup register 3, Address offset: 0x5C */
+ __IO uint32_t BKP4DT; /*!< ERTC backup register 4, Address offset: 0x60 */
+ __IO uint32_t BKP5DT; /*!< ERTC backup register 5, Address offset: 0x64 */
+ __IO uint32_t BKP6DT; /*!< ERTC backup register 6, Address offset: 0x68 */
+ __IO uint32_t BKP7DT; /*!< ERTC backup register 7, Address offset: 0x6C */
+ __IO uint32_t BKP8DT; /*!< ERTC backup register 8, Address offset: 0x70 */
+ __IO uint32_t BKP9DT; /*!< ERTC backup register 9, Address offset: 0x74 */
+ __IO uint32_t BKP10DT; /*!< ERTC backup register 10, Address offset: 0x78 */
+ __IO uint32_t BKP11DT; /*!< ERTC backup register 11, Address offset: 0x7C */
+ __IO uint32_t BKP12DT; /*!< ERTC backup register 12, Address offset: 0x80 */
+ __IO uint32_t BKP13DT; /*!< ERTC backup register 13, Address offset: 0x84 */
+ __IO uint32_t BKP14DT; /*!< ERTC backup register 14, Address offset: 0x88 */
+ __IO uint32_t BKP15DT; /*!< ERTC backup register 15, Address offset: 0x8C */
+ __IO uint32_t BKP16DT; /*!< ERTC backup register 16, Address offset: 0x90 */
+ __IO uint32_t BKP17DT; /*!< ERTC backup register 17, Address offset: 0x94 */
+ __IO uint32_t BKP18DT; /*!< ERTC backup register 18, Address offset: 0x98 */
+ __IO uint32_t BKP19DT; /*!< ERTC backup register 19, Address offset: 0x9C */
+} ERTC_Type;
+#else
+typedef struct
+{
+ __IO uint16_t CTRLH;
+ uint16_t RESERVED0;
+ __IO uint16_t CTRLL;
+ uint16_t RESERVED1;
+ __IO uint16_t DIVH;
+ uint16_t RESERVED2;
+ __IO uint16_t DIVL;
+ uint16_t RESERVED3;
+ __IO uint16_t DIVCNTH;
+ uint16_t RESERVED4;
+ __IO uint16_t DIVCNTL;
+ uint16_t RESERVED5;
+ __IO uint16_t CNTH;
+ uint16_t RESERVED6;
+ __IO uint16_t CNTL;
+ uint16_t RESERVED7;
+ __IO uint16_t ALAH;
+ uint16_t RESERVED8;
+ __IO uint16_t ALAL;
+ uint16_t RESERVED9;
+} RTC_Type;
+#endif
+/**
+ * @brief SD host Interface
+ */
+typedef struct
+{
+ __IO uint32_t POWER;
+ __IO uint32_t CLKCTRL;
+ __IO uint32_t ARG;
+ __IO uint32_t CMD;
+ __I uint32_t RSPCMD;
+ __I uint32_t RSP1;
+ __I uint32_t RSP2;
+ __I uint32_t RSP3;
+ __I uint32_t RSP4;
+ __IO uint32_t DTTMR;
+ __IO uint32_t DTLEN;
+ __IO uint32_t DTCTRL;
+ __I uint32_t DTCNTR;
+ __I uint32_t STS;
+ __IO uint32_t INTCLR;
+ __IO uint32_t INTEN;
+ uint32_t RESERVED0[2];
+ __I uint32_t BUFCNTR;
+ uint32_t RESERVED1[13];
+ __IO uint32_t BUF;
+} SDIO_Type;
+
+/**
+ * @brief Serial Peripheral Interface
+ */
+typedef struct
+{
+ __IO uint16_t CTRL1;
+ uint16_t RESERVED0;
+ __IO uint16_t CTRL2;
+ uint16_t RESERVED1;
+ __IO uint16_t STS;
+ uint16_t RESERVED2;
+ __IO uint16_t DT;
+ uint16_t RESERVED3;
+ __IO uint16_t CPOLY;
+ uint16_t RESERVED4;
+ __IO uint16_t RCRC;
+ uint16_t RESERVED5;
+ __IO uint16_t TCRC;
+ uint16_t RESERVED6;
+ __IO uint16_t I2SCTRL;
+ uint16_t RESERVED7;
+ __IO uint16_t I2SCLKP;
+ uint16_t RESERVED8;
+} SPI_Type;
+
+/**
+ * @brief TIMER
+ */
+typedef struct
+{
+ __IO uint16_t CTRL1;
+ uint16_t RESERVED0;
+ __IO uint16_t CTRL2;
+ uint16_t RESERVED1;
+ __IO uint16_t SMC;
+ uint16_t RESERVED2;
+ __IO uint16_t DIE;
+ uint16_t RESERVED3;
+ __IO uint16_t STS;
+ uint16_t RESERVED4;
+ __IO uint16_t EVEG;
+ uint16_t RESERVED5;
+ __IO uint16_t CCM1;
+ uint16_t RESERVED6;
+ __IO uint16_t CCM2;
+ uint16_t RESERVED7;
+ __IO uint16_t CCE;
+ uint16_t RESERVED8;
+ __IO uint32_t CNT;
+ __IO uint16_t DIV;
+ uint16_t RESERVED10;
+ __IO uint32_t AR;
+ __IO uint16_t RC;
+ uint16_t RESERVED12;
+ __IO uint32_t CC1;
+ __IO uint32_t CC2;
+ __IO uint32_t CC3;
+ __IO uint32_t CC4;
+ __IO uint16_t BRKDT;
+ uint16_t RESERVED17;
+ __IO uint16_t DMAC;
+ uint16_t RESERVED18;
+ __IO uint16_t DMABA;
+ uint16_t RESERVED19;
+} TMR_Type;
+
+/**
+ * @brief Universal Synchronous Asynchronous Receiver Transmitter
+ */
+typedef struct
+{
+ __IO uint16_t STS;
+ uint16_t RESERVED0;
+ __IO uint16_t DT;
+ uint16_t RESERVED1;
+ __IO uint16_t BAUDR;
+ uint16_t RESERVED2;
+ __IO uint16_t CTRL1;
+ uint16_t RESERVED3;
+ __IO uint16_t CTRL2;
+ uint16_t RESERVED4;
+ __IO uint16_t CTRL3;
+ uint16_t RESERVED5;
+ __IO uint16_t GTP;
+ uint16_t RESERVED6;
+} USART_Type;
+
+/**
+ * @brief Window WATCHDOG
+ */
+typedef struct
+{
+ __IO uint32_t CTRL;
+ __IO uint32_t CFG;
+ __IO uint32_t STS;
+} WWDG_Type;
+
+/**
+ * @brief Ethernet MAC
+ */
+
+typedef struct
+{
+ __IO uint32_t MACCTRL;
+ __IO uint32_t MACFRMF;
+ __IO uint32_t MACHTH;
+ __IO uint32_t MACHTL;
+ __IO uint32_t MACMIIADDR;
+ __IO uint32_t MACMIIDT;
+ __IO uint32_t MACFCTRL;
+ __IO uint32_t MACVLT; /* 8 */
+ uint32_t RESERVED0[2];
+ __IO uint32_t MACRWFF; /* 11 */
+ __IO uint32_t MACPMTCTRLSTS;
+ uint32_t RESERVED1[2];
+ __IO uint32_t MACISTS; /* 15 */
+ __IO uint32_t MACIM;
+ __IO uint32_t MACA0H;
+ __IO uint32_t MACA0L;
+ __IO uint32_t MACA1H;
+ __IO uint32_t MACA1L;
+ __IO uint32_t MACA2H;
+ __IO uint32_t MACA2L;
+ __IO uint32_t MACA3H;
+ __IO uint32_t MACA3L; /* 24 */
+ uint32_t RESERVED2[40];
+ __IO uint32_t MMCCTRL; /* 65 */
+ __IO uint32_t MMCRI;
+ __IO uint32_t MMCTI;
+ __IO uint32_t MMCRIM;
+ __IO uint32_t MMCTIM; /* 69 */
+ uint32_t RESERVED3[14];
+ __IO uint32_t MMCTFSCC; /* 84 */
+ __IO uint32_t MMCTFMSCC;
+ uint32_t RESERVED4[5];
+ __IO uint32_t MMCTFCNT;
+ uint32_t RESERVED5[10];
+ __IO uint32_t MMCRFCECNT;
+ __IO uint32_t MMCRFAECNT;
+ uint32_t RESERVED6[10];
+ __IO uint32_t MMCRGUFCNT;
+ uint32_t RESERVED7[334];
+ __IO uint32_t PTPTSCTRL;
+ __IO uint32_t PTPSSINC;
+ __IO uint32_t PTPTSH;
+ __IO uint32_t PTPTSL;
+ __IO uint32_t PTPTSHUD;
+ __IO uint32_t PTPTSLUD;
+ __IO uint32_t PTPTSAD;
+ __IO uint32_t PTPTTH;
+ __IO uint32_t PTPTTL;
+ uint32_t RESERVED8[567];
+ __IO uint32_t DMABM;
+ __IO uint32_t DMATPD;
+ __IO uint32_t DMARPD;
+ __IO uint32_t DMARDLADDR;
+ __IO uint32_t DMATDLADDR;
+ __IO uint32_t DMASTS;
+ __IO uint32_t DMAOPM;
+ __IO uint32_t DMAIE;
+ __IO uint32_t DMAMFBOCNT;
+ uint32_t RESERVED9[9];
+ __IO uint32_t DMACTD;
+ __IO uint32_t DMACRD;
+ __IO uint32_t DMACTBADDR;
+ __IO uint32_t DMACRBADDR;
+} ETH_Type;
+
+/**
+ * @}
+ */
+
+/** @addtogroup Peripheral_memory_map
+ * @{
+ */
+
+#define FLASH_BASE ((uint32_t)0x08000000) /*!< FLASH base address in the alias region */
+#define EXT_FLASH_BASE ((uint32_t)0x08400000) /*!< External FLASH base address in the alias region */
+#define SRAM_BASE ((uint32_t)0x20000000) /*!< SRAM base address in the alias region */
+#define PERIPH_BASE ((uint32_t)0x40000000) /*!< Peripheral base address in the alias region */
+
+#define SRAM_BB_BASE ((uint32_t)0x22000000) /*!< SRAM base address in the bit-band region */
+#define PERIPH_BB_BASE ((uint32_t)0x42000000) /*!< Peripheral base address in the bit-band region */
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || defined (AT32F407xx)
+ #define XMC_R_BASE ((uint32_t)0xA0000000) /*!< XMC registers base address */
+#endif
+
+#define UOB_BASE ((uint32_t)0x1FFFF800) /*!< Flash Option Bytes base address */
+
+#define DBGMCU_BASE ((uint32_t)0xE0042000) /*!< Debug MCU registers base address */
+
+/** Peripheral memory map */
+#define APB1PERIPH_BASE (PERIPH_BASE)
+#define APB2PERIPH_BASE (PERIPH_BASE + 0x10000)
+#define AHBPERIPH_BASE (PERIPH_BASE + 0x20000)
+
+#define TMR2_BASE (APB1PERIPH_BASE + 0x0000)
+#define TMR3_BASE (APB1PERIPH_BASE + 0x0400)
+#define TMR4_BASE (APB1PERIPH_BASE + 0x0800)
+#define TMR5_BASE (APB1PERIPH_BASE + 0x0C00)
+#if !defined (AT32F415xx)
+ #define RTC_BASE (APB1PERIPH_BASE + 0x2800)
+#else
+ #define ERTC_BASE (APB1PERIPH_BASE + 0x2800)
+#endif
+#define WWDG_BASE (APB1PERIPH_BASE + 0x2C00)
+#define IWDG_BASE (APB1PERIPH_BASE + 0x3000)
+#define SPI2_BASE (APB1PERIPH_BASE + 0x3800)
+#define USART2_BASE (APB1PERIPH_BASE + 0x4400)
+#define USART3_BASE (APB1PERIPH_BASE + 0x4800)
+#define UART4_BASE (APB1PERIPH_BASE + 0x4C00)
+#define UART5_BASE (APB1PERIPH_BASE + 0x5000)
+#define I2C1_BASE (APB1PERIPH_BASE + 0x5400)
+#define I2C2_BASE (APB1PERIPH_BASE + 0x5800)
+#define CAN1_BASE (APB1PERIPH_BASE + 0x6400)
+
+#if !defined (AT32F415xx)
+ #define BKP_BASE (APB1PERIPH_BASE + 0x6C00)
+#endif
+
+#define PWR_BASE (APB1PERIPH_BASE + 0x7000)
+
+#define AFIO_BASE (APB2PERIPH_BASE + 0x0000)
+#define EXTI_BASE (APB2PERIPH_BASE + 0x0400)
+
+#if defined (AT32F413xx) || defined (AT32F415xx)
+ #define GPIOA_BASE (PERIPH_BASE + 0x10800)
+ #define GPIOB_BASE (PERIPH_BASE + 0x10C00)
+ #define GPIOC_BASE (PERIPH_BASE + 0x11000)
+ #define GPIOD_BASE (PERIPH_BASE + 0x11400)
+ #define GPIOF_BASE (PERIPH_BASE + 0x11C00)
+#elif defined (AT32F403xx)
+ #define GPIOA_BASE (APB2PERIPH_BASE + 0x0800)
+ #define GPIOB_BASE (APB2PERIPH_BASE + 0x0C00)
+ #define GPIOC_BASE (APB2PERIPH_BASE + 0x1000)
+ #define GPIOD_BASE (APB2PERIPH_BASE + 0x1400)
+ #define GPIOE_BASE (APB2PERIPH_BASE + 0x1800)
+ #define GPIOF_BASE (APB2PERIPH_BASE + 0x1C00)
+ #define GPIOG_BASE (APB2PERIPH_BASE + 0x2000)
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+ #define GPIOA_BASE (APB2PERIPH_BASE + 0x0800)
+ #define GPIOB_BASE (APB2PERIPH_BASE + 0x0C00)
+ #define GPIOC_BASE (APB2PERIPH_BASE + 0x1000)
+ #define GPIOD_BASE (APB2PERIPH_BASE + 0x1400)
+ #define GPIOE_BASE (APB2PERIPH_BASE + 0x1800)
+#endif
+
+#define ADC1_BASE (APB2PERIPH_BASE + 0x2400)
+#define ADC2_BASE (APB2PERIPH_BASE + 0x2800)
+#define TMR1_BASE (APB2PERIPH_BASE + 0x2C00)
+#define SPI1_BASE (APB2PERIPH_BASE + 0x3000)
+#if !defined (AT32F415xx)
+ #define TMR8_BASE (APB2PERIPH_BASE + 0x3400)
+#endif
+
+#define USART1_BASE (APB2PERIPH_BASE + 0x3800)
+#define TMR9_BASE (APB2PERIPH_BASE + 0x4C00)
+#define TMR10_BASE (APB2PERIPH_BASE + 0x5000)
+#define TMR11_BASE (APB2PERIPH_BASE + 0x5400)
+
+#define DMA1_BASE (AHBPERIPH_BASE + 0x0000)
+#define DMA1_Channel1_BASE (AHBPERIPH_BASE + 0x0008)
+#define DMA1_Channel2_BASE (AHBPERIPH_BASE + 0x001C)
+#define DMA1_Channel3_BASE (AHBPERIPH_BASE + 0x0030)
+#define DMA1_Channel4_BASE (AHBPERIPH_BASE + 0x0044)
+#define DMA1_Channel5_BASE (AHBPERIPH_BASE + 0x0058)
+#define DMA1_Channel6_BASE (AHBPERIPH_BASE + 0x006C)
+#define DMA1_Channel7_BASE (AHBPERIPH_BASE + 0x0080)
+#define DMA2_BASE (AHBPERIPH_BASE + 0x0400)
+#define DMA2_Channel1_BASE (AHBPERIPH_BASE + 0x0408)
+#define DMA2_Channel2_BASE (AHBPERIPH_BASE + 0x041C)
+#define DMA2_Channel3_BASE (AHBPERIPH_BASE + 0x0430)
+#define DMA2_Channel4_BASE (AHBPERIPH_BASE + 0x0444)
+#define DMA2_Channel5_BASE (AHBPERIPH_BASE + 0x0458)
+
+#define RCC_BASE (AHBPERIPH_BASE + 0x1000)
+#define FLASH_R_BASE (AHBPERIPH_BASE + 0x2000) /*!< Flash registers base address */
+#define CRC_BASE (AHBPERIPH_BASE + 0x3000)
+
+#if defined (AT32F415xx)
+ #define ACC_BASE (APB2PERIPH_BASE + 0x5800)
+ #define SDIO_BASE (PERIPH_BASE + 0x18000)
+ #define USBOTG_BASE (PERIPH_BASE + 0x10000000)
+ #define COMP_BASE (APB1PERIPH_BASE + 0x2400)
+ #define DMA2_Channel6_BASE (AHBPERIPH_BASE + 0x046C)
+ #define DMA2_Channel7_BASE (AHBPERIPH_BASE + 0x0480)
+#elif defined (AT32F413xx)
+ #if !defined (AT32FEBKCx_MD)
+ #define CAN2_BASE (APB1PERIPH_BASE + 0x6800)
+ #define ACC_BASE (APB2PERIPH_BASE + 0x5800)
+ #define SDIO_BASE (PERIPH_BASE + 0x18000)
+ #endif
+ #define DMA2_Channel6_BASE (AHBPERIPH_BASE + 0x046C)
+ #define DMA2_Channel7_BASE (AHBPERIPH_BASE + 0x0480)
+#elif defined (AT32F403xx)
+ #define TMR6_BASE (APB1PERIPH_BASE + 0x1000)
+ #define TMR7_BASE (APB1PERIPH_BASE + 0x1400)
+ #define TMR12_BASE (APB1PERIPH_BASE + 0x1800)
+ #define TMR13_BASE (APB1PERIPH_BASE + 0x1C00)
+ #define TMR14_BASE (APB1PERIPH_BASE + 0x2000)
+ #define SPI3_BASE (APB1PERIPH_BASE + 0x3C00)
+ #define SPI4_BASE (APB1PERIPH_BASE + 0x4000)
+ #define I2C3_BASE (APB1PERIPH_BASE + 0x6800)
+ #define DAC_BASE (APB1PERIPH_BASE + 0x7400)
+ #define ADC3_BASE (APB2PERIPH_BASE + 0x3C00)
+ #define TMR15_BASE (APB2PERIPH_BASE + 0x4000)
+ #define SDIO1_BASE (PERIPH_BASE + 0x18000)
+ #define SDIO2_BASE (AHBPERIPH_BASE + 0x3400)
+ #define XMC_Bank1_R_BASE (XMC_R_BASE + 0x0000) /*!< XMC Bank1 registers base address */
+ #define XMC_Bank1E_R_BASE (XMC_R_BASE + 0x0104) /*!< XMC Bank1E registers base address */
+ #define XMC_Bank1E_H_BASE (XMC_R_BASE + 0x0220) /*!< XMC Bank1H registers base address */
+ #define XMC_Bank2_R_BASE (XMC_R_BASE + 0x0060) /*!< XMC Bank2 registers base address */
+ #define XMC_Bank3_R_BASE (XMC_R_BASE + 0x0080) /*!< XMC Bank3 registers base address */
+ #define XMC_Bank4_R_BASE (XMC_R_BASE + 0x00A0) /*!< XMC Bank4 registers base address */
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+ #define TMR6_BASE (APB1PERIPH_BASE + 0x1000)
+ #define TMR7_BASE (APB1PERIPH_BASE + 0x1400)
+ #define TMR12_BASE (APB1PERIPH_BASE + 0x1800)
+ #define TMR13_BASE (APB1PERIPH_BASE + 0x1C00)
+ #define TMR14_BASE (APB1PERIPH_BASE + 0x2000)
+ #define SPI3_BASE (APB1PERIPH_BASE + 0x3C00)
+ #define SPI4_BASE (APB1PERIPH_BASE + 0x4000)
+ #define CAN2_BASE (APB1PERIPH_BASE + 0x6800)
+ #define DAC_BASE (APB1PERIPH_BASE + 0x7400)
+ #define ADC3_BASE (APB2PERIPH_BASE + 0x3C00)
+ #define ACC_BASE (APB2PERIPH_BASE + 0x5800)
+ #define I2C3_BASE (APB2PERIPH_BASE + 0x5C00)
+ #define USART6_BASE (APB2PERIPH_BASE + 0x6000)
+ #define UART7_BASE (APB2PERIPH_BASE + 0x6400)
+ #define UART8_BASE (APB2PERIPH_BASE + 0x6800)
+ #define I2S2EXT_BASE (APB2PERIPH_BASE + 0x6C00)
+ #define I2S3EXT_BASE (APB2PERIPH_BASE + 0x7000)
+ #define SDIO1_BASE (PERIPH_BASE + 0x18000)
+ #define SDIO2_BASE (AHBPERIPH_BASE + 0x3400)
+ #define DMA2_Channel6_BASE (AHBPERIPH_BASE + 0x046C)
+ #define DMA2_Channel7_BASE (AHBPERIPH_BASE + 0x0480)
+ #define XMC_Bank1_R_BASE (XMC_R_BASE + 0x0000) /*!< XMC Bank1 registers base address */
+ #define XMC_Bank1E_R_BASE (XMC_R_BASE + 0x0104) /*!< XMC Bank1E registers base address */
+ #define XMC_Bank1E_H_BASE (XMC_R_BASE + 0x0220) /*!< XMC Bank1H registers base address */
+ #define XMC_Bank2_R_BASE (XMC_R_BASE + 0x0060) /*!< XMC Bank2 registers base address */
+ #define XMC_Bank3_R_BASE (XMC_R_BASE + 0x0080) /*!< XMC Bank3 registers base address */
+ #define XMC_Bank4_R_BASE (XMC_R_BASE + 0x00A0) /*!< XMC Bank4 registers base address */
+#endif
+
+#if defined (AT32F407xx)
+ #define ETH_BASE (AHBPERIPH_BASE + 0x8000)
+ #define ETH_MAC_BASE (ETH_BASE)
+ #define ETH_MMC_BASE (ETH_BASE + 0x0100)
+ #define ETH_PTP_BASE (ETH_BASE + 0x0700)
+ #define ETH_DMA_BASE (ETH_BASE + 0x1000)
+#endif
+
+/**
+ * @}
+ */
+
+/** @addtogroup Peripheral_declaration
+ * @{
+ */
+#if defined (AT32F415xx)
+ #define ACC ((ACC_Type *) ACC_BASE)
+ #define COMP ((COMP_Type *)COMP_BASE)
+ #define SDIO ((SDIO_Type *) SDIO_BASE)
+ #define USBOTG ((USBOTG_Type *) USBOTG_BASE)
+ #define DMA2_Channel6 ((DMA_Channel_Type *) DMA2_Channel6_BASE)
+ #define DMA2_Channel7 ((DMA_Channel_Type *) DMA2_Channel7_BASE)
+#elif defined (AT32F413xx)
+ #if !defined (AT32FEBKCx_MD)
+ #define CAN2 ((CAN_Type *) CAN2_BASE)
+ #define SDIO ((SDIO_Type *) SDIO_BASE)
+ #define ACC ((ACC_Type *) ACC_BASE)
+ #endif
+ #define DMA2_Channel6 ((DMA_Channel_Type *) DMA2_Channel6_BASE)
+ #define DMA2_Channel7 ((DMA_Channel_Type *) DMA2_Channel7_BASE)
+#elif defined (AT32F403xx)
+ #define TMR6 ((TMR_Type *) TMR6_BASE)
+ #define TMR7 ((TMR_Type *) TMR7_BASE)
+ #define TMR12 ((TMR_Type *) TMR12_BASE)
+ #define TMR13 ((TMR_Type *) TMR13_BASE)
+ #define TMR14 ((TMR_Type *) TMR14_BASE)
+ #define SPI3 ((SPI_Type *) SPI3_BASE)
+ #define SPI4 ((SPI_Type *) SPI4_BASE)
+ #define I2C3 ((I2C_Type *) I2C3_BASE)
+ #define DAC ((DAC_Type *) DAC_BASE)
+ #define GPIOE ((GPIO_Type *) GPIOE_BASE)
+ #define GPIOG ((GPIO_Type *) GPIOG_BASE)
+ #define ADC3 ((ADC_Type *) ADC3_BASE)
+ #define TMR15 ((TMR_Type *) TMR15_BASE)
+ #define SDIO1 ((SDIO_Type *) SDIO1_BASE)
+ #define SDIO2 ((SDIO_Type *) SDIO2_BASE)
+ #define XMC_Bank1 ((XMC_Bank1_Type *) XMC_Bank1_R_BASE)
+ #define XMC_Bank1E ((XMC_Bank1Ext_Type *) XMC_Bank1E_R_BASE)
+ #define XMC_Bank1H ((XMC_Bank1Hide_Type *) XMC_Bank1E_H_BASE)
+ #define XMC_Bank2 ((XMC_Bank2_Type *) XMC_Bank2_R_BASE)
+ #define XMC_Bank3 ((XMC_Bank3_Type *) XMC_Bank3_R_BASE)
+ #define XMC_Bank4 ((XMC_Bank4_Type *) XMC_Bank4_R_BASE)
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+ #define TMR6 ((TMR_Type *) TMR6_BASE)
+ #define TMR7 ((TMR_Type *) TMR7_BASE)
+ #define TMR12 ((TMR_Type *) TMR12_BASE)
+ #define TMR13 ((TMR_Type *) TMR13_BASE)
+ #define TMR14 ((TMR_Type *) TMR14_BASE)
+ #define SPI3 ((SPI_Type *) SPI3_BASE)
+ #define SPI4 ((SPI_Type *) SPI4_BASE)
+ #define CAN2 ((CAN_Type *) CAN2_BASE)
+ #define I2C3 ((I2C_Type *) I2C3_BASE)
+ #define DAC ((DAC_Type *) DAC_BASE)
+ #define GPIOE ((GPIO_Type *) GPIOE_BASE)
+ #define ADC3 ((ADC_Type *) ADC3_BASE)
+ #define ACC ((ACC_Type *) ACC_BASE)
+ #define USART6 ((USART_Type *) USART6_BASE)
+ #define UART7 ((USART_Type *) UART7_BASE)
+ #define UART8 ((USART_Type *) UART8_BASE)
+ #define I2S2EXT ((SPI_Type *) I2S2EXT_BASE)
+ #define I2S3EXT ((SPI_Type *) I2S3EXT_BASE)
+ #define SDIO1 ((SDIO_Type *) SDIO1_BASE)
+ #define SDIO2 ((SDIO_Type *) SDIO2_BASE)
+ #define XMC_Bank1 ((XMC_Bank1_Type *) XMC_Bank1_R_BASE)
+ #define XMC_Bank1E ((XMC_Bank1Ext_Type *) XMC_Bank1E_R_BASE)
+ #define XMC_Bank1H ((XMC_Bank1Hide_Type *) XMC_Bank1E_H_BASE)
+ #define XMC_Bank2 ((XMC_Bank2_Type *) XMC_Bank2_R_BASE)
+ #define XMC_Bank3 ((XMC_Bank3_Type *) XMC_Bank3_R_BASE)
+ #define XMC_Bank4 ((XMC_Bank4_Type *) XMC_Bank4_R_BASE)
+ #define DMA2_Channel6 ((DMA_Channel_Type *) DMA2_Channel6_BASE)
+ #define DMA2_Channel7 ((DMA_Channel_Type *) DMA2_Channel7_BASE)
+#endif
+
+#if !defined (AT32F415xx)
+ #define TMR8 ((TMR_Type *) TMR8_BASE)
+#endif
+
+#define TMR2 ((TMR_Type *) TMR2_BASE)
+#define TMR3 ((TMR_Type *) TMR3_BASE)
+#define TMR4 ((TMR_Type *) TMR4_BASE)
+#define TMR5 ((TMR_Type *) TMR5_BASE)
+#if !defined (AT32F415xx)
+ #define RTC ((RTC_Type *) RTC_BASE)
+#else
+ #define ERTC ((ERTC_Type *) ERTC_BASE)
+#endif
+#define WWDG ((WWDG_Type *) WWDG_BASE)
+#define IWDG ((IWDG_Type *) IWDG_BASE)
+#define SPI2 ((SPI_Type *) SPI2_BASE)
+#define USART2 ((USART_Type *) USART2_BASE)
+#define USART3 ((USART_Type *) USART3_BASE)
+#define UART4 ((USART_Type *) UART4_BASE)
+#define UART5 ((USART_Type *) UART5_BASE)
+#define I2C1 ((I2C_Type *) I2C1_BASE)
+#define I2C2 ((I2C_Type *) I2C2_BASE)
+#define CAN1 ((CAN_Type *) CAN1_BASE)
+#define BKP ((BKP_Type *) BKP_BASE)
+#define PWR ((PWR_Type *) PWR_BASE)
+#define AFIO ((AFIO_Type *) AFIO_BASE)
+#define EXTI ((EXTI_Type *) EXTI_BASE)
+#define GPIOA ((GPIO_Type *) GPIOA_BASE)
+#define GPIOB ((GPIO_Type *) GPIOB_BASE)
+#define GPIOC ((GPIO_Type *) GPIOC_BASE)
+#define GPIOD ((GPIO_Type *) GPIOD_BASE)
+#if !defined (AT32F403Axx) && !defined (AT32F407xx)
+ #define GPIOF ((GPIO_Type *) GPIOF_BASE)
+#endif
+#define ADC1 ((ADC_Type *) ADC1_BASE)
+#define ADC2 ((ADC_Type *) ADC2_BASE)
+#define TMR1 ((TMR_Type *) TMR1_BASE)
+#define SPI1 ((SPI_Type *) SPI1_BASE)
+#define USART1 ((USART_Type *) USART1_BASE)
+#define TMR9 ((TMR_Type *) TMR9_BASE)
+#define TMR10 ((TMR_Type *) TMR10_BASE)
+#define TMR11 ((TMR_Type *) TMR11_BASE)
+#define DMA1 ((DMA_Type *) DMA1_BASE)
+#define DMA2 ((DMA_Type *) DMA2_BASE)
+#define DMA1_Channel1 ((DMA_Channel_Type *) DMA1_Channel1_BASE)
+#define DMA1_Channel2 ((DMA_Channel_Type *) DMA1_Channel2_BASE)
+#define DMA1_Channel3 ((DMA_Channel_Type *) DMA1_Channel3_BASE)
+#define DMA1_Channel4 ((DMA_Channel_Type *) DMA1_Channel4_BASE)
+#define DMA1_Channel5 ((DMA_Channel_Type *) DMA1_Channel5_BASE)
+#define DMA1_Channel6 ((DMA_Channel_Type *) DMA1_Channel6_BASE)
+#define DMA1_Channel7 ((DMA_Channel_Type *) DMA1_Channel7_BASE)
+#define DMA2_Channel1 ((DMA_Channel_Type *) DMA2_Channel1_BASE)
+#define DMA2_Channel2 ((DMA_Channel_Type *) DMA2_Channel2_BASE)
+#define DMA2_Channel3 ((DMA_Channel_Type *) DMA2_Channel3_BASE)
+#define DMA2_Channel4 ((DMA_Channel_Type *) DMA2_Channel4_BASE)
+#define DMA2_Channel5 ((DMA_Channel_Type *) DMA2_Channel5_BASE)
+#define RCC ((RCC_Type *) RCC_BASE)
+#define CRC ((CRC_Type *) CRC_BASE)
+#define FLASH ((FLASH_Type *) FLASH_R_BASE)
+#define UOPTB ((UOB_Type *) UOB_BASE)
+#define DBGMCU ((MCUDBG_Type *) DBGMCU_BASE)
+
+#if defined (AT32F407xx)
+ #define ETH ((ETH_Type *) ETH_BASE)
+#endif
+
+/**
+ * @}
+ */
+
+/** @addtogroup Exported_constants
+ * @{
+ */
+
+/** @addtogroup Peripheral_Registers_Bits_Definition
+* @{
+*/
+
+/******************************************************************************/
+/* Peripheral Registers_Bits_Definition */
+/******************************************************************************/
+
+/******************************************************************************/
+/* */
+/* CRC calculation unit */
+/* */
+/******************************************************************************/
+
+/******************* Bit definition for CRC_DT register *********************/
+#define CRC_DT_DR ((uint32_t)0xFFFFFFFF) /*!< Data register bits */
+
+
+/******************* Bit definition for CRC_IDT register ********************/
+#define CRC_IDT_IDR ((uint8_t)0xFF) /*!< General-purpose 8-bit data register bits */
+
+
+/******************** Bit definition for CRC_CTRL register ********************/
+#define CRC_CTRL_RST ((uint8_t)0x01) /*!< RESET bit */
+
+/******************************************************************************/
+/* */
+/* Analog Comparators (COMP) */
+/* */
+/******************************************************************************/
+
+/********************* Bit definition for COMP_CTRLSTS register *************/
+/* COMP1 bits definition */
+#define COMP_CTRLSTS_COMP1EN ((uint32_t)0x00000001) /*!< COMP1 enable */
+#define COMP_CTRLSTS_COMP1SW1 ((uint32_t)0x00000002) /*!< SW1 switch control */
+#define COMP_CTRLSTS_COMP1MDE ((uint32_t)0x0000000C) /*!< COMP1 power mode */
+#define COMP_CTRLSTS_COMP1MDE_0 ((uint32_t)0x00000004) /*!< COMP1 power mode bit 0 */
+#define COMP_CTRLSTS_COMP1MDE_1 ((uint32_t)0x00000008) /*!< COMP1 power mode bit 1 */
+#define COMP_CTRLSTS_COMP1INSEL ((uint32_t)0x00000070) /*!< COMP1 inverting input select */
+#define COMP_CTRLSTS_COMP1INSEL_0 ((uint32_t)0x00000010) /*!< COMP1 inverting input select bit 0 */
+#define COMP_CTRLSTS_COMP1INSEL_1 ((uint32_t)0x00000020) /*!< COMP1 inverting input select bit 1 */
+#define COMP_CTRLSTS_COMP1INSEL_2 ((uint32_t)0x00000040) /*!< COMP1 inverting input select bit 2 */
+#define COMP_CTRLSTS_COMP1OUTSEL ((uint32_t)0x00000700) /*!< COMP1 output select */
+#define COMP_CTRLSTS_COMP1OUTSEL_0 ((uint32_t)0x00000100) /*!< COMP1 output select bit 0 */
+#define COMP_CTRLSTS_COMP1OUTSEL_1 ((uint32_t)0x00000200) /*!< COMP1 output select bit 1 */
+#define COMP_CTRLSTS_COMP1OUTSEL_2 ((uint32_t)0x00000400) /*!< COMP1 output select bit 2 */
+#define COMP_CTRLSTS_COMP1POL ((uint32_t)0x00000800) /*!< COMP1 output polarity */
+#define COMP_CTRLSTS_COMP1HYST ((uint32_t)0x00003000) /*!< COMP1 hysteresis */
+#define COMP_CTRLSTS_COMP1HYST_0 ((uint32_t)0x00001000) /*!< COMP1 hysteresis bit 0 */
+#define COMP_CTRLSTS_COMP1HYST_1 ((uint32_t)0x00002000) /*!< COMP1 hysteresis bit 1 */
+#define COMP_CTRLSTS_COMP1OUT ((uint32_t)0x00004000) /*!< COMP1 output level */
+#define COMP_CTRLSTS_COMP1LOCK ((uint32_t)0x00008000) /*!< COMP1 lock */
+/* COMP2 bits definition */
+#define COMP_CTRLSTS_COMP2EN ((uint32_t)0x00010000) /*!< COMP2 enable */
+#define COMP_CTRLSTS_COMP2MDE ((uint32_t)0x000C0000) /*!< COMP2 power mode */
+#define COMP_CTRLSTS_COMP2MDE_0 ((uint32_t)0x00040000) /*!< COMP2 power mode bit 0 */
+#define COMP_CTRLSTS_COMP2MDE_1 ((uint32_t)0x00080000) /*!< COMP2 power mode bit 1 */
+#define COMP_CTRLSTS_COMP2INSEL ((uint32_t)0x00700000) /*!< COMP2 inverting input select */
+#define COMP_CTRLSTS_COMP2INSEL_0 ((uint32_t)0x00100000) /*!< COMP2 inverting input select bit 0 */
+#define COMP_CTRLSTS_COMP2INSEL_1 ((uint32_t)0x00200000) /*!< COMP2 inverting input select bit 1 */
+#define COMP_CTRLSTS_COMP2INSEL_2 ((uint32_t)0x00400000) /*!< COMP2 inverting input select bit 2 */
+#define COMP_CTRLSTS_WNDWEN ((uint32_t)0x00800000) /*!< Comparators window mode enable */
+#define COMP_CTRLSTS_COMP2OUTSEL ((uint32_t)0x07000000) /*!< COMP2 output select */
+#define COMP_CTRLSTS_COMP2OUTSEL_0 ((uint32_t)0x01000000) /*!< COMP2 output select bit 0 */
+#define COMP_CTRLSTS_COMP2OUTSEL_1 ((uint32_t)0x02000000) /*!< COMP2 output select bit 1 */
+#define COMP_CTRLSTS_COMP2OUTSEL_2 ((uint32_t)0x04000000) /*!< COMP2 output select bit 2 */
+#define COMP_CTRLSTS_COMP2POL ((uint32_t)0x08000000) /*!< COMP2 output polarity */
+#define COMP_CTRLSTS_COMP2HYST ((uint32_t)0x30000000) /*!< COMP2 hysteresis */
+#define COMP_CTRLSTS_COMP2HYST_0 ((uint32_t)0x10000000) /*!< COMP2 hysteresis bit 0 */
+#define COMP_CTRLSTS_COMP2HYST_1 ((uint32_t)0x20000000) /*!< COMP2 hysteresis bit 1 */
+#define COMP_CTRLSTS_COMP2OUT ((uint32_t)0x40000000) /*!< COMP2 output level */
+#define COMP_CTRLSTS_COMP2LOCK ((uint32_t)0x80000000) /*!< COMP2 lock */
+
+/*************** Bit definition for COMP_G_FILTER_EN register ***************/
+#define COMP_G_FILTER_EN_GFE ((uint16_t)0x0001) /*!< Comparators Glitch filter enable */
+
+/******************************************************************************/
+/* */
+/* Power Control */
+/* */
+/******************************************************************************/
+
+/******************** Bit definition for PWR_CTRL register ********************/
+#define PWR_CTRL_PDDS ((uint16_t)0x0002) /*!< Power Down Deepsleep */
+#define PWR_CTRL_CLWUF ((uint16_t)0x0004) /*!< Clear Wakeup Flag */
+#define PWR_CTRL_CLSBF ((uint16_t)0x0008) /*!< Clear Standby Flag */
+#define PWR_CTRL_PVDEN ((uint16_t)0x0010) /*!< Power Voltage Detector Enable */
+
+#define PWR_CTRL_PVDS ((uint16_t)0x00E0) /*!< PLS[2:0] bits (PVD Level Selection) */
+#define PWR_CTRL_PVDS_0 ((uint16_t)0x0020) /*!< Bit 0 */
+#define PWR_CTRL_PVDS_1 ((uint16_t)0x0040) /*!< Bit 1 */
+#define PWR_CTRL_PVDS_2 ((uint16_t)0x0080) /*!< Bit 2 */
+
+/** PVD level configuration */
+#define PWR_CTRL_PVDS_2V2 ((uint16_t)0x0000) /*!< PVD level 2.2V */
+#define PWR_CTRL_PVDS_2V3 ((uint16_t)0x0020) /*!< PVD level 2.3V */
+#define PWR_CTRL_PVDS_2V4 ((uint16_t)0x0040) /*!< PVD level 2.4V */
+#define PWR_CTRL_PVDS_2V5 ((uint16_t)0x0060) /*!< PVD level 2.5V */
+#define PWR_CTRL_PVDS_2V6 ((uint16_t)0x0080) /*!< PVD level 2.6V */
+#define PWR_CTRL_PVDS_2V7 ((uint16_t)0x00A0) /*!< PVD level 2.7V */
+#define PWR_CTRL_PVDS_2V8 ((uint16_t)0x00C0) /*!< PVD level 2.8V */
+#define PWR_CTRL_PVDS_2V9 ((uint16_t)0x00E0) /*!< PVD level 2.9V */
+
+#define PWR_CTRL_DBP ((uint16_t)0x0100) /*!< Disable Backup Domain write protection */
+
+/******************* Bit definition for PWR_CTRLSTS register ********************/
+#define PWR_CTRLSTS_WUF ((uint16_t)0x0001) /*!< Wakeup Flag */
+#define PWR_CTRLSTS_SBF ((uint16_t)0x0002) /*!< Standby Flag */
+#define PWR_CTRLSTS_PVD ((uint16_t)0x0004) /*!< PVD Output */
+#define PWR_CTRLSTS_WUPEN ((uint16_t)0x0100) /*!< Enable WKUP pin */
+
+/******************************************************************************/
+/* */
+/* Backup registers */
+/* */
+/******************************************************************************/
+#if !defined (AT32F415xx)
+/******************* Bit definition for BKP_DT1 register ********************/
+#define BKP_DT1_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT2 register ********************/
+#define BKP_DT2_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT3 register ********************/
+#define BKP_DT3_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT4 register ********************/
+#define BKP_DT4_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT5 register ********************/
+#define BKP_DT5_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT6 register ********************/
+#define BKP_DT6_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT7 register ********************/
+#define BKP_DT7_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT8 register ********************/
+#define BKP_DT8_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT9 register ********************/
+#define BKP_DT9_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT10 register *******************/
+#define BKP_DT10_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT11 register *******************/
+#define BKP_DT11_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT12 register *******************/
+#define BKP_DT12_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT13 register *******************/
+#define BKP_DT13_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT14 register *******************/
+#define BKP_DT14_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT15 register *******************/
+#define BKP_DT15_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT16 register *******************/
+#define BKP_DT16_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT17 register *******************/
+#define BKP_DT17_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/****************** Bit definition for BKP_DT18 register ********************/
+#define BKP_DT18_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT19 register *******************/
+#define BKP_DT19_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT20 register *******************/
+#define BKP_DT20_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT21 register *******************/
+#define BKP_DT21_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT22 register *******************/
+#define BKP_DT22_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT23 register *******************/
+#define BKP_DT23_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT24 register *******************/
+#define BKP_DT24_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT25 register *******************/
+#define BKP_DT25_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT26 register *******************/
+#define BKP_DT26_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT27 register *******************/
+#define BKP_DT27_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT28 register *******************/
+#define BKP_DT28_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT29 register *******************/
+#define BKP_DT29_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT30 register *******************/
+#define BKP_DT30_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT31 register *******************/
+#define BKP_DT31_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT32 register *******************/
+#define BKP_DT32_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT33 register *******************/
+#define BKP_DT33_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT34 register *******************/
+#define BKP_DT34_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT35 register *******************/
+#define BKP_DT35_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT36 register *******************/
+#define BKP_DT36_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT37 register *******************/
+#define BKP_DT37_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT38 register *******************/
+#define BKP_DT38_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT39 register *******************/
+#define BKP_DT39_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT40 register *******************/
+#define BKP_DT40_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT41 register *******************/
+#define BKP_DT41_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/******************* Bit definition for BKP_DT42 register *******************/
+#define BKP_DT42_D ((uint16_t)0xFFFF) /*!< Backup data */
+
+/****************** Bit definition for BKP_RTCCAL register *******************/
+#define BKP_RTCCAL_CAL ((uint16_t)0x007F) /*!< Calibration value */
+#define BKP_RTCCAL_OT1CAL ((uint16_t)0x0080) /*!< Calibration Clock Output */
+#define BKP_RTCCAL_OT2EN ((uint16_t)0x0100) /*!< Alarm or Second Output Enable */
+#define BKP_RTCCAL_OT2SEL ((uint16_t)0x0200) /*!< Alarm or Second Output Selection */
+
+/******************** Bit definition for BKP_CTRL register ********************/
+#define BKP_CTRL_TPEN ((uint8_t)0x01) /*!< TAMPER pin enable */
+#define BKP_CTRL_TPALV ((uint8_t)0x02) /*!< TAMPER pin active level */
+
+/******************* Bit definition for BKP_CTRLSTS register ********************/
+#define BKP_CTRLSTS_CTPEF ((uint16_t)0x0001) /*!< Clear Tamper event */
+#define BKP_CTRLSTS_CTPIF ((uint16_t)0x0002) /*!< Clear Tamper Interrupt */
+#define BKP_CTRLSTS_TPIEN ((uint16_t)0x0004) /*!< TAMPER Pin interrupt enable */
+#define BKP_CTRLSTS_TPEF ((uint16_t)0x0100) /*!< Tamper Event Flag */
+#define BKP_CTRLSTS_TPIF ((uint16_t)0x0200) /*!< Tamper Interrupt Flag */
+#endif
+/******************************************************************************/
+/* */
+/* Reset and Clock Control */
+/* */
+/******************************************************************************/
+
+/******************** Bit definition for RCC_CTRL register ********************/
+#define RCC_CTRL_HSIEN ((uint32_t)0x00000001) /*!< Internal High Speed clock enable */
+#define RCC_CTRL_HSISTBL ((uint32_t)0x00000002) /*!< Internal High Speed clock ready flag */
+#if defined (AT32F403xx)
+ #define RCC_CTRL_HSITWK ((uint32_t)0x000000F8) /*!< Internal High Speed clock trimming */
+#else
+ #define RCC_CTRL_HSITWK ((uint32_t)0x000000FE) /*!< Internal High Speed clock trimming */
+#endif
+#define RCC_CTRL_HSICAL ((uint32_t)0x0000FF00) /*!< Internal High Speed clock Calibration */
+#define RCC_CTRL_HSEEN ((uint32_t)0x00010000) /*!< External High Speed clock enable */
+#define RCC_CTRL_HSESTBL ((uint32_t)0x00020000) /*!< External High Speed clock ready flag */
+#define RCC_CTRL_HSEBYPS ((uint32_t)0x00040000) /*!< External High Speed clock Bypass */
+#define RCC_CTRL_HSECFDEN ((uint32_t)0x00080000) /*!< Clock Security System enable */
+#define RCC_CTRL_PLLEN ((uint32_t)0x01000000) /*!< PLL enable */
+#define RCC_CTRL_PLLSTBL ((uint32_t)0x02000000) /*!< PLL clock ready flag */
+
+/******************* Bit definition for RCC_CFG register *******************/
+/** SYSCLKSEL configuration */
+#define RCC_CFG_SYSCLKSEL ((uint32_t)0x00000003) /*!< SYSCLKSEL[1:0] bits (System clock Switch) */
+#define RCC_CFG_SYSCLKSEL_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define RCC_CFG_SYSCLKSEL_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+
+#define RCC_CFG_SYSCLKSEL_HSI ((uint32_t)0x00000000) /*!< HSI selected as system clock */
+#define RCC_CFG_SYSCLKSEL_HSE ((uint32_t)0x00000001) /*!< HSE selected as system clock */
+#define RCC_CFG_SYSCLKSEL_PLL ((uint32_t)0x00000002) /*!< PLL selected as system clock */
+
+/** SYSCLKSTST configuration */
+#define RCC_CFG_SYSCLKSTS ((uint32_t)0x0000000C) /*!< SYSCLKSTST[1:0] bits (System Clock Switch Status) */
+#define RCC_CFG_SYSCLKSTS_0 ((uint32_t)0x00000004) /*!< Bit 0 */
+#define RCC_CFG_SYSCLKSTS_1 ((uint32_t)0x00000008) /*!< Bit 1 */
+
+#define RCC_CFG_SYSCLKSTS_HSI ((uint32_t)0x00000000) /*!< HSI oscillator used as system clock */
+#define RCC_CFG_SYSCLKSTS_HSE ((uint32_t)0x00000004) /*!< HSE oscillator used as system clock */
+#define RCC_CFG_SYSCLKSTS_PLL ((uint32_t)0x00000008) /*!< PLL used as system clock */
+
+/** AHBPSC configuration */
+#define RCC_CFG_AHBPSC ((uint32_t)0x000000F0) /*!< AHBPSC[3:0] bits (AHB prescaler) */
+#define RCC_CFG_AHBPSC_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define RCC_CFG_AHBPSC_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+#define RCC_CFG_AHBPSC_2 ((uint32_t)0x00000040) /*!< Bit 2 */
+#define RCC_CFG_AHBPSC_3 ((uint32_t)0x00000080) /*!< Bit 3 */
+
+#define RCC_CFG_AHBPSC_DIV1 ((uint32_t)0x00000000) /*!< SYSCLK not divided */
+#define RCC_CFG_AHBPSC_DIV2 ((uint32_t)0x00000080) /*!< SYSCLK divided by 2 */
+#define RCC_CFG_AHBPSC_DIV4 ((uint32_t)0x00000090) /*!< SYSCLK divided by 4 */
+#define RCC_CFG_AHBPSC_DIV8 ((uint32_t)0x000000A0) /*!< SYSCLK divided by 8 */
+#define RCC_CFG_AHBPSC_DIV16 ((uint32_t)0x000000B0) /*!< SYSCLK divided by 16 */
+#define RCC_CFG_AHBPSC_DIV64 ((uint32_t)0x000000C0) /*!< SYSCLK divided by 64 */
+#define RCC_CFG_AHBPSC_DIV128 ((uint32_t)0x000000D0) /*!< SYSCLK divided by 128 */
+#define RCC_CFG_AHBPSC_DIV256 ((uint32_t)0x000000E0) /*!< SYSCLK divided by 256 */
+#define RCC_CFG_AHBPSC_DIV512 ((uint32_t)0x000000F0) /*!< SYSCLK divided by 512 */
+
+/** APB1PSC configuration */
+#define RCC_CFG_APB1PSC ((uint32_t)0x00000700) /*!< PRE1[2:0] bits (APB1 prescaler) */
+#define RCC_CFG_APB1PSC_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define RCC_CFG_APB1PSC_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define RCC_CFG_APB1PSC_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+
+#define RCC_CFG_APB1PSC_DIV1 ((uint32_t)0x00000000) /*!< HCLK not divided */
+#define RCC_CFG_APB1PSC_DIV2 ((uint32_t)0x00000400) /*!< HCLK divided by 2 */
+#define RCC_CFG_APB1PSC_DIV4 ((uint32_t)0x00000500) /*!< HCLK divided by 4 */
+#define RCC_CFG_APB1PSC_DIV8 ((uint32_t)0x00000600) /*!< HCLK divided by 8 */
+#define RCC_CFG_APB1PSC_DIV16 ((uint32_t)0x00000700) /*!< HCLK divided by 16 */
+
+/** APB2PSC configuration */
+#define RCC_CFG_APB2PSC ((uint32_t)0x00003800) /*!< PRE2[2:0] bits (APB2 prescaler) */
+#define RCC_CFG_APB2PSC_0 ((uint32_t)0x00000800) /*!< Bit 0 */
+#define RCC_CFG_APB2PSC_1 ((uint32_t)0x00001000) /*!< Bit 1 */
+#define RCC_CFG_APB2PSC_2 ((uint32_t)0x00002000) /*!< Bit 2 */
+
+#define RCC_CFG_APB2PSC_DIV1 ((uint32_t)0x00000000) /*!< HCLK not divided */
+#define RCC_CFG_APB2PSC_DIV2 ((uint32_t)0x00002000) /*!< HCLK divided by 2 */
+#define RCC_CFG_APB2PSC_DIV4 ((uint32_t)0x00002800) /*!< HCLK divided by 4 */
+#define RCC_CFG_APB2PSC_DIV8 ((uint32_t)0x00003000) /*!< HCLK divided by 8 */
+#define RCC_CFG_APB2PSC_DIV16 ((uint32_t)0x00003800) /*!< HCLK divided by 16 */
+
+#define RCC_CFG_PLLRC ((uint32_t)0x00010000) /*!< PLL entry clock source */
+#define RCC_CFG_PLLHSEPSC ((uint32_t)0x00020000) /*!< HSE divider for PLL entry */
+
+
+/** ADCPSC configuration */
+#define RCC_CFG_ADCPSC ((uint32_t)0x1000C000) /*!< ADCPSC[1:0] bits (ADC prescaler) */
+#define RCC_CFG_ADCPSC_0 ((uint32_t)0x00004000) /*!< Bit 0 */
+#define RCC_CFG_ADCPSC_1 ((uint32_t)0x00008000) /*!< Bit 1 */
+#define RCC_CFG_ADCPSC_2 ((uint32_t)0x10000000) /*!< Bit 2 */
+#define RCC_CFG_ADCPSC_DIV2 ((uint32_t)0x00000000) /*!< PCLK2 divided by 2 */
+#define RCC_CFG_ADCPSC_DIV4 ((uint32_t)0x00004000) /*!< PCLK2 divided by 4 */
+#define RCC_CFG_ADCPSC_DIV6 ((uint32_t)0x00008000) /*!< PCLK2 divided by 6 */
+#define RCC_CFG_ADCPSC_DIV8 ((uint32_t)0x0000C000) /*!< PCLK2 divided by 8 */
+#define RCC_CFG_ADCPSC_DIV12 ((uint32_t)0x10004000) /*!< PCLK2 divided by 12 */
+#define RCC_CFG_ADCPSC_DIV16 ((uint32_t)0x1000C000) /*!< PCLK2 divided by 16 */
+
+#define RCC_CFG_PLLCFG_MASK ((uint32_t)0x1FC0FFFF) /*!< Mask for PLLRANGE, PLLHSEPSC, PLLMULT, PLLRC */
+
+
+/** PLLMULT configuration */
+#define RCC_CFG_PLLMULT ((uint32_t)0x603C0000) /*!< PLLMUL[5:0] bits (PLL multiplication factor) */
+#define RCC_CFG_PLLMULT_0 ((uint32_t)0x00040000) /*!< Bit 0 */
+#define RCC_CFG_PLLMULT_1 ((uint32_t)0x00080000) /*!< Bit 1 */
+#define RCC_CFG_PLLMULT_2 ((uint32_t)0x00100000) /*!< Bit 2 */
+#define RCC_CFG_PLLMULT_3 ((uint32_t)0x00200000) /*!< Bit 3 */
+#define RCC_CFG_PLLMULT_4 ((uint32_t)0x20000000) /*!< Bit 4 */
+#define RCC_CFG_PLLMULT_5 ((uint32_t)0x40000000) /*!< Bit 5 */
+#define RCC_CFG_PLLMULT_LB_MASK ((uint32_t)0x003C0000)
+#define RCC_CFG_PLLMULT_HB_MASK ((uint32_t)0x60000000)
+#define RCC_CFG_PLLMULT_LB_POS ((uint32_t)18)
+#define RCC_CFG_PLLMULT_HB_POS ((uint32_t)29)
+#define RCC_CFG_PLLMULT_HB_OFFSET ((uint32_t)4)
+
+
+#define RCC_CFG_PLLRANGE ((uint32_t)0x80000000) /*!< PLL Frequency range. */
+#define RCC_CFG_PLLRANGE_LE72MHZ ((uint32_t)0x00000000) /*!< When PLL frequency is less than or equal to 72MHz */
+#define RCC_CFG_PLLRANGE_GT72MHZ ((uint32_t)0x80000000) /*!< When PLL frequency is greater than 72MHz */
+
+#define RCC_CFG_PLLRC_HSI_DIV2 ((uint32_t)0x00000000) /*!< HSI clock divided by 2 selected as PLL entry clock source */
+#define RCC_CFG_PLLRC_HSE ((uint32_t)0x00010000) /*!< HSE clock selected as PLL entry clock source */
+
+#define RCC_CFG_PLLHSEPSC_HSE ((uint32_t)0x00000000) /*!< HSE clock not divided for PLL entry */
+#define RCC_CFG_PLLHSEPSC_HSE_DIV2 ((uint32_t)0x00020000) /*!< HSE clock divided by 2 for PLL entry */
+
+#define RCC_CFG_PLLMULT2 ((uint32_t)0x00000000) /*!< PLL input clock*2 */
+#define RCC_CFG_PLLMULT3 ((uint32_t)0x00040000) /*!< PLL input clock*3 */
+#define RCC_CFG_PLLMULT4 ((uint32_t)0x00080000) /*!< PLL input clock*4 */
+#define RCC_CFG_PLLMULT5 ((uint32_t)0x000C0000) /*!< PLL input clock*5 */
+#define RCC_CFG_PLLMULT6 ((uint32_t)0x00100000) /*!< PLL input clock*6 */
+#define RCC_CFG_PLLMULT7 ((uint32_t)0x00140000) /*!< PLL input clock*7 */
+#define RCC_CFG_PLLMULT8 ((uint32_t)0x00180000) /*!< PLL input clock*8 */
+#define RCC_CFG_PLLMULT9 ((uint32_t)0x001C0000) /*!< PLL input clock*9 */
+#define RCC_CFG_PLLMULT10 ((uint32_t)0x00200000) /*!< PLL input clock*10 */
+#define RCC_CFG_PLLMULT11 ((uint32_t)0x00240000) /*!< PLL input clock*11 */
+#define RCC_CFG_PLLMULT12 ((uint32_t)0x00280000) /*!< PLL input clock*12 */
+#define RCC_CFG_PLLMULT13 ((uint32_t)0x002C0000) /*!< PLL input clock*13 */
+#define RCC_CFG_PLLMULT14 ((uint32_t)0x00300000) /*!< PLL input clock*14 */
+#define RCC_CFG_PLLMULT15 ((uint32_t)0x00340000) /*!< PLL input clock*15 */
+#define RCC_CFG_PLLMULT16 ((uint32_t)0x00380000) /*!< PLL input clock*16 */
+
+#define RCC_CFG_PLLMULT17 ((uint32_t)0x20000000) /*!< PLL input clock*17 */
+#define RCC_CFG_PLLMULT18 ((uint32_t)0x20040000) /*!< PLL input clock*18 */
+#define RCC_CFG_PLLMULT19 ((uint32_t)0x20080000) /*!< PLL input clock*19 */
+#define RCC_CFG_PLLMULT20 ((uint32_t)0x200C0000) /*!< PLL input clock*20 */
+#define RCC_CFG_PLLMULT21 ((uint32_t)0x20100000) /*!< PLL input clock*21 */
+#define RCC_CFG_PLLMULT22 ((uint32_t)0x20140000) /*!< PLL input clock*22 */
+#define RCC_CFG_PLLMULT23 ((uint32_t)0x20180000) /*!< PLL input clock*23 */
+#define RCC_CFG_PLLMULT24 ((uint32_t)0x201C0000) /*!< PLL input clock*24 */
+#define RCC_CFG_PLLMULT25 ((uint32_t)0x20200000) /*!< PLL input clock*25 */
+#define RCC_CFG_PLLMULT26 ((uint32_t)0x20240000) /*!< PLL input clock*26 */
+#define RCC_CFG_PLLMULT27 ((uint32_t)0x20280000) /*!< PLL input clock*27 */
+#define RCC_CFG_PLLMULT28 ((uint32_t)0x202C0000) /*!< PLL input clock*28 */
+#define RCC_CFG_PLLMULT29 ((uint32_t)0x20300000) /*!< PLL input clock*29 */
+#define RCC_CFG_PLLMULT30 ((uint32_t)0x20340000) /*!< PLL input clock*30 */
+#define RCC_CFG_PLLMULT31 ((uint32_t)0x20380000) /*!< PLL input clock*31 */
+#define RCC_CFG_PLLMULT32 ((uint32_t)0x203C0000) /*!< PLL input clock*32 */
+#define RCC_CFG_PLLMULT33 ((uint32_t)0x40000000) /*!< PLL input clock*33 */
+#define RCC_CFG_PLLMULT34 ((uint32_t)0x40040000) /*!< PLL input clock*34 */
+#define RCC_CFG_PLLMULT35 ((uint32_t)0x40080000) /*!< PLL input clock*35 */
+#define RCC_CFG_PLLMULT36 ((uint32_t)0x400C0000) /*!< PLL input clock*36 */
+#define RCC_CFG_PLLMULT37 ((uint32_t)0x40100000) /*!< PLL input clock*37 */
+#define RCC_CFG_PLLMULT38 ((uint32_t)0x40140000) /*!< PLL input clock*38 */
+#define RCC_CFG_PLLMULT39 ((uint32_t)0x40180000) /*!< PLL input clock*39 */
+#define RCC_CFG_PLLMULT40 ((uint32_t)0x401C0000) /*!< PLL input clock*40 */
+#define RCC_CFG_PLLMULT41 ((uint32_t)0x40200000) /*!< PLL input clock*41 */
+#define RCC_CFG_PLLMULT42 ((uint32_t)0x40240000) /*!< PLL input clock*42 */
+#define RCC_CFG_PLLMULT43 ((uint32_t)0x40280000) /*!< PLL input clock*43 */
+#define RCC_CFG_PLLMULT44 ((uint32_t)0x402C0000) /*!< PLL input clock*44 */
+#define RCC_CFG_PLLMULT45 ((uint32_t)0x40300000) /*!< PLL input clock*45 */
+#define RCC_CFG_PLLMULT46 ((uint32_t)0x40340000) /*!< PLL input clock*46 */
+#define RCC_CFG_PLLMULT47 ((uint32_t)0x40380000) /*!< PLL input clock*47 */
+#define RCC_CFG_PLLMULT48 ((uint32_t)0x403C0000) /*!< PLL input clock*48 */
+#define RCC_CFG_PLLMULT49 ((uint32_t)0x60000000) /*!< PLL input clock*49 */
+#define RCC_CFG_PLLMULT50 ((uint32_t)0x60040000) /*!< PLL input clock*50 */
+#define RCC_CFG_PLLMULT51 ((uint32_t)0x60080000) /*!< PLL input clock*51 */
+#define RCC_CFG_PLLMULT52 ((uint32_t)0x600C0000) /*!< PLL input clock*52 */
+#define RCC_CFG_PLLMULT53 ((uint32_t)0x60100000) /*!< PLL input clock*53 */
+#define RCC_CFG_PLLMULT54 ((uint32_t)0x60140000) /*!< PLL input clock*54 */
+#define RCC_CFG_PLLMULT55 ((uint32_t)0x60180000) /*!< PLL input clock*55 */
+#define RCC_CFG_PLLMULT56 ((uint32_t)0x601C0000) /*!< PLL input clock*56 */
+#define RCC_CFG_PLLMULT57 ((uint32_t)0x60200000) /*!< PLL input clock*57 */
+#define RCC_CFG_PLLMULT58 ((uint32_t)0x60240000) /*!< PLL input clock*58 */
+#define RCC_CFG_PLLMULT59 ((uint32_t)0x60280000) /*!< PLL input clock*59 */
+#define RCC_CFG_PLLMULT60 ((uint32_t)0x602C0000) /*!< PLL input clock*60 */
+#define RCC_CFG_PLLMULT61 ((uint32_t)0x60300000) /*!< PLL input clock*61 */
+#define RCC_CFG_PLLMULT62 ((uint32_t)0x60340000) /*!< PLL input clock*62 */
+#define RCC_CFG_PLLMULT63 ((uint32_t)0x60380000) /*!< PLL input clock*63 */
+#define RCC_CFG_PLLMULT64 ((uint32_t)0x603C0000) /*!< PLL input clock*64 */
+
+#define RCC_CFG_USBPSC ((uint32_t)0x08C00000) /*!< USB Device prescaler */
+#define RCC_CFG_USBPSC_0 ((uint32_t)0x00400000) /*!< Bit 0 */
+#define RCC_CFG_USBPSC_1 ((uint32_t)0x00800000) /*!< Bit 1 */
+#define RCC_CFG_USBPSC_2 ((uint32_t)0x08000000) /*!< Bit 2 */
+#define RCC_CFG_USBPSC_DIV1_5 ((uint32_t)0x00000000) /*!< SYSCLK divided by 1.5 selected as USB clock source */
+#define RCC_CFG_USBPSC_DIV1 ((uint32_t)0x00400000) /*!< SYSCLK selected as USB clock source */
+#define RCC_CFG_USBPSC_DIV2_5 ((uint32_t)0x00800000) /*!< SYSCLK divided by 2.5 selected as USB clock source */
+#define RCC_CFG_USBPSC_DIV2 ((uint32_t)0x00C00000) /*!< SYSCLK divided by 2 selected as USB clock source */
+#define RCC_CFG_USBPSC_DIV3_5 ((uint32_t)0x08000000) /*!< SYSCLK divided by 3.5 selected as USB clock source */
+#define RCC_CFG_USBPSC_DIV3 ((uint32_t)0x08400000) /*!< SYSCLK divided by 3 selected as USB clock source */
+#define RCC_CFG_USBPSC_DIV4 ((uint32_t)0x08800000) /*!< SYSCLK divided by 4 selected as USB clock source */
+#define RCC_CFG_USBPSC_DIV4_0 ((uint32_t)0x08C00000) /*!< SYSCLK divided by 4 selected as USB clock source */
+
+/** CLKOUT configuration */
+#define RCC_CFG_CLKOUT ((uint32_t)0x07000000) /*!< CLKOUT[2:0] bits (Microcontroller Clock Output) */
+#define RCC_CFG_CLKOUT_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define RCC_CFG_CLKOUT_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define RCC_CFG_CLKOUT_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+
+#define RCC_CFG_CLKOUT_NOCLK ((uint32_t)0x00000000) /*!< No clock */
+#define RCC_CFG_CLKOUT_SYSCLK ((uint32_t)0x04000000) /*!< System clock selected as CLKOUT source */
+#define RCC_CFG_CLKOUT_HSI ((uint32_t)0x05000000) /*!< HSI clock selected as CLKOUT source */
+#define RCC_CFG_CLKOUT_HSE ((uint32_t)0x06000000) /*!< HSE clock selected as CLKOUT source */
+#define RCC_CFG_CLKOUT_PLL_DIV2 ((uint32_t)0x07000000) /*!< PLL clock divided by 2 selected as CLKOUT source */
+
+/******************** Bit definition for RCC_CLKINT register ********************/
+#define RCC_CLKINT_LSISTBLF ((uint32_t)0x00000001) /*!< LSI Ready Interrupt flag */
+#define RCC_CLKINT_LSESTBLF ((uint32_t)0x00000002) /*!< LSE Ready Interrupt flag */
+#define RCC_CLKINT_HSISTBLF ((uint32_t)0x00000004) /*!< HSI Ready Interrupt flag */
+#define RCC_CLKINT_HSESTBLF ((uint32_t)0x00000008) /*!< HSE Ready Interrupt flag */
+#define RCC_CLKINT_PLLSTBLF ((uint32_t)0x00000010) /*!< PLL Ready Interrupt flag */
+#define RCC_CLKINT_HSECFDF ((uint32_t)0x00000080) /*!< Clock Security System Interrupt flag */
+#define RCC_CLKINT_LSISTBLIE ((uint32_t)0x00000100) /*!< LSI Ready Interrupt Enable */
+#define RCC_CLKINT_LSESTBLIE ((uint32_t)0x00000200) /*!< LSE Ready Interrupt Enable */
+#define RCC_CLKINT_HSISTBLIE ((uint32_t)0x00000400) /*!< HSI Ready Interrupt Enable */
+#define RCC_CLKINT_HSESTBLIE ((uint32_t)0x00000800) /*!< HSE Ready Interrupt Enable */
+#define RCC_CLKINT_PLLSTBLIE ((uint32_t)0x00001000) /*!< PLL Ready Interrupt Enable */
+#define RCC_CLKINT_LSISTBLFC ((uint32_t)0x00010000) /*!< LSI Ready Interrupt Clear */
+#define RCC_CLKINT_LSESTBLFC ((uint32_t)0x00020000) /*!< LSE Ready Interrupt Clear */
+#define RCC_CLKINT_HSISTBLFC ((uint32_t)0x00040000) /*!< HSI Ready Interrupt Clear */
+#define RCC_CLKINT_HSESTBLFC ((uint32_t)0x00080000) /*!< HSE Ready Interrupt Clear */
+#define RCC_CLKINT_PLLSTBLFC ((uint32_t)0x00100000) /*!< PLL Ready Interrupt Clear */
+#define RCC_CLKINT_HSECFDFC ((uint32_t)0x00800000) /*!< Clock Security System Interrupt Clear */
+
+/***************** Bit definition for RCC_APB2RST register *****************/
+#define RCC_APB2RST_AFIORST ((uint32_t)0x00000001) /*!< Alternate Function I/O reset */
+#define RCC_APB2RST_GPIOARST ((uint32_t)0x00000004) /*!< I/O port A reset */
+#define RCC_APB2RST_GPIOBRST ((uint32_t)0x00000008) /*!< I/O port B reset */
+#define RCC_APB2RST_GPIOCRST ((uint32_t)0x00000010) /*!< I/O port C reset */
+#define RCC_APB2RST_GPIODRST ((uint32_t)0x00000020) /*!< I/O port D reset */
+#define RCC_APB2RST_ADC1RST ((uint32_t)0x00000200) /*!< ADC 1 interface reset */
+#define RCC_APB2RST_TMR1RST ((uint32_t)0x00000800) /*!< TMR1 Timer reset */
+#define RCC_APB2RST_SPI1RST ((uint32_t)0x00001000) /*!< SPI 1 reset */
+#define RCC_APB2RST_USART1RST ((uint32_t)0x00004000) /*!< USART1 reset */
+
+#if !defined (AT32F415xx)
+ #define RCC_APB2RST_ADC2RST ((uint32_t)0x00000400) /*!< ADC 2 interface reset */
+#endif
+
+#if !defined (AT32F413Kx_MD) && !defined (AT32F413Kx_HD) && \
+ !defined (AT32F413Cx_MD) && !defined (AT32F413Rx_MD) && \
+ !defined (AT32FEBKCx_MD) && !defined (TS32F401CBU7) && \
+ !defined (AT32F415xx)
+ #define RCC_APB2RST_TMR8RST ((uint32_t)0x00002000) /*!< TMR8 Timer reset */
+#endif
+
+#if !defined (AT32F403Axx) || !defined (AT32F407xx)
+ #define RCC_APB2RST_GPIOFRST ((uint32_t)0x00000080) /*!< I/O port F reset */
+#endif
+
+#if !defined (AT32FEBKCx_MD)
+ #define RCC_APB2RST_TMR9RST ((uint32_t)0x00080000) /*!< TMR9 Timer reset */
+ #define RCC_APB2RST_TMR10RST ((uint32_t)0x00100000) /*!< TMR10 Timer reset */
+ #define RCC_APB2RST_TMR11RST ((uint32_t)0x00200000) /*!< TMR11 Timer reset */
+#endif
+
+#if defined (AT32F403xx)
+ #define RCC_APB2RST_GPIOERST ((uint32_t)0x00000040) /*!< I/O port E reset */
+ #define RCC_APB2RST_GPIOGRST ((uint32_t)0x00000100) /*!< I/O port G reset */
+ #define RCC_APB2RST_ADC3RST ((uint32_t)0x00008000) /*!< ADC3 interface reset */
+ #define RCC_APB2RST_TMR15RST ((uint32_t)0x00010000) /*!< TMR15 Timer reset */
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+ #define RCC_APB2RST_GPIOERST ((uint32_t)0x00000040) /*!< I/O port E reset */
+ #define RCC_APB2RST_ADC3RST ((uint32_t)0x00008000) /*!< ADC3 interface reset */
+ #define RCC_APB2RST_I2C3RST ((uint32_t)0x00800000) /*!< I2C3 interface reset */
+ #define RCC_APB2RST_USART6RST ((uint32_t)0x01000000) /*!< USART6 interface reset */
+ #define RCC_APB2RST_UART7RST ((uint32_t)0x02000000) /*!< UART7 interface reset */
+ #define RCC_APB2RST_UART8RST ((uint32_t)0x04000000) /*!< UART8 interface reset */
+#endif
+
+#if !defined (AT32F403xx)
+ #if !defined (AT32FEBKCx_MD)
+ #define RCC_APB2RST_ACCRST ((uint32_t)0x00400000) /*!< ACC reset */
+ #endif
+#endif
+
+#if defined (AT32F415xx)
+ #define RCC_APB2RST_EFCBRST ((uint32_t)0x00800000) /*!< EFCB reset */
+#endif
+/***************** Bit definition for RCC_APB1RST register *****************/
+#define RCC_APB1RST_TMR2RST ((uint32_t)0x00000001) /*!< Timer 2 reset */
+#define RCC_APB1RST_TMR3RST ((uint32_t)0x00000002) /*!< Timer 3 reset */
+#define RCC_APB1RST_WWDGRST ((uint32_t)0x00000800) /*!< Window Watchdog reset */
+#define RCC_APB1RST_USART2RST ((uint32_t)0x00020000) /*!< USART 2 reset */
+#define RCC_APB1RST_I2C1RST ((uint32_t)0x00200000) /*!< I2C 1 reset */
+#define RCC_APB1RST_CAN1RST ((uint32_t)0x02000000) /*!< CAN1 reset */
+#define RCC_APB1RST_PWRRST ((uint32_t)0x10000000) /*!< Power interface reset */
+#define RCC_APB1RST_TMR4RST ((uint32_t)0x00000004) /*!< Timer 4 reset */
+#define RCC_APB1RST_SPI2RST ((uint32_t)0x00004000) /*!< SPI 2 reset */
+#define RCC_APB1RST_I2C2RST ((uint32_t)0x00400000) /*!< I2C 2 reset */
+#define RCC_APB1RST_TMR5RST ((uint32_t)0x00000008) /*!< Timer 5 reset */
+
+#if !defined (AT32F415xx)
+ #define RCC_APB1RST_BKPRST ((uint32_t)0x08000000) /*!< Backup interface reset */
+ #define RCC_APB1RST_USBRST ((uint32_t)0x00800000) /*!< USB Device reset */
+#endif
+
+#if defined (AT32F415xx)
+ #define RCC_APB1RST_COMPRST ((uint32_t)0x00000200) /*!< Compare reset */
+#endif
+
+#if defined (AT32F403Vx_HD) || defined (AT32F403Zx_HD) || \
+ defined (AT32F403Vx_XL) || defined (AT32F403Zx_XL) || \
+ defined (AT32F403Axx) || defined (AT32F407xx)
+ #define RCC_APB1RST_SPI4RST ((uint32_t)0x00010000) /*!< SPI 4 reset */
+#endif /* AT32F403Vx_HD || AT32F403Zx_HD || AT32F403Vx_XL || AT32F403Zx_XL
+ AT32F403Axx || AT32F407xx */
+
+#if !defined (AT32F413Kx_MD) && !defined (AT32F413Kx_HD) && \
+ !defined (AT32F415K8U7_4)&& !defined (AT32F415KBU7_4)&& \
+ !defined (AT32F415KCU7_4)
+ #define RCC_APB1RST_USART3RST ((uint32_t)0x00040000) /*!< USART 3 reset */
+#endif
+
+#if !defined (AT32F413Kx_MD) && !defined (AT32F413Kx_HD) && \
+ !defined (AT32F413Cx_MD) && !defined (AT32F413Cx_HD) && \
+ !defined (AT32FEBKCx_MD) && !defined (TS32F401CBU7) && \
+ !defined (AT32F415K8U7_4)&& !defined (AT32F415KBU7_4)&& \
+ !defined (AT32F415KCU7_4)&& !defined (AT32F415C8T7) && \
+ !defined (AT32F415CBT7) && !defined (AT32F415CCT7) && \
+ !defined (AT32F415CBU7) && !defined (AT32F415CCU7)
+ #define RCC_APB1RST_UART4RST ((uint32_t)0x00080000) /*!< UART 4 reset */
+ #define RCC_APB1RST_UART5RST ((uint32_t)0x00100000) /*!< UART 5 reset */
+#endif
+
+#if defined (AT32F413Cx_HD) || defined (AT32F413Cx_MD) || \
+ defined (AT32F413Rx_HD) || defined (AT32F413Rx_MD) || \
+ defined (TS32F401CBU7)
+ #define RCC_APB1RST_CAN2RST ((uint32_t)0x80000000) /*!< CAN2 reset */
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+ #define RCC_APB1RST_CAN2RST ((uint32_t)0x04000000) /*!< CAN2 reset */
+#endif
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+ #define RCC_APB1RST_TMR6RST ((uint32_t)0x00000010) /*!< Timer 6 reset */
+ #define RCC_APB1RST_TMR7RST ((uint32_t)0x00000020) /*!< Timer 7 reset */
+ #define RCC_APB1RST_SPI3RST ((uint32_t)0x00008000) /*!< SPI 3 reset */
+ #define RCC_APB1RST_I2C3RST ((uint32_t)0x04000000) /*!< I2C 3 reset */
+ #define RCC_APB1RST_TMR12RST ((uint32_t)0x00000040) /*!< TMR12 Timer reset */
+ #define RCC_APB1RST_TMR13RST ((uint32_t)0x00000080) /*!< TMR13 Timer reset */
+ #define RCC_APB1RST_TMR14RST ((uint32_t)0x00000100) /*!< TMR14 Timer reset */
+ #define RCC_APB1RST_DACRST ((uint32_t)0x20000000) /*!< DAC interface reset */
+#endif
+
+/****************** Bit definition for RCC_AHBEN register ******************/
+#define RCC_AHBEN_DMA1EN ((uint16_t)0x0001) /*!< DMA1 clock enable */
+#define RCC_AHBEN_DMA2EN ((uint16_t)0x0002) /*!< DMA2 clock enable */
+#define RCC_AHBEN_SRAMEN ((uint16_t)0x0004) /*!< SRAM interface clock enable */
+#define RCC_AHBEN_FLASHEN ((uint16_t)0x0010) /*!< FLITF clock enable */
+#define RCC_AHBEN_CRCEN ((uint16_t)0x0040) /*!< CRC clock enable */
+
+#if !defined (AT32FEBKCx_MD) && !defined (AT32F403Cx_HD) && \
+ !defined (AT32F403Cx_MD) && !defined (AT32F403Cx_XL) && \
+ !defined (AT32F403ACCT7) && !defined (AT32F403ACCU7) && \
+ !defined (AT32F403ACET7) && !defined (AT32F403ACEU7) && \
+ !defined (AT32F403ACGT7) && !defined (AT32F403ACGU7)
+ #define RCC_AHBEN_SDIO1EN ((uint16_t)0x0400) /*!< SDIO1 clock enable */
+#endif
+
+#if defined (AT32F403Vx_HD) || defined (AT32F403Zx_HD) || \
+ defined (AT32F403Vx_XL) || defined (AT32F403Zx_XL) || \
+ defined (AT32F403ARCT7) || defined (AT32F403ARGT7) || \
+ defined (AT32F403ARET7) || defined (AT32F403AVET7) || \
+ defined (AT32F403AVCT7) || defined (AT32F403AVGT7) || \
+ defined (AT32F407xx)
+ #define RCC_AHBEN_XMCEN ((uint16_t)0x0100) /*!< XMC clock enable */
+#endif /* AT32F403Vx_HD || AT32F403Zx_HD || AT32F403Vx_XL ||
+ AT32F403Zx_XL || AT32F403ARCT7 || AT32F403ARGT7 ||
+ AT32F403AVCT7 || AT32F403AVGT7 || AT32F403ARET7 ||
+ AT32F403AVET7 || AT32F407xx */
+
+#if defined (AT32F403Vx_HD) || defined (AT32F403Vx_XL) || \
+ defined (AT32F403Zx_HD) || defined (AT32F403Zx_XL) || \
+ defined (AT32F403Rx_HD) || defined (AT32F403Rx_XL) || \
+ defined (AT32F403Axx) || defined (AT32F407xx)
+ #define RCC_AHBEN_SDIO2EN ((uint16_t)0x0800) /*!< SDIO2 clock enable */
+#endif
+
+#if defined (AT32F415xx)
+ #define RCC_AHBEN_USBEN ((uint16_t)0x1000) /*!< USB clock enable */
+#endif
+
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+ #define RCC_AHBEN_ETHMACEN ((uint16_t)0x00004000) /*!< ETHMAC clock enable */
+ #define RCC_AHBEN_ETHMACTXEN ((uint16_t)0x00008000) /*!< ETHMACTX clock enable */
+ #define RCC_AHBEN_ETHMACRXEN ((uint16_t)0x00010000) /*!< ETHMACRX clock enable */
+ #define RCC_AHBEN_ETHMACPTPEN ((uint16_t)0x10000000) /*!< ETHMACPTP clock enable */
+#endif
+
+/****************** Bit definition for RCC_APB2EN register *****************/
+#define RCC_APB2EN_AFIOEN ((uint32_t)0x00000001) /*!< Alternate Function I/O clock enable */
+#define RCC_APB2EN_GPIOAEN ((uint32_t)0x00000004) /*!< I/O port A clock enable */
+#define RCC_APB2EN_GPIOBEN ((uint32_t)0x00000008) /*!< I/O port B clock enable */
+#define RCC_APB2EN_GPIOCEN ((uint32_t)0x00000010) /*!< I/O port C clock enable */
+#define RCC_APB2EN_GPIODEN ((uint32_t)0x00000020) /*!< I/O port D clock enable */
+#define RCC_APB2EN_ADC1EN ((uint32_t)0x00000200) /*!< ADC 1 interface clock enable */
+#define RCC_APB2EN_TMR1EN ((uint32_t)0x00000800) /*!< TMR1 Timer clock enable */
+#define RCC_APB2EN_SPI1EN ((uint32_t)0x00001000) /*!< SPI 1 clock enable */
+#define RCC_APB2EN_USART1EN ((uint32_t)0x00004000) /*!< USART1 clock enable */
+
+#if !defined (AT32F415xx)
+ #define RCC_APB2EN_ADC2EN ((uint32_t)0x00000400) /*!< ADC 2 interface clock enable */
+#endif
+
+#if !defined (AT32F413Kx_MD) && !defined (AT32F413Kx_HD) && \
+ !defined (AT32F413Cx_MD) && !defined (AT32F413Rx_MD) && \
+ !defined (AT32FEBKCx_MD) && !defined (TS32F401CBU7) && \
+ !defined (AT32F415xx)
+ #define RCC_APB2EN_TMR8EN ((uint32_t)0x00002000) /*!< TMR8 Timer clock enable */
+#endif
+
+#define RCC_APB2EN_GPIOFEN ((uint32_t)0x00000080) /*!< I/O port F clock enable */
+
+#if !defined (AT32FEBKCx_MD)
+ #define RCC_APB2EN_TMR9EN ((uint32_t)0x00080000) /*!< TMR9 Timer clock enable */
+ #define RCC_APB2EN_TMR10EN ((uint32_t)0x00100000) /*!< TMR10 Timer clock enable */
+ #define RCC_APB2EN_TMR11EN ((uint32_t)0x00200000) /*!< TMR11 Timer clock enable */
+#endif
+
+#if defined (AT32F403xx)
+ #define RCC_APB2EN_GPIOEEN ((uint32_t)0x00000040) /*!< I/O port E clock enable */
+ #define RCC_APB2EN_GPIOGEN ((uint32_t)0x00000100) /*!< I/O port G clock enable */
+ #define RCC_APB2EN_ADC3EN ((uint32_t)0x00008000) /*!< DMA1 clock enable */
+ #define RCC_APB2EN_TMR15EN ((uint32_t)0x00010000) /*!< TMR15 Timer clock enable */
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+ #define RCC_APB2EN_GPIOEEN ((uint32_t)0x00000040) /*!< I/O port E clock enable */
+ #define RCC_APB2EN_ADC3EN ((uint32_t)0x00008000) /*!< ADC3 interface clock enable */
+ #define RCC_APB2EN_I2C3EN ((uint32_t)0x00800000) /*!< I2C3 interface clock enable */
+ #define RCC_APB2EN_USART6EN ((uint32_t)0x01000000) /*!< USART6 interface clock enable */
+ #define RCC_APB2EN_UART7EN ((uint32_t)0x02000000) /*!< UART7 interface clock enable */
+ #define RCC_APB2EN_UART8EN ((uint32_t)0x04000000) /*!< UART8 interface clock enable */
+#endif
+
+#if !defined (AT32F403xx)
+ #if !defined (AT32FEBKCx_MD)
+ #define RCC_APB2EN_ACCEN ((uint32_t)0x00400000) /*!< ACC enable */
+ #endif
+#endif
+
+#if defined (AT32F415xx)
+ #define RCC_APB2EN_EFCBEN ((uint32_t)0x00800000) /*!< EFCB enable */
+#endif
+
+/***************** Bit definition for RCC_APB1EN register ******************/
+#define RCC_APB1EN_TMR2EN ((uint32_t)0x00000001) /*!< Timer 2 clock enabled*/
+#define RCC_APB1EN_TMR3EN ((uint32_t)0x00000002) /*!< Timer 3 clock enable */
+#define RCC_APB1EN_WWDGEN ((uint32_t)0x00000800) /*!< Window Watchdog clock enable */
+#define RCC_APB1EN_USART2EN ((uint32_t)0x00020000) /*!< USART 2 clock enable */
+#define RCC_APB1EN_I2C1EN ((uint32_t)0x00200000) /*!< I2C 1 clock enable */
+#define RCC_APB1EN_CAN1EN ((uint32_t)0x02000000) /*!< CAN1 clock enable */
+#define RCC_APB1EN_PWREN ((uint32_t)0x10000000) /*!< Power interface clock enable */
+#define RCC_APB1EN_TMR4EN ((uint32_t)0x00000004) /*!< Timer 4 clock enable */
+#define RCC_APB1EN_SPI2EN ((uint32_t)0x00004000) /*!< SPI 2 clock enable */
+#define RCC_APB1EN_I2C2EN ((uint32_t)0x00400000) /*!< I2C 2 clock enable */
+#define RCC_APB1EN_TMR5EN ((uint32_t)0x00000008) /*!< Timer 5 clock enable */
+
+#if !defined (AT32F415xx)
+ #define RCC_APB1EN_BKPEN ((uint32_t)0x08000000) /*!< Backup interface clock enable */
+ #define RCC_APB1EN_USBEN ((uint32_t)0x00800000) /*!< USB Device clock enable */
+#endif
+
+#if defined (AT32F415xx)
+ #define RCC_APB1EN_COMPEN ((uint32_t)0x00000200) /*!< Compare enable */
+#endif
+
+#if defined (AT32F403Vx_HD) || defined (AT32F403Zx_HD) || \
+ defined (AT32F403Vx_XL) || defined (AT32F403Zx_XL) || \
+ defined (AT32F403Axx) || defined (AT32F407xx)
+ #define RCC_APB1EN_SPI4EN ((uint32_t)0x00010000) /*!< SPI 4 clock enable */
+#endif /* AT32F403Vx_HD || AT32F403Zx_HD || AT32F403Vx_XL || AT32F403Zx_XL
+ AT32F403Axx || AT32F407xx */
+
+#if !defined (AT32F413Kx_MD) && !defined (AT32F413Kx_HD) && \
+ !defined (AT32F415K8U7_4)&& !defined (AT32F415KBU7_4)&& \
+ !defined (AT32F415KCU7_4)
+ #define RCC_APB1EN_USART3EN ((uint32_t)0x00040000) /*!< USART 3 clock enable */
+#endif
+
+#if !defined (AT32F413Kx_MD) && !defined (AT32F413Kx_HD) && \
+ !defined (AT32F413Cx_MD) && !defined (AT32F413Cx_HD) && \
+ !defined (AT32FEBKCx_MD) && !defined (TS32F401CBU7) && \
+ !defined (AT32F415K8U7_4)&& !defined (AT32F415KBU7_4)&& \
+ !defined (AT32F415KCU7_4)&& !defined (AT32F415C8T7) && \
+ !defined (AT32F415CBT7) && !defined (AT32F415CCT7) && \
+ !defined (AT32F415CBU7) && !defined (AT32F415CCU7)
+ #define RCC_APB1EN_UART4EN ((uint32_t)0x00080000) /*!< UART 4 clock enable */
+ #define RCC_APB1EN_UART5EN ((uint32_t)0x00100000) /*!< UART 5 clock enable */
+#endif
+
+#if defined (AT32F413Cx_HD) || defined (AT32F413Cx_MD) || \
+ defined (AT32F413Rx_HD) || defined (AT32F413Rx_MD) || \
+ defined (TS32F401CBU7)
+ #define RCC_APB1EN_CAN2EN ((uint32_t)0x80000000) /*!< CAN2 enable */
+#elif defined (AT32F403Axx) || defined (AT32F407xx)
+ #define RCC_APB1EN_CAN2EN ((uint32_t)0x04000000) /*!< CAN2 enable */
+#endif
+
+#if defined (AT32F403xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+ #define RCC_APB1EN_TMR6EN ((uint32_t)0x00000010) /*!< Timer 6 clock enable */
+ #define RCC_APB1EN_TMR7EN ((uint32_t)0x00000020) /*!< Timer 7 clock enable */
+ #define RCC_APB1EN_SPI3EN ((uint32_t)0x00008000) /*!< SPI 3 clock enable */
+ #define RCC_APB1EN_I2C3EN ((uint32_t)0x04000000) /*!< I2C 3 clock enable */
+ #define RCC_APB1EN_TMR12EN ((uint32_t)0x00000040) /*!< TMR12 Timer clock enable */
+ #define RCC_APB1EN_TMR13EN ((uint32_t)0x00000080) /*!< TMR13 Timer clock enable */
+ #define RCC_APB1EN_TMR14EN ((uint32_t)0x00000100) /*!< TMR14 Timer clock enable */
+ #define RCC_APB1EN_DACEN ((uint32_t)0x20000000) /*!< DAC interface clock enable */
+#endif
+
+/******************* Bit definition for RCC_BDC register *******************/
+#if !defined (AT32F415xx)
+ #define RCC_BDC_LSEEN ((uint32_t)0x00000001) /*!< External Low Speed oscillator enable */
+ #define RCC_BDC_LSESTBL ((uint32_t)0x00000002) /*!< External Low Speed oscillator Ready */
+ #define RCC_BDC_LSEBYPS ((uint32_t)0x00000004) /*!< External Low Speed oscillator Bypass */
+
+ #define RCC_BDC_RTCSEL ((uint32_t)0x00000300) /*!< RTCSEL[1:0] bits (RTC clock source selection) */
+ #define RCC_BDC_RTCSEL_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+ #define RCC_BDC_RTCSEL_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+
+ /** RTC congiguration */
+ #define RCC_BDC_RTCSEL_NOCLK ((uint32_t)0x00000000) /*!< No clock */
+ #define RCC_BDC_RTCSEL_LSE ((uint32_t)0x00000100) /*!< LSE oscillator clock used as RTC clock */
+ #define RCC_BDC_RTCSEL_LSI ((uint32_t)0x00000200) /*!< LSI oscillator clock used as RTC clock */
+ #define RCC_BDC_RTCSEL_HSE_DIV128 ((uint32_t)0x00000300) /*!< HSE oscillator clock divided by 128 used as RTC clock */
+
+ #define RCC_BDC_RTCEN ((uint32_t)0x00008000) /*!< RTC clock enable */
+ #define RCC_BDC_BDRST ((uint32_t)0x00010000) /*!< Backup domain software reset */
+#else
+ #define RCC_BDC_LSEEN ((uint32_t)0x00000001) /*!< External Low Speed oscillator enable */
+ #define RCC_BDC_LSESTBL ((uint32_t)0x00000002) /*!< External Low Speed oscillator Ready */
+ #define RCC_BDC_LSEBYPS ((uint32_t)0x00000004) /*!< External Low Speed oscillator Bypass */
+
+ #define RCC_BDC_ERTCSEL ((uint32_t)0x00000300) /*!< ERTCSEL[1:0] bits (ERTC clock source selection) */
+ #define RCC_BDC_ERTCSEL_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+ #define RCC_BDC_ERTCSEL_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+
+ /** ERTC congiguration */
+ #define RCC_BDC_ERTCSEL_NOCLK ((uint32_t)0x00000000) /*!< No clock */
+ #define RCC_BDC_ERTCSEL_LSE ((uint32_t)0x00000100) /*!< LSE oscillator clock used as ERTC clock */
+ #define RCC_BDC_ERTCSEL_LSI ((uint32_t)0x00000200) /*!< LSI oscillator clock used as ERTC clock */
+ #define RCC_BDC_ERTCSEL_HSE_DIV128 ((uint32_t)0x00000300) /*!< HSE oscillator clock divided by 128 used as ERTC clock */
+
+ #define RCC_BDC_ERTCEN ((uint32_t)0x00008000) /*!< ERTC clock enable */
+ #define RCC_BDC_BDRST ((uint32_t)0x00010000) /*!< Backup domain software reset */
+#endif
+/******************* Bit definition for RCC_CTRLSTS register ********************/
+#define RCC_CTRLSTS_LSIEN ((uint32_t)0x00000001) /*!< Internal Low Speed oscillator enable */
+#define RCC_CTRLSTS_LSISTBL ((uint32_t)0x00000002) /*!< Internal Low Speed oscillator Ready */
+#define RCC_CTRLSTS_RSTFC ((uint32_t)0x01000000) /*!< Remove reset flag */
+#define RCC_CTRLSTS_PINRSTF ((uint32_t)0x04000000) /*!< PIN reset flag */
+#define RCC_CTRLSTS_PORSTF ((uint32_t)0x08000000) /*!< POR/PDR reset flag */
+#define RCC_CTRLSTS_SWRSTF ((uint32_t)0x10000000) /*!< Software Reset flag */
+#define RCC_CTRLSTS_IWDGRSTF ((uint32_t)0x20000000) /*!< Independent Watchdog reset flag */
+#define RCC_CTRLSTS_WWDGRSTF ((uint32_t)0x40000000) /*!< Window watchdog reset flag */
+#define RCC_CTRLSTS_LPRSTF ((uint32_t)0x80000000) /*!< Low-Power reset flag */
+
+/******************* Bit definition for RCC_AHBRST register ********************/
+#if defined (AT32F415xx)
+ #define RCC_AHBRST_USBRST ((uint32_t)0x00001000) /*!< USB reset */
+#endif /* AT32F415xx */
+
+#if defined (AT32F403Axx) || defined (AT32F407xx)
+ #define RCC_AHBRST_ETHMACRST ((uint32_t)0x00004000) /*!< ETHMAC reset */
+#endif /* AT32F43Axx || AT32F407 */
+
+/******************* Bit definition for RCC_PLL register ********************/
+#if defined (AT32F415xx)
+ #define RCC_PLL_PLLFR ((uint32_t)0x00000007) /*!< PLL FR Configuration Value */
+ #define RCC_PLL_PLLFR_0 ((uint32_t)0x00000000) /*!< PLL FR Configuration VCO */
+ #define RCC_PLL_PLLFR_2 ((uint32_t)0x00000001) /*!< PLL FR Configuration VCO/2 */
+ #define RCC_PLL_PLLFR_4 ((uint32_t)0x00000002) /*!< PLL FR Configuration VCO/4 */
+ #define RCC_PLL_PLLFR_8 ((uint32_t)0x00000003) /*!< PLL FR Configuration VCO/8 */
+ #define RCC_PLL_PLLFR_16 ((uint32_t)0x00000004) /*!< PLL FR Configuration VCO/16 */
+ #define RCC_PLL_PLLFR_32 ((uint32_t)0x00000005) /*!< PLL FR Configuration VCO/32 */
+ #define RCC_PLL_PLLMS ((uint32_t)0x000000F0) /*!< PLL MS Configuration Value */
+ #define RCC_PLL_PLLNS ((uint32_t)0x0001FF00) /*!< PLL NS Configuration Value */
+ #define RCC_PLL_PLLFREF ((uint32_t)0x07000000) /*!< PLL FREF Configuration Table */
+ #define RCC_PLL_PLLFREF_4M ((uint32_t)0x00000000) /*!< PLL FREF Configuration Table */
+ #define RCC_PLL_PLLFREF_6M ((uint32_t)0x01000000) /*!< PLL FREF Configuration Table */
+ #define RCC_PLL_PLLFREF_8M ((uint32_t)0x02000000) /*!< PLL FREF Configuration Table */
+ #define RCC_PLL_PLLFREF_12M ((uint32_t)0x03000000) /*!< PLL FREF Configuration Table */
+ #define RCC_PLL_PLLFREF_16M ((uint32_t)0x04000000) /*!< PLL FREF Configuration Table */
+ #define RCC_PLL_PLLFREF_25M ((uint32_t)0x05000000) /*!< PLL FREF Configuration Table */
+ #define RCC_PLL_PLLCFGEN ((uint32_t)0x80000000) /*!< PLL CFGEN Configuration enable */
+#endif /* AT32F415xx */
+
+/******************* Bit definition for RCC_MISC register ********************/
+#define RCC_MISC_HSICAL_KEY ((uint32_t)0x000000FF) /*!< HSICAL KEY */
+#define RCC_MISC_CLKOUT_3 ((uint32_t)0x00010000) /*!< CLKOUT Bit 3 */
+
+#if defined (AT32F403xx) || defined (AT32F413xx) || \
+ defined (AT32F403Axx)|| defined (AT32F407xx)
+ #define RCC_MISC_USB768B ((uint32_t)0x01000000) /*!< USB SRAM size */
+#endif /* AT32F403xx | AT32F413xx | AT32F403Axx | AT32F407xx */
+
+#if defined (AT32F413xx) || defined (AT32F403Axx) || \
+ defined (AT32F407xx)
+#define RCC_MISC_DIV_EN ((uint32_t)0x20000000) /*!< HSI48 Div 6 enable */
+#endif /* AT32F413xx | AT32F403Axx | AT32F407xx */
+
+#if !defined (AT32F403xx)
+ #define RCC_MISC_HSI_DIV_EN ((uint32_t)0x02000000) /*!< HSI DIV enable */
+ #define RCC_MISC_MCOPRE_MASK ((uint32_t)0xF0000000) /*!< MCO Divider Mask Value */
+ #define RCC_MISC_MCOPRE_1 ((uint32_t)0x10000000) /*!< MCO Div 1 Configure */
+ #define RCC_MISC_MCOPRE_2 ((uint32_t)0x80000000) /*!< MCO Div 2 Configure */
+ #define RCC_MISC_MCOPRE_4 ((uint32_t)0x90000000) /*!< MCO Div 4 Configure */
+ #define RCC_MISC_MCOPRE_8 ((uint32_t)0xA0000000) /*!< MCO Div 8 Configure */
+ #define RCC_MISC_MCOPRE_16 ((uint32_t)0xB0000000) /*!< MCO Div 16 Configure */
+ #define RCC_MISC_MCOPRE_64 ((uint32_t)0xC0000000) /*!< MCO Div 64 Configure */
+ #define RCC_MISC_MCOPRE_128 ((uint32_t)0xD0000000) /*!< MCO Div 128 Configure */
+ #define RCC_MISC_MCOPRE_256 ((uint32_t)0xE0000000) /*!< MCO Div 256 Configure */
+ #define RCC_MISC_MCOPRE_512 ((uint32_t)0xF0000000) /*!< MCO Div 512 Configure */
+#endif /* !AT32F403xx */
+
+/******************* Bit definition for RCC_TEST register ********************/
+#define RCC_TEST_MCO2TMR_EN ((uint32_t)0x00010000) /*!< CLKOUT to TMR10 Ch 0 */
+
+/******************* Bit definition for RCC_MISC2 register *******************/
+#define RCC_MISC2_AUTO_STEP_EN ((uint32_t)0x00000030) /*!< Auto Step Mode */
+#define RCC_MISC2_HSI_FOR_USB ((uint32_t)0x00000100) /*!< HSI48 for USB */
+#define RCC_MISC2_HSI_SYS_CTRL ((uint32_t)0x00000200) /*!< HSI48 for SYSCLK */
+
+#define RCC_MISC2_HSE_DIV_CTRL ((uint32_t)0x00003000) /*!< HSE Div */
+#define RCC_MISC2_HSE_DIV_CTRL_2 ((uint32_t)0x00000000) /*!< HSE Div 2 */
+#define RCC_MISC2_HSE_DIV_CTRL_3 ((uint32_t)0x00001000) /*!< HSE Div 3 */
+#define RCC_MISC2_HSE_DIV_CTRL_4 ((uint32_t)0x00002000) /*!< HSE Div 4 */
+#define RCC_MISC2_HSE_DIV_CTRL_5 ((uint32_t)0x00003000) /*!< HSE Div 5 */
+
+/***************** Bit definition for RCC_INTCTRL register *******************/
+#define RCC_INTCTRL_USB_INT_CTRL ((uint32_t)0x00000001) /*!< USB interrupt remap */
+
+/******************************************************************************/
+/* */
+/* General Purpose and Alternate Function I/O */
+/* */
+/******************************************************************************/
+
+/******************* Bit definition for GPIO_CTRLL register *******************/
+#define GPIO_CTRLL_MDE ((uint32_t)0x33333333) /*!< Port x mode bits */
+
+#define GPIO_CTRLL_MDE0 ((uint32_t)0x00000003) /*!< MODE0[1:0] bits (Port x mode bits, pin 0) */
+#define GPIO_CTRLL_MDE0_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define GPIO_CTRLL_MDE0_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+
+#define GPIO_CTRLL_MDE1 ((uint32_t)0x00000030) /*!< MODE1[1:0] bits (Port x mode bits, pin 1) */
+#define GPIO_CTRLL_MDE1_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define GPIO_CTRLL_MDE1_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+
+#define GPIO_CTRLL_MDE2 ((uint32_t)0x00000300) /*!< MODE2[1:0] bits (Port x mode bits, pin 2) */
+#define GPIO_CTRLL_MDE2_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define GPIO_CTRLL_MDE2_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+
+#define GPIO_CTRLL_MDE3 ((uint32_t)0x00003000) /*!< MODE3[1:0] bits (Port x mode bits, pin 3) */
+#define GPIO_CTRLL_MDE3_0 ((uint32_t)0x00001000) /*!< Bit 0 */
+#define GPIO_CTRLL_MDE3_1 ((uint32_t)0x00002000) /*!< Bit 1 */
+
+#define GPIO_CTRLL_MDE4 ((uint32_t)0x00030000) /*!< MODE4[1:0] bits (Port x mode bits, pin 4) */
+#define GPIO_CTRLL_MDE4_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define GPIO_CTRLL_MDE4_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+
+#define GPIO_CTRLL_MDE5 ((uint32_t)0x00300000) /*!< MODE5[1:0] bits (Port x mode bits, pin 5) */
+#define GPIO_CTRLL_MDE5_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define GPIO_CTRLL_MDE5_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+
+#define GPIO_CTRLL_MDE6 ((uint32_t)0x03000000) /*!< MODE6[1:0] bits (Port x mode bits, pin 6) */
+#define GPIO_CTRLL_MDE6_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define GPIO_CTRLL_MDE6_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+
+#define GPIO_CTRLL_MDE7 ((uint32_t)0x30000000) /*!< MODE7[1:0] bits (Port x mode bits, pin 7) */
+#define GPIO_CTRLL_MDE7_0 ((uint32_t)0x10000000) /*!< Bit 0 */
+#define GPIO_CTRLL_MDE7_1 ((uint32_t)0x20000000) /*!< Bit 1 */
+
+#define GPIO_CTRLL_CONF ((uint32_t)0xCCCCCCCC) /*!< Port x configuration bits */
+
+#define GPIO_CTRLL_CONF0 ((uint32_t)0x0000000C) /*!< CNF0[1:0] bits (Port x configuration bits, pin 0) */
+#define GPIO_CTRLL_CONF0_0 ((uint32_t)0x00000004) /*!< Bit 0 */
+#define GPIO_CTRLL_CONF0_1 ((uint32_t)0x00000008) /*!< Bit 1 */
+
+#define GPIO_CTRLL_CONF1 ((uint32_t)0x000000C0) /*!< CNF1[1:0] bits (Port x configuration bits, pin 1) */
+#define GPIO_CTRLL_CONF1_0 ((uint32_t)0x00000040) /*!< Bit 0 */
+#define GPIO_CTRLL_CONF1_1 ((uint32_t)0x00000080) /*!< Bit 1 */
+
+#define GPIO_CTRLL_CONF2 ((uint32_t)0x00000C00) /*!< CNF2[1:0] bits (Port x configuration bits, pin 2) */
+#define GPIO_CTRLL_CONF2_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define GPIO_CTRLL_CONF2_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+
+#define GPIO_CTRLL_CONF3 ((uint32_t)0x0000C000) /*!< CNF3[1:0] bits (Port x configuration bits, pin 3) */
+#define GPIO_CTRLL_CONF3_0 ((uint32_t)0x00004000) /*!< Bit 0 */
+#define GPIO_CTRLL_CONF3_1 ((uint32_t)0x00008000) /*!< Bit 1 */
+
+#define GPIO_CTRLL_CONF4 ((uint32_t)0x000C0000) /*!< CNF4[1:0] bits (Port x configuration bits, pin 4) */
+#define GPIO_CTRLL_CONF4_0 ((uint32_t)0x00040000) /*!< Bit 0 */
+#define GPIO_CTRLL_CONF4_1 ((uint32_t)0x00080000) /*!< Bit 1 */
+
+#define GPIO_CTRLL_CONF5 ((uint32_t)0x00C00000) /*!< CNF5[1:0] bits (Port x configuration bits, pin 5) */
+#define GPIO_CTRLL_CONF5_0 ((uint32_t)0x00400000) /*!< Bit 0 */
+#define GPIO_CTRLL_CONF5_1 ((uint32_t)0x00800000) /*!< Bit 1 */
+
+#define GPIO_CTRLL_CONF6 ((uint32_t)0x0C000000) /*!< CNF6[1:0] bits (Port x configuration bits, pin 6) */
+#define GPIO_CTRLL_CONF6_0 ((uint32_t)0x04000000) /*!< Bit 0 */
+#define GPIO_CTRLL_CONF6_1 ((uint32_t)0x08000000) /*!< Bit 1 */
+
+#define GPIO_CTRLL_CONF7 ((uint32_t)0xC0000000) /*!< CNF7[1:0] bits (Port x configuration bits, pin 7) */
+#define GPIO_CTRLL_CONF7_0 ((uint32_t)0x40000000) /*!< Bit 0 */
+#define GPIO_CTRLL_CONF7_1 ((uint32_t)0x80000000) /*!< Bit 1 */
+
+/******************* Bit definition for GPIO_CTRLH register *******************/
+#define GPIO_CTRLH_MDE ((uint32_t)0x33333333) /*!< Port x mode bits */
+
+#define GPIO_CTRLH_MDE8 ((uint32_t)0x00000003) /*!< MODE8[1:0] bits (Port x mode bits, pin 8) */
+#define GPIO_CTRLH_MDE8_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define GPIO_CTRLH_MDE8_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+
+#define GPIO_CTRLH_MDE9 ((uint32_t)0x00000030) /*!< MODE9[1:0] bits (Port x mode bits, pin 9) */
+#define GPIO_CTRLH_MDE9_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define GPIO_CTRLH_MDE9_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+
+#define GPIO_CTRLH_MDE10 ((uint32_t)0x00000300) /*!< MODE10[1:0] bits (Port x mode bits, pin 10) */
+#define GPIO_CTRLH_MDE10_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define GPIO_CTRLH_MDE10_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+
+#define GPIO_CTRLH_MDE11 ((uint32_t)0x00003000) /*!< MODE11[1:0] bits (Port x mode bits, pin 11) */
+#define GPIO_CTRLH_MDE11_0 ((uint32_t)0x00001000) /*!< Bit 0 */
+#define GPIO_CTRLH_MDE11_1 ((uint32_t)0x00002000) /*!< Bit 1 */
+
+#define GPIO_CTRLH_MDE12 ((uint32_t)0x00030000) /*!< MODE12[1:0] bits (Port x mode bits, pin 12) */
+#define GPIO_CTRLH_MDE12_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define GPIO_CTRLH_MDE12_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+
+#define GPIO_CTRLH_MDE13 ((uint32_t)0x00300000) /*!< MODE13[1:0] bits (Port x mode bits, pin 13) */
+#define GPIO_CTRLH_MDE13_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define GPIO_CTRLH_MDE13_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+
+#define GPIO_CTRLH_MDE14 ((uint32_t)0x03000000) /*!< MODE14[1:0] bits (Port x mode bits, pin 14) */
+#define GPIO_CTRLH_MDE14_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define GPIO_CTRLH_MDE14_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+
+#define GPIO_CTRLH_MDE15 ((uint32_t)0x30000000) /*!< MODE15[1:0] bits (Port x mode bits, pin 15) */
+#define GPIO_CTRLH_MDE15_0 ((uint32_t)0x10000000) /*!< Bit 0 */
+#define GPIO_CTRLH_MDE15_1 ((uint32_t)0x20000000) /*!< Bit 1 */
+
+#define GPIO_CTRLH_CONF ((uint32_t)0xCCCCCCCC) /*!< Port x configuration bits */
+
+#define GPIO_CTRLH_CONF8 ((uint32_t)0x0000000C) /*!< CNF8[1:0] bits (Port x configuration bits, pin 8) */
+#define GPIO_CTRLH_CONF8_0 ((uint32_t)0x00000004) /*!< Bit 0 */
+#define GPIO_CTRLH_CONF8_1 ((uint32_t)0x00000008) /*!< Bit 1 */
+
+#define GPIO_CTRLH_CONF9 ((uint32_t)0x000000C0) /*!< CNF9[1:0] bits (Port x configuration bits, pin 9) */
+#define GPIO_CTRLH_CONF9_0 ((uint32_t)0x00000040) /*!< Bit 0 */
+#define GPIO_CTRLH_CONF9_1 ((uint32_t)0x00000080) /*!< Bit 1 */
+
+#define GPIO_CTRLH_CONF10 ((uint32_t)0x00000C00) /*!< CNF10[1:0] bits (Port x configuration bits, pin 10) */
+#define GPIO_CTRLH_CONF10_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define GPIO_CTRLH_CONF10_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+
+#define GPIO_CTRLH_CONF11 ((uint32_t)0x0000C000) /*!< CNF11[1:0] bits (Port x configuration bits, pin 11) */
+#define GPIO_CTRLH_CONF11_0 ((uint32_t)0x00004000) /*!< Bit 0 */
+#define GPIO_CTRLH_CONF11_1 ((uint32_t)0x00008000) /*!< Bit 1 */
+
+#define GPIO_CTRLH_CONF12 ((uint32_t)0x000C0000) /*!< CNF12[1:0] bits (Port x configuration bits, pin 12) */
+#define GPIO_CTRLH_CONF12_0 ((uint32_t)0x00040000) /*!< Bit 0 */
+#define GPIO_CTRLH_CONF12_1 ((uint32_t)0x00080000) /*!< Bit 1 */
+
+#define GPIO_CTRLH_CONF13 ((uint32_t)0x00C00000) /*!< CNF13[1:0] bits (Port x configuration bits, pin 13) */
+#define GPIO_CTRLH_CONF13_0 ((uint32_t)0x00400000) /*!< Bit 0 */
+#define GPIO_CTRLH_CONF13_1 ((uint32_t)0x00800000) /*!< Bit 1 */
+
+#define GPIO_CTRLH_CONF14 ((uint32_t)0x0C000000) /*!< CNF14[1:0] bits (Port x configuration bits, pin 14) */
+#define GPIO_CTRLH_CONF14_0 ((uint32_t)0x04000000) /*!< Bit 0 */
+#define GPIO_CTRLH_CONF14_1 ((uint32_t)0x08000000) /*!< Bit 1 */
+
+#define GPIO_CTRLH_CONF15 ((uint32_t)0xC0000000) /*!< CNF15[1:0] bits (Port x configuration bits, pin 15) */
+#define GPIO_CTRLH_CONF15_0 ((uint32_t)0x40000000) /*!< Bit 0 */
+#define GPIO_CTRLH_CONF15_1 ((uint32_t)0x80000000) /*!< Bit 1 */
+
+/******************** Bit definition for GPIO_IPTDT register *******************/
+#define GPIO_IPTDT_IPTDT0 ((uint16_t)0x0001) /*!< Port input data, bit 0 */
+#define GPIO_IPTDT_IPTDT1 ((uint16_t)0x0002) /*!< Port input data, bit 1 */
+#define GPIO_IPTDT_IPTDT2 ((uint16_t)0x0004) /*!< Port input data, bit 2 */
+#define GPIO_IPTDT_IPTDT3 ((uint16_t)0x0008) /*!< Port input data, bit 3 */
+#define GPIO_IPTDT_IPTDT4 ((uint16_t)0x0010) /*!< Port input data, bit 4 */
+#define GPIO_IPTDT_IPTDT5 ((uint16_t)0x0020) /*!< Port input data, bit 5 */
+#define GPIO_IPTDT_IPTDT6 ((uint16_t)0x0040) /*!< Port input data, bit 6 */
+#define GPIO_IPTDT_IPTDT7 ((uint16_t)0x0080) /*!< Port input data, bit 7 */
+#define GPIO_IPTDT_IPTDT8 ((uint16_t)0x0100) /*!< Port input data, bit 8 */
+#define GPIO_IPTDT_IPTDT9 ((uint16_t)0x0200) /*!< Port input data, bit 9 */
+#define GPIO_IPTDT_IPTDT10 ((uint16_t)0x0400) /*!< Port input data, bit 10 */
+#define GPIO_IPTDT_IPTDT11 ((uint16_t)0x0800) /*!< Port input data, bit 11 */
+#define GPIO_IPTDT_IPTDT12 ((uint16_t)0x1000) /*!< Port input data, bit 12 */
+#define GPIO_IPTDT_IPTDT13 ((uint16_t)0x2000) /*!< Port input data, bit 13 */
+#define GPIO_IPTDT_IPTDT14 ((uint16_t)0x4000) /*!< Port input data, bit 14 */
+#define GPIO_IPTDT_IPTDT15 ((uint16_t)0x8000) /*!< Port input data, bit 15 */
+
+/******************* Bit definition for GPIO_OPTDT register *******************/
+#define GPIO_OPTDT_OPTDT0 ((uint16_t)0x0001) /*!< Port output data, bit 0 */
+#define GPIO_OPTDT_OPTDT1 ((uint16_t)0x0002) /*!< Port output data, bit 1 */
+#define GPIO_OPTDT_OPTDT2 ((uint16_t)0x0004) /*!< Port output data, bit 2 */
+#define GPIO_OPTDT_OPTDT3 ((uint16_t)0x0008) /*!< Port output data, bit 3 */
+#define GPIO_OPTDT_OPTDT4 ((uint16_t)0x0010) /*!< Port output data, bit 4 */
+#define GPIO_OPTDT_OPTDT5 ((uint16_t)0x0020) /*!< Port output data, bit 5 */
+#define GPIO_OPTDT_OPTDT6 ((uint16_t)0x0040) /*!< Port output data, bit 6 */
+#define GPIO_OPTDT_OPTDT7 ((uint16_t)0x0080) /*!< Port output data, bit 7 */
+#define GPIO_OPTDT_OPTDT8 ((uint16_t)0x0100) /*!< Port output data, bit 8 */
+#define GPIO_OPTDT_OPTDT9 ((uint16_t)0x0200) /*!< Port output data, bit 9 */
+#define GPIO_OPTDT_OPTDT10 ((uint16_t)0x0400) /*!< Port output data, bit 10 */
+#define GPIO_OPTDT_OPTDT11 ((uint16_t)0x0800) /*!< Port output data, bit 11 */
+#define GPIO_OPTDT_OPTDT12 ((uint16_t)0x1000) /*!< Port output data, bit 12 */
+#define GPIO_OPTDT_OPTDT13 ((uint16_t)0x2000) /*!< Port output data, bit 13 */
+#define GPIO_OPTDT_OPTDT14 ((uint16_t)0x4000) /*!< Port output data, bit 14 */
+#define GPIO_OPTDT_OPTDT15 ((uint16_t)0x8000) /*!< Port output data, bit 15 */
+
+/****************** Bit definition for GPIO_BSRE register *******************/
+#define GPIO_BSRE_BST0 ((uint32_t)0x00000001) /*!< Port x Set bit 0 */
+#define GPIO_BSRE_BST1 ((uint32_t)0x00000002) /*!< Port x Set bit 1 */
+#define GPIO_BSRE_BST2 ((uint32_t)0x00000004) /*!< Port x Set bit 2 */
+#define GPIO_BSRE_BST3 ((uint32_t)0x00000008) /*!< Port x Set bit 3 */
+#define GPIO_BSRE_BST4 ((uint32_t)0x00000010) /*!< Port x Set bit 4 */
+#define GPIO_BSRE_BST5 ((uint32_t)0x00000020) /*!< Port x Set bit 5 */
+#define GPIO_BSRE_BST6 ((uint32_t)0x00000040) /*!< Port x Set bit 6 */
+#define GPIO_BSRE_BST7 ((uint32_t)0x00000080) /*!< Port x Set bit 7 */
+#define GPIO_BSRE_BST8 ((uint32_t)0x00000100) /*!< Port x Set bit 8 */
+#define GPIO_BSRE_BST9 ((uint32_t)0x00000200) /*!< Port x Set bit 9 */
+#define GPIO_BSRE_BST10 ((uint32_t)0x00000400) /*!< Port x Set bit 10 */
+#define GPIO_BSRE_BST11 ((uint32_t)0x00000800) /*!< Port x Set bit 11 */
+#define GPIO_BSRE_BST12 ((uint32_t)0x00001000) /*!< Port x Set bit 12 */
+#define GPIO_BSRE_BST13 ((uint32_t)0x00002000) /*!< Port x Set bit 13 */
+#define GPIO_BSRE_BST14 ((uint32_t)0x00004000) /*!< Port x Set bit 14 */
+#define GPIO_BSRE_BST15 ((uint32_t)0x00008000) /*!< Port x Set bit 15 */
+
+#define GPIO_BSRE_BRE0 ((uint32_t)0x00010000) /*!< Port x Reset bit 0 */
+#define GPIO_BSRE_BRE1 ((uint32_t)0x00020000) /*!< Port x Reset bit 1 */
+#define GPIO_BSRE_BRE2 ((uint32_t)0x00040000) /*!< Port x Reset bit 2 */
+#define GPIO_BSRE_BRE3 ((uint32_t)0x00080000) /*!< Port x Reset bit 3 */
+#define GPIO_BSRE_BRE4 ((uint32_t)0x00100000) /*!< Port x Reset bit 4 */
+#define GPIO_BSRE_BRE5 ((uint32_t)0x00200000) /*!< Port x Reset bit 5 */
+#define GPIO_BSRE_BRE6 ((uint32_t)0x00400000) /*!< Port x Reset bit 6 */
+#define GPIO_BSRE_BRE7 ((uint32_t)0x00800000) /*!< Port x Reset bit 7 */
+#define GPIO_BSRE_BRE8 ((uint32_t)0x01000000) /*!< Port x Reset bit 8 */
+#define GPIO_BSRE_BRE9 ((uint32_t)0x02000000) /*!< Port x Reset bit 9 */
+#define GPIO_BSRE_BRE10 ((uint32_t)0x04000000) /*!< Port x Reset bit 10 */
+#define GPIO_BSRE_BRE11 ((uint32_t)0x08000000) /*!< Port x Reset bit 11 */
+#define GPIO_BSRE_BRE12 ((uint32_t)0x10000000) /*!< Port x Reset bit 12 */
+#define GPIO_BSRE_BRE13 ((uint32_t)0x20000000) /*!< Port x Reset bit 13 */
+#define GPIO_BSRE_BRE14 ((uint32_t)0x40000000) /*!< Port x Reset bit 14 */
+#define GPIO_BSRE_BRE15 ((uint32_t)0x80000000) /*!< Port x Reset bit 15 */
+
+/******************* Bit definition for GPIO_BRE register *******************/
+#define GPIO_BRE_BRE0 ((uint16_t)0x0001) /*!< Port x Reset bit 0 */
+#define GPIO_BRE_BRE1 ((uint16_t)0x0002) /*!< Port x Reset bit 1 */
+#define GPIO_BRE_BRE2 ((uint16_t)0x0004) /*!< Port x Reset bit 2 */
+#define GPIO_BRE_BRE3 ((uint16_t)0x0008) /*!< Port x Reset bit 3 */
+#define GPIO_BRE_BRE4 ((uint16_t)0x0010) /*!< Port x Reset bit 4 */
+#define GPIO_BRE_BRE5 ((uint16_t)0x0020) /*!< Port x Reset bit 5 */
+#define GPIO_BRE_BRE6 ((uint16_t)0x0040) /*!< Port x Reset bit 6 */
+#define GPIO_BRE_BRE7 ((uint16_t)0x0080) /*!< Port x Reset bit 7 */
+#define GPIO_BRE_BRE8 ((uint16_t)0x0100) /*!< Port x Reset bit 8 */
+#define GPIO_BRE_BRE9 ((uint16_t)0x0200) /*!< Port x Reset bit 9 */
+#define GPIO_BRE_BRE10 ((uint16_t)0x0400) /*!< Port x Reset bit 10 */
+#define GPIO_BRE_BRE11 ((uint16_t)0x0800) /*!< Port x Reset bit 11 */
+#define GPIO_BRE_BRE12 ((uint16_t)0x1000) /*!< Port x Reset bit 12 */
+#define GPIO_BRE_BRE13 ((uint16_t)0x2000) /*!< Port x Reset bit 13 */
+#define GPIO_BRE_BRE14 ((uint16_t)0x4000) /*!< Port x Reset bit 14 */
+#define GPIO_BRE_BRE15 ((uint16_t)0x8000) /*!< Port x Reset bit 15 */
+
+/****************** Bit definition for GPIO_LOCK register *******************/
+#define GPIO_LOCK_LOCK0 ((uint32_t)0x00000001) /*!< Port x Lock bit 0 */
+#define GPIO_LOCK_LOCK1 ((uint32_t)0x00000002) /*!< Port x Lock bit 1 */
+#define GPIO_LOCK_LOCK2 ((uint32_t)0x00000004) /*!< Port x Lock bit 2 */
+#define GPIO_LOCK_LOCK3 ((uint32_t)0x00000008) /*!< Port x Lock bit 3 */
+#define GPIO_LOCK_LOCK4 ((uint32_t)0x00000010) /*!< Port x Lock bit 4 */
+#define GPIO_LOCK_LOCK5 ((uint32_t)0x00000020) /*!< Port x Lock bit 5 */
+#define GPIO_LOCK_LOCK6 ((uint32_t)0x00000040) /*!< Port x Lock bit 6 */
+#define GPIO_LOCK_LOCK7 ((uint32_t)0x00000080) /*!< Port x Lock bit 7 */
+#define GPIO_LOCK_LOCK8 ((uint32_t)0x00000100) /*!< Port x Lock bit 8 */
+#define GPIO_LOCK_LOCK9 ((uint32_t)0x00000200) /*!< Port x Lock bit 9 */
+#define GPIO_LOCK_LOCK10 ((uint32_t)0x00000400) /*!< Port x Lock bit 10 */
+#define GPIO_LOCK_LOCK11 ((uint32_t)0x00000800) /*!< Port x Lock bit 11 */
+#define GPIO_LOCK_LOCK12 ((uint32_t)0x00001000) /*!< Port x Lock bit 12 */
+#define GPIO_LOCK_LOCK13 ((uint32_t)0x00002000) /*!< Port x Lock bit 13 */
+#define GPIO_LOCK_LOCK14 ((uint32_t)0x00004000) /*!< Port x Lock bit 14 */
+#define GPIO_LOCK_LOCK15 ((uint32_t)0x00008000) /*!< Port x Lock bit 15 */
+#define GPIO_LOCK_LOCKK ((uint32_t)0x00010000) /*!< Lock key */
+
+/*----------------------------------------------------------------------------*/
+
+/****************** Bit definition for AFIO_EVCTRL register *******************/
+#define AFIO_EVCTRL_PIN ((uint8_t)0x0F) /*!< PIN[3:0] bits (Pin selection) */
+#define AFIO_EVCTRL_PIN_B0 ((uint8_t)0x01) /*!< Bit 0 */
+#define AFIO_EVCTRL_PIN_B1 ((uint8_t)0x02) /*!< Bit 1 */
+#define AFIO_EVCTRL_PIN_B2 ((uint8_t)0x04) /*!< Bit 2 */
+#define AFIO_EVCTRL_PIN_B3 ((uint8_t)0x08) /*!< Bit 3 */
+
+/** PIN configuration */
+#define AFIO_EVCTRL_PIN_PN0 ((uint8_t)0x00) /*!< Pin 0 selected */
+#define AFIO_EVCTRL_PIN_PN1 ((uint8_t)0x01) /*!< Pin 1 selected */
+#define AFIO_EVCTRL_PIN_PN2 ((uint8_t)0x02) /*!< Pin 2 selected */
+#define AFIO_EVCTRL_PIN_PN3 ((uint8_t)0x03) /*!< Pin 3 selected */
+#define AFIO_EVCTRL_PIN_PN4 ((uint8_t)0x04) /*!< Pin 4 selected */
+#define AFIO_EVCTRL_PIN_PN5 ((uint8_t)0x05) /*!< Pin 5 selected */
+#define AFIO_EVCTRL_PIN_PN6 ((uint8_t)0x06) /*!< Pin 6 selected */
+#define AFIO_EVCTRL_PIN_PN7 ((uint8_t)0x07) /*!< Pin 7 selected */
+#define AFIO_EVCTRL_PIN_PN8 ((uint8_t)0x08) /*!< Pin 8 selected */
+#define AFIO_EVCTRL_PIN_PN9 ((uint8_t)0x09) /*!< Pin 9 selected */
+#define AFIO_EVCTRL_PIN_PN10 ((uint8_t)0x0A) /*!< Pin 10 selected */
+#define AFIO_EVCTRL_PIN_PN11 ((uint8_t)0x0B) /*!< Pin 11 selected */
+#define AFIO_EVCTRL_PIN_PN12 ((uint8_t)0x0C) /*!< Pin 12 selected */
+#define AFIO_EVCTRL_PIN_PN13 ((uint8_t)0x0D) /*!< Pin 13 selected */
+#define AFIO_EVCTRL_PIN_PN14 ((uint8_t)0x0E) /*!< Pin 14 selected */
+#define AFIO_EVCTRL_PIN_PN15 ((uint8_t)0x0F) /*!< Pin 15 selected */
+
+#define AFIO_EVCTRL_PORT ((uint8_t)0x70) /*!< PORT[2:0] bits (Port selection) */
+#define AFIO_EVCTRL_PORT_B0 ((uint8_t)0x10) /*!< Bit 0 */
+#define AFIO_EVCTRL_PORT_B1 ((uint8_t)0x20) /*!< Bit 1 */
+#define AFIO_EVCTRL_PORT_B2 ((uint8_t)0x40) /*!< Bit 2 */
+
+/** PORT configuration */
+#define AFIO_EVCTRL_PORT_PTA ((uint8_t)0x00) /*!< Port A selected */
+#define AFIO_EVCTRL_PORT_PTB ((uint8_t)0x10) /*!< Port B selected */
+#define AFIO_EVCTRL_PORT_PTC ((uint8_t)0x20) /*!< Port C selected */
+#define AFIO_EVCTRL_PORT_PTD ((uint8_t)0x30) /*!< Port D selected */
+#define AFIO_EVCTRL_PORT_PTE ((uint8_t)0x40) /*!< Port E selected */
+
+#define AFIO_EVCTRL_EVOEN ((uint8_t)0x80) /*!< Event Output Enable */
+
+/****************** Bit definition for AFIO_MAP register *******************/
+#define AFIO_MAP_SPI1_REMAP ((uint32_t)0x00000001) /*!< SPI1 remapping */
+#define AFIO_MAP_I2C1_REMAP ((uint32_t)0x00000002) /*!< I2C1 remapping */
+#define AFIO_MAP_USART1_REMAP ((uint32_t)0x00000004) /*!< USART1 remapping */
+#define AFIO_MAP_USART2_REMAP ((uint32_t)0x00000008) /*!< USART2 remapping */
+
+#define AFIO_MAP_USART3_REMAP ((uint32_t)0x00000030) /*!< USART3_REMAP[1:0] bits (USART3 remapping) */
+#define AFIO_MAP_USART3_REMAP_B0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define AFIO_MAP_USART3_REMAP_B1 ((uint32_t)0x00000020) /*!< Bit 1 */
+
+/** USART3_REMAP configuration */
+#define AFIO_MAP_USART3_REMAP_NONEREMAP ((uint32_t)0x00000000) /*!< No remap (TX/PB10, RX/PB11, CK/PB12, CTS/PB13, RTS/PB14) */
+#define AFIO_MAP_USART3_REMAP_PARTIALREMAP ((uint32_t)0x00000010) /*!< Partial remap (TX/PC10, RX/PC11, CK/PC12, CTS/PB13, RTS/PB14) */
+#define AFIO_MAP_USART3_REMAP_FULLREMAP ((uint32_t)0x00000030) /*!< Full remap (TX/PD8, RX/PD9, CK/PD10, CTS/PD11, RTS/PD12) */
+
+#define AFIO_MAP_TMR1_REMAP ((uint32_t)0x000000C0) /*!< TMR1_REMAP[1:0] bits (TMR1 remapping) */
+#define AFIO_MAP_TMR1_REMAP_B0 ((uint32_t)0x00000040) /*!< Bit 0 */
+#define AFIO_MAP_TMR1_REMAP_B1 ((uint32_t)0x00000080) /*!< Bit 1 */
+
+/** TMR1_REMAP configuration */
+#define AFIO_MAP_TMR1_REMAP_NONEREMAP ((uint32_t)0x00000000) /*!< No remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PB12, CH1N/PB13, CH2N/PB14, CH3N/PB15) */
+#define AFIO_MAP_TMR1_REMAP_PARTIALREMAP ((uint32_t)0x00000040) /*!< Partial remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PA6, CH1N/PA7, CH2N/PB0, CH3N/PB1) */
+#define AFIO_MAP_TMR1_REMAP_FULLREMAP ((uint32_t)0x000000C0) /*!< Full remap (ETR/PE7, CH1/PE9, CH2/PE11, CH3/PE13, CH4/PE14, BKIN/PE15, CH1N/PE8, CH2N/PE10, CH3N/PE12) */
+
+#define AFIO_MAP_TMR2_REMAP ((uint32_t)0x00000300) /*!< TMR2_REMAP[1:0] bits (TMR2 remapping) */
+#define AFIO_MAP_TMR2_REMAP_B0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define AFIO_MAP_TMR2_REMAP_B1 ((uint32_t)0x00000200) /*!< Bit 1 */
+
+/** TMR2_REMAP configuration */
+#define AFIO_MAP_TMR2_REMAP_NONEREMAP ((uint32_t)0x00000000) /*!< No remap (CH1/ETR/PA0, CH2/PA1, CH3/PA2, CH4/PA3) */
+#define AFIO_MAP_TMR2_REMAP_PARTIALREMAP1 ((uint32_t)0x00000100) /*!< Partial remap (CH1/ETR/PA15, CH2/PB3, CH3/PA2, CH4/PA3) */
+#define AFIO_MAP_TMR2_REMAP_PARTIALREMAP2 ((uint32_t)0x00000200) /*!< Partial remap (CH1/ETR/PA0, CH2/PA1, CH3/PB10, CH4/PB11) */
+#define AFIO_MAP_TMR2_REMAP_FULLREMAP ((uint32_t)0x00000300) /*!< Full remap (CH1/ETR/PA15, CH2/PB3, CH3/PB10, CH4/PB11) */
+
+#define AFIO_MAP_TMR3_REMAP ((uint32_t)0x00000C00) /*!< TMR3_REMAP[1:0] bits (TMR3 remapping) */
+#define AFIO_MAP_TMR3_REMAP_B0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define AFIO_MAP_TMR3_REMAP_B1 ((uint32_t)0x00000800) /*!< Bit 1 */
+
+/** TMR3_REMAP configuration */
+#define AFIO_MAP_TMR3_REMAP_NONEREMAP ((uint32_t)0x00000000) /*!< No remap (CH1/PA6, CH2/PA7, CH3/PB0, CH4/PB1) */
+#define AFIO_MAP_TMR3_REMAP_PARTIALREMAP ((uint32_t)0x00000800) /*!< Partial remap (CH1/PB4, CH2/PB5, CH3/PB0, CH4/PB1) */
+#define AFIO_MAP_TMR3_REMAP_FULLREMAP ((uint32_t)0x00000C00) /*!< Full remap (CH1/PC6, CH2/PC7, CH3/PC8, CH4/PC9) */
+
+#define AFIO_MAP_TMR4_REMAP ((uint32_t)0x00001000) /*!< TMR4_REMAP bit (TMR4 remapping) */
+
+#define AFIO_MAP_CAN_REMAP ((uint32_t)0x00006000) /*!< CAN_REMAP[1:0] bits (CAN Alternate function remapping) */
+#define AFIO_MAP_CAN_REMAP_B0 ((uint32_t)0x00002000) /*!< Bit 0 */
+#define AFIO_MAP_CAN_REMAP_B1 ((uint32_t)0x00004000) /*!< Bit 1 */
+
+/** CAN_REMAP configuration */
+#define AFIO_MAP_CAN_REMAP_RE1 ((uint32_t)0x00000000) /*!< CANRX mapped to PA11, CANTX mapped to PA12 */
+#define AFIO_MAP_CAN_REMAP_RE2 ((uint32_t)0x00004000) /*!< CANRX mapped to PB8, CANTX mapped to PB9 */
+#define AFIO_MAP_CAN_REMAP_RE3 ((uint32_t)0x00006000) /*!< CANRX mapped to PD0, CANTX mapped to PD1 */
+
+#define AFIO_MAP_PTD01_REMAP ((uint32_t)0x00008000) /*!< Port D0/Port D1 mapping on OSC_IN/OSC_OUT */
+#define AFIO_MAP_TMR5CH4_INTLRE ((uint32_t)0x00010000) /*!< TMR5 Channel4 Internal Remap */
+#define AFIO_MAP_ADC1_EXTRGINJ_REMAP ((uint32_t)0x00020000) /*!< ADC 1 External Trigger Injected Conversion remapping */
+#define AFIO_MAP_ADC1_EXTRGREG_REMAP ((uint32_t)0x00040000) /*!< ADC 1 External Trigger Regular Conversion remapping */
+#define AFIO_MAP_ADC2_EXTRGINJ_REMAP ((uint32_t)0x00080000) /*!< ADC 2 External Trigger Injected Conversion remapping */
+#define AFIO_MAP_ADC2_EXTRGREG_REMAP ((uint32_t)0x00100000) /*!< ADC 2 External Trigger Regular Conversion remapping */
+
+/** SWJ_CFG configuration */
+#define AFIO_MAP_SWJTAG_CONF ((uint32_t)0x07000000) /*!< SWJ_CFG[2:0] bits (Serial Wire JTAG configuration) */
+#define AFIO_MAP_SWJTAG_CONF_B0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define AFIO_MAP_SWJTAG_CONF_B1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define AFIO_MAP_SWJTAG_CONF_B2 ((uint32_t)0x04000000) /*!< Bit 2 */
+
+#define AFIO_MAP_SWJTAG_CONF_FULL ((uint32_t)0x00000000) /*!< Full SWJ (JTAG-DP + SW-DP) : Reset State */
+#define AFIO_MAP_SWJTAG_CONF_NOJNTRST ((uint32_t)0x01000000) /*!< Full SWJ (JTAG-DP + SW-DP) but without JNTRST */
+#define AFIO_MAP_SWJTAG_CONF_JTAGDISABLE ((uint32_t)0x02000000) /*!< JTAG-DP Disabled and SW-DP Enabled */
+#define AFIO_MAP_SWJTAG_CONF_ALLDISABLE ((uint32_t)0x04000000) /*!< JTAG-DP Disabled and SW-DP Disabled */
+
+/***************** Bit definition for AFIO_EXTIC1 register *****************/
+#define AFIO_EXTIC1_EXTINT0 ((uint16_t)0x000F) /*!< EXTI 0 configuration */
+#define AFIO_EXTIC1_EXTINT1 ((uint16_t)0x00F0) /*!< EXTI 1 configuration */
+#define AFIO_EXTIC1_EXTINT2 ((uint16_t)0x0F00) /*!< EXTI 2 configuration */
+#define AFIO_EXTIC1_EXTINT3 ((uint16_t)0xF000) /*!< EXTI 3 configuration */
+
+/** EXTI0 configuration */
+#define AFIO_EXTIC1_EXTINT0_PTA ((uint16_t)0x0000) /*!< PA[0] pin */
+#define AFIO_EXTIC1_EXTINT0_PTB ((uint16_t)0x0001) /*!< PB[0] pin */
+#define AFIO_EXTIC1_EXTINT0_PTC ((uint16_t)0x0002) /*!< PC[0] pin */
+#define AFIO_EXTIC1_EXTINT0_PTD ((uint16_t)0x0003) /*!< PD[0] pin */
+#define AFIO_EXTIC1_EXTINT0_PTE ((uint16_t)0x0004) /*!< PE[0] pin */
+#define AFIO_EXTIC1_EXTINT0_PTF ((uint16_t)0x0005) /*!< PF[0] pin */
+#define AFIO_EXTIC1_EXTINT0_PTG ((uint16_t)0x0006) /*!< PG[0] pin */
+
+/** EXTI1 configuration */
+#define AFIO_EXTIC1_EXTINT1_PTA ((uint16_t)0x0000) /*!< PA[1] pin */
+#define AFIO_EXTIC1_EXTINT1_PTB ((uint16_t)0x0010) /*!< PB[1] pin */
+#define AFIO_EXTIC1_EXTINT1_PTC ((uint16_t)0x0020) /*!< PC[1] pin */
+#define AFIO_EXTIC1_EXTINT1_PTD ((uint16_t)0x0030) /*!< PD[1] pin */
+#define AFIO_EXTIC1_EXTINT1_PTE ((uint16_t)0x0040) /*!< PE[1] pin */
+#define AFIO_EXTIC1_EXTINT1_PTF ((uint16_t)0x0050) /*!< PF[1] pin */
+#define AFIO_EXTIC1_EXTINT1_PTG ((uint16_t)0x0060) /*!< PG[1] pin */
+
+/** EXTI2 configuration */
+#define AFIO_EXTIC1_EXTINT2_PTA ((uint16_t)0x0000) /*!< PA[2] pin */
+#define AFIO_EXTIC1_EXTINT2_PTB ((uint16_t)0x0100) /*!< PB[2] pin */
+#define AFIO_EXTIC1_EXTINT2_PTC ((uint16_t)0x0200) /*!< PC[2] pin */
+#define AFIO_EXTIC1_EXTINT2_PTD ((uint16_t)0x0300) /*!< PD[2] pin */
+#define AFIO_EXTIC1_EXTINT2_PTE ((uint16_t)0x0400) /*!< PE[2] pin */
+#define AFIO_EXTIC1_EXTINT2_PTF ((uint16_t)0x0500) /*!< PF[2] pin */
+#define AFIO_EXTIC1_EXTINT2_PTG ((uint16_t)0x0600) /*!< PG[2] pin */
+
+/** EXTI3 configuration */
+#define AFIO_EXTIC1_EXTINT3_PTA ((uint16_t)0x0000) /*!< PA[3] pin */
+#define AFIO_EXTIC1_EXTINT3_PTB ((uint16_t)0x1000) /*!< PB[3] pin */
+#define AFIO_EXTIC1_EXTINT3_PTC ((uint16_t)0x2000) /*!< PC[3] pin */
+#define AFIO_EXTIC1_EXTINT3_PTD ((uint16_t)0x3000) /*!< PD[3] pin */
+#define AFIO_EXTIC1_EXTINT3_PTE ((uint16_t)0x4000) /*!< PE[3] pin */
+#define AFIO_EXTIC1_EXTINT3_PTF ((uint16_t)0x5000) /*!< PF[3] pin */
+#define AFIO_EXTIC1_EXTINT3_PTG ((uint16_t)0x6000) /*!< PG[3] pin */
+
+/***************** Bit definition for AFIO_EXTIC2 register *****************/
+#define AFIO_EXTIC2_EXTINT4 ((uint16_t)0x000F) /*!< EXTI 4 configuration */
+#define AFIO_EXTIC2_EXTINT5 ((uint16_t)0x00F0) /*!< EXTI 5 configuration */
+#define AFIO_EXTIC2_EXTINT6 ((uint16_t)0x0F00) /*!< EXTI 6 configuration */
+#define AFIO_EXTIC2_EXTINT7 ((uint16_t)0xF000) /*!< EXTI 7 configuration */
+
+/** EXTI4 configuration */
+#define AFIO_EXTIC2_EXTINT4_PTA ((uint16_t)0x0000) /*!< PA[4] pin */
+#define AFIO_EXTIC2_EXTINT4_PTB ((uint16_t)0x0001) /*!< PB[4] pin */
+#define AFIO_EXTIC2_EXTINT4_PTC ((uint16_t)0x0002) /*!< PC[4] pin */
+#define AFIO_EXTIC2_EXTINT4_PTD ((uint16_t)0x0003) /*!< PD[4] pin */
+#define AFIO_EXTIC2_EXTINT4_PTE ((uint16_t)0x0004) /*!< PE[4] pin */
+#define AFIO_EXTIC2_EXTINT4_PTF ((uint16_t)0x0005) /*!< PF[4] pin */
+#define AFIO_EXTIC2_EXTINT4_PTG ((uint16_t)0x0006) /*!< PG[4] pin */
+
+/* EXTI5 configuration */
+#define AFIO_EXTIC2_EXTINT5_PTA ((uint16_t)0x0000) /*!< PA[5] pin */
+#define AFIO_EXTIC2_EXTINT5_PTB ((uint16_t)0x0010) /*!< PB[5] pin */
+#define AFIO_EXTIC2_EXTINT5_PTC ((uint16_t)0x0020) /*!< PC[5] pin */
+#define AFIO_EXTIC2_EXTINT5_PTD ((uint16_t)0x0030) /*!< PD[5] pin */
+#define AFIO_EXTIC2_EXTINT5_PTE ((uint16_t)0x0040) /*!< PE[5] pin */
+#define AFIO_EXTIC2_EXTINT5_PTF ((uint16_t)0x0050) /*!< PF[5] pin */
+#define AFIO_EXTIC2_EXTINT5_PTG ((uint16_t)0x0060) /*!< PG[5] pin */
+
+/** EXTI6 configuration */
+#define AFIO_EXTIC2_EXTINT6_PTA ((uint16_t)0x0000) /*!< PA[6] pin */
+#define AFIO_EXTIC2_EXTINT6_PTB ((uint16_t)0x0100) /*!< PB[6] pin */
+#define AFIO_EXTIC2_EXTINT6_PTC ((uint16_t)0x0200) /*!< PC[6] pin */
+#define AFIO_EXTIC2_EXTINT6_PTD ((uint16_t)0x0300) /*!< PD[6] pin */
+#define AFIO_EXTIC2_EXTINT6_PTE ((uint16_t)0x0400) /*!< PE[6] pin */
+#define AFIO_EXTIC2_EXTINT6_PTF ((uint16_t)0x0500) /*!< PF[6] pin */
+#define AFIO_EXTIC2_EXTINT6_PTG ((uint16_t)0x0600) /*!< PG[6] pin */
+
+/** EXTI7 configuration */
+#define AFIO_EXTIC2_EXTINT7_PTA ((uint16_t)0x0000) /*!< PA[7] pin */
+#define AFIO_EXTIC2_EXTINT7_PTB ((uint16_t)0x1000) /*!< PB[7] pin */
+#define AFIO_EXTIC2_EXTINT7_PTC ((uint16_t)0x2000) /*!< PC[7] pin */
+#define AFIO_EXTIC2_EXTINT7_PTD ((uint16_t)0x3000) /*!< PD[7] pin */
+#define AFIO_EXTIC2_EXTINT7_PTE ((uint16_t)0x4000) /*!< PE[7] pin */
+#define AFIO_EXTIC2_EXTINT7_PTF ((uint16_t)0x5000) /*!< PF[7] pin */
+#define AFIO_EXTIC2_EXTINT7_PTG ((uint16_t)0x6000) /*!< PG[7] pin */
+
+/***************** Bit definition for AFIO_EXTIC3 register *****************/
+#define AFIO_EXTIC3_EXTINT8 ((uint16_t)0x000F) /*!< EXTI 8 configuration */
+#define AFIO_EXTIC3_EXTINT9 ((uint16_t)0x00F0) /*!< EXTI 9 configuration */
+#define AFIO_EXTIC3_EXTINT10 ((uint16_t)0x0F00) /*!< EXTI 10 configuration */
+#define AFIO_EXTIC3_EXTINT11 ((uint16_t)0xF000) /*!< EXTI 11 configuration */
+
+/** EXTI8 configuration */
+#define AFIO_EXTIC3_EXTINT8_PTA ((uint16_t)0x0000) /*!< PA[8] pin */
+#define AFIO_EXTIC3_EXTINT8_PTB ((uint16_t)0x0001) /*!< PB[8] pin */
+#define AFIO_EXTIC3_EXTINT8_PTC ((uint16_t)0x0002) /*!< PC[8] pin */
+#define AFIO_EXTIC3_EXTINT8_PTD ((uint16_t)0x0003) /*!< PD[8] pin */
+#define AFIO_EXTIC3_EXTINT8_PTE ((uint16_t)0x0004) /*!< PE[8] pin */
+#define AFIO_EXTIC3_EXTINT8_PTF ((uint16_t)0x0005) /*!< PF[8] pin */
+#define AFIO_EXTIC3_EXTINT8_PTG ((uint16_t)0x0006) /*!< PG[8] pin */
+
+/** EXTI9 configuration */
+#define AFIO_EXTIC3_EXTINT9_PTA ((uint16_t)0x0000) /*!< PA[9] pin */
+#define AFIO_EXTIC3_EXTINT9_PTB ((uint16_t)0x0010) /*!< PB[9] pin */
+#define AFIO_EXTIC3_EXTINT9_PTC ((uint16_t)0x0020) /*!< PC[9] pin */
+#define AFIO_EXTIC3_EXTINT9_PTD ((uint16_t)0x0030) /*!< PD[9] pin */
+#define AFIO_EXTIC3_EXTINT9_PTE ((uint16_t)0x0040) /*!< PE[9] pin */
+#define AFIO_EXTIC3_EXTINT9_PTF ((uint16_t)0x0050) /*!< PF[9] pin */
+#define AFIO_EXTIC3_EXTINT9_PTG ((uint16_t)0x0060) /*!< PG[9] pin */
+
+/** EXTI10 configuration */
+#define AFIO_EXTIC3_EXTINT10_PTA ((uint16_t)0x0000) /*!< PA[10] pin */
+#define AFIO_EXTIC3_EXTINT10_PTB ((uint16_t)0x0100) /*!< PB[10] pin */
+#define AFIO_EXTIC3_EXTINT10_PTC ((uint16_t)0x0200) /*!< PC[10] pin */
+#define AFIO_EXTIC3_EXTINT10_PTD ((uint16_t)0x0300) /*!< PD[10] pin */
+#define AFIO_EXTIC3_EXTINT10_PTE ((uint16_t)0x0400) /*!< PE[10] pin */
+#define AFIO_EXTIC3_EXTINT10_PTF ((uint16_t)0x0500) /*!< PF[10] pin */
+#define AFIO_EXTIC3_EXTINT10_PTG ((uint16_t)0x0600) /*!< PG[10] pin */
+
+/** EXTI11 configuration */
+#define AFIO_EXTIC3_EXTINT11_PTA ((uint16_t)0x0000) /*!< PA[11] pin */
+#define AFIO_EXTIC3_EXTINT11_PTB ((uint16_t)0x1000) /*!< PB[11] pin */
+#define AFIO_EXTIC3_EXTINT11_PTC ((uint16_t)0x2000) /*!< PC[11] pin */
+#define AFIO_EXTIC3_EXTINT11_PTD ((uint16_t)0x3000) /*!< PD[11] pin */
+#define AFIO_EXTIC3_EXTINT11_PTE ((uint16_t)0x4000) /*!< PE[11] pin */
+#define AFIO_EXTIC3_EXTINT11_PTF ((uint16_t)0x5000) /*!< PF[11] pin */
+#define AFIO_EXTIC3_EXTINT11_PTG ((uint16_t)0x6000) /*!< PG[11] pin */
+
+/***************** Bit definition for AFIO_EXTIC4 register *****************/
+#define AFIO_EXTIC4_EXTINT12 ((uint16_t)0x000F) /*!< EXTI 12 configuration */
+#define AFIO_EXTIC4_EXTINT13 ((uint16_t)0x00F0) /*!< EXTI 13 configuration */
+#define AFIO_EXTIC4_EXTINT14 ((uint16_t)0x0F00) /*!< EXTI 14 configuration */
+#define AFIO_EXTIC4_EXTINT15 ((uint16_t)0xF000) /*!< EXTI 15 configuration */
+
+/** EXTI12 configuration */
+#define AFIO_EXTIC4_EXTINT12_PTA ((uint16_t)0x0000) /*!< PA[12] pin */
+#define AFIO_EXTIC4_EXTINT12_PTB ((uint16_t)0x0001) /*!< PB[12] pin */
+#define AFIO_EXTIC4_EXTINT12_PTC ((uint16_t)0x0002) /*!< PC[12] pin */
+#define AFIO_EXTIC4_EXTINT12_PTD ((uint16_t)0x0003) /*!< PD[12] pin */
+#define AFIO_EXTIC4_EXTINT12_PTE ((uint16_t)0x0004) /*!< PE[12] pin */
+#define AFIO_EXTIC4_EXTINT12_PTF ((uint16_t)0x0005) /*!< PF[12] pin */
+#define AFIO_EXTIC4_EXTINT12_PTG ((uint16_t)0x0006) /*!< PG[12] pin */
+
+/** EXTI13 configuration */
+#define AFIO_EXTIC4_EXTINT13_PTA ((uint16_t)0x0000) /*!< PA[13] pin */
+#define AFIO_EXTIC4_EXTINT13_PTB ((uint16_t)0x0010) /*!< PB[13] pin */
+#define AFIO_EXTIC4_EXTINT13_PTC ((uint16_t)0x0020) /*!< PC[13] pin */
+#define AFIO_EXTIC4_EXTINT13_PTD ((uint16_t)0x0030) /*!< PD[13] pin */
+#define AFIO_EXTIC4_EXTINT13_PTE ((uint16_t)0x0040) /*!< PE[13] pin */
+#define AFIO_EXTIC4_EXTINT13_PTF ((uint16_t)0x0050) /*!< PF[13] pin */
+#define AFIO_EXTIC4_EXTINT13_PTG ((uint16_t)0x0060) /*!< PG[13] pin */
+
+/** EXTI14 configuration */
+#define AFIO_EXTIC4_EXTINT14_PTA ((uint16_t)0x0000) /*!< PA[14] pin */
+#define AFIO_EXTIC4_EXTINT14_PTB ((uint16_t)0x0100) /*!< PB[14] pin */
+#define AFIO_EXTIC4_EXTINT14_PTC ((uint16_t)0x0200) /*!< PC[14] pin */
+#define AFIO_EXTIC4_EXTINT14_PTD ((uint16_t)0x0300) /*!< PD[14] pin */
+#define AFIO_EXTIC4_EXTINT14_PTE ((uint16_t)0x0400) /*!< PE[14] pin */
+#define AFIO_EXTIC4_EXTINT14_PTF ((uint16_t)0x0500) /*!< PF[14] pin */
+#define AFIO_EXTIC4_EXTINT14_PTG ((uint16_t)0x0600) /*!< PG[14] pin */
+
+/** EXTI15 configuration */
+#define AFIO_EXTIC4_EXTINT15_PTA ((uint16_t)0x0000) /*!< PA[15] pin */
+#define AFIO_EXTIC4_EXTINT15_PTB ((uint16_t)0x1000) /*!< PB[15] pin */
+#define AFIO_EXTIC4_EXTINT15_PTC ((uint16_t)0x2000) /*!< PC[15] pin */
+#define AFIO_EXTIC4_EXTINT15_PTD ((uint16_t)0x3000) /*!< PD[15] pin */
+#define AFIO_EXTIC4_EXTINT15_PTE ((uint16_t)0x4000) /*!< PE[15] pin */
+#define AFIO_EXTIC4_EXTINT15_PTF ((uint16_t)0x5000) /*!< PF[15] pin */
+#define AFIO_EXTIC4_EXTINT15_PTG ((uint16_t)0x6000) /*!< PG[15] pin */
+
+
+/****************** Bit definition for AFIO_MAP2 register ******************/
+#define AFIO_MAP2_TMR9_REMAP ((uint32_t)0x00000020) /*!< TMR9 remapping */
+#define AFIO_MAP2_TMR10_REMAP ((uint32_t)0x00000040) /*!< TMR10 remapping */
+#define AFIO_MAP2_TMR11_REMAP ((uint32_t)0x00000080) /*!< TMR11 remapping */
+#define AFIO_MAP2_TMR13_REMAP ((uint32_t)0x00000100) /*!< TMR13 remapping */
+#define AFIO_MAP2_TMR14_REMAP ((uint32_t)0x00000200) /*!< TMR14 remapping */
+#define AFIO_MAP2_XMC_NADV_REMAP ((uint32_t)0x00000400) /*!< XMC NADV remapping */
+#define AFIO_MAP2_TMR15_REMAP ((uint32_t)0x00000001) /*!< TMR15 remapping */
+#define AFIO_MAP2_SPI4_REMAP ((uint32_t)0x00020000) /*!< SPI4 remapping */
+#define AFIO_MAP2_I2C3_REMAP ((uint32_t)0x00040000) /*!< I2C3 remapping */
+#define AFIO_MAP2_SDIO2_REMAP_01 ((uint32_t)0x00080000) /*!< SDIO2 remapping01 */
+#define AFIO_MAP2_SDIO2_REMAP_10 ((uint32_t)0x00100000) /*!< SDIO2 remapping10 */
+#define AFIO_MAP2_SDIO2_REMAP_11 ((uint32_t)0x00180000) /*!< SDIO2 remapping11 */
+#define AFIO_MAP2_EXT_FLASH_REMAP ((uint32_t)0x00200000) /*!< External FLASH remapping */
+
+/****************** Bit definition for AFIO_MAP3 register ******************/
+#define AFIO_MAP3_TMR9_GRMP ((uint32_t)0x00000002) /*!< TMR9 Alternate Function mapping */
+#define AFIO_MAP3_TMR10_GRMP ((uint32_t)0x00000020) /*!< TMR10 Alternate Function mapping */
+#define AFIO_MAP3_TMR11_GRMP ((uint32_t)0x00000200) /*!< TMR11 Alternate Function mapping */
+
+/****************** Bit definition for AFIO_MAP4 register ******************/
+#define AFIO_MAP4_TMR1_GRMP ((uint32_t)0x00000001) /*!< TMR1 Alternate Function mapping */
+#define AFIO_MAP4_TMR2_GRMP_01 ((uint32_t)0x00000010) /*!< TMR2 Alternate Function mapping 0001*/
+#define AFIO_MAP4_TMR2_GRMP_10 ((uint32_t)0x00000020) /*!< TMR2 Alternate Function mapping 0010*/
+#define AFIO_MAP4_TMR2_GRMP_11 ((uint32_t)0x00000030) /*!< TMR2 Alternate Function mapping 0011*/
+#define AFIO_MAP4_TMR3_GRMP_10 ((uint32_t)0x00000200) /*!< TMR3 Alternate Function mapping 0010*/
+#define AFIO_MAP4_TMR3_GRMP_11 ((uint32_t)0x00000300) /*!< TMR3 Alternate Function mapping 0011*/
+#define AFIO_MAP4_TMR5_GRMP ((uint32_t)0x00010000) /*!< TMR5 Alternate Function mapping : CH1/CH2*/
+#define AFIO_MAP4_TMR5CH4_INTLRE ((uint32_t)0x00080000) /*!< TMR5 Channel4 Internal Remap */
+
+/****************** Bit definition for AFIO_MAP5 register ******************/
+#define AFIO_MAP5_I2C1_GRMP_01 ((uint32_t)0x00000010) /*!< I2C1 Alternate Function mapping 0001*/
+#define AFIO_MAP5_I2C1_GRMP_11 ((uint32_t)0x00000030) /*!< I2C1 Alternate Function mapping 0011*/
+#define AFIO_MAP5_I2C2_GRMP_01 ((uint32_t)0x00000100) /*!< I2C2 Alternate Function mapping 0001*/
+#define AFIO_MAP5_I2C2_GRMP_10 ((uint32_t)0x00000200) /*!< I2C2 Alternate Function mapping 0010*/
+#define AFIO_MAP5_I2C2_GRMP_11 ((uint32_t)0x00000300) /*!< I2C2 Alternate Function mapping 0011*/
+#define AFIO_MAP5_SPI1_GRMP ((uint32_t)0x00010000) /*!< SPI1 Alternate Function mapping */
+#define AFIO_MAP5_SPI2_GRMP ((uint32_t)0x00100000) /*!< SPI2 Alternate Function mapping */
+
+/****************** Bit definition for AFIO_MAP6 register ******************/
+#define AFIO_MAP6_CAN1_GRMP ((uint32_t)0x00000002) /*!< CAN1 Alternate Function mapping */
+#define AFIO_MAP6_CAN2_GRMP ((uint32_t)0x00000010) /*!< CAN2 Alternate Function mapping */
+#define AFIO_MAP6_SDIO_GRMP_100 ((uint32_t)0x00000400) /*!< SDIO Alternate Function mapping 100 */
+#define AFIO_MAP6_SDIO_GRMP_101 ((uint32_t)0x00000500) /*!< SDIO Alternate Function mapping 101 */
+#define AFIO_MAP6_SDIO_GRMP_110 ((uint32_t)0x00000600) /*!< SDIO Alternate Function mapping 110 */
+#define AFIO_MAP6_SDIO_GRMP_111 ((uint32_t)0x00000700) /*!< SDIO Alternate Function mapping 111 */
+#define AFIO_MAP6_USART1_GRMP ((uint32_t)0x00010000) /*!< USART1 Alternate Function mapping */
+#define AFIO_MAP6_USART3_GRMP ((uint32_t)0x01000000) /*!< USART3 Partial Alternate Function mapping */
+#define AFIO_MAP6_UART4_GRMP ((uint32_t)0x10000000) /*!< UART4 Alternate Function mapping */
+
+/****************** Bit definition for AFIO_MAP7 register ******************/
+#define AFIO_MAP7_SPIF_GRMP_1000 ((uint32_t)0x00000008) /*!< EXT_FLASH Alternate Function mapping */
+#define AFIO_MAP7_SPIF_GRMP_1001 ((uint32_t)0x00000009) /*!< EXT_FLASH Alternate Function enable */
+#define AFIO_MAP7_ADC1_GRMP_01 ((uint32_t)0x00000010) /*!< ADC1 External Trigger Injected Conversion remapping */
+#define AFIO_MAP7_ADC1_GRMP_10 ((uint32_t)0x00000020) /*!< ADC1 External Trigger Regular Conversion remapping */
+#define AFIO_MAP7_ADC1_GRMP_11 ((uint32_t)0x00000030) /*!< ADC1 External Trigger Regular & Injected Conversion remapping */
+#define AFIO_MAP7_ADC2_GRMP_01 ((uint32_t)0x00000100) /*!< ADC2 External Trigger Injected Conversion remapping */
+#define AFIO_MAP7_ADC2_GRMP_10 ((uint32_t)0x00000200) /*!< ADC2 External Trigger Regular Conversion remapping */
+#define AFIO_MAP7_ADC2_GRMP_11 ((uint32_t)0x00000300) /*!< ADC2 External Trigger Regular & Injected Conversion remapping */
+#define AFIO_MAP7_SWJTAG_GRMP_001 ((uint32_t)0x00010000) /*!< Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST */
+#define AFIO_MAP7_SWJTAG_GRMP_010 ((uint32_t)0x00020000) /*!< JTAG-DP Disabled and SW-DP Enabled */
+#define AFIO_MAP7_SWJTAG_GRMP_100 ((uint32_t)0x00040000) /*!< Full SWJ Disabled (JTAG-DP + SW-DP) */
+#define AFIO_MAP7_PD01_GRMP ((uint32_t)0x00100000) /*!< PD01 Alternate Function mapping */
+
+
+/******************************************************************************/
+/* */
+/* SystemTick */
+/* */
+/******************************************************************************/
+
+/***************** Bit definition for SysTick_CTRL register *****************/
+#define SysTick_CTRL_ENABLE ((uint32_t)0x00000001) /*!< Counter enable */
+#define SysTick_CTRL_TICKINT ((uint32_t)0x00000002) /*!< Counting down to 0 pends the SysTick handler */
+#define SysTick_CTRL_CLKSOURCE ((uint32_t)0x00000004) /*!< Clock source */
+#define SysTick_CTRL_COUNTFLAG ((uint32_t)0x00010000) /*!< Count Flag */
+
+/***************** Bit definition for SysTick_LOAD register *****************/
+#define SysTick_LOAD_RELOAD ((uint32_t)0x00FFFFFF) /*!< Value to load into the SysTick Current Value Register when the counter reaches 0 */
+
+/***************** Bit definition for SysTick_VAL register ******************/
+#define SysTick_VAL_CURRENT ((uint32_t)0x00FFFFFF) /*!< Current value at the time the register is accessed */
+
+/***************** Bit definition for SysTick_CALIB register ****************/
+#define SysTick_CALIB_TENMS ((uint32_t)0x00FFFFFF) /*!< Reload value to use for 10ms timing */
+#define SysTick_CALIB_SKEW ((uint32_t)0x40000000) /*!< Calibration value is not exactly 10 ms */
+#define SysTick_CALIB_NOREF ((uint32_t)0x80000000) /*!< The reference clock is not provided */
+
+/******************************************************************************/
+/* */
+/* Nested Vectored Interrupt Controller */
+/* */
+/******************************************************************************/
+
+/****************** Bit definition for NVIC_ISER register *******************/
+#define NVIC_ISER_SETENA ((uint32_t)0xFFFFFFFF) /*!< Interrupt set enable bits */
+#define NVIC_ISER_SETENA_0 ((uint32_t)0x00000001) /*!< bit 0 */
+#define NVIC_ISER_SETENA_1 ((uint32_t)0x00000002) /*!< bit 1 */
+#define NVIC_ISER_SETENA_2 ((uint32_t)0x00000004) /*!< bit 2 */
+#define NVIC_ISER_SETENA_3 ((uint32_t)0x00000008) /*!< bit 3 */
+#define NVIC_ISER_SETENA_4 ((uint32_t)0x00000010) /*!< bit 4 */
+#define NVIC_ISER_SETENA_5 ((uint32_t)0x00000020) /*!< bit 5 */
+#define NVIC_ISER_SETENA_6 ((uint32_t)0x00000040) /*!< bit 6 */
+#define NVIC_ISER_SETENA_7 ((uint32_t)0x00000080) /*!< bit 7 */
+#define NVIC_ISER_SETENA_8 ((uint32_t)0x00000100) /*!< bit 8 */
+#define NVIC_ISER_SETENA_9 ((uint32_t)0x00000200) /*!< bit 9 */
+#define NVIC_ISER_SETENA_10 ((uint32_t)0x00000400) /*!< bit 10 */
+#define NVIC_ISER_SETENA_11 ((uint32_t)0x00000800) /*!< bit 11 */
+#define NVIC_ISER_SETENA_12 ((uint32_t)0x00001000) /*!< bit 12 */
+#define NVIC_ISER_SETENA_13 ((uint32_t)0x00002000) /*!< bit 13 */
+#define NVIC_ISER_SETENA_14 ((uint32_t)0x00004000) /*!< bit 14 */
+#define NVIC_ISER_SETENA_15 ((uint32_t)0x00008000) /*!< bit 15 */
+#define NVIC_ISER_SETENA_16 ((uint32_t)0x00010000) /*!< bit 16 */
+#define NVIC_ISER_SETENA_17 ((uint32_t)0x00020000) /*!< bit 17 */
+#define NVIC_ISER_SETENA_18 ((uint32_t)0x00040000) /*!< bit 18 */
+#define NVIC_ISER_SETENA_19 ((uint32_t)0x00080000) /*!< bit 19 */
+#define NVIC_ISER_SETENA_20 ((uint32_t)0x00100000) /*!< bit 20 */
+#define NVIC_ISER_SETENA_21 ((uint32_t)0x00200000) /*!< bit 21 */
+#define NVIC_ISER_SETENA_22 ((uint32_t)0x00400000) /*!< bit 22 */
+#define NVIC_ISER_SETENA_23 ((uint32_t)0x00800000) /*!< bit 23 */
+#define NVIC_ISER_SETENA_24 ((uint32_t)0x01000000) /*!< bit 24 */
+#define NVIC_ISER_SETENA_25 ((uint32_t)0x02000000) /*!< bit 25 */
+#define NVIC_ISER_SETENA_26 ((uint32_t)0x04000000) /*!< bit 26 */
+#define NVIC_ISER_SETENA_27 ((uint32_t)0x08000000) /*!< bit 27 */
+#define NVIC_ISER_SETENA_28 ((uint32_t)0x10000000) /*!< bit 28 */
+#define NVIC_ISER_SETENA_29 ((uint32_t)0x20000000) /*!< bit 29 */
+#define NVIC_ISER_SETENA_30 ((uint32_t)0x40000000) /*!< bit 30 */
+#define NVIC_ISER_SETENA_31 ((uint32_t)0x80000000) /*!< bit 31 */
+
+/****************** Bit definition for NVIC_ICER register *******************/
+#define NVIC_ICER_CLRENA ((uint32_t)0xFFFFFFFF) /*!< Interrupt clear-enable bits */
+#define NVIC_ICER_CLRENA_0 ((uint32_t)0x00000001) /*!< bit 0 */
+#define NVIC_ICER_CLRENA_1 ((uint32_t)0x00000002) /*!< bit 1 */
+#define NVIC_ICER_CLRENA_2 ((uint32_t)0x00000004) /*!< bit 2 */
+#define NVIC_ICER_CLRENA_3 ((uint32_t)0x00000008) /*!< bit 3 */
+#define NVIC_ICER_CLRENA_4 ((uint32_t)0x00000010) /*!< bit 4 */
+#define NVIC_ICER_CLRENA_5 ((uint32_t)0x00000020) /*!< bit 5 */
+#define NVIC_ICER_CLRENA_6 ((uint32_t)0x00000040) /*!< bit 6 */
+#define NVIC_ICER_CLRENA_7 ((uint32_t)0x00000080) /*!< bit 7 */
+#define NVIC_ICER_CLRENA_8 ((uint32_t)0x00000100) /*!< bit 8 */
+#define NVIC_ICER_CLRENA_9 ((uint32_t)0x00000200) /*!< bit 9 */
+#define NVIC_ICER_CLRENA_10 ((uint32_t)0x00000400) /*!< bit 10 */
+#define NVIC_ICER_CLRENA_11 ((uint32_t)0x00000800) /*!< bit 11 */
+#define NVIC_ICER_CLRENA_12 ((uint32_t)0x00001000) /*!< bit 12 */
+#define NVIC_ICER_CLRENA_13 ((uint32_t)0x00002000) /*!< bit 13 */
+#define NVIC_ICER_CLRENA_14 ((uint32_t)0x00004000) /*!< bit 14 */
+#define NVIC_ICER_CLRENA_15 ((uint32_t)0x00008000) /*!< bit 15 */
+#define NVIC_ICER_CLRENA_16 ((uint32_t)0x00010000) /*!< bit 16 */
+#define NVIC_ICER_CLRENA_17 ((uint32_t)0x00020000) /*!< bit 17 */
+#define NVIC_ICER_CLRENA_18 ((uint32_t)0x00040000) /*!< bit 18 */
+#define NVIC_ICER_CLRENA_19 ((uint32_t)0x00080000) /*!< bit 19 */
+#define NVIC_ICER_CLRENA_20 ((uint32_t)0x00100000) /*!< bit 20 */
+#define NVIC_ICER_CLRENA_21 ((uint32_t)0x00200000) /*!< bit 21 */
+#define NVIC_ICER_CLRENA_22 ((uint32_t)0x00400000) /*!< bit 22 */
+#define NVIC_ICER_CLRENA_23 ((uint32_t)0x00800000) /*!< bit 23 */
+#define NVIC_ICER_CLRENA_24 ((uint32_t)0x01000000) /*!< bit 24 */
+#define NVIC_ICER_CLRENA_25 ((uint32_t)0x02000000) /*!< bit 25 */
+#define NVIC_ICER_CLRENA_26 ((uint32_t)0x04000000) /*!< bit 26 */
+#define NVIC_ICER_CLRENA_27 ((uint32_t)0x08000000) /*!< bit 27 */
+#define NVIC_ICER_CLRENA_28 ((uint32_t)0x10000000) /*!< bit 28 */
+#define NVIC_ICER_CLRENA_29 ((uint32_t)0x20000000) /*!< bit 29 */
+#define NVIC_ICER_CLRENA_30 ((uint32_t)0x40000000) /*!< bit 30 */
+#define NVIC_ICER_CLRENA_31 ((uint32_t)0x80000000) /*!< bit 31 */
+
+/****************** Bit definition for NVIC_ISPR register *******************/
+#define NVIC_ISPR_SETPEND ((uint32_t)0xFFFFFFFF) /*!< Interrupt set-pending bits */
+#define NVIC_ISPR_SETPEND_0 ((uint32_t)0x00000001) /*!< bit 0 */
+#define NVIC_ISPR_SETPEND_1 ((uint32_t)0x00000002) /*!< bit 1 */
+#define NVIC_ISPR_SETPEND_2 ((uint32_t)0x00000004) /*!< bit 2 */
+#define NVIC_ISPR_SETPEND_3 ((uint32_t)0x00000008) /*!< bit 3 */
+#define NVIC_ISPR_SETPEND_4 ((uint32_t)0x00000010) /*!< bit 4 */
+#define NVIC_ISPR_SETPEND_5 ((uint32_t)0x00000020) /*!< bit 5 */
+#define NVIC_ISPR_SETPEND_6 ((uint32_t)0x00000040) /*!< bit 6 */
+#define NVIC_ISPR_SETPEND_7 ((uint32_t)0x00000080) /*!< bit 7 */
+#define NVIC_ISPR_SETPEND_8 ((uint32_t)0x00000100) /*!< bit 8 */
+#define NVIC_ISPR_SETPEND_9 ((uint32_t)0x00000200) /*!< bit 9 */
+#define NVIC_ISPR_SETPEND_10 ((uint32_t)0x00000400) /*!< bit 10 */
+#define NVIC_ISPR_SETPEND_11 ((uint32_t)0x00000800) /*!< bit 11 */
+#define NVIC_ISPR_SETPEND_12 ((uint32_t)0x00001000) /*!< bit 12 */
+#define NVIC_ISPR_SETPEND_13 ((uint32_t)0x00002000) /*!< bit 13 */
+#define NVIC_ISPR_SETPEND_14 ((uint32_t)0x00004000) /*!< bit 14 */
+#define NVIC_ISPR_SETPEND_15 ((uint32_t)0x00008000) /*!< bit 15 */
+#define NVIC_ISPR_SETPEND_16 ((uint32_t)0x00010000) /*!< bit 16 */
+#define NVIC_ISPR_SETPEND_17 ((uint32_t)0x00020000) /*!< bit 17 */
+#define NVIC_ISPR_SETPEND_18 ((uint32_t)0x00040000) /*!< bit 18 */
+#define NVIC_ISPR_SETPEND_19 ((uint32_t)0x00080000) /*!< bit 19 */
+#define NVIC_ISPR_SETPEND_20 ((uint32_t)0x00100000) /*!< bit 20 */
+#define NVIC_ISPR_SETPEND_21 ((uint32_t)0x00200000) /*!< bit 21 */
+#define NVIC_ISPR_SETPEND_22 ((uint32_t)0x00400000) /*!< bit 22 */
+#define NVIC_ISPR_SETPEND_23 ((uint32_t)0x00800000) /*!< bit 23 */
+#define NVIC_ISPR_SETPEND_24 ((uint32_t)0x01000000) /*!< bit 24 */
+#define NVIC_ISPR_SETPEND_25 ((uint32_t)0x02000000) /*!< bit 25 */
+#define NVIC_ISPR_SETPEND_26 ((uint32_t)0x04000000) /*!< bit 26 */
+#define NVIC_ISPR_SETPEND_27 ((uint32_t)0x08000000) /*!< bit 27 */
+#define NVIC_ISPR_SETPEND_28 ((uint32_t)0x10000000) /*!< bit 28 */
+#define NVIC_ISPR_SETPEND_29 ((uint32_t)0x20000000) /*!< bit 29 */
+#define NVIC_ISPR_SETPEND_30 ((uint32_t)0x40000000) /*!< bit 30 */
+#define NVIC_ISPR_SETPEND_31 ((uint32_t)0x80000000) /*!< bit 31 */
+
+/****************** Bit definition for NVIC_ICPR register *******************/
+#define NVIC_ICPR_CLRPEND ((uint32_t)0xFFFFFFFF) /*!< Interrupt clear-pending bits */
+#define NVIC_ICPR_CLRPEND_0 ((uint32_t)0x00000001) /*!< bit 0 */
+#define NVIC_ICPR_CLRPEND_1 ((uint32_t)0x00000002) /*!< bit 1 */
+#define NVIC_ICPR_CLRPEND_2 ((uint32_t)0x00000004) /*!< bit 2 */
+#define NVIC_ICPR_CLRPEND_3 ((uint32_t)0x00000008) /*!< bit 3 */
+#define NVIC_ICPR_CLRPEND_4 ((uint32_t)0x00000010) /*!< bit 4 */
+#define NVIC_ICPR_CLRPEND_5 ((uint32_t)0x00000020) /*!< bit 5 */
+#define NVIC_ICPR_CLRPEND_6 ((uint32_t)0x00000040) /*!< bit 6 */
+#define NVIC_ICPR_CLRPEND_7 ((uint32_t)0x00000080) /*!< bit 7 */
+#define NVIC_ICPR_CLRPEND_8 ((uint32_t)0x00000100) /*!< bit 8 */
+#define NVIC_ICPR_CLRPEND_9 ((uint32_t)0x00000200) /*!< bit 9 */
+#define NVIC_ICPR_CLRPEND_10 ((uint32_t)0x00000400) /*!< bit 10 */
+#define NVIC_ICPR_CLRPEND_11 ((uint32_t)0x00000800) /*!< bit 11 */
+#define NVIC_ICPR_CLRPEND_12 ((uint32_t)0x00001000) /*!< bit 12 */
+#define NVIC_ICPR_CLRPEND_13 ((uint32_t)0x00002000) /*!< bit 13 */
+#define NVIC_ICPR_CLRPEND_14 ((uint32_t)0x00004000) /*!< bit 14 */
+#define NVIC_ICPR_CLRPEND_15 ((uint32_t)0x00008000) /*!< bit 15 */
+#define NVIC_ICPR_CLRPEND_16 ((uint32_t)0x00010000) /*!< bit 16 */
+#define NVIC_ICPR_CLRPEND_17 ((uint32_t)0x00020000) /*!< bit 17 */
+#define NVIC_ICPR_CLRPEND_18 ((uint32_t)0x00040000) /*!< bit 18 */
+#define NVIC_ICPR_CLRPEND_19 ((uint32_t)0x00080000) /*!< bit 19 */
+#define NVIC_ICPR_CLRPEND_20 ((uint32_t)0x00100000) /*!< bit 20 */
+#define NVIC_ICPR_CLRPEND_21 ((uint32_t)0x00200000) /*!< bit 21 */
+#define NVIC_ICPR_CLRPEND_22 ((uint32_t)0x00400000) /*!< bit 22 */
+#define NVIC_ICPR_CLRPEND_23 ((uint32_t)0x00800000) /*!< bit 23 */
+#define NVIC_ICPR_CLRPEND_24 ((uint32_t)0x01000000) /*!< bit 24 */
+#define NVIC_ICPR_CLRPEND_25 ((uint32_t)0x02000000) /*!< bit 25 */
+#define NVIC_ICPR_CLRPEND_26 ((uint32_t)0x04000000) /*!< bit 26 */
+#define NVIC_ICPR_CLRPEND_27 ((uint32_t)0x08000000) /*!< bit 27 */
+#define NVIC_ICPR_CLRPEND_28 ((uint32_t)0x10000000) /*!< bit 28 */
+#define NVIC_ICPR_CLRPEND_29 ((uint32_t)0x20000000) /*!< bit 29 */
+#define NVIC_ICPR_CLRPEND_30 ((uint32_t)0x40000000) /*!< bit 30 */
+#define NVIC_ICPR_CLRPEND_31 ((uint32_t)0x80000000) /*!< bit 31 */
+
+/****************** Bit definition for NVIC_IABR register *******************/
+#define NVIC_IABR_ACTIVE ((uint32_t)0xFFFFFFFF) /*!< Interrupt active flags */
+#define NVIC_IABR_ACTIVE_0 ((uint32_t)0x00000001) /*!< bit 0 */
+#define NVIC_IABR_ACTIVE_1 ((uint32_t)0x00000002) /*!< bit 1 */
+#define NVIC_IABR_ACTIVE_2 ((uint32_t)0x00000004) /*!< bit 2 */
+#define NVIC_IABR_ACTIVE_3 ((uint32_t)0x00000008) /*!< bit 3 */
+#define NVIC_IABR_ACTIVE_4 ((uint32_t)0x00000010) /*!< bit 4 */
+#define NVIC_IABR_ACTIVE_5 ((uint32_t)0x00000020) /*!< bit 5 */
+#define NVIC_IABR_ACTIVE_6 ((uint32_t)0x00000040) /*!< bit 6 */
+#define NVIC_IABR_ACTIVE_7 ((uint32_t)0x00000080) /*!< bit 7 */
+#define NVIC_IABR_ACTIVE_8 ((uint32_t)0x00000100) /*!< bit 8 */
+#define NVIC_IABR_ACTIVE_9 ((uint32_t)0x00000200) /*!< bit 9 */
+#define NVIC_IABR_ACTIVE_10 ((uint32_t)0x00000400) /*!< bit 10 */
+#define NVIC_IABR_ACTIVE_11 ((uint32_t)0x00000800) /*!< bit 11 */
+#define NVIC_IABR_ACTIVE_12 ((uint32_t)0x00001000) /*!< bit 12 */
+#define NVIC_IABR_ACTIVE_13 ((uint32_t)0x00002000) /*!< bit 13 */
+#define NVIC_IABR_ACTIVE_14 ((uint32_t)0x00004000) /*!< bit 14 */
+#define NVIC_IABR_ACTIVE_15 ((uint32_t)0x00008000) /*!< bit 15 */
+#define NVIC_IABR_ACTIVE_16 ((uint32_t)0x00010000) /*!< bit 16 */
+#define NVIC_IABR_ACTIVE_17 ((uint32_t)0x00020000) /*!< bit 17 */
+#define NVIC_IABR_ACTIVE_18 ((uint32_t)0x00040000) /*!< bit 18 */
+#define NVIC_IABR_ACTIVE_19 ((uint32_t)0x00080000) /*!< bit 19 */
+#define NVIC_IABR_ACTIVE_20 ((uint32_t)0x00100000) /*!< bit 20 */
+#define NVIC_IABR_ACTIVE_21 ((uint32_t)0x00200000) /*!< bit 21 */
+#define NVIC_IABR_ACTIVE_22 ((uint32_t)0x00400000) /*!< bit 22 */
+#define NVIC_IABR_ACTIVE_23 ((uint32_t)0x00800000) /*!< bit 23 */
+#define NVIC_IABR_ACTIVE_24 ((uint32_t)0x01000000) /*!< bit 24 */
+#define NVIC_IABR_ACTIVE_25 ((uint32_t)0x02000000) /*!< bit 25 */
+#define NVIC_IABR_ACTIVE_26 ((uint32_t)0x04000000) /*!< bit 26 */
+#define NVIC_IABR_ACTIVE_27 ((uint32_t)0x08000000) /*!< bit 27 */
+#define NVIC_IABR_ACTIVE_28 ((uint32_t)0x10000000) /*!< bit 28 */
+#define NVIC_IABR_ACTIVE_29 ((uint32_t)0x20000000) /*!< bit 29 */
+#define NVIC_IABR_ACTIVE_30 ((uint32_t)0x40000000) /*!< bit 30 */
+#define NVIC_IABR_ACTIVE_31 ((uint32_t)0x80000000) /*!< bit 31 */
+
+/****************** Bit definition for NVIC_PRI0 register *******************/
+#define NVIC_IPR0_PRI_0 ((uint32_t)0x000000FF) /*!< Priority of interrupt 0 */
+#define NVIC_IPR0_PRI_1 ((uint32_t)0x0000FF00) /*!< Priority of interrupt 1 */
+#define NVIC_IPR0_PRI_2 ((uint32_t)0x00FF0000) /*!< Priority of interrupt 2 */
+#define NVIC_IPR0_PRI_3 ((uint32_t)0xFF000000) /*!< Priority of interrupt 3 */
+
+/****************** Bit definition for NVIC_PRI1 register *******************/
+#define NVIC_IPR1_PRI_4 ((uint32_t)0x000000FF) /*!< Priority of interrupt 4 */
+#define NVIC_IPR1_PRI_5 ((uint32_t)0x0000FF00) /*!< Priority of interrupt 5 */
+#define NVIC_IPR1_PRI_6 ((uint32_t)0x00FF0000) /*!< Priority of interrupt 6 */
+#define NVIC_IPR1_PRI_7 ((uint32_t)0xFF000000) /*!< Priority of interrupt 7 */
+
+/****************** Bit definition for NVIC_PRI2 register *******************/
+#define NVIC_IPR2_PRI_8 ((uint32_t)0x000000FF) /*!< Priority of interrupt 8 */
+#define NVIC_IPR2_PRI_9 ((uint32_t)0x0000FF00) /*!< Priority of interrupt 9 */
+#define NVIC_IPR2_PRI_10 ((uint32_t)0x00FF0000) /*!< Priority of interrupt 10 */
+#define NVIC_IPR2_PRI_11 ((uint32_t)0xFF000000) /*!< Priority of interrupt 11 */
+
+/****************** Bit definition for NVIC_PRI3 register *******************/
+#define NVIC_IPR3_PRI_12 ((uint32_t)0x000000FF) /*!< Priority of interrupt 12 */
+#define NVIC_IPR3_PRI_13 ((uint32_t)0x0000FF00) /*!< Priority of interrupt 13 */
+#define NVIC_IPR3_PRI_14 ((uint32_t)0x00FF0000) /*!< Priority of interrupt 14 */
+#define NVIC_IPR3_PRI_15 ((uint32_t)0xFF000000) /*!< Priority of interrupt 15 */
+
+/****************** Bit definition for NVIC_PRI4 register *******************/
+#define NVIC_IPR4_PRI_16 ((uint32_t)0x000000FF) /*!< Priority of interrupt 16 */
+#define NVIC_IPR4_PRI_17 ((uint32_t)0x0000FF00) /*!< Priority of interrupt 17 */
+#define NVIC_IPR4_PRI_18 ((uint32_t)0x00FF0000) /*!< Priority of interrupt 18 */
+#define NVIC_IPR4_PRI_19 ((uint32_t)0xFF000000) /*!< Priority of interrupt 19 */
+
+/****************** Bit definition for NVIC_PRI5 register *******************/
+#define NVIC_IPR5_PRI_20 ((uint32_t)0x000000FF) /*!< Priority of interrupt 20 */
+#define NVIC_IPR5_PRI_21 ((uint32_t)0x0000FF00) /*!< Priority of interrupt 21 */
+#define NVIC_IPR5_PRI_22 ((uint32_t)0x00FF0000) /*!< Priority of interrupt 22 */
+#define NVIC_IPR5_PRI_23 ((uint32_t)0xFF000000) /*!< Priority of interrupt 23 */
+
+/****************** Bit definition for NVIC_PRI6 register *******************/
+#define NVIC_IPR6_PRI_24 ((uint32_t)0x000000FF) /*!< Priority of interrupt 24 */
+#define NVIC_IPR6_PRI_25 ((uint32_t)0x0000FF00) /*!< Priority of interrupt 25 */
+#define NVIC_IPR6_PRI_26 ((uint32_t)0x00FF0000) /*!< Priority of interrupt 26 */
+#define NVIC_IPR6_PRI_27 ((uint32_t)0xFF000000) /*!< Priority of interrupt 27 */
+
+/****************** Bit definition for NVIC_PRI7 register *******************/
+#define NVIC_IPR7_PRI_28 ((uint32_t)0x000000FF) /*!< Priority of interrupt 28 */
+#define NVIC_IPR7_PRI_29 ((uint32_t)0x0000FF00) /*!< Priority of interrupt 29 */
+#define NVIC_IPR7_PRI_30 ((uint32_t)0x00FF0000) /*!< Priority of interrupt 30 */
+#define NVIC_IPR7_PRI_31 ((uint32_t)0xFF000000) /*!< Priority of interrupt 31 */
+
+/****************** Bit definition for SCB_CPUID register *******************/
+#define SCB_CPUID_REVISION ((uint32_t)0x0000000F) /*!< Implementation defined revision number */
+#define SCB_CPUID_PARTNO ((uint32_t)0x0000FFF0) /*!< Number of processor within family */
+#define SCB_CPUID_Constant ((uint32_t)0x000F0000) /*!< Reads as 0x0F */
+#define SCB_CPUID_VARIANT ((uint32_t)0x00F00000) /*!< Implementation defined variant number */
+#define SCB_CPUID_IMPLEMENTER ((uint32_t)0xFF000000) /*!< Implementer code. ARM is 0x41 */
+
+/******************* Bit definition for SCB_ICSR register *******************/
+#define SCB_ICSR_VECTACTIVE ((uint32_t)0x000001FF) /*!< Active ISR number field */
+#define SCB_ICSR_RETTOBASE ((uint32_t)0x00000800) /*!< All active exceptions minus the IPSR_current_exception yields the empty set */
+#define SCB_ICSR_VECTPENDING ((uint32_t)0x003FF000) /*!< Pending ISR number field */
+#define SCB_ICSR_ISRPENDING ((uint32_t)0x00400000) /*!< Interrupt pending flag */
+#define SCB_ICSR_ISRPREEMPT ((uint32_t)0x00800000) /*!< It indicates that a pending interrupt becomes active in the next running cycle */
+#define SCB_ICSR_PENDSTCLR ((uint32_t)0x02000000) /*!< Clear pending SysTick bit */
+#define SCB_ICSR_PENDSTSET ((uint32_t)0x04000000) /*!< Set pending SysTick bit */
+#define SCB_ICSR_PENDSVCLR ((uint32_t)0x08000000) /*!< Clear pending pendSV bit */
+#define SCB_ICSR_PENDSVSET ((uint32_t)0x10000000) /*!< Set pending pendSV bit */
+#define SCB_ICSR_NMIPENDSET ((uint32_t)0x80000000) /*!< Set pending NMI bit */
+
+/******************* Bit definition for SCB_VTOR register *******************/
+#define SCB_VTOR_TBLOFF ((uint32_t)0x1FFFFF80) /*!< Vector table base offset field */
+#define SCB_VTOR_TBLBASE ((uint32_t)0x20000000) /*!< Table base in code(0) or RAM(1) */
+
+/******************* Bit definition for SCB_AIRCR register *******************/
+#define SCB_AIRCR_VECTRESET ((uint32_t)0x00000001) /*!< System Reset bit */
+#define SCB_AIRCR_VECTCLRACTIVE ((uint32_t)0x00000002) /*!< Clear active vector bit */
+#define SCB_AIRCR_SYSRESETREQ ((uint32_t)0x00000004) /*!< Requests chip control logic to generate a reset */
+
+#define SCB_AIRCR_PRIGROUP ((uint32_t)0x00000700) /*!< PRIGROUP[2:0] bits (Priority group) */
+#define SCB_AIRCR_PRIGROUP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define SCB_AIRCR_PRIGROUP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define SCB_AIRCR_PRIGROUP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+
+/* prority group configuration */
+#define SCB_AIRCR_PRIGROUP0 ((uint32_t)0x00000000) /*!< Priority group=0 (7 bits of pre-emption priority, 1 bit of subpriority) */
+#define SCB_AIRCR_PRIGROUP1 ((uint32_t)0x00000100) /*!< Priority group=1 (6 bits of pre-emption priority, 2 bits of subpriority) */
+#define SCB_AIRCR_PRIGROUP2 ((uint32_t)0x00000200) /*!< Priority group=2 (5 bits of pre-emption priority, 3 bits of subpriority) */
+#define SCB_AIRCR_PRIGROUP3 ((uint32_t)0x00000300) /*!< Priority group=3 (4 bits of pre-emption priority, 4 bits of subpriority) */
+#define SCB_AIRCR_PRIGROUP4 ((uint32_t)0x00000400) /*!< Priority group=4 (3 bits of pre-emption priority, 5 bits of subpriority) */
+#define SCB_AIRCR_PRIGROUP5 ((uint32_t)0x00000500) /*!< Priority group=5 (2 bits of pre-emption priority, 6 bits of subpriority) */
+#define SCB_AIRCR_PRIGROUP6 ((uint32_t)0x00000600) /*!< Priority group=6 (1 bit of pre-emption priority, 7 bits of subpriority) */
+#define SCB_AIRCR_PRIGROUP7 ((uint32_t)0x00000700) /*!< Priority group=7 (no pre-emption priority, 8 bits of subpriority) */
+
+#define SCB_AIRCR_ENDIANESS ((uint32_t)0x00008000) /*!< Data endianness bit */
+#define SCB_AIRCR_VECTKEY ((uint32_t)0xFFFF0000) /*!< Register key (VECTKEY) - Reads as 0xFA05 (VECTKEYSTAT) */
+
+/******************* Bit definition for SCB_SCR register ********************/
+#define SCB_SCR_SLEEPONEXIT ((uint8_t)0x02) /*!< Sleep on exit bit */
+#define SCB_SCR_SLEEPDEEP ((uint8_t)0x04) /*!< Sleep deep bit */
+#define SCB_SCR_SEVONPEND ((uint8_t)0x10) /*!< Wake up from WFE */
+
+/******************** Bit definition for SCB_CCR register *******************/
+#define SCB_CCR_NONBASETHRDENA ((uint16_t)0x0001) /*!< Thread mode can be entered from any level in Handler mode by controlled return value */
+#define SCB_CCR_USERSETMPEND ((uint16_t)0x0002) /*!< Enables user code to write the Software Trigger Interrupt register to trigger (pend) a Main exception */
+#define SCB_CCR_UNALIGN_TRP ((uint16_t)0x0008) /*!< Trap for unaligned access */
+#define SCB_CCR_DIV_0_TRP ((uint16_t)0x0010) /*!< Trap on Divide by 0 */
+#define SCB_CCR_BFHFNMIGN ((uint16_t)0x0100) /*!< Handlers running at priority -1 and -2 */
+#define SCB_CCR_STKALIGN ((uint16_t)0x0200) /*!< On exception entry, the SP used prior to the exception is adjusted to be 8-byte aligned */
+
+/******************* Bit definition for SCB_SHPR register ********************/
+#define SCB_SHPR_PRI_N ((uint32_t)0x000000FF) /*!< Priority of system handler 4,8, and 12. Mem Manage, reserved and Debug Monitor */
+#define SCB_SHPR_PRI_N1 ((uint32_t)0x0000FF00) /*!< Priority of system handler 5,9, and 13. Bus Fault, reserved and reserved */
+#define SCB_SHPR_PRI_N2 ((uint32_t)0x00FF0000) /*!< Priority of system handler 6,10, and 14. Usage Fault, reserved and PendSV */
+#define SCB_SHPR_PRI_N3 ((uint32_t)0xFF000000) /*!< Priority of system handler 7,11, and 15. Reserved, SVCall and SysTick */
+
+/****************** Bit definition for SCB_SHCSR register *******************/
+#define SCB_SHCSR_MEMFAULTACT ((uint32_t)0x00000001) /*!< MemManage is active */
+#define SCB_SHCSR_BUSFAULTACT ((uint32_t)0x00000002) /*!< BusFault is active */
+#define SCB_SHCSR_USGFAULTACT ((uint32_t)0x00000008) /*!< UsageFault is active */
+#define SCB_SHCSR_SVCALLACT ((uint32_t)0x00000080) /*!< SVCall is active */
+#define SCB_SHCSR_MONITORACT ((uint32_t)0x00000100) /*!< Monitor is active */
+#define SCB_SHCSR_PENDSVACT ((uint32_t)0x00000400) /*!< PendSV is active */
+#define SCB_SHCSR_SYSTICKACT ((uint32_t)0x00000800) /*!< SysTick is active */
+#define SCB_SHCSR_USGFAULTPENDED ((uint32_t)0x00001000) /*!< Usage Fault is pended */
+#define SCB_SHCSR_MEMFAULTPENDED ((uint32_t)0x00002000) /*!< MemManage is pended */
+#define SCB_SHCSR_BUSFAULTPENDED ((uint32_t)0x00004000) /*!< Bus Fault is pended */
+#define SCB_SHCSR_SVCALLPENDED ((uint32_t)0x00008000) /*!< SVCall is pended */
+#define SCB_SHCSR_MEMFAULTENA ((uint32_t)0x00010000) /*!< MemManage enable */
+#define SCB_SHCSR_BUSFAULTENA ((uint32_t)0x00020000) /*!< Bus Fault enable */
+#define SCB_SHCSR_USGFAULTENA ((uint32_t)0x00040000) /*!< UsageFault enable */
+
+/******************* Bit definition for SCB_CFSR register *******************/
+/** MFSR */
+#define SCB_CFSR_IACCVIOL ((uint32_t)0x00000001) /*!< Instruction access violation */
+#define SCB_CFSR_DACCVIOL ((uint32_t)0x00000002) /*!< Data access violation */
+#define SCB_CFSR_MUNSTKERR ((uint32_t)0x00000008) /*!< Unstacking error */
+#define SCB_CFSR_MSTKERR ((uint32_t)0x00000010) /*!< Stacking error */
+#define SCB_CFSR_MMARVALID ((uint32_t)0x00000080) /*!< Memory Manage Address Register address valid flag */
+/** BFSR */
+#define SCB_CFSR_IBUSERR ((uint32_t)0x00000100) /*!< Instruction bus error flag */
+#define SCB_CFSR_PRECISERR ((uint32_t)0x00000200) /*!< Precise data bus error */
+#define SCB_CFSR_IMPRECISERR ((uint32_t)0x00000400) /*!< Imprecise data bus error */
+#define SCB_CFSR_UNSTKERR ((uint32_t)0x00000800) /*!< Unstacking error */
+#define SCB_CFSR_STKERR ((uint32_t)0x00001000) /*!< Stacking error */
+#define SCB_CFSR_BFARVALID ((uint32_t)0x00008000) /*!< Bus Fault Address Register address valid flag */
+/** UFSR */
+#define SCB_CFSR_UNDEFINSTR ((uint32_t)0x00010000) /*!< The processor attempt to execute an undefined instruction */
+#define SCB_CFSR_INVSTATE ((uint32_t)0x00020000) /*!< Invalid combination of EPSR and instruction */
+#define SCB_CFSR_INVPC ((uint32_t)0x00040000) /*!< Attempt to load EXC_RETURN into pc illegally */
+#define SCB_CFSR_NOCP ((uint32_t)0x00080000) /*!< Attempt to use a coprocessor instruction */
+#define SCB_CFSR_UNALIGNED ((uint32_t)0x01000000) /*!< Fault occurs when there is an attempt to make an unaligned memory access */
+#define SCB_CFSR_DIVBYZERO ((uint32_t)0x02000000) /*!< Fault occurs when SDIV or DIV instruction is used with a divisor of 0 */
+
+/******************* Bit definition for SCB_HFSR register *******************/
+#define SCB_HFSR_VECTTBL ((uint32_t)0x00000002) /*!< Fault occurs because of vector table read on exception processing */
+#define SCB_HFSR_FORCED ((uint32_t)0x40000000) /*!< Hard Fault activated when a configurable Fault was received and cannot activate */
+#define SCB_HFSR_DEBUGEVT ((uint32_t)0x80000000) /*!< Fault related to debug */
+
+/******************* Bit definition for SCB_DFSR register *******************/
+#define SCB_DFSR_HALTED ((uint8_t)0x01) /*!< Halt request flag */
+#define SCB_DFSR_BKPT ((uint8_t)0x02) /*!< BKPT flag */
+#define SCB_DFSR_DWTTRAP ((uint8_t)0x04) /*!< Data Watchpoint and Trace (DWT) flag */
+#define SCB_DFSR_VCATCH ((uint8_t)0x08) /*!< Vector catch flag */
+#define SCB_DFSR_EXTERNAL ((uint8_t)0x10) /*!< External debug request flag */
+
+/******************* Bit definition for SCB_MMFAR register ******************/
+#define SCB_MMFAR_ADDRESS ((uint32_t)0xFFFFFFFF) /*!< Mem Manage fault address field */
+
+/******************* Bit definition for SCB_BFAR register *******************/
+#define SCB_BFAR_ADDRESS ((uint32_t)0xFFFFFFFF) /*!< Bus fault address field */
+
+/******************* Bit definition for SCB_AFSR register *******************/
+#define SCB_AFSR_IMPDEF ((uint32_t)0xFFFFFFFF) /*!< Implementation defined */
+
+/******************************************************************************/
+/* */
+/* External Interrupt/Event Controller */
+/* */
+/******************************************************************************/
+
+/******************* Bit definition for EXTI_INTEN register *******************/
+#define EXTI_INTEN_LN0 ((uint32_t)0x00000001) /*!< Interrupt Mask on line 0 */
+#define EXTI_INTEN_LN1 ((uint32_t)0x00000002) /*!< Interrupt Mask on line 1 */
+#define EXTI_INTEN_LN2 ((uint32_t)0x00000004) /*!< Interrupt Mask on line 2 */
+#define EXTI_INTEN_LN3 ((uint32_t)0x00000008) /*!< Interrupt Mask on line 3 */
+#define EXTI_INTEN_LN4 ((uint32_t)0x00000010) /*!< Interrupt Mask on line 4 */
+#define EXTI_INTEN_LN5 ((uint32_t)0x00000020) /*!< Interrupt Mask on line 5 */
+#define EXTI_INTEN_LN6 ((uint32_t)0x00000040) /*!< Interrupt Mask on line 6 */
+#define EXTI_INTEN_LN7 ((uint32_t)0x00000080) /*!< Interrupt Mask on line 7 */
+#define EXTI_INTEN_LN8 ((uint32_t)0x00000100) /*!< Interrupt Mask on line 8 */
+#define EXTI_INTEN_LN9 ((uint32_t)0x00000200) /*!< Interrupt Mask on line 9 */
+#define EXTI_INTEN_LN10 ((uint32_t)0x00000400) /*!< Interrupt Mask on line 10 */
+#define EXTI_INTEN_LN11 ((uint32_t)0x00000800) /*!< Interrupt Mask on line 11 */
+#define EXTI_INTEN_LN12 ((uint32_t)0x00001000) /*!< Interrupt Mask on line 12 */
+#define EXTI_INTEN_LN13 ((uint32_t)0x00002000) /*!< Interrupt Mask on line 13 */
+#define EXTI_INTEN_LN14 ((uint32_t)0x00004000) /*!< Interrupt Mask on line 14 */
+#define EXTI_INTEN_LN15 ((uint32_t)0x00008000) /*!< Interrupt Mask on line 15 */
+#define EXTI_INTEN_LN16 ((uint32_t)0x00010000) /*!< Interrupt Mask on line 16 */
+#define EXTI_INTEN_LN17 ((uint32_t)0x00020000) /*!< Interrupt Mask on line 17 */
+#define EXTI_INTEN_LN18 ((uint32_t)0x00040000) /*!< Interrupt Mask on line 18 */
+#define EXTI_INTEN_LN19 ((uint32_t)0x00080000) /*!< Interrupt Mask on line 19 */
+
+/******************* Bit definition for EXTI_EVTEN register *******************/
+#define EXTI_EVTEN_LN0 ((uint32_t)0x00000001) /*!< Event Mask on line 0 */
+#define EXTI_EVTEN_LN1 ((uint32_t)0x00000002) /*!< Event Mask on line 1 */
+#define EXTI_EVTEN_LN2 ((uint32_t)0x00000004) /*!< Event Mask on line 2 */
+#define EXTI_EVTEN_LN3 ((uint32_t)0x00000008) /*!< Event Mask on line 3 */
+#define EXTI_EVTEN_LN4 ((uint32_t)0x00000010) /*!< Event Mask on line 4 */
+#define EXTI_EVTEN_LN5 ((uint32_t)0x00000020) /*!< Event Mask on line 5 */
+#define EXTI_EVTEN_LN6 ((uint32_t)0x00000040) /*!< Event Mask on line 6 */
+#define EXTI_EVTEN_LN7 ((uint32_t)0x00000080) /*!< Event Mask on line 7 */
+#define EXTI_EVTEN_LN8 ((uint32_t)0x00000100) /*!< Event Mask on line 8 */
+#define EXTI_EVTEN_LN9 ((uint32_t)0x00000200) /*!< Event Mask on line 9 */
+#define EXTI_EVTEN_LN10 ((uint32_t)0x00000400) /*!< Event Mask on line 10 */
+#define EXTI_EVTEN_LN11 ((uint32_t)0x00000800) /*!< Event Mask on line 11 */
+#define EXTI_EVTEN_LN12 ((uint32_t)0x00001000) /*!< Event Mask on line 12 */
+#define EXTI_EVTEN_LN13 ((uint32_t)0x00002000) /*!< Event Mask on line 13 */
+#define EXTI_EVTEN_LN14 ((uint32_t)0x00004000) /*!< Event Mask on line 14 */
+#define EXTI_EVTEN_LN15 ((uint32_t)0x00008000) /*!< Event Mask on line 15 */
+#define EXTI_EVTEN_LN16 ((uint32_t)0x00010000) /*!< Event Mask on line 16 */
+#define EXTI_EVTEN_LN17 ((uint32_t)0x00020000) /*!< Event Mask on line 17 */
+#define EXTI_EVTEN_LN18 ((uint32_t)0x00040000) /*!< Event Mask on line 18 */
+#define EXTI_EVTEN_LN19 ((uint32_t)0x00080000) /*!< Event Mask on line 19 */
+
+/****************** Bit definition for EXTI_RTRSEL register *******************/
+#define EXTI_RTRSEL_LN0 ((uint32_t)0x00000001) /*!< Rising trigger event configuration bit of line 0 */
+#define EXTI_RTRSEL_LN1 ((uint32_t)0x00000002) /*!< Rising trigger event configuration bit of line 1 */
+#define EXTI_RTRSEL_LN2 ((uint32_t)0x00000004) /*!< Rising trigger event configuration bit of line 2 */
+#define EXTI_RTRSEL_LN3 ((uint32_t)0x00000008) /*!< Rising trigger event configuration bit of line 3 */
+#define EXTI_RTRSEL_LN4 ((uint32_t)0x00000010) /*!< Rising trigger event configuration bit of line 4 */
+#define EXTI_RTRSEL_LN5 ((uint32_t)0x00000020) /*!< Rising trigger event configuration bit of line 5 */
+#define EXTI_RTRSEL_LN6 ((uint32_t)0x00000040) /*!< Rising trigger event configuration bit of line 6 */
+#define EXTI_RTRSEL_LN7 ((uint32_t)0x00000080) /*!< Rising trigger event configuration bit of line 7 */
+#define EXTI_RTRSEL_LN8 ((uint32_t)0x00000100) /*!< Rising trigger event configuration bit of line 8 */
+#define EXTI_RTRSEL_LN9 ((uint32_t)0x00000200) /*!< Rising trigger event configuration bit of line 9 */
+#define EXTI_RTRSEL_LN10 ((uint32_t)0x00000400) /*!< Rising trigger event configuration bit of line 10 */
+#define EXTI_RTRSEL_LN11 ((uint32_t)0x00000800) /*!< Rising trigger event configuration bit of line 11 */
+#define EXTI_RTRSEL_LN12 ((uint32_t)0x00001000) /*!< Rising trigger event configuration bit of line 12 */
+#define EXTI_RTRSEL_LN13 ((uint32_t)0x00002000) /*!< Rising trigger event configuration bit of line 13 */
+#define EXTI_RTRSEL_LN14 ((uint32_t)0x00004000) /*!< Rising trigger event configuration bit of line 14 */
+#define EXTI_RTRSEL_LN15 ((uint32_t)0x00008000) /*!< Rising trigger event configuration bit of line 15 */
+#define EXTI_RTRSEL_LN16 ((uint32_t)0x00010000) /*!< Rising trigger event configuration bit of line 16 */
+#define EXTI_RTRSEL_LN17 ((uint32_t)0x00020000) /*!< Rising trigger event configuration bit of line 17 */
+#define EXTI_RTRSEL_LN18 ((uint32_t)0x00040000) /*!< Rising trigger event configuration bit of line 18 */
+#define EXTI_RTRSEL_LN19 ((uint32_t)0x00080000) /*!< Rising trigger event configuration bit of line 19 */
+
+/****************** Bit definition for EXTI_FTRSEL register *******************/
+#define EXTI_FTRSEL_LN0 ((uint32_t)0x00000001) /*!< Falling trigger event configuration bit of line 0 */
+#define EXTI_FTRSEL_LN1 ((uint32_t)0x00000002) /*!< Falling trigger event configuration bit of line 1 */
+#define EXTI_FTRSEL_LN2 ((uint32_t)0x00000004) /*!< Falling trigger event configuration bit of line 2 */
+#define EXTI_FTRSEL_LN3 ((uint32_t)0x00000008) /*!< Falling trigger event configuration bit of line 3 */
+#define EXTI_FTRSEL_LN4 ((uint32_t)0x00000010) /*!< Falling trigger event configuration bit of line 4 */
+#define EXTI_FTRSEL_LN5 ((uint32_t)0x00000020) /*!< Falling trigger event configuration bit of line 5 */
+#define EXTI_FTRSEL_LN6 ((uint32_t)0x00000040) /*!< Falling trigger event configuration bit of line 6 */
+#define EXTI_FTRSEL_LN7 ((uint32_t)0x00000080) /*!< Falling trigger event configuration bit of line 7 */
+#define EXTI_FTRSEL_LN8 ((uint32_t)0x00000100) /*!< Falling trigger event configuration bit of line 8 */
+#define EXTI_FTRSEL_LN9 ((uint32_t)0x00000200) /*!< Falling trigger event configuration bit of line 9 */
+#define EXTI_FTRSEL_LN10 ((uint32_t)0x00000400) /*!< Falling trigger event configuration bit of line 10 */
+#define EXTI_FTRSEL_LN11 ((uint32_t)0x00000800) /*!< Falling trigger event configuration bit of line 11 */
+#define EXTI_FTRSEL_LN12 ((uint32_t)0x00001000) /*!< Falling trigger event configuration bit of line 12 */
+#define EXTI_FTRSEL_LN13 ((uint32_t)0x00002000) /*!< Falling trigger event configuration bit of line 13 */
+#define EXTI_FTRSEL_LN14 ((uint32_t)0x00004000) /*!< Falling trigger event configuration bit of line 14 */
+#define EXTI_FTRSEL_LN15 ((uint32_t)0x00008000) /*!< Falling trigger event configuration bit of line 15 */
+#define EXTI_FTRSEL_LN16 ((uint32_t)0x00010000) /*!< Falling trigger event configuration bit of line 16 */
+#define EXTI_FTRSEL_LN17 ((uint32_t)0x00020000) /*!< Falling trigger event configuration bit of line 17 */
+#define EXTI_FTRSEL_LN18 ((uint32_t)0x00040000) /*!< Falling trigger event configuration bit of line 18 */
+#define EXTI_FTRSEL_LN19 ((uint32_t)0x00080000) /*!< Falling trigger event configuration bit of line 19 */
+
+/****************** Bit definition for EXTI_SWIE register ******************/
+#define EXTI_SWIE_LN0 ((uint32_t)0x00000001) /*!< Software Interrupt on line 0 */
+#define EXTI_SWIE_LN1 ((uint32_t)0x00000002) /*!< Software Interrupt on line 1 */
+#define EXTI_SWIE_LN2 ((uint32_t)0x00000004) /*!< Software Interrupt on line 2 */
+#define EXTI_SWIE_LN3 ((uint32_t)0x00000008) /*!< Software Interrupt on line 3 */
+#define EXTI_SWIE_LN4 ((uint32_t)0x00000010) /*!< Software Interrupt on line 4 */
+#define EXTI_SWIE_LN5 ((uint32_t)0x00000020) /*!< Software Interrupt on line 5 */
+#define EXTI_SWIE_LN6 ((uint32_t)0x00000040) /*!< Software Interrupt on line 6 */
+#define EXTI_SWIE_LN7 ((uint32_t)0x00000080) /*!< Software Interrupt on line 7 */
+#define EXTI_SWIE_LN8 ((uint32_t)0x00000100) /*!< Software Interrupt on line 8 */
+#define EXTI_SWIE_LN9 ((uint32_t)0x00000200) /*!< Software Interrupt on line 9 */
+#define EXTI_SWIE_LN10 ((uint32_t)0x00000400) /*!< Software Interrupt on line 10 */
+#define EXTI_SWIE_LN11 ((uint32_t)0x00000800) /*!< Software Interrupt on line 11 */
+#define EXTI_SWIE_LN12 ((uint32_t)0x00001000) /*!< Software Interrupt on line 12 */
+#define EXTI_SWIE_LN13 ((uint32_t)0x00002000) /*!< Software Interrupt on line 13 */
+#define EXTI_SWIE_LN14 ((uint32_t)0x00004000) /*!< Software Interrupt on line 14 */
+#define EXTI_SWIE_LN15 ((uint32_t)0x00008000) /*!< Software Interrupt on line 15 */
+#define EXTI_SWIE_LN16 ((uint32_t)0x00010000) /*!< Software Interrupt on line 16 */
+#define EXTI_SWIE_LN17 ((uint32_t)0x00020000) /*!< Software Interrupt on line 17 */
+#define EXTI_SWIE_LN18 ((uint32_t)0x00040000) /*!< Software Interrupt on line 18 */
+#define EXTI_SWIE_LN19 ((uint32_t)0x00080000) /*!< Software Interrupt on line 19 */
+
+/******************* Bit definition for EXTI_PND register ********************/
+#define EXTI_PND_LN0 ((uint32_t)0x00000001) /*!< Pending bit for line 0 */
+#define EXTI_PND_LN1 ((uint32_t)0x00000002) /*!< Pending bit for line 1 */
+#define EXTI_PND_LN2 ((uint32_t)0x00000004) /*!< Pending bit for line 2 */
+#define EXTI_PND_LN3 ((uint32_t)0x00000008) /*!< Pending bit for line 3 */
+#define EXTI_PND_LN4 ((uint32_t)0x00000010) /*!< Pending bit for line 4 */
+#define EXTI_PND_LN5 ((uint32_t)0x00000020) /*!< Pending bit for line 5 */
+#define EXTI_PND_LN6 ((uint32_t)0x00000040) /*!< Pending bit for line 6 */
+#define EXTI_PND_LN7 ((uint32_t)0x00000080) /*!< Pending bit for line 7 */
+#define EXTI_PND_LN8 ((uint32_t)0x00000100) /*!< Pending bit for line 8 */
+#define EXTI_PND_LN9 ((uint32_t)0x00000200) /*!< Pending bit for line 9 */
+#define EXTI_PND_LN10 ((uint32_t)0x00000400) /*!< Pending bit for line 10 */
+#define EXTI_PND_LN11 ((uint32_t)0x00000800) /*!< Pending bit for line 11 */
+#define EXTI_PND_LN12 ((uint32_t)0x00001000) /*!< Pending bit for line 12 */
+#define EXTI_PND_LN13 ((uint32_t)0x00002000) /*!< Pending bit for line 13 */
+#define EXTI_PND_LN14 ((uint32_t)0x00004000) /*!< Pending bit for line 14 */
+#define EXTI_PND_LN15 ((uint32_t)0x00008000) /*!< Pending bit for line 15 */
+#define EXTI_PND_LN16 ((uint32_t)0x00010000) /*!< Pending bit for line 16 */
+#define EXTI_PND_LN17 ((uint32_t)0x00020000) /*!< Pending bit for line 17 */
+#define EXTI_PND_LN18 ((uint32_t)0x00040000) /*!< Pending bit for line 18 */
+#define EXTI_PND_LN19 ((uint32_t)0x00080000) /*!< Pending bit for line 19 */
+
+/******************************************************************************/
+/* */
+/* DMA Controller */
+/* */
+/******************************************************************************/
+
+/******************* Bit definition for DMA_ISTS register ********************/
+#define DMA_ISTS_GIF1 ((uint32_t)0x00000001) /*!< Channel 1 Global interrupt flag */
+#define DMA_ISTS_TCIF1 ((uint32_t)0x00000002) /*!< Channel 1 Transfer Complete flag */
+#define DMA_ISTS_HTIF1 ((uint32_t)0x00000004) /*!< Channel 1 Half Transfer flag */
+#define DMA_ISTS_ERRIF1 ((uint32_t)0x00000008) /*!< Channel 1 Transfer Error flag */
+#define DMA_ISTS_GIF2 ((uint32_t)0x00000010) /*!< Channel 2 Global interrupt flag */
+#define DMA_ISTS_TCIF2 ((uint32_t)0x00000020) /*!< Channel 2 Transfer Complete flag */
+#define DMA_ISTS_HTIF2 ((uint32_t)0x00000040) /*!< Channel 2 Half Transfer flag */
+#define DMA_ISTS_ERRIF2 ((uint32_t)0x00000080) /*!< Channel 2 Transfer Error flag */
+#define DMA_ISTS_GIF3 ((uint32_t)0x00000100) /*!< Channel 3 Global interrupt flag */
+#define DMA_ISTS_TCIF3 ((uint32_t)0x00000200) /*!< Channel 3 Transfer Complete flag */
+#define DMA_ISTS_HTIF3 ((uint32_t)0x00000400) /*!< Channel 3 Half Transfer flag */
+#define DMA_ISTS_ERRIF3 ((uint32_t)0x00000800) /*!< Channel 3 Transfer Error flag */
+#define DMA_ISTS_GIF4 ((uint32_t)0x00001000) /*!< Channel 4 Global interrupt flag */
+#define DMA_ISTS_TCIF4 ((uint32_t)0x00002000) /*!< Channel 4 Transfer Complete flag */
+#define DMA_ISTS_HTIF4 ((uint32_t)0x00004000) /*!< Channel 4 Half Transfer flag */
+#define DMA_ISTS_ERRIF4 ((uint32_t)0x00008000) /*!< Channel 4 Transfer Error flag */
+#define DMA_ISTS_GIF5 ((uint32_t)0x00010000) /*!< Channel 5 Global interrupt flag */
+#define DMA_ISTS_TCIF5 ((uint32_t)0x00020000) /*!< Channel 5 Transfer Complete flag */
+#define DMA_ISTS_HTIF5 ((uint32_t)0x00040000) /*!< Channel 5 Half Transfer flag */
+#define DMA_ISTS_ERRIF5 ((uint32_t)0x00080000) /*!< Channel 5 Transfer Error flag */
+#define DMA_ISTS_GIF6 ((uint32_t)0x00100000) /*!< Channel 6 Global interrupt flag */
+#define DMA_ISTS_TCIF6 ((uint32_t)0x00200000) /*!< Channel 6 Transfer Complete flag */
+#define DMA_ISTS_HTIF6 ((uint32_t)0x00400000) /*!< Channel 6 Half Transfer flag */
+#define DMA_ISTS_ERRIF6 ((uint32_t)0x00800000) /*!< Channel 6 Transfer Error flag */
+#define DMA_ISTS_GIF7 ((uint32_t)0x01000000) /*!< Channel 7 Global interrupt flag */
+#define DMA_ISTS_TCIF7 ((uint32_t)0x02000000) /*!< Channel 7 Transfer Complete flag */
+#define DMA_ISTS_HTIF7 ((uint32_t)0x04000000) /*!< Channel 7 Half Transfer flag */
+#define DMA_ISTS_ERRIF7 ((uint32_t)0x08000000) /*!< Channel 7 Transfer Error flag */
+
+/******************* Bit definition for DMA_ICLR register *******************/
+#define DMA_ICLR_CGIF1 ((uint32_t)0x00000001) /*!< Channel 1 Global interrupt clear */
+#define DMA_ICLR_CTCIF1 ((uint32_t)0x00000002) /*!< Channel 1 Transfer Complete clear */
+#define DMA_ICLR_CHTIF1 ((uint32_t)0x00000004) /*!< Channel 1 Half Transfer clear */
+#define DMA_ICLR_CERRIF1 ((uint32_t)0x00000008) /*!< Channel 1 Transfer Error clear */
+#define DMA_ICLR_CGIF2 ((uint32_t)0x00000010) /*!< Channel 2 Global interrupt clear */
+#define DMA_ICLR_CTCIF2 ((uint32_t)0x00000020) /*!< Channel 2 Transfer Complete clear */
+#define DMA_ICLR_CHTIF2 ((uint32_t)0x00000040) /*!< Channel 2 Half Transfer clear */
+#define DMA_ICLR_CERRIF2 ((uint32_t)0x00000080) /*!< Channel 2 Transfer Error clear */
+#define DMA_ICLR_CGIF3 ((uint32_t)0x00000100) /*!< Channel 3 Global interrupt clear */
+#define DMA_ICLR_CTCIF3 ((uint32_t)0x00000200) /*!< Channel 3 Transfer Complete clear */
+#define DMA_ICLR_CHTIF3 ((uint32_t)0x00000400) /*!< Channel 3 Half Transfer clear */
+#define DMA_ICLR_CERRIF3 ((uint32_t)0x00000800) /*!< Channel 3 Transfer Error clear */
+#define DMA_ICLR_CGIF4 ((uint32_t)0x00001000) /*!< Channel 4 Global interrupt clear */
+#define DMA_ICLR_CTCIF4 ((uint32_t)0x00002000) /*!< Channel 4 Transfer Complete clear */
+#define DMA_ICLR_CHTIF4 ((uint32_t)0x00004000) /*!< Channel 4 Half Transfer clear */
+#define DMA_ICLR_CERRIF4 ((uint32_t)0x00008000) /*!< Channel 4 Transfer Error clear */
+#define DMA_ICLR_CGIF5 ((uint32_t)0x00010000) /*!< Channel 5 Global interrupt clear */
+#define DMA_ICLR_CTCIF5 ((uint32_t)0x00020000) /*!< Channel 5 Transfer Complete clear */
+#define DMA_ICLR_CHTIF5 ((uint32_t)0x00040000) /*!< Channel 5 Half Transfer clear */
+#define DMA_ICLR_CERRIF5 ((uint32_t)0x00080000) /*!< Channel 5 Transfer Error clear */
+#define DMA_ICLR_CGIF6 ((uint32_t)0x00100000) /*!< Channel 6 Global interrupt clear */
+#define DMA_ICLR_CTCIF6 ((uint32_t)0x00200000) /*!< Channel 6 Transfer Complete clear */
+#define DMA_ICLR_CHTIF6 ((uint32_t)0x00400000) /*!< Channel 6 Half Transfer clear */
+#define DMA_ICLR_CERRIF6 ((uint32_t)0x00800000) /*!< Channel 6 Transfer Error clear */
+#define DMA_ICLR_CGIF7 ((uint32_t)0x01000000) /*!< Channel 7 Global interrupt clear */
+#define DMA_ICLR_CTCIF7 ((uint32_t)0x02000000) /*!< Channel 7 Transfer Complete clear */
+#define DMA_ICLR_CHTIF7 ((uint32_t)0x04000000) /*!< Channel 7 Half Transfer clear */
+#define DMA_ICLR_CERRIF7 ((uint32_t)0x08000000) /*!< Channel 7 Transfer Error clear */
+
+/******************* Bit definition for DMA_CHCTRL1 register *******************/
+#define DMA_CHCTRL1_CHEN ((uint16_t)0x0001) /*!< Channel enable*/
+#define DMA_CHCTRL1_TCIE ((uint16_t)0x0002) /*!< Transfer complete interrupt enable */
+#define DMA_CHCTRL1_HTIE ((uint16_t)0x0004) /*!< Half Transfer interrupt enable */
+#define DMA_CHCTRL1_ERRIE ((uint16_t)0x0008) /*!< Transfer error interrupt enable */
+#define DMA_CHCTRL1_DIR ((uint16_t)0x0010) /*!< Data transfer direction */
+#define DMA_CHCTRL1_CIRM ((uint16_t)0x0020) /*!< Circular mode */
+#define DMA_CHCTRL1_PINC ((uint16_t)0x0040) /*!< Peripheral increment mode */
+#define DMA_CHCTRL1_MINC ((uint16_t)0x0080) /*!< Memory increment mode */
+
+#define DMA_CHCTRL1_PWIDTH ((uint16_t)0x0300) /*!< PSIZE[1:0] bits (Peripheral size) */
+#define DMA_CHCTRL1_PWIDTH_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define DMA_CHCTRL1_PWIDTH_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define DMA_CHCTRL1_MWIDTH ((uint16_t)0x0C00) /*!< MSIZE[1:0] bits (Memory size) */
+#define DMA_CHCTRL1_MWIDTH_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define DMA_CHCTRL1_MWIDTH_1 ((uint16_t)0x0800) /*!< Bit 1 */
+
+#define DMA_CHCTRL1_CHPL ((uint16_t)0x3000) /*!< PL[1:0] bits(Channel Priority level) */
+#define DMA_CHCTRL1_CHPL_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define DMA_CHCTRL1_CHPL_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define DMA_CHCTRL1_MEMTOMEM ((uint16_t)0x4000) /*!< Memory to memory mode */
+
+/******************* Bit definition for DMA_CHCTRL2 register *******************/
+#define DMA_CHCTRL2_CHEN ((uint16_t)0x0001) /*!< Channel enable */
+#define DMA_CHCTRL2_TCIE ((uint16_t)0x0002) /*!< Transfer complete interrupt enable */
+#define DMA_CHCTRL2_HTIE ((uint16_t)0x0004) /*!< Half Transfer interrupt enable */
+#define DMA_CHCTRL2_ERRIE ((uint16_t)0x0008) /*!< Transfer error interrupt enable */
+#define DMA_CHCTRL2_DIR ((uint16_t)0x0010) /*!< Data transfer direction */
+#define DMA_CHCTRL2_CIRM ((uint16_t)0x0020) /*!< Circular mode */
+#define DMA_CHCTRL2_PINC ((uint16_t)0x0040) /*!< Peripheral increment mode */
+#define DMA_CHCTRL2_MINC ((uint16_t)0x0080) /*!< Memory increment mode */
+
+#define DMA_CHCTRL2_PWIDTH ((uint16_t)0x0300) /*!< PSIZE[1:0] bits (Peripheral size) */
+#define DMA_CHCTRL2_PWIDTH_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define DMA_CHCTRL2_PWIDTH_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define DMA_CHCTRL2_MWIDTH ((uint16_t)0x0C00) /*!< MSIZE[1:0] bits (Memory size) */
+#define DMA_CHCTRL2_MWIDTH_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define DMA_CHCTRL2_MWIDTH_1 ((uint16_t)0x0800) /*!< Bit 1 */
+
+#define DMA_CHCTRL2_CHPL ((uint16_t)0x3000) /*!< PL[1:0] bits (Channel Priority level) */
+#define DMA_CHCTRL2_CHPL_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define DMA_CHCTRL2_CHPL_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define DMA_CHCTRL2_MEMTOMEM ((uint16_t)0x4000) /*!< Memory to memory mode */
+
+/******************* Bit definition for DMA_CHCTRL3 register *******************/
+#define DMA_CHCTRL3_CHEN ((uint16_t)0x0001) /*!< Channel enable */
+#define DMA_CHCTRL3_TCIE ((uint16_t)0x0002) /*!< Transfer complete interrupt enable */
+#define DMA_CHCTRL3_HTIE ((uint16_t)0x0004) /*!< Half Transfer interrupt enable */
+#define DMA_CHCTRL3_ERRIE ((uint16_t)0x0008) /*!< Transfer error interrupt enable */
+#define DMA_CHCTRL3_DIR ((uint16_t)0x0010) /*!< Data transfer direction */
+#define DMA_CHCTRL3_CIRM ((uint16_t)0x0020) /*!< Circular mode */
+#define DMA_CHCTRL3_PINC ((uint16_t)0x0040) /*!< Peripheral increment mode */
+#define DMA_CHCTRL3_MINC ((uint16_t)0x0080) /*!< Memory increment mode */
+
+#define DMA_CHCTRL3_PWIDTH ((uint16_t)0x0300) /*!< PSIZE[1:0] bits (Peripheral size) */
+#define DMA_CHCTRL3_PWIDTH_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define DMA_CHCTRL3_PWIDTH_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define DMA_CHCTRL3_MWIDTH ((uint16_t)0x0C00) /*!< MSIZE[1:0] bits (Memory size) */
+#define DMA_CHCTRL3_MWIDTH_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define DMA_CHCTRL3_MWIDTH_1 ((uint16_t)0x0800) /*!< Bit 1 */
+
+#define DMA_CHCTRL3_CHPL ((uint16_t)0x3000) /*!< PL[1:0] bits (Channel Priority level) */
+#define DMA_CHCTRL3_CHPL_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define DMA_CHCTRL3_CHPL_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define DMA_CHCTRL3_MEMTOMEM ((uint16_t)0x4000) /*!< Memory to memory mode */
+
+/******************** Bit definition for DMA_CHCTRL4 register *******************/
+#define DMA_CHCTRL4_CHEN ((uint16_t)0x0001) /*!< Channel enable */
+#define DMA_CHCTRL4_TCIE ((uint16_t)0x0002) /*!< Transfer complete interrupt enable */
+#define DMA_CHCTRL4_HTIE ((uint16_t)0x0004) /*!< Half Transfer interrupt enable */
+#define DMA_CHCTRL4_ERRIE ((uint16_t)0x0008) /*!< Transfer error interrupt enable */
+#define DMA_CHCTRL4_DIR ((uint16_t)0x0010) /*!< Data transfer direction */
+#define DMA_CHCTRL4_CIRM ((uint16_t)0x0020) /*!< Circular mode */
+#define DMA_CHCTRL4_PINC ((uint16_t)0x0040) /*!< Peripheral increment mode */
+#define DMA_CHCTRL4_MINC ((uint16_t)0x0080) /*!< Memory increment mode */
+
+#define DMA_CHCTRL4_PWIDTH ((uint16_t)0x0300) /*!< PSIZE[1:0] bits (Peripheral size) */
+#define DMA_CHCTRL4_PWIDTH_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define DMA_CHCTRL4_PWIDTH_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define DMA_CHCTRL4_MWIDTH ((uint16_t)0x0C00) /*!< MSIZE[1:0] bits (Memory size) */
+#define DMA_CHCTRL4_MWIDTH_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define DMA_CHCTRL4_MWIDTH_1 ((uint16_t)0x0800) /*!< Bit 1 */
+
+#define DMA_CHCTRL4_CHPL ((uint16_t)0x3000) /*!< PL[1:0] bits (Channel Priority level) */
+#define DMA_CHCTRL4_CHPL_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define DMA_CHCTRL4_CHPL_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define DMA_CHCTRL4_MEMTOMEM ((uint16_t)0x4000) /*!< Memory to memory mode */
+
+/****************** Bit definition for DMA_CHCTRL5 register *******************/
+#define DMA_CHCTRL5_CHEN ((uint16_t)0x0001) /*!< Channel enable */
+#define DMA_CHCTRL5_TCIE ((uint16_t)0x0002) /*!< Transfer complete interrupt enable */
+#define DMA_CHCTRL5_HTIE ((uint16_t)0x0004) /*!< Half Transfer interrupt enable */
+#define DMA_CHCTRL5_ERRIE ((uint16_t)0x0008) /*!< Transfer error interrupt enable */
+#define DMA_CHCTRL5_DIR ((uint16_t)0x0010) /*!< Data transfer direction */
+#define DMA_CHCTRL5_CIRM ((uint16_t)0x0020) /*!< Circular mode */
+#define DMA_CHCTRL5_PINC ((uint16_t)0x0040) /*!< Peripheral increment mode */
+#define DMA_CHCTRL5_MINC ((uint16_t)0x0080) /*!< Memory increment mode */
+
+#define DMA_CHCTRL5_PWIDTH ((uint16_t)0x0300) /*!< PSIZE[1:0] bits (Peripheral size) */
+#define DMA_CHCTRL5_PWIDTH_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define DMA_CHCTRL5_PWIDTH_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define DMA_CHCTRL5_MWIDTH ((uint16_t)0x0C00) /*!< MSIZE[1:0] bits (Memory size) */
+#define DMA_CHCTRL5_MWIDTH_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define DMA_CHCTRL5_MWIDTH_1 ((uint16_t)0x0800) /*!< Bit 1 */
+
+#define DMA_CHCTRL5_CHPL ((uint16_t)0x3000) /*!< PL[1:0] bits (Channel Priority level) */
+#define DMA_CHCTRL5_CHPL_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define DMA_CHCTRL5_CHPL_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define DMA_CHCTRL5_MEMTOMEM ((uint16_t)0x4000) /*!< Memory to memory mode enable */
+
+/******************* Bit definition for DMA_CHCTRL6 register *******************/
+#define DMA_CHCTRL6_CHEN ((uint16_t)0x0001) /*!< Channel enable */
+#define DMA_CHCTRL6_TCIE ((uint16_t)0x0002) /*!< Transfer complete interrupt enable */
+#define DMA_CHCTRL6_HTIE ((uint16_t)0x0004) /*!< Half Transfer interrupt enable */
+#define DMA_CHCTRL6_ERRIE ((uint16_t)0x0008) /*!< Transfer error interrupt enable */
+#define DMA_CHCTRL6_DIR ((uint16_t)0x0010) /*!< Data transfer direction */
+#define DMA_CHCTRL6_CIRM ((uint16_t)0x0020) /*!< Circular mode */
+#define DMA_CHCTRL6_PINC ((uint16_t)0x0040) /*!< Peripheral increment mode */
+#define DMA_CHCTRL6_MINC ((uint16_t)0x0080) /*!< Memory increment mode */
+
+#define DMA_CHCTRL6_PWIDTH ((uint16_t)0x0300) /*!< PSIZE[1:0] bits (Peripheral size) */
+#define DMA_CHCTRL6_PWIDTH_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define DMA_CHCTRL6_PWIDTH_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define DMA_CHCTRL6_MWIDTH ((uint16_t)0x0C00) /*!< MSIZE[1:0] bits (Memory size) */
+#define DMA_CHCTRL6_MWIDTH_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define DMA_CHCTRL6_MWIDTH_1 ((uint16_t)0x0800) /*!< Bit 1 */
+
+#define DMA_CHCTRL6_CHPL ((uint16_t)0x3000) /*!< PL[1:0] bits (Channel Priority level) */
+#define DMA_CHCTRL6_CHPL_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define DMA_CHCTRL6_CHPL_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define DMA_CHCTRL6_MEMTOMEM ((uint16_t)0x4000) /*!< Memory to memory mode */
+
+/******************* Bit definition for DMA_CHCTRL7 register *******************/
+#define DMA_CHCTRL7_CHEN ((uint16_t)0x0001) /*!< Channel enable */
+#define DMA_CHCTRL7_TCIE ((uint16_t)0x0002) /*!< Transfer complete interrupt enable */
+#define DMA_CHCTRL7_HTIE ((uint16_t)0x0004) /*!< Half Transfer interrupt enable */
+#define DMA_CHCTRL7_ERRIE ((uint16_t)0x0008) /*!< Transfer error interrupt enable */
+#define DMA_CHCTRL7_DIR ((uint16_t)0x0010) /*!< Data transfer direction */
+#define DMA_CHCTRL7_CIRM ((uint16_t)0x0020) /*!< Circular mode */
+#define DMA_CHCTRL7_PINC ((uint16_t)0x0040) /*!< Peripheral increment mode */
+#define DMA_CHCTRL7_MINC ((uint16_t)0x0080) /*!< Memory increment mode */
+
+#define DMA_CHCTRL7_PWIDTH , ((uint16_t)0x0300) /*!< PSIZE[1:0] bits (Peripheral size) */
+#define DMA_CHCTRL7_PWIDTH_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define DMA_CHCTRL7_PWIDTH_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define DMA_CHCTRL7_MWIDTH ((uint16_t)0x0C00) /*!< MSIZE[1:0] bits (Memory size) */
+#define DMA_CHCTRL7_MWIDTH_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define DMA_CHCTRL7_MWIDTH_1 ((uint16_t)0x0800) /*!< Bit 1 */
+
+#define DMA_CHCTRL7_CHPL ((uint16_t)0x3000) /*!< PL[1:0] bits (Channel Priority level) */
+#define DMA_CHCTRL7_CHPL_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define DMA_CHCTRL7_CHPL_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define DMA_CHCTRL7_MEMTOMEM ((uint16_t)0x4000) /*!< Memory to memory mode enable */
+
+/****************** Bit definition for DMA_TCNT1 register ******************/
+#define DMA_TCNT1_CNT ((uint16_t)0xFFFF) /*!< Number of data to Transfer */
+
+/****************** Bit definition for DMA_TCNT2 register ******************/
+#define DMA_TCNT2_CNT ((uint16_t)0xFFFF) /*!< Number of data to Transfer */
+
+/****************** Bit definition for DMA_TCNT3 register ******************/
+#define DMA_TCNT3_CNT ((uint16_t)0xFFFF) /*!< Number of data to Transfer */
+
+/****************** Bit definition for DMA_TCNT4 register ******************/
+#define DMA_TCNT4_CNT ((uint16_t)0xFFFF) /*!< Number of data to Transfer */
+
+/****************** Bit definition for DMA_TCNT5 register ******************/
+#define DMA_TCNT5_CNT ((uint16_t)0xFFFF) /*!< Number of data to Transfer */
+
+/****************** Bit definition for DMA_TCNT6 register ******************/
+#define DMA_TCNT6_CNT ((uint16_t)0xFFFF) /*!< Number of data to Transfer */
+
+/****************** Bit definition for DMA_TCNT7 register ******************/
+#define DMA_TCNT7_CNT ((uint16_t)0xFFFF) /*!< Number of data to Transfer */
+
+/****************** Bit definition for DMA_CPBA1 register *******************/
+#define DMA_CPBA1_PA ((uint32_t)0xFFFFFFFF) /*!< Peripheral Address */
+
+/****************** Bit definition for DMA_CPBA2 register *******************/
+#define DMA_CPBA2_PA ((uint32_t)0xFFFFFFFF) /*!< Peripheral Address */
+
+/****************** Bit definition for DMA_CPBA3 register *******************/
+#define DMA_CPBA3_PA ((uint32_t)0xFFFFFFFF) /*!< Peripheral Address */
+
+
+/****************** Bit definition for DMA_CPBA4 register *******************/
+#define DMA_CPBA4_PA ((uint32_t)0xFFFFFFFF) /*!< Peripheral Address */
+
+/****************** Bit definition for DMA_CPBA5 register *******************/
+#define DMA_CPBA5_PA ((uint32_t)0xFFFFFFFF) /*!< Peripheral Address */
+
+/****************** Bit definition for DMA_CPBA6 register *******************/
+#define DMA_CPBA6_PA ((uint32_t)0xFFFFFFFF) /*!< Peripheral Address */
+
+
+/****************** Bit definition for DMA_CPBA7 register *******************/
+#define DMA_CPBA7_PA ((uint32_t)0xFFFFFFFF) /*!< Peripheral Address */
+
+/****************** Bit definition for DMA_CMBA1 register *******************/
+#define DMA_CMBA1_MA ((uint32_t)0xFFFFFFFF) /*!< Memory Address */
+
+/****************** Bit definition for DMA_CMBA2 register *******************/
+#define DMA_CMBA2_MA ((uint32_t)0xFFFFFFFF) /*!< Memory Address */
+
+/****************** Bit definition for DMA_CMBA3 register *******************/
+#define DMA_CMBA3_MA ((uint32_t)0xFFFFFFFF) /*!< Memory Address */
+
+
+/****************** Bit definition for DMA_CMBA4 register *******************/
+#define DMA_CMBA4_MA ((uint32_t)0xFFFFFFFF) /*!< Memory Address */
+
+/****************** Bit definition for DMA_CMBA5 register *******************/
+#define DMA_CMBA5_MA ((uint32_t)0xFFFFFFFF) /*!< Memory Address */
+
+/****************** Bit definition for DMA_CMBA6 register *******************/
+#define DMA_CMBA6_MA ((uint32_t)0xFFFFFFFF) /*!< Memory Address */
+
+/****************** Bit definition for DMA_CMBA7 register *******************/
+#define DMA_CMBA7_MA ((uint32_t)0xFFFFFFFF) /*!< Memory Address */
+
+/******************************************************************************/
+/* */
+/* Analog to Digital Converter */
+/* */
+/******************************************************************************/
+
+/******************** Bit definition for ADC_STS register ********************/
+#define ADC_STS_AWD ((uint8_t)0x01) /*!< Analog watchdog flag */
+#define ADC_STS_EC ((uint8_t)0x02) /*!< End of conversion */
+#define ADC_STS_JEC ((uint8_t)0x04) /*!< Injected channel end of conversion */
+#define ADC_STS_JSTR ((uint8_t)0x08) /*!< Injected channel Start flag */
+#define ADC_STS_RSTR ((uint8_t)0x10) /*!< Regular channel Start flag */
+
+/******************* Bit definition for ADC_CTRL1 register ********************/
+#define ADC_CTRL1_AWDCS ((uint32_t)0x0000001F) /*!< AWDCH[4:0] bits (Analog watchdog channel select bits) */
+#define ADC_CTRL1_AWDCS_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define ADC_CTRL1_AWDCS_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define ADC_CTRL1_AWDCS_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define ADC_CTRL1_AWDCS_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define ADC_CTRL1_AWDCS_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+
+#define ADC_CTRL1_ECIEN ((uint32_t)0x00000020) /*!< Interrupt enable for EOC */
+#define ADC_CTRL1_AWDIEN ((uint32_t)0x00000040) /*!< Analog Watchdog interrupt enable */
+#define ADC_CTRL1_JECIEN ((uint32_t)0x00000080) /*!< Interrupt enable for injected channels */
+#define ADC_CTRL1_SCN ((uint32_t)0x00000100) /*!< Scan mode */
+#define ADC_CTRL1_AWDSGE ((uint32_t)0x00000200) /*!< Enable the watchdog on a single channel in scan mode */
+#define ADC_CTRL1_JAUT ((uint32_t)0x00000400) /*!< Automatic injected group conversion */
+#define ADC_CTRL1_RDISEN ((uint32_t)0x00000800) /*!< Discontinuous mode on regular channels */
+#define ADC_CTRL1_JDISEN ((uint32_t)0x00001000) /*!< Discontinuous mode on injected channels */
+
+#define ADC_CTRL1_DISN ((uint32_t)0x0000E000) /*!< DISCNUM[2:0] bits (Discontinuous mode channel count) */
+#define ADC_CTRL1_DISN_0 ((uint32_t)0x00002000) /*!< Bit 0 */
+#define ADC_CTRL1_DISN_1 ((uint32_t)0x00004000) /*!< Bit 1 */
+#define ADC_CTRL1_DISN_2 ((uint32_t)0x00008000) /*!< Bit 2 */
+
+#define ADC_CTRL1_DUALM ((uint32_t)0x000F0000) /*!< DUALMOD[3:0] bits (Dual mode selection) */
+#define ADC_CTRL1_DUALM_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define ADC_CTRL1_DUALM_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define ADC_CTRL1_DUALM_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define ADC_CTRL1_DUALM_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+
+#define ADC_CTRL1_JAWDEN ((uint32_t)0x00400000) /*!< Analog watchdog enable on injected channels */
+#define ADC_CTRL1_AWDEN ((uint32_t)0x00800000) /*!< Analog watchdog enable on regular channels */
+
+
+/******************* Bit definition for ADC_CTRL2 register ********************/
+#define ADC_CTRL2_ADON ((uint32_t)0x00000001) /*!< A/D Converter ON / OFF */
+#define ADC_CTRL2_CON ((uint32_t)0x00000002) /*!< Continuous Conversion */
+#define ADC_CTRL2_CAL ((uint32_t)0x00000004) /*!< A/D Calibration */
+#define ADC_CTRL2_RSTCAL ((uint32_t)0x00000008) /*!< Reset Calibration */
+#define ADC_CTRL2_DMAEN ((uint32_t)0x00000100) /*!< Direct Memory access mode */
+#define ADC_CTRL2_DALIGN ((uint32_t)0x00000800) /*!< Data Alignment */
+
+#define ADC_CTRL2_JEXSEL ((uint32_t)0x01007000) /*!< JEXTSEL[3:0] bits (External event select for injected group) */
+#define ADC_CTRL2_JEXSEL_0 ((uint32_t)0x00001000) /*!< Bit 0 */
+#define ADC_CTRL2_JEXSEL_1 ((uint32_t)0x00002000) /*!< Bit 1 */
+#define ADC_CTRL2_JEXSEL_2 ((uint32_t)0x00004000) /*!< Bit 2 */
+#define ADC_CTRL2_JEXSEL_3 ((uint32_t)0x01000000) /*!< Bit 3 */
+
+#define ADC_CTRL2_JEXTREN ((uint32_t)0x00008000) /*!< External Trigger Conversion mode for injected channels */
+
+#define ADC_CTRL2_EXSEL ((uint32_t)0x020E0000) /*!< EXTSEL[3:0] bits (External Event Select for regular group) */
+#define ADC_CTRL2_EXSEL_0 ((uint32_t)0x00020000) /*!< Bit 0 */
+#define ADC_CTRL2_EXSEL_1 ((uint32_t)0x00040000) /*!< Bit 1 */
+#define ADC_CTRL2_EXSEL_2 ((uint32_t)0x00080000) /*!< Bit 2 */
+#define ADC_CTRL2_EXSEL_3 ((uint32_t)0x02000000) /*!< Bit 3 */
+
+#define ADC_CTRL2_EXTREN ((uint32_t)0x00100000) /*!< External Trigger Conversion mode for regular channels */
+#define ADC_CTRL2_JSWSTR ((uint32_t)0x00200000) /*!< Start Conversion of injected channels */
+#define ADC_CTRL2_SWSTR ((uint32_t)0x00400000) /*!< Start Conversion of regular channels */
+#define ADC_CTRL2_TSREF ((uint32_t)0x00800000) /*!< Temperature Sensor and VREFINT Enable */
+
+/****************** Bit definition for ADC_SMPT1 register *******************/
+#define ADC_SMPT1_SMP10 ((uint32_t)0x00000007) /*!< SMP10[2:0] bits (Channel 10 Sample time selection) */
+#define ADC_SMPT1_SMP10_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define ADC_SMPT1_SMP10_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define ADC_SMPT1_SMP10_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+
+#define ADC_SMPT1_SMP11 ((uint32_t)0x00000038) /*!< SMP11[2:0] bits (Channel 11 Sample time selection) */
+#define ADC_SMPT1_SMP11_0 ((uint32_t)0x00000008) /*!< Bit 0 */
+#define ADC_SMPT1_SMP11_1 ((uint32_t)0x00000010) /*!< Bit 1 */
+#define ADC_SMPT1_SMP11_2 ((uint32_t)0x00000020) /*!< Bit 2 */
+
+#define ADC_SMPT1_SMP12 ((uint32_t)0x000001C0) /*!< SMP12[2:0] bits (Channel 12 Sample time selection) */
+#define ADC_SMPT1_SMP12_0 ((uint32_t)0x00000040) /*!< Bit 0 */
+#define ADC_SMPT1_SMP12_1 ((uint32_t)0x00000080) /*!< Bit 1 */
+#define ADC_SMPT1_SMP12_2 ((uint32_t)0x00000100) /*!< Bit 2 */
+
+#define ADC_SMPT1_SMP13 ((uint32_t)0x00000E00) /*!< SMP13[2:0] bits (Channel 13 Sample time selection) */
+#define ADC_SMPT1_SMP13_0 ((uint32_t)0x00000200) /*!< Bit 0 */
+#define ADC_SMPT1_SMP13_1 ((uint32_t)0x00000400) /*!< Bit 1 */
+#define ADC_SMPT1_SMP13_2 ((uint32_t)0x00000800) /*!< Bit 2 */
+
+#define ADC_SMPT1_SMP14 ((uint32_t)0x00007000) /*!< SMP14[2:0] bits (Channel 14 Sample time selection) */
+#define ADC_SMPT1_SMP14_0 ((uint32_t)0x00001000) /*!< Bit 0 */
+#define ADC_SMPT1_SMP14_1 ((uint32_t)0x00002000) /*!< Bit 1 */
+#define ADC_SMPT1_SMP14_2 ((uint32_t)0x00004000) /*!< Bit 2 */
+
+#define ADC_SMPT1_SMP15 ((uint32_t)0x00038000) /*!< SMP15[2:0] bits (Channel 15 Sample time selection) */
+#define ADC_SMPT1_SMP15_0 ((uint32_t)0x00008000) /*!< Bit 0 */
+#define ADC_SMPT1_SMP15_1 ((uint32_t)0x00010000) /*!< Bit 1 */
+#define ADC_SMPT1_SMP15_2 ((uint32_t)0x00020000) /*!< Bit 2 */
+
+#define ADC_SMPT1_SMP16 ((uint32_t)0x001C0000) /*!< SMP16[2:0] bits (Channel 16 Sample time selection) */
+#define ADC_SMPT1_SMP16_0 ((uint32_t)0x00040000) /*!< Bit 0 */
+#define ADC_SMPT1_SMP16_1 ((uint32_t)0x00080000) /*!< Bit 1 */
+#define ADC_SMPT1_SMP16_2 ((uint32_t)0x00100000) /*!< Bit 2 */
+
+#define ADC_SMPT1_SMP17 ((uint32_t)0x00E00000) /*!< SMP17[2:0] bits (Channel 17 Sample time selection) */
+#define ADC_SMPT1_SMP17_0 ((uint32_t)0x00200000) /*!< Bit 0 */
+#define ADC_SMPT1_SMP17_1 ((uint32_t)0x00400000) /*!< Bit 1 */
+#define ADC_SMPT1_SMP17_2 ((uint32_t)0x00800000) /*!< Bit 2 */
+
+/****************** Bit definition for ADC_SMPT2 register *******************/
+#define ADC_SMPT2_SMP0 ((uint32_t)0x00000007) /*!< SMP0[2:0] bits (Channel 0 Sample time selection) */
+#define ADC_SMPT2_SMP0_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define ADC_SMPT2_SMP0_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define ADC_SMPT2_SMP0_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+
+#define ADC_SMPT2_SMP1 ((uint32_t)0x00000038) /*!< SMP1[2:0] bits (Channel 1 Sample time selection) */
+#define ADC_SMPT2_SMP1_0 ((uint32_t)0x00000008) /*!< Bit 0 */
+#define ADC_SMPT2_SMP1_1 ((uint32_t)0x00000010) /*!< Bit 1 */
+#define ADC_SMPT2_SMP1_2 ((uint32_t)0x00000020) /*!< Bit 2 */
+
+#define ADC_SMPT2_SMP2 ((uint32_t)0x000001C0) /*!< SMP2[2:0] bits (Channel 2 Sample time selection) */
+#define ADC_SMPT2_SMP2_0 ((uint32_t)0x00000040) /*!< Bit 0 */
+#define ADC_SMPT2_SMP2_1 ((uint32_t)0x00000080) /*!< Bit 1 */
+#define ADC_SMPT2_SMP2_2 ((uint32_t)0x00000100) /*!< Bit 2 */
+
+#define ADC_SMPT2_SMP3 ((uint32_t)0x00000E00) /*!< SMP3[2:0] bits (Channel 3 Sample time selection) */
+#define ADC_SMPT2_SMP3_0 ((uint32_t)0x00000200) /*!< Bit 0 */
+#define ADC_SMPT2_SMP3_1 ((uint32_t)0x00000400) /*!< Bit 1 */
+#define ADC_SMPT2_SMP3_2 ((uint32_t)0x00000800) /*!< Bit 2 */
+
+#define ADC_SMPT2_SMP4 ((uint32_t)0x00007000) /*!< SMP4[2:0] bits (Channel 4 Sample time selection) */
+#define ADC_SMPT2_SMP4_0 ((uint32_t)0x00001000) /*!< Bit 0 */
+#define ADC_SMPT2_SMP4_1 ((uint32_t)0x00002000) /*!< Bit 1 */
+#define ADC_SMPT2_SMP4_2 ((uint32_t)0x00004000) /*!< Bit 2 */
+
+#define ADC_SMPT2_SMP5 ((uint32_t)0x00038000) /*!< SMP5[2:0] bits (Channel 5 Sample time selection) */
+#define ADC_SMPT2_SMP5_0 ((uint32_t)0x00008000) /*!< Bit 0 */
+#define ADC_SMPT2_SMP5_1 ((uint32_t)0x00010000) /*!< Bit 1 */
+#define ADC_SMPT2_SMP5_2 ((uint32_t)0x00020000) /*!< Bit 2 */
+
+#define ADC_SMPT2_SMP6 ((uint32_t)0x001C0000) /*!< SMP6[2:0] bits (Channel 6 Sample time selection) */
+#define ADC_SMPT2_SMP6_0 ((uint32_t)0x00040000) /*!< Bit 0 */
+#define ADC_SMPT2_SMP6_1 ((uint32_t)0x00080000) /*!< Bit 1 */
+#define ADC_SMPT2_SMP6_2 ((uint32_t)0x00100000) /*!< Bit 2 */
+
+#define ADC_SMPT2_SMP7 ((uint32_t)0x00E00000) /*!< SMP7[2:0] bits (Channel 7 Sample time selection) */
+#define ADC_SMPT2_SMP7_0 ((uint32_t)0x00200000) /*!< Bit 0 */
+#define ADC_SMPT2_SMP7_1 ((uint32_t)0x00400000) /*!< Bit 1 */
+#define ADC_SMPT2_SMP7_2 ((uint32_t)0x00800000) /*!< Bit 2 */
+
+#define ADC_SMPT2_SMP8 ((uint32_t)0x07000000) /*!< SMP8[2:0] bits (Channel 8 Sample time selection) */
+#define ADC_SMPT2_SMP8_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define ADC_SMPT2_SMP8_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define ADC_SMPT2_SMP8_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+
+#define ADC_SMPT2_SMP9 ((uint32_t)0x38000000) /*!< SMP9[2:0] bits (Channel 9 Sample time selection) */
+#define ADC_SMPT2_SMP9_0 ((uint32_t)0x08000000) /*!< Bit 0 */
+#define ADC_SMPT2_SMP9_1 ((uint32_t)0x10000000) /*!< Bit 1 */
+#define ADC_SMPT2_SMP9_2 ((uint32_t)0x20000000) /*!< Bit 2 */
+
+/****************** Bit definition for ADC_JOFS1 register *******************/
+#define ADC_JOFS1_JOFST1 ((uint16_t)0x0FFF) /*!< Data offset for injected channel 1 */
+
+/****************** Bit definition for ADC_JOFS2 register *******************/
+#define ADC_JOFS2_JOFST2 ((uint16_t)0x0FFF) /*!< Data offset for injected channel 2 */
+
+/****************** Bit definition for ADC_JOFS3 register *******************/
+#define ADC_JOFS3_JOFST3 ((uint16_t)0x0FFF) /*!< Data offset for injected channel 3 */
+
+/****************** Bit definition for ADC_JOFS4 register *******************/
+#define ADC_JOFS4_JOFST4 ((uint16_t)0x0FFF) /*!< Data offset for injected channel 4 */
+
+/******************* Bit definition for ADC_WHTR register ********************/
+#define ADC_WHTR_AWHT ((uint16_t)0x0FFF) /*!< Analog watchdog high threshold */
+
+/******************* Bit definition for ADC_WLTR register ********************/
+#define ADC_WLTR_AWLT ((uint16_t)0x0FFF) /*!< Analog watchdog low threshold */
+
+/******************* Bit definition for ADC_RSQ1 register *******************/
+#define ADC_RSQ1_SQ13 ((uint32_t)0x0000001F) /*!< SQ13[4:0] bits (13th conversion in regular sequence) */
+#define ADC_RSQ1_SQ13_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define ADC_RSQ1_SQ13_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define ADC_RSQ1_SQ13_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define ADC_RSQ1_SQ13_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define ADC_RSQ1_SQ13_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+
+#define ADC_RSQ1_SQ14 ((uint32_t)0x000003E0) /*!< SQ14[4:0] bits (14th conversion in regular sequence) */
+#define ADC_RSQ1_SQ14_0 ((uint32_t)0x00000020) /*!< Bit 0 */
+#define ADC_RSQ1_SQ14_1 ((uint32_t)0x00000040) /*!< Bit 1 */
+#define ADC_RSQ1_SQ14_2 ((uint32_t)0x00000080) /*!< Bit 2 */
+#define ADC_RSQ1_SQ14_3 ((uint32_t)0x00000100) /*!< Bit 3 */
+#define ADC_RSQ1_SQ14_4 ((uint32_t)0x00000200) /*!< Bit 4 */
+
+#define ADC_RSQ1_SQ15 ((uint32_t)0x00007C00) /*!< SQ15[4:0] bits (15th conversion in regular sequence) */
+#define ADC_RSQ1_SQ15_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define ADC_RSQ1_SQ15_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define ADC_RSQ1_SQ15_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define ADC_RSQ1_SQ15_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define ADC_RSQ1_SQ15_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define ADC_RSQ1_SQ16 ((uint32_t)0x000F8000) /*!< SQ16[4:0] bits (16th conversion in regular sequence) */
+#define ADC_RSQ1_SQ16_0 ((uint32_t)0x00008000) /*!< Bit 0 */
+#define ADC_RSQ1_SQ16_1 ((uint32_t)0x00010000) /*!< Bit 1 */
+#define ADC_RSQ1_SQ16_2 ((uint32_t)0x00020000) /*!< Bit 2 */
+#define ADC_RSQ1_SQ16_3 ((uint32_t)0x00040000) /*!< Bit 3 */
+#define ADC_RSQ1_SQ16_4 ((uint32_t)0x00080000) /*!< Bit 4 */
+
+#define ADC_RSQ1_LEN ((uint32_t)0x00F00000) /*!< L[3:0] bits (Regular channel sequence length) */
+#define ADC_RSQ1_LEN_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define ADC_RSQ1_LEN_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+#define ADC_RSQ1_LEN_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define ADC_RSQ1_LEN_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+
+/******************* Bit definition for ADC_RSQ2 register *******************/
+#define ADC_RSQ2_SQ7 ((uint32_t)0x0000001F) /*!< SQ7[4:0] bits (7th conversion in regular sequence) */
+#define ADC_RSQ2_SQ7_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define ADC_RSQ2_SQ7_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define ADC_RSQ2_SQ7_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define ADC_RSQ2_SQ7_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define ADC_RSQ2_SQ7_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+
+#define ADC_RSQ2_SQ8 ((uint32_t)0x000003E0) /*!< SQ8[4:0] bits (8th conversion in regular sequence) */
+#define ADC_RSQ2_SQ8_0 ((uint32_t)0x00000020) /*!< Bit 0 */
+#define ADC_RSQ2_SQ8_1 ((uint32_t)0x00000040) /*!< Bit 1 */
+#define ADC_RSQ2_SQ8_2 ((uint32_t)0x00000080) /*!< Bit 2 */
+#define ADC_RSQ2_SQ8_3 ((uint32_t)0x00000100) /*!< Bit 3 */
+#define ADC_RSQ2_SQ8_4 ((uint32_t)0x00000200) /*!< Bit 4 */
+
+#define ADC_RSQ2_SQ9 ((uint32_t)0x00007C00) /*!< SQ9[4:0] bits (9th conversion in regular sequence) */
+#define ADC_RSQ2_SQ9_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define ADC_RSQ2_SQ9_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define ADC_RSQ2_SQ9_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define ADC_RSQ2_SQ9_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define ADC_RSQ2_SQ9_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define ADC_RSQ2_SQ10 ((uint32_t)0x000F8000) /*!< SQ10[4:0] bits (10th conversion in regular sequence) */
+#define ADC_RSQ2_SQ10_0 ((uint32_t)0x00008000) /*!< Bit 0 */
+#define ADC_RSQ2_SQ10_1 ((uint32_t)0x00010000) /*!< Bit 1 */
+#define ADC_RSQ2_SQ10_2 ((uint32_t)0x00020000) /*!< Bit 2 */
+#define ADC_RSQ2_SQ10_3 ((uint32_t)0x00040000) /*!< Bit 3 */
+#define ADC_RSQ2_SQ10_4 ((uint32_t)0x00080000) /*!< Bit 4 */
+
+#define ADC_RSQ2_SQ11 ((uint32_t)0x01F00000) /*!< SQ11[4:0] bits (11th conversion in regular sequence) */
+#define ADC_RSQ2_SQ11_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define ADC_RSQ2_SQ11_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+#define ADC_RSQ2_SQ11_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define ADC_RSQ2_SQ11_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+#define ADC_RSQ2_SQ11_4 ((uint32_t)0x01000000) /*!< Bit 4 */
+
+#define ADC_RSQ2_SQ12 ((uint32_t)0x3E000000) /*!< SQ12[4:0] bits (12th conversion in regular sequence) */
+#define ADC_RSQ2_SQ12_0 ((uint32_t)0x02000000) /*!< Bit 0 */
+#define ADC_RSQ2_SQ12_1 ((uint32_t)0x04000000) /*!< Bit 1 */
+#define ADC_RSQ2_SQ12_2 ((uint32_t)0x08000000) /*!< Bit 2 */
+#define ADC_RSQ2_SQ12_3 ((uint32_t)0x10000000) /*!< Bit 3 */
+#define ADC_RSQ2_SQ12_4 ((uint32_t)0x20000000) /*!< Bit 4 */
+
+/******************* Bit definition for ADC_RSQ3 register *******************/
+#define ADC_RSQ3_SQ1 ((uint32_t)0x0000001F) /*!< SQ1[4:0] bits (1st conversion in regular sequence) */
+#define ADC_RSQ3_SQ1_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define ADC_RSQ3_SQ1_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define ADC_RSQ3_SQ1_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define ADC_RSQ3_SQ1_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define ADC_RSQ3_SQ1_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+
+#define ADC_RSQ3_SQ2 ((uint32_t)0x000003E0) /*!< SQ2[4:0] bits (2nd conversion in regular sequence) */
+#define ADC_RSQ3_SQ2_0 ((uint32_t)0x00000020) /*!< Bit 0 */
+#define ADC_RSQ3_SQ2_1 ((uint32_t)0x00000040) /*!< Bit 1 */
+#define ADC_RSQ3_SQ2_2 ((uint32_t)0x00000080) /*!< Bit 2 */
+#define ADC_RSQ3_SQ2_3 ((uint32_t)0x00000100) /*!< Bit 3 */
+#define ADC_RSQ3_SQ2_4 ((uint32_t)0x00000200) /*!< Bit 4 */
+
+#define ADC_RSQ3_SQ3 ((uint32_t)0x00007C00) /*!< SQ3[4:0] bits (3rd conversion in regular sequence) */
+#define ADC_RSQ3_SQ3_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define ADC_RSQ3_SQ3_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define ADC_RSQ3_SQ3_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define ADC_RSQ3_SQ3_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define ADC_RSQ3_SQ3_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define ADC_RSQ3_SQ4 ((uint32_t)0x000F8000) /*!< SQ4[4:0] bits (4th conversion in regular sequence) */
+#define ADC_RSQ3_SQ4_0 ((uint32_t)0x00008000) /*!< Bit 0 */
+#define ADC_RSQ3_SQ4_1 ((uint32_t)0x00010000) /*!< Bit 1 */
+#define ADC_RSQ3_SQ4_2 ((uint32_t)0x00020000) /*!< Bit 2 */
+#define ADC_RSQ3_SQ4_3 ((uint32_t)0x00040000) /*!< Bit 3 */
+#define ADC_RSQ3_SQ4_4 ((uint32_t)0x00080000) /*!< Bit 4 */
+
+#define ADC_RSQ3_SQ5 ((uint32_t)0x01F00000) /*!< SQ5[4:0] bits (5th conversion in regular sequence) */
+#define ADC_RSQ3_SQ5_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define ADC_RSQ3_SQ5_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+#define ADC_RSQ3_SQ5_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define ADC_RSQ3_SQ5_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+#define ADC_RSQ3_SQ5_4 ((uint32_t)0x01000000) /*!< Bit 4 */
+
+#define ADC_RSQ3_SQ6 ((uint32_t)0x3E000000) /*!< SQ6[4:0] bits (6th conversion in regular sequence) */
+#define ADC_RSQ3_SQ6_0 ((uint32_t)0x02000000) /*!< Bit 0 */
+#define ADC_RSQ3_SQ6_1 ((uint32_t)0x04000000) /*!< Bit 1 */
+#define ADC_RSQ3_SQ6_2 ((uint32_t)0x08000000) /*!< Bit 2 */
+#define ADC_RSQ3_SQ6_3 ((uint32_t)0x10000000) /*!< Bit 3 */
+#define ADC_RSQ3_SQ6_4 ((uint32_t)0x20000000) /*!< Bit 4 */
+
+/******************* Bit definition for ADC_JSQ register *******************/
+#define ADC_JSQ_JSQ1 ((uint32_t)0x0000001F) /*!< JSQ1[4:0] bits (1st conversion in injected sequence) */
+#define ADC_JSQ_JSQ1_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define ADC_JSQ_JSQ1_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define ADC_JSQ_JSQ1_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define ADC_JSQ_JSQ1_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define ADC_JSQ_JSQ1_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+
+#define ADC_JSQ_JSQ2 ((uint32_t)0x000003E0) /*!< JSQ2[4:0] bits (2nd conversion in injected sequence) */
+#define ADC_JSQ_JSQ2_0 ((uint32_t)0x00000020) /*!< Bit 0 */
+#define ADC_JSQ_JSQ2_1 ((uint32_t)0x00000040) /*!< Bit 1 */
+#define ADC_JSQ_JSQ2_2 ((uint32_t)0x00000080) /*!< Bit 2 */
+#define ADC_JSQ_JSQ2_3 ((uint32_t)0x00000100) /*!< Bit 3 */
+#define ADC_JSQ_JSQ2_4 ((uint32_t)0x00000200) /*!< Bit 4 */
+
+#define ADC_JSQ_JSQ3 ((uint32_t)0x00007C00) /*!< JSQ3[4:0] bits (3rd conversion in injected sequence) */
+#define ADC_JSQ_JSQ3_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define ADC_JSQ_JSQ3_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define ADC_JSQ_JSQ3_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define ADC_JSQ_JSQ3_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define ADC_JSQ_JSQ3_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define ADC_JSQ_JSQ4 ((uint32_t)0x000F8000) /*!< JSQ4[4:0] bits (4th conversion in injected sequence) */
+#define ADC_JSQ_JSQ4_0 ((uint32_t)0x00008000) /*!< Bit 0 */
+#define ADC_JSQ_JSQ4_1 ((uint32_t)0x00010000) /*!< Bit 1 */
+#define ADC_JSQ_JSQ4_2 ((uint32_t)0x00020000) /*!< Bit 2 */
+#define ADC_JSQ_JSQ4_3 ((uint32_t)0x00040000) /*!< Bit 3 */
+#define ADC_JSQ_JSQ4_4 ((uint32_t)0x00080000) /*!< Bit 4 */
+
+#define ADC_JSQ_JLEN ((uint32_t)0x00300000) /*!< JL[1:0] bits (Injected Sequence length) */
+#define ADC_JSQ_JLEN_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define ADC_JSQ_JLEN_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+
+/******************* Bit definition for ADC_JDOR1 register *******************/
+#define ADC_JDOR1_JD ((uint16_t)0xFFFF) /*!< Injected data */
+
+/******************* Bit definition for ADC_JDOR2 register *******************/
+#define ADC_JDOR2_JD ((uint16_t)0xFFFF) /*!< Injected data */
+
+/******************* Bit definition for ADC_JDOR3 register *******************/
+#define ADC_JDOR3_JD ((uint16_t)0xFFFF) /*!< Injected data */
+
+/******************* Bit definition for ADC_JDOR4 register *******************/
+#define ADC_JDOR4_JD ((uint16_t)0xFFFF) /*!< Injected data */
+
+/******************** Bit definition for ADC_RDOR register ********************/
+#define ADC_RDOR_D ((uint32_t)0x0000FFFF) /*!< Regular data */
+#define ADC_RDOR_AD2D ((uint32_t)0xFFFF0000) /*!< ADC2 data */
+
+/******************************************************************************/
+/* */
+/* Digital to Analog Converter */
+/* */
+/******************************************************************************/
+
+/******************** Bit definition for DAC_CTRL register ********************/
+#define DAC_CTRL_EN1 ((uint32_t)0x00000001) /*!< DAC channel1 enable */
+#define DAC_CTRL_BF1 ((uint32_t)0x00000002) /*!< DAC channel1 output buffer disable */
+#define DAC_CTRL_TEN1 ((uint32_t)0x00000004) /*!< DAC channel1 Trigger enable */
+
+#define DAC_CTRL_TGSL1 ((uint32_t)0x00000038) /*!< TSEL1[2:0] (DAC channel1 Trigger selection) */
+#define DAC_CTRL_TGSL1_0 ((uint32_t)0x00000008) /*!< Bit 0 */
+#define DAC_CTRL_TGSL1_1 ((uint32_t)0x00000010) /*!< Bit 1 */
+#define DAC_CTRL_TGSL1_2 ((uint32_t)0x00000020) /*!< Bit 2 */
+
+#define DAC_CTRL_WAVE1 ((uint32_t)0x000000C0) /*!< WAVE1[1:0] (DAC channel1 noise/triangle wave generation enable) */
+#define DAC_CTRL_WAVE1_0 ((uint32_t)0x00000040) /*!< Bit 0 */
+#define DAC_CTRL_WAVE1_1 ((uint32_t)0x00000080) /*!< Bit 1 */
+
+#define DAC_CTRL_MAMS1 ((uint32_t)0x00000F00) /*!< MAMP1[3:0] (DAC channel1 Mask/Amplitude selector) */
+#define DAC_CTRL_MAMS1_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define DAC_CTRL_MAMS1_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define DAC_CTRL_MAMS1_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define DAC_CTRL_MAMS1_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+
+#define DAC_CTRL_DMAEN1 ((uint32_t)0x00001000) /*!< DAC channel1 DMA enable */
+#define DAC_CTRL_EN2 ((uint32_t)0x00010000) /*!< DAC channel2 enable */
+#define DAC_CTRL_BF2 ((uint32_t)0x00020000) /*!< DAC channel2 output buffer disable */
+#define DAC_CTRL_TEN2 ((uint32_t)0x00040000) /*!< DAC channel2 Trigger enable */
+
+#define DAC_CTRL_TGSL2 ((uint32_t)0x00380000) /*!< TSEL2[2:0] (DAC channel2 Trigger selection) */
+#define DAC_CTRL_TGSL2_0 ((uint32_t)0x00080000) /*!< Bit 0 */
+#define DAC_CTRL_TGSL2_1 ((uint32_t)0x00100000) /*!< Bit 1 */
+#define DAC_CTRL_TGSL2_2 ((uint32_t)0x00200000) /*!< Bit 2 */
+
+#define DAC_CTRL_WAVE2 ((uint32_t)0x00C00000) /*!< WAVE2[1:0] (DAC channel2 noise/triangle wave generation enable) */
+#define DAC_CTRL_WAVE2_0 ((uint32_t)0x00400000) /*!< Bit 0 */
+#define DAC_CTRL_WAVE2_1 ((uint32_t)0x00800000) /*!< Bit 1 */
+
+#define DAC_CTRL_MAMS2 ((uint32_t)0x0F000000) /*!< MAMP2[3:0] (DAC channel2 Mask/Amplitude selector) */
+#define DAC_CTRL_MAMS2_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define DAC_CTRL_MAMS2_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define DAC_CTRL_MAMS2_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define DAC_CTRL_MAMS2_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+
+#define DAC_CTRL_DMAEN2 ((uint32_t)0x10000000) /*!< DAC channel2 DMA enabled */
+
+/***************** Bit definition for DAC_SWTRG register ******************/
+#define DAC_SWTRG_SWTRG1 ((uint8_t)0x01) /*!< DAC channel1 software trigger */
+#define DAC_SWTRG_SWTRG2 ((uint8_t)0x02) /*!< DAC channel2 software trigger */
+
+/***************** Bit definition for DAC_HDR12R1 register ******************/
+#define DAC_HDR12R1_D1HDR ((uint16_t)0x0FFF) /*!< DAC channel1 12-bit Right aligned data */
+
+/***************** Bit definition for DAC_HDR12L1register ******************/
+#define DAC_HDR12L1_D1HDR ((uint16_t)0xFFF0) /*!< DAC channel1 12-bit Left aligned data */
+
+/****************** Bit definition for DAC_HDR8R1 register ******************/
+#define DAC_HDR8R1_D1HDR ((uint8_t)0xFF) /*!< DAC channel1 8-bit Right aligned data */
+
+/***************** Bit definition for DAC_HDR12R2 register ******************/
+#define DAC_HDR12R2_D2HDR ((uint16_t)0x0FFF) /*!< DAC channel2 12-bit Right aligned data */
+
+/***************** Bit definition for DAC_HDR12L2 register ******************/
+#define DAC_HDR12L2_D2HDR ((uint16_t)0xFFF0) /*!< DAC channel2 12-bit Left aligned data */
+
+/****************** Bit definition for DAC_HDR8R2 register ******************/
+#define DAC_HDR8R2_D2HDR ((uint8_t)0xFF) /*!< DAC channel2 8-bit Right aligned data */
+
+/***************** Bit definition for DAC_HDR12RD register ******************/
+#define DAC_HDR12RD_D1HDR ((uint32_t)0x00000FFF) /*!< DAC channel1 12-bit Right aligned data */
+#define DAC_HDR12RD_D2HDR ((uint32_t)0x0FFF0000) /*!< DAC channel2 12-bit Right aligned data */
+
+/***************** Bit definition for DAC_HDR12LD register ******************/
+#define DAC_HDR12LD_D1HDR ((uint32_t)0x0000FFF0) /*!< DAC channel1 12-bit Left aligned data */
+#define DAC_HDR12LD_D2HDR ((uint32_t)0xFFF00000) /*!< DAC channel2 12-bit Left aligned data */
+
+/****************** Bit definition for DAC_HDR8RD register ******************/
+#define DAC_HDR8RD_D1HDR ((uint16_t)0x00FF) /*!< DAC channel1 8-bit Right aligned data */
+#define DAC_HDR8RD_D2HDR ((uint16_t)0xFF00) /*!< DAC channel2 8-bit Right aligned data */
+
+/******************* Bit definition for DAC_ODT1 register *******************/
+#define DAC_ODT1_D1ODT ((uint16_t)0x0FFF) /*!< DAC channel1 data output */
+
+/******************* Bit definition for DAC_ODT2 register *******************/
+#define DAC_ODT2_D2ODT ((uint16_t)0x0FFF) /*!< DAC channel2 data output */
+
+/******************** Bit definition for DAC_STS register ********************/
+#define DAC_STS_DMAUDR1 ((uint32_t)0x00002000) /*!< DAC channel1 DMA underrun flag */
+#define DAC_STS_DMAUDR2 ((uint32_t)0x20000000) /*!< DAC channel2 DMA underrun flag */
+
+/*****************************************************************************/
+/* */
+/* Timers (TMR) */
+/* */
+/*****************************************************************************/
+/******************* Bit definition for TMR_CTRL1 register ********************/
+#define TMR_CTRL1_CNTEN ((uint16_t)0x0001) /*!< Counter enable */
+#define TMR_CTRL1_UEVDIS ((uint16_t)0x0002) /*!< Update disable */
+#define TMR_CTRL1_UVERS ((uint16_t)0x0004) /*!< Update request source */
+#define TMR_CTRL1_OPMODE ((uint16_t)0x0008) /*!< One pulse mode */
+#define TMR_CTRL1_DIR ((uint16_t)0x0010) /*!< Direction */
+
+#define TMR_CTRL1_CMSEL ((uint16_t)0x0060) /*!< CMS[1:0] bits (Center-aligned mode selection) */
+#define TMR_CTRL1_CMSEL_0 ((uint16_t)0x0020) /*!< Bit 0 */
+#define TMR_CTRL1_CMSEL_1 ((uint16_t)0x0040) /*!< Bit 1 */
+
+#define TMR_CTRL1_ARPEN ((uint16_t)0x0080) /*!< Auto-reload preload enable */
+
+#define TMR_CTRL1_CLKDIV ((uint16_t)0x0300) /*!< CKD[1:0] bits (clock division) */
+#define TMR_CTRL1_CLKDIV_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define TMR_CTRL1_CLKDIV_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define TMR_CTRL1_PMEN ((uint16_t)0x0400) /*!< 32bit counter enable */
+
+/******************* Bit definition for TMR_CTRL2 register ********************/
+#define TMR_CTRL2_CPC ((uint16_t)0x0001) /*!< Capture/Compare Preloaded Control */
+#define TMR_CTRL2_CUSEL ((uint16_t)0x0004) /*!< Capture/Compare Control Update Selection */
+#define TMR_CTRL2_CDSEL ((uint16_t)0x0008) /*!< Capture/Compare DMA Selection */
+
+#define TMR_CTRL2_MMSEL ((uint16_t)0x0070) /*!< MMS[2:0] bits (Master Mode Selection) */
+#define TMR_CTRL2_MMSEL_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define TMR_CTRL2_MMSEL_1 ((uint16_t)0x0020) /*!< Bit 1 */
+#define TMR_CTRL2_MMSEL_2 ((uint16_t)0x0040) /*!< Bit 2 */
+
+#define TMR_CTRL2_TI1SEL ((uint16_t)0x0080) /*!< TI1 Selection */
+#define TMR_CTRL2_OC1IS ((uint16_t)0x0100) /*!< Output Idle state 1 (OC1 output) */
+#define TMR_CTRL2_OC1NIS ((uint16_t)0x0200) /*!< Output Idle state 1 (OC1N output) */
+#define TMR_CTRL2_OC2IS ((uint16_t)0x0400) /*!< Output Idle state 2 (OC2 output) */
+#define TMR_CTRL2_OC2NIS ((uint16_t)0x0800) /*!< Output Idle state 2 (OC2N output) */
+#define TMR_CTRL2_OC3IS ((uint16_t)0x1000) /*!< Output Idle state 3 (OC3 output) */
+#define TMR_CTRL2_OC3NIS ((uint16_t)0x2000) /*!< Output Idle state 3 (OC3N output) */
+#define TMR_CTRL2_OC4IS ((uint16_t)0x4000) /*!< Output Idle state 4 (OC4 output) */
+
+/******************* Bit definition for TMR_SMC register *******************/
+#define TMR_SMC_SMSEL ((uint16_t)0x0007) /*!< SMS[2:0] bits (Slave mode selection) */
+#define TMR_SMC_SMSEL_0 ((uint16_t)0x0001) /*!< Bit 0 */
+#define TMR_SMC_SMSEL_1 ((uint16_t)0x0002) /*!< Bit 1 */
+#define TMR_SMC_SMSEL_2 ((uint16_t)0x0004) /*!< Bit 2 */
+
+#define TMR_SMC_TRGSEL ((uint16_t)0x0070) /*!< TS[2:0] bits (Trigger selection) */
+#define TMR_SMC_TRGSEL_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define TMR_SMC_TRGSEL_1 ((uint16_t)0x0020) /*!< Bit 1 */
+#define TMR_SMC_TRGSEL_2 ((uint16_t)0x0040) /*!< Bit 2 */
+
+#define TMR_SMC_MSMODE ((uint16_t)0x0080) /*!< Master/slave mode */
+
+#define TMR_SMC_ETDF ((uint16_t)0x0F00) /*!< ETF[3:0] bits (External trigger filter) */
+#define TMR_SMC_ETDF_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define TMR_SMC_ETDF_1 ((uint16_t)0x0200) /*!< Bit 1 */
+#define TMR_SMC_ETDF_2 ((uint16_t)0x0400) /*!< Bit 2 */
+#define TMR_SMC_ETDF_3 ((uint16_t)0x0800) /*!< Bit 3 */
+
+#define TMR_SMC_ETD ((uint16_t)0x3000) /*!< ETPS[1:0] bits (External trigger prescaler) */
+#define TMR_SMC_ETD_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define TMR_SMC_ETD_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define TMR_SMC_ECLKEN ((uint16_t)0x4000) /*!< External clock enable */
+#define TMR_SMC_ETRGP ((uint16_t)0x8000) /*!< External trigger polarity */
+
+/******************* Bit definition for TMR_DIE register *******************/
+#define TMR_DIE_UEVIE ((uint16_t)0x0001) /*!< Update interrupt enable */
+#define TMR_DIE_C1IE ((uint16_t)0x0002) /*!< Capture/Compare 1 interrupt enable */
+#define TMR_DIE_C2IE ((uint16_t)0x0004) /*!< Capture/Compare 2 interrupt enable */
+#define TMR_DIE_C3IE ((uint16_t)0x0008) /*!< Capture/Compare 3 interrupt enable */
+#define TMR_DIE_C4IE ((uint16_t)0x0010) /*!< Capture/Compare 4 interrupt enable */
+#define TMR_DIE_HALLIE ((uint16_t)0x0020) /*!< COM interrupt enable */
+#define TMR_DIE_TRGIE ((uint16_t)0x0040) /*!< Trigger interrupt enable */
+#define TMR_DIE_BRKIE ((uint16_t)0x0080) /*!< Break interrupt enable */
+#define TMR_DIE_UEVDE ((uint16_t)0x0100) /*!< Update DMA request enable */
+#define TMR_DIE_C1DE ((uint16_t)0x0200) /*!< Capture/Compare 1 DMA request enable */
+#define TMR_DIE_C2DE ((uint16_t)0x0400) /*!< Capture/Compare 2 DMA request enable */
+#define TMR_DIE_C3DE ((uint16_t)0x0800) /*!< Capture/Compare 3 DMA request enable */
+#define TMR_DIE_C4DE ((uint16_t)0x1000) /*!< Capture/Compare 4 DMA request enable */
+#define TMR_DIE_HALLDE ((uint16_t)0x2000) /*!< COM DMA request enable */
+#define TMR_DIE_TRGDE ((uint16_t)0x4000) /*!< Trigger DMA request enable */
+
+/******************** Bit definition for TMR_STS register ********************/
+#define TMR_STS_UEVIF ((uint16_t)0x0001) /*!< Update interrupt Flag */
+#define TMR_STS_C1IF ((uint16_t)0x0002) /*!< Capture/Compare 1 interrupt Flag */
+#define TMR_STS_C2IF ((uint16_t)0x0004) /*!< Capture/Compare 2 interrupt Flag */
+#define TMR_STS_C3IF ((uint16_t)0x0008) /*!< Capture/Compare 3 interrupt Flag */
+#define TMR_STS_C4IF ((uint16_t)0x0010) /*!< Capture/Compare 4 interrupt Flag */
+#define TMR_STS_HALLIF ((uint16_t)0x0020) /*!< COM interrupt Flag */
+#define TMR_STS_TRGIF ((uint16_t)0x0040) /*!< Trigger interrupt Flag */
+#define TMR_STS_BRKIF ((uint16_t)0x0080) /*!< Break interrupt Flag */
+#define TMR_STS_C1OF ((uint16_t)0x0200) /*!< Capture/Compare 1 Overcapture Flag */
+#define TMR_STS_C2OF ((uint16_t)0x0400) /*!< Capture/Compare 2 Overcapture Flag */
+#define TMR_STS_C3OF ((uint16_t)0x0800) /*!< Capture/Compare 3 Overcapture Flag */
+#define TMR_STS_C4OF ((uint16_t)0x1000) /*!< Capture/Compare 4 Overcapture Flag */
+
+/******************* Bit definition for TMR_EVEG register ********************/
+#define TMR_EVEG_UEVG ((uint8_t)0x01) /*!< Update Generation */
+#define TMR_EVEG_C1G ((uint8_t)0x02) /*!< Capture/Compare 1 Generation */
+#define TMR_EVEG_C2G ((uint8_t)0x04) /*!< Capture/Compare 2 Generation */
+#define TMR_EVEG_C3G ((uint8_t)0x08) /*!< Capture/Compare 3 Generation */
+#define TMR_EVEG_C4G ((uint8_t)0x10) /*!< Capture/Compare 4 Generation */
+#define TMR_EVEG_HALLG ((uint8_t)0x20) /*!< Capture/Compare Control Update Generation */
+#define TMR_EVEG_TRGG ((uint8_t)0x40) /*!< Trigger Generation */
+#define TMR_EVEG_BRKG ((uint8_t)0x80) /*!< Break Generation */
+
+/****************** Bit definition for TMR_CCM1 register *******************/
+#define TMR_CCM1_C1SEL ((uint16_t)0x0003) /*!< CC1S[1:0] bits (Capture/Compare 1 Selection) */
+#define TMR_CCM1_C1SEL_0 ((uint16_t)0x0001) /*!< Bit 0 */
+#define TMR_CCM1_C1SEL_1 ((uint16_t)0x0002) /*!< Bit 1 */
+
+#define TMR_CCM1_OC1FEN ((uint16_t)0x0004) /*!< Output Compare 1 Fast enable */
+#define TMR_CCM1_OC1PEN ((uint16_t)0x0008) /*!< Output Compare 1 Preload enable */
+
+#define TMR_CCM1_OC1MODE ((uint16_t)0x0070) /*!< OC1M[2:0] bits (Output Compare 1 Mode) */
+#define TMR_CCM1_OC1MODE_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define TMR_CCM1_OC1MODE_1 ((uint16_t)0x0020) /*!< Bit 1 */
+#define TMR_CCM1_OC1MODE_2 ((uint16_t)0x0040) /*!< Bit 2 */
+
+#define TMR_CCM1_C1CDIS ((uint16_t)0x0080) /*!< Output Compare 1Clear Enable */
+
+#define TMR_CCM1_C2SEL ((uint16_t)0x0300) /*!< CC2S[1:0] bits (Capture/Compare 2 Selection) */
+#define TMR_CCM1_C2SEL_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define TMR_CCM1_C2SEL_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define TMR_CCM1_OC2FNE ((uint16_t)0x0400) /*!< Output Compare 2 Fast enable */
+#define TMR_CCM1_OC2PEN ((uint16_t)0x0800) /*!< Output Compare 2 Preload enable */
+
+#define TMR_CCM1_OC2MODE ((uint16_t)0x7000) /*!< OC2M[2:0] bits (Output Compare 2 Mode) */
+#define TMR_CCM1_OC2MODE_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define TMR_CCM1_OC2MODE_1 ((uint16_t)0x2000) /*!< Bit 1 */
+#define TMR_CCM1_OC2MODE_2 ((uint16_t)0x4000) /*!< Bit 2 */
+
+#define TMR_CCM1_OC2CDIS ((uint16_t)0x8000) /*!< Output Compare 2 Clear Enable */
+
+/*----------------------------------------------------------------------------*/
+
+#define TMR_CCM1_IC1DIV ((uint16_t)0x000C) /*!< IC1PSC[1:0] bits (Input Capture 1 Prescaler) */
+#define TMR_CCM1_IC1DIV_0 ((uint16_t)0x0004) /*!< Bit 0 */
+#define TMR_CCM1_IC1DIV_1 ((uint16_t)0x0008) /*!< Bit 1 */
+
+#define TMR_CCM1_IC1F ((uint16_t)0x00F0) /*!< IC1F[3:0] bits (Input Capture 1 Filter) */
+#define TMR_CCM1_IC1F_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define TMR_CCM1_IC1F_1 ((uint16_t)0x0020) /*!< Bit 1 */
+#define TMR_CCM1_IC1F_2 ((uint16_t)0x0040) /*!< Bit 2 */
+#define TMR_CCM1_IC1F_3 ((uint16_t)0x0080) /*!< Bit 3 */
+
+#define TMR_CCM1_IC2DIV ((uint16_t)0x0C00) /*!< IC2PSC[1:0] bits (Input Capture 2 Prescaler) */
+#define TMR_CCM1_IC2DIV_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define TMR_CCM1_IC2DIVC_1 ((uint16_t)0x0800) /*!< Bit 1 */
+
+#define TMR_CCM1_IC2DF ((uint16_t)0xF000) /*!< IC2F[3:0] bits (Input Capture 2 Filter) */
+#define TMR_CCM1_IC2DF_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define TMR_CCM1_IC2DF_1 ((uint16_t)0x2000) /*!< Bit 1 */
+#define TMR_CCM1_IC2DF_2 ((uint16_t)0x4000) /*!< Bit 2 */
+#define TMR_CCM1_IC2DF_3 ((uint16_t)0x8000) /*!< Bit 3 */
+
+/****************** Bit definition for TMR_CCM2 register *******************/
+#define TMR_CCM2_C3SEL ((uint16_t)0x0003) /*!< CC3S[1:0] bits (Capture/Compare 3 Selection) */
+#define TMR_CCM2_C3SEL_0 ((uint16_t)0x0001) /*!< Bit 0 */
+#define TMR_CCM2_C3SEL_1 ((uint16_t)0x0002) /*!< Bit 1 */
+
+#define TMR_CCM2_OC3FEN ((uint16_t)0x0004) /*!< Output Compare 3 Fast enable */
+#define TMR_CCM2_OC3PEN ((uint16_t)0x0008) /*!< Output Compare 3 Preload enable */
+
+#define TMR_CCM2_OC3MODE ((uint16_t)0x0070) /*!< OC3M[2:0] bits (Output Compare 3 Mode) */
+#define TMR_CCM2_OC3MODE_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define TMR_CCM2_OC3MODE_1 ((uint16_t)0x0020) /*!< Bit 1 */
+#define TMR_CCM2_OC3MODE_2 ((uint16_t)0x0040) /*!< Bit 2 */
+
+#define TMR_CCM2_OC3CDIS ((uint16_t)0x0080) /*!< Output Compare 3 Clear Enable */
+
+#define TMR_CCM2_CC4S ((uint16_t)0x0300) /*!< CC4S[1:0] bits (Capture/Compare 4 Selection) */
+#define TMR_CCM2_CC4S_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define TMR_CCM2_CC4S_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define TMR_CCM2_OC4FE ((uint16_t)0x0400) /*!< Output Compare 4 Fast enable */
+#define TMR_CCM2_OC4PE ((uint16_t)0x0800) /*!< Output Compare 4 Preload enable */
+
+#define TMR_CCM2_OC4MODE ((uint16_t)0x7000) /*!< OC4M[2:0] bits (Output Compare 4 Mode) */
+#define TMR_CCM2_OC4MODE_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define TMR_CCM2_OC4MODE_1 ((uint16_t)0x2000) /*!< Bit 1 */
+#define TMR_CCM2_OC4MODE_2 ((uint16_t)0x4000) /*!< Bit 2 */
+
+#define TMR_CCM2_OC4CDIS ((uint16_t)0x8000) /*!< Output Compare 4 Clear Enable */
+
+/*----------------------------------------------------------------------------*/
+
+#define TMR_CCM2_IC3DIV ((uint16_t)0x000C) /*!< IC3PSC[1:0] bits (Input Capture 3 Prescaler) */
+#define TMR_CCM2_IC3DIV_0 ((uint16_t)0x0004) /*!< Bit 0 */
+#define TMR_CCM2_IC3DIV_1 ((uint16_t)0x0008) /*!< Bit 1 */
+
+#define TMR_CCM2_IC3DF ((uint16_t)0x00F0) /*!< IC3F[3:0] bits (Input Capture 3 Filter) */
+#define TMR_CCM2_IC3DF_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define TMR_CCM2_IC3DF_1 ((uint16_t)0x0020) /*!< Bit 1 */
+#define TMR_CCM2_IC3DF_2 ((uint16_t)0x0040) /*!< Bit 2 */
+#define TMR_CCM2_IC3DF_3 ((uint16_t)0x0080) /*!< Bit 3 */
+
+#define TMR_CCM2_IC4DIV ((uint16_t)0x0C00) /*!< IC4PSC[1:0] bits (Input Capture 4 Prescaler) */
+#define TMR_CCM2_IC4DIV_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define TMR_CCM2_IC4DIV_1 ((uint16_t)0x0800) /*!< Bit 1 */
+
+#define TMR_CCM2_IC4DF ((uint16_t)0xF000) /*!< IC4F[3:0] bits (Input Capture 4 Filter) */
+#define TMR_CCM2_IC4DF_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define TMR_CCM2_IC4DF_1 ((uint16_t)0x2000) /*!< Bit 1 */
+#define TMR_CCM2_IC4DF_2 ((uint16_t)0x4000) /*!< Bit 2 */
+#define TMR_CCM2_IC4DF_3 ((uint16_t)0x8000) /*!< Bit 3 */
+
+/******************* Bit definition for TMR_CCE register *******************/
+#define TMR_CCE_C1EN ((uint16_t)0x0001) /*!< Capture/Compare 1 output enable */
+#define TMR_CCE_C1P ((uint16_t)0x0002) /*!< Capture/Compare 1 output Polarity */
+#define TMR_CCE_C1NEN ((uint16_t)0x0004) /*!< Capture/Compare 1 Complementary output enable */
+#define TMR_CCE_C1NP ((uint16_t)0x0008) /*!< Capture/Compare 1 Complementary output Polarity */
+#define TMR_CCE_C2EN ((uint16_t)0x0010) /*!< Capture/Compare 2 output enable */
+#define TMR_CCE_C2P ((uint16_t)0x0020) /*!< Capture/Compare 2 output Polarity */
+#define TMR_CCE_C2NEN ((uint16_t)0x0040) /*!< Capture/Compare 2 Complementary output enable */
+#define TMR_CCE_C2NP ((uint16_t)0x0080) /*!< Capture/Compare 2 Complementary output Polarity */
+#define TMR_CCE_C3EN ((uint16_t)0x0100) /*!< Capture/Compare 3 output enable */
+#define TMR_CCE_C3P ((uint16_t)0x0200) /*!< Capture/Compare 3 output Polarity */
+#define TMR_CCE_C3NEN ((uint16_t)0x0400) /*!< Capture/Compare 3 Complementary output enable */
+#define TMR_CCE_C3NP ((uint16_t)0x0800) /*!< Capture/Compare 3 Complementary output Polarity */
+#define TMR_CCE_C4EN ((uint16_t)0x1000) /*!< Capture/Compare 4 output enable */
+#define TMR_CCE_C4P ((uint16_t)0x2000) /*!< Capture/Compare 4 output Polarity */
+#define TMR_CCE_C4NP ((uint16_t)0x8000) /*!< Capture/Compare 4 Complementary output Polarity */
+
+/******************* Bit definition for TMR_CNT register ********************/
+#define TMR_CNT_CNT ((uint16_t)0xFFFF) /*!< Counter Value */
+
+/******************* Bit definition for TMR_DIV register ********************/
+#define TMR_DIV_DIV ((uint16_t)0xFFFF) /*!< Prescaler Value */
+
+/******************* Bit definition for TMR_AR register ********************/
+#define TMR_AR_AR ((uint16_t)0xFFFF) /*!< actual auto-reload Value */
+
+/******************* Bit definition for TMR_RC register ********************/
+#define TMR_RC_RC ((uint8_t)0xFF) /*!< Repetition Counter Value */
+
+/******************* Bit definition for TMR_CC1 register *******************/
+#define TMR_CC1_CC1 ((uint16_t)0xFFFF) /*!< Capture/Compare 1 Value */
+
+/******************* Bit definition for TMR_CC2 register *******************/
+#define TMR_CC2_CC2 ((uint16_t)0xFFFF) /*!< Capture/Compare 2 Value */
+
+/******************* Bit definition for TMR_CC3 register *******************/
+#define TMR_CC3_CC3 ((uint16_t)0xFFFF) /*!< Capture/Compare 3 Value */
+
+/******************* Bit definition for TMR_CC4 register *******************/
+#define TMR_CC4_CC4 ((uint16_t)0xFFFF) /*!< Capture/Compare 4 Value */
+
+/******************* Bit definition for TMR_BRKDT register *******************/
+#define TMR_BRKDT_DTGS ((uint16_t)0x00FF) /*!< DTG[0:7] bits (Dead-Time Generator set-up) */
+#define TMR_BRKDT_DTGS_0 ((uint16_t)0x0001) /*!< Bit 0 */
+#define TMR_BRKDT_DTGS_1 ((uint16_t)0x0002) /*!< Bit 1 */
+#define TMR_BRKDT_DTGS_2 ((uint16_t)0x0004) /*!< Bit 2 */
+#define TMR_BRKDT_DTGS_3 ((uint16_t)0x0008) /*!< Bit 3 */
+#define TMR_BRKDT_DTGS_4 ((uint16_t)0x0010) /*!< Bit 4 */
+#define TMR_BRKDT_DTGS_5 ((uint16_t)0x0020) /*!< Bit 5 */
+#define TMR_BRKDT_DTGS_6 ((uint16_t)0x0040) /*!< Bit 6 */
+#define TMR_BRKDT_DTGS_7 ((uint16_t)0x0080) /*!< Bit 7 */
+
+#define TMR_BRKDT_LOCKC ((uint16_t)0x0300) /*!< LOCK[1:0] bits (Lock Configuration) */
+#define TMR_BRKDT_LOCKC_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define TMR_BRKDT_LOCKC_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define TMR_BRKDT_OSIMI ((uint16_t)0x0400) /*!< Off-State Selection for Idle mode */
+#define TMR_BRKDT_OSIMR ((uint16_t)0x0800) /*!< Off-State Selection for Run mode */
+#define TMR_BRKDT_BRKEN ((uint16_t)0x1000) /*!< Break enable */
+#define TMR_BRKDT_BRKP ((uint16_t)0x2000) /*!< Break Polarity */
+#define TMR_BRKDT_AOEN ((uint16_t)0x4000) /*!< Automatic Output enable */
+#define TMR_BRKDT_MOEN ((uint16_t)0x8000) /*!< Main Output enable */
+
+/******************* Bit definition for TMR_DMAC register ********************/
+#define TMR_DMAC_ADDR ((uint16_t)0x001F) /*!< DBA[4:0] bits (DMA Base Address) */
+#define TMR_DMAC_ADDR_0 ((uint16_t)0x0001) /*!< Bit 0 */
+#define TMR_DMAC_ADDR_1 ((uint16_t)0x0002) /*!< Bit 1 */
+#define TMR_DMAC_ADDR_2 ((uint16_t)0x0004) /*!< Bit 2 */
+#define TMR_DMAC_ADDR_3 ((uint16_t)0x0008) /*!< Bit 3 */
+#define TMR_DMAC_ADDR_4 ((uint16_t)0x0010) /*!< Bit 4 */
+
+#define TMR_DMAC_DBLEN ((uint16_t)0x1F00) /*!< DBL[4:0] bits (DMA Burst Length) */
+#define TMR_DMAC_DBLEN_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define TMR_DMAC_DBLEN_1 ((uint16_t)0x0200) /*!< Bit 1 */
+#define TMR_DMAC_DBLEN_2 ((uint16_t)0x0400) /*!< Bit 2 */
+#define TMR_DMAC_DBLEN_3 ((uint16_t)0x0800) /*!< Bit 3 */
+#define TMR_DMAC_DBLEN_4 ((uint16_t)0x1000) /*!< Bit 4 */
+
+/******************* Bit definition for TMR_DMABA register *******************/
+#define TMR_DMABA_DMABA ((uint16_t)0xFFFF) /*!< DMA register for burst accesses */
+
+/******************************************************************************/
+/* */
+/* Real-Time Clock */
+/* */
+/******************************************************************************/
+#if defined (AT32F415xx)
+/******************** Bits definition for ERTC_TIME register *******************/
+#define ERTC_TIME_AMPM ((uint32_t)0x00400000)
+#define ERTC_TIME_HT ((uint32_t)0x00300000)
+#define ERTC_TIME_HT_0 ((uint32_t)0x00100000)
+#define ERTC_TIME_HT_1 ((uint32_t)0x00200000)
+#define ERTC_TIME_HU ((uint32_t)0x000F0000)
+#define ERTC_TIME_HU_0 ((uint32_t)0x00010000)
+#define ERTC_TIME_HU_1 ((uint32_t)0x00020000)
+#define ERTC_TIME_HU_2 ((uint32_t)0x00040000)
+#define ERTC_TIME_HU_3 ((uint32_t)0x00080000)
+#define ERTC_TIME_MT ((uint32_t)0x00007000)
+#define ERTC_TIME_MT_0 ((uint32_t)0x00001000)
+#define ERTC_TIME_MT_1 ((uint32_t)0x00002000)
+#define ERTC_TIME_MT_2 ((uint32_t)0x00004000)
+#define ERTC_TIME_MU ((uint32_t)0x00000F00)
+#define ERTC_TIME_MU_0 ((uint32_t)0x00000100)
+#define ERTC_TIME_MU_1 ((uint32_t)0x00000200)
+#define ERTC_TIME_MU_2 ((uint32_t)0x00000400)
+#define ERTC_TIME_MU_3 ((uint32_t)0x00000800)
+#define ERTC_TIME_ST ((uint32_t)0x00000070)
+#define ERTC_TIME_ST_0 ((uint32_t)0x00000010)
+#define ERTC_TIME_ST_1 ((uint32_t)0x00000020)
+#define ERTC_TIME_ST_2 ((uint32_t)0x00000040)
+#define ERTC_TIME_SU ((uint32_t)0x0000000F)
+#define ERTC_TIME_SU_0 ((uint32_t)0x00000001)
+#define ERTC_TIME_SU_1 ((uint32_t)0x00000002)
+#define ERTC_TIME_SU_2 ((uint32_t)0x00000004)
+#define ERTC_TIME_SU_3 ((uint32_t)0x00000008)
+
+/******************** Bits definition for ERTC_DATE register *******************/
+#define ERTC_DATE_YT ((uint32_t)0x00F00000)
+#define ERTC_DATE_YT_0 ((uint32_t)0x00100000)
+#define ERTC_DATE_YT_1 ((uint32_t)0x00200000)
+#define ERTC_DATE_YT_2 ((uint32_t)0x00400000)
+#define ERTC_DATE_YT_3 ((uint32_t)0x00800000)
+#define ERTC_DATE_YU ((uint32_t)0x000F0000)
+#define ERTC_DATE_YU_0 ((uint32_t)0x00010000)
+#define ERTC_DATE_YU_1 ((uint32_t)0x00020000)
+#define ERTC_DATE_YU_2 ((uint32_t)0x00040000)
+#define ERTC_DATE_YU_3 ((uint32_t)0x00080000)
+#define ERTC_DATE_WK ((uint32_t)0x0000E000)
+#define ERTC_DATE_WK_0 ((uint32_t)0x00002000)
+#define ERTC_DATE_WK_1 ((uint32_t)0x00004000)
+#define ERTC_DATE_WK_2 ((uint32_t)0x00008000)
+#define ERTC_DATE_MT ((uint32_t)0x00001000)
+#define ERTC_DATE_MU ((uint32_t)0x00000F00)
+#define ERTC_DATE_MU_0 ((uint32_t)0x00000100)
+#define ERTC_DATE_MU_1 ((uint32_t)0x00000200)
+#define ERTC_DATE_MU_2 ((uint32_t)0x00000400)
+#define ERTC_DATE_MU_3 ((uint32_t)0x00000800)
+#define ERTC_DATE_DT ((uint32_t)0x00000030)
+#define ERTC_DATE_DT_0 ((uint32_t)0x00000010)
+#define ERTC_DATE_DT_1 ((uint32_t)0x00000020)
+#define ERTC_DATE_DU ((uint32_t)0x0000000F)
+#define ERTC_DATE_DU_0 ((uint32_t)0x00000001)
+#define ERTC_DATE_DU_1 ((uint32_t)0x00000002)
+#define ERTC_DATE_DU_2 ((uint32_t)0x00000004)
+#define ERTC_DATE_DU_3 ((uint32_t)0x00000008)
+
+/******************** Bits definition for ERTC_CTRL register *******************/
+#define ERTC_CTRL_CALOE ((uint32_t)0x00800000)
+#define ERTC_CTRL_OSEL ((uint32_t)0x00600000)
+#define ERTC_CTRL_OSEL_0 ((uint32_t)0x00200000)
+#define ERTC_CTRL_OSEL_1 ((uint32_t)0x00400000)
+#define ERTC_CTRL_OPOL ((uint32_t)0x00100000)
+#define ERTC_CTRL_CALSEL ((uint32_t)0x00080000)
+#define ERTC_CTRL_BKP ((uint32_t)0x00040000)
+#define ERTC_CTRL_SUB1H ((uint32_t)0x00020000)
+#define ERTC_CTRL_ADD1H ((uint32_t)0x00010000)
+#define ERTC_CTRL_TSIE ((uint32_t)0x00008000)
+#define ERTC_CTRL_WATIE ((uint32_t)0x00004000)
+#define ERTC_CTRL_ALBIE ((uint32_t)0x00002000)
+#define ERTC_CTRL_ALAIE ((uint32_t)0x00001000)
+#define ERTC_CTRL_TSE ((uint32_t)0x00000800)
+#define ERTC_CTRL_WATE ((uint32_t)0x00000400)
+#define ERTC_CTRL_ALBE ((uint32_t)0x00000200)
+#define ERTC_CTRL_ALAE ((uint32_t)0x00000100)
+#define ERTC_CTRL_CDCE ((uint32_t)0x00000080)
+#define ERTC_CTRL_HFM ((uint32_t)0x00000040)
+#define ERTC_CTRL_BYPSHDW ((uint32_t)0x00000020)
+#define ERTC_CTRL_RFCKON ((uint32_t)0x00000010)
+#define ERTC_CTRL_TSEDGE ((uint32_t)0x00000008)
+#define ERTC_CTRL_WACKSEL ((uint32_t)0x00000007)
+#define ERTC_CTRL_WACKSEL_0 ((uint32_t)0x00000001)
+#define ERTC_CTRL_WACKSEL_1 ((uint32_t)0x00000002)
+#define ERTC_CTRL_WACKSEL_2 ((uint32_t)0x00000004)
+
+/******************** Bits definition for ERTC_ISTS register ******************/
+#define ERTC_ISTS_RECALPDF ((uint32_t)0x00010000)
+#define ERTC_ISTS_TPF ((uint32_t)0x00002000)
+#define ERTC_ISTS_TP2F ((uint32_t)0x00004000)
+#define ERTC_ISTS_TSOF ((uint32_t)0x00001000)
+#define ERTC_ISTS_TSF ((uint32_t)0x00000800)
+#define ERTC_ISTS_WATF ((uint32_t)0x00000400)
+#define ERTC_ISTS_ALBF ((uint32_t)0x00000200)
+#define ERTC_ISTS_ALAF ((uint32_t)0x00000100)
+#define ERTC_ISTS_INITM ((uint32_t)0x00000080)
+#define ERTC_ISTS_INITF ((uint32_t)0x00000040)
+#define ERTC_ISTS_RSF ((uint32_t)0x00000020)
+#define ERTC_ISTS_INITS ((uint32_t)0x00000010)
+#define ERTC_ISTS_SFP ((uint32_t)0x00000008)
+#define ERTC_ISTS_WATWF ((uint32_t)0x00000004)
+#define ERTC_ISTS_ALBWF ((uint32_t)0x00000002)
+#define ERTC_ISTS_ALAWF ((uint32_t)0x00000001)
+
+/******************** Bits definition for ERTC_PSC register *****************/
+#define ERTC_PSC_PRDIV_A ((uint32_t)0x007F0000)
+#define ERTC_PSC_PRDIV_S ((uint32_t)0x00001FFF)
+
+/******************** Bits definition for ERTC_WATR register *****************/
+#define ERTC_WATR_WAREV ((uint32_t)0x0000FFFF)
+
+/******************** Bits definition for ERTC_CAL register ***************/
+#define ERTC_CAL_DCALS ((uint32_t)0x00000080)
+#define ERTC_CAL_DCAL ((uint32_t)0x0000001F)
+
+/******************** Bits definition for ERTC_ALA register ***************/
+#define ERTC_ALA_MASK4 ((uint32_t)0x80000000)
+#define ERTC_ALA_WKSEL ((uint32_t)0x40000000)
+#define ERTC_ALA_DT ((uint32_t)0x30000000)
+#define ERTC_ALA_DT_0 ((uint32_t)0x10000000)
+#define ERTC_ALA_DT_1 ((uint32_t)0x20000000)
+#define ERTC_ALA_DU ((uint32_t)0x0F000000)
+#define ERTC_ALA_DU_0 ((uint32_t)0x01000000)
+#define ERTC_ALA_DU_1 ((uint32_t)0x02000000)
+#define ERTC_ALA_DU_2 ((uint32_t)0x04000000)
+#define ERTC_ALA_DU_3 ((uint32_t)0x08000000)
+#define ERTC_ALA_MASK3 ((uint32_t)0x00800000)
+#define ERTC_ALA_AMPM ((uint32_t)0x00400000)
+#define ERTC_ALA_HT ((uint32_t)0x00300000)
+#define ERTC_ALA_HT_0 ((uint32_t)0x00100000)
+#define ERTC_ALA_HT_1 ((uint32_t)0x00200000)
+#define ERTC_ALA_HU ((uint32_t)0x000F0000)
+#define ERTC_ALA_HU_0 ((uint32_t)0x00010000)
+#define ERTC_ALA_HU_1 ((uint32_t)0x00020000)
+#define ERTC_ALA_HU_2 ((uint32_t)0x00040000)
+#define ERTC_ALA_HU_3 ((uint32_t)0x00080000)
+#define ERTC_ALA_MASK2 ((uint32_t)0x00008000)
+#define ERTC_ALA_MT ((uint32_t)0x00007000)
+#define ERTC_ALA_MT_0 ((uint32_t)0x00001000)
+#define ERTC_ALA_MT_1 ((uint32_t)0x00002000)
+#define ERTC_ALA_MT_2 ((uint32_t)0x00004000)
+#define ERTC_ALA_MU ((uint32_t)0x00000F00)
+#define ERTC_ALA_MU_0 ((uint32_t)0x00000100)
+#define ERTC_ALA_MU_1 ((uint32_t)0x00000200)
+#define ERTC_ALA_MU_2 ((uint32_t)0x00000400)
+#define ERTC_ALA_MU_3 ((uint32_t)0x00000800)
+#define ERTC_ALA_MASK1 ((uint32_t)0x00000080)
+#define ERTC_ALA_ST ((uint32_t)0x00000070)
+#define ERTC_ALA_ST_0 ((uint32_t)0x00000010)
+#define ERTC_ALA_ST_1 ((uint32_t)0x00000020)
+#define ERTC_ALA_ST_2 ((uint32_t)0x00000040)
+#define ERTC_ALA_SU ((uint32_t)0x0000000F)
+#define ERTC_ALA_SU_0 ((uint32_t)0x00000001)
+#define ERTC_ALA_SU_1 ((uint32_t)0x00000002)
+#define ERTC_ALA_SU_2 ((uint32_t)0x00000004)
+#define ERTC_ALA_SU_3 ((uint32_t)0x00000008)
+
+/******************** Bits definition for ERTC_ALB register ***************/
+#define ERTC_ALB_MASK4 ((uint32_t)0x80000000)
+#define ERTC_ALB_WKSEL ((uint32_t)0x40000000)
+#define ERTC_ALB_DT ((uint32_t)0x30000000)
+#define ERTC_ALB_DT_0 ((uint32_t)0x10000000)
+#define ERTC_ALB_DT_1 ((uint32_t)0x20000000)
+#define ERTC_ALB_DU ((uint32_t)0x0F000000)
+#define ERTC_ALB_DU_0 ((uint32_t)0x01000000)
+#define ERTC_ALB_DU_1 ((uint32_t)0x02000000)
+#define ERTC_ALB_DU_2 ((uint32_t)0x04000000)
+#define ERTC_ALB_DU_3 ((uint32_t)0x08000000)
+#define ERTC_ALB_MASK3 ((uint32_t)0x00800000)
+#define ERTC_ALB_AMPM ((uint32_t)0x00400000)
+#define ERTC_ALB_HT ((uint32_t)0x00300000)
+#define ERTC_ALB_HT_0 ((uint32_t)0x00100000)
+#define ERTC_ALB_HT_1 ((uint32_t)0x00200000)
+#define ERTC_ALB_HU ((uint32_t)0x000F0000)
+#define ERTC_ALB_HU_0 ((uint32_t)0x00010000)
+#define ERTC_ALB_HU_1 ((uint32_t)0x00020000)
+#define ERTC_ALB_HU_2 ((uint32_t)0x00040000)
+#define ERTC_ALB_HU_3 ((uint32_t)0x00080000)
+#define ERTC_ALB_MASK2 ((uint32_t)0x00008000)
+#define ERTC_ALB_MT ((uint32_t)0x00007000)
+#define ERTC_ALB_MT_0 ((uint32_t)0x00001000)
+#define ERTC_ALB_MT_1 ((uint32_t)0x00002000)
+#define ERTC_ALB_MT_2 ((uint32_t)0x00004000)
+#define ERTC_ALB_MU ((uint32_t)0x00000F00)
+#define ERTC_ALB_MU_0 ((uint32_t)0x00000100)
+#define ERTC_ALB_MU_1 ((uint32_t)0x00000200)
+#define ERTC_ALB_MU_2 ((uint32_t)0x00000400)
+#define ERTC_ALB_MU_3 ((uint32_t)0x00000800)
+#define ERTC_ALB_MASK1 ((uint32_t)0x00000080)
+#define ERTC_ALB_ST ((uint32_t)0x00000070)
+#define ERTC_ALB_ST_0 ((uint32_t)0x00000010)
+#define ERTC_ALB_ST_1 ((uint32_t)0x00000020)
+#define ERTC_ALB_ST_2 ((uint32_t)0x00000040)
+#define ERTC_ALA_SU ((uint32_t)0x0000000F)
+#define ERTC_ALA_SU_0 ((uint32_t)0x00000001)
+#define ERTC_ALA_SU_1 ((uint32_t)0x00000002)
+#define ERTC_ALA_SU_2 ((uint32_t)0x00000004)
+#define ERTC_ALA_SU_3 ((uint32_t)0x00000008)
+
+/******************** Bits definition for ERTC_WPR register ******************/
+#define ERTC_WPR_KEY ((uint32_t)0x000000FF)
+
+/******************** Bits definition for ERTC_SBSR register ******************/
+#define ERTC_SBSR_SBS ((uint32_t)0x0000FFFF)
+
+/******************** Bits definition for ERTC_SFCTR register ***************/
+#define ERTC_SFCTR_SUBSBS ((uint32_t)0x00007FFF)
+#define ERTC_SFCTR_ADD1S ((uint32_t)0x80000000)
+
+/******************** Bits definition for ERTC_TSTM register *****************/
+#define ERTC_TSTM_AMPM ((uint32_t)0x00400000)
+#define ERTC_TSTM_HT ((uint32_t)0x00300000)
+#define ERTC_TSTM_HT_0 ((uint32_t)0x00100000)
+#define ERTC_TSTM_HT_1 ((uint32_t)0x00200000)
+#define ERTC_TSTM_HU ((uint32_t)0x000F0000)
+#define ERTC_TSTM_HU_0 ((uint32_t)0x00010000)
+#define ERTC_TSTM_HU_1 ((uint32_t)0x00020000)
+#define ERTC_TSTM_HU_2 ((uint32_t)0x00040000)
+#define ERTC_TSTM_HU_3 ((uint32_t)0x00080000)
+#define ERTC_TSTM_MT ((uint32_t)0x00007000)
+#define ERTC_TSTM_MT_0 ((uint32_t)0x00001000)
+#define ERTC_TSTM_MT_1 ((uint32_t)0x00002000)
+#define ERTC_TSTM_MT_2 ((uint32_t)0x00004000)
+#define ERTC_TSTM_MU ((uint32_t)0x00000F00)
+#define ERTC_TSTM_MU_0 ((uint32_t)0x00000100)
+#define ERTC_TSTM_MU_1 ((uint32_t)0x00000200)
+#define ERTC_TSTM_MU_2 ((uint32_t)0x00000400)
+#define ERTC_TSTM_MU_3 ((uint32_t)0x00000800)
+#define ERTC_TSTM_ST ((uint32_t)0x00000070)
+#define ERTC_TSTM_ST_0 ((uint32_t)0x00000010)
+#define ERTC_TSTM_ST_1 ((uint32_t)0x00000020)
+#define ERTC_TSTM_ST_2 ((uint32_t)0x00000040)
+#define ERTC_TSTM_SU ((uint32_t)0x0000000F)
+#define ERTC_TSTM_SU_0 ((uint32_t)0x00000001)
+#define ERTC_TSTM_SU_1 ((uint32_t)0x00000002)
+#define ERTC_TSTM_SU_2 ((uint32_t)0x00000004)
+#define ERTC_TSTM_SU_3 ((uint32_t)0x00000008)
+
+/******************** Bits definition for ERTC_TSDT register *****************/
+#define ERTC_TSDT_WK ((uint32_t)0x0000E000)
+#define ERTC_TSDT_WK_0 ((uint32_t)0x00002000)
+#define ERTC_TSDT_WK_1 ((uint32_t)0x00004000)
+#define ERTC_TSDT_WK_2 ((uint32_t)0x00008000)
+#define ERTC_TSDT_MT ((uint32_t)0x00001000)
+#define ERTC_TSDT_MU ((uint32_t)0x00000F00)
+#define ERTC_TSDT_MU_0 ((uint32_t)0x00000100)
+#define ERTC_TSDT_MU_1 ((uint32_t)0x00000200)
+#define ERTC_TSDT_MU_2 ((uint32_t)0x00000400)
+#define ERTC_TSDT_MU_3 ((uint32_t)0x00000800)
+#define ERTC_TSDT_DT ((uint32_t)0x00000030)
+#define ERTC_TSDT_DT_0 ((uint32_t)0x00000010)
+#define ERTC_TSDT_DT_1 ((uint32_t)0x00000020)
+#define ERTC_TSDT_DU ((uint32_t)0x0000000F)
+#define ERTC_TSDT_DU_0 ((uint32_t)0x00000001)
+#define ERTC_TSDT_DU_1 ((uint32_t)0x00000002)
+#define ERTC_TSDT_DU_2 ((uint32_t)0x00000004)
+#define ERTC_TSDT_DU_3 ((uint32_t)0x00000008)
+
+/******************** Bits definition for ERTC_TSSBS register ****************/
+#define ERTC_TSSBS_SBS ((uint32_t)0x0000FFFF)
+
+/******************** Bits definition for ERTC_CCR register *****************/
+#define ERTC_CCR_CALAD ((uint32_t)0x00008000)
+#define ERTC_CCR_CAL8 ((uint32_t)0x00004000)
+#define ERTC_CCR_CAL16 ((uint32_t)0x00002000)
+#define ERTC_CCR_CALM ((uint32_t)0x000001FF)
+#define ERTC_CCR_CALM_0 ((uint32_t)0x00000001)
+#define ERTC_CCR_CALM_1 ((uint32_t)0x00000002)
+#define ERTC_CCR_CALM_2 ((uint32_t)0x00000004)
+#define ERTC_CCR_CALM_3 ((uint32_t)0x00000008)
+#define ERTC_CCR_CALM_4 ((uint32_t)0x00000010)
+#define ERTC_CCR_CALM_5 ((uint32_t)0x00000020)
+#define ERTC_CCR_CALM_6 ((uint32_t)0x00000040)
+#define ERTC_CCR_CALM_7 ((uint32_t)0x00000080)
+#define ERTC_CCR_CALM_8 ((uint32_t)0x00000100)
+
+/******************** Bits definition for ERTC_TPAF register ****************/
+#define ERTC_TPAF_ALAOUTTYPE ((uint32_t)0x00040000)
+#define ERTC_TPAF_TSINSEL ((uint32_t)0x00020000)
+#define ERTC_TPAF_TMPINSEL ((uint32_t)0x00010000)
+#define ERTC_TPAF_TMPUDIS ((uint32_t)0x00008000)
+#define ERTC_TPAF_TMPRCH ((uint32_t)0x00006000)
+#define ERTC_TPAF_TMPRCH_0 ((uint32_t)0x00002000)
+#define ERTC_TPAF_TMPRCH_1 ((uint32_t)0x00004000)
+#define ERTC_TPAF_TMFLT ((uint32_t)0x00001800)
+#define ERTC_TPAF_TMFLT_0 ((uint32_t)0x00000800)
+#define ERTC_TPAF_TMFLT_1 ((uint32_t)0x00001000)
+#define ERTC_TPAF_TMFREQ ((uint32_t)0x00000700)
+#define ERTC_TPAF_TMFREQ_0 ((uint32_t)0x00000100)
+#define ERTC_TPAF_TMFREQ_1 ((uint32_t)0x00000200)
+#define ERTC_TPAF_TMFREQ_2 ((uint32_t)0x00000400)
+#define ERTC_TPAF_TMTS ((uint32_t)0x00000080)
+#define ERTC_TPAF_TM2TRG ((uint32_t)0x00000010)
+#define ERTC_TPAF_TM2E ((uint32_t)0x00000008)
+#define ERTC_TPAF_TMIE ((uint32_t)0x00000004)
+#define ERTC_TPAF_TM1TRG ((uint32_t)0x00000002)
+#define ERTC_TPAF_TM1E ((uint32_t)0x00000001)
+
+/******************** Bits definition for ERTC_ALASBS register *************/
+#define ERTC_ALASBS_MASKSBS ((uint32_t)0x0F000000)
+#define ERTC_ALASBS_MASKSBS_0 ((uint32_t)0x01000000)
+#define ERTC_ALASBS_MASKSBS_1 ((uint32_t)0x02000000)
+#define ERTC_ALASBS_MASKSBS_2 ((uint32_t)0x04000000)
+#define ERTC_ALASBS_MASKSBS_3 ((uint32_t)0x08000000)
+#define ERTC_ALASBS_SBS ((uint32_t)0x00007FFF)
+
+/******************** Bits definition for ERTC_ALBSBS register *************/
+#define ERTC_ALBSBS_MASKSBS ((uint32_t)0x0F000000)
+#define ERTC_ALBSBS_MASKSBS_0 ((uint32_t)0x01000000)
+#define ERTC_ALBSBS_MASKSBS_1 ((uint32_t)0x02000000)
+#define ERTC_ALBSBS_MASKSBS_2 ((uint32_t)0x04000000)
+#define ERTC_ALBSBS_MASKSBS_3 ((uint32_t)0x08000000)
+#define ERTC_ALBSBS_SBS ((uint32_t)0x00007FFF)
+
+/******************** Bits definition for ERTC_BKP0DT register ****************/
+#define ERTC_BKP0DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP1DT register ****************/
+#define ERTC_BKP1DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP2DT register ****************/
+#define ERTC_BKP2DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP3DT register ****************/
+#define ERTC_BKP3DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP4DT register ****************/
+#define ERTC_BKP4DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP5DT register ****************/
+#define ERTC_BKP5DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP6DT register ****************/
+#define ERTC_BKP6DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP7DT register ****************/
+#define ERTC_BKP7DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP8DT register ****************/
+#define ERTC_BKP8DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP9DT register ****************/
+#define ERTC_BKP9DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP10DT register ***************/
+#define ERTC_BKP10DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP11DT register ***************/
+#define ERTC_BKP11DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP12DT register ***************/
+#define ERTC_BKP12DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP13DT register ***************/
+#define ERTC_BKP13DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP14DT register ***************/
+#define ERTC_BKP14DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP15DT register ***************/
+#define ERTC_BKP15DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP16DT register ***************/
+#define ERTC_BKP16DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP17DT register ***************/
+#define ERTC_BKP17DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP18DT register ***************/
+#define ERTC_BKP18DT ((uint32_t)0xFFFFFFFF)
+
+/******************** Bits definition for ERTC_BKP19DT register ***************/
+#define ERTC_BKP19DT ((uint32_t)0xFFFFFFFF)
+
+#else
+/******************* Bit definition for RTC_CTRLH register ********************/
+#define RTC_CTRLH_PACEIEN ((uint8_t)0x01) /*!< Second Interrupt Enable */
+#define RTC_CTRLH_ALAIEN ((uint8_t)0x02) /*!< Alarm Interrupt Enable */
+#define RTC_CTRLH_OVIEN ((uint8_t)0x04) /*!< OverfloW Interrupt Enable */
+
+/******************* Bit definition for RTC_CTRLL register ********************/
+#define RTC_CTRLL_PACEF ((uint8_t)0x01) /*!< Second Flag */
+#define RTC_CTRLL_ALAF ((uint8_t)0x02) /*!< Alarm Flag */
+#define RTC_CTRLL_OVF ((uint8_t)0x04) /*!< OverfloW Flag */
+#define RTC_CTRLL_RSYNF ((uint8_t)0x08) /*!< Registers Synchronized Flag */
+#define RTC_CTRLL_CMF ((uint8_t)0x10) /*!< Configuration Flag */
+#define RTC_CTRLL_RTF ((uint8_t)0x20) /*!< RTC operation OFF */
+
+/******************* Bit definition for RTC_DIVH register *******************/
+#define RTC_DIVH_DIV ((uint16_t)0x000F) /*!< RTC Prescaler Reload Value High */
+
+/******************* Bit definition for RTC_DIVL register *******************/
+#define RTC_DIVL_DIV ((uint16_t)0xFFFF) /*!< RTC Prescaler Reload Value Low */
+
+/******************* Bit definition for RTC_DIVCNTH register *******************/
+#define RTC_DIVCNTH_RTC_DIVCNT ((uint16_t)0x000F) /*!< RTC Clock Divider High */
+
+/******************* Bit definition for RTC_DIVCNTL register *******************/
+#define RTC_DIVCNTL_RTC_DIVCNT ((uint16_t)0xFFFF) /*!< RTC Clock Divider Low */
+
+/******************* Bit definition for RTC_CNTH register *******************/
+#define RTC_CNTH_CNT ((uint16_t)0xFFFF) /*!< RTC Counter High */
+
+/******************* Bit definition for RTC_CNTL register *******************/
+#define RTC_CNTL_CNT ((uint16_t)0xFFFF) /*!< RTC Counter Low */
+
+/******************* Bit definition for RTC_ALAH register *******************/
+#define RTC_ALAH_ALA ((uint16_t)0xFFFF) /*!< RTC Alarm High */
+
+/******************* Bit definition for RTC_ALAL register *******************/
+#define RTC_ALAL_ALA ((uint16_t)0xFFFF) /*!< RTC Alarm Low */
+#endif
+/******************************************************************************/
+/* */
+/* Independent WATCHDOG */
+/* */
+/******************************************************************************/
+
+/******************* Bit definition for IWDG_KEY register ********************/
+#define IWDG_KEY_KEY ((uint16_t)0xFFFF) /*!< Key value (write only, read 0000h) */
+
+/******************* Bit definition for IWDG_PSC register ********************/
+#define IWDG_PSC_PSC ((uint8_t)0x07) /*!< PR[2:0] (Prescaler divider) */
+#define IWDG_PSC_PSC_0 ((uint8_t)0x01) /*!< Bit 0 */
+#define IWDG_PSC_PSC_1 ((uint8_t)0x02) /*!< Bit 1 */
+#define IWDG_PSC_PSC_2 ((uint8_t)0x04) /*!< Bit 2 */
+
+/******************* Bit definition for IWDG_RLD register *******************/
+#define IWDG_RLD_RLD ((uint16_t)0x0FFF) /*!< Watchdog counter reload value */
+
+/******************* Bit definition for IWDG_STS register ********************/
+#define IWDG_STS_PSCF ((uint8_t)0x01) /*!< Watchdog prescaler value update */
+#define IWDG_STS_RLDF ((uint8_t)0x02) /*!< Watchdog counter reload value update */
+
+/******************************************************************************/
+/* */
+/* Window WATCHDOG */
+/* */
+/******************************************************************************/
+
+/******************* Bit definition for WWDG_CTRL register ********************/
+#define WWDG_CTRL_CNTR ((uint8_t)0x7F) /*!< T[6:0] bits (7-Bit counter (MSB to LSB)) */
+#define WWDG_CTRL_CNTR0 ((uint8_t)0x01) /*!< Bit 0 */
+#define WWDG_CTRL_CNTR1 ((uint8_t)0x02) /*!< Bit 1 */
+#define WWDG_CTRL_CNTR2 ((uint8_t)0x04) /*!< Bit 2 */
+#define WWDG_CTRL_CNTR3 ((uint8_t)0x08) /*!< Bit 3 */
+#define WWDG_CTRL_CNTR4 ((uint8_t)0x10) /*!< Bit 4 */
+#define WWDG_CTRL_CNTR5 ((uint8_t)0x20) /*!< Bit 5 */
+#define WWDG_CTRL_CNTR6 ((uint8_t)0x40) /*!< Bit 6 */
+
+#define WWDG_CTRL_EN ((uint8_t)0x80) /*!< Activation bit */
+
+/******************* Bit definition for WWDG_CFG register *******************/
+#define WWDG_CFG_WCNTR ((uint16_t)0x007F) /*!< W[6:0] bits (7-bit window value) */
+#define WWDG_CFG_WCNTR0 ((uint16_t)0x0001) /*!< Bit 0 */
+#define WWDG_CFG_WCNTR1 ((uint16_t)0x0002) /*!< Bit 1 */
+#define WWDG_CFG_WCNTR2 ((uint16_t)0x0004) /*!< Bit 2 */
+#define WWDG_CFG_WCNTR3 ((uint16_t)0x0008) /*!< Bit 3 */
+#define WWDG_CFG_WCNTR4 ((uint16_t)0x0010) /*!< Bit 4 */
+#define WWDG_CFG_WCNTR5 ((uint16_t)0x0020) /*!< Bit 5 */
+#define WWDG_CFG_WCNTR6 ((uint16_t)0x0040) /*!< Bit 6 */
+
+#define WWDG_CFG_PSC ((uint16_t)0x0180) /*!< WDGTB[1:0] bits (Timer Base) */
+#define WWDG_CFG_PSC0 ((uint16_t)0x0080) /*!< Bit 0 */
+#define WWDG_CFG_PSC1 ((uint16_t)0x0100) /*!< Bit 1 */
+
+#define WWDG_CFG_EWIEN ((uint16_t)0x0200) /*!< Early Wakeup Interrupt */
+
+/******************* Bit definition for WWDG_STS register ********************/
+#define WWDG_STS_EWIF ((uint8_t)0x01) /*!< Early Wakeup Interrupt Flag */
+
+/******************************************************************************/
+/* */
+/* eXternal Memory Controller */
+/* */
+/******************************************************************************/
+
+/****************** Bit definition for XMC_BK1CTRL1 register *******************/
+#define XMC_BK1CTRL1_EN ((uint32_t)0x00000001) /*!< Memory bank enable bit */
+#define XMC_BK1CTRL1_MUXEN ((uint32_t)0x00000002) /*!< Address/data multiplexing enable bit */
+
+#define XMC_BK1CTRL1_DEV ((uint32_t)0x0000000C) /*!< MTYP[1:0] bits (Memory type) */
+#define XMC_BK1CTRL1_DEV_0 ((uint32_t)0x00000004) /*!< Bit 0 */
+#define XMC_BK1CTRL1_DEV_1 ((uint32_t)0x00000008) /*!< Bit 1 */
+
+#define XMC_BK1CTRL1_BUSTYPE ((uint32_t)0x00000030) /*!< MWID[1:0] bits (Memory data bus width) */
+#define XMC_BK1CTRL1_BUSTYPE_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1CTRL1_BUSTYPE_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+
+#define XMC_BK1CTRL1_NOREN ((uint32_t)0x00000040) /*!< Flash access enable */
+#define XMC_BK1CTRL1_BURSTEN ((uint32_t)0x00000100) /*!< Burst enable bit */
+#define XMC_BK1CTRL1_WAITALV ((uint32_t)0x00000200) /*!< Wait signal polarity bit */
+#define XMC_BK1CTRL1_BRSTSPLTEN ((uint32_t)0x00000400) /*!< Wrapped burst mode support */
+#define XMC_BK1CTRL1_WAITCFG ((uint32_t)0x00000800) /*!< Wait timing configuration */
+#define XMC_BK1CTRL1_WREN ((uint32_t)0x00001000) /*!< Write enable bit */
+#define XMC_BK1CTRL1_WAITEN ((uint32_t)0x00002000) /*!< Wait enable bit */
+#define XMC_BK1CTRL1_TMGWREN ((uint32_t)0x00004000) /*!< Extended mode enable */
+#define XMC_BK1CTRL1_WAITASYNC ((uint32_t)0x00008000) /*!< Asynchronous wait */
+#define XMC_BK1CTRL1_BURSTWRSYN ((uint32_t)0x00080000) /*!< Write burst enable */
+
+/****************** Bit definition for XMC_BK1CTRL2 register *******************/
+#define XMC_BK1CTRL2_EN ((uint32_t)0x00000001) /*!< Memory bank enable bit */
+#define XMC_BK1CTRL2_MUXEN ((uint32_t)0x00000002) /*!< Address/data multiplexing enable bit */
+
+#define XMC_BK1CTRL2_DEV ((uint32_t)0x0000000C) /*!< MTYP[1:0] bits (Memory type) */
+#define XMC_BK1CTRL2_DEV_0 ((uint32_t)0x00000004) /*!< Bit 0 */
+#define XMC_BK1CTRL2_DEV_1 ((uint32_t)0x00000008) /*!< Bit 1 */
+
+#define XMC_BK1CTRL2_BUSTYPE ((uint32_t)0x00000030) /*!< MWID[1:0] bits (Memory data bus width) */
+#define XMC_BK1CTRL2_BUSTYPE_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1CTRL2_BUSTYPE_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+
+#define XMC_BK1CTRL2_NOREN ((uint32_t)0x00000040) /*!< Flash access enable */
+#define XMC_BK1CTRL2_BURSTEN ((uint32_t)0x00000100) /*!< Burst enable bit */
+#define XMC_BK1CTRL2_WAITALV ((uint32_t)0x00000200) /*!< Wait signal polarity bit */
+#define XMC_BK1CTRL2_BRSTSPLTEN ((uint32_t)0x00000400) /*!< Wrapped burst mode support */
+#define XMC_BK1CTRL2_WAITCFG ((uint32_t)0x00000800) /*!< Wait timing configuration */
+#define XMC_BK1CTRL2_WREN ((uint32_t)0x00001000) /*!< Write enable bit */
+#define XMC_BK1CTRL2_WAITEN ((uint32_t)0x00002000) /*!< Wait enable bit */
+#define XMC_BK1CTRL2_TMGWREN ((uint32_t)0x00004000) /*!< Extended mode enable */
+#define XMC_BK1CTRL2_WAITASYNC ((uint32_t)0x00008000) /*!< Asynchronous wait */
+#define XMC_BK1CTRL2_BURSTWRSYN ((uint32_t)0x00080000) /*!< Write burst enable */
+
+/****************** Bit definition for XMC_BK1CTRL3 register *******************/
+#define XMC_BK1CTRL3_EN ((uint32_t)0x00000001) /*!< Memory bank enable bit */
+#define XMC_BK1CTRL3_MUXEN ((uint32_t)0x00000002) /*!< Address/data multiplexing enable bit */
+
+#define XMC_BK1CTRL3_DEV ((uint32_t)0x0000000C) /*!< MTYP[1:0] bits (Memory type) */
+#define XMC_BK1CTRL3_DEV_0 ((uint32_t)0x00000004) /*!< Bit 0 */
+#define XMC_BK1CTRL3_DEV_1 ((uint32_t)0x00000008) /*!< Bit 1 */
+
+#define XMC_BK1CTRL3_BUSTYPE ((uint32_t)0x00000030) /*!< MWID[1:0] bits (Memory data bus width) */
+#define XMC_BK1CTRL3_BUSTYPE_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1CTRL3_BUSTYPE_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+
+#define XMC_BK1CTRL3_NOREN ((uint32_t)0x00000040) /*!< Flash access enable */
+#define XMC_BK1CTRL3_BURSTEN ((uint32_t)0x00000100) /*!< Burst enable bit */
+#define XMC_BK1CTRL3_WAITALV ((uint32_t)0x00000200) /*!< Wait signal polarity bit. */
+#define XMC_BK1CTRL3_BRSTSPLTEN ((uint32_t)0x00000400) /*!< Wrapped burst mode support */
+#define XMC_BK1CTRL3_WAITCFG ((uint32_t)0x00000800) /*!< Wait timing configuration */
+#define XMC_BK1CTRL3_WREN ((uint32_t)0x00001000) /*!< Write enable bit */
+#define XMC_BK1CTRL3_WAITEN ((uint32_t)0x00002000) /*!< Wait enable bit */
+#define XMC_BK1CTRL3_TMGWREN ((uint32_t)0x00004000) /*!< Extended mode enable */
+#define XMC_BK1CTRL3_WAITASYNC ((uint32_t)0x00008000) /*!< Asynchronous wait */
+#define XMC_BK1CTRL3_BURSTWRSYN ((uint32_t)0x00080000) /*!< Write burst enable */
+
+/****************** Bit definition for XMC_BK1CTRL4 register *******************/
+#define XMC_BK1CTRL4_EN ((uint32_t)0x00000001) /*!< Memory bank enable bit */
+#define XMC_BK1CTRL4_MUXEN ((uint32_t)0x00000002) /*!< Address/data multiplexing enable bit */
+
+#define XMC_BK1CTRL4_DEV ((uint32_t)0x0000000C) /*!< MTYP[1:0] bits (Memory type) */
+#define XMC_BK1CTRL4_DEV_0 ((uint32_t)0x00000004) /*!< Bit 0 */
+#define XMC_BK1CTRL4_DEV_1 ((uint32_t)0x00000008) /*!< Bit 1 */
+
+#define XMC_BK1CTRL4_BUSTYPE ((uint32_t)0x00000030) /*!< MWID[1:0] bits (Memory data bus width) */
+#define XMC_BK1CTRL4_BUSTYPE_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1CTRL4_BUSTYPE_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+
+#define XMC_BK1CTRL4_NOREN ((uint32_t)0x00000040) /*!< Flash access enable */
+#define XMC_BK1CTRL4_BURSTEN ((uint32_t)0x00000100) /*!< Burst enable bit */
+#define XMC_BK1CTRL4_WAITALV ((uint32_t)0x00000200) /*!< Wait signal polarity bit */
+#define XMC_BK1CTRL4_BRSTSPLTEN ((uint32_t)0x00000400) /*!< Wrapped burst mode support */
+#define XMC_BK1CTRL4_WAITCFG ((uint32_t)0x00000800) /*!< Wait timing configuration */
+#define XMC_BK1CTRL4_WREN ((uint32_t)0x00001000) /*!< Write enable bit */
+#define XMC_BK1CTRL4_WAITEN ((uint32_t)0x00002000) /*!< Wait enable bit */
+#define XMC_BK1CTRL4_TMGWREN ((uint32_t)0x00004000) /*!< Extended mode enable */
+#define XMC_BK1CTRL4_WAITASYNC ((uint32_t)0x00008000) /*!< Asynchronous wait */
+#define XMC_BK1CTRL4_BURSTWRSYN ((uint32_t)0x00080000) /*!< Write burst enable */
+
+/****************** Bit definition for XMC_BK1TMG1 register ******************/
+#define XMC_BK1TMG1_ADROP ((uint32_t)0x0000000F) /*!< ADDSET[3:0] bits (Address setup phase duration) */
+#define XMC_BK1TMG1_ADROP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK1TMG1_ADROP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK1TMG1_ADROP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK1TMG1_ADROP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+
+#define XMC_BK1TMG1_ADRHLD ((uint32_t)0x000000F0) /*!< ADDHLD[3:0] bits (Address-hold phase duration) */
+#define XMC_BK1TMG1_ADRHLD_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1TMG1_ADRHLD_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+#define XMC_BK1TMG1_ADRHLD_2 ((uint32_t)0x00000040) /*!< Bit 2 */
+#define XMC_BK1TMG1_ADRHLD_3 ((uint32_t)0x00000080) /*!< Bit 3 */
+
+#define XMC_BK1TMG1_DTOP ((uint32_t)0x0000FF00) /*!< DATAST [3:0] bits (Data-phase duration) */
+#define XMC_BK1TMG1_DTOP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK1TMG1_DTOP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK1TMG1_DTOP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK1TMG1_DTOP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+
+#define XMC_BK1TMG1_INTVLOP ((uint32_t)0x000F0000) /*!< BUSTURN[3:0] bits (Bus turnaround phase duration) */
+#define XMC_BK1TMG1_INTVLOP_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK1TMG1_INTVLOP_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK1TMG1_INTVLOP_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK1TMG1_INTVLOP_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+
+#define XMC_BK1TMG1_CLKPSC ((uint32_t)0x00F00000) /*!< CLKDIV[3:0] bits (Clock divide ratio) */
+#define XMC_BK1TMG1_CLKPSC_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define XMC_BK1TMG1_CLKPSC_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+#define XMC_BK1TMG1_CLKPSC_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define XMC_BK1TMG1_CLKPSC_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+
+#define XMC_BK1TMG1_DTSTBL ((uint32_t)0x0F000000) /*!< DATLA[3:0] bits (Data latency) */
+#define XMC_BK1TMG1_DTSTBL_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK1TMG1_DTSTBL_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK1TMG1_DTSTBL_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK1TMG1_DTSTBL_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+
+#define XMC_BK1TMG1_MODE ((uint32_t)0x30000000) /*!< ACCMOD[1:0] bits (Access mode) */
+#define XMC_BK1TMG1_MODE_0 ((uint32_t)0x10000000) /*!< Bit 0 */
+#define XMC_BK1TMG1_MODE_1 ((uint32_t)0x20000000) /*!< Bit 1 */
+
+/****************** Bit definition for XMC_BK1TMG2 register *******************/
+#define XMC_BK1TMG2_ADROP ((uint32_t)0x0000000F) /*!< ADDSET[3:0] bits (Address setup phase duration) */
+#define XMC_BK1TMG2_ADROP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK1TMG2_ADROP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK1TMG2_ADROP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK1TMG2_ADROP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+
+#define XMC_BK1TMG2_ADRHLD ((uint32_t)0x000000F0) /*!< ADDHLD[3:0] bits (Address-hold phase duration) */
+#define XMC_BK1TMG2_ADRHLD_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1TMG2_ADRHLD_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+#define XMC_BK1TMG2_ADRHLD_2 ((uint32_t)0x00000040) /*!< Bit 2 */
+#define XMC_BK1TMG2_ADRHLD_3 ((uint32_t)0x00000080) /*!< Bit 3 */
+
+#define XMC_BK1TMG2_DTOP ((uint32_t)0x0000FF00) /*!< DATAST [3:0] bits (Data-phase duration) */
+#define XMC_BK1TMG2_DTOP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK1TMG2_DTOP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK1TMG2_DTOP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK1TMG2_DTOP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+
+#define XMC_BK1TMG2_INTVLOP ((uint32_t)0x000F0000) /*!< BUSTURN[3:0] bits (Bus turnaround phase duration) */
+#define XMC_BK1TMG2_INTVLOP_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK1TMG2_INTVLOP_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK1TMG2_INTVLOP_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK1TMG2_INTVLOP_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+
+#define XMC_BK1TMG2_CLKPSC ((uint32_t)0x00F00000) /*!< CLKDIV[3:0] bits (Clock divide ratio) */
+#define XMC_BK1TMG2_CLKPSC_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define XMC_BK1TMG2_CLKPSC_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+#define XMC_BK1TMG2_CLKPSC_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define XMC_BK1TMG2_CLKPSC_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+
+#define XMC_BK1TMG2_DTSTBL ((uint32_t)0x0F000000) /*!< DATLA[3:0] bits (Data latency) */
+#define XMC_BK1TMG2_DTSTBL_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK1TMG2_DTSTBL_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK1TMG2_DTSTBL_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK1TMG2_DTSTBL_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+
+#define XMC_BK1TMG2_MODE ((uint32_t)0x30000000) /*!< ACCMOD[1:0] bits (Access mode) */
+#define XMC_BK1TMG2_MODE_0 ((uint32_t)0x10000000) /*!< Bit 0 */
+#define XMC_BK1TMG2_MODE_1 ((uint32_t)0x20000000) /*!< Bit 1 */
+
+/******************* Bit definition for XMC_BK1TMG3 register *******************/
+#define XMC_BK1TMG3_ADROP ((uint32_t)0x0000000F) /*!< ADDSET[3:0] bits (Address setup phase duration) */
+#define XMC_BK1TMG3_ADROP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK1TMG3_ADROP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK1TMG3_ADROP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK1TMG3_ADROP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+
+#define XMC_BK1TMG3_ADRHLD ((uint32_t)0x000000F0) /*!< ADDHLD[3:0] bits (Address-hold phase duration) */
+#define XMC_BK1TMG3_ADRHLD_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1TMG3_ADRHLD_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+#define XMC_BK1TMG3_ADRHLD_2 ((uint32_t)0x00000040) /*!< Bit 2 */
+#define XMC_BK1TMG3_ADRHLD_3 ((uint32_t)0x00000080) /*!< Bit 3 */
+
+#define XMC_BK1TMG3_DTOP ((uint32_t)0x0000FF00) /*!< DATAST [3:0] bits (Data-phase duration) */
+#define XMC_BK1TMG3_DTOP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK1TMG3_DTOP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK1TMG3_DTOP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK1TMG3_DTOP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+
+#define XMC_BK1TMG3_INTVLOP ((uint32_t)0x000F0000) /*!< BUSTURN[3:0] bits (Bus turnaround phase duration) */
+#define XMC_BK1TMG3_INTVLOP_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK1TMG3_INTVLOP_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK1TMG3_INTVLOP_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK1TMG3_INTVLOP_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+
+#define XMC_BK1TMG3_CLKPSC ((uint32_t)0x00F00000) /*!< CLKDIV[3:0] bits (Clock divide ratio) */
+#define XMC_BK1TMG3_CLKPSC_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define XMC_BK1TMG3_CLKPSC_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+#define XMC_BK1TMG3_CLKPSC_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define XMC_BK1TMG3_CLKPSC_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+
+#define XMC_BK1TMG3_DTSTBL ((uint32_t)0x0F000000) /*!< DATLA[3:0] bits (Data latency) */
+#define XMC_BK1TMG3_DTSTBL_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK1TMG3_DTSTBL_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK1TMG3_DTSTBL_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK1TMG3_DTSTBL_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+
+#define XMC_BK1TMG3_MODE ((uint32_t)0x30000000) /*!< ACCMOD[1:0] bits (Access mode) */
+#define XMC_BK1TMG3_MODE_0 ((uint32_t)0x10000000) /*!< Bit 0 */
+#define XMC_BK1TMG3_MODE_1 ((uint32_t)0x20000000) /*!< Bit 1 */
+
+/****************** Bit definition for XMC_BK1TMG4 register *******************/
+#define XMC_BK1TMG4_ADROP ((uint32_t)0x0000000F) /*!< ADDSET[3:0] bits (Address setup phase duration) */
+#define XMC_BK1TMG4_ADROP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK1TMG4_ADROP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK1TMG4_ADROP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK1TMG4_ADROP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+
+#define XMC_BK1TMG4_ADRHLD ((uint32_t)0x000000F0) /*!< ADDHLD[3:0] bits (Address-hold phase duration) */
+#define XMC_BK1TMG4_ADRHLD_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1TMG4_ADRHLD_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+#define XMC_BK1TMG4_ADRHLD_2 ((uint32_t)0x00000040) /*!< Bit 2 */
+#define XMC_BK1TMG4_ADRHLD_3 ((uint32_t)0x00000080) /*!< Bit 3 */
+
+#define XMC_BK1TMG4_DTOP ((uint32_t)0x0000FF00) /*!< DATAST [3:0] bits (Data-phase duration) */
+#define XMC_BK1TMG4_DTOP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK1TMG4_DTOP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK1TMG4_DTOP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK1TMG4_DTOP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+
+#define XMC_BK1TMG4_INTVLOP ((uint32_t)0x000F0000) /*!< BUSTURN[3:0] bits (Bus turnaround phase duration) */
+#define XMC_BK1TMG4_INTVLOP_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK1TMG4_INTVLOP_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK1TMG4_INTVLOP_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK1TMG4_INTVLOP_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+
+#define XMC_BK1TMG4_CLKPSC ((uint32_t)0x00F00000) /*!< CLKDIV[3:0] bits (Clock divide ratio) */
+#define XMC_BK1TMG4_CLKPSC_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define XMC_BK1TMG4_CLKPSC_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+#define XMC_BK1TMG4_CLKPSC_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define XMC_BK1TMG4_CLKPSC_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+
+#define XMC_BK1TMG4_DTSTBL ((uint32_t)0x0F000000) /*!< DATLA[3:0] bits (Data latency) */
+#define XMC_BK1TMG4_DTSTBL_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK1TMG4_DTSTBL_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK1TMG4_DTSTBL_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK1TMG4_DTSTBL_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+
+#define XMC_BK1TMG4_MODE ((uint32_t)0x30000000) /*!< ACCMOD[1:0] bits (Access mode) */
+#define XMC_BK1TMG4_MODE_0 ((uint32_t)0x10000000) /*!< Bit 0 */
+#define XMC_BK1TMG4_MODE_1 ((uint32_t)0x20000000) /*!< Bit 1 */
+
+/****************** Bit definition for XMC_BK1TMGWR1 register ******************/
+#define XMC_BK1TMGWR1_ADROP ((uint32_t)0x0000000F) /*!< ADDSET[3:0] bits (Address setup phase duration) */
+#define XMC_BK1TMGWR1_ADROP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK1TMGWR1_ADROP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK1TMGWR1_ADROP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK1TMGWR1_ADROP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR1_ADRHLD ((uint32_t)0x000000F0) /*!< ADDHLD[3:0] bits (Address-hold phase duration) */
+#define XMC_BK1TMGWR1_ADRHLD_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1TMGWR1_ADRHLD_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+#define XMC_BK1TMGWR1_ADRHLD_2 ((uint32_t)0x00000040) /*!< Bit 2 */
+#define XMC_BK1TMGWR1_ADRHLD_3 ((uint32_t)0x00000080) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR1_DTOP ((uint32_t)0x0000FF00) /*!< DATAST [3:0] bits (Data-phase duration) */
+#define XMC_BK1TMGWR1_DTOP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK1TMGWR1_DTOP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK1TMGWR1_DTOP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK1TMGWR1_DTOP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR1_CLKPSC ((uint32_t)0x00F00000) /*!< CLKDIV[3:0] bits (Clock divide ratio) */
+#define XMC_BK1TMGWR1_CLKPSC_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define XMC_BK1TMGWR1_CLKPSC_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+#define XMC_BK1TMGWR1_CLKPSC_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define XMC_BK1TMGWR1_CLKPSC_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR1_DTSTBL ((uint32_t)0x0F000000) /*!< DATLA[3:0] bits (Data latency) */
+#define XMC_BK1TMGWR1_DTSTBL_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK1TMGWR1_DTSTBL_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK1TMGWR1_DTSTBL_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK1TMGWR1_DTSTBL_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR1_MODE ((uint32_t)0x30000000) /*!< ACCMOD[1:0] bits (Access mode) */
+#define XMC_BK1TMGWR1_MODE_0 ((uint32_t)0x10000000) /*!< Bit 0 */
+#define XMC_BK1TMGWR1_MODE_1 ((uint32_t)0x20000000) /*!< Bit 1 */
+
+/****************** Bit definition for XMC_BK1TMGWR2 register ******************/
+#define XMC_BK1TMGWR2_ADROP ((uint32_t)0x0000000F) /*!< ADDSET[3:0] bits (Address setup phase duration) */
+#define XMC_BK1TMGWR2_ADROP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK1TMGWR2_ADROP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK1TMGWR2_ADROP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK1TMGWR2_ADROP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR2_ADRHLD ((uint32_t)0x000000F0) /*!< ADDHLD[3:0] bits (Address-hold phase duration) */
+#define XMC_BK1TMGWR2_ADRHLD_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1TMGWR2_ADRHLD_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+#define XMC_BK1TMGWR2_ADRHLD_2 ((uint32_t)0x00000040) /*!< Bit 2 */
+#define XMC_BK1TMGWR2_ADRHLD_3 ((uint32_t)0x00000080) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR2_DTOP ((uint32_t)0x0000FF00) /*!< DATAST [3:0] bits (Data-phase duration) */
+#define XMC_BK1TMGWR2_DTOP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK1TMGWR2_DTOP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK1TMGWR2_DTOP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK1TMGWR2_DTOP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR2_CLKPSC ((uint32_t)0x00F00000) /*!< CLKDIV[3:0] bits (Clock divide ratio) */
+#define XMC_BK1TMGWR2_CLKPSC_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define XMC_BK1TMGWR2_CLKPSC_1 ((uint32_t)0x00200000) /*!< Bit 1*/
+#define XMC_BK1TMGWR2_CLKPSC_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define XMC_BK1TMGWR2_CLKPSC_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR2_DTSTBL ((uint32_t)0x0F000000) /*!< DATLA[3:0] bits (Data latency) */
+#define XMC_BK1TMGWR2_DTSTBL_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK1TMGWR2_DTSTBL_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK1TMGWR2_DTSTBL_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK1TMGWR2_DTSTBL_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR2_MODE ((uint32_t)0x30000000) /*!< ACCMOD[1:0] bits (Access mode) */
+#define XMC_BK1TMGWR2_MODE_0 ((uint32_t)0x10000000) /*!< Bit 0 */
+#define XMC_BK1TMGWR2_MODE_1 ((uint32_t)0x20000000) /*!< Bit 1 */
+
+/****************** Bit definition for XMC_BK1TMGWR3 register ******************/
+#define XMC_BK1TMGWR3_ADROP ((uint32_t)0x0000000F) /*!< ADDSET[3:0] bits (Address setup phase duration) */
+#define XMC_BK1TMGWR3_ADROP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK1TMGWR3_ADROP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK1TMGWR3_ADROP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK1TMGWR3_ADROP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR3_ADRHLD ((uint32_t)0x000000F0) /*!< ADDHLD[3:0] bits (Address-hold phase duration) */
+#define XMC_BK1TMGWR3_ADRHLD_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1TMGWR3_ADRHLD_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+#define XMC_BK1TMGWR3_ADRHLD_2 ((uint32_t)0x00000040) /*!< Bit 2 */
+#define XMC_BK1TMGWR3_ADRHLD_3 ((uint32_t)0x00000080) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR3_DTOP ((uint32_t)0x0000FF00) /*!< DATAST [3:0] bits (Data-phase duration) */
+#define XMC_BK1TMGWR3_DTOP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK1TMGWR3_DTOP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK1TMGWR3_DTOP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK1TMGWR3_DTOP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR3_CLKPSC ((uint32_t)0x00F00000) /*!< CLKDIV[3:0] bits (Clock divide ratio) */
+#define XMC_BK1TMGWR3_CLKPSC_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define XMC_BK1TMGWR3_CLKPSC_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+#define XMC_BK1TMGWR3_CLKPSC_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define XMC_BK1TMGWR3_CLKPSC_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR3_DTSTBL ((uint32_t)0x0F000000) /*!< DATLA[3:0] bits (Data latency) */
+#define XMC_BK1TMGWR3_DTSTBL_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK1TMGWR3_DTSTBL_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK1TMGWR3_DTSTBL_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK1TMGWR3_DTSTBL_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR3_MODE ((uint32_t)0x30000000) /*!< ACCMOD[1:0] bits (Access mode) */
+#define XMC_BK1TMGWR3_MODE_0 ((uint32_t)0x10000000) /*!< Bit 0 */
+#define XMC_BK1TMGWR3_MODE_1 ((uint32_t)0x20000000) /*!< Bit 1 */
+
+/****************** Bit definition for XMC_BK1TMGWR4 register ******************/
+#define XMC_BK1TMGWR4_ADROP ((uint32_t)0x0000000F) /*!< ADDSET[3:0] bits (Address setup phase duration) */
+#define XMC_BK1TMGWR4_ADROP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK1TMGWR4_ADROP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK1TMGWR4_ADROP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK1TMGWR4_ADROP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR4_ADRHLD ((uint32_t)0x000000F0) /*!< ADDHLD[3:0] bits (Address-hold phase duration) */
+#define XMC_BK1TMGWR4_ADRHLD_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK1TMGWR4_ADRHLD_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+#define XMC_BK1TMGWR4_ADRHLD_2 ((uint32_t)0x00000040) /*!< Bit 2 */
+#define XMC_BK1TMGWR4_ADRHLD_3 ((uint32_t)0x00000080) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR4_DTOP ((uint32_t)0x0000FF00) /*!< DATAST [3:0] bits (Data-phase duration) */
+#define XMC_BK1TMGWR4_DTOP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK1TMGWR4_DTOP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK1TMGWR4_DTOP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK1TMGWR4_DTOP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR4_CLKPSC ((uint32_t)0x00F00000) /*!< CLKDIV[3:0] bits (Clock divide ratio) */
+#define XMC_BK1TMGWR4_CLKPSC_0 ((uint32_t)0x00100000) /*!< Bit 0 */
+#define XMC_BK1TMGWR4_CLKPSC_1 ((uint32_t)0x00200000) /*!< Bit 1 */
+#define XMC_BK1TMGWR4_CLKPSC_2 ((uint32_t)0x00400000) /*!< Bit 2 */
+#define XMC_BK1TMGWR4_CLKPSC_3 ((uint32_t)0x00800000) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR4_DTSTBL ((uint32_t)0x0F000000) /*!< DATLA[3:0] bits (Data latency) */
+#define XMC_BK1TMGWR4_DTSTBL_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK1TMGWR4_DTSTBL_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK1TMGWR4_DTSTBL_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK1TMGWR4_DTSTBL_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+
+#define XMC_BK1TMGWR4_MODE ((uint32_t)0x30000000) /*!< ACCMOD[1:0] bits (Access mode) */
+#define XMC_BK1TMGWR4_MODE_0 ((uint32_t)0x10000000) /*!< Bit 0 */
+#define XMC_BK1TMGWR4_MODE_1 ((uint32_t)0x20000000) /*!< Bit 1 */
+
+/****************** Bit definition for XMC_BK2CTRL register *******************/
+#define XMC_BK2CTRL_WAITEN ((uint32_t)0x00000002) /*!< Wait feature enable bit */
+#define XMC_BK2CTRL_EN ((uint32_t)0x00000004) /*!< PC Card/NAND Flash memory bank enable bit */
+#define XMC_BK2CTRL_DEV ((uint32_t)0x00000008) /*!< Memory type */
+
+#define XMC_BK2CTRL_BUSTYPE ((uint32_t)0x00000030) /*!< PWID[1:0] bits (NAND Flash databus width) */
+#define XMC_BK2CTRL_BUSTYPE_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK2CTRL_BUSTYPE_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+
+#define XMC_BK2CTRL_ECCEN ((uint32_t)0x00000040) /*!< ECC computation logic enable bit */
+
+#define XMC_BK2CTRL_DLYCR ((uint32_t)0x00001E00) /*!< TCLR[3:0] bits (CLE to RE delay) */
+#define XMC_BK2CTRL_DLYCR_0 ((uint32_t)0x00000200) /*!< Bit 0 */
+#define XMC_BK2CTRL_DLYCR_1 ((uint32_t)0x00000400) /*!< Bit 1 */
+#define XMC_BK2CTRL_DLYCR_2 ((uint32_t)0x00000800) /*!< Bit 2 */
+#define XMC_BK2CTRL_DLYCR_3 ((uint32_t)0x00001000) /*!< Bit 3 */
+
+#define XMC_BK2CTRL_DLYAR ((uint32_t)0x0001E000) /*!< TAR[3:0] bits (ALE to RE delay) */
+#define XMC_BK2CTRL_DLYAR_0 ((uint32_t)0x00002000) /*!< Bit 0 */
+#define XMC_BK2CTRL_DLYAR_1 ((uint32_t)0x00004000) /*!< Bit 1 */
+#define XMC_BK2CTRL_DLYAR_2 ((uint32_t)0x00008000) /*!< Bit 2 */
+#define XMC_BK2CTRL_DLYAR_3 ((uint32_t)0x00010000) /*!< Bit 3 */
+
+#define XMC_BK2CTRL_ECCPGSIZE ((uint32_t)0x000E0000) /*!< ECCPS[1:0] bits (ECC page size) */
+#define XMC_BK2CTRL_ECCPGSIZE_0 ((uint32_t)0x00020000) /*!< Bit 0 */
+#define XMC_BK2CTRL_ECCPGSIZE_1 ((uint32_t)0x00040000) /*!< Bit 1 */
+#define XMC_BK2CTRL_ECCPGSIZE_2 ((uint32_t)0x00080000) /*!< Bit 2 */
+
+/****************** Bit definition for XMC_BK3CTRL register *******************/
+#define XMC_BK3CTRL_WAITEN ((uint32_t)0x00000002) /*!< Wait feature enable bit */
+#define XMC_BK3CTRL_EN ((uint32_t)0x00000004) /*!< PC Card/NAND Flash memory bank enable bit */
+#define XMC_BK3CTRL_DEV ((uint32_t)0x00000008) /*!< Memory type */
+
+#define XMC_BK3CTRL_BUSTYPE ((uint32_t)0x00000030) /*!< PWID[1:0] bits (NAND Flash databus width) */
+#define XMC_BK3CTRL_BUSTYPE_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK3CTRL_BUSTYPE_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+
+#define XMC_BK3CTRL_ECCEN ((uint32_t)0x00000040) /*!< ECC computation logic enable bit */
+
+#define XMC_BK3CTRL_DLYCR ((uint32_t)0x00001E00) /*!< TCLR[3:0] bits (CLE to RE delay) */
+#define XMC_BK3CTRL_DLYCR_0 ((uint32_t)0x00000200) /*!< Bit 0 */
+#define XMC_BK3CTRL_DLYCR_1 ((uint32_t)0x00000400) /*!< Bit 1 */
+#define XMC_BK3CTRL_DLYCR_2 ((uint32_t)0x00000800) /*!< Bit 2 */
+#define XMC_BK3CTRL_DLYCR_3 ((uint32_t)0x00001000) /*!< Bit 3 */
+
+#define XMC_BK3CTRL_DLYAR ((uint32_t)0x0001E000) /*!< TAR[3:0] bits (ALE to RE delay) */
+#define XMC_BK3CTRL_DLYAR_0 ((uint32_t)0x00002000) /*!< Bit 0 */
+#define XMC_BK3CTRL_DLYAR_1 ((uint32_t)0x00004000) /*!< Bit 1 */
+#define XMC_BK3CTRL_DLYAR_2 ((uint32_t)0x00008000) /*!< Bit 2 */
+#define XMC_BK3CTRL_DLYAR_3 ((uint32_t)0x00010000) /*!< Bit 3 */
+
+#define XMC_BK3CTRL_ECCPGSIZE ((uint32_t)0x000E0000) /*!< ECCPS[2:0] bits (ECC page size) */
+#define XMC_BK3CTRL_ECCPGSIZE_0 ((uint32_t)0x00020000) /*!< Bit 0 */
+#define XMC_BK3CTRL_ECCPGSIZE_1 ((uint32_t)0x00040000) /*!< Bit 1 */
+#define XMC_BK3CTRL_ECCPGSIZE_2 ((uint32_t)0x00080000) /*!< Bit 2 */
+
+/****************** Bit definition for XMC_BK4CTRL register *******************/
+#define XMC_BK4CTRL_WAITEN ((uint32_t)0x00000002) /*!< Wait feature enable bit */
+#define XMC_BK4CTRL_EN ((uint32_t)0x00000004) /*!< PC Card/NAND Flash memory bank enable bit */
+#define XMC_BK4CTRL_DEV ((uint32_t)0x00000008) /*!< Memory type */
+
+#define XMC_BK4CTRL_BUSTYPE ((uint32_t)0x00000030) /*!< PWID[1:0] bits (NAND Flash databus width) */
+#define XMC_BK4CTRL_BUSTYPE_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define XMC_BK4CTRL_BUSTYPE_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+
+#define XMC_BK4CTRL_ECCEN ((uint32_t)0x00000040) /*!< ECC computation logic enable bit */
+
+#define XMC_BK4CTRL_DLYCR ((uint32_t)0x00001E00) /*!< TCLR[3:0] bits (CLE to RE delay) */
+#define XMC_BK4CTRL_DLYCR_0 ((uint32_t)0x00000200) /*!< Bit 0 */
+#define XMC_BK4CTRL_DLYCR_1 ((uint32_t)0x00000400) /*!< Bit 1 */
+#define XMC_BK4CTRL_DLYCR_2 ((uint32_t)0x00000800) /*!< Bit 2 */
+#define XMC_BK4CTRL_DLYCR_3 ((uint32_t)0x00001000) /*!< Bit 3 */
+
+#define XMC_BK4CTRL_DLYAR ((uint32_t)0x0001E000) /*!< TAR[3:0] bits (ALE to RE delay) */
+#define XMC_BK4CTRL_DLYAR_0 ((uint32_t)0x00002000) /*!< Bit 0 */
+#define XMC_BK4CTRL_DLYAR_1 ((uint32_t)0x00004000) /*!< Bit 1 */
+#define XMC_BK4CTRL_DLYAR_2 ((uint32_t)0x00008000) /*!< Bit 2 */
+#define XMC_BK4CTRL_DLYAR_3 ((uint32_t)0x00010000) /*!< Bit 3 */
+
+#define XMC_BK4CTRL_ECCPGSIZE ((uint32_t)0x000E0000) /*!< ECCPS[2:0] bits (ECC page size) */
+#define XMC_BK4CTRL_ECCPGSIZE_0 ((uint32_t)0x00020000) /*!< Bit 0 */
+#define XMC_BK4CTRL_ECCPGSIZE_1 ((uint32_t)0x00040000) /*!< Bit 1 */
+#define XMC_BK4CTRL_ECCPGSIZE_2 ((uint32_t)0x00080000) /*!< Bit 2 */
+
+/******************* Bit definition for XMC_BK2STS register *******************/
+#define XMC_BK2STS_IRF ((uint8_t)0x01) /*!< Interrupt Rising Edge status */
+#define XMC_BK2STS_IHLF ((uint8_t)0x02) /*!< Interrupt Level status */
+#define XMC_BK2STS_IFF ((uint8_t)0x04) /*!< Interrupt Falling Edge status */
+#define XMC_BK2STS_IREN ((uint8_t)0x08) /*!< Interrupt Rising Edge detection Enable bit */
+#define XMC_BK2STS_IHLEN ((uint8_t)0x10) /*!< Interrupt Level detection Enable bit */
+#define XMC_BK2STS_IFEN ((uint8_t)0x20) /*!< Interrupt Falling Edge detection Enable bit */
+#define XMC_BK2STS_FIFOE ((uint8_t)0x40) /*!< FIFO empty */
+
+/******************* Bit definition for XMC_BK3STS register *******************/
+#define XMC_BK3STS_IRF ((uint8_t)0x01) /*!< Interrupt Rising Edge status */
+#define XMC_BK3STS_IHLF ((uint8_t)0x02) /*!< Interrupt Level status */
+#define XMC_BK3STS_IFF ((uint8_t)0x04) /*!< Interrupt Falling Edge status */
+#define XMC_BK3STS_IREN ((uint8_t)0x08) /*!< Interrupt Rising Edge detection Enable bit */
+#define XMC_BK3STS_IHLEN ((uint8_t)0x10) /*!< Interrupt Level detection Enable bit */
+#define XMC_BK3STS_IFEN ((uint8_t)0x20) /*!< Interrupt Falling Edge detection Enable bit */
+#define XMC_BK3STS_FIFOE ((uint8_t)0x40) /*!< FIFO empty */
+
+/******************* Bit definition for XMC_BK4STS register *******************/
+#define XMC_BK4STS_IRF ((uint8_t)0x01) /*!< Interrupt Rising Edge status */
+#define XMC_BK4STS_IHLF ((uint8_t)0x02) /*!< Interrupt Level status */
+#define XMC_BK4STS_IFF ((uint8_t)0x04) /*!< Interrupt Falling Edge status */
+#define XMC_BK4STS_IREN ((uint8_t)0x08) /*!< Interrupt Rising Edge detection Enable bit */
+#define XMC_BK4STS_IHLEN ((uint8_t)0x10) /*!< Interrupt Level detection Enable bit */
+#define XMC_BK4STS_IFEN ((uint8_t)0x20) /*!< Interrupt Falling Edge detection Enable bit */
+#define XMC_BK4STS_FIFOE ((uint8_t)0x40) /*!< FIFO empty */
+
+/****************** Bit definition for XMC_BK2TMGMEM register ******************/
+#define XMC_BK2TMGMEM_STP ((uint32_t)0x000000FF) /*!< MEMSET2[7:0] bits (Common memory 2 setup time) */
+#define XMC_BK2TMGMEM_STP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK2TMGMEM_STP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK2TMGMEM_STP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK2TMGMEM_STP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define XMC_BK2TMGMEM_STP_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+#define XMC_BK2TMGMEM_STP_5 ((uint32_t)0x00000020) /*!< Bit 5 */
+#define XMC_BK2TMGMEM_STP_6 ((uint32_t)0x00000040) /*!< Bit 6 */
+#define XMC_BK2TMGMEM_STP_7 ((uint32_t)0x00000080) /*!< Bit 7 */
+
+#define XMC_BK2TMGMEM_OP ((uint32_t)0x0000FF00) /*!< MEMWAIT2[7:0] bits (Common memory 2 wait time) */
+#define XMC_BK2TMGMEM_OP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK2TMGMEM_OP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK2TMGMEM_OP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK2TMGMEM_OP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+#define XMC_BK2TMGMEM_OP_4 ((uint32_t)0x00001000) /*!< Bit 4 */
+#define XMC_BK2TMGMEM_OP_5 ((uint32_t)0x00002000) /*!< Bit 5 */
+#define XMC_BK2TMGMEM_OP_6 ((uint32_t)0x00004000) /*!< Bit 6 */
+#define XMC_BK2TMGMEM_OP_7 ((uint32_t)0x00008000) /*!< Bit 7 */
+
+#define XMC_BK2TMGMEM_HLD ((uint32_t)0x00FF0000) /*!< MEMHOLD2[7:0] bits (Common memory 2 hold time) */
+#define XMC_BK2TMGMEM_HLD_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK2TMGMEM_HLD_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK2TMGMEM_HLD_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK2TMGMEM_HLD_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+#define XMC_BK2TMGMEM_HLD_4 ((uint32_t)0x00100000) /*!< Bit 4 */
+#define XMC_BK2TMGMEM_HLD_5 ((uint32_t)0x00200000) /*!< Bit 5 */
+#define XMC_BK2TMGMEM_HLD_6 ((uint32_t)0x00400000) /*!< Bit 6 */
+#define XMC_BK2TMGMEM_HLD_7 ((uint32_t)0x00800000) /*!< Bit 7 */
+
+#define XMC_BK2TMGMEM_WRSTP ((uint32_t)0xFF000000) /*!< MEMHIZ2[7:0] bits (Common memory 2 databus HiZ time) */
+#define XMC_BK2TMGMEM_WRSTP_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK2TMGMEM_WRSTP_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK2TMGMEM_WRSTP_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK2TMGMEM_WRSTP_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+#define XMC_BK2TMGMEM_WRSTP_4 ((uint32_t)0x10000000) /*!< Bit 4 */
+#define XMC_BK2TMGMEM_WRSTP_5 ((uint32_t)0x20000000) /*!< Bit 5 */
+#define XMC_BK2TMGMEM_WRSTP_6 ((uint32_t)0x40000000) /*!< Bit 6 */
+#define XMC_BK2TMGMEM_WRSTP_7 ((uint32_t)0x80000000) /*!< Bit 7 */
+
+/****************** Bit definition for XMC_BK3TMGMEM register ******************/
+#define XMC_BK3TMGMEM_STP ((uint32_t)0x000000FF) /*!< MEMSET3[7:0] bits (Common memory 3 setup time) */
+#define XMC_BK3TMGMEM_STP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK3TMGMEM_STP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK3TMGMEM_STP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK3TMGMEM_STP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define XMC_BK3TMGMEM_STP_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+#define XMC_BK3TMGMEM_STP_5 ((uint32_t)0x00000020) /*!< Bit 5 */
+#define XMC_BK3TMGMEM_STP_6 ((uint32_t)0x00000040) /*!< Bit 6 */
+#define XMC_BK3TMGMEM_STP_7 ((uint32_t)0x00000080) /*!< Bit 7 */
+
+#define XMC_BK3TMGMEM_OP ((uint32_t)0x0000FF00) /*!< MEMWAIT3[7:0] bits (Common memory 3 wait time) */
+#define XMC_BK3TMGMEM_OP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK3TMGMEM_OP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK3TMGMEM_OP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK3TMGMEM_OP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+#define XMC_BK3TMGMEM_OP_4 ((uint32_t)0x00001000) /*!< Bit 4 */
+#define XMC_BK3TMGMEM_OP_5 ((uint32_t)0x00002000) /*!< Bit 5 */
+#define XMC_BK3TMGMEM_OP_6 ((uint32_t)0x00004000) /*!< Bit 6 */
+#define XMC_BK3TMGMEM_OP_7 ((uint32_t)0x00008000) /*!< Bit 7 */
+
+#define XMC_BK3TMGMEM_HLD ((uint32_t)0x00FF0000) /*!< MEMHOLD3[7:0] bits (Common memory 3 hold time) */
+#define XMC_BK3TMGMEM_HLD_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK3TMGMEM_HLD_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK3TMGMEM_HLD_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK3TMGMEM_HLD_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+#define XMC_BK3TMGMEM_HLD_4 ((uint32_t)0x00100000) /*!< Bit 4 */
+#define XMC_BK3TMGMEM_HLD_5 ((uint32_t)0x00200000) /*!< Bit 5 */
+#define XMC_BK3TMGMEM_HLD_6 ((uint32_t)0x00400000) /*!< Bit 6 */
+#define XMC_BK3TMGMEM_HLD_7 ((uint32_t)0x00800000) /*!< Bit 7 */
+
+#define XMC_BK3TMGMEM_WRSTP ((uint32_t)0xFF000000) /*!< MEMHIZ3[7:0] bits (Common memory 3 databus HiZ time) */
+#define XMC_BK3TMGMEM_WRSTP_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK3TMGMEM_WRSTP_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK3TMGMEM_WRSTP_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK3TMGMEM_WRSTP_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+#define XMC_BK3TMGMEM_WRSTP_4 ((uint32_t)0x10000000) /*!< Bit 4 */
+#define XMC_BK3TMGMEM_WRSTP_5 ((uint32_t)0x20000000) /*!< Bit 5 */
+#define XMC_BK3TMGMEM_WRSTP_6 ((uint32_t)0x40000000) /*!< Bit 6 */
+#define XMC_BK3TMGMEM_WRSTP_7 ((uint32_t)0x80000000) /*!< Bit 7 */
+
+/****************** Bit definition for XMC_BK4TMGMEM register ******************/
+#define XMC_BK4TMGMEM_STP ((uint32_t)0x000000FF) /*!< MEMSET4[7:0] bits (Common memory 4 setup time) */
+#define XMC_BK4TMGMEM_STP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK4TMGMEM_STP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK4TMGMEM_STP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK4TMGMEM_STP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define XMC_BK4TMGMEM_STP_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+#define XMC_BK4TMGMEM_STP_5 ((uint32_t)0x00000020) /*!< Bit 5 */
+#define XMC_BK4TMGMEM_STP_6 ((uint32_t)0x00000040) /*!< Bit 6 */
+#define XMC_BK4TMGMEM_STP_7 ((uint32_t)0x00000080) /*!< Bit 7 */
+
+#define XMC_BK4TMGMEM_OP ((uint32_t)0x0000FF00) /*!< MEMWAIT4[7:0] bits (Common memory 4 wait time) */
+#define XMC_BK4TMGMEM_OP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK4TMGMEM_OP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK4TMGMEM_OP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK4TMGMEM_OP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+#define XMC_BK4TMGMEM_OP_4 ((uint32_t)0x00001000) /*!< Bit 4 */
+#define XMC_BK4TMGMEM_OP_5 ((uint32_t)0x00002000) /*!< Bit 5 */
+#define XMC_BK4TMGMEM_OP_6 ((uint32_t)0x00004000) /*!< Bit 6 */
+#define XMC_BK4TMGMEM_OP_7 ((uint32_t)0x00008000) /*!< Bit 7 */
+
+#define XMC_BK4TMGMEM_HLD ((uint32_t)0x00FF0000) /*!< MEMHOLD4[7:0] bits (Common memory 4 hold time) */
+#define XMC_BK4TMGMEM_HLD_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK4TMGMEM_HLD_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK4TMGMEM_HLD_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK4TMGMEM_HLD_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+#define XMC_BK4TMGMEM_HLD_4 ((uint32_t)0x00100000) /*!< Bit 4 */
+#define XMC_BK4TMGMEM_HLD_5 ((uint32_t)0x00200000) /*!< Bit 5 */
+#define XMC_BK4TMGMEM_HLD_6 ((uint32_t)0x00400000) /*!< Bit 6 */
+#define XMC_BK4TMGMEM_HLD_7 ((uint32_t)0x00800000) /*!< Bit 7 */
+
+#define XMC_BK4TMGMEM_WRSTP ((uint32_t)0xFF000000) /*!< MEMHIZ4[7:0] bits (Common memory 4 databus HiZ time) */
+#define XMC_BK4TMGMEM_WRSTP_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK4TMGMEM_WRSTP_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK4TMGMEM_WRSTP_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK4TMGMEM_WRSTP_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+#define XMC_BK4TMGMEM_WRSTP_4 ((uint32_t)0x10000000) /*!< Bit 4 */
+#define XMC_BK4TMGMEM_WRSTP_5 ((uint32_t)0x20000000) /*!< Bit 5 */
+#define XMC_BK4TMGMEM_WRSTP_6 ((uint32_t)0x40000000) /*!< Bit 6 */
+#define XMC_BK4TMGMEM_WRSTP_7 ((uint32_t)0x80000000) /*!< Bit 7 */
+
+/****************** Bit definition for XMC_BK2TMGATT register ******************/
+#define XMC_BK2TMGATT_STP ((uint32_t)0x000000FF) /*!< ATTSET2[7:0] bits (Attribute memory 2 setup time) */
+#define XMC_BK2TMGATT_STP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK2TMGATT_STP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK2TMGATT_STP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK2TMGATT_STP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define XMC_BK2TMGATT_STP_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+#define XMC_BK2TMGATT_STP_5 ((uint32_t)0x00000020) /*!< Bit 5 */
+#define XMC_BK2TMGATT_STP_6 ((uint32_t)0x00000040) /*!< Bit 6 */
+#define XMC_BK2TMGATT_STP_7 ((uint32_t)0x00000080) /*!< Bit 7 */
+
+#define XMC_BK2TMGATT_OP ((uint32_t)0x0000FF00) /*!< ATTWAIT2[7:0] bits (Attribute memory 2 wait time) */
+#define XMC_BK2TMGATT_OP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK2TMGATT_OP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK2TMGATT_OP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK2TMGATT_OP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+#define XMC_BK2TMGATT_OP_4 ((uint32_t)0x00001000) /*!< Bit 4 */
+#define XMC_BK2TMGATT_OP_5 ((uint32_t)0x00002000) /*!< Bit 5 */
+#define XMC_BK2TMGATT_OP_6 ((uint32_t)0x00004000) /*!< Bit 6 */
+#define XMC_BK2TMGATT_OP_7 ((uint32_t)0x00008000) /*!< Bit 7 */
+
+#define XMC_BK2TMGATT_HLD ((uint32_t)0x00FF0000) /*!< ATTHOLD2[7:0] bits (Attribute memory 2 hold time) */
+#define XMC_BK2TMGATT_HLD_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK2TMGATT_HLD_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK2TMGATT_HLD_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK2TMGATT_HLD_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+#define XMC_BK2TMGATT_HLD_4 ((uint32_t)0x00100000) /*!< Bit 4 */
+#define XMC_BK2TMGATT_HLD_5 ((uint32_t)0x00200000) /*!< Bit 5 */
+#define XMC_BK2TMGATT_HLD_6 ((uint32_t)0x00400000) /*!< Bit 6 */
+#define XMC_BK2TMGATT_HLD_7 ((uint32_t)0x00800000) /*!< Bit 7 */
+
+#define XMC_BK2TMGATT_WRSTP ((uint32_t)0xFF000000) /*!< ATTHIZ2[7:0] bits (Attribute memory 2 databus HiZ time) */
+#define XMC_BK2TMGATT_WRSTP_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK2TMGATT_WRSTP_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK2TMGATT_WRSTP_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK2TMGATT_WRSTP_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+#define XMC_BK2TMGATT_WRSTP_4 ((uint32_t)0x10000000) /*!< Bit 4 */
+#define XMC_BK2TMGATT_WRSTP_5 ((uint32_t)0x20000000) /*!< Bit 5 */
+#define XMC_BK2TMGATT_WRSTP_6 ((uint32_t)0x40000000) /*!< Bit 6 */
+#define XMC_BK2TMGATT_WRSTP_7 ((uint32_t)0x80000000) /*!< Bit 7 */
+
+/****************** Bit definition for XMC_BK3TMGATT register ******************/
+#define XMC_BK3TMGATT_STP ((uint32_t)0x000000FF) /*!< ATTSET3[7:0] bits (Attribute memory 3 setup time) */
+#define XMC_BK3TMGATT_STP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK3TMGATT_STP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK3TMGATT_STP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK3TMGATT_STP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define XMC_BK3TMGATT_STP_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+#define XMC_BK3TMGATT_STP_5 ((uint32_t)0x00000020) /*!< Bit 5 */
+#define XMC_BK3TMGATT_STP_6 ((uint32_t)0x00000040) /*!< Bit 6 */
+#define XMC_BK3TMGATT_STP_7 ((uint32_t)0x00000080) /*!< Bit 7 */
+
+#define XMC_BK3TMGATT_OP ((uint32_t)0x0000FF00) /*!< ATTWAIT3[7:0] bits (Attribute memory 3 wait time) */
+#define XMC_BK3TMGATT_OP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK3TMGATT_OP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK3TMGATT_OP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK3TMGATT_OP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+#define XMC_BK3TMGATT_OP_4 ((uint32_t)0x00001000) /*!< Bit 4 */
+#define XMC_BK3TMGATT_OP_5 ((uint32_t)0x00002000) /*!< Bit 5 */
+#define XMC_BK3TMGATT_OP_6 ((uint32_t)0x00004000) /*!< Bit 6 */
+#define XMC_BK3TMGATT_OP_7 ((uint32_t)0x00008000) /*!< Bit 7 */
+
+#define XMC_BK3TMGATT_HLD ((uint32_t)0x00FF0000) /*!< ATTHOLD3[7:0] bits (Attribute memory 3 hold time) */
+#define XMC_BK3TMGATT_HLD_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK3TMGATT_HLD_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK3TMGATT_HLD_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK3TMGATT_HLD_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+#define XMC_BK3TMGATT_HLD_4 ((uint32_t)0x00100000) /*!< Bit 4 */
+#define XMC_BK3TMGATT_HLD_5 ((uint32_t)0x00200000) /*!< Bit 5 */
+#define XMC_BK3TMGATT_HLD_6 ((uint32_t)0x00400000) /*!< Bit 6 */
+#define XMC_BK3TMGATT_HLD_7 ((uint32_t)0x00800000) /*!< Bit 7 */
+
+#define XMC_BK3TMGATT_WRSTP ((uint32_t)0xFF000000) /*!< ATTHIZ3[7:0] bits (Attribute memory 3 databus HiZ time) */
+#define XMC_BK3TMGATT_WRSTP_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK3TMGATT_WRSTP_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK3TMGATT_WRSTP_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK3TMGATT_WRSTP_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+#define XMC_BK3TMGATT_WRSTP_4 ((uint32_t)0x10000000) /*!< Bit 4 */
+#define XMC_BK3TMGATT_WRSTP_5 ((uint32_t)0x20000000) /*!< Bit 5 */
+#define XMC_BK3TMGATT_WRSTP_6 ((uint32_t)0x40000000) /*!< Bit 6 */
+#define XMC_BK3TMGATT_WRSTP_7 ((uint32_t)0x80000000) /*!< Bit 7 */
+
+/****************** Bit definition for XMC_BK4TMGATT register ******************/
+#define XMC_BK4TMGATT_STP ((uint32_t)0x000000FF) /*!< ATTSET4[7:0] bits (Attribute memory 4 setup time) */
+#define XMC_BK4TMGATT_STP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK4TMGATT_STP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK4TMGATT_STP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK4TMGATT_STP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define XMC_BK4TMGATT_STP_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+#define XMC_BK4TMGATT_STP_5 ((uint32_t)0x00000020) /*!< Bit 5 */
+#define XMC_BK4TMGATT_STP_6 ((uint32_t)0x00000040) /*!< Bit 6 */
+#define XMC_BK4TMGATT_STP_7 ((uint32_t)0x00000080) /*!< Bit 7 */
+
+#define XMC_BK4TMGATT_OP ((uint32_t)0x0000FF00) /*!< ATTWAIT4[7:0] bits (Attribute memory 4 wait time) */
+#define XMC_BK4TMGATT_OP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK4TMGATT_OP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK4TMGATT_OP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK4TMGATT_OP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+#define XMC_BK4TMGATT_OP_4 ((uint32_t)0x00001000) /*!< Bit 4 */
+#define XMC_BK4TMGATT_OP_5 ((uint32_t)0x00002000) /*!< Bit 5 */
+#define XMC_BK4TMGATT_OP_6 ((uint32_t)0x00004000) /*!< Bit 6 */
+#define XMC_BK4TMGATT_OP_7 ((uint32_t)0x00008000) /*!< Bit 7 */
+
+#define XMC_BK4TMGATT_HLD ((uint32_t)0x00FF0000) /*!< ATTHOLD4[7:0] bits (Attribute memory 4 hold time) */
+#define XMC_BK4TMGATT_HLD_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK4TMGATT_HLD_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK4TMGATT_HLD_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK4TMGATT_HLD_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+#define XMC_BK4TMGATT_HLD_4 ((uint32_t)0x00100000) /*!< Bit 4 */
+#define XMC_BK4TMGATT_HLD_5 ((uint32_t)0x00200000) /*!< Bit 5 */
+#define XMC_BK4TMGATT_HLD_6 ((uint32_t)0x00400000) /*!< Bit 6 */
+#define XMC_BK4TMGATT_HLD_7 ((uint32_t)0x00800000) /*!< Bit 7 */
+
+#define XMC_BK4TMGATT_WRSTP ((uint32_t)0xFF000000) /*!< ATTHIZ4[7:0] bits (Attribute memory 4 databus HiZ time) */
+#define XMC_BK4TMGATT_WRSTP_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK4TMGATT_WRSTP_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK4TMGATT_WRSTP_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK4TMGATT_WRSTP_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+#define XMC_BK4TMGATT_WRSTP_4 ((uint32_t)0x10000000) /*!< Bit 4 */
+#define XMC_BK4TMGATT_WRSTP_5 ((uint32_t)0x20000000) /*!< Bit 5 */
+#define XMC_BK4TMGATT_WRSTP_6 ((uint32_t)0x40000000) /*!< Bit 6 */
+#define XMC_BK4TMGATT_WRSTP_7 ((uint32_t)0x80000000) /*!< Bit 7 */
+
+/****************** Bit definition for XMC_BK4TMGIO register *******************/
+#define XMC_BK4TMGIO_STP ((uint32_t)0x000000FF) /*!< IOSET4[7:0] bits (I/O 4 setup time) */
+#define XMC_BK4TMGIO_STP_0 ((uint32_t)0x00000001) /*!< Bit 0 */
+#define XMC_BK4TMGIO_STP_1 ((uint32_t)0x00000002) /*!< Bit 1 */
+#define XMC_BK4TMGIO_STP_2 ((uint32_t)0x00000004) /*!< Bit 2 */
+#define XMC_BK4TMGIO_STP_3 ((uint32_t)0x00000008) /*!< Bit 3 */
+#define XMC_BK4TMGIO_STP_4 ((uint32_t)0x00000010) /*!< Bit 4 */
+#define XMC_BK4TMGIO_STP_5 ((uint32_t)0x00000020) /*!< Bit 5 */
+#define XMC_BK4TMGIO_STP_6 ((uint32_t)0x00000040) /*!< Bit 6 */
+#define XMC_BK4TMGIO_STP_7 ((uint32_t)0x00000080) /*!< Bit 7 */
+
+#define XMC_BK4TMGIO_OP ((uint32_t)0x0000FF00) /*!< IOWAIT4[7:0] bits (I/O 4 wait time) */
+#define XMC_BK4TMGIO_OP_0 ((uint32_t)0x00000100) /*!< Bit 0 */
+#define XMC_BK4TMGIO_OP_1 ((uint32_t)0x00000200) /*!< Bit 1 */
+#define XMC_BK4TMGIO_OP_2 ((uint32_t)0x00000400) /*!< Bit 2 */
+#define XMC_BK4TMGIO_OP_3 ((uint32_t)0x00000800) /*!< Bit 3 */
+#define XMC_BK4TMGIO_OP_4 ((uint32_t)0x00001000) /*!< Bit 4 */
+#define XMC_BK4TMGIO_OP_5 ((uint32_t)0x00002000) /*!< Bit 5 */
+#define XMC_BK4TMGIO_OP_6 ((uint32_t)0x00004000) /*!< Bit 6 */
+#define XMC_BK4TMGIO_OP_7 ((uint32_t)0x00008000) /*!< Bit 7 */
+
+#define XMC_BK4TMGIO_HLD ((uint32_t)0x00FF0000) /*!< IOHOLD4[7:0] bits (I/O 4 hold time) */
+#define XMC_BK4TMGIO_HLD_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define XMC_BK4TMGIO_HLD_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define XMC_BK4TMGIO_HLD_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define XMC_BK4TMGIO_HLD_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+#define XMC_BK4TMGIO_HLD_4 ((uint32_t)0x00100000) /*!< Bit 4 */
+#define XMC_BK4TMGIO_HLD_5 ((uint32_t)0x00200000) /*!< Bit 5 */
+#define XMC_BK4TMGIO_HLD_6 ((uint32_t)0x00400000) /*!< Bit 6 */
+#define XMC_BK4TMGIO_HLD_7 ((uint32_t)0x00800000) /*!< Bit 7 */
+
+#define XMC_BK4TMGIO_WRSTP ((uint32_t)0xFF000000) /*!< IOHIZ4[7:0] bits (I/O 4 databus HiZ time) */
+#define XMC_BK4TMGIO_WRSTP_0 ((uint32_t)0x01000000) /*!< Bit 0 */
+#define XMC_BK4TMGIO_WRSTP_1 ((uint32_t)0x02000000) /*!< Bit 1 */
+#define XMC_BK4TMGIO_WRSTP_2 ((uint32_t)0x04000000) /*!< Bit 2 */
+#define XMC_BK4TMGIO_WRSTP_3 ((uint32_t)0x08000000) /*!< Bit 3 */
+#define XMC_BK4TMGIO_WRSTP_4 ((uint32_t)0x10000000) /*!< Bit 4 */
+#define XMC_BK4TMGIO_WRSTP_5 ((uint32_t)0x20000000) /*!< Bit 5 */
+#define XMC_BK4TMGIO_WRSTP_6 ((uint32_t)0x40000000) /*!< Bit 6 */
+#define XMC_BK4TMGIO_WRSTP_7 ((uint32_t)0x80000000) /*!< Bit 7 */
+
+/****************** Bit definition for XMC_BK2ECC register ******************/
+#define XMC_BK2ECC_ECC ((uint32_t)0xFFFFFFFF) /*!< ECC result */
+
+/****************** Bit definition for XMC_BK3ECC register ******************/
+#define XMC_BK3ECC_ECC ((uint32_t)0xFFFFFFFF) /*!< ECC result */
+
+/******************************************************************************/
+/* */
+/* SD host Interface */
+/* */
+/******************************************************************************/
+
+/****************** Bit definition for SDIO_POWER register ******************/
+#define SDIO_POWER_PWRCTRL ((uint8_t)0x03) /*!< PWRCTRL[1:0] bits (Power supply control bits) */
+#define SDIO_POWER_PWRCTRL_0 ((uint8_t)0x01) /*!< Bit 0 */
+#define SDIO_POWER_PWRCTRL_1 ((uint8_t)0x02) /*!< Bit 1 */
+
+/****************** Bit definition for SDIO_CLKCTRL register ******************/
+#define SDIO_CLKCTRL_CLKPSC ((uint16_t)0x00FF) /*!< Clock divide factor */
+#define SDIO_CLKCTRL_CLKEN ((uint16_t)0x0100) /*!< Clock enable bit */
+#define SDIO_CLKCTRL_PWRSVG ((uint16_t)0x0200) /*!< Power saving configuration bit */
+#define SDIO_CLKCTRL_BYPS ((uint16_t)0x0400) /*!< Clock divider bypass enable bit */
+
+#define SDIO_CLKCTRL_BUSWIDTH ((uint16_t)0x1800) /*!< WIDBUS[1:0] bits (Wide bus mode enable bit) */
+#define SDIO_CLKCR_WIDBUS_0 ((uint16_t)0x0800) /*!< Bit 0 */
+#define SDIO_CLKCR_WIDBUS_1 ((uint16_t)0x1000) /*!< Bit 1 */
+
+#define SDIO_CLKCTRL_CLKEDG ((uint16_t)0x2000) /*!< SDIO_CK dephasing selection bit */
+#define SDIO_CLKCTRL_FLWCTRLEN ((uint16_t)0x4000) /*!< HW Flow Control enable */
+
+/******************* Bit definition for SDIO_ARG register *******************/
+#define SDIO_ARG_ARG ((uint32_t)0xFFFFFFFF) /*!< Command argument */
+
+/******************* Bit definition for SDIO_CMD register *******************/
+#define SDIO_CMD_CMDIDX ((uint16_t)0x003F) /*!< Command Index */
+
+#define SDIO_CMD_RSPWT ((uint16_t)0x00C0) /*!< WAITRESP[1:0] bits (Wait for response bits) */
+#define SDIO_CMD_WAITRESP_0 ((uint16_t)0x0040) /*!< Bit 0 */
+#define SDIO_CMD_WAITRESP_1 ((uint16_t)0x0080) /*!< Bit 1 */
+
+#define SDIO_CMD_INTWT ((uint16_t)0x0100) /*!< CPSM Waits for Interrupt Request */
+#define SDIO_CMD_PNDWT ((uint16_t)0x0200) /*!< CPSM Waits for ends of data transfer (CmdPend internal signal) */
+#define SDIO_CMD_CMDMEN ((uint16_t)0x0400) /*!< Command path state machine (CPSM) Enable bit */
+#define SDIO_CMD_SDIOSUSP ((uint16_t)0x0800) /*!< SD I/O suspend command */
+#define SDIO_CMD_CMPLSGNLEN ((uint16_t)0x1000) /*!< Enable CMD completion */
+#define SDIO_CMD_INTDIS ((uint16_t)0x2000) /*!< Interrupt Disable */
+#define SDIO_CMD_ATACMD ((uint16_t)0x4000) /*!< CE-ATA command */
+
+/***************** Bit definition for SDIO_RSPCMD register *****************/
+#define SDIO_RSPCMD_RSPCMD ((uint8_t)0x3F) /*!< Response command index */
+
+/****************** Bit definition for SDIO_RESP0 register ******************/
+#define SDIO_RESP0_CARDSTATUS0 ((uint32_t)0xFFFFFFFF) /*!< Card Status */
+
+/****************** Bit definition for SDIO_RSP1 register ******************/
+#define SDIO_RSP1_CARDSTS1 ((uint32_t)0xFFFFFFFF) /*!< Card Status */
+
+/****************** Bit definition for SDIO_RSP2 register ******************/
+#define SDIO_RSP2_CARDSTS2 ((uint32_t)0xFFFFFFFF) /*!< Card Status */
+
+/****************** Bit definition for SDIO_RSP3 register ******************/
+#define SDIO_RSP3_CARDSTS3 ((uint32_t)0xFFFFFFFF) /*!< Card Status */
+
+/****************** Bit definition for SDIO_RSP4 register ******************/
+#define SDIO_RSP4_CARDSTS4 ((uint32_t)0xFFFFFFFF) /*!< Card Status */
+
+/****************** Bit definition for SDIO_DTTMR register *****************/
+#define SDIO_DTTMR_TIMEOUT ((uint32_t)0xFFFFFFFF) /*!< Data timeout period. */
+
+/****************** Bit definition for SDIO_DTLEN register *******************/
+#define SDIO_DTLEN_DTLEN ((uint32_t)0x01FFFFFF) /*!< Data length value */
+
+/****************** Bit definition for SDIO_DTCTRL register ******************/
+#define SDIO_DTCTRL_TFREN ((uint16_t)0x0001) /*!< Data transfer enabled bit */
+#define SDIO_DTCTRL_TFRDIR ((uint16_t)0x0002) /*!< Data transfer direction selection */
+#define SDIO_DTCTRL_TFRMODE ((uint16_t)0x0004) /*!< Data transfer mode selection */
+#define SDIO_DTCTRL_DMAEN ((uint16_t)0x0008) /*!< DMA enabled bit */
+
+#define SDIO_DTCTRL_BLKSIZE ((uint16_t)0x00F0) /*!< DBLOCKSIZE[3:0] bits (Data block size) */
+#define SDIO_DTCTRL_DBLOCKSIZE_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define SDIO_DTCTRL_DBLOCKSIZE_1 ((uint16_t)0x0020) /*!< Bit 1 */
+#define SDIO_DTCTRL_DBLOCKSIZE_2 ((uint16_t)0x0040) /*!< Bit 2 */
+#define SDIO_DTCTRL_DBLOCKSIZE_3 ((uint16_t)0x0080) /*!< Bit 3 */
+
+#define SDIO_DTCTRL_RDWTSTART ((uint16_t)0x0100) /*!< Read wait start */
+#define SDIO_DTCTRL_RDWTSTOP ((uint16_t)0x0200) /*!< Read wait stop */
+#define SDIO_DTCTRL_RDWTMODE ((uint16_t)0x0400) /*!< Read wait mode */
+#define SDIO_DTCTRL_SDIOEN ((uint16_t)0x0800) /*!< SD I/O enable functions */
+
+/****************** Bit definition for SDIO_DTCNTR register *****************/
+#define SDIO_DTCNTR_DTCNT ((uint32_t)0x01FFFFFF) /*!< Data count value */
+
+/****************** Bit definition for SDIO_STS register ********************/
+#define SDIO_STS_CMDFAIL ((uint32_t)0x00000001) /*!< Command response received (CRC check failed) */
+#define SDIO_STS_DTFAIL ((uint32_t)0x00000002) /*!< Data block sent/received (CRC check failed) */
+#define SDIO_STS_CMDTIMEOUT ((uint32_t)0x00000004) /*!< Command response timeout */
+#define SDIO_STS_DTTIMEOUT ((uint32_t)0x00000008) /*!< Data timeout */
+#define SDIO_STS_TXERRU ((uint32_t)0x00000010) /*!< Transmit FIFO underrun error */
+#define SDIO_STS_RXERRO ((uint32_t)0x00000020) /*!< Received FIFO overrun error */
+#define SDIO_STS_CMDRSPCMPL ((uint32_t)0x00000040) /*!< Command response received (CRC check passed) */
+#define SDIO_STS_CMDCMPL ((uint32_t)0x00000080) /*!< Command sent (no response required) */
+#define SDIO_STS_DTCMPL ((uint32_t)0x00000100) /*!< Data end (data counter, SDIDCOUNT, is zero) */
+#define SDIO_STS_SBITERR ((uint32_t)0x00000200) /*!< Start bit not detected on all data signals in wide bus mode */
+#define SDIO_STS_DTBLKCMPL ((uint32_t)0x00000400) /*!< Data block sent/received (CRC check passed) */
+#define SDIO_STS_DOCMD ((uint32_t)0x00000800) /*!< Command transfer in progress */
+#define SDIO_STS_DOTX ((uint32_t)0x00001000) /*!< Data transmit in progress */
+#define SDIO_STS_DORX ((uint32_t)0x00002000) /*!< Data receive in progress */
+#define SDIO_STS_TXBUF_H ((uint32_t)0x00004000) /*!< Transmit FIFO Half Empty: at least 8 words can be written into the FIFO */
+#define SDIO_STS_RXBUF_H ((uint32_t)0x00008000) /*!< Receive FIFO Half Full: there are at least 8 words in the FIFO */
+#define SDIO_STS_TXBUF_F ((uint32_t)0x00010000) /*!< Transmit FIFO full */
+#define SDIO_STS_RXBUF_F ((uint32_t)0x00020000) /*!< Receive FIFO full */
+#define SDIO_STS_TXBUF_E ((uint32_t)0x00040000) /*!< Transmit FIFO empty */
+#define SDIO_STS_RXBUF_E ((uint32_t)0x00080000) /*!< Receive FIFO empty */
+#define SDIO_STS_TXBUF ((uint32_t)0x00100000) /*!< Data available in transmit FIFO */
+#define SDIO_STS_RXBUF ((uint32_t)0x00200000) /*!< Data available in receive FIFO */
+#define SDIO_STS_SDIOIF ((uint32_t)0x00400000) /*!< SDIO interrupt received */
+#define SDIO_STS_ATACMPL ((uint32_t)0x00800000) /*!< CE-ATA command completion signal received for CMD61 */
+
+/******************* Bit definition for SDIO_INTCLR register *******************/
+#define SDIO_INTCLR_CMDFAIL ((uint32_t)0x00000001) /*!< CCRCFAIL flag clear bit */
+#define SDIO_INTCLR_DTFAIL ((uint32_t)0x00000002) /*!< DCRCFAIL flag clear bit */
+#define SDIO_INTCLR_CMDTIMEOUT ((uint32_t)0x00000004) /*!< CTIMEOUT flag clear bit */
+#define SDIO_INTCLR_DTTIMEOUT ((uint32_t)0x00000008) /*!< DTIMEOUT flag clear bit */
+#define SDIO_INTCLR_TXERRU ((uint32_t)0x00000010) /*!< TXUNDERR flag clear bit */
+#define SDIO_INTCLR_RXERRO ((uint32_t)0x00000020) /*!< RXOVERR flag clear bit */
+#define SDIO_INTCLR_CMDRSPCMPL ((uint32_t)0x00000040) /*!< CMDREND flag clear bit */
+#define SDIO_INTCLR_CMDCMPL ((uint32_t)0x00000080) /*!< CMDSENT flag clear bit */
+#define SDIO_INTCLR_DTCMPL ((uint32_t)0x00000100) /*!< DATAEND flag clear bit */
+#define SDIO_INTCLR_SBITERR ((uint32_t)0x00000200) /*!< STBITERR flag clear bit */
+#define SDIO_INTCLR_DTBLKCMPL ((uint32_t)0x00000400) /*!< DBCKEND flag clear bit */
+#define SDIO_INTCLR_SDIOIF ((uint32_t)0x00400000) /*!< SDIOIT flag clear bit */
+#define SDIO_INTCLR_ATACMPL ((uint32_t)0x00800000) /*!< CEATAEND flag clear bit */
+
+/****************** Bit definition for SDIO_MASK register *******************/
+#define SDIO_MASK_CCRCFAILIE ((uint32_t)0x00000001) /*!< Command CRC Fail Interrupt Enable */
+#define SDIO_INTEN_DTFAIL ((uint32_t)0x00000002) /*!< Data CRC Fail Interrupt Enable */
+#define SDIO_INTEN_CMDTIMEOUT ((uint32_t)0x00000004) /*!< Command TimeOut Interrupt Enable */
+#define SDIO_INTEN_DTTIMEOUT ((uint32_t)0x00000008) /*!< Data TimeOut Interrupt Enable */
+#define SDIO_INTEN_TXERRU ((uint32_t)0x00000010) /*!< Tx FIFO UnderRun Error Interrupt Enable */
+#define SDIO_INTEN_RXERRO ((uint32_t)0x00000020) /*!< Rx FIFO OverRun Error Interrupt Enable */
+#define SDIO_INTEN_CMDRSPCMPL ((uint32_t)0x00000040) /*!< Command Response Received Interrupt Enable */
+#define SDIO_INTEN_CMDCMPL ((uint32_t)0x00000080) /*!< Command Sent Interrupt Enable */
+#define SDIO_INTEN_DTCMPL ((uint32_t)0x00000100) /*!< Data End Interrupt Enable */
+#define SDIO_INTEN_SBITERR ((uint32_t)0x00000200) /*!< Start Bit Error Interrupt Enable */
+#define SDIO_INTEN_DTBLKCMPL ((uint32_t)0x00000400) /*!< Data Block End Interrupt Enable */
+#define SDIO_INTEN_DOCMD ((uint32_t)0x00000800) /*!< Command Acting Interrupt Enable */
+#define SDIO_INTEN_DOTX ((uint32_t)0x00001000) /*!< Data Transmit Acting Interrupt Enable */
+#define SDIO_INTEN_DORX ((uint32_t)0x00002000) /*!< Data receive acting interrupt enabled */
+#define SDIO_INTEN_TXBUF_H ((uint32_t)0x00004000) /*!< Tx FIFO Half Empty interrupt Enable */
+#define SDIO_INTEN_RXBUF_H ((uint32_t)0x00008000) /*!< Rx FIFO Half Full interrupt Enable */
+#define SDIO_INTEN_TXBUF_F ((uint32_t)0x00010000) /*!< Tx FIFO Full interrupt Enable */
+#define SDIO_INTEN_RXBUF_F ((uint32_t)0x00020000) /*!< Rx FIFO Full interrupt Enable */
+#define SDIO_INTEN_TXBUF_E ((uint32_t)0x00040000) /*!< Tx FIFO Empty interrupt Enable */
+#define SDIO_INTEN_RXBUF_E ((uint32_t)0x00080000) /*!< Rx FIFO Empty interrupt Enable */
+#define SDIO_INTEN_TXBUF ((uint32_t)0x00100000) /*!< Data available in Tx FIFO interrupt Enable */
+#define SDIO_INTEN_RXBUF ((uint32_t)0x00200000) /*!< Data available in Rx FIFO interrupt Enable */
+#define SDIO_INTEN_SDIOIF ((uint32_t)0x00400000) /*!< SDIO Mode Interrupt Received interrupt Enable */
+#define SDIO_INTEN_ATACMPL ((uint32_t)0x00800000) /*!< CE-ATA command completion signal received Interrupt Enable */
+
+/***************** Bit definition for SDIO_BUFCNTR register *****************/
+#define SDIO_BUFCNTR_CNT ((uint32_t)0x00FFFFFF) /*!< Remaining number of words to be written to or read from the FIFO */
+
+/****************** Bit definition for SDIO_BUF register *******************/
+#define SDIO_BUF_DT ((uint32_t)0xFFFFFFFF) /*!< Receive and transmit BUF data */
+
+/******************************************************************************/
+/* */
+/* USB Device FS */
+/* */
+/******************************************************************************/
+
+/** Endpoint-specific registers */
+/******************* Bit definition for USB_EPT0 register *******************/
+#define USB_EPT0_EPTADR ((uint16_t)0x000F) /*!< Endpoint Address */
+
+#define USB_EPT0_STS_TX ((uint16_t)0x0030) /*!< STAT_TX[1:0] bits (Status bits, for transmission transfers) */
+#define USB_EPT0_STS_TX_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define USB_EPT0_STS_TX_1 ((uint16_t)0x0020) /*!< Bit 1 */
+
+#define USB_EPT0_DTOG_TX ((uint16_t)0x0040) /*!< Data Toggle, for transmission transfers */
+#define USB_EPT0_CTFR_TX ((uint16_t)0x0080) /*!< Correct Transfer for transmission */
+#define USB_EPT0_EPT_SUBTYPE ((uint16_t)0x0100) /*!< Endpoint Kind */
+
+#define USB_EPT0_EPT_TYPE ((uint16_t)0x0600) /*!< EP_TYPE[1:0] bits (Endpoint type) */
+#define USB_EPT0_EPT_TYPE_0 ((uint16_t)0x0200) /*!< Bit 0 */
+#define USB_EPT0_EPT_TYPE_1 ((uint16_t)0x0400) /*!< Bit 1 */
+
+#define USB_EPT0_SETUP ((uint16_t)0x0800) /*!< Setup transaction completed */
+
+#define USB_EPT0_STS_RX ((uint16_t)0x3000) /*!< STAT_RX[1:0] bits (Status bits, for reception transfers) */
+#define USB_EPT0_STS_RX_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define USB_EPT0_STS_RX_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define USB_EPT0_DTOG_RX ((uint16_t)0x4000) /*!< Data Toggle, for reception transfers */
+#define USB_EPT0_CTFR_RX ((uint16_t)0x8000) /*!< Correct Transfer for reception */
+
+/******************* Bit definition for USB_EPT1 register *******************/
+#define USB_EPT1_EPTADR ((uint16_t)0x000F) /*!< Endpoint Address */
+
+#define USB_EPT1_STS_TX ((uint16_t)0x0030) /*!< STAT_TX[1:0] bits (Status bits, for transmission transfers) */
+#define USB_EPT1_STS_TX_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define USB_EPT1_STS_TX_1 ((uint16_t)0x0020) /*!< Bit 1 */
+
+#define USB_EPT1_DTOG_TX ((uint16_t)0x0040) /*!< Data Toggle, for transmission transfers */
+#define USB_EPT1_CTFR_TX ((uint16_t)0x0080) /*!< Correct Transfer for transmission */
+#define USB_EPT1_EPT_SUBTYPE ((uint16_t)0x0100) /*!< Endpoint Kind */
+
+#define USB_EPT1_EPT_TYPE ((uint16_t)0x0600) /*!< EP_TYPE[1:0] bits (Endpoint type) */
+#define USB_EPT1_EPT_TYPE_0 ((uint16_t)0x0200) /*!< Bit 0 */
+#define USB_EPT1_EPT_TYPE_1 ((uint16_t)0x0400) /*!< Bit 1 */
+
+#define USB_EPT1_SETUP ((uint16_t)0x0800) /*!< Setup transaction completed */
+
+#define USB_EPT1_STS_RX ((uint16_t)0x3000) /*!< STAT_RX[1:0] bits (Status bits, for reception transfers) */
+#define USB_EPT1_STS_RX_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define USB_EPT1_STS_RX_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define USB_EPT1_DTOG_RX ((uint16_t)0x4000) /*!< Data Toggle, for reception transfers */
+#define USB_EPT1_CTFR_RX ((uint16_t)0x8000) /*!< Correct Transfer for reception */
+
+/******************* Bit definition for USB_EPT2 register *******************/
+#define USB_EPT2_EPTADR ((uint16_t)0x000F) /*!< Endpoint Address */
+
+#define USB_EPT2_STS_TX ((uint16_t)0x0030) /*!< STAT_TX[1:0] bits (Status bits, for transmission transfers) */
+#define USB_EPT2_STS_TX_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define USB_EPT2_STS_TX_1 ((uint16_t)0x0020) /*!< Bit 1 */
+
+#define USB_EPT2_DTOG_TX ((uint16_t)0x0040) /*!< Data Toggle, for transmission transfers */
+#define USB_EPT2_CTFR_TX ((uint16_t)0x0080) /*!< Correct Transfer for transmission */
+#define USB_EPT2_EPT_SUBTYPE ((uint16_t)0x0100) /*!< Endpoint Kind */
+
+#define USB_EPT2_EPT_TYPE ((uint16_t)0x0600) /*!< EP_TYPE[1:0] bits (Endpoint type) */
+#define USB_EPT2_EPT_TYPE_0 ((uint16_t)0x0200) /*!< Bit 0 */
+#define USB_EPT2_EPT_TYPE_1 ((uint16_t)0x0400) /*!< Bit 1 */
+
+#define USB_EPT2_SETUP ((uint16_t)0x0800) /*!< Setup transaction completed */
+
+#define USB_EPT2_STS_RX ((uint16_t)0x3000) /*!< STAT_RX[1:0] bits (Status bits, for reception transfers) */
+#define USB_EPT2_STS_RX_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define USB_EPT2_STS_RX_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define USB_EPT2_DTOG_RX ((uint16_t)0x4000) /*!< Data Toggle, for reception transfers */
+#define USB_EPT2_CTFR_RX ((uint16_t)0x8000) /*!< Correct Transfer for reception */
+
+/******************* Bit definition for USB_EPT3 register *******************/
+#define USB_EPT3_EPTADR ((uint16_t)0x000F) /*!< Endpoint Address */
+
+#define USB_EPT3_STS_TX ((uint16_t)0x0030) /*!< STAT_TX[1:0] bits (Status bits, for transmission transfers) */
+#define USB_EPT3_STS_TX_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define USB_EPT3_STS_TX_1 ((uint16_t)0x0020) /*!< Bit 1 */
+
+#define USB_EPT3_DTOG_TX ((uint16_t)0x0040) /*!< Data Toggle, for transmission transfers */
+#define USB_EPT3_CTFR_TX ((uint16_t)0x0080) /*!< Correct Transfer for transmission */
+#define USB_EPT3_EPT_SUBTYPE ((uint16_t)0x0100) /*!< Endpoint Kind */
+
+#define USB_EPT3_EPT_TYPE ((uint16_t)0x0600) /*!< EP_TYPE[1:0] bits (Endpoint type) */
+#define USB_EPT3_EPT_TYPE_0 ((uint16_t)0x0200) /*!< Bit 0 */
+#define USB_EPT3_EPT_TYPE_1 ((uint16_t)0x0400) /*!< Bit 1 */
+
+#define USB_EPT3_SETUP ((uint16_t)0x0800) /*!< Setup transaction completed */
+
+#define USB_EPT3_STS_RX ((uint16_t)0x3000) /*!< STAT_RX[1:0] bits (Status bits, for reception transfers) */
+#define USB_EPT3_STS_RX_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define USB_EPT3_STS_RX_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define USB_EPT3_DTOG_RX ((uint16_t)0x4000) /*!< Data Toggle, for reception transfers */
+#define USB_EPT3_CTFR_RX ((uint16_t)0x8000) /*!< Correct Transfer for reception */
+
+/******************* Bit definition for USB_EPT4 register *******************/
+#define USB_EPT4_EPTADR ((uint16_t)0x000F) /*!< Endpoint Address */
+
+#define USB_EPT4_STS_TX ((uint16_t)0x0030) /*!< STAT_TX[1:0] bits (Status bits, for transmission transfers) */
+#define USB_EPT4_STS_TX_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define USB_EPT4_STS_TX_1 ((uint16_t)0x0020) /*!< Bit 1 */
+
+#define USB_EPT4_DTOG_TX ((uint16_t)0x0040) /*!< Data Toggle, for transmission transfers */
+#define USB_EPT4_CTFR_TX ((uint16_t)0x0080) /*!< Correct Transfer for transmission */
+#define USB_EPT4_EPT_SUBTYPE ((uint16_t)0x0100) /*!< Endpoint Kind */
+
+#define USB_EPT4_EPT_TYPE ((uint16_t)0x0600) /*!< EP_TYPE[1:0] bits (Endpoint type) */
+#define USB_EPT4_EPT_TYPE_0 ((uint16_t)0x0200) /*!< Bit 0 */
+#define USB_EPT4_EPT_TYPE_1 ((uint16_t)0x0400) /*!< Bit 1 */
+
+#define USB_EPT4_SETUP ((uint16_t)0x0800) /*!< Setup transaction completed */
+
+#define USB_EPT4_STS_RX ((uint16_t)0x3000) /*!< STAT_RX[1:0] bits (Status bits, for reception transfers) */
+#define USB_EPT4_STS_RX_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define USB_EPT4_STS_RX_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define USB_EPT4_DTOG_RX ((uint16_t)0x4000) /*!< Data Toggle, for reception transfers */
+#define USB_EPT4_CTFR_RX ((uint16_t)0x8000) /*!< Correct Transfer for reception */
+
+/******************* Bit definition for USB_EPT5 register *******************/
+#define USB_EPT5_EPTADR ((uint16_t)0x000F) /*!< Endpoint Address */
+
+#define USB_EPT5_STS_TX ((uint16_t)0x0030) /*!< STAT_TX[1:0] bits (Status bits, for transmission transfers) */
+#define USB_EPT5_STS_TX_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define USB_EPT5_STS_TX_1 ((uint16_t)0x0020) /*!< Bit 1 */
+
+#define USB_EPT5_DTOG_TX ((uint16_t)0x0040) /*!< Data Toggle, for transmission transfers */
+#define USB_EPT5_CTFR_TX ((uint16_t)0x0080) /*!< Correct Transfer for transmission */
+#define USB_EPT5_EPT_SUBTYPE ((uint16_t)0x0100) /*!< Endpoint Kind */
+
+#define USB_EPT5_EPT_TYPE ((uint16_t)0x0600) /*!< EP_TYPE[1:0] bits (Endpoint type) */
+#define USB_EPT5_EPT_TYPE_0 ((uint16_t)0x0200) /*!< Bit 0 */
+#define USB_EPT5_EPT_TYPE_1 ((uint16_t)0x0400) /*!< Bit 1 */
+
+#define USB_EPT5_SETUP ((uint16_t)0x0800) /*!< Setup transaction completed */
+
+#define USB_EPT5_STS_RX ((uint16_t)0x3000) /*!< STAT_RX[1:0] bits (Status bits, for reception transfers) */
+#define USB_EPT5_STS_RX_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define USB_EPT5_STS_RX_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define USB_EPT5_DTOG_RX ((uint16_t)0x4000) /*!< Data Toggle, for reception transfers */
+#define USB_EPT5_CTFR_RX ((uint16_t)0x8000) /*!< Correct Transfer for reception */
+
+/******************* Bit definition for USB_EPT6 register *******************/
+#define USB_EPT6_EPTADR ((uint16_t)0x000F) /*!< Endpoint Address */
+
+#define USB_EPT6_STS_TX ((uint16_t)0x0030) /*!< STAT_TX[1:0] bits (Status bits, for transmission transfers) */
+#define USB_EPT6_STS_TX_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define USB_EPT6_STS_TX_1 ((uint16_t)0x0020) /*!< Bit 1 */
+
+#define USB_EPT6_DTOG_TX ((uint16_t)0x0040) /*!< Data Toggle, for transmission transfers */
+#define USB_EPT6_CTFR_TX ((uint16_t)0x0080) /*!< Correct Transfer for transmission */
+#define USB_EPT6_EPT_SUBTYPE ((uint16_t)0x0100) /*!< Endpoint Kind */
+
+#define USB_EPT6_EPT_TYPE ((uint16_t)0x0600) /*!< EP_TYPE[1:0] bits (Endpoint type) */
+#define USB_EPT6_EPT_TYPE_0 ((uint16_t)0x0200) /*!< Bit 0 */
+#define USB_EPT6_EPT_TYPE_1 ((uint16_t)0x0400) /*!< Bit 1 */
+
+#define USB_EPT6_SETUP ((uint16_t)0x0800) /*!< Setup transaction completed */
+
+#define USB_EPT6_STS_RX ((uint16_t)0x3000) /*!< STAT_RX[1:0] bits (Status bits, for reception transfers) */
+#define USB_EPT6_STS_RX_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define USB_EPT6_STS_RX_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define USB_EPT6_DTOG_RX ((uint16_t)0x4000) /*!< Data Toggle, for reception transfers */
+#define USB_EPT6_CTFR_RX ((uint16_t)0x8000) /*!< Correct Transfer for reception */
+
+/******************* Bit definition for USB_EPT7 register *******************/
+#define USB_EPT7_EPTADR ((uint16_t)0x000F) /*!< Endpoint Address */
+
+#define USB_EPT7_STS_TX ((uint16_t)0x0030) /*!< STAT_TX[1:0] bits (Status bits, for transmission transfers) */
+#define USB_EPT7_STS_TX_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define USB_EPT7_STS_TX_1 ((uint16_t)0x0020) /*!< Bit 1 */
+
+#define USB_EPT7_DTOG_TX ((uint16_t)0x0040) /*!< Data Toggle, for transmission transfers */
+#define USB_EPT7_CTFR_TX ((uint16_t)0x0080) /*!< Correct Transfer for transmission */
+#define USB_EPT7_EPT_SUBTYPE ((uint16_t)0x0100) /*!< Endpoint Kind */
+
+#define USB_EPT7_EPT_TYPE ((uint16_t)0x0600) /*!< EP_TYPE[1:0] bits (Endpoint type) */
+#define USB_EPT7_EPT_TYPE_0 ((uint16_t)0x0200) /*!< Bit 0 */
+#define USB_EPT7_EPT_TYPE_1 ((uint16_t)0x0400) /*!< Bit 1 */
+
+#define USB_EPT7_SETUP ((uint16_t)0x0800) /*!< Setup transaction completed */
+
+#define USB_EPT7_STS_RX ((uint16_t)0x3000) /*!< STAT_RX[1:0] bits (Status bits, for reception transfers) */
+#define USB_EPT7_STS_RX_0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define USB_EPT7_STS_RX_1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define USB_EPT7_DTOG_RX ((uint16_t)0x4000) /*!< Data Toggle, for reception transfers */
+#define USB_EPT7_CTFR_RX ((uint16_t)0x8000) /*!< Correct Transfer for reception */
+
+/** Common registers */
+/******************* Bit definition for USB_CTRL register *******************/
+#define USB_CTRL_FRST ((uint16_t)0x0001) /*!< Force USB Reset */
+#define USB_CTRL_PDWN ((uint16_t)0x0002) /*!< Power down */
+#define USB_CTRL_LPWR ((uint16_t)0x0004) /*!< Low-power mode */
+#define USB_CTRL_FSUSP ((uint16_t)0x0008) /*!< Force suspend */
+#define USB_CTRL_RESUME ((uint16_t)0x0010) /*!< Resume request */
+#define USB_CTRL_ESOF_IEN ((uint16_t)0x0100) /*!< Expected Start Of Frame Interrupt Mask */
+#define USB_CTRL_SOF_IEN ((uint16_t)0x0200) /*!< Start Of Frame Interrupt Mask */
+#define USB_CTRL_RST_IEN ((uint16_t)0x0400) /*!< RESET Interrupt Mask */
+#define USB_CTRL_SUSP_IEN ((uint16_t)0x0800) /*!< Suspend mode Interrupt Mask */
+#define USB_CTRL_WKUP_IEN ((uint16_t)0x1000) /*!< Wakeup Interrupt Mask */
+#define USB_CTRL_ERR_IEN ((uint16_t)0x2000) /*!< Error Interrupt Mask */
+#define USB_CTRL_PMOVR_IEN ((uint16_t)0x4000) /*!< Packet Memory Area Over / Underrun Interrupt Mask */
+#define USB_CTRL_CTFR_IEN ((uint16_t)0x8000) /*!< Correct Transfer Interrupt Mask */
+
+/******************* Bit definition for USB_INTSTS register *******************/
+#define USB_INTSTS_EPT_ID ((uint16_t)0x000F) /*!< Endpoint Identifier */
+#define USB_INTSTS_DIR ((uint16_t)0x0010) /*!< Direction of transaction */
+#define USB_INTSTS_ESOF ((uint16_t)0x0100) /*!< Expected Start Of Frame */
+#define USB_INTSTS_SOFF ((uint16_t)0x0200) /*!< Start Of Frame */
+#define USB_INTSTS_RSTF ((uint16_t)0x0400) /*!< USB RESET request */
+#define USB_INTSTS_SUSPF ((uint16_t)0x0800) /*!< Suspend mode request */
+#define USB_INTSTS_WKUPF ((uint16_t)0x1000) /*!< Wake up */
+#define USB_INTSTS_ERRF ((uint16_t)0x2000) /*!< Error */
+#define USB_INTSTS_PMOVERF ((uint16_t)0x4000) /*!< Packet Memory Area Over / Underrun */
+#define USB_INTSTS_CTFRF ((uint16_t)0x8000) /*!< Correct Transfer */
+
+/******************* Bit definition for USB_FRNUM register ********************/
+#define USB_FRNUM_FRNUM ((uint16_t)0x07FF) /*!< Frame Number */
+#define USB_FRNUM_LSOF ((uint16_t)0x1800) /*!< Lost SOF */
+#define USB_FRNUM_LCK ((uint16_t)0x2000) /*!< Locked */
+#define USB_FRNUM_DMSTS ((uint16_t)0x4000) /*!< Receive Data - Line Status */
+#define USB_FRNUM_DPSTS ((uint16_t)0x8000) /*!< Receive Data + Line Status */
+
+/****************** Bit definition for USB_DEVADR register *******************/
+#define USB_DEVADR_ADR ((uint8_t)0x7F) /*!< ADD[6:0] bits (Device Address) */
+#define USB_DEVADR_ADR_B0 ((uint8_t)0x01) /*!< Bit 0 */
+#define USB_DEVADR_ADR_B1 ((uint8_t)0x02) /*!< Bit 1 */
+#define USB_DEVADR_ADR_B2 ((uint8_t)0x04) /*!< Bit 2 */
+#define USB_DEVADR_ADR_B3 ((uint8_t)0x08) /*!< Bit 3 */
+#define USB_DEVADR_ADR_B4 ((uint8_t)0x10) /*!< Bit 4 */
+#define USB_DEVADR_ADR_B5 ((uint8_t)0x20) /*!< Bit 5 */
+#define USB_DEVADR_ADR_B6 ((uint8_t)0x40) /*!< Bit 6 */
+
+#define USB_DEVADR_EN ((uint8_t)0x80) /*!< Enable Function */
+
+/****************** Bit definition for USB_BUFTBL register ******************/
+#define USB_BUFTBL_ADR ((uint16_t)0xFFF8) /*!< Buffer Table */
+
+/** Buffer descriptor table */
+/***************** Bit definition for USB_ADR0_TX register *****************/
+#define USB_ADR0_TX_ADR0_TX ((uint16_t)0xFFFE) /*!< Transmission Buffer Address 0 */
+
+/***************** Bit definition for USB_ADR1_TX register *****************/
+#define USB_ADR1_TX_ADR1_TX ((uint16_t)0xFFFE) /*!< Transmission Buffer Address 1 */
+
+/***************** Bit definition for USB_ADR2_TX register *****************/
+#define USB_ADR2_TX_ADR2_TX ((uint16_t)0xFFFE) /*!< Transmission Buffer Address 2 */
+
+/***************** Bit definition for USB_ADR3_TX register *****************/
+#define USB_ADR3_TX_ADR3_TX ((uint16_t)0xFFFE) /*!< Transmission Buffer Address 3 */
+
+/***************** Bit definition for USB_ADR4_TX register *****************/
+#define USB_ADR4_TX_ADR4_TX ((uint16_t)0xFFFE) /*!< Transmission Buffer Address 4 */
+
+/***************** Bit definition for USB_ADR5_TX register *****************/
+#define USB_ADR5_TX_ADR5_TX ((uint16_t)0xFFFE) /*!< Transmission Buffer Address 5 */
+
+/***************** Bit definition for USB_ADR6_TX register *****************/
+#define USB_ADR6_TX_ADR6_TX ((uint16_t)0xFFFE) /*!< Transmission Buffer Address 6 */
+
+/***************** Bit definition for USB_ADR7_TX register *****************/
+#define USB_ADR7_TX_ADR7_TX ((uint16_t)0xFFFE) /*!< Transmission Buffer Address 7 */
+
+/*----------------------------------------------------------------------------*/
+
+/***************** Bit definition for USB_CNT0_TX register ****************/
+#define USB_CNT0_TX_CNT0_TX ((uint16_t)0x03FF) /*!< Transmission Byte Count 0 */
+
+/***************** Bit definition for USB_CNT1_TX register ****************/
+#define USB_CNT1_TX_CNT1_TX ((uint16_t)0x03FF) /*!< Transmission Byte Count 1 */
+
+/***************** Bit definition for USB_CNT2_TX register ****************/
+#define USB_CNT2_TX_CNT2_TX ((uint16_t)0x03FF) /*!< Transmission Byte Count 2 */
+
+/***************** Bit definition for USB_CNT3_TX register ****************/
+#define USB_CNT3_TX_CNT3_TX ((uint16_t)0x03FF) /*!< Transmission Byte Count 3 */
+
+/***************** Bit definition for USB_CNT4_TX register ****************/
+#define USB_CNT4_TX_CNT4_TX ((uint16_t)0x03FF) /*!< Transmission Byte Count 4 */
+
+/***************** Bit definition for USB_CNT5_TX register ****************/
+#define USB_CNT5_TX_CNT5_TX ((uint16_t)0x03FF) /*!< Transmission Byte Count 5 */
+
+/***************** Bit definition for USB_CNT6_TX register ****************/
+#define USB_CNT6_TX_CNT6_TX ((uint16_t)0x03FF) /*!< Transmission Byte Count 6 */
+
+/***************** Bit definition for USB_CNT7_TX register ****************/
+#define USB_CNT7_TX_CNT7_TX ((uint16_t)0x03FF) /*!< Transmission Byte Count 7 */
+
+/*----------------------------------------------------------------------------*/
+
+/**************** Bit definition for USB_CNT0_TX_0 register ***************/
+#define USB_CNT0_TX_0_CNT0_TX_0 ((uint32_t)0x000003FF) /*!< Transmission Byte Count 0 (low) */
+
+/**************** Bit definition for USB_CNT0_TX_1 register ***************/
+#define USB_CNT0_TX_1_CNT0_TX_1 ((uint32_t)0x03FF0000) /*!< Transmission Byte Count 0 (high) */
+
+/**************** Bit definition for USB_CNT1_TX_0 register ***************/
+#define USB_CNT1_TX_0_CNT1_TX_0 ((uint32_t)0x000003FF) /*!< Transmission Byte Count 1 (low) */
+
+/**************** Bit definition for USB_CNT1_TX_1 register ***************/
+#define USB_CNT1_TX_1_CNT1_TX_1 ((uint32_t)0x03FF0000) /*!< Transmission Byte Count 1 (high) */
+
+/**************** Bit definition for USB_CNT2_TX_0 register ***************/
+#define USB_CNT2_TX_0_CNT2_TX_0 ((uint32_t)0x000003FF) /*!< Transmission Byte Count 2 (low) */
+
+/**************** Bit definition for USB_CNT2_TX_1 register ***************/
+#define USB_CNT2_TX_1_CNT2_TX_1 ((uint32_t)0x03FF0000) /*!< Transmission Byte Count 2 (high) */
+
+/**************** Bit definition for USB_CNT3_TX_0 register ***************/
+#define USB_CNT3_TX_0_CNT3_TX_0 ((uint32_t)0x000003FF) /*!< Transmission Byte Count 3 (low) */
+
+/**************** Bit definition for USB_CNT3_TX_1 register ***************/
+#define USB_CNT3_TX_1_CNT3_TX_1 ((uint32_t)0x03FF0000) /*!< Transmission Byte Count 3 (high) */
+
+/**************** Bit definition for USB_CNT4_TX_0 register ***************/
+#define USB_CNT4_TX_0_CNT4_TX_0 ((uint32_t)0x000003FF) /*!< Transmission Byte Count 4 (low) */
+
+/**************** Bit definition for USB_CNT4_TX_1 register ***************/
+#define USB_CNT4_TX_1_CNT4_TX_1 ((uint32_t)0x03FF0000) /*!< Transmission Byte Count 4 (high) */
+
+/**************** Bit definition for USB_CNT5_TX_0 register ***************/
+#define USB_CNT5_TX_0_CNT5_TX_0 ((uint32_t)0x000003FF) /*!< Transmission Byte Count 5 (low) */
+
+/**************** Bit definition for USB_CNT5_TX_1 register ***************/
+#define USB_CNT5_TX_1_CNT5_TX_1 ((uint32_t)0x03FF0000) /*!< Transmission Byte Count 5 (high) */
+
+/**************** Bit definition for USB_CNT6_TX_0 register ***************/
+#define USB_CNT6_TX_0_CNT6_TX_0 ((uint32_t)0x000003FF) /*!< Transmission Byte Count 6 (low) */
+
+/**************** Bit definition for USB_CNT6_TX_1 register ***************/
+#define USB_CNT6_TX_1_CNT6_TX_1 ((uint32_t)0x03FF0000) /*!< Transmission Byte Count 6 (high) */
+
+/**************** Bit definition for USB_CNT7_TX_0 register ***************/
+#define USB_CNT7_TX_0_CNT7_TX_0 ((uint32_t)0x000003FF) /*!< Transmission Byte Count 7 (low) */
+
+/**************** Bit definition for USB_CNT7_TX_1 register ***************/
+#define USB_CNT7_TX_1_CNT7_TX_1 ((uint32_t)0x03FF0000) /*!< Transmission Byte Count 7 (high) */
+
+/*----------------------------------------------------------------------------*/
+
+/***************** Bit definition for USB_ADR0_RX register *****************/
+#define USB_ADR0_RX_ADR0_RX ((uint16_t)0xFFFE) /*!< Reception Buffer Address 0 */
+
+/***************** Bit definition for USB_ADR1_RX register *****************/
+#define USB_ADR1_RX_ADR1_RX ((uint16_t)0xFFFE) /*!< Reception Buffer Address 1 */
+
+/***************** Bit definition for USB_ADR2_RX register *****************/
+#define USB_ADR2_RX_ADR2_RX ((uint16_t)0xFFFE) /*!< Reception Buffer Address 2 */
+
+/***************** Bit definition for USB_ADR3_RX register *****************/
+#define USB_ADR3_RX_ADR3_RX ((uint16_t)0xFFFE) /*!< Reception Buffer Address 3 */
+
+/***************** Bit definition for USB_ADR4_RX register *****************/
+#define USB_ADR4_RX_ADR4_RX ((uint16_t)0xFFFE) /*!< Reception Buffer Address 4 */
+
+/***************** Bit definition for USB_ADR5_RX register *****************/
+#define USB_ADR5_RX_ADR5_RX ((uint16_t)0xFFFE) /*!< Reception Buffer Address 5 */
+
+/***************** Bit definition for USB_ADR6_RX register *****************/
+#define USB_ADR6_RX_ADR6_RX ((uint16_t)0xFFFE) /*!< Reception Buffer Address 6 */
+
+/***************** Bit definition for USB_ADR7_RX register *****************/
+#define USB_ADR7_RX_ADR7_RX ((uint16_t)0xFFFE) /*!< Reception Buffer Address 7 */
+
+/*----------------------------------------------------------------------------*/
+
+/***************** Bit definition for USB_CNT0_RX register ****************/
+#define USB_CNT0_RX_CNT0_RX ((uint16_t)0x03FF) /*!< Reception Byte Count */
+
+#define USB_CNT0_RX_NUM_BLK ((uint16_t)0x7C00) /*!< NUM_BLOCK[4:0] bits (Number of blocks) */
+#define USB_CNT0_RX_NUM_BLK_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define USB_CNT0_RX_NUM_BLK_1 ((uint16_t)0x0800) /*!< Bit 1 */
+#define USB_CNT0_RX_NUM_BLK_2 ((uint16_t)0x1000) /*!< Bit 2 */
+#define USB_CNT0_RX_NUM_BLK_3 ((uint16_t)0x2000) /*!< Bit 3 */
+#define USB_CNT0_RX_NUM_BLK_4 ((uint16_t)0x4000) /*!< Bit 4 */
+
+#define USB_CNT0_RX_BLKSIZE ((uint16_t)0x8000) /*!< BLock SIZE */
+
+/***************** Bit definition for USB_CNT1_RX register ****************/
+#define USB_CNT1_RX_CNT1_RX ((uint16_t)0x03FF) /*!< Reception Byte Count */
+
+#define USB_CNT1_RX_NUM_BLK ((uint16_t)0x7C00) /*!< NUM_BLOCK[4:0] bits (Number of blocks) */
+#define USB_CNT1_RX_NUM_BLK_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define USB_CNT1_RX_NUM_BLK_1 ((uint16_t)0x0800) /*!< Bit 1 */
+#define USB_CNT1_RX_NUM_BLK_2 ((uint16_t)0x1000) /*!< Bit 2 */
+#define USB_CNT1_RX_NUM_BLK_3 ((uint16_t)0x2000) /*!< Bit 3 */
+#define USB_CNT1_RX_NUM_BLK_4 ((uint16_t)0x4000) /*!< Bit 4 */
+
+#define USB_CNT1_RX_BLKSIZE ((uint16_t)0x8000) /*!< BLock SIZE */
+
+/***************** Bit definition for USB_CNT2_RX register ****************/
+#define USB_CNT2_RX_CNT2_RX ((uint16_t)0x03FF) /*!< Reception Byte Count */
+
+#define USB_CNT2_RX_NUM_BLK ((uint16_t)0x7C00) /*!< NUM_BLOCK[4:0] bits (Number of blocks) */
+#define USB_CNT2_RX_NUM_BLK_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define USB_CNT2_RX_NUM_BLK_1 ((uint16_t)0x0800) /*!< Bit 1 */
+#define USB_CNT2_RX_NUM_BLK_2 ((uint16_t)0x1000) /*!< Bit 2 */
+#define USB_CNT2_RX_NUM_BLK_3 ((uint16_t)0x2000) /*!< Bit 3 */
+#define USB_CNT2_RX_NUM_BLK_4 ((uint16_t)0x4000) /*!< Bit 4 */
+
+#define USB_CNT2_RX_BLKSIZE ((uint16_t)0x8000) /*!< BLock SIZE */
+
+/***************** Bit definition for USB_CNT3_RX register ****************/
+#define USB_CNT3_RX_CNT0_RX ((uint16_t)0x03FF) /*!< Reception Byte Count */
+
+#define USB_CNT3_RX_NUM_BLK ((uint16_t)0x7C00) /*!< NUM_BLOCK[4:0] bits (Number of blocks) */
+#define USB_CNT3_RX_NUM_BLK_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define USB_CNT3_RX_NUM_BLK_1 ((uint16_t)0x0800) /*!< Bit 1 */
+#define USB_CNT3_RX_NUM_BLK_2 ((uint16_t)0x1000) /*!< Bit 2 */
+#define USB_CNT3_RX_NUM_BLK_3 ((uint16_t)0x2000) /*!< Bit 3 */
+#define USB_CNT3_RX_NUM_BLK_4 ((uint16_t)0x4000) /*!< Bit 4 */
+
+#define USB_CNT3_RX_BLKSIZE ((uint16_t)0x8000) /*!< BLock SIZE */
+
+/***************** Bit definition for USB_CNT4_RX register ****************/
+#define USB_CNT4_RX_CNT0_RX ((uint16_t)0x03FF) /*!< Reception Byte Count */
+
+#define USB_CNT4_RX_NUM_BLK ((uint16_t)0x7C00) /*!< NUM_BLOCK[4:0] bits (Number of blocks) */
+#define USB_CNT4_RX_NUM_BLK_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define USB_CNT4_RX_NUM_BLK_1 ((uint16_t)0x0800) /*!< Bit 1 */
+#define USB_CNT4_RX_NUM_BLK_2 ((uint16_t)0x1000) /*!< Bit 2 */
+#define USB_CNT4_RX_NUM_BLK_3 ((uint16_t)0x2000) /*!< Bit 3 */
+#define USB_CNT4_RX_NUM_BLK_4 ((uint16_t)0x4000) /*!< Bit 4 */
+
+#define USB_CNT4_RX_BLKSIZE ((uint16_t)0x8000) /*!< BLock SIZE */
+
+/***************** Bit definition for USB_CNT5_RX register ****************/
+#define USB_CNT5_RX_CNT0_RX ((uint16_t)0x03FF) /*!< Reception Byte Count */
+
+#define USB_CNT5_RX_NUM_BLK ((uint16_t)0x7C00) /*!< NUM_BLOCK[4:0] bits (Number of blocks) */
+#define USB_CNT5_RX_NUM_BLK_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define USB_CNT5_RX_NUM_BLK_1 ((uint16_t)0x0800) /*!< Bit 1 */
+#define USB_CNT5_RX_NUM_BLK_2 ((uint16_t)0x1000) /*!< Bit 2 */
+#define USB_CNT5_RX_NUM_BLK_3 ((uint16_t)0x2000) /*!< Bit 3 */
+#define USB_CNT5_RX_NUM_BLK_4 ((uint16_t)0x4000) /*!< Bit 4 */
+
+#define USB_CNT5_RX_BLKSIZE ((uint16_t)0x8000) /*!< BLock SIZE */
+
+/***************** Bit definition for USB_CNT6_RX register ****************/
+#define USB_CNT6_RX_CNT0_RX ((uint16_t)0x03FF) /*!< Reception Byte Count */
+
+#define USB_CNT6_RX_NUM_BLK ((uint16_t)0x7C00) /*!< NUM_BLOCK[4:0] bits (Number of blocks) */
+#define USB_CNT6_RX_NUM_BLK_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define USB_CNT6_RX_NUM_BLK_1 ((uint16_t)0x0800) /*!< Bit 1 */
+#define USB_CNT6_RX_NUM_BLK_2 ((uint16_t)0x1000) /*!< Bit 2 */
+#define USB_CNT6_RX_NUM_BLK_3 ((uint16_t)0x2000) /*!< Bit 3 */
+#define USB_CNT6_RX_NUM_BLK_4 ((uint16_t)0x4000) /*!< Bit 4 */
+
+#define USB_CNT6_RX_BLKSIZE ((uint16_t)0x8000) /*!< BLock SIZE */
+
+/***************** Bit definition for USB_CNT7_RX register ****************/
+#define USB_CNT7_RX_CNT0_RX ((uint16_t)0x03FF) /*!< Reception Byte Count */
+
+#define USB_CNT7_RX_NUM_BLK ((uint16_t)0x7C00) /*!< NUM_BLOCK[4:0] bits (Number of blocks) */
+#define USB_CNT7_RX_NUM_BLK_0 ((uint16_t)0x0400) /*!< Bit 0 */
+#define USB_CNT7_RX_NUM_BLK_1 ((uint16_t)0x0800) /*!< Bit 1 */
+#define USB_CNT7_RX_NUM_BLK_2 ((uint16_t)0x1000) /*!< Bit 2 */
+#define USB_CNT7_RX_NUM_BLK_3 ((uint16_t)0x2000) /*!< Bit 3 */
+#define USB_CNT7_RX_NUM_BLK_4 ((uint16_t)0x4000) /*!< Bit 4 */
+
+#define USB_CNT7_RX_BLKSIZE ((uint16_t)0x8000) /*!< BLock SIZE */
+
+/*----------------------------------------------------------------------------*/
+
+/**************** Bit definition for USB_CNT0_RX_0 register ***************/
+#define USB_CNT0_RX_0_CNT0_RX_0 ((uint32_t)0x000003FF) /*!< Reception Byte Count (low) */
+
+#define USB_CNT0_RX_0_NUM_BLK_0 ((uint32_t)0x00007C00) /*!< NUM_BLOCK_0[4:0] bits (Number of blocks) (low) */
+#define USB_CNT0_RX_0_NUM_BLK_0_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define USB_CNT0_RX_0_NUM_BLK_0_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define USB_CNT0_RX_0_NUM_BLK_0_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define USB_CNT0_RX_0_NUM_BLK_0_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define USB_CNT0_RX_0_NUM_BLK_0_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define USB_CNT0_RX_0_BLKSIZE_0 ((uint32_t)0x00008000) /*!< BLock SIZE (low) */
+
+/**************** Bit definition for USB_CNT0_RX_1 register ***************/
+#define USB_CNT0_RX_1_CNT0_RX_1 ((uint32_t)0x03FF0000) /*!< Reception Byte Count (high) */
+
+#define USB_CNT0_RX_1_NUM_BLK_1 ((uint32_t)0x7C000000) /*!< NUM_BLOCK_1[4:0] bits (Number of blocks) (high) */
+#define USB_CNT0_RX_1_NUM_BLK_1_0 ((uint32_t)0x04000000) /*!< Bit 1 */
+#define USB_CNT0_RX_1_NUM_BLK_1_1 ((uint32_t)0x08000000) /*!< Bit 1 */
+#define USB_CNT0_RX_1_NUM_BLK_1_2 ((uint32_t)0x10000000) /*!< Bit 2 */
+#define USB_CNT0_RX_1_NUM_BLK_1_3 ((uint32_t)0x20000000) /*!< Bit 3 */
+#define USB_CNT0_RX_1_NUM_BLK_1_4 ((uint32_t)0x40000000) /*!< Bit 4 */
+
+#define USB_CNT0_RX_1_BLKSIZE_1 ((uint32_t)0x80000000) /*!< BLock SIZE (high) */
+
+/**************** Bit definition for USB_CNT1_RX_0 register ***************/
+#define USB_CNT1_RX_0_CNT1_RX_0 ((uint32_t)0x000003FF) /*!< Reception Byte Count (low) */
+
+#define USB_CNT1_RX_0_NUM_BLK_0 ((uint32_t)0x00007C00) /*!< NUM_BLOCK_0[4:0] bits (Number of blocks) (low) */
+#define USB_CNT1_RX_0_NUM_BLK_0_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define USB_CNT1_RX_0_NUM_BLK_0_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define USB_CNT1_RX_0_NUM_BLK_0_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define USB_CNT1_RX_0_NUM_BLK_0_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define USB_CNT1_RX_0_NUM_BLK_0_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define USB_CNT1_RX_0_BLKSIZE_0 ((uint32_t)0x00008000) /*!< BLock SIZE (low) */
+
+/**************** Bit definition for USB_CNT1_RX_1 register ***************/
+#define USB_CNT1_RX_1_CNT1_RX_1 ((uint32_t)0x03FF0000) /*!< Reception Byte Count (high) */
+
+#define USB_CNT1_RX_1_NUM_BLK_1 ((uint32_t)0x7C000000) /*!< NUM_BLOCK_1[4:0] bits (Number of blocks) (high) */
+#define USB_CNT1_RX_1_NUM_BLK_1_0 ((uint32_t)0x04000000) /*!< Bit 0 */
+#define USB_CNT1_RX_1_NUM_BLK_1_1 ((uint32_t)0x08000000) /*!< Bit 1 */
+#define USB_CNT1_RX_1_NUM_BLK_1_2 ((uint32_t)0x10000000) /*!< Bit 2 */
+#define USB_CNT1_RX_1_NUM_BLK_1_3 ((uint32_t)0x20000000) /*!< Bit 3 */
+#define USB_CNT1_RX_1_NUM_BLK_1_4 ((uint32_t)0x40000000) /*!< Bit 4 */
+
+#define USB_CNT1_RX_1_BLKSIZE_1 ((uint32_t)0x80000000) /*!< BLock SIZE (high) */
+
+/**************** Bit definition for USB_CNT2_RX_0 register ***************/
+#define USB_CNT2_RX_0_CNT2_RX_0 ((uint32_t)0x000003FF) /*!< Reception Byte Count (low) */
+
+#define USB_CNT2_RX_0_NUM_BLK_0 ((uint32_t)0x00007C00) /*!< NUM_BLOCK_0[4:0] bits (Number of blocks) (low) */
+#define USB_CNT2_RX_0_NUM_BLK_0_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define USB_CNT2_RX_0_NUM_BLK_0_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define USB_CNT2_RX_0_NUM_BLK_0_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define USB_CNT2_RX_0_NUM_BLK_0_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define USB_CNT2_RX_0_NUM_BLK_0_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define USB_CNT2_RX_0_BLKSIZE_0 ((uint32_t)0x00008000) /*!< BLock SIZE (low) */
+
+/**************** Bit definition for USB_CNT2_RX_1 register ***************/
+#define USB_CNT2_RX_1_CNT2_RX_1 ((uint32_t)0x03FF0000) /*!< Reception Byte Count (high) */
+
+#define USB_CNT2_RX_1_NUM_BLK_1 ((uint32_t)0x7C000000) /*!< NUM_BLOCK_1[4:0] bits (Number of blocks) (high) */
+#define USB_CNT2_RX_1_NUM_BLK_1_0 ((uint32_t)0x04000000) /*!< Bit 0 */
+#define USB_CNT2_RX_1_NUM_BLK_1_1 ((uint32_t)0x08000000) /*!< Bit 1 */
+#define USB_CNT2_RX_1_NUM_BLK_1_2 ((uint32_t)0x10000000) /*!< Bit 2 */
+#define USB_CNT2_RX_1_NUM_BLK_1_3 ((uint32_t)0x20000000) /*!< Bit 3 */
+#define USB_CNT2_RX_1_NUM_BLK_1_4 ((uint32_t)0x40000000) /*!< Bit 4 */
+
+#define USB_CNT2_RX_1_BLKSIZE_1 ((uint32_t)0x80000000) /*!< BLock SIZE (high) */
+
+/**************** Bit definition for USB_CNT3_RX_0 register ***************/
+#define USB_CNT3_RX_0_CNT3_RX_0 ((uint32_t)0x000003FF) /*!< Reception Byte Count (low) */
+
+#define USB_CNT3_RX_0_NUM_BLK_0 ((uint32_t)0x00007C00) /*!< NUM_BLOCK_0[4:0] bits (Number of blocks) (low) */
+#define USB_CNT3_RX_0_NUM_BLK_0_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define USB_CNT3_RX_0_NUM_BLK_0_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define USB_CNT3_RX_0_NUM_BLK_0_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define USB_CNT3_RX_0_NUM_BLK_0_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define USB_CNT3_RX_0_NUM_BLK_0_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define USB_CNT3_RX_0_BLKSIZE_0 ((uint32_t)0x00008000) /*!< BLock SIZE (low) */
+
+/**************** Bit definition for USB_CNT3_RX_1 register ***************/
+#define USB_CNT3_RX_1_CNT3_RX_1 ((uint32_t)0x03FF0000) /*!< Reception Byte Count (high) */
+
+#define USB_CNT3_RX_1_NUM_BLK_1 ((uint32_t)0x7C000000) /*!< NUM_BLOCK_1[4:0] bits (Number of blocks) (high) */
+#define USB_CNT3_RX_1_NUM_BLK_1_0 ((uint32_t)0x04000000) /*!< Bit 0 */
+#define USB_CNT3_RX_1_NUM_BLK_1_1 ((uint32_t)0x08000000) /*!< Bit 1 */
+#define USB_CNT3_RX_1_NUM_BLK_1_2 ((uint32_t)0x10000000) /*!< Bit 2 */
+#define USB_CNT3_RX_1_NUM_BLK_1_3 ((uint32_t)0x20000000) /*!< Bit 3 */
+#define USB_CNT3_RX_1_NUM_BLK_1_4 ((uint32_t)0x40000000) /*!< Bit 4 */
+
+#define USB_CNT3_RX_1_BLKSIZE_1 ((uint32_t)0x80000000) /*!< BLock SIZE (high) */
+
+/**************** Bit definition for USB_CNT4_RX_0 register ***************/
+#define USB_CNT4_RX_0_CNT4_RX_0 ((uint32_t)0x000003FF) /*!< Reception Byte Count (low) */
+
+#define USB_CNT4_RX_0_NUM_BLK_0 ((uint32_t)0x00007C00) /*!< NUM_BLOCK_0[4:0] bits (Number of blocks) (low) */
+#define USB_CNT4_RX_0_NUM_BLK_0_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define USB_CNT4_RX_0_NUM_BLK_0_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define USB_CNT4_RX_0_NUM_BLK_0_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define USB_CNT4_RX_0_NUM_BLK_0_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define USB_CNT4_RX_0_NUM_BLK_0_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define USB_CNT4_RX_0_BLKSIZE_0 ((uint32_t)0x00008000) /*!< BLock SIZE (low) */
+
+/**************** Bit definition for USB_CNT4_RX_1 register ***************/
+#define USB_CNT4_RX_1_CNT4_RX_1 ((uint32_t)0x03FF0000) /*!< Reception Byte Count (high) */
+
+#define USB_CNT4_RX_1_NUM_BLK_1 ((uint32_t)0x7C000000) /*!< NUM_BLOCK_1[4:0] bits (Number of blocks) (high) */
+#define USB_CNT4_RX_1_NUM_BLK_1_0 ((uint32_t)0x04000000) /*!< Bit 0 */
+#define USB_CNT4_RX_1_NUM_BLK_1_1 ((uint32_t)0x08000000) /*!< Bit 1 */
+#define USB_CNT4_RX_1_NUM_BLK_1_2 ((uint32_t)0x10000000) /*!< Bit 2 */
+#define USB_CNT4_RX_1_NUM_BLK_1_3 ((uint32_t)0x20000000) /*!< Bit 3 */
+#define USB_CNT4_RX_1_NUM_BLK_1_4 ((uint32_t)0x40000000) /*!< Bit 4 */
+
+#define USB_CNT4_RX_1_BLKSIZE_1 ((uint32_t)0x80000000) /*!< BLock SIZE (high) */
+
+/**************** Bit definition for USB_CNT5_RX_0 register ***************/
+#define USB_CNT5_RX_0_CNT5_RX_0 ((uint32_t)0x000003FF) /*!< Reception Byte Count (low) */
+
+#define USB_CNT5_RX_0_NUM_BLK_0 ((uint32_t)0x00007C00) /*!< NUM_BLOCK_0[4:0] bits (Number of blocks) (low) */
+#define USB_CNT5_RX_0_NUM_BLK_0_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define USB_CNT5_RX_0_NUM_BLK_0_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define USB_CNT5_RX_0_NUM_BLK_0_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define USB_CNT5_RX_0_NUM_BLK_0_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define USB_CNT5_RX_0_NUM_BLK_0_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define USB_CNT5_RX_0_BLKSIZE_0 ((uint32_t)0x00008000) /*!< BLock SIZE (low) */
+
+/**************** Bit definition for USB_CNT5_RX_1 register ***************/
+#define USB_CNT5_RX_1_CNT5_RX_1 ((uint32_t)0x03FF0000) /*!< Reception Byte Count (high) */
+
+#define USB_CNT5_RX_1_NUM_BLK_1 ((uint32_t)0x7C000000) /*!< NUM_BLOCK_1[4:0] bits (Number of blocks) (high) */
+#define USB_CNT5_RX_1_NUM_BLK_1_0 ((uint32_t)0x04000000) /*!< Bit 0 */
+#define USB_CNT5_RX_1_NUM_BLK_1_1 ((uint32_t)0x08000000) /*!< Bit 1 */
+#define USB_CNT5_RX_1_NUM_BLK_1_2 ((uint32_t)0x10000000) /*!< Bit 2 */
+#define USB_CNT5_RX_1_NUM_BLK_1_3 ((uint32_t)0x20000000) /*!< Bit 3 */
+#define USB_CNT5_RX_1_NUM_BLK_1_4 ((uint32_t)0x40000000) /*!< Bit 4 */
+
+#define USB_CNT5_RX_1_BLKSIZE_1 ((uint32_t)0x80000000) /*!< BLock SIZE (high) */
+
+/*************** Bit definition for USB_CNT6_RX_0 register ***************/
+#define USB_CNT6_RX_0_CNT6_RX_0 ((uint32_t)0x000003FF) /*!< Reception Byte Count (low) */
+
+#define USB_CNT6_RX_0_NUM_BLK_0 ((uint32_t)0x00007C00) /*!< NUM_BLOCK_0[4:0] bits (Number of blocks) (low) */
+#define USB_CNT6_RX_0_NUM_BLK_0_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define USB_CNT6_RX_0_NUM_BLK_0_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define USB_CNT6_RX_0_NUM_BLK_0_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define USB_CNT6_RX_0_NUM_BLK_0_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define USB_CNT6_RX_0_NUM_BLK_0_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define USB_CNT6_RX_0_BLKSIZE_0 ((uint32_t)0x00008000) /*!< BLock SIZE (low) */
+
+/**************** Bit definition for USB_CNT6_RX_1 register ***************/
+#define USB_CNT6_RX_1_CNT6_RX_1 ((uint32_t)0x03FF0000) /*!< Reception Byte Count (high) */
+
+#define USB_CNT6_RX_1_NUM_BLK_1 ((uint32_t)0x7C000000) /*!< NUM_BLOCK_1[4:0] bits (Number of blocks) (high) */
+#define USB_CNT6_RX_1_NUM_BLK_1_0 ((uint32_t)0x04000000) /*!< Bit 0 */
+#define USB_CNT6_RX_1_NUM_BLK_1_1 ((uint32_t)0x08000000) /*!< Bit 1 */
+#define USB_CNT6_RX_1_NUM_BLK_1_2 ((uint32_t)0x10000000) /*!< Bit 2 */
+#define USB_CNT6_RX_1_NUM_BLK_1_3 ((uint32_t)0x20000000) /*!< Bit 3 */
+#define USB_CNT6_RX_1_NUM_BLK_1_4 ((uint32_t)0x40000000) /*!< Bit 4 */
+
+#define USB_CNT6_RX_1_BLKSIZE_1 ((uint32_t)0x80000000) /*!< BLock SIZE (high) */
+
+/*************** Bit definition for USB_CNT7_RX_0 register ****************/
+#define USB_CNT7_RX_0_CNT7_RX_0 ((uint32_t)0x000003FF) /*!< Reception Byte Count (low) */
+
+#define USB_CNT7_RX_0_NUM_BLK_0 ((uint32_t)0x00007C00) /*!< NUM_BLOCK_0[4:0] bits (Number of blocks) (low) */
+#define USB_CNT7_RX_0_NUM_BLK_0_0 ((uint32_t)0x00000400) /*!< Bit 0 */
+#define USB_CNT7_RX_0_NUM_BLK_0_1 ((uint32_t)0x00000800) /*!< Bit 1 */
+#define USB_CNT7_RX_0_NUM_BLK_0_2 ((uint32_t)0x00001000) /*!< Bit 2 */
+#define USB_CNT7_RX_0_NUM_BLK_0_3 ((uint32_t)0x00002000) /*!< Bit 3 */
+#define USB_CNT7_RX_0_NUM_BLK_0_4 ((uint32_t)0x00004000) /*!< Bit 4 */
+
+#define USB_CNT7_RX_0_BLKSIZE_0 ((uint32_t)0x00008000) /*!< BLock SIZE (low) */
+
+/*************** Bit definition for USB_CNT7_RX_1 register ****************/
+#define USB_CNT7_RX_1_CNT7_RX_1 ((uint32_t)0x03FF0000) /*!< Reception Byte Count (high) */
+
+#define USB_CNT7_RX_1_NUM_BLK_1 ((uint32_t)0x7C000000) /*!< NUM_BLOCK_1[4:0] bits (Number of blocks) (high) */
+#define USB_CNT7_RX_1_NUM_BLK_1_0 ((uint32_t)0x04000000) /*!< Bit 0 */
+#define USB_CNT7_RX_1_NUM_BLK_1_1 ((uint32_t)0x08000000) /*!< Bit 1 */
+#define USB_CNT7_RX_1_NUM_BLK_1_2 ((uint32_t)0x10000000) /*!< Bit 2 */
+#define USB_CNT7_RX_1_NUM_BLK_1_3 ((uint32_t)0x20000000) /*!< Bit 3 */
+#define USB_CNT7_RX_1_NUM_BLK_1_4 ((uint32_t)0x40000000) /*!< Bit 4 */
+
+#define USB_CNT7_RX_1_BLKSIZE_1 ((uint32_t)0x80000000) /*!< BLock SIZE (high) */
+
+/******************************************************************************/
+/* */
+/* Controller Area Network */
+/* */
+/******************************************************************************/
+
+/** CAN control and status registers */
+/******************* Bit definition for CAN_MCTRL register ********************/
+#define CAN_MCTRL_INRQ ((uint16_t)0x0001) /*!< Initialization Request */
+#define CAN_MCTRL_SLP ((uint16_t)0x0002) /*!< Sleep Mode Request */
+#define CAN_MCTRL_TFP ((uint16_t)0x0004) /*!< Transmit FIFO Priority */
+#define CAN_MCTRL_RFL ((uint16_t)0x0008) /*!< Receive FIFO Locked Mode */
+#define CAN_MCTRL_NART ((uint16_t)0x0010) /*!< No Automatic Retransmission */
+#define CAN_MCTRL_AWU ((uint16_t)0x0020) /*!< Automatic Wakeup Mode */
+#define CAN_MCTRL_ABO ((uint16_t)0x0040) /*!< Automatic Bus-Off Management */
+#define CAN_MCTRL_TTC ((uint16_t)0x0080) /*!< Time Triggered Communication Mode */
+#define CAN_MCTRL_RST ((uint16_t)0x8000) /*!< CAN software master reset */
+
+/******************* Bit definition for CAN_MSTS register ********************/
+#define CAN_MSTS_IAK ((uint16_t)0x0001) /*!< Initialization Acknowledge */
+#define CAN_MSTS_SAK ((uint16_t)0x0002) /*!< Sleep Acknowledge */
+#define CAN_MSTS_ERIT ((uint16_t)0x0004) /*!< Error Interrupt */
+#define CAN_MSTS_WKIT ((uint16_t)0x0008) /*!< Wakeup Interrupt */
+#define CAN_MSTS_SAKIT ((uint16_t)0x0010) /*!< Sleep Acknowledge Interrupt */
+#define CAN_MSTS_TX ((uint16_t)0x0100) /*!< Transmit Mode */
+#define CAN_MSTS_RX ((uint16_t)0x0200) /*!< Receive Mode */
+#define CAN_MSTS_LSAP ((uint16_t)0x0400) /*!< Last Sample Point */
+#define CAN_MSTS_RXS ((uint16_t)0x0800) /*!< CAN Rx Signal */
+
+/******************* Bit definition for CAN_TSTS register ********************/
+#define CAN_TSTS_RQC0 ((uint32_t)0x00000001) /*!< Request Completed Mailbox0 */
+#define CAN_TSTS_TOK0 ((uint32_t)0x00000002) /*!< Transmission OK of Mailbox0 */
+#define CAN_TSTS_ALS0 ((uint32_t)0x00000004) /*!< Arbitration Lost for Mailbox0 */
+#define CAN_TSTS_TER0 ((uint32_t)0x00000008) /*!< Transmission Error of Mailbox0 */
+#define CAN_TSTS_ARQ0 ((uint32_t)0x00000080) /*!< Abort Request for Mailbox0 */
+#define CAN_TSTS_RQC1 ((uint32_t)0x00000100) /*!< Request Completed Mailbox1 */
+#define CAN_TSTS_TOK1 ((uint32_t)0x00000200) /*!< Transmission OK of Mailbox1 */
+#define CAN_TSTS_ALS1 ((uint32_t)0x00000400) /*!< Arbitration Lost for Mailbox1 */
+#define CAN_TSTS_TER1 ((uint32_t)0x00000800) /*!< Transmission Error of Mailbox1 */
+#define CAN_TSTS_ARQ1 ((uint32_t)0x00008000) /*!< Abort Request for Mailbox 1 */
+#define CAN_TSTS_RQC2 ((uint32_t)0x00010000) /*!< Request Completed Mailbox2 */
+#define CAN_TSTS_TOK2 ((uint32_t)0x00020000) /*!< Transmission OK of Mailbox 2 */
+#define CAN_TSTS_ALS2 ((uint32_t)0x00040000) /*!< Arbitration Lost for mailbox 2 */
+#define CAN_TSTS_TER2 ((uint32_t)0x00080000) /*!< Transmission Error of Mailbox 2 */
+#define CAN_TSTS_ARQ2 ((uint32_t)0x00800000) /*!< Abort Request for Mailbox 2 */
+#define CAN_TSTS_NTM ((uint32_t)0x03000000) /*!< Mailbox Code */
+
+#define CAN_TSTS_TSME ((uint32_t)0x1C000000) /*!< TME[2:0] bits */
+#define CAN_TSTS_TSME0 ((uint32_t)0x04000000) /*!< Transmit Mailbox 0 Empty */
+#define CAN_TSTS_TSME1 ((uint32_t)0x08000000) /*!< Transmit Mailbox 1 Empty */
+#define CAN_TSTS_TSME2 ((uint32_t)0x10000000) /*!< Transmit Mailbox 2 Empty */
+
+#define CAN_TSTS_LPM ((uint32_t)0xE0000000) /*!< LOW[2:0] bits */
+#define CAN_TSTS_LPM0 ((uint32_t)0x20000000) /*!< Lowest Priority Flag for Mailbox 0 */
+#define CAN_TSTS_LPM1 ((uint32_t)0x40000000) /*!< Lowest Priority Flag for Mailbox 1 */
+#define CAN_TSTS_LPM2 ((uint32_t)0x80000000) /*!< Lowest Priority Flag for Mailbox 2 */
+
+/******************* Bit definition for CAN_RF0 register *******************/
+#define CAN_RF0_RFP0 ((uint8_t)0x03) /*!< FIFO 0 Message Pending */
+#define CAN_RF0_RFFU0 ((uint8_t)0x08) /*!< FIFO 0 Full */
+#define CAN_RF0_RFOV0 ((uint8_t)0x10) /*!< FIFO 0 Overrun */
+#define CAN_RF0_RRFM0 ((uint8_t)0x20) /*!< Release FIFO 0 Output Mailbox */
+
+/******************* Bit definition for CAN_RF1 register *******************/
+#define CAN_RF1_RFP1 ((uint8_t)0x03) /*!< FIFO 1 Message Pending */
+#define CAN_RF1_RFFU1 ((uint8_t)0x08) /*!< FIFO 1 Full */
+#define CAN_RF1_RFOV1 ((uint8_t)0x10) /*!< FIFO 1 Overrun */
+#define CAN_RF1_RRFM1 ((uint8_t)0x20) /*!< Release FIFO 1 Output Mailbox */
+
+/******************** Bit definition for CAN_INTEN register *******************/
+#define CAN_INTEN_TSMEIE ((uint32_t)0x00000001) /*!< Transmit Mailbox Empty Interrupt Enable */
+#define CAN_INTEN_RFPIE0 ((uint32_t)0x00000002) /*!< FIFO Message Pending Interrupt Enable */
+#define CAN_INTEN_RFFUIE0 ((uint32_t)0x00000004) /*!< FIFO Full Interrupt Enable */
+#define CAN_INTEN_RFOVIE0 ((uint32_t)0x00000008) /*!< FIFO Overrun Interrupt Enable */
+#define CAN_INTEN_RFPIE1 ((uint32_t)0x00000010) /*!< FIFO Message Pending Interrupt Enable */
+#define CAN_INTEN_RFFUIE1 ((uint32_t)0x00000020) /*!< FIFO Full Interrupt Enable */
+#define CAN_INTEN_RFOVIE1 ((uint32_t)0x00000040) /*!< FIFO Overrun Interrupt Enable */
+#define CAN_INTEN_ERWIE ((uint32_t)0x00000100) /*!< Error Warning Interrupt Enable */
+#define CAN_INTEN_ERPIE ((uint32_t)0x00000200) /*!< Error Passive Interrupt Enable */
+#define CAN_INTEN_BUIE ((uint32_t)0x00000400) /*!< Bus-Off Interrupt Enable */
+#define CAN_INTEN_ERCIE ((uint32_t)0x00000800) /*!< Last Error Code Interrupt Enable */
+#define CAN_INTEN_ERIE ((uint32_t)0x00008000) /*!< Error Interrupt Enable */
+#define CAN_INTEN_WKIE ((uint32_t)0x00010000) /*!< Wakeup Interrupt Enable */
+#define CAN_INTEN_SAKIE ((uint32_t)0x00020000) /*!< Sleep Interrupt Enable */
+
+/******************** Bit definition for CAN_ESTS register *******************/
+#define CAN_ESTS_ERWF ((uint32_t)0x00000001) /*!< Error Warning Flag */
+#define CAN_ESTS_ERPF ((uint32_t)0x00000002) /*!< Error Passive Flag */
+#define CAN_ESTS_BFF ((uint32_t)0x00000004) /*!< Bus-Off Flag */
+
+#define CAN_ESTS_ERC ((uint32_t)0x00000070) /*!< LEC[2:0] bits (Last Error Code) */
+#define CAN_ESTS_ERC_0 ((uint32_t)0x00000010) /*!< Bit 0 */
+#define CAN_ESTS_ERC_1 ((uint32_t)0x00000020) /*!< Bit 1 */
+#define CAN_ESTS_ERC_2 ((uint32_t)0x00000040) /*!< Bit 2 */
+
+#define CAN_ESTS_TEC ((uint32_t)0x00FF0000) /*!< Least significant byte of the 9-bit Transmit Error Counter */
+#define CAN_ESTS_REC ((uint32_t)0xFF000000) /*!< Receive Error Counter */
+
+/******************* Bit definition for CAN_BTMG register ********************/
+#define CAN_BTMG_BRP ((uint32_t)0x000003FF) /*!< Baud Rate Prescaler */
+#define CAN_BTMG_BS1 ((uint32_t)0x000F0000) /*!< Time Segment 1 */
+#define CAN_BTMG_BS2 ((uint32_t)0x00700000) /*!< Time Segment 2 */
+#define CAN_BTMG_SJW ((uint32_t)0x03000000) /*!< Resynchronization Jump Width */
+#define CAN_BTMG_LBK ((uint32_t)0x40000000) /*!< Loop Back Mode (Debug) */
+#define CAN_BTMG_SIL ((uint32_t)0x80000000) /*!< Silent Mode */
+
+/** Mailbox registers */
+/****************** Bit definition for CAN_TI0R register ********************/
+#define CAN_TMI0_TRQ ((uint32_t)0x00000001) /*!< Transmit Mailbox Request */
+#define CAN_TMI0_RTR ((uint32_t)0x00000002) /*!< Remote Transmission Request */
+#define CAN_TMI0_IDT ((uint32_t)0x00000004) /*!< Identifier Extension */
+#define CAN_TMI0_EID ((uint32_t)0x001FFFF8) /*!< Extended Identifier */
+#define CAN_TMI0_SID ((uint32_t)0xFFE00000) /*!< Standard Identifier or Extended Identifier */
+
+/****************** Bit definition for CAN_TDT0 register *******************/
+#define CAN_TDT0_DLC ((uint32_t)0x0000000F) /*!< Data Length Code */
+#define CAN_TDT0_TMEN ((uint32_t)0x00000100) /*!< Transmit Global Time */
+#define CAN_TDT0_TS ((uint32_t)0xFFFF0000) /*!< Message Time Stamp */
+
+/****************** Bit definition for CAN_TDL0 register *******************/
+#define CAN_TDL0_D0 ((uint32_t)0x000000FF) /*!< Data byte 0 */
+#define CAN_TDL0_D1 ((uint32_t)0x0000FF00) /*!< Data byte 1 */
+#define CAN_TDL0_D2 ((uint32_t)0x00FF0000) /*!< Data byte 2 */
+#define CAN_TDL0_D3 ((uint32_t)0xFF000000) /*!< Data byte 3 */
+
+/****************** Bit definition for CAN_TDH0 register *******************/
+#define CAN_TDH0_D4 ((uint32_t)0x000000FF) /*!< Data byte 4 */
+#define CAN_TDH0_D5 ((uint32_t)0x0000FF00) /*!< Data byte 5 */
+#define CAN_TDH0_D6 ((uint32_t)0x00FF0000) /*!< Data byte 6 */
+#define CAN_TDH0_D7 ((uint32_t)0xFF000000) /*!< Data byte 7 */
+
+/******************* Bit definition for CAN_TMI1 register *******************/
+#define CAN_TMI1_TRQ ((uint32_t)0x00000001) /*!< Transmit Mailbox Request */
+#define CAN_TMI1_RTR ((uint32_t)0x00000002) /*!< Remote Transmission Request */
+#define CAN_TMI1_IDT ((uint32_t)0x00000004) /*!< Identifier Extension */
+#define CAN_TMI1_EID ((uint32_t)0x001FFFF8) /*!< Extended Identifier */
+#define CAN_TMI1_SID ((uint32_t)0xFFE00000) /*!< Standard Identifier or Extended Identifier */
+
+/******************* Bit definition for CAN_TDT1 register ******************/
+#define CAN_TDT1_DLC ((uint32_t)0x0000000F) /*!< Data Length Code */
+#define CAN_TDT1_TMEN ((uint32_t)0x00000100) /*!< Transmit Global Time */
+#define CAN_TDT1_TS ((uint32_t)0xFFFF0000) /*!< Message Time Stamp */
+
+/******************* Bit definition for CAN_TDL1 register ******************/
+#define CAN_TDL1_D0 ((uint32_t)0x000000FF) /*!< Data byte 0 */
+#define CAN_TDL1_D1 ((uint32_t)0x0000FF00) /*!< Data byte 1 */
+#define CAN_TDL1_D2 ((uint32_t)0x00FF0000) /*!< Data byte 2 */
+#define CAN_TDL1_D3 ((uint32_t)0xFF000000) /*!< Data byte 3 */
+
+/******************* Bit definition for CAN_TDH1 register ******************/
+#define CAN_TDH1_D4 ((uint32_t)0x000000FF) /*!< Data byte 4 */
+#define CAN_TDH1_D5 ((uint32_t)0x0000FF00) /*!< Data byte 5 */
+#define CAN_TDH1_D6 ((uint32_t)0x00FF0000) /*!< Data byte 6 */
+#define CAN_TDH1_D7 ((uint32_t)0xFF000000) /*!< Data byte 7 */
+
+/******************* Bit definition for CAN_TMI2 register *******************/
+#define CAN_TMI2_TRQ ((uint32_t)0x00000001) /*!< Transmit Mailbox Request */
+#define CAN_TMI2_RTR ((uint32_t)0x00000002) /*!< Remote Transmission Request */
+#define CAN_TMI2_IDT ((uint32_t)0x00000004) /*!< Identifier Extension */
+#define CAN_TMI2_EID ((uint32_t)0x001FFFF8) /*!< Extended identifier */
+#define CAN_TMI2_SID ((uint32_t)0xFFE00000) /*!< Standard Identifier or Extended Identifier */
+
+/******************* Bit definition for CAN_TDT2 register ******************/
+#define CAN_TDT2_DLC ((uint32_t)0x0000000F) /*!< Data Length Code */
+#define CAN_TDT2_TMEN ((uint32_t)0x00000100) /*!< Transmit Global Time */
+#define CAN_TDT2_TS ((uint32_t)0xFFFF0000) /*!< Message Time Stamp */
+
+/******************* Bit definition for CAN_TDL2 register ******************/
+#define CAN_TDL2_D0 ((uint32_t)0x000000FF) /*!< Data byte 0 */
+#define CAN_TDL2_D1 ((uint32_t)0x0000FF00) /*!< Data byte 1 */
+#define CAN_TDL2_D2 ((uint32_t)0x00FF0000) /*!< Data byte 2 */
+#define CAN_TDL2_D3 ((uint32_t)0xFF000000) /*!< Data byte 3 */
+
+/******************* Bit definition for CAN_TDH2 register ******************/
+#define CAN_TDH2_D4 ((uint32_t)0x000000FF) /*!< Data byte 4 */
+#define CAN_TDH2_D5 ((uint32_t)0x0000FF00) /*!< Data byte 5 */
+#define CAN_TDH2_D6 ((uint32_t)0x00FF0000) /*!< Data byte 6 */
+#define CAN_TDH2_D7 ((uint32_t)0xFF000000) /*!< Data byte 7 */
+
+/******************* Bit definition for CAN_RFI0 register *******************/
+#define CAN_RFI0_RTR ((uint32_t)0x00000002) /*!< Remote Transmission Request */
+#define CAN_RFI0_IDT ((uint32_t)0x00000004) /*!< Identifier Extension */
+#define CAN_RFI0_EID ((uint32_t)0x001FFFF8) /*!< Extended Identifier */
+#define CAN_RFI0_SID ((uint32_t)0xFFE00000) /*!< Standard Identifier or Extended Identifier */
+
+/******************* Bit definition for CAN_RDT0 register ******************/
+#define CAN_RDT0_DLC ((uint32_t)0x0000000F) /*!< Data Length Code */
+#define CAN_RDT0_FID ((uint32_t)0x0000FF00) /*!< Filter Match Index */
+#define CAN_RDT0_TS ((uint32_t)0xFFFF0000) /*!< Message Time Stamp */
+
+/******************* Bit definition for CAN_RDL0 register ******************/
+#define CAN_RDL0_D0 ((uint32_t)0x000000FF) /*!< Data byte 0 */
+#define CAN_RDL0_D1 ((uint32_t)0x0000FF00) /*!< Data byte 1 */
+#define CAN_RDL0_D2 ((uint32_t)0x00FF0000) /*!< Data byte 2 */
+#define CAN_RDL0_D3 ((uint32_t)0xFF000000) /*!< Data byte 3 */
+
+/******************* Bit definition for CAN_RDH0 register ******************/
+#define CAN_RDH0_D4 ((uint32_t)0x000000FF) /*!< Data byte 4 */
+#define CAN_RDH0_D5 ((uint32_t)0x0000FF00) /*!< Data byte 5 */
+#define CAN_RDH0_D6 ((uint32_t)0x00FF0000) /*!< Data byte 6 */
+#define CAN_RDH0_D7 ((uint32_t)0xFF000000) /*!< Data byte 7 */
+
+/******************* Bit definition for CAN_RFI1 register *******************/
+#define CAN_RFI1_RTR ((uint32_t)0x00000002) /*!< Remote Transmission Request */
+#define CAN_RFI1_IDT ((uint32_t)0x00000004) /*!< Identifier Extension */
+#define CAN_RFI1_EID ((uint32_t)0x001FFFF8) /*!< Extended identifier */
+#define CAN_RFI1_SID ((uint32_t)0xFFE00000) /*!< Standard Identifier or Extended Identifier */
+
+/******************* Bit definition for CAN_RDT1 register ******************/
+#define CAN_RDT1_DLC ((uint32_t)0x0000000F) /*!< Data Length Code */
+#define CAN_RDT1_FID ((uint32_t)0x0000FF00) /*!< Filter Match Index */
+#define CAN_RDT1_TS ((uint32_t)0xFFFF0000) /*!< Message Time Stamp */
+
+/******************* Bit definition for CAN_RDL1 register ******************/
+#define CAN_RDL1_D0 ((uint32_t)0x000000FF) /*!< Data byte 0 */
+#define CAN_RDL1_D1 ((uint32_t)0x0000FF00) /*!< Data byte 1 */
+#define CAN_RDL1_D2 ((uint32_t)0x00FF0000) /*!< Data byte 2 */
+#define CAN_RDL1_D3 ((uint32_t)0xFF000000) /*!< Data byte 3 */
+
+/******************* Bit definition for CAN_RDH1 register ******************/
+#define CAN_RDH1_D4 ((uint32_t)0x000000FF) /*!< Data byte 4 */
+#define CAN_RDH1_D5 ((uint32_t)0x0000FF00) /*!< Data byte 5 */
+#define CAN_RDH1_D6 ((uint32_t)0x00FF0000) /*!< Data byte 6 */
+#define CAN_RDH1_D7 ((uint32_t)0xFF000000) /*!< Data byte 7 */
+
+/** CAN filter registers */
+/******************* Bit definition for CAN_FM register ********************/
+#define CAN_FM_FINT ((uint8_t)0x01) /*!< Filter Init Mode */
+
+/******************* Bit definition for CAN_FM1 register *******************/
+#define CAN_FM1_FMS ((uint16_t)0x3FFF) /*!< Filter Mode */
+#define CAN_FM1_FMS0 ((uint16_t)0x0001) /*!< Filter Init Mode bit 0 */
+#define CAN_FM1_FMS1 ((uint16_t)0x0002) /*!< Filter Init Mode bit 1 */
+#define CAN_FM1_FMS2 ((uint16_t)0x0004) /*!< Filter Init Mode bit 2 */
+#define CAN_FM1_FMS3 ((uint16_t)0x0008) /*!< Filter Init Mode bit 3 */
+#define CAN_FM1_FMS4 ((uint16_t)0x0010) /*!< Filter Init Mode bit 4 */
+#define CAN_FM1_FMS5 ((uint16_t)0x0020) /*!< Filter Init Mode bit 5 */
+#define CAN_FM1_FMS6 ((uint16_t)0x0040) /*!< Filter Init Mode bit 6 */
+#define CAN_FM1_FMS7 ((uint16_t)0x0080) /*!< Filter Init Mode bit 7 */
+#define CAN_FM1_FMS8 ((uint16_t)0x0100) /*!< Filter Init Mode bit 8 */
+#define CAN_FM1_FMS9 ((uint16_t)0x0200) /*!< Filter Init Mode bit 9 */
+#define CAN_FM1_FMS10 ((uint16_t)0x0400) /*!< Filter Init Mode bit 10 */
+#define CAN_FM1_FMS11 ((uint16_t)0x0800) /*!< Filter Init Mode bit 11 */
+#define CAN_FM1_FMS12 ((uint16_t)0x1000) /*!< Filter Init Mode bit 12 */
+#define CAN_FM1_FMS13 ((uint16_t)0x2000) /*!< Filter Init Mode bit 13 */
+
+/******************* Bit definition for CAN_FS1 register *******************/
+#define CAN_FS1_FBS ((uint16_t)0x3FFF) /*!< Filter Scale Configuration */
+#define CAN_FS1_FBS0 ((uint16_t)0x0001) /*!< Filter Scale Configuration bit 0 */
+#define CAN_FS1_FBS1 ((uint16_t)0x0002) /*!< Filter Scale Configuration bit 1 */
+#define CAN_FS1_FBS2 ((uint16_t)0x0004) /*!< Filter Scale Configuration bit 2 */
+#define CAN_FS1_FBS3 ((uint16_t)0x0008) /*!< Filter Scale Configuration bit 3 */
+#define CAN_FS1_FBS4 ((uint16_t)0x0010) /*!< Filter Scale Configuration bit 4 */
+#define CAN_FS1_FBS5 ((uint16_t)0x0020) /*!< Filter Scale Configuration bit 5 */
+#define CAN_FS1_FBS6 ((uint16_t)0x0040) /*!< Filter Scale Configuration bit 6 */
+#define CAN_FS1_FBS7 ((uint16_t)0x0080) /*!< Filter Scale Configuration bit 7 */
+#define CAN_FS1_FBS8 ((uint16_t)0x0100) /*!< Filter Scale Configuration bit 8 */
+#define CAN_FS1_FBS9 ((uint16_t)0x0200) /*!< Filter Scale Configuration bit 9 */
+#define CAN_FS1_FBS10 ((uint16_t)0x0400) /*!< Filter Scale Configuration bit 10 */
+#define CAN_FS1_FBS11 ((uint16_t)0x0800) /*!< Filter Scale Configuration bit 11 */
+#define CAN_FS1_FBS12 ((uint16_t)0x1000) /*!< Filter Scale Configuration bit 12 */
+#define CAN_FS1_FBS13 ((uint16_t)0x2000) /*!< Filter Scale Configuration bit 13 */
+
+/****************** Bit definition for CAN_FFA1 register *******************/
+#define CAN_FFA1_FAF ((uint16_t)0x3FFF) /*!< Filter FIFO Assignment */
+#define CAN_FFA1_FAF0 ((uint16_t)0x0001) /*!< Filter FIFO Assignment for Filter 0 */
+#define CAN_FFA1_FAF1 ((uint16_t)0x0002) /*!< Filter FIFO Assignment for Filter 1 */
+#define CAN_FFA1_FAF2 ((uint16_t)0x0004) /*!< Filter FIFO Assignment for Filter 2 */
+#define CAN_FFA1_FAF3 ((uint16_t)0x0008) /*!< Filter FIFO Assignment for Filter 3 */
+#define CAN_FFA1_FAF4 ((uint16_t)0x0010) /*!< Filter FIFO Assignment for Filter 4 */
+#define CAN_FFA1_FAF5 ((uint16_t)0x0020) /*!< Filter FIFO Assignment for Filter 5 */
+#define CAN_FFA1_FAF6 ((uint16_t)0x0040) /*!< Filter FIFO Assignment for Filter 6 */
+#define CAN_FFA1_FAF7 ((uint16_t)0x0080) /*!< Filter FIFO Assignment for Filter 7 */
+#define CAN_FFA1_FAF8 ((uint16_t)0x0100) /*!< Filter FIFO Assignment for Filter 8 */
+#define CAN_FFA1_FAF9 ((uint16_t)0x0200) /*!< Filter FIFO Assignment for Filter 9 */
+#define CAN_FFA1_FAF10 ((uint16_t)0x0400) /*!< Filter FIFO Assignment for Filter 10 */
+#define CAN_FFA1_FAF11 ((uint16_t)0x0800) /*!< Filter FIFO Assignment for Filter 11 */
+#define CAN_FFA1_FAF12 ((uint16_t)0x1000) /*!< Filter FIFO Assignment for Filter 12 */
+#define CAN_FFA1_FAF13 ((uint16_t)0x2000) /*!< Filter FIFO Assignment for Filter 13 */
+
+/******************* Bit definition for CAN_FA1 register *******************/
+#define CAN_FA1_FEN ((uint16_t)0x3FFF) /*!< Filter Active */
+#define CAN_FA1_FEN0 ((uint16_t)0x0001) /*!< Filter 0 Active */
+#define CAN_FA1_FEN1 ((uint16_t)0x0002) /*!< Filter 1 Active */
+#define CAN_FA1_FEN2 ((uint16_t)0x0004) /*!< Filter 2 Active */
+#define CAN_FA1_FEN3 ((uint16_t)0x0008) /*!< Filter 3 Active */
+#define CAN_FA1_FEN4 ((uint16_t)0x0010) /*!< Filter 4 Active */
+#define CAN_FA1_FEN5 ((uint16_t)0x0020) /*!< Filter 5 Active */
+#define CAN_FA1_FEN6 ((uint16_t)0x0040) /*!< Filter 6 Active */
+#define CAN_FA1_FEN7 ((uint16_t)0x0080) /*!< Filter 7 Active */
+#define CAN_FA1_FEN8 ((uint16_t)0x0100) /*!< Filter 8 Active */
+#define CAN_FA1_FEN9 ((uint16_t)0x0200) /*!< Filter 9 Active */
+#define CAN_FA1_FEN10 ((uint16_t)0x0400) /*!< Filter 10 Active */
+#define CAN_FA1_FEN11 ((uint16_t)0x0800) /*!< Filter 11 Active */
+#define CAN_FA1_FEN12 ((uint16_t)0x1000) /*!< Filter 12 Active */
+#define CAN_FA1_FEN13 ((uint16_t)0x2000) /*!< Filter 13 Active */
+
+/******************* Bit definition for CAN_FB0R1 register *******************/
+#define CAN_FB0R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB0R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB0R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB0R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB0R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB0R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB0R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB0R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB0R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB0R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB0R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB0R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB0R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB0R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB0R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB0R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB0R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB0R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB0R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB0R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB0R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB0R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB0R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB0R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB0R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB0R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB0R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB0R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB0R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB0R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB0R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB0R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB1R1 register *******************/
+#define CAN_FB1R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB1R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB1R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB1R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB1R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB1R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB1R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB1R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB1R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB1R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB1R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB1R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB1R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB1R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB1R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB1R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB1R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB1R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB1R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB1R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB1R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB1R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB1R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB1R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB1R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB1R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB1R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB1R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB1R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB1R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB1R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB1R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB2R1 register *******************/
+#define CAN_FB2R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB2R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB2R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB2R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB2R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB2R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB2R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB2R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB2R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB2R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB2R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB2R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB2R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB2R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB2R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB2R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB2R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB2R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB2R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB2R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB2R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB2R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB2R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB2R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB2R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB2R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB2R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB2R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB2R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB2R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB2R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB2R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB3R1 register *******************/
+#define CAN_FB3R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB3R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB3R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB3R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB3R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB3R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB3R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB3R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB3R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB3R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB3R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB3R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB3R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB3R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB3R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB3R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB3R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB3R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB3R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB3R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB3R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB3R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB3R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB3R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB3R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB3R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB3R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB3R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB3R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB3R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB3R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB3R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB4R1 register *******************/
+#define CAN_FB4R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB4R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB4R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB4R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB4R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB4R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB4R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB4R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB4R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB4R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB4R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB4R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB4R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB4R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB4R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB4R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB4R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB4R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB4R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB4R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB4R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB4R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB4R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB4R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB4R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB4R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB4R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB4R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB4R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB4R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB4R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB4R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB5R1 register *******************/
+#define CAN_FB5R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB5R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB5R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB5R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB5R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB5R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB5R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB5R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB5R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB5R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB5R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB5R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB5R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB5R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB5R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB5R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB5R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB5R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB5R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB5R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB5R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB5R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB5R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB5R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB5R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB5R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB5R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB5R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB5R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB5R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB5R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB5R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB6R1 register *******************/
+#define CAN_FB6R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB6R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB6R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB6R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB6R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB6R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB6R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB6R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB6R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB6R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB6R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB6R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB6R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB6R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB6R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB6R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB6R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB6R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB6R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB6R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB6R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB6R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB6R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB6R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB6R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB6R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB6R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB6R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB6R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB6R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB6R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB6R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB7R1 register *******************/
+#define CAN_FB7R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB7R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB7R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB7R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB7R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB7R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB7R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB7R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB7R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB7R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB7R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB7R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB7R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB7R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB7R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB7R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB7R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB7R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB7R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB7R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB7R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB7R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB7R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB7R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB7R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB7R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB7R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB7R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB7R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB7R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB7R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB7R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB8R1 register *******************/
+#define CAN_FB8R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB8R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB8R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB8R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB8R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB8R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB8R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB8R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB8R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB8R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB8R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB8R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB8R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB8R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB8R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB8R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB8R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB8R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB8R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB8R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB8R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB8R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB8R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB8R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB8R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB8R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB8R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB8R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB8R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB8R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB8R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB8R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB9R1 register *******************/
+#define CAN_FB9R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB9R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB9R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB9R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB9R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB9R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB9R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB9R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB9R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB9R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB9R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB9R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB9R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB9R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB9R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB9R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB9R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB9R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB9R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB9R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB9R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB9R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB9R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB9R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB9R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB9R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB9R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB9R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB9R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB9R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB9R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB9R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB10R1 register ******************/
+#define CAN_FB10R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB10R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB10R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB10R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB10R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB10R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB10R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB10R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB10R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB10R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB10R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB10R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB10R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB10R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB10R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB10R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB10R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB10R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB10R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB10R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB10R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB10R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB10R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB10R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB10R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB10R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB10R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB10R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB10R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB10R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB10R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB10R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB11R1 register ******************/
+#define CAN_FB11R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB11R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB11R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB11R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB11R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB11R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB11R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB11R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB11R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB11R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB11R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB11R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB11R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB11R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB11R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB11R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB11R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB11R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB11R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB11R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB11R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB11R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB11R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB11R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB11R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB11R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB11R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB11R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB11R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB11R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB11R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB11R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB12R1 register ******************/
+#define CAN_FB12R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB12R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB12R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB12R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB12R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB12R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB12R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB12R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB12R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB12R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB12R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB12R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB12R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB12R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB12R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB12R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB12R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB12R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB12R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB12R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB12R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB12R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB12R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB12R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB12R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB12R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB12R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB12R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB12R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB12R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB12R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB12R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB13R1 register ******************/
+#define CAN_FB13R1_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB13R1_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB13R1_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB13R1_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB13R1_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB13R1_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB13R1_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB13R1_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB13R1_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB13R1_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB13R1_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB13R1_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB13R1_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB13R1_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB13R1_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB13R1_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB13R1_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB13R1_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB13R1_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB13R1_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB13R1_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB13R1_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB13R1_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB13R1_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB13R1_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB13R1_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB13R1_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB13R1_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB13R1_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB13R1_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB13R1_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB13R1_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB0R2 register *******************/
+#define CAN_FB0R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB0R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB0R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB0R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB0R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB0R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB0R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB0R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB0R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB0R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB0R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB0R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB0R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB0R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB0R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB0R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB0R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB0R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB0R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB0R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB0R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB0R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB0R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB0R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB0R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB0R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB0R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB0R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB0R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB0R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB0R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB0R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB1R2 register *******************/
+#define CAN_FB1R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB1R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB1R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB1R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB1R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB1R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB1R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB1R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB1R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB1R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB1R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB1R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB1R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB1R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB1R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB1R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB1R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB1R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB1R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB1R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB1R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB1R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB1R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB1R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB1R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB1R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB1R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB1R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB1R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB1R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB1R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB1R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB2R2 register *******************/
+#define CAN_FB2R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB2R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB2R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB2R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB2R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB2R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB2R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB2R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB2R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB2R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB2R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB2R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB2R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB2R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB2R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB2R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB2R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB2R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB2R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB2R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB2R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB2R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB2R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB2R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB2R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB2R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB2R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB2R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB2R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB2R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB2R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB2R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB3R2 register *******************/
+#define CAN_FB3R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB3R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB3R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB3R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB3R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB3R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB3R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB3R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB3R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB3R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB3R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB3R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB3R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB3R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB3R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB3R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB3R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB3R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB3R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB3R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB3R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB3R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB3R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB3R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB3R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB3R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB3R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB3R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB3R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB3R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB3R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB3R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB4R2 register *******************/
+#define CAN_FB4R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB4R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB4R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB4R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB4R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB4R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB4R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB4R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB4R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB4R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB4R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB4R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB4R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB4R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB4R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB4R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB4R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB4R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB4R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB4R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB4R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB4R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB4R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB4R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB4R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB4R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB4R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB4R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB4R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB4R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB4R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB4R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB5R2 register *******************/
+#define CAN_FB5R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB5R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB5R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB5R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB5R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB5R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB5R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB5R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB5R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB5R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB5R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB5R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB5R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB5R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB5R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB5R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB5R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB5R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB5R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB5R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB5R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB5R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB5R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB5R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB5R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB5R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB5R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB5R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB5R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB5R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB5R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB5R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB6R2 register *******************/
+#define CAN_FB6R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB6R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB6R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB6R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB6R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB6R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB6R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB6R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB6R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB6R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB6R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB6R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB6R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB6R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB6R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB6R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB6R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB6R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB6R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB6R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB6R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB6R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB6R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB6R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB6R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB6R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB6R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB6R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB6R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB6R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB6R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB6R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB7R2 register *******************/
+#define CAN_FB7R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB7R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB7R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB7R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB7R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB7R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB7R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB7R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB7R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB7R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB7R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB7R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB7R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB7R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB7R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB7R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB7R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB7R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB7R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB7R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB7R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB7R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB7R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB7R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB7R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB7R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB7R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB7R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB7R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB7R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB7R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB7R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB8R2 register *******************/
+#define CAN_FB8R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB8R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB8R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB8R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB8R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB8R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB8R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB8R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB8R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB8R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB8R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB8R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB8R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB8R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB8R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB8R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB8R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB8R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB8R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB8R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB8R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB8R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB8R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB8R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB8R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB8R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB8R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB8R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB8R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB8R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB8R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB8R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB9R2 register *******************/
+#define CAN_FB9R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB9R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB9R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB9R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB9R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB9R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB9R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB9R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB9R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB9R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB9R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB9R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB9R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB9R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB9R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB9R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB9R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB9R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB9R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB9R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB9R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB9R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB9R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB9R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB9R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB9R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB9R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB9R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB9R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB9R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB9R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB9R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB10R2 register ******************/
+#define CAN_FB10R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB10R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB10R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB10R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB10R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB10R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB10R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB10R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB10R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB10R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB10R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB10R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB10R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB10R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB10R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB10R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB10R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB10R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB10R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB10R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB10R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB10R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB10R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB10R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB10R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB10R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB10R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB10R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB10R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB10R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB10R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB10R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB11R2 register ******************/
+#define CAN_FB11R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB11R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB11R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB11R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB11R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB11R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB11R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB11R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB11R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB11R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB11R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB11R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB11R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB11R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB11R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB11R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB11R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB11R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB11R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB11R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB11R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB11R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB11R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB11R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB11R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB11R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB11R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB11R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB11R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB11R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB11R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB11R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB12R2 register ******************/
+#define CAN_FB12R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB12R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB12R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB12R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB12R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB12R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB12R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB12R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB12R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB12R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB12R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB12R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB12R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB12R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB12R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB12R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB12R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB12R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB12R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB12R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB12R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB12R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB12R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB12R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB12R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB12R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB12R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB12R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB12R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB12R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB12R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB12R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************* Bit definition for CAN_FB13R2 register ******************/
+#define CAN_FB13R2_FD0 ((uint32_t)0x00000001) /*!< Filter bit 0 */
+#define CAN_FB13R2_FD1 ((uint32_t)0x00000002) /*!< Filter bit 1 */
+#define CAN_FB13R2_FD2 ((uint32_t)0x00000004) /*!< Filter bit 2 */
+#define CAN_FB13R2_FD3 ((uint32_t)0x00000008) /*!< Filter bit 3 */
+#define CAN_FB13R2_FD4 ((uint32_t)0x00000010) /*!< Filter bit 4 */
+#define CAN_FB13R2_FD5 ((uint32_t)0x00000020) /*!< Filter bit 5 */
+#define CAN_FB13R2_FD6 ((uint32_t)0x00000040) /*!< Filter bit 6 */
+#define CAN_FB13R2_FD7 ((uint32_t)0x00000080) /*!< Filter bit 7 */
+#define CAN_FB13R2_FD8 ((uint32_t)0x00000100) /*!< Filter bit 8 */
+#define CAN_FB13R2_FD9 ((uint32_t)0x00000200) /*!< Filter bit 9 */
+#define CAN_FB13R2_FD10 ((uint32_t)0x00000400) /*!< Filter bit 10 */
+#define CAN_FB13R2_FD11 ((uint32_t)0x00000800) /*!< Filter bit 11 */
+#define CAN_FB13R2_FD12 ((uint32_t)0x00001000) /*!< Filter bit 12 */
+#define CAN_FB13R2_FD13 ((uint32_t)0x00002000) /*!< Filter bit 13 */
+#define CAN_FB13R2_FD14 ((uint32_t)0x00004000) /*!< Filter bit 14 */
+#define CAN_FB13R2_FD15 ((uint32_t)0x00008000) /*!< Filter bit 15 */
+#define CAN_FB13R2_FD16 ((uint32_t)0x00010000) /*!< Filter bit 16 */
+#define CAN_FB13R2_FD17 ((uint32_t)0x00020000) /*!< Filter bit 17 */
+#define CAN_FB13R2_FD18 ((uint32_t)0x00040000) /*!< Filter bit 18 */
+#define CAN_FB13R2_FD19 ((uint32_t)0x00080000) /*!< Filter bit 19 */
+#define CAN_FB13R2_FD20 ((uint32_t)0x00100000) /*!< Filter bit 20 */
+#define CAN_FB13R2_FD21 ((uint32_t)0x00200000) /*!< Filter bit 21 */
+#define CAN_FB13R2_FD22 ((uint32_t)0x00400000) /*!< Filter bit 22 */
+#define CAN_FB13R2_FD23 ((uint32_t)0x00800000) /*!< Filter bit 23 */
+#define CAN_FB13R2_FD24 ((uint32_t)0x01000000) /*!< Filter bit 24 */
+#define CAN_FB13R2_FD25 ((uint32_t)0x02000000) /*!< Filter bit 25 */
+#define CAN_FB13R2_FD26 ((uint32_t)0x04000000) /*!< Filter bit 26 */
+#define CAN_FB13R2_FD27 ((uint32_t)0x08000000) /*!< Filter bit 27 */
+#define CAN_FB13R2_FD28 ((uint32_t)0x10000000) /*!< Filter bit 28 */
+#define CAN_FB13R2_FD29 ((uint32_t)0x20000000) /*!< Filter bit 29 */
+#define CAN_FB13R2_FD30 ((uint32_t)0x40000000) /*!< Filter bit 30 */
+#define CAN_FB13R2_FD31 ((uint32_t)0x80000000) /*!< Filter bit 31 */
+
+/******************************************************************************/
+/* */
+/* Serial Peripheral Interface */
+/* */
+/******************************************************************************/
+
+/******************* Bit definition for SPI_CTRL1 register ********************/
+#define SPI_CTRL1_CPHA ((uint16_t)0x0001) /*!< Clock Phase */
+#define SPI_CTRL1_CPOL ((uint16_t)0x0002) /*!< Clock Polarity */
+#define SPI_CTRL1_MSTEN ((uint16_t)0x0004) /*!< Master Selection */
+
+#define SPI_CTRL1_MCLKP ((uint16_t)0x0038) /*!< BR[2:0] bits (Baud Rate Control) */
+#define SPI_CTRL1_MCLKP_0 ((uint16_t)0x0008) /*!< Bit 0 */
+#define SPI_CTRL1_MCLKP_1 ((uint16_t)0x0010) /*!< Bit 1 */
+#define SPI_CTRL1_MCLKP_2 ((uint16_t)0x0020) /*!< Bit 2 */
+
+#define SPI_CTRL1_SPIEN ((uint16_t)0x0040) /*!< SPI Enable */
+#define SPI_CTRL1_LSBEN ((uint16_t)0x0080) /*!< Frame Format */
+#define SPI_CTRL1_ISS ((uint16_t)0x0100) /*!< Internal slave select */
+#define SPI_CTRL1_SWNSSEN ((uint16_t)0x0200) /*!< Software slave management */
+#define SPI_CTRL1_RONLY ((uint16_t)0x0400) /*!< Receive only */
+#define SPI_CTRL1_DFF16 ((uint16_t)0x0800) /*!< Data Frame Format */
+#define SPI_CTRL1_CTN ((uint16_t)0x1000) /*!< Transmit CRC next */
+#define SPI_CTRL1_CCE ((uint16_t)0x2000) /*!< Hardware CRC calculation enable */
+#define SPI_CTRL1_BDOE ((uint16_t)0x4000) /*!< Output enable in bidirectional mode */
+#define SPI_CTRL1_BDMODE ((uint16_t)0x8000) /*!< Bidirectional data mode enable */
+
+/******************* Bit definition for SPI_CTRL2 register ********************/
+#define SPI_CTRL2_DMAREN ((uint16_t)0x0001) /*!< Rx Buffer DMA Enable */
+#define SPI_CTRL2_DMATEN ((uint16_t)0x0002) /*!< Tx Buffer DMA Enable */
+#define SPI_CTRL2_NSSOE ((uint16_t)0x0004) /*!< SS Output Enable */
+#define SPI_CTRL2_ERRIE ((uint16_t)0x0020) /*!< Error Interrupt Enable */
+#define SPI_CTRL2_RNEIE ((uint16_t)0x0040) /*!< RX buffer Not Empty Interrupt Enable */
+#define SPI_CTRL2_TEIE ((uint16_t)0x0080) /*!< Tx buffer Empty Interrupt Enable */
+#define SPI_CTRL2_MCLKP_EXT ((uint16_t)0x0100) /*!< BR[3] bits (Baud Rate Control) */
+#define SPI_CTRL2_MCLKP_3 ((uint16_t)0x0100) /*!< Bit 3 */
+
+/******************** Bit definition for SPI_STS register ********************/
+#define SPI_STS_RNE ((uint8_t)0x01) /*!< Receive buffer Not Empty */
+#define SPI_STS_TE ((uint8_t)0x02) /*!< Transmit buffer Empty */
+#define SPI_STS_I2SCS ((uint8_t)0x04) /*!< Channel side */
+#define SPI_STS_UDR ((uint8_t)0x08) /*!< Underrun flag */
+#define SPI_STS_CERR ((uint8_t)0x10) /*!< CRC Error flag */
+#define SPI_STS_MODF ((uint8_t)0x20) /*!< Mode fault */
+#define SPI_STS_OVR ((uint8_t)0x40) /*!< Overrun flag */
+#define SPI_STS_BSY ((uint8_t)0x80) /*!< Busy flag */
+
+/******************** Bit definition for SPI_DT register ********************/
+#define SPI_DT_DT ((uint16_t)0xFFFF) /*!< Data Register */
+
+/******************* Bit definition for SPI_CPOLY register ******************/
+#define SPI_CPOLY_CPOLY ((uint16_t)0xFFFF) /*!< CRC polynomial register */
+
+/****************** Bit definition for SPI_RCRC register ******************/
+#define SPI_RCRC_RCRC ((uint16_t)0xFFFF) /*!< Rx CRC Register */
+
+/****************** Bit definition for SPI_TCRC register ******************/
+#define SPI_TCRC_TCRC ((uint16_t)0xFFFF) /*!< Tx CRC Register */
+
+/****************** Bit definition for SPI_I2SCTRL register *****************/
+#define SPI_I2SCTRL_CHLEN ((uint16_t)0x0001) /*!< Channel length (number of bits per audio channel) */
+
+#define SPI_I2SCTRL_DLEN ((uint16_t)0x0006) /*!< DATLEN[1:0] bits (Data length to be transferred) */
+#define SPI_I2SCTRL_DLEN_0 ((uint16_t)0x0002) /*!< Bit 0 */
+#define SPI_I2SCTRL_DLEN_1 ((uint16_t)0x0004) /*!< Bit 1 */
+
+#define SPI_I2SCTRL_CPOL ((uint16_t)0x0008) /*!< steady state clock polarity */
+
+#define SPI_I2SCTRL_I2SAP ((uint16_t)0x0030) /*!< I2SSTD[1:0] bits (I2S standard selection) */
+#define SPI_I2SCTRL_I2SAP_0 ((uint16_t)0x0010) /*!< Bit 0 */
+#define SPI_I2SCTRL_I2SAP_1 ((uint16_t)0x0020) /*!< Bit 1 */
+
+#define SPI_I2SCTRL_PCMSYNCSEL ((uint16_t)0x0080) /*!< PCM frame synchronization */
+
+#define SPI_I2SCTRL_I2SMOD ((uint16_t)0x0300) /*!< I2SCFG[1:0] bits (I2S configuration mode) */
+#define SPI_I2SCTRL_I2SMOD_0 ((uint16_t)0x0100) /*!< Bit 0 */
+#define SPI_I2SCTRL_I2SMOD_1 ((uint16_t)0x0200) /*!< Bit 1 */
+
+#define SPI_I2SCTRL_I2SEN ((uint16_t)0x0400) /*!< I2S Enable */
+#define SPI_I2SCTRL_I2SSEL ((uint16_t)0x0800) /*!< I2S mode selection */
+
+/****************** Bit definition for SPI_I2SCLKP register *******************/
+#define SPI_I2SCLKP_I2SDIV ((uint16_t)0x0CFF) /*!< I2S Linear prescaler */
+#define SPI_I2SCLKP_I2SODD ((uint16_t)0x0100) /*!< Odd factor for the prescaler */
+#define SPI_I2SCLKP_I2SMCLKOE ((uint16_t)0x0200) /*!< Master Clock Output Enable */
+
+
+
+
+/******************************************************************************/
+/* */
+/* Inter-integrated Circuit Interface */
+/* */
+/******************************************************************************/
+
+/******************* Bit definition for I2C_CTRL1 register ********************/
+#define I2C_CTRL1_PEN ((uint16_t)0x0001) /*!< Peripheral Enable */
+#define I2C_CTRL1_SMBMODE ((uint16_t)0x0002) /*!< SMBus Mode */
+#define I2C_CTRL1_SMBTYPE ((uint16_t)0x0008) /*!< SMBus Type */
+#define I2C_CTRL1_ARPEN ((uint16_t)0x0010) /*!< ARP Enable */
+#define I2C_CTRL1_PECEN ((uint16_t)0x0020) /*!< PEC Enable */
+#define I2C_CTRL1_GCEN ((uint16_t)0x0040) /*!< General Call Enable */
+#define I2C_CTRL1_NOCLKSTRETCH ((uint16_t)0x0080) /*!< Clock Stretching Disable (Slave mode) */
+#define I2C_CTRL1_STARTGEN ((uint16_t)0x0100) /*!< Start Generation */
+#define I2C_CTRL1_STOPGEN ((uint16_t)0x0200) /*!< Stop Generation */
+#define I2C_CTRL1_ACKEN ((uint16_t)0x0400) /*!< Acknowledge Enable */
+#define I2C_CTRL1_POSEN ((uint16_t)0x0800) /*!< Acknowledge/PEC Position (for data reception) */
+#define I2C_CTRL1_PECTRA ((uint16_t)0x1000) /*!< Packet Error Checking */
+#define I2C_CTRL1_SMBALERT ((uint16_t)0x2000) /*!< SMBus Alert */
+#define I2C_CTRL1_SWRESET ((uint16_t)0x8000) /*!< Software Reset */
+
+/******************* Bit definition for I2C_CTRL2 register ********************/
+#define I2C_CTRL2_CLKFREQ ((uint16_t)0x003F) /*!< FREQ[7:0] bits (Peripheral Clock Frequency) */
+#define I2C_CTRL2_CLKFREQ_B0 ((uint16_t)0x0001) /*!< Bit 0 */
+#define I2C_CTRL2_CLKFREQ_B1 ((uint16_t)0x0002) /*!< Bit 1 */
+#define I2C_CTRL2_CLKFREQ_B2 ((uint16_t)0x0004) /*!< Bit 2 */
+#define I2C_CTRL2_CLKFREQ_B3 ((uint16_t)0x0008) /*!< Bit 3 */
+#define I2C_CTRL2_CLKFREQ_B4 ((uint16_t)0x0010) /*!< Bit 4 */
+#define I2C_CTRL2_CLKFREQ_B5 ((uint16_t)0x0020) /*!< Bit 5 */
+#define I2C_CTRL2_CLKFREQ_B6 ((uint16_t)0x0040) /*!< Bit 6 */
+#define I2C_CTRL2_CLKFREQ_B7 ((uint16_t)0x0080) /*!< Bit 7 */
+
+#define I2C_CTRL2_ERRITEN ((uint16_t)0x0100) /*!< Error Interrupt Enable */
+#define I2C_CTRL2_EVTITEN ((uint16_t)0x0200) /*!< Event Interrupt Enable */
+#define I2C_CTRL2_BUFITEN ((uint16_t)0x0400) /*!< Buffer Interrupt Enable */
+#define I2C_CTRL2_DMAEN ((uint16_t)0x0800) /*!< DMA Requests Enable */
+#define I2C_CTRL2_DMALAST ((uint16_t)0x1000) /*!< DMA Last Transfer */
+
+/******************* Bit definition for I2C_OADDR1 register *******************/
+#define I2C_OADDR1_ADDR1_7 ((uint16_t)0x00FE) /*!< Interface Address */
+#define I2C_OADDR1_ADDR8_9 ((uint16_t)0x0300) /*!< Interface Address */
+
+#define I2C_OADDR1_ADDR_B0 ((uint16_t)0x0001) /*!< Bit 0 */
+#define I2C_OADDR1_ADDR_B1 ((uint16_t)0x0002) /*!< Bit 1 */
+#define I2C_OADDR1_ADDR_B2 ((uint16_t)0x0004) /*!< Bit 2 */
+#define I2C_OADDR1_ADDR_B3 ((uint16_t)0x0008) /*!< Bit 3 */
+#define I2C_OADDR1_ADDR_B4 ((uint16_t)0x0010) /*!< Bit 4 */
+#define I2C_OADDR1_ADDR_B5 ((uint16_t)0x0020) /*!< Bit 5 */
+#define I2C_OADDR1_ADDR_B6 ((uint16_t)0x0040) /*!< Bit 6 */
+#define I2C_OADDR1_ADDR_B7 ((uint16_t)0x0080) /*!< Bit 7 */
+#define I2C_OADDR1_ADDR_B8 ((uint16_t)0x0100) /*!< Bit 8 */
+#define I2C_OADDR1_ADDR_B9 ((uint16_t)0x0200) /*!< Bit 9 */
+
+#define I2C_OADDR1_ADDRMODE ((uint16_t)0x8000) /*!< Addressing Mode (Slave mode) */
+
+/******************* Bit definition for I2C_OADDR2 register *******************/
+#define I2C_OADDR2_DUALEN ((uint8_t)0x01) /*!< Dual addressing mode enable */
+#define I2C_OADDR2_ADDR2 ((uint8_t)0xFE) /*!< Interface address */
+
+/******************** Bit definition for I2C_DT register ********************/
+#define I2C_DT_DT ((uint8_t)0xFF) /*!< 8-bit Data Register */
+
+/******************* Bit definition for I2C_STS1 register ********************/
+#define I2C_STS1_STARTF ((uint16_t)0x0001) /*!< Start Bit (Master mode) */
+#define I2C_STS1_ADDRF ((uint16_t)0x0002) /*!< Address sent (master mode)/matched (slave mode) */
+#define I2C_STS1_BTFF ((uint16_t)0x0004) /*!< Byte Transfer Finished */
+#define I2C_STS1_ADDR10F ((uint16_t)0x0008) /*!< 10-bit header sent (Master mode) */
+#define I2C_STS1_STOPF ((uint16_t)0x0010) /*!< Stop detection (Slave mode) */
+#define I2C_STS1_RDNE ((uint16_t)0x0040) /*!< Data Register not Empty (receivers) */
+#define I2C_STS1_TDE ((uint16_t)0x0080) /*!< Data Register Empty (transmitters) */
+#define I2C_STS1_BUSERR ((uint16_t)0x0100) /*!< Bus Error */
+#define I2C_STS1_ARLOST ((uint16_t)0x0200) /*!< Arbitration Lost (master mode) */
+#define I2C_STS1_ACKFAIL ((uint16_t)0x0400) /*!< Acknowledge Failure */
+#define I2C_STS1_OVRUN ((uint16_t)0x0800) /*!< Overrun/Underrun */
+#define I2C_STS1_PECERR ((uint16_t)0x1000) /*!< PEC Error in reception */
+#define I2C_STS1_TIMOUT ((uint16_t)0x4000) /*!< Timeout or Tlow Error */
+#define I2C_STS1_SMBALERTF ((uint16_t)0x8000) /*!< SMBus Alert */
+
+/******************* Bit definition for I2C_STS2 register ********************/
+#define I2C_STS2_MSF ((uint16_t)0x0001) /*!< Master/Slave */
+#define I2C_STS2_BUSYF ((uint16_t)0x0002) /*!< Bus Busy */
+#define I2C_STS2_TRF ((uint16_t)0x0004) /*!< Transmitter/Receiver */
+#define I2C_STS2_GCADDRF ((uint16_t)0x0010) /*!< General Call Address (Slave mode) */
+#define I2C_STS2_SMBDEFTADDRF ((uint16_t)0x0020) /*!< SMBus Device Default Address (Slave mode) */
+#define I2C_STS2_SMBHOSTADDRF ((uint16_t)0x0040) /*!< SMBus Host Header (Slave mode) */
+#define I2C_STS2_DUALF ((uint16_t)0x0080) /*!< Dual Flag (Slave mode) */
+#define I2C_STS2_PECVAL ((uint16_t)0xFF00) /*!< Packet Error Checking Register */
+
+/******************* Bit definition for I2C_CLKCTRL register ********************/
+#define I2C_CLKCTRL_CLKCTRL ((uint16_t)0x0FFF) /*!< Clock Control Register in Fast/Standard mode (Master mode) */
+#define I2C_CLKCTRL_FMDUTY ((uint16_t)0x4000) /*!< Fast Mode Duty Cycle */
+#define I2C_CLKCTRL_FSMODE ((uint16_t)0x8000) /*!< I2C Master Mode Selection */
+
+/****************** Bit definition for I2C_TMRISE register *******************/
+#define I2C_TMRISE_TMRISE ((uint8_t)0x3F) /*!< Maximum Rise Time in Fast/Standard mode (Master mode) */
+
+/******************************************************************************/
+/* */
+/* Universal Synchronous Asynchronous Receiver Transmitter */
+/* */
+/******************************************************************************/
+
+/******************* Bit definition for USART_STS register *******************/
+#define USART_STS_PERR ((uint16_t)0x0001) /*!< Parity Error */
+#define USART_STS_FERR ((uint16_t)0x0002) /*!< Framing Error */
+#define USART_STS_NERR ((uint16_t)0x0004) /*!< Noise Error Flag */
+#define USART_STS_ORERR ((uint16_t)0x0008) /*!< OverRun Error */
+#define USART_STS_IDLEF ((uint16_t)0x0010) /*!< IDLE line detected */
+#define USART_STS_RDNE ((uint16_t)0x0020) /*!< Read Data Register Not Empty */
+#define USART_STS_TRAC ((uint16_t)0x0040) /*!< Transmission Complete */
+#define USART_STS_TDE ((uint16_t)0x0080) /*!< Transmit Data Register Empty */
+#define USART_STS_LBDF ((uint16_t)0x0100) /*!< LIN Break Detection Flag */
+#define USART_STS_CTSF ((uint16_t)0x0200) /*!< CTS Flag */
+
+/******************* Bit definition for USART_DT register *******************/
+#define USART_DT_DT ((uint16_t)0x01FF) /*!< Data value */
+
+/****************** Bit definition for USART_BAUDR register *******************/
+#define USART_BAUDR_DIV_Decimal ((uint16_t)0x000F) /*!< Fraction of USARTDIV */
+#define USART_BAUDR_DIV_Integer ((uint16_t)0xFFF0) /*!< Mantissa of USARTDIV */
+
+/****************** Bit definition for USART_CTRL1 register *******************/
+#define USART_CTRL1_SBRK ((uint16_t)0x0001) /*!< Send Break */
+#define USART_CTRL1_RECMUTE ((uint16_t)0x0002) /*!< Receiver wakeup */
+#define USART_CTRL1_REN ((uint16_t)0x0004) /*!< Receiver Enable */
+#define USART_CTRL1_TEN ((uint16_t)0x0008) /*!< Transmitter Enable */
+#define USART_CTRL1_IDLEIEN ((uint16_t)0x0010) /*!< IDLE Interrupt Enable */
+#define USART_CTRL1_RDNEIEN ((uint16_t)0x0020) /*!< RXNE Interrupt Enable */
+#define USART_CTRL1_TRACIEN ((uint16_t)0x0040) /*!< Transmission Complete Interrupt Enable */
+#define USART_CTRL1_TDEIEN ((uint16_t)0x0080) /*!< PE Interrupt Enable */
+#define USART_CTRL1_PERRIEN ((uint16_t)0x0100) /*!< PE Interrupt Enable */
+#define USART_CTRL1_PSEL ((uint16_t)0x0200) /*!< Parity Selection */
+#define USART_CTRL1_PCEN ((uint16_t)0x0400) /*!< Parity Control Enable */
+#define USART_CTRL1_WUMODE ((uint16_t)0x0800) /*!< Wakeup method */
+#define USART_CTRL1_LEN ((uint16_t)0x1000) /*!< Word length */
+#define USART_CTRL1_UEN ((uint16_t)0x2000) /*!< USART Enable */
+#define USART_CTRL1_OVER8 ((uint16_t)0x8000) /*!< USART Oversmapling 8-bits */
+
+/****************** Bit definition for USART_CTRL2 register *******************/
+#define USART_CTRL2_ADDR ((uint16_t)0x000F) /*!< Address of the USART node */
+#define USART_CTRL2_LBDLEN ((uint16_t)0x0020) /*!< LIN Break Detection Length */
+#define USART_CTRL2_LBDIEN ((uint16_t)0x0040) /*!< LIN Break Detection Interrupt Enable */
+#define USART_CTRL2_LBCP ((uint16_t)0x0100) /*!< Last Bit Clock pulse */
+#define USART_CTRL2_CLKPHA ((uint16_t)0x0200) /*!< Clock Phase */
+#define USART_CTRL2_CLKPOL ((uint16_t)0x0400) /*!< Clock Polarity */
+#define USART_CTRL2_CLKEN ((uint16_t)0x0800) /*!< Clock Enable */
+
+#define USART_CTRL2_STOPB ((uint16_t)0x3000) /*!< STOP[1:0] bits (STOP bits) */
+#define USART_CTRL2_STOP_B0 ((uint16_t)0x1000) /*!< Bit 0 */
+#define USART_CTRL2_STOP_B1 ((uint16_t)0x2000) /*!< Bit 1 */
+
+#define USART_CTRL2_LINEN ((uint16_t)0x4000) /*!< LIN mode enable */
+
+/****************** Bit definition for USART_CTRL3 register *******************/
+#define USART_CTRL3_ERRIEN ((uint16_t)0x0001) /*!< Error Interrupt Enable */
+#define USART_CTRL3_IRDAEN ((uint16_t)0x0002) /*!< IrDA mode Enable */
+#define USART_CTRL3_IRDALP ((uint16_t)0x0004) /*!< IrDA Low-Power */
+#define USART_CTRL3_HALFSEL ((uint16_t)0x0008) /*!< Half-Duplex Selection */
+#define USART_CTRL3_NACKEN ((uint16_t)0x0010) /*!< Smartcard NACK enable */
+#define USART_CTRL3_SCMEN ((uint16_t)0x0020) /*!< Smartcard mode enable */
+#define USART_CTRL3_DMAREN ((uint16_t)0x0040) /*!< DMA Enable Receiver */
+#define USART_CTRL3_DMATEN ((uint16_t)0x0080) /*!< DMA Enable Transmitter */
+#define USART_CTRL3_RTSEN ((uint16_t)0x0100) /*!< RTS Enable */
+#define USART_CTRL3_CTSEN ((uint16_t)0x0200) /*!< CTS Enable */
+#define USART_CTRL3_CTSIEN ((uint16_t)0x0400) /*!< CTS Interrupt Enable */
+#define USART_CTRL3_ONEBIT ((uint16_t)0x0800) /*!< One Bit method */
+
+/****************** Bit definition for USART_GTP register ******************/
+#define USART_GTP_PSC ((uint16_t)0x00FF) /*!< PSC[7:0] bits (Prescaler value) */
+#define USART_GTP_PSC_B0 ((uint16_t)0x0001) /*!< Bit 0 */
+#define USART_GTP_PSC_B1 ((uint16_t)0x0002) /*!< Bit 1 */
+#define USART_GTP_PSC_B2 ((uint16_t)0x0004) /*!< Bit 2 */
+#define USART_GTP_PSC_B3 ((uint16_t)0x0008) /*!< Bit 3 */
+#define USART_GTP_PSC_B4 ((uint16_t)0x0010) /*!< Bit 4 */
+#define USART_GTP_PSC_B5 ((uint16_t)0x0020) /*!< Bit 5 */
+#define USART_GTP_PSC_B6 ((uint16_t)0x0040) /*!< Bit 6 */
+#define USART_GTP_PSC_B7 ((uint16_t)0x0080) /*!< Bit 7 */
+
+#define USART_GTP_GTVAL ((uint16_t)0xFF00) /*!< Guard time value */
+
+/******************************************************************************/
+/* */
+/* Debug MCU */
+/* */
+/******************************************************************************/
+
+/**************** Bit definition for DBGMCU_IDCR register *****************/
+#define MCUDBG_IDCR_DEV_ID ((uint32_t)0x00000FFF) /*!< Device Identifier */
+
+#define MCUDBG_IDCR_REV_ID ((uint32_t)0xFFFF0000) /*!< REV_ID[15:0] bits (Revision Identifier) */
+#define MCUDBG_IDCR_REV_ID_0 ((uint32_t)0x00010000) /*!< Bit 0 */
+#define MCUDBG_IDCR_REV_ID_1 ((uint32_t)0x00020000) /*!< Bit 1 */
+#define MCUDBG_IDCR_REV_ID_2 ((uint32_t)0x00040000) /*!< Bit 2 */
+#define MCUDBG_IDCR_REV_ID_3 ((uint32_t)0x00080000) /*!< Bit 3 */
+#define MCUDBG_IDCR_REV_ID_4 ((uint32_t)0x00100000) /*!< Bit 4 */
+#define MCUDBG_IDCR_REV_ID_5 ((uint32_t)0x00200000) /*!< Bit 5 */
+#define MCUDBG_IDCR_REV_ID_6 ((uint32_t)0x00400000) /*!< Bit 6 */
+#define MCUDBG_IDCR_REV_ID_7 ((uint32_t)0x00800000) /*!< Bit 7 */
+#define MCUDBG_IDCR_REV_ID_8 ((uint32_t)0x01000000) /*!< Bit 8 */
+#define MCUDBG_IDCR_REV_ID_9 ((uint32_t)0x02000000) /*!< Bit 9 */
+#define MCUDBG_IDCR_REV_ID_10 ((uint32_t)0x04000000) /*!< Bit 10 */
+#define MCUDBG_IDCR_REV_ID_11 ((uint32_t)0x08000000) /*!< Bit 11 */
+#define MCUDBG_IDCR_REV_ID_12 ((uint32_t)0x10000000) /*!< Bit 12 */
+#define MCUDBG_IDCR_REV_ID_13 ((uint32_t)0x20000000) /*!< Bit 13 */
+#define MCUDBG_IDCR_REV_ID_14 ((uint32_t)0x40000000) /*!< Bit 14 */
+#define MCUDBG_IDCR_REV_ID_15 ((uint32_t)0x80000000) /*!< Bit 15 */
+
+/****************** Bit definition for DBGMCU_CTRL register *******************/
+#define MCUDBG_CTRL_DBG_SLEEP ((uint32_t)0x00000001) /*!< Debug Sleep Mode */
+#define MCUDBG_CTRL_DBG_STOP ((uint32_t)0x00000002) /*!< Debug Stop Mode */
+#define MCUDBG_CTRL_DBG_STANDBY ((uint32_t)0x00000004) /*!< Debug Standby mode */
+#define MCUDBG_CTRL_TRACE_IOEN ((uint32_t)0x00000020) /*!< Trace Pin Assignment Control */
+
+#define MCUDBG_CTRL_TRACE_MODE ((uint32_t)0x000000C0) /*!< TRACE_MODE[1:0] bits (Trace Pin Assignment Control) */
+#define MCUDBG_CTRL_TRACE_MODE_0 ((uint32_t)0x00000040) /*!< Bit 0 */
+#define MCUDBG_CTRL_TRACE_MODE_1 ((uint32_t)0x00000080) /*!< Bit 1 */
+
+#define MCUDBG_CTRL_DBG_IWDG_STOP ((uint32_t)0x00000100) /*!< Debug Independent Watchdog stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_WWDG_STOP ((uint32_t)0x00000200) /*!< Debug Window Watchdog stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_TMR1_STOP ((uint32_t)0x00000400) /*!< TMR1 counter stopped when core is halted */
+#define MCUDBG_CTRL_DBG_TMR2_STOP ((uint32_t)0x00000800) /*!< TMR2 counter stopped when core is halted */
+#define MCUDBG_CTRL_DBG_TMR3_STOP ((uint32_t)0x00001000) /*!< TMR3 counter stopped when core is halted */
+#define MCUDBG_CTRL_DBG_TMR4_STOP ((uint32_t)0x00002000) /*!< TMR4 counter stopped when core is halted */
+#define MCUDBG_CTRL_DBG_CAN1_STOP ((uint32_t)0x00004000) /*!< Debug CAN1 stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) /*!< SMBUS timeout mode stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) /*!< SMBUS timeout mode stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_TMR8_STOP ((uint32_t)0x00020000) /*!< TMR8 counter stopped when core is halted */
+#define MCUDBG_CTRL_DBG_TMR5_STOP ((uint32_t)0x00040000) /*!< TMR5 counter stopped when core is halted */
+
+
+#define MCUDBG_CTRL_DBG_TMR9_STOP ((uint32_t)0x10000000) /*!< Debug TMR9 stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_TMR10_STOP ((uint32_t)0x20000000) /*!< Debug TMR10 stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_TMR11_STOP ((uint32_t)0x40000000) /*!< Debug TMR11 stopped when Core is halted */
+
+#ifdef AT32F413xx
+#if !defined (AT32FEBKCx_MD)
+#define MCUDBG_CTRL_DBG_CAN2_STOP ((uint32_t)0x00200000) /*!< Debug CAN2 stopped when Core is halted */
+#endif
+#else
+#define MCUDBG_CTRL_DBG_TMR6_STOP ((uint32_t)0x00080000) /*!< TMR6 counter stopped when core is halted */
+#define MCUDBG_CTRL_DBG_TMR7_STOP ((uint32_t)0x00100000) /*!< TMR7 counter stopped when core is halted */
+#define MCUDBG_CTRL_DBG_TMR15_STOP ((uint32_t)0x00400000) /*!< Debug TMR15 stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_TMR12_STOP ((uint32_t)0x02000000) /*!< Debug TMR12 stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_TMR13_STOP ((uint32_t)0x04000000) /*!< Debug TMR13 stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_TMR14_STOP ((uint32_t)0x08000000) /*!< Debug TMR14 stopped when Core is halted */
+#define MCUDBG_CTRL_DBG_I2C3_SMBUS_TIMEOUT ((uint32_t)0x80000000) /*!< SMBUS timeout mode stopped when Core is halted */
+#endif
+
+/******************************************************************************/
+/* */
+/* FLASH and Option Bytes Registers */
+/* */
+/******************************************************************************/
+
+/******************* Bit definition for FLASH_ACR register ******************/
+#define FLASH_ACR_LATENCY ((uint8_t)0x07) /*!< LATENCY[2:0] bits (Latency) */
+#define FLASH_ACR_LATENCY_0 ((uint8_t)0x00) /*!< Bit 0 */
+#define FLASH_ACR_LATENCY_1 ((uint8_t)0x01) /*!< Bit 0 */
+#define FLASH_ACR_LATENCY_2 ((uint8_t)0x02) /*!< Bit 1 */
+#define FLASH_ACR_LATENCY_3 ((uint8_t)0x03) /*!< Bit 1 & Bit 0 */
+#define FLASH_ACR_LATENCY_4 ((uint8_t)0x04) /*!< Bit 2 */
+#define FLASH_ACR_LATENCY_5 ((uint8_t)0x05) /*!< Bit 2 & Bit 0 */
+
+#define FLASH_ACR_HLFCYA ((uint8_t)0x08) /*!< Flash Half Cycle Access Enable */
+#define FLASH_ACR_PRFTBE ((uint8_t)0x10) /*!< Prefetch Buffer Enable */
+#define FLASH_ACR_PRFTBS ((uint8_t)0x20) /*!< Prefetch Buffer Status */
+
+/****************** Bit definition for FLASH_FCKEY register ******************/
+#define FLASH_FCKEY_KEY ((uint32_t)0xFFFFFFFF) /*!< FPEC Key */
+
+/***************** Bit definition for FLASH_UOBKEY register ****************/
+#define FLASH_UOBKEY_KEY ((uint32_t)0xFFFFFFFF) /*!< Option Byte Key */
+
+/****************** Bit definition for FLASH_STS register *******************/
+#define FLASH_STS_BSY ((uint8_t)0x01) /*!< Busy */
+#define FLASH_STS_PRGMFLR ((uint8_t)0x04) /*!< Programming Error */
+#define FLASH_STS_WRPRTFLR ((uint8_t)0x10) /*!< Write Protection Error */
+#define FLASH_STS_PRCDN ((uint8_t)0x20) /*!< End of operation */
+
+/******************* Bit definition for FLASH_CTRL register *******************/
+#define FLASH_CTRL_PRGM ((uint16_t)0x0001) /*!< Programming */
+#define FLASH_CTRL_PGERS ((uint16_t)0x0002) /*!< Page Erase */
+#define FLASH_CTRL_CHPERS ((uint16_t)0x0004) /*!< Mass Erase */
+#define FLASH_CTRL_UOBPRGM ((uint16_t)0x0010) /*!< Option Byte Programming */
+#define FLASH_CTRL_UOBERS ((uint16_t)0x0020) /*!< Option Byte Erase */
+#define FLASH_CTRL_STRT ((uint16_t)0x0040) /*!< Start */
+#define FLASH_CTRL_LCK ((uint16_t)0x0080) /*!< Lock */
+#define FLASH_CTRL_UOBWE ((uint16_t)0x0200) /*!< Option Bytes Write Enable */
+#define FLASH_CTRL_FLRIE ((uint16_t)0x0400) /*!< Error Interrupt Enable */
+#define FLASH_CTRL_PRCDNIE ((uint16_t)0x1000) /*!< End of operation interrupt enable */
+#define FLASH_CTRL_OPTION_BYTE_PRT_DIS_TRIG ((uint32_t)0x00010000) /*!< Disable Option Byte Protection */
+
+/******************* Bit definition for FLASH_ADDR register *******************/
+#define FLASH_ADDR_TA ((uint32_t)0xFFFFFFFF) /*!< Flash Address */
+
+/****************** Bit definition for FLASH_UOB register *******************/
+#define FLASH_UOB_UOBFLR ((uint16_t)0x0001) /*!< Option Byte Error */
+#define FLASH_UOB_RDPRTEN ((uint16_t)0x0002) /*!< Read protection */
+
+#define FLASH_UOB_USR ((uint16_t)0x03FC) /*!< User Option Bytes */
+#define FLASH_UOB_SW_WDG ((uint16_t)0x0004) /*!< WDG_SW */
+#define FLASH_UOB_nSTP_RST ((uint16_t)0x0008) /*!< nRST_STOP */
+#define FLASH_UOB_nSTDBY_RST ((uint16_t)0x0010) /*!< nRST_STDBY */
+#define FLASH_UOB_BTOPT ((uint16_t)0x0020) /*!< BFB2 */
+
+#define FLASH_UOB_DATA0 ((uint32_t)0x0003FC00) /*!< User data 0 */
+#define FLASH_UOB_DATA1 ((uint32_t)0x03FC0000) /*!< User data 1 */
+#define FLASH_UOB_OPTION_BYTE_PRT_EN ((uint32_t)0x04000000) /*!< Option Byte Protection */
+
+/****************** Bit definition for FLASH_WRPRT register ******************/
+#define FLASH_WRPRT_WRPRTBMP ((uint32_t)0xFFFFFFFF) /*!< Write Protect */
+
+/****************** Bit definition for FSLIB_CDR0 register ******************/
+#define FLASH_SLIB_CDR0_BOOT_DIS ((uint8_t)0x01) /*!< Boot mode disable in System Memory */
+#define FLASH_SLIB_CDR0_SYS_SLIB_EN ((uint8_t)0x04) /*!< SLIB code enable in System Memory */
+#define FLASH_SLIB_CDR0_SLIB_EN ((uint8_t)0x08) /*!< SLIB code enable in Flash */
+
+/****************** Bit definition for FSLIB_CDR1 register ******************/
+#define FLASH_SLIB_START_PAGE ((uint32_t)0x000007FF) /*!< SLIB Start Page */
+#define FLASH_SLIB_DATA_START_PAGE ((uint32_t)0x003FF800) /*!< SLIB Data Start Page */
+#define FLASH_SLIB_END_PAGE ((uint32_t)0xFFC00000) /*!< SLIB End Page */
+/****************** Bit definition for FSLIB_PSW register ******************/
+#define FLASH_SLIB_PSW_PSW ((uint32_t)0xFFFFFFFF) /*!< SLIB password */
+
+/****************** Bit definition for FSLIB_PSWSTS register ******************/
+#define FLASH_SLIB_PSWSTS_PSW_ERR ((uint8_t)0x01) /*!< SLIB password mismatch */
+#define FLASH_SLIB_PSWSTS_PSW_OK ((uint8_t)0x02) /*!< SLIB password match */
+#define FLASH_SLIB_UNLOCK ((uint8_t)0x04) /*!< SLIB unlock status */
+#define FLASH_SLIB_CNT ((uint32_t)0x01FF0000) /*!< SLIB remaining CFG count */
+
+/*----------------------------------------------------------------------------*/
+
+/****************** Bit definition for FLASH_RDPRT register *******************/
+#define FLASH_RDPRT_RDPRT ((uint32_t)0x000000FF) /*!< Read protection option byte */
+#define FLASH_RDPRT_nRDPRT ((uint32_t)0x0000FF00) /*!< Read protection complemented option byte */
+
+/****************** Bit definition for FLASH_USR register ******************/
+#define FLASH_USR_USR ((uint32_t)0x00FF0000) /*!< User option byte */
+#define FLASH_USR_nUSR ((uint32_t)0xFF000000) /*!< User complemented option byte */
+
+/****************** Bit definition for FLASH_DT0 register *****************/
+#define FLASH_DT0_DT0 ((uint32_t)0x000000FF) /*!< User data storage option byte */
+#define FLASH_DT0_nDT0 ((uint32_t)0x0000FF00) /*!< User data storage complemented option byte */
+
+/****************** Bit definition for FLASH_DT1 register *****************/
+#define FLASH_DT1_DT1 ((uint32_t)0x00FF0000) /*!< User data storage option byte */
+#define FLASH_DT1_nDT1 ((uint32_t)0xFF000000) /*!< User data storage complemented option byte */
+
+/****************** Bit definition for FLASH_WRPRT0 register ******************/
+#define FLASH_WRPRT0_WRPRT0 ((uint32_t)0x000000FF) /*!< Flash memory write protection option bytes */
+#define FLASH_WRPRT0_nWRPRT0 ((uint32_t)0x0000FF00) /*!< Flash memory write protection complemented option bytes */
+
+/****************** Bit definition for FLASH_WRPRT1 register ******************/
+#define FLASH_WRPRT1_WRPRT1 ((uint32_t)0x00FF0000) /*!< Flash memory write protection option bytes */
+#define FLASH_WRPRT1_nWRPRT1 ((uint32_t)0xFF000000) /*!< Flash memory write protection complemented option bytes */
+
+/****************** Bit definition for FLASH_WRPRT2 register ******************/
+#define FLASH_WRPRT2_WRPRT2 ((uint32_t)0x000000FF) /*!< Flash memory write protection option bytes */
+#define FLASH_WRPRT2_nWRPRT2 ((uint32_t)0x0000FF00) /*!< Flash memory write protection complemented option bytes */
+
+/****************** Bit definition for FLASH_WRPRT3 register ******************/
+#define FLASH_WRPRT3_WRPRT3 ((uint32_t)0x00FF0000) /*!< Flash memory write protection option bytes */
+#define FLASH_WRPRT3_nWRPRT3 ((uint32_t)0xFF000000) /*!< Flash memory write protection complemented option bytes */
+
+/****************** Bit definition for FSLIB_SET_PSW register ******************/
+#define FLASH_SLIB_SET_PSW ((uint32_t)0xFFFFFFFF) /*!< SLIB Password */
+
+/****************** Bit definition for FSLIB_SET_RANGE register ******************/
+#define FLASH_SLIB_SET_START_PAGE ((uint32_t)0x000007FF) /*!< SLIB Start Page */
+#define FLASH_SLIB_SET_DATA_START_PAGE ((uint32_t)0x003FF800) /*!< SLIB Data Start Page */
+#define FLASH_SLIB_SET_END_PAGE ((uint32_t)0xFFC00000) /*!< SLIB End Page */
+
+/****************** Bit definition for SLIB_KEYR register ******************/
+#define FLASH_SLIB_KEYR ((uint32_t)0xFFFFFFFF) /*!< SLIB Unlock Key Register */
+
+#if defined (AT32F407xx)
+/******************************************************************************/
+/* */
+/* Ethernet MAC Registers bits definitions */
+/* */
+/******************************************************************************/
+/********** Bit definition for Ethernet MAC Control Register register ***********/
+#define ETH_MACCTRL_WDOGD ((uint32_t)0x00800000) /*!< Watchdog disable */
+#define ETH_MACCTRL_JAD ((uint32_t)0x00400000) /*!< Jabber disable */
+
+#define ETH_MACCTRL_FG ((uint32_t)0x000E0000) /*!< Inter-frame gap */
+#define ETH_MACCTRL_FG_96Bit ((uint32_t)0x00000000) /*!< Minimum IFG between frames during transmission is 96Bit */
+#define ETH_MACCTRL_FG_88Bit ((uint32_t)0x00020000) /*!< Minimum IFG between frames during transmission is 88Bit */
+#define ETH_MACCTRL_FG_80Bit ((uint32_t)0x00040000) /*!< Minimum IFG between frames during transmission is 80Bit */
+#define ETH_MACCTRL_FG_72Bit ((uint32_t)0x00060000) /*!< Minimum IFG between frames during transmission is 72Bit */
+#define ETH_MACCTRL_FG_64Bit ((uint32_t)0x00080000) /*!< Minimum IFG between frames during transmission is 64Bit */
+#define ETH_MACCTRL_FG_56Bit ((uint32_t)0x000A0000) /*!< Minimum IFG between frames during transmission is 56Bit */
+#define ETH_MACCTRL_FG_48Bit ((uint32_t)0x000C0000) /*!< Minimum IFG between frames during transmission is 48Bit */
+#define ETH_MACCTRL_FG_40Bit ((uint32_t)0x000E0000) /*!< Minimum IFG between frames during transmission is 40Bit */
+
+#define ETH_MACCTRL_CSD ((uint32_t)0x00010000) /*!< Carrier sense disable (during transmission) */
+#define ETH_MACCTRL_FESM ((uint32_t)0x00004000) /*!< Fast ethernet speed */
+#define ETH_MACCTRL_ROD ((uint32_t)0x00002000) /*!< Receive own disable */
+#define ETH_MACCTRL_LBM ((uint32_t)0x00001000) /*!< loopback mode */
+#define ETH_MACCTRL_DM ((uint32_t)0x00000800) /*!< Duplex mode */
+#define ETH_MACCTRL_IP4CO ((uint32_t)0x00000400) /*!< IP Checksum offload */
+#define ETH_MACCTRL_RD ((uint32_t)0x00000200) /*!< Retry disable */
+#define ETH_MACCTRL_AUPCS ((uint32_t)0x00000080) /*!< Automatic Pad/CRC stripping */
+
+#define ETH_MACCTRL_BOL ((uint32_t)0x00000060) /*!< Back-off limit: random integer number (r) of slot time delays before rescheduling
+ a transmission attempt during retries after a collision: 0 =< r <2^k */
+#define ETH_MACCTRL_BOL_10 ((uint32_t)0x00000000) /*!< k = min (n, 10) */
+#define ETH_MACCTRL_BOL_8 ((uint32_t)0x00000020) /*!< k = min (n, 8) */
+#define ETH_MACCTRL_BOL_4 ((uint32_t)0x00000040) /*!< k = min (n, 4) */
+#define ETH_MACCTRL_BOL_1 ((uint32_t)0x00000060) /*!< k = min (n, 1) */
+
+#define ETH_MACCTRL_DC ((uint32_t)0x00000010) /*!< Defferal check */
+#define ETH_MACCTRL_TE ((uint32_t)0x00000008) /*!< Transmitter enable */
+#define ETH_MACCTRL_RE ((uint32_t)0x00000004) /*!< Receiver enable */
+
+/************** Bit definition for Ethernet MAC Frame Filter Register ***************/
+#define ETH_MACFRMF_RALL ((uint32_t)0x80000000) /*!< Receive all */
+#define ETH_MACFRMF_HOPF ((uint32_t)0x00000400) /*!< Hash or perfect filter */
+#define ETH_MACFRMF_SADDRF ((uint32_t)0x00000200) /*!< Source address filter enable */
+#define ETH_MACFRMF_SADDRIF ((uint32_t)0x00000100) /*!< SA inverse filtering */
+
+#define ETH_MACFRMF_PCF ((uint32_t)0x000000C0) /*!< Pass control frames: 3 cases */
+#define ETH_MACFRMF_PCF_BlockAll ((uint32_t)0x00000040) /*!< MAC filters all control frames from reaching the application */
+#define ETH_MACFRMF_PCF_ForwardAll ((uint32_t)0x00000080) /*!< MAC forwards all control frames to application even if they fail the Address Filter */
+#define ETH_MACFRMF_ForwardPassedAddrFilter ((uint32_t)0x000000C0) /*!< MAC forwards control frames that pass the Address Filter. */
+
+#define ETH_MACFRMF_BFD ((uint32_t)0x00000020) /*!< Broadcast frame disable */
+#define ETH_MACFRMF_PALLM ((uint32_t)0x00000010) /*!< Pass all mutlicast */
+#define ETH_MACFRMF_DADDRIF ((uint32_t)0x00000008) /*!< DA Inverse filtering */
+#define ETH_MACFRMF_HM ((uint32_t)0x00000004) /*!< Hash multicast */
+#define ETH_MACFRMF_HU ((uint32_t)0x00000002) /*!< Hash unicast */
+#define ETH_MACFRMF_PM ((uint32_t)0x00000001) /*!< Promiscuous mode */
+
+/************ Bit definition for Ethernet MAC Hash Table High Register *************/
+#define ETH_MACHTH_HTH ((uint32_t)0xFFFFFFFF) /*!< Hash table high */
+
+/************* Bit definition for Ethernet MAC Hash Table Low Register *************/
+#define ETH_MACHTL_HTL ((uint32_t)0xFFFFFFFF) /*!< Hash table low */
+
+/************** Bit definition for Ethernet MAC MII Address Register ***************/
+#define ETH_MACMIIADDR_PA ((uint32_t)0x0000F800) /*!< Physical layer address */
+#define ETH_MACMIIADDR_MII ((uint32_t)0x000007C0) /*!< MII register in the selected PHY */
+
+#define ETH_MACMIIADDR_CLKR ((uint32_t)0x0000001C) /*!< CR clock range: 6 cases */
+#define ETH_MACMIIADDR_CLKR_DIV42 ((uint32_t)0x00000000) /*!< HCLK:60-72 MHz; MDC clock= HCLK/42 */
+#define ETH_MACMIIADDR_CLKR_DIV62 ((uint32_t)0x00000004) /*!< HCLK:100-150 MHz; MDC clock= HCLK/62 */
+#define ETH_MACMIIADDR_CLKR_DIV16 ((uint32_t)0x00000008) /*!< HCLK:20-35 MHz; MDC clock= HCLK/16 */
+#define ETH_MACMIIADDR_CLKR_DIV26 ((uint32_t)0x0000000C) /*!< HCLK:35-60 MHz; MDC clock= HCLK/26 */
+#define ETH_MACMIIADDR_CLKR_DIV102 ((uint32_t)0x00000010) /*!< HCLK:150-250 MHz; MDC clock= HCLK/102 */
+#define ETH_MACMIIADDR_CLKR_DIV124 ((uint32_t)0x00000014) /*!< HCLK:250-300 MHz; MDC clock= HCLK/124 */
+
+#define ETH_MACMIIADDR_MIIW ((uint32_t)0x00000002) /*!< MII write */
+#define ETH_MACMIIADDR_MIIB ((uint32_t)0x00000001) /*!< MII busy */
+
+/**************** Bit definition for Ethernet MAC MII Data Register ****************/
+#define ETH_MACMIIDT_MIID ((uint32_t)0x0000FFFF) /*!< MII data: read/write data from/to PHY */
+
+/************** Bit definition for Ethernet MAC Flow Control Register **************/
+#define ETH_MACFCTRL_PTM ((uint32_t)0xFFFF0000) /*!< Pause time */
+#define ETH_MACFCTRL_ZQPD ((uint32_t)0x00000080) /*!< Zero-quanta pause disable */
+
+#define ETH_MACFCTRL_PLT ((uint32_t)0x00000030) /*!< Pause low threshold: 4 cases */
+#define ETH_MACFCTRL_PLT_Minus4 ((uint32_t)0x00000000) /*!< Pause time minus 4 slot times */
+#define ETH_MACFCTRL_PLT_Minus28 ((uint32_t)0x00000010) /*!< Pause time minus 28 slot times */
+#define ETH_MACFCTRL_PLT_Minus144 ((uint32_t)0x00000020) /*!< Pause time minus 144 slot times */
+#define ETH_MACFCTRL_PLT_Minus256 ((uint32_t)0x00000030) /*!< Pause time minus 256 slot times */
+
+#define ETH_MACFCTRL_UPFD ((uint32_t)0x00000008) /*!< Unicast pause frame detect */
+#define ETH_MACFCTRL_RFCEN ((uint32_t)0x00000004) /*!< Receive flow control enable */
+#define ETH_MACFCTRL_TFCEN ((uint32_t)0x00000002) /*!< Transmit flow control enable */
+#define ETH_MACFCTRL_FCBBPA ((uint32_t)0x00000001) /*!< Flow control busy/backpressure activate */
+
+/************** Bit definition for Ethernet MAC VLAN Tag Register ****************/
+#define ETH_MACVLT_VLTC ((uint32_t)0x00010000) /*!< 12-bit VLAN tag comparison */
+#define ETH_MACVLT_VLTI ((uint32_t)0x0000FFFF) /*!< VLAN tag identifier (for receive frames) */
+
+/****** Bit definition for Ethernet MAC Remote Wake-UpFrame Filter Register ******/
+#define ETH_MACRWFF_D ((uint32_t)0xFFFFFFFF) /*!< Wake-up frame filter register data */
+
+/*!< Eight sequential Writes to this address (offset 0x28) will write all Wake-UpFrame Filter Registers.
+ Eight sequential Reads from this address (offset 0x28) will read all Wake-UpFrame Filter Registers. */
+/*!< Wake-UpFrame Filter Reg0 : Filter 0 Byte Mask
+ Wake-UpFrame Filter Reg1 : Filter 1 Byte Mask
+ Wake-UpFrame Filter Reg2 : Filter 2 Byte Mask
+ Wake-UpFrame Filter Reg3 : Filter 3 Byte Mask
+ Wake-UpFrame Filter Reg4 : RSVD - Filter3 Command - RSVD - Filter2 Command -
+ RSVD - Filter1 Command - RSVD - Filter0 Command
+ Wake-UpFrame Filter Re5 : Filter3 Offset - Filter2 Offset - Filter1 Offset - Filter0 Offset
+ Wake-UpFrame Filter Re6 : Filter1 CRC16 - Filter0 CRC16
+ Wake-UpFrame Filter Re7 : Filter3 CRC16 - Filter2 CRC16 */
+
+/******** Bit definition for Ethernet MAC PMT Control and Status Register **********/
+#define ETH_MACPMTCTRLSTS_WFFPR ((uint32_t)0x80000000) /*!< Wake-Up Frame Filter Register Pointer Reset */
+#define ETH_MACPMTCTRLSTS_GLBU ((uint32_t)0x00000200) /*!< Global Unicast */
+#define ETH_MACPMTCTRLSTS_WFR ((uint32_t)0x00000040) /*!< Wake-Up Frame Received */
+#define ETH_MACPMTCTRLSTS_MPR ((uint32_t)0x00000020) /*!< Magic Packet Received */
+#define ETH_MACPMTCTRLSTS_WFEN ((uint32_t)0x00000004) /*!< Wake-Up Frame Enable */
+#define ETH_MACPMTCTRLSTS_MPEN ((uint32_t)0x00000002) /*!< Magic Packet Enable */
+#define ETH_MACPMTCTRLSTS_PD ((uint32_t)0x00000001) /*!< Power Down */
+
+/**************** Bit definition for Ethernet MAC Status Register ******************/
+#define ETH_MACISTS_TSTS ((uint32_t)0x00000200) /*!< Time stamp trigger status */
+#define ETH_MACISTS_MMCTS ((uint32_t)0x00000040) /*!< MMC transmit status */
+#define ETH_MACISTS_MMCRS ((uint32_t)0x00000020) /*!< MMC receive status */
+#define ETH_MACISTS_MMCS ((uint32_t)0x00000010) /*!< MMC status */
+#define ETH_MACISTS_PMTS ((uint32_t)0x00000008) /*!< PMT status */
+
+/************ Bit definition for Ethernet MAC Interrupt Mask Register **************/
+#define ETH_MACIM_TSTINTM ((uint32_t)0x00000200) /*!< Time stamp trigger interrupt mask */
+#define ETH_MACIM_PMTINTM ((uint32_t)0x00000008) /*!< PMT interrupt mask */
+
+/************ Bit definition for Ethernet MAC Address0 High Register ***************/
+#define ETH_MACA0H_MACADDR0H ((uint32_t)0x0000FFFF) /*!< MAC address0 high */
+
+/************* Bit definition for Ethernet MAC Address0 Low Register ***************/
+#define ETH_MACA0L_MACADDR0L ((uint32_t)0xFFFFFFFF) /*!< MAC address0 low */
+
+/************* Bit definition for Ethernet MAC Address1 High Register **************/
+#define ETH_MACA1H_AEN ((uint32_t)0x80000000) /*!< Address enable */
+#define ETH_MACA1H_SADDR ((uint32_t)0x40000000) /*!< Source address */
+
+#define ETH_MACA1H_MBCTRL ((uint32_t)0x3F000000) /*!< Mask byte control: bits to mask for comparison of the MAC Address bytes */
+#define ETH_MACA1H_MBCTRL_HBits15_8 ((uint32_t)0x20000000) /*!< Mask MAC Address high reg bits [15:8] */
+#define ETH_MACA1H_MBCTRL_HBits7_0 ((uint32_t)0x10000000) /*!< Mask MAC Address high reg bits [7:0] */
+#define ETH_MACA1H_MBCTRL_LBits31_24 ((uint32_t)0x08000000) /*!< Mask MAC Address low reg bits [31:24] */
+#define ETH_MACA1H_MBCTRL_LBits23_16 ((uint32_t)0x04000000) /*!< Mask MAC Address low reg bits [23:16] */
+#define ETH_MACA1H_MBCTRL_LBits15_8 ((uint32_t)0x02000000) /*!< Mask MAC Address low reg bits [15:8] */
+#define ETH_MACA1H_MBCTRL_LBits7_0 ((uint32_t)0x01000000) /*!< Mask MAC Address low reg bits [7:0] */
+
+#define ETH_MACA1H_MACADDR1H ((uint32_t)0x0000FFFF) /*!< MAC address1 high */
+/************** Bit definition for Ethernet MAC Address1 Low Register **************/
+
+#define ETH_MACA1L_MACADDR1L ((uint32_t)0xFFFFFFFF) /*!< MAC address1 low */
+
+/************** Bit definition for Ethernet MAC Address2 High Register *************/
+#define ETH_MACA2H_AEN ((uint32_t)0x80000000) /*!< Address enable */
+#define ETH_MACA2H_SADDR ((uint32_t)0x40000000) /*!< Source address */
+
+#define ETH_MACA2H_MBCTRL ((uint32_t)0x3F000000) /*!< Mask byte control */
+#define ETH_MACA2H_MBCTRL_HBits15_8 ((uint32_t)0x20000000) /*!< Mask MAC Address high reg bits [15:8] */
+#define ETH_MACA2H_MBCTRL_HBits7_0 ((uint32_t)0x10000000) /*!< Mask MAC Address high reg bits [7:0] */
+#define ETH_MACA2H_MBCTRL_LBits31_24 ((uint32_t)0x08000000) /*!< Mask MAC Address low reg bits [31:24] */
+#define ETH_MACA2H_MBCTRL_LBits23_16 ((uint32_t)0x04000000) /*!< Mask MAC Address low reg bits [23:16] */
+#define ETH_MACA2H_MBCTRL_LBits15_8 ((uint32_t)0x02000000) /*!< Mask MAC Address low reg bits [15:8] */
+#define ETH_MACA2H_MBCTRL_LBits7_0 ((uint32_t)0x01000000) /*!< Mask MAC Address low reg bits [70] */
+
+#define ETH_MACA2H_MACADDR2H ((uint32_t)0x0000FFFF) /*!< MAC address1 high */
+
+/************** Bit definition for Ethernet MAC Address2 Low Register **************/
+#define ETH_MACA2L_MACADDR2L ((uint32_t)0xFFFFFFFF) /*!< MAC address2 low */
+
+/************** Bit definition for Ethernet MAC Address3 High Register *************/
+#define ETH_MACA3H_AEN ((uint32_t)0x80000000) /*!< Address enable */
+#define ETH_MACA3H_SADDR ((uint32_t)0x40000000) /*!< Source address */
+
+#define ETH_MACA3H_MBCTRL ((uint32_t)0x3F000000) /*!< Mask byte control */
+#define ETH_MACA3H_MBCTRL_HBits15_8 ((uint32_t)0x20000000) /*!< Mask MAC Address high reg bits [15:8] */
+#define ETH_MACA3H_MBCTRL_HBits7_0 ((uint32_t)0x10000000) /*!< Mask MAC Address high reg bits [7:0] */
+#define ETH_MACA3H_MBCTRL_LBits31_24 ((uint32_t)0x08000000) /*!< Mask MAC Address low reg bits [31:24] */
+#define ETH_MACA3H_MBCTRL_LBits23_16 ((uint32_t)0x04000000) /*!< Mask MAC Address low reg bits [23:16] */
+#define ETH_MACA3H_MBCTRL_LBits15_8 ((uint32_t)0x02000000) /*!< Mask MAC Address low reg bits [15:8] */
+#define ETH_MACA3H_MBCTRL_LBits7_0 ((uint32_t)0x01000000) /*!< Mask MAC Address low reg bits [70] */
+
+#define ETH_MACA3H_MACADDR3H ((uint32_t)0x0000FFFF) /*!< MAC address3 high */
+
+/************** Bit definition for Ethernet MAC Address3 Low Register **************/
+#define ETH_MACA3L_MACADDR3L ((uint32_t)0xFFFFFFFF) /*!< MAC address3 low */
+
+/******************************************************************************/
+/* */
+/* Ethernet MMC Registers bits definition */
+/* */
+/******************************************************************************/
+
+/***************** Bit definition for Ethernet MMC Contol Register *****************/
+#define ETH_MMCCTRL_MCNTF ((uint32_t)0x00000008) /*!< MMC Counter Freeze */
+#define ETH_MMCCTRL_RSTOR ((uint32_t)0x00000004) /*!< Reset on Read */
+#define ETH_MMCCTRL_CSR ((uint32_t)0x00000002) /*!< Counter Stop Rollover */
+#define ETH_MMCCTRL_CNTR ((uint32_t)0x00000001) /*!< Counters Reset */
+
+/*********** Bit definition for Ethernet MMC Receive Interrupt Register ************/
+#define ETH_MMCRI_RGUF ((uint32_t)0x00020000) /*!< Set when Rx good unicast frames counter reaches half the maximum value */
+#define ETH_MMCRI_RFAE ((uint32_t)0x00000040) /*!< Set when Rx alignment error counter reaches half the maximum value */
+#define ETH_MMCRI_RFCE ((uint32_t)0x00000020) /*!< Set when Rx crc error counter reaches half the maximum value */
+
+/*********** Bit definition for Ethernet MMC Transmit Interrupt Register ***********/
+#define ETH_MMCTI_TGF ((uint32_t)0x00200000) /*!< Set when Tx good frame count counter reaches half the maximum value */
+#define ETH_MMCTI_TGFMSC ((uint32_t)0x00008000) /*!< Set when Tx good multi col counter reaches half the maximum value */
+#define ETH_MMCTI_TGFSC ((uint32_t)0x00004000) /*!< Set when Tx good single col counter reaches half the maximum value */
+
+/********* Bit definition for Ethernet MMC Receive Interrupt Mask Register *********/
+#define ETH_MMCRIM_RGUFM ((uint32_t)0x00020000) /*!< Mask the interrupt when Rx good unicast frames counter reaches half the maximum value */
+#define ETH_MMCRIM_RFAEM ((uint32_t)0x00000040) /*!< Mask the interrupt when when Rx alignment error counter reaches half the maximum value */
+#define ETH_MMCRIM_RFCEM ((uint32_t)0x00000020) /*!< Mask the interrupt when Rx crc error counter reaches half the maximum value */
+
+/********* Bit definition for Ethernet MMC Transmit Interrupt Mask Register ********/
+#define ETH_MMCTIM_TGFM ((uint32_t)0x00200000) /*!< Mask the interrupt when Tx good frame count counter reaches half the maximum value */
+#define ETH_MMCTIM_TGFMSCM ((uint32_t)0x00008000) /*!< Mask the interrupt when Tx good multi col counter reaches half the maximum value */
+#define ETH_MMCTIM_TGFSCM ((uint32_t)0x00004000) /*!< Mask the interrupt when Tx good single col counter reaches half the maximum value */
+
+/** Bit definition for Ethernet MMC Transmitted Good Frames after Single Collision Counter Register */
+#define ETH_MMCTFSCC_TGFSCC ((uint32_t)0xFFFFFFFF) /*!< Number of successfully transmitted frames after a single collision in Half-duplex mode. */
+
+/** Bit definition for Ethernet MMC Transmitted Good Frames after More than a Single Collision Counter Register */
+#define ETH_MMCTFMSCC_TGFMSCC ((uint32_t)0xFFFFFFFF) /*!< Number of successfully transmitted frames after more than a single collision in Half-duplex mode. */
+
+/***** Bit definition for Ethernet MMC Transmitted Good Frames Counter Register ****/
+#define ETH_MMCTFCNT_TGFC ((uint32_t)0xFFFFFFFF) /*!< Number of good frames transmitted. */
+/** Bit definition for Ethernet MMC Received Frames with CRC Error Counter Register */
+#define ETH_MMCRFCECNT_RFCEC ((uint32_t)0xFFFFFFFF) /*!< Number of frames received with CRC error. */
+
+/** Bit definition for Ethernet MMC Received Frames with Alignement Error Counter Register */
+#define ETH_MMCRFAECNT_RFAEC ((uint32_t)0xFFFFFFFF) /*!< Number of frames received with alignment (dribble) error */
+
+/** Bit definition for Ethernet MMC Received Good Unicast Frames Counter Register */
+#define ETH_MMCRGUFCNT_RGUFC ((uint32_t)0xFFFFFFFF) /*!< Number of good unicast frames received. */
+
+/******************************************************************************/
+/* */
+/* Ethernet PTP Registers bits definition */
+/* */
+/******************************************************************************/
+
+/************ Bit definition for Ethernet PTP Time Stamp Contol Register ***********/
+#define ETH_PTPTSCTRL_TSARU ((uint32_t)0x00000020) /*!< Addend register update */
+#define ETH_PTPTSCTRL_TSITE ((uint32_t)0x00000010) /*!< Time stamp interrupt trigger enable */
+#define ETH_PTPTSCTRL_TSSTU ((uint32_t)0x00000008) /*!< Time stamp update */
+#define ETH_PTPTSCTRL_TSSTI ((uint32_t)0x00000004) /*!< Time stamp initialize */
+#define ETH_PTPTSCTRL_TSFCU ((uint32_t)0x00000002) /*!< Time stamp fine or coarse update */
+#define ETH_PTPTSCTRL_TSE ((uint32_t)0x00000001) /*!< Time stamp enable */
+
+/********** Bit definition for Ethernet PTP Sub-Second Increment Register **********/
+#define ETH_PTPSSINC_STSINC ((uint32_t)0x000000FF) /*!< System time Sub-second increment value */
+
+/************ Bit definition for Ethernet PTP Time Stamp High Register *************/
+#define ETH_PTPTSH_STS ((uint32_t)0xFFFFFFFF) /*!< System Time second */
+
+/************ Bit definition for Ethernet PTP Time Stamp Low Register **************/
+#define ETH_PTPTSL_STPNS ((uint32_t)0x80000000) /*!< System Time Positive or negative time */
+#define ETH_PTPTSL_STSS ((uint32_t)0x7FFFFFFF) /*!< System Time sub-seconds */
+
+/********* Bit definition for Ethernet PTP Time Stamp High Update Register *********/
+#define ETH_PTPTSHUD_TSUS ((uint32_t)0xFFFFFFFF) /*!< Time stamp update seconds */
+
+/********* Bit definition for Ethernet PTP Time Stamp Low Update Register **********/
+#define ETH_PTPTSLUD_TSUPNS ((uint32_t)0x80000000) /*!< Time stamp update Positive or negative time */
+#define ETH_PTPTSLUD_TSUSS ((uint32_t)0x7FFFFFFF) /*!< Time stamp update sub-seconds */
+
+/*********** Bit definition for Ethernet PTP Time Stamp Addend Register ************/
+#define ETH_PTPTSAD_TSA ((uint32_t)0xFFFFFFFF) /*!< Time stamp addend */
+
+/*********** Bit definition for Ethernet PTP Target Time High Register *************/
+#define ETH_PTPTTH_TTSH ((uint32_t)0xFFFFFFFF) /*!< Target time stamp high */
+
+/************ Bit definition for Ethernet PTP Target Time Low Register *************/
+#define ETH_PTPTTL_TTSL ((uint32_t)0xFFFFFFFF) /*!< Target time stamp low */
+
+/******************************************************************************/
+/* */
+/* Ethernet DMA Registers bits definition */
+/* */
+/******************************************************************************/
+
+/**************** Bit definition for Ethernet DMA Bus Mode Register ****************/
+#define ETH_DMABM_AAB ((uint32_t)0x02000000) /*!< Address-Aligned beats */
+#define ETH_DMABM_FPBLM ((uint32_t)0x01000000) /*!< 4xPBL mode */
+#define ETH_DMABM_USP ((uint32_t)0x00800000) /*!< Use separate PBL */
+
+#define ETH_DMABM_RDPBL ((uint32_t)0x007E0000) /*!< RxDMA PBL */
+#define ETH_DMABM_RDPBL_1Beat ((uint32_t)0x00020000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 1 */
+#define ETH_DMABM_RDPBL_2Beat ((uint32_t)0x00040000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 2 */
+#define ETH_DMABM_RDPBL_4Beat ((uint32_t)0x00080000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 4 */
+#define ETH_DMABM_RDPBL_8Beat ((uint32_t)0x00100000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 8 */
+#define ETH_DMABM_RDPBL_16Beat ((uint32_t)0x00200000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 16 */
+#define ETH_DMABM_RDPBL_32Beat ((uint32_t)0x00400000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 32 */
+#define ETH_DMABM_RDPBL_4xPBL_4Beat ((uint32_t)0x01020000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 4 */
+#define ETH_DMABM_RDPBL_4xPBL_8Beat ((uint32_t)0x01040000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 8 */
+#define ETH_DMABM_RDPBL_4xPBL_16Beat ((uint32_t)0x01080000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 16 */
+#define ETH_DMABM_RDPBL_4xPBL_32Beat ((uint32_t)0x01100000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 32 */
+#define ETH_DMABM_RDPBL_4xPBL_64Beat ((uint32_t)0x01200000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 64 */
+#define ETH_DMABM_RDPBL_4xPBL_128Beat ((uint32_t)0x01400000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 128 */
+
+#define ETH_DMABM_FB ((uint32_t)0x00010000) /*!< Fixed Burst */
+
+#define ETH_DMABM_RTPR ((uint32_t)0x0000C000) /*!< Rx Tx priority ratio */
+#define ETH_DMABM_RTPR_1_1 ((uint32_t)0x00000000) /*!< Rx Tx priority ratio */
+#define ETH_DMABM_RTPR_2_1 ((uint32_t)0x00004000) /*!< Rx Tx priority ratio */
+#define ETH_DMABM_RTPR_3_1 ((uint32_t)0x00008000) /*!< Rx Tx priority ratio */
+#define ETH_DMABM_RTPR_4_1 ((uint32_t)0x0000C000) /*!< Rx Tx priority ratio */
+
+#define ETH_DMABM_PBL ((uint32_t)0x00003F00) /*!< Programmable burst length */
+#define ETH_DMABM_PBL_1Beat ((uint32_t)0x00000100) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 1 */
+#define ETH_DMABM_PBL_2Beat ((uint32_t)0x00000200) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 2 */
+#define ETH_DMABM_PBL_4Beat ((uint32_t)0x00000400) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */
+#define ETH_DMABM_PBL_8Beat ((uint32_t)0x00000800) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */
+#define ETH_DMABM_PBL_16Beat ((uint32_t)0x00001000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */
+#define ETH_DMABM_PBL_32Beat ((uint32_t)0x00002000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */
+#define ETH_DMABM_PBL_4xPBL_4Beat ((uint32_t)0x01000100) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */
+#define ETH_DMABM_PBL_4xPBL_8Beat ((uint32_t)0x01000200) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */
+#define ETH_DMABM_PBL_4xPBL_16Beat ((uint32_t)0x01000400) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */
+#define ETH_DMABM_PBL_4xPBL_32Beat ((uint32_t)0x01000800) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */
+#define ETH_DMABM_PBL_4xPBL_64Beat ((uint32_t)0x01001000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 64 */
+#define ETH_DMABM_PBL_4xPBL_128Beat ((uint32_t)0x01002000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 128 */
+
+#define ETH_DMABM_DSL ((uint32_t)0x0000007C) /*!< Descriptor Skip Length */
+#define ETH_DMABM_DA ((uint32_t)0x00000002) /*!< DMA arbitration scheme */
+#define ETH_DMABM_SWRST ((uint32_t)0x00000001) /*!< Software reset */
+
+/********** Bit definition for Ethernet DMA Transmit Poll Demand Register **********/
+#define ETH_DMATPD_TPD ((uint32_t)0xFFFFFFFF) /*!< Transmit poll demand */
+
+/********** Bit definition for Ethernet DMA Receive Poll Demand Register ***********/
+#define ETH_DMARPD_RPD ((uint32_t)0xFFFFFFFF) /*!< Receive poll demand */
+
+/**** Bit definition for Ethernet DMA Receive Descriptor List Address Register *****/
+#define ETH_DMARDLADDR_SRL ((uint32_t)0xFFFFFFFF) /*!< Start of receive list */
+
+/**** Bit definition for Ethernet DMA Transmit Descriptor List Address Register ****/
+#define ETH_DMATDLADDR_STL ((uint32_t)0xFFFFFFFF) /*!< Start of transmit list */
+
+/***************** Bit definition for Ethernet DMA Status Register *****************/
+#define ETH_DMASTS_TST ((uint32_t)0x20000000) /*!< Time-stamp trigger status */
+#define ETH_DMASTS_PMT ((uint32_t)0x10000000) /*!< PMT status */
+#define ETH_DMASTS_MMC ((uint32_t)0x08000000) /*!< MMC status */
+
+#define ETH_DMASTS_EB ((uint32_t)0x03800000) /*!< Error bits status */
+#define ETH_DMASTS_EB_DescAccess ((uint32_t)0x02000000) /*!< Error bits 0-data buffer, 1-desc. access */
+#define ETH_DMASTS_EB_ReadTransf ((uint32_t)0x01000000) /*!< Error bits 0-write trnsf, 1-read transfr */
+#define ETH_DMASTS_EB_DataTransfTx ((uint32_t)0x00800000) /*!< Error bits 0-Rx DMA, 1-Tx DMA */
+
+#define ETH_DMASTS_TP ((uint32_t)0x00700000) /*!< Transmit process state */
+#define ETH_DMASTS_TP_Stopped ((uint32_t)0x00000000) /*!< Stopped - Reset or Stop Tx Command issued */
+#define ETH_DMASTS_TP_Fetching ((uint32_t)0x00100000) /*!< Running - fetching the Tx descriptor */
+#define ETH_DMASTS_TP_Waiting ((uint32_t)0x00200000) /*!< Running - waiting for status */
+#define ETH_DMASTS_TP_Reading ((uint32_t)0x00300000) /*!< Running - reading the data from host memory */
+#define ETH_DMASTS_TP_Suspended ((uint32_t)0x00600000) /*!< Suspended - Tx Descriptor unavailabe */
+#define ETH_DMASTS_TP_Closing ((uint32_t)0x00700000) /*!< Running - closing Rx descriptor */
+
+#define ETH_DMASTS_RP ((uint32_t)0x000E0000) /*!< Receive process state */
+#define ETH_DMASTS_RP_Stopped ((uint32_t)0x00000000) /*!< Stopped - Reset or Stop Rx Command issued */
+#define ETH_DMASTS_RP_Fetching ((uint32_t)0x00020000) /*!< Running - fetching the Rx descriptor */
+#define ETH_DMASTS_RP_Waiting ((uint32_t)0x00060000) /*!< Running - waiting for packet */
+#define ETH_DMASTS_RP_Suspended ((uint32_t)0x00080000) /*!< Suspended - Rx Descriptor unavailable */
+#define ETH_DMASTS_RP_Closing ((uint32_t)0x000A0000) /*!< Running - closing descriptor */
+#define ETH_DMASTS_RP_Queuing ((uint32_t)0x000E0000) /*!< Running - queuing the recieve frame into host memory */
+
+#define ETH_DMASTS_NIS ((uint32_t)0x00010000) /*!< Normal interrupt summary */
+#define ETH_DMASTS_AIS ((uint32_t)0x00008000) /*!< Abnormal interrupt summary */
+#define ETH_DMASTS_ER ((uint32_t)0x00004000) /*!< Early receive status */
+#define ETH_DMASTS_FBE ((uint32_t)0x00002000) /*!< Fatal bus error status */
+#define ETH_DMASTS_ET ((uint32_t)0x00000400) /*!< Early transmit status */
+#define ETH_DMASTS_RWT ((uint32_t)0x00000200) /*!< Receive watchdog timeout status */
+#define ETH_DMASTS_RPS ((uint32_t)0x00000100) /*!< Receive process stopped status */
+#define ETH_DMASTS_RBU ((uint32_t)0x00000080) /*!< Receive buffer unavailable status */
+#define ETH_DMASTS_RECV ((uint32_t)0x00000040) /*!< Receive status */
+#define ETH_DMASTS_TU ((uint32_t)0x00000020) /*!< Transmit underflow status */
+#define ETH_DMASTS_RO ((uint32_t)0x00000010) /*!< Receive overflow status */
+#define ETH_DMASTS_TJT ((uint32_t)0x00000008) /*!< Transmit jabber timeout status */
+#define ETH_DMASTS_TBU ((uint32_t)0x00000004) /*!< Transmit buffer unavailable status */
+#define ETH_DMASTS_TPS ((uint32_t)0x00000002) /*!< Transmit process stopped status */
+#define ETH_DMASTS_TX ((uint32_t)0x00000001) /*!< Transmit status */
+
+/************* Bit definition for Ethernet DMA Operation Mode Register *************/
+#define ETH_DMAOPM_DTCEFD ((uint32_t)0x04000000) /*!< Disable Dropping of TCP/IP checksum error frames */
+#define ETH_DMAOPM_RSFD ((uint32_t)0x02000000) /*!< Receive store and forward */
+#define ETH_DMAOPM_DFRFD ((uint32_t)0x01000000) /*!< Disable flushing of received frames */
+#define ETH_DMAOPM_TXSF ((uint32_t)0x00200000) /*!< Transmit store and forward */
+#define ETH_DMAOPM_FTXF ((uint32_t)0x00100000) /*!< Flush transmit FIFO */
+
+#define ETH_DMAOPM_TXTC ((uint32_t)0x0001C000) /*!< Transmit threshold control */
+#define ETH_DMAOPM_TXTC_64Bytes ((uint32_t)0x00000000) /*!< threshold level of the MTL Transmit FIFO is 64 Bytes */
+#define ETH_DMAOPM_TXTC_128Bytes ((uint32_t)0x00004000) /*!< threshold level of the MTL Transmit FIFO is 128 Bytes */
+#define ETH_DMAOPM_TXTC_192Bytes ((uint32_t)0x00008000) /*!< threshold level of the MTL Transmit FIFO is 192 Bytes */
+#define ETH_DMAOPM_TXTC_256Bytes ((uint32_t)0x0000C000) /*!< threshold level of the MTL Transmit FIFO is 256 Bytes */
+#define ETH_DMAOPM_TXTC_40Bytes ((uint32_t)0x00010000) /*!< threshold level of the MTL Transmit FIFO is 40 Bytes */
+#define ETH_DMAOPM_TXTC_32Bytes ((uint32_t)0x00014000) /*!< threshold level of the MTL Transmit FIFO is 32 Bytes */
+#define ETH_DMAOPM_TXTC_24Bytes ((uint32_t)0x00018000) /*!< threshold level of the MTL Transmit FIFO is 24 Bytes */
+#define ETH_DMAOPM_TXTC_16Bytes ((uint32_t)0x0001C000) /*!< threshold level of the MTL Transmit FIFO is 16 Bytes */
+
+#define ETH_DMAOPM_STXE ((uint32_t)0x00002000) /*!< Start/stop transmission command */
+#define ETH_DMAOPM_FEF ((uint32_t)0x00000080) /*!< Forward error frames */
+#define ETH_DMAOPM_FUGF ((uint32_t)0x00000040) /*!< Forward undersized good frames */
+
+#define ETH_DMAOPM_RXTC ((uint32_t)0x00000018) /*!< receive threshold control */
+#define ETH_DMAOPM_RXTC_64Bytes ((uint32_t)0x00000000) /*!< threshold level of the MTL Receive FIFO is 64 Bytes */
+#define ETH_DMAOPM_RXTC_32Bytes ((uint32_t)0x00000008) /*!< threshold level of the MTL Receive FIFO is 32 Bytes */
+#define ETH_DMAOPM_RXTC_96Bytes ((uint32_t)0x00000010) /*!< threshold level of the MTL Receive FIFO is 96 Bytes */
+#define ETH_DMAOPM_RXTC_128Bytes ((uint32_t)0x00000018) /*!< threshold level of the MTL Receive FIFO is 128 Bytes */
+
+#define ETH_DMAOPM_OPSF ((uint32_t)0x00000004) /*!< operate on second frame */
+#define ETH_DMAOPM_SRXE ((uint32_t)0x00000002) /*!< Start/stop receive */
+
+/************ Bit definition for Ethernet DMA Interrupt Enable Register ************/
+#define ETH_DMAIE_NISE ((uint32_t)0x00010000) /*!< Normal interrupt summary enable */
+#define ETH_DMAIE_AISE ((uint32_t)0x00008000) /*!< Abnormal interrupt summary enable */
+#define ETH_DMAIE_ERIE ((uint32_t)0x00004000) /*!< Early receive interrupt enable */
+#define ETH_DMAIE_FBEIE ((uint32_t)0x00002000) /*!< Fatal bus error interrupt enable */
+#define ETH_DMAIE_ETIE ((uint32_t)0x00000400) /*!< Early transmit interrupt enable */
+#define ETH_DMAIE_RXWTIE ((uint32_t)0x00000200) /*!< Receive watchdog timeout interrupt enable */
+#define ETH_DMAIE_RXPSIE ((uint32_t)0x00000100) /*!< Receive process stopped interrupt enable */
+#define ETH_DMAIE_RXBUIE ((uint32_t)0x00000080) /*!< Receive buffer unavailable interrupt enable */
+#define ETH_DMAIE_RXIE ((uint32_t)0x00000040) /*!< Receive interrupt enable */
+#define ETH_DMAIE_TUIE ((uint32_t)0x00000020) /*!< Transmit Underflow interrupt enable */
+#define ETH_DMAIE_ROIE ((uint32_t)0x00000010) /*!< Receive Overflow interrupt enable */
+#define ETH_DMAIE_TXJTIE ((uint32_t)0x00000008) /*!< Transmit jabber timeout interrupt enable */
+#define ETH_DMAIE_TXBUIE ((uint32_t)0x00000004) /*!< Transmit buffer unavailable interrupt enable */
+#define ETH_DMAIE_TXPSIE ((uint32_t)0x00000002) /*!< Transmit process stopped interrupt enable */
+#define ETH_DMAIE_TXIE ((uint32_t)0x00000001) /*!< Transmit interrupt enable */
+
+/** Bit definition for Ethernet DMA Missed Frame and Buffer Overflow Counter Register */
+#define ETH_DMAMFBOCNT_OFOC ((uint32_t)0x10000000) /*!< Overflow bit for FIFO overflow counter */
+#define ETH_DMAMFBOCNT_MFA ((uint32_t)0x0FFE0000) /*!< Number of frames missed by the application */
+#define ETH_DMAMFBOCNT_OMFC ((uint32_t)0x00010000) /*!< Overflow bit for missed frame counter */
+#define ETH_DMAMFBOCNT_MFC ((uint32_t)0x0000FFFF) /*!< Number of frames missed by the controller */
+
+/** Bit definition for Ethernet DMA Current Host Transmit Descriptor Register */
+#define ETH_DMACTD_HTDAP ((uint32_t)0xFFFFFFFF) /*!< Host transmit descriptor address pointer */
+
+/** Bit definition for Ethernet DMA Current Host Receive Descriptor Register */
+#define ETH_DMACRD_HRDAP ((uint32_t)0xFFFFFFFF) /*!< Host receive descriptor address pointer */
+
+/** Bit definition for Ethernet DMA Current Host Transmit Buffer Address Register */
+#define ETH_DMACTBADDR_HTBAP ((uint32_t)0xFFFFFFFF) /*!< Host transmit buffer address pointer */
+
+/** Bit definition for Ethernet DMA Current Host Receive Buffer Address Register */
+#define ETH_DMACRBADDR_HRBAP ((uint32_t)0xFFFFFFFF) /*!< Host receive buffer address pointer */
+#endif /* AT32F407xx */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#if defined (LIBRARY_VERSION) || defined (USE_STDPERIPH_DRIVER)
+#include "at32f4xx_conf.h"
+#endif
+
+/** @addtogroup Exported_macro
+ * @{
+ */
+
+#define BIT_SET(REG, BIT) ((REG) |= (BIT))
+
+#define BIT_CLEAR(REG, BIT) ((REG) &= ~(BIT))
+
+#define BIT_READ(REG, BIT) ((REG) & (BIT))
+
+#define REG_CLEAR(REG) ((REG) = (0x0))
+
+#define REG_WRITE(REG, VAL) ((REG) = (VAL))
+
+#define REG_READ(REG) ((REG))
+
+#define REG_CHANGE(REG, CLEARMASK, SETMASK) REG_WRITE((REG), (((REG_READ(REG)) & (~(CLEARMASK))) | (SETMASK)))
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AT32F4xx_H */
+
+/**
+ * @}
+ */
+
+/**
+* @}
+*/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/inc/at32f4xx_conf.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/inc/at32f4xx_conf.h
new file mode 100644
index 0000000000000000000000000000000000000000..e9583d96a773d6fb45fb49aa4252d3c5554df308
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/inc/at32f4xx_conf.h
@@ -0,0 +1,68 @@
+/**
+ **************************************************************************
+ * File Name : at32f4xx_conf.h
+ * Description : at32f4xx configuration file
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __AT32F4xx_CONF_H
+#define __AT32F4xx_CONF_H
+
+/* Includes ------------------------------------------------------------------*/
+/* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */
+#include "at32f4xx_acc.h"
+#include "at32f4xx_adc.h"
+#include "at32f4xx_bkp.h"
+#include "at32f4xx_can.h"
+#include "at32f4xx_comp.h"
+#include "at32f4xx_crc.h"
+#include "at32f4xx_dac.h"
+#include "at32f4xx_dbgmcu.h"
+#include "at32f4xx_dma.h"
+#include "at32f4xx_ertc.h"
+#include "at32f4xx_exti.h"
+#include "at32f4xx_flash.h"
+#include "at32f4xx_gpio.h"
+#include "at32f4xx_i2c.h"
+#include "at32f4xx_iwdg.h"
+#include "at32f4xx_pwr.h"
+#include "at32f4xx_rcc.h"
+#include "at32f4xx_rtc.h"
+#include "at32f4xx_sdio.h"
+#include "at32f4xx_spi.h"
+#include "at32f4xx_tim.h"
+#include "at32f4xx_usart.h"
+#include "at32f4xx_wwdg.h"
+#include "at32f4xx_xmc.h"
+#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+/* Uncomment the line below to expanse the "assert_param" macro in the
+ Standard Peripheral Library drivers code */
+/* #define USE_FULL_ASSERT 1 */
+
+/* Exported macro ------------------------------------------------------------*/
+#ifdef USE_FULL_ASSERT
+
+/**
+ * @brief The assert_param macro is used for function's parameters check.
+ * @param expr: If expr is false, it calls assert_failed function which reports
+ * the name of the source file and the source line number of the call
+ * that failed. If expr is true, it returns no value.
+ * @retval None
+ */
+#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+void assert_failed(uint8_t* file, uint32_t line);
+#else
+#define assert_param(expr) ((void)0)
+#endif /* USE_FULL_ASSERT */
+
+#endif /* __AT32F4xx_CONF_H */
+
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/inc/system_at32f4xx.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/inc/system_at32f4xx.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9d0f29b623bf4d9e807dc0a16f1345e525dd78f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/inc/system_at32f4xx.h
@@ -0,0 +1,88 @@
+/**
+ **************************************************************************
+ * File Name : system_at32f4xx.h
+ * Description : CMSIS Cortex-M4 system header file.
+ * Date : 2018-02-26
+ * Version : V1.0.4
+ **************************************************************************
+ */
+
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup at32f4xx_system
+ * @{
+ */
+
+/**
+ * @brief Define to prevent recursive inclusion
+ */
+#ifndef __SYSTEM_AT32F4xx_H
+#define __SYSTEM_AT32F4xx_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup AT32F4xx_System_Includes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+
+/** @addtogroup AT32F4xx_System_Exported_types
+ * @{
+ */
+
+extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
+
+/**
+ * @}
+ */
+
+/** @addtogroup AT32F4xx_System_Exported_Constants
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup AT32F4xx_System_Exported_Macros
+ * @{
+ */
+#define HSE_STABLE_DELAY (5000u)
+#define PLL_STABLE_DELAY (500u)
+/**
+ * @}
+ */
+
+/** @addtogroup AT32F4xx_System_Exported_Functions
+ * @{
+ */
+
+extern void SystemInit(void);
+extern void SystemCoreClockUpdate(void);
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__SYSTEM_AT32F4xx_H */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403AxC_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403AxC_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..6c5f76dd2ff9ef4cdb7a468060695fc091dc08bf
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403AxC_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F403AxC_FLASH.ld
+**
+** Abstract : Linker script for AT32F403xC Device with
+** 256KByte FLASH, 96KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20017FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403AxE_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403AxE_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..f2ab8b57c96f477648779440599167f604273083
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403AxE_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F403AxE_FLASH.ld
+**
+** Abstract : Linker script for AT32F403AxE Device with
+** 512KByte FLASH, 96KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20017FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403AxG_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403AxG_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..953604a70740cbf87557c363776f60c583261601
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403AxG_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F403AxG_FLASH.ld
+**
+** Abstract : Linker script for AT32F403xG Device with
+** 1000KByte FLASH, 96KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20017FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1000K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xB_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xB_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..86685fed6b2d2c8a5a9197da63c304843841501d
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xB_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F403xB_FLASH.ld
+**
+** Abstract : Linker script for AT32F403xB Device with
+** 128KByte FLASH, 32KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20007FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xC_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xC_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..5fbe9e3b17280321a55314ca818e86f8a90dbda8
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xC_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F403xC_FLASH.ld
+**
+** Abstract : Linker script for AT32F403xC Device with
+** 256KByte FLASH, 96KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20017FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xE_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xE_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..2e43d1e70d378b2958f1ab4c3f8364d03ca85bbf
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xE_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F403xE_FLASH.ld
+**
+** Abstract : Linker script for AT32F403xE Device with
+** 512KByte FLASH, 96KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20017FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xG_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xG_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..9dcd181454df178c9706f997c803bce6f76bdc39
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F403xG_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F403xG_FLASH.ld
+**
+** Abstract : Linker script for AT32F403xG Device with
+** 1000KByte FLASH, 96KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20017FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1000K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F407xC_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F407xC_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..0f5b4498920df3a5c7130ff93ed7be49af635c7f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F407xC_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F407xC_FLASH.ld
+**
+** Abstract : Linker script for AT32F403xC Device with
+** 256KByte FLASH, 96KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20017FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F407xE_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F407xE_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..28c6a63091c4340547f63ae48b905fb3c5ee0862
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F407xE_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F407xE_FLASH.ld
+**
+** Abstract : Linker script for AT32F407xE Device with
+** 512KByte FLASH, 96KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20017FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F407xG_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F407xG_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..81320aeee022cb6d440f8cb26aa4584b302ca6d0
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F407xG_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F407xG_FLASH.ld
+**
+** Abstract : Linker script for AT32F403xG Device with
+** 1000KByte FLASH, 96KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20017FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1000K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F413x8_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F413x8_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..ab7aada63ffc4dea39ffc747ff86ddf6ccc5ce26
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F413x8_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F413x8_FLASH.ld
+**
+** Abstract : Linker script for AT32F413x8 Device with
+** 64KByte FLASH, 32KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20007FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F413xB_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F413xB_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..165740265136300950a00deb9f7768caea489a76
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F413xB_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F413xB_FLASH.ld
+**
+** Abstract : Linker script for AT32F413xB Device with
+** 128KByte FLASH, 32KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20007FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F413xC_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F413xC_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..80be72a7f4463a7c180c1705252b6c8b505142db
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F413xC_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F413xC_FLASH.ld
+**
+** Abstract : Linker script for AT32F413xC Device with
+** 256KByte FLASH, 32KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20007FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F415x8_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F415x8_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..b8fc180923c5fcbe82eba9614f2aaaa4728cb32f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F415x8_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F415x8_FLASH.ld
+**
+** Abstract : Linker script for AT32F415x8 Device with
+** 64KByte FLASH, 32KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20007FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F415xB_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F415xB_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..0daef6fb097e9678a19402d0390e2943920ffede
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F415xB_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F415xB_FLASH.ld
+**
+** Abstract : Linker script for AT32F415xB Device with
+** 128KByte FLASH, 32KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20007FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F415xC_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F415xC_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..903419bb3e9c7aca0c62ea451dbea5e927c871b5
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/AT32F415xC_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : AT32F415xC_FLASH.ld
+**
+** Abstract : Linker script for AT32F415xC Device with
+** 256KByte FLASH, 32KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek AT32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20007FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/TS32F401xB_FLASH.ld b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/TS32F401xB_FLASH.ld
new file mode 100644
index 0000000000000000000000000000000000000000..60c487c3f4f47797d9734e966377e4b356cc6bac
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/linker/TS32F401xB_FLASH.ld
@@ -0,0 +1,154 @@
+/*
+*****************************************************************************
+**
+** File : TS32F401xB_FLASH.ld
+**
+** Abstract : Linker script for TS32F401xB Device with
+** 128KByte FLASH, 32KByte RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used.
+**
+** Target : Artery Tek TS32
+**
+** Environment : Arm gcc toolchain
+**
+*****************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = 0x20007FFF; /* end of RAM */
+
+/* Generate a link error if heap and stack don't fit into RAM */
+_Min_Heap_Size = 0x200; /* required amount of heap */
+_Min_Stack_Size = 0x400; /* required amount of stack */
+
+/* Specify the memory areas */
+MEMORY
+{
+FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+/* Define output sections */
+SECTIONS
+{
+ /* The startup code goes first into FLASH */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data goes into FLASH */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } >FLASH
+
+ .preinit_array :
+ {
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ } >FLASH
+ .init_array :
+ {
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ } >FLASH
+ .fini_array :
+ {
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ } >FLASH
+
+ /* used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough RAM left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(4);
+ } >RAM
+
+ /* Remove information from the standard libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..cb80c7e203bb4f2e38e0d82f3f0c7ff4d0cca0c3
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acct7.s
@@ -0,0 +1,464 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403acct7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word 0 /* Reserved */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403accu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403accu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..9d52badd6afbb42fff188dc4ba0abb43690bf19e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403accu7.s
@@ -0,0 +1,464 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403accu7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word 0 /* Reserved */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acet7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acet7.s
new file mode 100644
index 0000000000000000000000000000000000000000..b22bbecdb2997fc0b5277ea5caca31443ac888bd
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acet7.s
@@ -0,0 +1,464 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403acet7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word 0 /* Reserved */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403aceu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403aceu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..3cc8c7428bf2673432c8fbbd4029c88b61ebda87
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403aceu7.s
@@ -0,0 +1,464 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403aceu7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word 0 /* Reserved */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..0ccf1465de920cdfb6ede2ceca1c968baf1943d3
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acgt7.s
@@ -0,0 +1,464 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403acgt7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word 0 /* Reserved */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acgu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acgu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..7a020031b50ee40f86e9675a50f3a501caf17efb
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403acgu7.s
@@ -0,0 +1,464 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403acgu7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word 0 /* Reserved */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403arct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403arct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..2fbac90ffe8a8d45d864dda0c38521016dfc2380
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403arct7.s
@@ -0,0 +1,473 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403arct7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403aret7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403aret7.s
new file mode 100644
index 0000000000000000000000000000000000000000..2fcda5a199b65571eea33aa1881fb675830576d0
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403aret7.s
@@ -0,0 +1,473 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403aret7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403argt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403argt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..276127480eb762f68cb3dd0c015680645582803d
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403argt7.s
@@ -0,0 +1,473 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403argt7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403avct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403avct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..87d8d9677e69e6f56c008723e7440a2b78b9ae9f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403avct7.s
@@ -0,0 +1,473 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403avct7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403avet7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403avet7.s
new file mode 100644
index 0000000000000000000000000000000000000000..1e844536caabac9850ca3bf13da61b359f50feb9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403avet7.s
@@ -0,0 +1,473 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403avet7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403avgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403avgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..9579af8d9bceec86fa5533e0d4ce1009eaee1a02
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403avgt7.s
@@ -0,0 +1,473 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403avgt7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403cx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403cx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..25698657d1bb1dfe488b33557d6c07060ef78d8e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403cx_hd.s
@@ -0,0 +1,409 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403cx_hd.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_IRQHandler /* SPI3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_IRQHandler
+ .thumb_set SPI3_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403cx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403cx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..54f81f37ded52573d93cb58567f971e97c16dbf1
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403cx_md.s
@@ -0,0 +1,409 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403cx_md.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_IRQHandler /* SPI3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_IRQHandler
+ .thumb_set SPI3_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403cx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403cx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..0a84d4ebb8c81456c119df120fcfa54e4b5a3447
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403cx_xl.s
@@ -0,0 +1,409 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403cx_xl.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_IRQHandler /* SPI3 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_IRQHandler
+ .thumb_set SPI3_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403rx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403rx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..cc6d9c5510666e52fa9a8f4c19093058693e5a95
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403rx_hd.s
@@ -0,0 +1,418 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403rx_hd.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_IRQHandler /* SPI3 */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_IRQHandler
+ .thumb_set SPI3_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403rx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403rx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..658c16f1c92ea8b2c24cc2cb7ca6a4bfa1e31a4f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403rx_xl.s
@@ -0,0 +1,418 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403rx_xl.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word 0 /* Reserved */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_IRQHandler /* SPI3 */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_IRQHandler
+ .thumb_set SPI3_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403vx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403vx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..4078929e497103b761cb35d6e739c1159fe08e4a
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403vx_hd.s
@@ -0,0 +1,425 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403vx_hd.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_IRQHandler /* SPI3 */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_IRQHandler
+ .thumb_set SPI3_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403vx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403vx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..782967c13645d2baf4a01a55f3c6b4bfc9fc50c7
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403vx_xl.s
@@ -0,0 +1,425 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403vx_xl.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_IRQHandler /* SPI3 */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_IRQHandler
+ .thumb_set SPI3_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403zx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403zx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..49baca4b772422f1c6010c58b4f4a4a4b6e276ae
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403zx_hd.s
@@ -0,0 +1,441 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403zx_hd.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_IRQHandler /* SPI3 */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word TMR15_BRK_IRQHandler /* TMR15 Break */
+ .word TMR15_OV_IRQHandler /* TMR15 Update */
+ .word TMR15_TRG_HALL_IRQHandler /* TMR15 Trigger and Commutation */
+ .word TMR15_CC_IRQHandler /* TMR15 Capture Compare */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_IRQHandler
+ .thumb_set SPI3_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak TMR15_BRK_IRQHandler
+ .thumb_set TMR15_BRK_IRQHandler,Default_Handler
+
+ .weak TMR15_OV_IRQHandler
+ .thumb_set TMR15_OV_IRQHandler,Default_Handler
+
+ .weak TMR15_TRG_HALL_IRQHandler
+ .thumb_set TMR15_TRG_HALL_IRQHandler,Default_Handler
+
+ .weak TMR15_CC_IRQHandler
+ .thumb_set TMR15_CC_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403zx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403zx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..8e7880b1f9c2aa0f510d1385a66b308b8dfbece1
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403zx_xl.s
@@ -0,0 +1,441 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f403zx_xl.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_IRQHandler /* SPI3 */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word TMR15_BRK_IRQHandler /* TMR15 Break */
+ .word TMR15_OV_IRQHandler /* TMR15 Update */
+ .word TMR15_TRG_HALL_IRQHandler /* TMR15 Trigger and Commutation */
+ .word TMR15_CC_IRQHandler /* TMR15 Capture Compare */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_IRQHandler
+ .thumb_set SPI3_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak TMR15_BRK_IRQHandler
+ .thumb_set TMR15_BRK_IRQHandler,Default_Handler
+
+ .weak TMR15_OV_IRQHandler
+ .thumb_set TMR15_OV_IRQHandler,Default_Handler
+
+ .weak TMR15_TRG_HALL_IRQHandler
+ .thumb_set TMR15_TRG_HALL_IRQHandler,Default_Handler
+
+ .weak TMR15_CC_IRQHandler
+ .thumb_set TMR15_CC_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407rct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407rct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..5a6cdf4f164e4def695b04aa28d9326c9fc178e9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407rct7.s
@@ -0,0 +1,481 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f407rct7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+ .word ETH_IRQHandler /* ETH */
+ .word ETH_WKUP_IRQHandler /* ETH Wakeup */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+ .weak ETH_IRQHandler
+ .thumb_set ETH_IRQHandler,Default_Handler
+
+ .weak ETH_WKUP_IRQHandler
+ .thumb_set ETH_WKUP_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407ret7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407ret7.s
new file mode 100644
index 0000000000000000000000000000000000000000..0e0e4a77edddd96df0d06d4e85440b81e3351c78
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407ret7.s
@@ -0,0 +1,481 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f407ret7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+ .word ETH_IRQHandler /* ETH */
+ .word ETH_WKUP_IRQHandler /* ETH Wakeup */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+ .weak ETH_IRQHandler
+ .thumb_set ETH_IRQHandler,Default_Handler
+
+ .weak ETH_WKUP_IRQHandler
+ .thumb_set ETH_WKUP_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407rgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407rgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..df003b58a9d6c6a9ff8f0cec4c9a16e5b88beea3
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407rgt7.s
@@ -0,0 +1,481 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f407rgt7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+ .word ETH_IRQHandler /* ETH */
+ .word ETH_WKUP_IRQHandler /* ETH Wakeup */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+ .weak ETH_IRQHandler
+ .thumb_set ETH_IRQHandler,Default_Handler
+
+ .weak ETH_WKUP_IRQHandler
+ .thumb_set ETH_WKUP_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407vct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407vct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..668f4c4e2a655e1b568cd0653e8cdad7bc95051b
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407vct7.s
@@ -0,0 +1,481 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f407vct7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+ .word ETH_IRQHandler /* ETH */
+ .word ETH_WKUP_IRQHandler /* ETH Wakeup */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+ .weak ETH_IRQHandler
+ .thumb_set ETH_IRQHandler,Default_Handler
+
+ .weak ETH_WKUP_IRQHandler
+ .thumb_set ETH_WKUP_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407vet7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407vet7.s
new file mode 100644
index 0000000000000000000000000000000000000000..b8b1cf1f1238807628af3bd8a22dfe34fb11a061
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407vet7.s
@@ -0,0 +1,481 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f407vet7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+ .word ETH_IRQHandler /* ETH */
+ .word ETH_WKUP_IRQHandler /* ETH Wakeup */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+ .weak ETH_IRQHandler
+ .thumb_set ETH_IRQHandler,Default_Handler
+
+ .weak ETH_WKUP_IRQHandler
+ .thumb_set ETH_WKUP_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407vgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407vgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..dea8bf20a62a205bd428dcb9d9ee3ca4c63c6125
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f407vgt7.s
@@ -0,0 +1,481 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f407vgt7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-12
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_COM_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_I2S2EXT_IRQHandler /* SPI2 & I2S2EXT */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_COM_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word ADC3_IRQHandler /* ADC3 */
+ .word XMC_IRQHandler /* XMC */
+ .word SDIO1_IRQHandler /* SDIO1 */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word SPI3_I2S3EXT_IRQHandler /* SPI3 & I2S3EXT */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word TMR6_GLOBAL_IRQHandler /* TMR6 */
+ .word TMR7_GLOBAL_IRQHandler /* TMR7 */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word SDIO2_IRQHandler /* SDIO2 */
+ .word I2C3_EV_IRQHandler /* I2C3 Event */
+ .word I2C3_ER_IRQHandler /* I2C3 Error */
+ .word SPI4_IRQHandler /* SPI4 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB HP */
+ .word USB_LP_IRQHandler /* USB LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+ .word USART6_IRQHandler /* USART6 */
+ .word UART7_IRQHandler /* UART7 */
+ .word UART8_IRQHandler /* UART8 */
+ .word ETH_IRQHandler /* ETH */
+ .word ETH_WKUP_IRQHandler /* ETH Wakeup */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_COM_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_COM_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_I2S2EXT_IRQHandler
+ .thumb_set SPI2_I2S2EXT_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_COM_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_COM_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak ADC3_IRQHandler
+ .thumb_set ADC3_IRQHandler,Default_Handler
+
+ .weak XMC_IRQHandler
+ .thumb_set XMC_IRQHandler,Default_Handler
+
+ .weak SDIO1_IRQHandler
+ .thumb_set SDIO1_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak SPI3_I2S3EXT_IRQHandler
+ .thumb_set SPI3_I2S3EXT_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak TMR6_GLOBAL_IRQHandler
+ .thumb_set TMR6_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR7_GLOBAL_IRQHandler
+ .thumb_set TMR7_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak SDIO2_IRQHandler
+ .thumb_set SDIO2_IRQHandler,Default_Handler
+
+ .weak I2C3_EV_IRQHandler
+ .thumb_set I2C3_EV_IRQHandler,Default_Handler
+
+ .weak I2C3_ER_IRQHandler
+ .thumb_set I2C3_ER_IRQHandler,Default_Handler
+
+ .weak SPI4_IRQHandler
+ .thumb_set SPI4_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler ,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler ,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+ .weak USART6_IRQHandler
+ .thumb_set USART6_IRQHandler,Default_Handler
+
+ .weak UART7_IRQHandler
+ .thumb_set UART7_IRQHandler,Default_Handler
+
+ .weak UART8_IRQHandler
+ .thumb_set UART8_IRQHandler,Default_Handler
+
+ .weak ETH_IRQHandler
+ .thumb_set ETH_IRQHandler,Default_Handler
+
+ .weak ETH_WKUP_IRQHandler
+ .thumb_set ETH_WKUP_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413cx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413cx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..026563af237f69fda874f1c220dd1ac8d1b4bb81
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413cx_hd.s
@@ -0,0 +1,428 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f413cx_hd.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB_HP */
+ .word USB_LP_IRQHandler /* USB_LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413cx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413cx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..7c2859905f24eca44f251f4972ebfcc6b91a4f49
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413cx_md.s
@@ -0,0 +1,416 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f413cx_md.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB_HP */
+ .word USB_LP_IRQHandler /* USB_LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413kx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413kx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..bf12fcf5cedd5f4cda59c85099b062fea599e8c1
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413kx_hd.s
@@ -0,0 +1,413 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f413kx_hd.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word 0 /* Reserved */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB_HP */
+ .word USB_LP_IRQHandler /* USB_LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413kx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413kx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..84491b49a55d23fc242953aeb1acef901b80a1c9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413kx_md.s
@@ -0,0 +1,413 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f413kx_md.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word 0 /* Reserved */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB_HP */
+ .word USB_LP_IRQHandler /* USB_LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413rx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413rx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..79831c9fea8da781bcee5235c7c0653d56c7b550
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413rx_hd.s
@@ -0,0 +1,434 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f413rx_hd.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word TMR8_BRK_TMR12_IRQHandler /* TMR8 Break and TMR12 */
+ .word TMR8_OV_TMR13_IRQHandler /* TMR8 Update and TMR13 */
+ .word TMR8_TRG_HALL_TMR14_IRQHandler /* TMR8 Trigger and Commutation and TMR14 */
+ .word TMR8_CC_IRQHandler /* TMR8 Capture Compare */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB_HP */
+ .word USB_LP_IRQHandler /* USB_LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak TMR8_BRK_TMR12_IRQHandler
+ .thumb_set TMR8_BRK_TMR12_IRQHandler,Default_Handler
+
+ .weak TMR8_OV_TMR13_IRQHandler
+ .thumb_set TMR8_OV_TMR13_IRQHandler,Default_Handler
+
+ .weak TMR8_TRG_HALL_TMR14_IRQHandler
+ .thumb_set TMR8_TRG_HALL_TMR14_IRQHandler,Default_Handler
+
+ .weak TMR8_CC_IRQHandler
+ .thumb_set TMR8_CC_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413rx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413rx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..578a3470bcdc8a9e14d82fe4050e28b80f47eadf
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f413rx_md.s
@@ -0,0 +1,422 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f413rx_md.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB_HP */
+ .word USB_LP_IRQHandler /* USB_LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415c8t7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415c8t7.s
new file mode 100644
index 0000000000000000000000000000000000000000..1715d0a03c63bbc5a687b6f34553be1bd7034d57
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415c8t7.s
@@ -0,0 +1,407 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415c8t7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415cbt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415cbt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..052207a2eb0cac76fe6d1e3109f4ad63eb43a702
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415cbt7.s
@@ -0,0 +1,407 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415cbt7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415cbu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415cbu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..8bc66cb4cb83a2515b9299c55626085e4d6a606f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415cbu7.s
@@ -0,0 +1,407 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415cbu7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-08
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415cct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415cct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..a12728f9abaab5026eec7901a6efaeea619113c0
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415cct7.s
@@ -0,0 +1,407 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415cct7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415ccu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415ccu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..139f975e96a5fbfdd9c5d17058d57f943bc97b0e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415ccu7.s
@@ -0,0 +1,407 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415ccu7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-10-08
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415k8u7-4.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415k8u7-4.s
new file mode 100644
index 0000000000000000000000000000000000000000..3cb9a0bb2f303f767267420dc4fce1050a4dc609
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415k8u7-4.s
@@ -0,0 +1,404 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415k8u7-4.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word 0 /* Reserved */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415kbu7-4.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415kbu7-4.s
new file mode 100644
index 0000000000000000000000000000000000000000..447cd7774534e1503a0abaf5a4fce0ca168e6983
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415kbu7-4.s
@@ -0,0 +1,404 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415kbu7-4.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word 0 /* Reserved */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415kcu7-4.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415kcu7-4.s
new file mode 100644
index 0000000000000000000000000000000000000000..1025a9871a23dd4352248a9ec21478f40efbe95e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415kcu7-4.s
@@ -0,0 +1,404 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415kcu7-4.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word 0 /* Reserved */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415r8t7-7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415r8t7-7.s
new file mode 100644
index 0000000000000000000000000000000000000000..4e7769b5dbba9057f38587922c2d8a6afb82d353
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415r8t7-7.s
@@ -0,0 +1,413 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415r8t7-7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415r8t7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415r8t7.s
new file mode 100644
index 0000000000000000000000000000000000000000..c1d34ca134213284f9f3c2b8fd42d72433290553
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415r8t7.s
@@ -0,0 +1,413 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415r8t7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rbt7-7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rbt7-7.s
new file mode 100644
index 0000000000000000000000000000000000000000..69239665f1500e050376b0ff8a9ca7e444770225
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rbt7-7.s
@@ -0,0 +1,413 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415rbt7-7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rbt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rbt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..32bdc1ef0d1171683c987d77fa4163241196a16c
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rbt7.s
@@ -0,0 +1,413 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415rbt7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rct7-7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rct7-7.s
new file mode 100644
index 0000000000000000000000000000000000000000..9363872ac8366c74d0171dc269dad43756ada68f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rct7-7.s
@@ -0,0 +1,413 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415rct7-7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..ae66d54f9644632987f5443a37ce3beda9556425
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f415rct7.s
@@ -0,0 +1,413 @@
+/**
+ ******************************************************************************
+ * @file startup_at32f415rct7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2019-08-15
+ * @brief AT32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
+ .word ERTC_WKUP_IRQHandler /* ERTC Wakeup through the EXTI line */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word CAN1_TX_IRQHandler /* CAN1 TX */
+ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word ERTCAlarm_IRQHandler /* ERTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word UART4_IRQHandler /* UART4 */
+ .word UART5_IRQHandler /* UART5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USBOTG_IRQHandler /* USBOTG */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word COMP1_IRQHandler /* COMP1 */
+ .word COMP2_IRQHandler /* COMP2 */
+ .word ACC_IRQHandler /* ACC */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMP_STAMP_IRQHandler
+ .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
+
+ .weak ERTC_WKUP_IRQHandler
+ .thumb_set ERTC_WKUP_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak CAN1_TX_IRQHandler
+ .thumb_set CAN1_TX_IRQHandler,Default_Handler
+
+ .weak CAN1_RX0_IRQHandler
+ .thumb_set CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak ERTCAlarm_IRQHandler
+ .thumb_set ERTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak UART4_IRQHandler
+ .thumb_set UART4_IRQHandler,Default_Handler
+
+ .weak UART5_IRQHandler
+ .thumb_set UART5_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak USBOTG_IRQHandler
+ .thumb_set USBOTG_IRQHandler,Default_Handler
+
+ .weak COMP1_IRQHandler
+ .thumb_set COMP1_IRQHandler,Default_Handler
+
+ .weak COMP2_IRQHandler
+ .thumb_set COMP2_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_ts32f401cbu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_ts32f401cbu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..8cc6ef3543e2ad51e5d0b342d75832e1d65c08a1
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_ts32f401cbu7.s
@@ -0,0 +1,416 @@
+/**
+ ******************************************************************************
+ * @file startup_ts32f401cbu7.s
+ * @author Artery Tek
+ * @version V1.0.0
+ * @date 2020-02-25
+ * @brief TS32F4xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Configure the clock system and the external SRAM to
+ * be used as data memory (optional, to be enabled by user)
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M4 processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m4
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
+
+/**
+ * @brief This is the code that gets called when the processor first
+ * starts execution following a reset event. Only the absolutely
+ * necessary set is performed, after which the application
+ * supplied main() routine is called.
+ * @param None
+ * @retval None
+*/
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+
+/* Copy the data segment initializers from flash to SRAM */
+ movs r1, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r3, =_sidata
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+
+LoopCopyDataInit:
+ ldr r0, =_sdata
+ ldr r3, =_edata
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc CopyDataInit
+ ldr r2, =_sbss
+ b LoopFillZerobss
+/* Zero fill the bss segment. */
+FillZerobss:
+ movs r3, #0
+ str r3, [r2], #4
+
+LoopFillZerobss:
+ ldr r3, = _ebss
+ cmp r2, r3
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call the application's entry point.*/
+ bl entry
+ bx lr
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ * @param None
+ * @retval None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M3. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+*******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word MemManage_Handler
+ .word BusFault_Handler
+ .word UsageFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word DebugMon_Handler
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+
+ /* External Interrupts */
+ .word WWDG_IRQHandler /* Window Watchdog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detect */
+ .word TAMPER_IRQHandler /* Tamper */
+ .word RTC_IRQHandler /* RTC */
+ .word FLASH_IRQHandler /* Flash */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_IRQHandler /* EXTI Line 0 */
+ .word EXTI1_IRQHandler /* EXTI Line 1 */
+ .word EXTI2_IRQHandler /* EXTI Line 2 */
+ .word EXTI3_IRQHandler /* EXTI Line 3 */
+ .word EXTI4_IRQHandler /* EXTI Line 4 */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_IRQHandler /* DMA1 Channel 2 */
+ .word DMA1_Channel3_IRQHandler /* DMA1 Channel 3 */
+ .word DMA1_Channel4_IRQHandler /* DMA1 Channel 4 */
+ .word DMA1_Channel5_IRQHandler /* DMA1 Channel 5 */
+ .word DMA1_Channel6_IRQHandler /* DMA1 Channel 6 */
+ .word DMA1_Channel7_IRQHandler /* DMA1 Channel 7 */
+ .word ADC1_2_IRQHandler /* ADC1 & ADC2 */
+ .word USB_HP_CAN1_TX_IRQHandler /* USB High Priority or CAN1 TX */
+ .word USB_LP_CAN1_RX0_IRQHandler /* USB Low Priority or CAN1 RX0 */
+ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
+ .word CAN1_SCE_IRQHandler /* CAN1 SCE */
+ .word EXTI9_5_IRQHandler /* EXTI Line [9:5] */
+ .word TMR1_BRK_TMR9_IRQHandler /* TMR1 Break and TMR9 */
+ .word TMR1_OV_TMR10_IRQHandler /* TMR1 Update and TMR10 */
+ .word TMR1_TRG_HALL_TMR11_IRQHandler /* TMR1 Trigger and Commutation and TMR11 */
+ .word TMR1_CC_IRQHandler /* TMR1 Capture Compare */
+ .word TMR2_GLOBAL_IRQHandler /* TMR2 */
+ .word TMR3_GLOBAL_IRQHandler /* TMR3 */
+ .word TMR4_GLOBAL_IRQHandler /* TMR4 */
+ .word I2C1_EV_IRQHandler /* I2C1 Event */
+ .word I2C1_ER_IRQHandler /* I2C1 Error */
+ .word I2C2_EV_IRQHandler /* I2C2 Event */
+ .word I2C2_ER_IRQHandler /* I2C2 Error */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word SPI2_IRQHandler /* SPI2 */
+ .word USART1_IRQHandler /* USART1 */
+ .word USART2_IRQHandler /* USART2 */
+ .word USART3_IRQHandler /* USART3 */
+ .word EXTI15_10_IRQHandler /* EXTI Line [15:10] */
+ .word RTCAlarm_IRQHandler /* RTC Alarm through EXTI Line */
+ .word USBWakeUp_IRQHandler /* USB Wakeup from suspend */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word SDIO_IRQHandler /* SDIO */
+ .word TMR5_GLOBAL_IRQHandler /* TMR5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word DMA2_Channel1_IRQHandler /* DMA2 Channel1 */
+ .word DMA2_Channel2_IRQHandler /* DMA2 Channel2 */
+ .word DMA2_Channel3_IRQHandler /* DMA2 Channel3 */
+ .word DMA2_Channel4_5_IRQHandler /* DMA2 Channel4 & Channel5 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word CAN2_TX_IRQHandler /* CAN2 TX */
+ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
+ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
+ .word CAN2_SCE_IRQHandler /* CAN2 SCE */
+ .word ACC_IRQHandler /* ACC */
+ .word USB_HP_IRQHandler /* USB_HP */
+ .word USB_LP_IRQHandler /* USB_LP */
+ .word DMA2_Channel6_7_IRQHandler /* DMA2 Channel6 & Channel7 */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak MemManage_Handler
+ .thumb_set MemManage_Handler,Default_Handler
+
+ .weak BusFault_Handler
+ .thumb_set BusFault_Handler,Default_Handler
+
+ .weak UsageFault_Handler
+ .thumb_set UsageFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak DebugMon_Handler
+ .thumb_set DebugMon_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak TAMPER_IRQHandler
+ .thumb_set TAMPER_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_IRQHandler
+ .thumb_set EXTI0_IRQHandler,Default_Handler
+
+ .weak EXTI1_IRQHandler
+ .thumb_set EXTI1_IRQHandler,Default_Handler
+
+ .weak EXTI2_IRQHandler
+ .thumb_set EXTI2_IRQHandler,Default_Handler
+
+ .weak EXTI3_IRQHandler
+ .thumb_set EXTI3_IRQHandler,Default_Handler
+
+ .weak EXTI4_IRQHandler
+ .thumb_set EXTI4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_IRQHandler
+ .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel3_IRQHandler
+ .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_IRQHandler
+ .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel5_IRQHandler
+ .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel6_IRQHandler
+ .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel7_IRQHandler
+ .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
+
+ .weak ADC1_2_IRQHandler
+ .thumb_set ADC1_2_IRQHandler,Default_Handler
+
+ .weak USB_HP_CAN1_TX_IRQHandler
+ .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
+
+ .weak USB_LP_CAN1_RX0_IRQHandler
+ .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
+
+ .weak CAN1_RX1_IRQHandler
+ .thumb_set CAN1_RX1_IRQHandler,Default_Handler
+
+ .weak CAN1_SCE_IRQHandler
+ .thumb_set CAN1_SCE_IRQHandler,Default_Handler
+
+ .weak EXTI9_5_IRQHandler
+ .thumb_set EXTI9_5_IRQHandler,Default_Handler
+
+ .weak TMR1_BRK_TMR9_IRQHandler
+ .thumb_set TMR1_BRK_TMR9_IRQHandler,Default_Handler
+
+ .weak TMR1_OV_TMR10_IRQHandler
+ .thumb_set TMR1_OV_TMR10_IRQHandler,Default_Handler
+
+ .weak TMR1_TRG_HALL_TMR11_IRQHandler
+ .thumb_set TMR1_TRG_HALL_TMR11_IRQHandler,Default_Handler
+
+ .weak TMR1_CC_IRQHandler
+ .thumb_set TMR1_CC_IRQHandler,Default_Handler
+
+ .weak TMR2_GLOBAL_IRQHandler
+ .thumb_set TMR2_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR3_GLOBAL_IRQHandler
+ .thumb_set TMR3_GLOBAL_IRQHandler,Default_Handler
+
+ .weak TMR4_GLOBAL_IRQHandler
+ .thumb_set TMR4_GLOBAL_IRQHandler,Default_Handler
+
+ .weak I2C1_EV_IRQHandler
+ .thumb_set I2C1_EV_IRQHandler,Default_Handler
+
+ .weak I2C1_ER_IRQHandler
+ .thumb_set I2C1_ER_IRQHandler,Default_Handler
+
+ .weak I2C2_EV_IRQHandler
+ .thumb_set I2C2_EV_IRQHandler,Default_Handler
+
+ .weak I2C2_ER_IRQHandler
+ .thumb_set I2C2_ER_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak SPI2_IRQHandler
+ .thumb_set SPI2_IRQHandler,Default_Handler
+
+ .weak USART1_IRQHandler
+ .thumb_set USART1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak USART3_IRQHandler
+ .thumb_set USART3_IRQHandler,Default_Handler
+
+ .weak EXTI15_10_IRQHandler
+ .thumb_set EXTI15_10_IRQHandler,Default_Handler
+
+ .weak RTCAlarm_IRQHandler
+ .thumb_set RTCAlarm_IRQHandler,Default_Handler
+
+ .weak USBWakeUp_IRQHandler
+ .thumb_set USBWakeUp_IRQHandler,Default_Handler
+
+ .weak SDIO_IRQHandler
+ .thumb_set SDIO_IRQHandler,Default_Handler
+
+ .weak TMR5_GLOBAL_IRQHandler
+ .thumb_set TMR5_GLOBAL_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel1_IRQHandler
+ .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel2_IRQHandler
+ .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel3_IRQHandler
+ .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel4_5_IRQHandler
+ .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
+
+ .weak CAN2_TX_IRQHandler
+ .thumb_set CAN2_TX_IRQHandler,Default_Handler
+
+ .weak CAN2_RX0_IRQHandler
+ .thumb_set CAN2_RX0_IRQHandler,Default_Handler
+
+ .weak CAN2_RX1_IRQHandler
+ .thumb_set CAN2_RX1_IRQHandler,Default_Handler
+
+ .weak CAN2_SCE_IRQHandler
+ .thumb_set CAN2_SCE_IRQHandler,Default_Handler
+
+ .weak ACC_IRQHandler
+ .thumb_set ACC_IRQHandler,Default_Handler
+
+ .weak USB_HP_IRQHandler
+ .thumb_set USB_HP_IRQHandler,Default_Handler
+
+ .weak USB_LP_IRQHandler
+ .thumb_set USB_LP_IRQHandler,Default_Handler
+
+ .weak DMA2_Channel6_7_IRQHandler
+ .thumb_set DMA2_Channel6_7_IRQHandler,Default_Handler
+
+/************************ (C) COPYRIGHT Artery Tek *****END OF FILE****/
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403AxC.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403AxC.icf
new file mode 100644
index 0000000000000000000000000000000000000000..5c133472cbc9bbeb6031d1b321bf85ac7e091ce4
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403AxC.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403AxE.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403AxE.icf
new file mode 100644
index 0000000000000000000000000000000000000000..4b5ba6a97b22734256f2e19a56e7bab87b623061
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403AxE.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403AxG.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403AxG.icf
new file mode 100644
index 0000000000000000000000000000000000000000..97734051a269b4742e85ebe2270f87586cfeac0e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403AxG.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x080FFFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xB.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xB.icf
new file mode 100644
index 0000000000000000000000000000000000000000..bf9488ed4903d26f6c46df47bd81580f44f682a6
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xB.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xC.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xC.icf
new file mode 100644
index 0000000000000000000000000000000000000000..5c133472cbc9bbeb6031d1b321bf85ac7e091ce4
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xC.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xE.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xE.icf
new file mode 100644
index 0000000000000000000000000000000000000000..4b5ba6a97b22734256f2e19a56e7bab87b623061
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xE.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xG.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xG.icf
new file mode 100644
index 0000000000000000000000000000000000000000..97734051a269b4742e85ebe2270f87586cfeac0e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F403xG.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x080FFFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F407xC.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F407xC.icf
new file mode 100644
index 0000000000000000000000000000000000000000..5c133472cbc9bbeb6031d1b321bf85ac7e091ce4
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F407xC.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F407xE.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F407xE.icf
new file mode 100644
index 0000000000000000000000000000000000000000..4b5ba6a97b22734256f2e19a56e7bab87b623061
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F407xE.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F407xG.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F407xG.icf
new file mode 100644
index 0000000000000000000000000000000000000000..97734051a269b4742e85ebe2270f87586cfeac0e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F407xG.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x080FFFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20037FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F413x8.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F413x8.icf
new file mode 100644
index 0000000000000000000000000000000000000000..cd94ed669e0a417940c9d358250713e06ee6d19e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F413x8.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F413xB.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F413xB.icf
new file mode 100644
index 0000000000000000000000000000000000000000..2edbb3dabfe9939e6e01acad19126a5c6c2bf667
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F413xB.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F413xC.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F413xC.icf
new file mode 100644
index 0000000000000000000000000000000000000000..843b1d434556462f553f3b614c436d98ce200788
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F413xC.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F415x8.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F415x8.icf
new file mode 100644
index 0000000000000000000000000000000000000000..cd94ed669e0a417940c9d358250713e06ee6d19e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F415x8.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F415xB.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F415xB.icf
new file mode 100644
index 0000000000000000000000000000000000000000..912235b9c0ddfd0889d72c5767a4025ae5866ccc
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F415xB.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F415xC.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F415xC.icf
new file mode 100644
index 0000000000000000000000000000000000000000..0f25e9274433b0c22ed82a36f6f1f8f15296686d
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/AT32F415xC.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/TS32F401xB.icf b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/TS32F401xB.icf
new file mode 100644
index 0000000000000000000000000000000000000000..912235b9c0ddfd0889d72c5767a4025ae5866ccc
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/linker/TS32F401xB.icf
@@ -0,0 +1,30 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x1000;
+define symbol __ICFEDIT_size_heap__ = 0x1000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite,
+ block CSTACK, block HEAP };
\ No newline at end of file
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..578aa524777168ce4376caeddcb6adc5fb060df9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acct7.s
@@ -0,0 +1,550 @@
+;**************************************************************************
+;* File Name : startup_at32f403acct7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403accu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403accu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..db59fc3a6622b8f92c7b8ff6766420b6e21b162c
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403accu7.s
@@ -0,0 +1,550 @@
+;**************************************************************************
+;* File Name : startup_at32f403accu7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acet7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acet7.s
new file mode 100644
index 0000000000000000000000000000000000000000..3091172583c1768a640dec4586424227d1481f01
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acet7.s
@@ -0,0 +1,550 @@
+;**************************************************************************
+;* File Name : startup_at32f403acet7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403aceu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403aceu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..28ca2221a1cd7d5639878f5e618d75f01af246eb
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403aceu7.s
@@ -0,0 +1,550 @@
+;**************************************************************************
+;* File Name : startup_at32f403aceu7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..8be53aa3df71f4d15990e8c79f1e9658f1f5b1b9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acgt7.s
@@ -0,0 +1,550 @@
+;**************************************************************************
+;* File Name : startup_at32f403acgt7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acgu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acgu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..ed8381e08d06a8eb941874e73b4ccd5635b97286
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403acgu7.s
@@ -0,0 +1,550 @@
+;**************************************************************************
+;* File Name : startup_at32f403acgu7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403arct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403arct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..d13c44033f3edc56006ef146efc9b33a4198a6e9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403arct7.s
@@ -0,0 +1,560 @@
+;**************************************************************************
+;* File Name : startup_at32f403arct7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403aret7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403aret7.s
new file mode 100644
index 0000000000000000000000000000000000000000..1249466094601feb98fb8c163d2a986d32f3aa9a
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403aret7.s
@@ -0,0 +1,560 @@
+;**************************************************************************
+;* File Name : startup_at32f403aret7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403argt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403argt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..917e7a7ea78a50843905c7ff5fe75f4d0f477720
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403argt7.s
@@ -0,0 +1,560 @@
+;**************************************************************************
+;* File Name : startup_at32f403argt7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403avct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403avct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..b8551c342160190c95ee5272d396c6acb127a6c8
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403avct7.s
@@ -0,0 +1,560 @@
+;**************************************************************************
+;* File Name : startup_at32f403avct7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403avet7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403avet7.s
new file mode 100644
index 0000000000000000000000000000000000000000..151f27b74e623141341bd2deb1f6bc845ef4146a
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403avet7.s
@@ -0,0 +1,560 @@
+;**************************************************************************
+;* File Name : startup_at32f403avet7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403avgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403avgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..903cb98b15250499276b29deb0eece4936c43ef3
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403avgt7.s
@@ -0,0 +1,560 @@
+;**************************************************************************
+;* File Name : startup_at32f403avgt7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403cx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403cx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..ee8ebd2a89e90cf909bc4bd91368874a9eb292c8
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403cx_hd.s
@@ -0,0 +1,463 @@
+;**************************************************************************
+;* File Name : startup_at32f403cx_hd.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_IRQHandler
+ B SPI3_IRQHandler
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403cx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403cx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..d8044babccecc9df906b62acd964ef900287362f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403cx_md.s
@@ -0,0 +1,463 @@
+;**************************************************************************
+;* File Name : startup_at32f403cx_md.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_IRQHandler
+ B SPI3_IRQHandler
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403cx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403cx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..2316a95110fc24d9d64e4b2b1d8c6822ab07a36c
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403cx_xl.s
@@ -0,0 +1,463 @@
+;**************************************************************************
+;* File Name : startup_at32f403cx_xl.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_IRQHandler
+ B SPI3_IRQHandler
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403rx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403rx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..e7308173ac935767995ee32d3ec37245c3c222a9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403rx_hd.s
@@ -0,0 +1,479 @@
+;**************************************************************************
+;* File Name : startup_at32f403rx_hd.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_IRQHandler
+ B SPI3_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403rx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403rx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..806c7e2be4cdc95fb7e87d318a3c76f8b4b1096b
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403rx_xl.s
@@ -0,0 +1,481 @@
+;**************************************************************************
+;* File Name : startup_at32f403rx_xl.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_IRQHandler
+ B SPI3_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403vx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403vx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..cbe21f431990cfa8951037ff78d25b9d6258a1d6
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403vx_hd.s
@@ -0,0 +1,491 @@
+;**************************************************************************
+;* File Name : startup_at32f403vx_hd.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_IRQHandler
+ B SPI3_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403vx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403vx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..2c5bdcbdfeaf32323801fc9b65a4ede72dc8c4e3
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403vx_xl.s
@@ -0,0 +1,490 @@
+;**************************************************************************
+;* File Name : startup_at32f403vx_xl.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_IRQHandler
+ B SPI3_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403zx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403zx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..f0b54d7b76abf835bfd101b7d4bab4ddf69a503f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403zx_hd.s
@@ -0,0 +1,514 @@
+;**************************************************************************
+;* File Name : startup_at32f403zx_hd.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD TMR15_BRK_IRQHandler ; TMR15 Break
+ DCD TMR15_OV_IRQHandler ; TMR15 Update
+ DCD TMR15_TRG_HALL_IRQHandler ; TMR15 Trigger and Commutation
+ DCD TMR15_CC_IRQHandler ; TMR15 Capture Compare
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_IRQHandler
+ B SPI3_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK TMR15_BRK_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR15_BRK_IRQHandler
+ B TMR15_BRK_IRQHandler
+
+ PUBWEAK TMR15_OV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR15_OV_IRQHandler
+ B TMR15_OV_IRQHandler
+
+ PUBWEAK TMR15_TRG_HALL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR15_TRG_HALL_IRQHandler
+ B TMR15_TRG_HALL_IRQHandler
+
+ PUBWEAK TMR15_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR15_CC_IRQHandler
+ B TMR15_CC_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403zx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403zx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..fc95fc994e51c6cbd70a11d20603385181c1d78f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403zx_xl.s
@@ -0,0 +1,514 @@
+;**************************************************************************
+;* File Name : startup_at32f403zx_xl.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD TMR15_BRK_IRQHandler ; TMR15 Break
+ DCD TMR15_OV_IRQHandler ; TMR15 Update
+ DCD TMR15_TRG_HALL_IRQHandler ; TMR15 Trigger and Commutation
+ DCD TMR15_CC_IRQHandler ; TMR15 Capture Compare
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_IRQHandler
+ B SPI3_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK TMR15_BRK_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR15_BRK_IRQHandler
+ B TMR15_BRK_IRQHandler
+
+ PUBWEAK TMR15_OV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR15_OV_IRQHandler
+ B TMR15_OV_IRQHandler
+
+ PUBWEAK TMR15_TRG_HALL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR15_TRG_HALL_IRQHandler
+ B TMR15_TRG_HALL_IRQHandler
+
+ PUBWEAK TMR15_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR15_CC_IRQHandler
+ B TMR15_CC_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407rct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407rct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..d6bc629f3acbabfb405a5b346fc54fe1979f4ae8
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407rct7.s
@@ -0,0 +1,573 @@
+;**************************************************************************
+;* File Name : startup_at32f407rct7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ PUBWEAK ETH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_IRQHandler
+ B ETH_IRQHandler
+
+ PUBWEAK ETH_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_WKUP_IRQHandler
+ B ETH_WKUP_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407ret7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407ret7.s
new file mode 100644
index 0000000000000000000000000000000000000000..0f6ab6048e790ae53496989f520abffb12c7b836
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407ret7.s
@@ -0,0 +1,573 @@
+;**************************************************************************
+;* File Name : startup_at32f407ret7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ PUBWEAK ETH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_IRQHandler
+ B ETH_IRQHandler
+
+ PUBWEAK ETH_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_WKUP_IRQHandler
+ B ETH_WKUP_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407rgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407rgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..8e2df4ddecd0bd24a0877f29b2e103df3a70b63e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407rgt7.s
@@ -0,0 +1,573 @@
+;**************************************************************************
+;* File Name : startup_at32f407rgt7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ PUBWEAK ETH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_IRQHandler
+ B ETH_IRQHandler
+
+ PUBWEAK ETH_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_WKUP_IRQHandler
+ B ETH_WKUP_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407vct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407vct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..cd351a70eadfc96855157c4be168afe25248d819
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407vct7.s
@@ -0,0 +1,573 @@
+;**************************************************************************
+;* File Name : startup_at32f407vct7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ PUBWEAK ETH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_IRQHandler
+ B ETH_IRQHandler
+
+ PUBWEAK ETH_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_WKUP_IRQHandler
+ B ETH_WKUP_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407vet7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407vet7.s
new file mode 100644
index 0000000000000000000000000000000000000000..06919c336b7b389f3f2b6275c3597984528208e2
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407vet7.s
@@ -0,0 +1,573 @@
+;**************************************************************************
+;* File Name : startup_at32f407vet7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ PUBWEAK ETH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_IRQHandler
+ B ETH_IRQHandler
+
+ PUBWEAK ETH_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_WKUP_IRQHandler
+ B ETH_WKUP_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407vgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407vgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..f78b715b41cde2610a92f2db578e4be37634add9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f407vgt7.s
@@ -0,0 +1,573 @@
+;**************************************************************************
+;* File Name : startup_at32f407vgt7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-12
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_COM_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_COM_TMR11_IRQHandler
+ B TMR1_TRG_COM_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_I2S2EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_I2S2EXT_IRQHandler
+ B SPI2_I2S2EXT_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_COM_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_COM_TMR14_IRQHandler
+ B TMR8_TRG_COM_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK ADC3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC3_IRQHandler
+ B ADC3_IRQHandler
+
+ PUBWEAK XMC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+XMC_IRQHandler
+ B XMC_IRQHandler
+
+ PUBWEAK SDIO1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO1_IRQHandler
+ B SDIO1_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK SPI3_I2S3EXT_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI3_I2S3EXT_IRQHandler
+ B SPI3_I2S3EXT_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK TMR6_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR6_GLOBAL_IRQHandler
+ B TMR6_GLOBAL_IRQHandler
+
+ PUBWEAK TMR7_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR7_GLOBAL_IRQHandler
+ B TMR7_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK SDIO2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO2_IRQHandler
+ B SDIO2_IRQHandler
+
+ PUBWEAK I2C3_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_EV_IRQHandler
+ B I2C3_EV_IRQHandler
+
+ PUBWEAK I2C3_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C3_ER_IRQHandler
+ B I2C3_ER_IRQHandler
+
+ PUBWEAK SPI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI4_IRQHandler
+ B SPI4_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ PUBWEAK USART6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART6_IRQHandler
+ B USART6_IRQHandler
+
+ PUBWEAK UART7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART7_IRQHandler
+ B UART7_IRQHandler
+
+ PUBWEAK UART8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART8_IRQHandler
+ B UART8_IRQHandler
+
+ PUBWEAK ETH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_IRQHandler
+ B ETH_IRQHandler
+
+ PUBWEAK ETH_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ETH_WKUP_IRQHandler
+ B ETH_WKUP_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413cx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413cx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..2ee838682576280ce19f01e1ae3d8a4458f0678b
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413cx_hd.s
@@ -0,0 +1,487 @@
+;**************************************************************************
+;* File Name : startup_at32f413cx_hd.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-10-08
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413cx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413cx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..adcd44ed7cefd6d42aefa78fe750b4695324f890
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413cx_md.s
@@ -0,0 +1,467 @@
+;**************************************************************************
+;* File Name : startup_at32f413cx_md.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-10-08
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413kx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413kx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..0dc5c1a50940b45eadb14e3db8bd11fd34d8ca4b
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413kx_hd.s
@@ -0,0 +1,462 @@
+;**************************************************************************
+;* File Name : startup_at32f413kx_hd.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-10-08
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD 0 ; Reserved
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413kx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413kx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..15fadef8f4bc5526d855a894153ae77ef5c7ab9b
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413kx_md.s
@@ -0,0 +1,462 @@
+;**************************************************************************
+;* File Name : startup_at32f413kx_md.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-10-08
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD 0 ; Reserved
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413rx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413rx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..60e1995f4f79b5b02f86210cbea763cf0863bef9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413rx_hd.s
@@ -0,0 +1,497 @@
+;**************************************************************************
+;* File Name : startup_at32f413rx_hd.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-10-08
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK TMR8_BRK_TMR12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_BRK_TMR12_IRQHandler
+ B TMR8_BRK_TMR12_IRQHandler
+
+ PUBWEAK TMR8_OV_TMR13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_OV_TMR13_IRQHandler
+ B TMR8_OV_TMR13_IRQHandler
+
+ PUBWEAK TMR8_TRG_HALL_TMR14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_TRG_HALL_TMR14_IRQHandler
+ B TMR8_TRG_HALL_TMR14_IRQHandler
+
+ PUBWEAK TMR8_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR8_CC_IRQHandler
+ B TMR8_CC_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413rx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413rx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..f31efa8a99bba76cc90eff23ee355ada622d18b5
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f413rx_md.s
@@ -0,0 +1,477 @@
+;**************************************************************************
+;* File Name : startup_at32f413rx_md.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2018-10-08
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415c8t7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415c8t7.s
new file mode 100644
index 0000000000000000000000000000000000000000..9c4576b8c269ab31695f8a3cd5d145e36432c034
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415c8t7.s
@@ -0,0 +1,452 @@
+;**************************************************************************
+;* File Name : startup_at32f415c8t7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415cbt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415cbt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..3f9e680c53d7471e90e8cb0e3842e399e6a1e790
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415cbt7.s
@@ -0,0 +1,452 @@
+;**************************************************************************
+;* File Name : startup_at32f415cbt7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415cbu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415cbu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..0d1c18778997c5a39ef1ba8fead82d424e57088f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415cbu7.s
@@ -0,0 +1,452 @@
+;**************************************************************************
+;* File Name : startup_at32f415cbu7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-08
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415cct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415cct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..58cee2ea44ea6406e856afc3366e415a1c38b33d
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415cct7.s
@@ -0,0 +1,452 @@
+;**************************************************************************
+;* File Name : startup_at32f415cct7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415ccu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415ccu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..eeed14f436bd95256649960ef9c6a347dd139577
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415ccu7.s
@@ -0,0 +1,452 @@
+;**************************************************************************
+;* File Name : startup_at32f415ccu7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-10-08
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415k8u7-4.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415k8u7-4.s
new file mode 100644
index 0000000000000000000000000000000000000000..689b0ce97c7e58a1083b3423e5cae6f6ce99249e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415k8u7-4.s
@@ -0,0 +1,447 @@
+;**************************************************************************
+;* File Name : startup_at32f415k8u7-4.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD 0 ; Reserved
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415kbu7-4.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415kbu7-4.s
new file mode 100644
index 0000000000000000000000000000000000000000..27a4b9e601cf37e1d6b7dd3a09be671f6f8c40bd
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415kbu7-4.s
@@ -0,0 +1,447 @@
+;**************************************************************************
+;* File Name : startup_at32f415kbu7-4.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD 0 ; Reserved
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415kcu7-4.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415kcu7-4.s
new file mode 100644
index 0000000000000000000000000000000000000000..d03235315bad16b091ca77333ad63ef6ce1f0732
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415kcu7-4.s
@@ -0,0 +1,447 @@
+;**************************************************************************
+;* File Name : startup_at32f415kcu7-4.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD 0 ; Reserved
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415r8t7-7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415r8t7-7.s
new file mode 100644
index 0000000000000000000000000000000000000000..53b931b6221295ba6854d757966f7a604228b8c6
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415r8t7-7.s
@@ -0,0 +1,462 @@
+;**************************************************************************
+;* File Name : startup_at32f415r8t7-7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415r8t7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415r8t7.s
new file mode 100644
index 0000000000000000000000000000000000000000..ffccf9e8239e2d077c1686ac7852f0f16fb467be
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415r8t7.s
@@ -0,0 +1,462 @@
+;**************************************************************************
+;* File Name : startup_at32f415r8t7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rbt7-7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rbt7-7.s
new file mode 100644
index 0000000000000000000000000000000000000000..1f0122fb7817e0712c64822cfa8bfe58a565a919
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rbt7-7.s
@@ -0,0 +1,462 @@
+;**************************************************************************
+;* File Name : startup_at32f415rbt7-7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rbt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rbt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..d02eaa6c215b0dc8264efcb4c0594e0bee164e24
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rbt7.s
@@ -0,0 +1,462 @@
+;**************************************************************************
+;* File Name : startup_at32f415rbt7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rct7-7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rct7-7.s
new file mode 100644
index 0000000000000000000000000000000000000000..fbf3cc8355686b20ffa71ed7797976e8534cee10
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rct7-7.s
@@ -0,0 +1,462 @@
+;**************************************************************************
+;* File Name : startup_at32f415rct7-7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..9e62f40775b4ddd267a88302cc994fc0c2f12d86
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f415rct7.s
@@ -0,0 +1,462 @@
+;**************************************************************************
+;* File Name : startup_at32f415rct7.s
+;* Description : at32f4xx startup file for IAR Systems
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMP_STAMP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMP_STAMP_IRQHandler
+ B TAMP_STAMP_IRQHandler
+
+ PUBWEAK ERTC_WKUP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTC_WKUP_IRQHandler
+ B ERTC_WKUP_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_TX_IRQHandler
+ B CAN1_TX_IRQHandler
+
+ PUBWEAK CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX0_IRQHandler
+ B CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK ERTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ERTCAlarm_IRQHandler
+ B ERTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK UART4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART4_IRQHandler
+ B UART4_IRQHandler
+
+ PUBWEAK UART5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UART5_IRQHandler
+ B UART5_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK USBOTG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBOTG_IRQHandler
+ B USBOTG_IRQHandler
+
+ PUBWEAK COMP1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP1_IRQHandler
+ B COMP1_IRQHandler
+
+ PUBWEAK COMP2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+COMP2_IRQHandler
+ B COMP2_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_ts32f401cbu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_ts32f401cbu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..0ea8ffa5c0dc382d5ab19ac81259203ff91234fa
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_ts32f401cbu7.s
@@ -0,0 +1,467 @@
+;**************************************************************************
+;* File Name : startup_ts32f401cbu7.s
+;* Description : ts32f4xx startup file for IAR Systems
+;* Date : 2020-02-25
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B MemManage_Handler
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B BusFault_Handler
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B UsageFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+ PUBWEAK WWDG_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+WWDG_IRQHandler
+ B WWDG_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK TAMPER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TAMPER_IRQHandler
+ B TAMPER_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK FLASH_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+FLASH_IRQHandler
+ B FLASH_IRQHandler
+
+ PUBWEAK RCC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RCC_IRQHandler
+ B RCC_IRQHandler
+
+ PUBWEAK EXTI0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI0_IRQHandler
+ B EXTI0_IRQHandler
+
+ PUBWEAK EXTI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI1_IRQHandler
+ B EXTI1_IRQHandler
+
+ PUBWEAK EXTI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI2_IRQHandler
+ B EXTI2_IRQHandler
+
+ PUBWEAK EXTI3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI3_IRQHandler
+ B EXTI3_IRQHandler
+
+ PUBWEAK EXTI4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI4_IRQHandler
+ B EXTI4_IRQHandler
+
+ PUBWEAK DMA1_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel1_IRQHandler
+ B DMA1_Channel1_IRQHandler
+
+ PUBWEAK DMA1_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel2_IRQHandler
+ B DMA1_Channel2_IRQHandler
+
+ PUBWEAK DMA1_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel3_IRQHandler
+ B DMA1_Channel3_IRQHandler
+
+ PUBWEAK DMA1_Channel4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel4_IRQHandler
+ B DMA1_Channel4_IRQHandler
+
+ PUBWEAK DMA1_Channel5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel5_IRQHandler
+ B DMA1_Channel5_IRQHandler
+
+ PUBWEAK DMA1_Channel6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel6_IRQHandler
+ B DMA1_Channel6_IRQHandler
+
+ PUBWEAK DMA1_Channel7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA1_Channel7_IRQHandler
+ B DMA1_Channel7_IRQHandler
+
+ PUBWEAK ADC1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ADC1_2_IRQHandler
+ B ADC1_2_IRQHandler
+
+ PUBWEAK USB_HP_CAN1_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_CAN1_TX_IRQHandler
+ B USB_HP_CAN1_TX_IRQHandler
+
+ PUBWEAK USB_LP_CAN1_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_CAN1_RX0_IRQHandler
+ B USB_LP_CAN1_RX0_IRQHandler
+
+ PUBWEAK CAN1_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_RX1_IRQHandler
+ B CAN1_RX1_IRQHandler
+
+ PUBWEAK CAN1_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN1_SCE_IRQHandler
+ B CAN1_SCE_IRQHandler
+
+ PUBWEAK EXTI9_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI9_5_IRQHandler
+ B EXTI9_5_IRQHandler
+
+ PUBWEAK TMR1_BRK_TMR9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_BRK_TMR9_IRQHandler
+ B TMR1_BRK_TMR9_IRQHandler
+
+ PUBWEAK TMR1_OV_TMR10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_OV_TMR10_IRQHandler
+ B TMR1_OV_TMR10_IRQHandler
+
+ PUBWEAK TMR1_TRG_HALL_TMR11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_TRG_HALL_TMR11_IRQHandler
+ B TMR1_TRG_HALL_TMR11_IRQHandler
+
+ PUBWEAK TMR1_CC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR1_CC_IRQHandler
+ B TMR1_CC_IRQHandler
+
+ PUBWEAK TMR2_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR2_GLOBAL_IRQHandler
+ B TMR2_GLOBAL_IRQHandler
+
+ PUBWEAK TMR3_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR3_GLOBAL_IRQHandler
+ B TMR3_GLOBAL_IRQHandler
+
+ PUBWEAK TMR4_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR4_GLOBAL_IRQHandler
+ B TMR4_GLOBAL_IRQHandler
+
+ PUBWEAK I2C1_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_EV_IRQHandler
+ B I2C1_EV_IRQHandler
+
+ PUBWEAK I2C1_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C1_ER_IRQHandler
+ B I2C1_ER_IRQHandler
+
+ PUBWEAK I2C2_EV_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_EV_IRQHandler
+ B I2C2_EV_IRQHandler
+
+ PUBWEAK I2C2_ER_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+I2C2_ER_IRQHandler
+ B I2C2_ER_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK USART1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART1_IRQHandler
+ B USART1_IRQHandler
+
+ PUBWEAK USART2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART2_IRQHandler
+ B USART2_IRQHandler
+
+ PUBWEAK USART3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USART3_IRQHandler
+ B USART3_IRQHandler
+
+ PUBWEAK EXTI15_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+EXTI15_10_IRQHandler
+ B EXTI15_10_IRQHandler
+
+ PUBWEAK RTCAlarm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+RTCAlarm_IRQHandler
+ B RTCAlarm_IRQHandler
+
+ PUBWEAK USBWakeUp_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USBWakeUp_IRQHandler
+ B USBWakeUp_IRQHandler
+
+ PUBWEAK SDIO_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SDIO_IRQHandler
+ B SDIO_IRQHandler
+
+ PUBWEAK TMR5_GLOBAL_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+TMR5_GLOBAL_IRQHandler
+ B TMR5_GLOBAL_IRQHandler
+
+ PUBWEAK DMA2_Channel1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel1_IRQHandler
+ B DMA2_Channel1_IRQHandler
+
+ PUBWEAK DMA2_Channel2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel2_IRQHandler
+ B DMA2_Channel2_IRQHandler
+
+ PUBWEAK DMA2_Channel3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel3_IRQHandler
+ B DMA2_Channel3_IRQHandler
+
+ PUBWEAK DMA2_Channel4_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel4_5_IRQHandler
+ B DMA2_Channel4_5_IRQHandler
+
+ PUBWEAK CAN2_TX_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_TX_IRQHandler
+ B CAN2_TX_IRQHandler
+
+ PUBWEAK CAN2_RX0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX0_IRQHandler
+ B CAN2_RX0_IRQHandler
+
+ PUBWEAK CAN2_RX1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_RX1_IRQHandler
+ B CAN2_RX1_IRQHandler
+
+ PUBWEAK CAN2_SCE_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+CAN2_SCE_IRQHandler
+ B CAN2_SCE_IRQHandler
+
+ PUBWEAK ACC_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ACC_IRQHandler
+ B ACC_IRQHandler
+
+ PUBWEAK USB_HP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_HP_IRQHandler
+ B USB_HP_IRQHandler
+
+ PUBWEAK USB_LP_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+USB_LP_IRQHandler
+ B USB_LP_IRQHandler
+
+ PUBWEAK DMA2_Channel6_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DMA2_Channel6_7_IRQHandler
+ B DMA2_Channel6_7_IRQHandler
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..9589786df59fa6b3cc985ac5de8a575dd26faaaa
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acct7.s
@@ -0,0 +1,379 @@
+;**************************************************************************
+;* File Name : startup_at32f403acct7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403accu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403accu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..a20bb0e6efb98fd33e63e7fa1425af9f3e79a836
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403accu7.s
@@ -0,0 +1,379 @@
+;**************************************************************************
+;* File Name : startup_at32f403accu7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acet7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acet7.s
new file mode 100644
index 0000000000000000000000000000000000000000..d75467660326435c60c7c19f04bf0a29ebc6bc05
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acet7.s
@@ -0,0 +1,379 @@
+;**************************************************************************
+;* File Name : startup_at32f403acet7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403aceu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403aceu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..28059e139e05b45de06e0350820da163e761a249
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403aceu7.s
@@ -0,0 +1,379 @@
+;**************************************************************************
+;* File Name : startup_at32f403aceu7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..b84c02571175db95af12387bcbcc7e4c9eb60a7b
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acgt7.s
@@ -0,0 +1,379 @@
+;**************************************************************************
+;* File Name : startup_at32f403acgt7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acgu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acgu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..c8b634e2e13d146b706c801f284abd13c5792a72
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403acgu7.s
@@ -0,0 +1,379 @@
+;**************************************************************************
+;* File Name : startup_at32f403acgu7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD 0 ; Reserved
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403arct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403arct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..e7c3a2dc5831d040de9622bf1106488ee2a10777
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403arct7.s
@@ -0,0 +1,385 @@
+;**************************************************************************
+;* File Name : startup_at32f403arct7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403aret7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403aret7.s
new file mode 100644
index 0000000000000000000000000000000000000000..1d985c15c00310d71b1f1eaf9607c158f77aa539
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403aret7.s
@@ -0,0 +1,385 @@
+;**************************************************************************
+;* File Name : startup_at32f403aret7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403argt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403argt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..aafa9660b4d94e7e3a7d4b61b1f7de934967a0e4
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403argt7.s
@@ -0,0 +1,385 @@
+;**************************************************************************
+;* File Name : startup_at32f403argt7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403avct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403avct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..d25ed52c45a82fbb54fae7642e5c23d9dcca4596
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403avct7.s
@@ -0,0 +1,385 @@
+;**************************************************************************
+;* File Name : startup_at32f403avct7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403avet7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403avet7.s
new file mode 100644
index 0000000000000000000000000000000000000000..086d385e36d6725d149a994aa1ecc1d59d722e66
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403avet7.s
@@ -0,0 +1,385 @@
+;**************************************************************************
+;* File Name : startup_at32f403avet7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403avgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403avgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..4acef24bcf64b9ed04f89ea0ee9ebce4aa55e433
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403avgt7.s
@@ -0,0 +1,385 @@
+;**************************************************************************
+;* File Name : startup_at32f403avgt7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403cx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403cx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..85a5afa3581d8574b2216a03118eef2cdb274021
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403cx_hd.s
@@ -0,0 +1,338 @@
+;**************************************************************************
+;* File Name : startup_at32f403cx_hd.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403cx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403cx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..b19a4b1483b6654a757fdc41532f073b2985d787
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403cx_md.s
@@ -0,0 +1,338 @@
+;**************************************************************************
+;* File Name : startup_at32f403cx_md.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403cx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403cx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..e32edc6d8d721d20a99cf84a69205d418052d151
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403cx_xl.s
@@ -0,0 +1,338 @@
+;**************************************************************************
+;* File Name : startup_at32f403cx_xl.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403rx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403rx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..00ff8e00991e13e6853bd0e1c081b191599ad133
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403rx_hd.s
@@ -0,0 +1,345 @@
+;**************************************************************************
+;* File Name : startup_at32f403rx_hd.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403rx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403rx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..bc368c4d6eed1ffad901cadb9ba0e7cd66f9731a
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403rx_xl.s
@@ -0,0 +1,345 @@
+;**************************************************************************
+;* File Name : startup_at32f403rx_xl.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD 0 ; Reserved
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403vx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403vx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..ed6550679c7ac749deca9d7a68455247f08ae4ab
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403vx_hd.s
@@ -0,0 +1,350 @@
+;**************************************************************************
+;* File Name : startup_at32f403vx_hd.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403vx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403vx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..461e3d36f63162d4b978319a3b4e1c3f9f0f8aeb
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403vx_xl.s
@@ -0,0 +1,350 @@
+;**************************************************************************
+;* File Name : startup_at32f403vx_xl.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403zx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403zx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..5ef75b0885385322081654bebae57548346161ed
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403zx_hd.s
@@ -0,0 +1,362 @@
+;**************************************************************************
+;* File Name : startup_at32f403zx_hd.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD TMR15_BRK_IRQHandler ; TMR15 Break
+ DCD TMR15_OV_IRQHandler ; TMR15 Update
+ DCD TMR15_TRG_HALL_IRQHandler ; TMR15 Trigger and Commutation
+ DCD TMR15_CC_IRQHandler ; TMR15 Capture Compare
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT TMR15_BRK_IRQHandler [WEAK]
+ EXPORT TMR15_OV_IRQHandler [WEAK]
+ EXPORT TMR15_TRG_HALL_IRQHandler [WEAK]
+ EXPORT TMR15_CC_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+TMR15_BRK_IRQHandler
+TMR15_OV_IRQHandler
+TMR15_TRG_HALL_IRQHandler
+TMR15_CC_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403zx_xl.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403zx_xl.s
new file mode 100644
index 0000000000000000000000000000000000000000..64fbc07572f5bf743fc974edd3ec3b38594d40eb
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403zx_xl.s
@@ -0,0 +1,362 @@
+;**************************************************************************
+;* File Name : startup_at32f403zx_xl.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-02-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_IRQHandler ; SPI3
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD TMR15_BRK_IRQHandler ; TMR15 Break
+ DCD TMR15_OV_IRQHandler ; TMR15 Update
+ DCD TMR15_TRG_HALL_IRQHandler ; TMR15 Trigger and Commutation
+ DCD TMR15_CC_IRQHandler ; TMR15 Capture Compare
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT TMR15_BRK_IRQHandler [WEAK]
+ EXPORT TMR15_OV_IRQHandler [WEAK]
+ EXPORT TMR15_TRG_HALL_IRQHandler [WEAK]
+ EXPORT TMR15_CC_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+TMR15_BRK_IRQHandler
+TMR15_OV_IRQHandler
+TMR15_TRG_HALL_IRQHandler
+TMR15_CC_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407rct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407rct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..c89ed67c716d1abced02e4beb2ee7a99f0578f96
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407rct7.s
@@ -0,0 +1,391 @@
+;**************************************************************************
+;* File Name : startup_at32f407rct7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+ EXPORT ETH_IRQHandler [WEAK]
+ EXPORT ETH_WKUP_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ETH_IRQHandler
+ETH_WKUP_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407ret7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407ret7.s
new file mode 100644
index 0000000000000000000000000000000000000000..e5f88c0c51922f34e161f4024e09b4c38d2144b2
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407ret7.s
@@ -0,0 +1,391 @@
+;**************************************************************************
+;* File Name : startup_at32f407ret7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+ EXPORT ETH_IRQHandler [WEAK]
+ EXPORT ETH_WKUP_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ETH_IRQHandler
+ETH_WKUP_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407rgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407rgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..b396d9157fd74d7240f37416acdc5abdfb7c07ad
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407rgt7.s
@@ -0,0 +1,391 @@
+;**************************************************************************
+;* File Name : startup_at32f407rgt7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+ EXPORT ETH_IRQHandler [WEAK]
+ EXPORT ETH_WKUP_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ETH_IRQHandler
+ETH_WKUP_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407vct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407vct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..cdb73fecf043b052e87b1dc21d3e6499d07dcf28
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407vct7.s
@@ -0,0 +1,391 @@
+;**************************************************************************
+;* File Name : startup_at32f407vct7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+ EXPORT ETH_IRQHandler [WEAK]
+ EXPORT ETH_WKUP_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ETH_IRQHandler
+ETH_WKUP_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407vet7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407vet7.s
new file mode 100644
index 0000000000000000000000000000000000000000..be030dc1451b9317e9f1de147d539952d5fe262d
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407vet7.s
@@ -0,0 +1,391 @@
+;**************************************************************************
+;* File Name : startup_at32f407vet7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+ EXPORT ETH_IRQHandler [WEAK]
+ EXPORT ETH_WKUP_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ETH_IRQHandler
+ETH_WKUP_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407vgt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407vgt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..3f336a4245fbff7b46c3bcb7faff0eb9787bb376
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f407vgt7.s
@@ -0,0 +1,391 @@
+;**************************************************************************
+;* File Name : startup_at32f407vgt7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-09-26
+;* Version : V1.0.4
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_COM_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_I2S2EXT_IRQHandler ; SPI2 & I2S2EXT
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_COM_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD ADC3_IRQHandler ; ADC3
+ DCD XMC_IRQHandler ; XMC
+ DCD SDIO1_IRQHandler ; SDIO1
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD SPI3_I2S3EXT_IRQHandler ; SPI3 & I2S3EXT
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD TMR6_GLOBAL_IRQHandler ; TMR6
+ DCD TMR7_GLOBAL_IRQHandler ; TMR7
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD SDIO2_IRQHandler ; SDIO2
+ DCD I2C3_EV_IRQHandler ; I2C3 Event
+ DCD I2C3_ER_IRQHandler ; I2C3 Error
+ DCD SPI4_IRQHandler ; SPI4
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB HP
+ DCD USB_LP_IRQHandler ; USB LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+ DCD USART6_IRQHandler ; USART6
+ DCD UART7_IRQHandler ; UART7
+ DCD UART8_IRQHandler ; UART8
+ DCD ETH_IRQHandler ; ETH
+ DCD ETH_WKUP_IRQHandler ; ETH_WKUP
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_COM_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_I2S2EXT_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_COM_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT ADC3_IRQHandler [WEAK]
+ EXPORT XMC_IRQHandler [WEAK]
+ EXPORT SDIO1_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT SPI3_I2S3EXT_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT TMR6_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR7_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT SDIO2_IRQHandler [WEAK]
+ EXPORT I2C3_EV_IRQHandler [WEAK]
+ EXPORT I2C3_ER_IRQHandler [WEAK]
+ EXPORT SPI4_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+ EXPORT USART6_IRQHandler [WEAK]
+ EXPORT UART7_IRQHandler [WEAK]
+ EXPORT UART8_IRQHandler [WEAK]
+ EXPORT ETH_IRQHandler [WEAK]
+ EXPORT ETH_WKUP_IRQHandler [WEAK]
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_COM_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_I2S2EXT_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_COM_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+ADC3_IRQHandler
+XMC_IRQHandler
+SDIO1_IRQHandler
+TMR5_GLOBAL_IRQHandler
+SPI3_I2S3EXT_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+TMR6_GLOBAL_IRQHandler
+TMR7_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+SDIO2_IRQHandler
+I2C3_EV_IRQHandler
+I2C3_ER_IRQHandler
+SPI4_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+USART6_IRQHandler
+UART7_IRQHandler
+UART8_IRQHandler
+ETH_IRQHandler
+ETH_WKUP_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413cx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413cx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..3ae9228a9507712aa234c9c756baacee7d1b74fa
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413cx_hd.s
@@ -0,0 +1,356 @@
+;**************************************************************************
+;* File Name : startup_at32f413cx_hd.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-09-29
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413cx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413cx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..55d4651afb92b0c95870dff8b3147dc02899c458
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413cx_md.s
@@ -0,0 +1,348 @@
+;**************************************************************************
+;* File Name : startup_at32f413cx_md.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-09-29
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413kx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413kx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..17d3c437988f6134d11b5a94e6f5f5e9389f1306
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413kx_hd.s
@@ -0,0 +1,346 @@
+;**************************************************************************
+;* File Name : startup_at32f413kx_hd.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-09-29
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD 0 ; Reserved
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413kx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413kx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..f7c67200f2d4bb4e2e07a877771bcf5ab3ed5c7a
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413kx_md.s
@@ -0,0 +1,346 @@
+;**************************************************************************
+;* File Name : startup_at32f413kx_md.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-09-29
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD 0 ; Reserved
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413rx_hd.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413rx_hd.s
new file mode 100644
index 0000000000000000000000000000000000000000..e92ec8737f686a236471c0dc950be05220081533
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413rx_hd.s
@@ -0,0 +1,360 @@
+;**************************************************************************
+;* File Name : startup_at32f413rx_hd.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-09-29
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD TMR8_BRK_TMR12_IRQHandler ; TMR8 Break and TMR12
+ DCD TMR8_OV_TMR13_IRQHandler ; TMR8 Update and TMR13
+ DCD TMR8_TRG_HALL_TMR14_IRQHandler ; TMR8 Trigger and Commutation and TMR14
+ DCD TMR8_CC_IRQHandler ; TMR8 Capture Compare
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT TMR8_BRK_TMR12_IRQHandler [WEAK]
+ EXPORT TMR8_OV_TMR13_IRQHandler [WEAK]
+ EXPORT TMR8_TRG_HALL_TMR14_IRQHandler [WEAK]
+ EXPORT TMR8_CC_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+TMR8_BRK_TMR12_IRQHandler
+TMR8_OV_TMR13_IRQHandler
+TMR8_TRG_HALL_TMR14_IRQHandler
+TMR8_CC_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413rx_md.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413rx_md.s
new file mode 100644
index 0000000000000000000000000000000000000000..8ab14e5cec0ccffcf31e6079cf263ec7ddc343e0
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f413rx_md.s
@@ -0,0 +1,352 @@
+;**************************************************************************
+;* File Name : startup_at32f413rx_md.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2018-09-29
+;* Version : V1.0.5
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415c8t7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415c8t7.s
new file mode 100644
index 0000000000000000000000000000000000000000..d9be02c5dc983c654bf05a61dfca1d78b9a0758a
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415c8t7.s
@@ -0,0 +1,342 @@
+;**************************************************************************
+;* File Name : startup_at32f415c8t7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415cbt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415cbt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..772223083d79592089ea33de0d74fd3aeded21dc
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415cbt7.s
@@ -0,0 +1,342 @@
+;**************************************************************************
+;* File Name : startup_at32f415cbt7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415cbu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415cbu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..81ca96449e3af648b6a6f78048a69ed9673ea8cc
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415cbu7.s
@@ -0,0 +1,342 @@
+;**************************************************************************
+;* File Name : startup_at32f415cbu7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-10-08
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415cct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415cct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..d22226a784d98d5c023e14a19fdfd45e2a75658e
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415cct7.s
@@ -0,0 +1,342 @@
+;**************************************************************************
+;* File Name : startup_at32f415cct7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415ccu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415ccu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..7ab28e9c31c3a36afb1810b10cad911244bbbcfe
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415ccu7.s
@@ -0,0 +1,342 @@
+;**************************************************************************
+;* File Name : startup_at32f415ccu7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-10-08
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415k8u7-4.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415k8u7-4.s
new file mode 100644
index 0000000000000000000000000000000000000000..e9107700cf2836d2bc0b2aac38e478260c970c9a
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415k8u7-4.s
@@ -0,0 +1,340 @@
+;**************************************************************************
+;* File Name : startup_at32f415k8u7-4.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD 0 ; Reserved
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415kbu7-4.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415kbu7-4.s
new file mode 100644
index 0000000000000000000000000000000000000000..c9761fd2772ef6b5ce0c30af76e952e52dc67f16
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415kbu7-4.s
@@ -0,0 +1,340 @@
+;**************************************************************************
+;* File Name : startup_at32f415kbu7-4.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD 0 ; Reserved
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415kcu7-4.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415kcu7-4.s
new file mode 100644
index 0000000000000000000000000000000000000000..2f59c7201aad6a981daa0f9bbddd2f0487047281
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415kcu7-4.s
@@ -0,0 +1,340 @@
+;**************************************************************************
+;* File Name : startup_at32f415kcu7-4.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-17
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD 0 ; Reserved
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415r8t7-7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415r8t7-7.s
new file mode 100644
index 0000000000000000000000000000000000000000..cb4667bfc94d8124aca2778b582d34d1f4c7a257
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415r8t7-7.s
@@ -0,0 +1,346 @@
+;**************************************************************************
+;* File Name : startup_at32f415r8t7-7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415r8t7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415r8t7.s
new file mode 100644
index 0000000000000000000000000000000000000000..70adee7008a981dca62cc7b07ca95f42a80f9c13
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415r8t7.s
@@ -0,0 +1,346 @@
+;**************************************************************************
+;* File Name : startup_at32f415r8t7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rbt7-7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rbt7-7.s
new file mode 100644
index 0000000000000000000000000000000000000000..c8c11bdb18ad67ce5c91b18b8ad3d8246005ddfa
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rbt7-7.s
@@ -0,0 +1,346 @@
+;**************************************************************************
+;* File Name : startup_at32f415rbt7-7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rbt7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rbt7.s
new file mode 100644
index 0000000000000000000000000000000000000000..0ca1857f1e4f65434fec4f113d9403ad82cf93b1
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rbt7.s
@@ -0,0 +1,346 @@
+;**************************************************************************
+;* File Name : startup_at32f415rbt7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rct7-7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rct7-7.s
new file mode 100644
index 0000000000000000000000000000000000000000..982ee300fdf2589c4fb67957fc305fc365118ae7
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rct7-7.s
@@ -0,0 +1,346 @@
+;**************************************************************************
+;* File Name : startup_at32f415rct7-7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rct7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rct7.s
new file mode 100644
index 0000000000000000000000000000000000000000..3cb3cdc285f914bf3443ab5d6dfaab69588a2fb9
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f415rct7.s
@@ -0,0 +1,346 @@
+;**************************************************************************
+;* File Name : startup_at32f415rct7.s
+;* Description : at32f4xx startup file for keil
+;* Date : 2019-05-30
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
+ DCD ERTC_WKUP_IRQHandler ; ERTC Wakeup through the EXTI line
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD CAN1_TX_IRQHandler ; CAN1 TX
+ DCD CAN1_RX0_IRQHandler ; CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD ERTCAlarm_IRQHandler ; ERTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD UART4_IRQHandler ; UART4
+ DCD UART5_IRQHandler ; UART5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD USBOTG_IRQHandler ; USBOTG
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD COMP1_IRQHandler ; COMP1
+ DCD COMP2_IRQHandler ; COMP2
+ DCD ACC_IRQHandler ; ACC
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMP_STAMP_IRQHandler [WEAK]
+ EXPORT ERTC_WKUP_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT CAN1_TX_IRQHandler [WEAK]
+ EXPORT CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT ERTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT UART4_IRQHandler [WEAK]
+ EXPORT UART5_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT USBOTG_IRQHandler [WEAK]
+ EXPORT COMP1_IRQHandler [WEAK]
+ EXPORT COMP2_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMP_STAMP_IRQHandler
+ERTC_WKUP_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+CAN1_TX_IRQHandler
+CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+ERTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+UART4_IRQHandler
+UART5_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+USBOTG_IRQHandler
+COMP1_IRQHandler
+COMP2_IRQHandler
+ACC_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_ts32f401cbu7.s b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_ts32f401cbu7.s
new file mode 100644
index 0000000000000000000000000000000000000000..9ab05eb515f04a0c084e421fd40380637a8146c5
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_ts32f401cbu7.s
@@ -0,0 +1,348 @@
+;**************************************************************************
+;* File Name : startup_ts32f401cbu7.s
+;* Description : ts32f4xx startup file for keil
+;* Date : 2020-02-25
+;* Version : V1.0.0
+;**************************************************************************
+;
+
+; Amount of memory (in bytes) allocated for Stack
+; Tailor this value to your application needs
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset Handler
+ DCD NMI_Handler ; NMI Handler
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External Interrupts
+ DCD WWDG_IRQHandler ; Window Watchdog
+ DCD PVD_IRQHandler ; PVD through EXTI Line detect
+ DCD TAMPER_IRQHandler ; Tamper
+ DCD RTC_IRQHandler ; RTC
+ DCD FLASH_IRQHandler ; Flash
+ DCD RCC_IRQHandler ; RCC
+ DCD EXTI0_IRQHandler ; EXTI Line 0
+ DCD EXTI1_IRQHandler ; EXTI Line 1
+ DCD EXTI2_IRQHandler ; EXTI Line 2
+ DCD EXTI3_IRQHandler ; EXTI Line 3
+ DCD EXTI4_IRQHandler ; EXTI Line 4
+ DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
+ DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
+ DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
+ DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
+ DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
+ DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
+ DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
+ DCD ADC1_2_IRQHandler ; ADC1 & ADC2
+ DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
+ DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
+ DCD CAN1_RX1_IRQHandler ; CAN1 RX1
+ DCD CAN1_SCE_IRQHandler ; CAN1 SCE
+ DCD EXTI9_5_IRQHandler ; EXTI Line [9:5]
+ DCD TMR1_BRK_TMR9_IRQHandler ; TMR1 Break and TMR9
+ DCD TMR1_OV_TMR10_IRQHandler ; TMR1 Update and TMR10
+ DCD TMR1_TRG_HALL_TMR11_IRQHandler ; TMR1 Trigger and Commutation and TMR11
+ DCD TMR1_CC_IRQHandler ; TMR1 Capture Compare
+ DCD TMR2_GLOBAL_IRQHandler ; TMR2
+ DCD TMR3_GLOBAL_IRQHandler ; TMR3
+ DCD TMR4_GLOBAL_IRQHandler ; TMR4
+ DCD I2C1_EV_IRQHandler ; I2C1 Event
+ DCD I2C1_ER_IRQHandler ; I2C1 Error
+ DCD I2C2_EV_IRQHandler ; I2C2 Event
+ DCD I2C2_ER_IRQHandler ; I2C2 Error
+ DCD SPI1_IRQHandler ; SPI1
+ DCD SPI2_IRQHandler ; SPI2
+ DCD USART1_IRQHandler ; USART1
+ DCD USART2_IRQHandler ; USART2
+ DCD USART3_IRQHandler ; USART3
+ DCD EXTI15_10_IRQHandler ; EXTI Line [15:10]
+ DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
+ DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SDIO_IRQHandler ; SDIO
+ DCD TMR5_GLOBAL_IRQHandler ; TMR5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
+ DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
+ DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
+ DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD CAN2_TX_IRQHandler ; CAN2 TX
+ DCD CAN2_RX0_IRQHandler ; CAN2 RX0
+ DCD CAN2_RX1_IRQHandler ; CAN2 RX1
+ DCD CAN2_SCE_IRQHandler ; CAN2 SCE
+ DCD ACC_IRQHandler ; ACC
+ DCD USB_HP_IRQHandler ; USB_HP
+ DCD USB_LP_IRQHandler ; USB_LP
+ DCD DMA2_Channel6_7_IRQHandler ; DMA2 Channel6 & Channel7
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+; Reset handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B .
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B .
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT WWDG_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT TAMPER_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT FLASH_IRQHandler [WEAK]
+ EXPORT RCC_IRQHandler [WEAK]
+ EXPORT EXTI0_IRQHandler [WEAK]
+ EXPORT EXTI1_IRQHandler [WEAK]
+ EXPORT EXTI2_IRQHandler [WEAK]
+ EXPORT EXTI3_IRQHandler [WEAK]
+ EXPORT EXTI4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel1_IRQHandler [WEAK]
+ EXPORT DMA1_Channel2_IRQHandler [WEAK]
+ EXPORT DMA1_Channel3_IRQHandler [WEAK]
+ EXPORT DMA1_Channel4_IRQHandler [WEAK]
+ EXPORT DMA1_Channel5_IRQHandler [WEAK]
+ EXPORT DMA1_Channel6_IRQHandler [WEAK]
+ EXPORT DMA1_Channel7_IRQHandler [WEAK]
+ EXPORT ADC1_2_IRQHandler [WEAK]
+ EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
+ EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
+ EXPORT CAN1_RX1_IRQHandler [WEAK]
+ EXPORT CAN1_SCE_IRQHandler [WEAK]
+ EXPORT EXTI9_5_IRQHandler [WEAK]
+ EXPORT TMR1_BRK_TMR9_IRQHandler [WEAK]
+ EXPORT TMR1_OV_TMR10_IRQHandler [WEAK]
+ EXPORT TMR1_TRG_HALL_TMR11_IRQHandler [WEAK]
+ EXPORT TMR1_CC_IRQHandler [WEAK]
+ EXPORT TMR2_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR3_GLOBAL_IRQHandler [WEAK]
+ EXPORT TMR4_GLOBAL_IRQHandler [WEAK]
+ EXPORT I2C1_EV_IRQHandler [WEAK]
+ EXPORT I2C1_ER_IRQHandler [WEAK]
+ EXPORT I2C2_EV_IRQHandler [WEAK]
+ EXPORT I2C2_ER_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT USART1_IRQHandler [WEAK]
+ EXPORT USART2_IRQHandler [WEAK]
+ EXPORT USART3_IRQHandler [WEAK]
+ EXPORT EXTI15_10_IRQHandler [WEAK]
+ EXPORT RTCAlarm_IRQHandler [WEAK]
+ EXPORT USBWakeUp_IRQHandler [WEAK]
+ EXPORT SDIO_IRQHandler [WEAK]
+ EXPORT TMR5_GLOBAL_IRQHandler [WEAK]
+ EXPORT DMA2_Channel1_IRQHandler [WEAK]
+ EXPORT DMA2_Channel2_IRQHandler [WEAK]
+ EXPORT DMA2_Channel3_IRQHandler [WEAK]
+ EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
+ EXPORT CAN2_TX_IRQHandler [WEAK]
+ EXPORT CAN2_RX0_IRQHandler [WEAK]
+ EXPORT CAN2_RX1_IRQHandler [WEAK]
+ EXPORT CAN2_SCE_IRQHandler [WEAK]
+ EXPORT ACC_IRQHandler [WEAK]
+ EXPORT USB_HP_IRQHandler [WEAK]
+ EXPORT USB_LP_IRQHandler [WEAK]
+ EXPORT DMA2_Channel6_7_IRQHandler [WEAK]
+
+
+
+WWDG_IRQHandler
+PVD_IRQHandler
+TAMPER_IRQHandler
+RTC_IRQHandler
+FLASH_IRQHandler
+RCC_IRQHandler
+EXTI0_IRQHandler
+EXTI1_IRQHandler
+EXTI2_IRQHandler
+EXTI3_IRQHandler
+EXTI4_IRQHandler
+DMA1_Channel1_IRQHandler
+DMA1_Channel2_IRQHandler
+DMA1_Channel3_IRQHandler
+DMA1_Channel4_IRQHandler
+DMA1_Channel5_IRQHandler
+DMA1_Channel6_IRQHandler
+DMA1_Channel7_IRQHandler
+ADC1_2_IRQHandler
+USB_HP_CAN1_TX_IRQHandler
+USB_LP_CAN1_RX0_IRQHandler
+CAN1_RX1_IRQHandler
+CAN1_SCE_IRQHandler
+EXTI9_5_IRQHandler
+TMR1_BRK_TMR9_IRQHandler
+TMR1_OV_TMR10_IRQHandler
+TMR1_TRG_HALL_TMR11_IRQHandler
+TMR1_CC_IRQHandler
+TMR2_GLOBAL_IRQHandler
+TMR3_GLOBAL_IRQHandler
+TMR4_GLOBAL_IRQHandler
+I2C1_EV_IRQHandler
+I2C1_ER_IRQHandler
+I2C2_EV_IRQHandler
+I2C2_ER_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+USART1_IRQHandler
+USART2_IRQHandler
+USART3_IRQHandler
+EXTI15_10_IRQHandler
+RTCAlarm_IRQHandler
+USBWakeUp_IRQHandler
+SDIO_IRQHandler
+TMR5_GLOBAL_IRQHandler
+DMA2_Channel1_IRQHandler
+DMA2_Channel2_IRQHandler
+DMA2_Channel3_IRQHandler
+DMA2_Channel4_5_IRQHandler
+CAN2_TX_IRQHandler
+CAN2_RX0_IRQHandler
+CAN2_RX1_IRQHandler
+CAN2_SCE_IRQHandler
+ACC_IRQHandler
+USB_HP_IRQHandler
+USB_LP_IRQHandler
+DMA2_Channel6_7_IRQHandler
+ B .
+
+ ENDP
+
+ ALIGN
+
+;*******************************************************************************
+; User Stack and Heap initialization
+;*******************************************************************************
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/system_at32f4xx.c b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/system_at32f4xx.c
new file mode 100644
index 0000000000000000000000000000000000000000..062fd4e50175f62a088581de910d0be2d3e8ba6f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/system_at32f4xx.c
@@ -0,0 +1,3457 @@
+/**
+ ******************************************************************************
+ * @file system_at32f4xx.c
+ * @author Artery Technology
+ * @version V1.0.0
+ * @date 2019-05-27
+ * @brief CMSIS Cortex-M4 system source file
+ ******************************************************************************
+ * @attention
+ *
+ * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+ * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+ * TIME. AS A RESULT, ARTERYTEK SHALL NOT BE HELD LIABLE FOR ANY
+ * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+ * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+ * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+ *
+ * © COPYRIGHT 2018 ArteryTek
+ ******************************************************************************
+ */
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup at32f4xx_system
+ * @{
+ */
+
+/** @addtogroup at32f4xx_System_Private_Includes
+ * @{
+ */
+
+#include "at32f4xx.h"
+
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_Defines
+ * @{
+ */
+
+/*!< Uncomment the line corresponding to the desired System clock (SYSCLK)
+ frequency (after reset the HSI is used as SYSCLK source)
+
+ IMPORTANT NOTE:
+ ==============
+ 1. After each device reset the HSI is used as System clock source.
+
+ 2. Please make sure that the selected System clock doesn't exceed your device's
+ maximum frequency.
+
+ 3. If none of the define below is enabled, the HSI is used as System clock
+ source.
+
+ 4. The System clock configuration functions provided within this file assume that:
+ - For at32f4xx devices, an external 8MHz crystal is used to drive the System clock.
+ If you are using different crystal you have to adapt those functions accordingly.
+
+ Clock (MHz)
+ PLL from HSE or HSI
+ SYSCLK HCLK PCLK2 PCLK1
+ 24 24 24 24
+ 36 36 36 36
+ 48 48 48 24
+ 56 56 56 28
+ 72 72 72 36
+ 96 96 48 48
+ 108 108 54 54
+ 120 120 60 60
+ 144 144 72 72
+ 150 150 75 75
+ 168 168 84 84
+ 176 176 88 88
+ 192 192 96 96
+ 200 200 100 100
+ 224 224 112 112
+ 240 240 120 120
+ */
+
+#if defined (AT32F403xx) || defined (AT32F413xx) || \
+ defined (AT32F415xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+/* #define SYSCLK_FREQ_HSE HSE_VALUE */
+/* #define SYSCLK_FREQ_24MHz 24000000 */
+/* #define SYSCLK_FREQ_36MHz 36000000 */
+/* #define SYSCLK_FREQ_48MHz 48000000 */
+/* #define SYSCLK_FREQ_56MHz 56000000 */
+/* #define SYSCLK_FREQ_72MHz 72000000 */
+/* #define SYSCLK_FREQ_96MHz 96000000 */
+/* #define SYSCLK_FREQ_108MHz 108000000 */
+/* #define SYSCLK_FREQ_120MHz 120000000 */
+/* #define SYSCLK_FREQ_144MHz 144000000 */
+/* #define SYSCLK_FREQ_24MHz_HSI 24000000 */
+/* #define SYSCLK_FREQ_36MHz_HSI 36000000 */
+/* #define SYSCLK_FREQ_48MHz_HSI 48000000 */
+/* #define SYSCLK_FREQ_56MHz_HSI 56000000 */
+/* #define SYSCLK_FREQ_72MHz_HSI 72000000 */
+/* #define SYSCLK_FREQ_96MHz_HSI 96000000 */
+/* #define SYSCLK_FREQ_108MHz_HSI 108000000 */
+/* #define SYSCLK_FREQ_120MHz_HSI 120000000 */
+/* #define SYSCLK_FREQ_144MHz_HSI 144000000 */
+#endif
+
+#if defined (AT32F415xx)
+/* #define SYSCLK_FREQ_150MHz 150000000 */
+/* #define SYSCLK_FREQ_150MHz_HSI 150000000 */
+#endif
+
+#if defined (AT32F403xx) || defined (AT32F413xx) || \
+ defined (AT32F403Axx)|| defined (AT32F407xx)
+/* #define SYSCLK_FREQ_168MHz 168000000 */
+/* #define SYSCLK_FREQ_176MHz 176000000 */
+/* #define SYSCLK_FREQ_192MHz 192000000 */
+/* #define SYSCLK_FREQ_200MHz 200000000 */
+/* #define SYSCLK_FREQ_168MHz_HSI 168000000 */
+/* #define SYSCLK_FREQ_176MHz_HSI 176000000 */
+/* #define SYSCLK_FREQ_192MHz_HSI 192000000 */
+/* #define SYSCLK_FREQ_200MHz_HSI 200000000 */
+#endif
+
+#if defined (AT32F403Axx)|| defined (AT32F407xx)
+/* #define SYSCLK_FREQ_224MHz 224000000 */
+/* #define SYSCLK_FREQ_240MHz 240000000 */
+/* #define SYSCLK_FREQ_224MHz_HSI 224000000 */
+/* #define SYSCLK_FREQ_240MHz_HSI 240000000 */
+#endif
+
+/*!< Uncomment the following line if you need to use external SRAM mounted
+ (AT32 High density and XL-density devices) as data memory */
+
+/* #define DATA_IN_ExtSRAM */
+
+/*!< Uncomment the following line if you need to relocate your vector Table in
+ Internal SRAM. */
+/* #define VECT_TAB_SRAM */
+#define VECT_TAB_OFFSET 0x0 /*!< Vector Table base offset field.
+This value must be a multiple of 0x200. */
+
+
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_Variables
+ * @{
+ */
+
+/*******************************************************************************
+* Clock Definitions
+*******************************************************************************/
+#ifdef SYSCLK_FREQ_HSE
+uint32_t SystemCoreClock = SYSCLK_FREQ_HSE; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_24MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_24MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_36MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_36MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_48MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_48MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_56MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_56MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_72MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_72MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_96MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_96MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_108MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_108MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_120MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_120MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_144MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_144MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_150MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_150MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_168MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_168MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_176MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_176MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_192MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_192MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_200MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_200MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_224MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_224MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_240MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_240MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_24MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_24MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_36MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_36MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_48MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_48MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_56MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_56MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_72MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_72MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_96MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_96MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_108MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_108MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_120MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_120MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_144MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_144MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_150MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_150MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_168MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_168MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_176MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_176MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_192MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_192MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_200MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_200MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_224MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_224MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_240MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_240MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#else /*!< HSI Selected as System Clock source */
+#define SYSCLK_FREQ_HSI HSI_VALUE
+uint32_t SystemCoreClock = HSI_VALUE; /*!< System Clock Frequency (Core Clock) */
+#endif
+
+__I uint8_t AHBPscTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_FunctionPrototypes
+ * @{
+ */
+
+static void SetSysClock(void);
+
+#ifdef SYSCLK_FREQ_HSE
+static void SetSysClockToHSE(void);
+#elif defined SYSCLK_FREQ_24MHz
+static void SetSysClockTo24M(void);
+#elif defined SYSCLK_FREQ_36MHz
+static void SetSysClockTo36M(void);
+#elif defined SYSCLK_FREQ_48MHz
+static void SetSysClockTo48M(void);
+#elif defined SYSCLK_FREQ_56MHz
+static void SetSysClockTo56M(void);
+#elif defined SYSCLK_FREQ_72MHz
+static void SetSysClockTo72M(void);
+#elif defined SYSCLK_FREQ_96MHz
+static void SetSysClockTo96M(void);
+#elif defined SYSCLK_FREQ_108MHz
+static void SetSysClockTo108M(void);
+#elif defined SYSCLK_FREQ_120MHz
+static void SetSysClockTo120M(void);
+#elif defined SYSCLK_FREQ_144MHz
+static void SetSysClockTo144M(void);
+#elif defined SYSCLK_FREQ_150MHz
+static void SetSysClockTo150M(void);
+#elif defined SYSCLK_FREQ_168MHz
+static void SetSysClockTo168M(void);
+#elif defined SYSCLK_FREQ_176MHz
+static void SetSysClockTo176M(void);
+#elif defined SYSCLK_FREQ_192MHz
+static void SetSysClockTo192M(void);
+#elif defined SYSCLK_FREQ_200MHz
+static void SetSysClockTo200M(void);
+#elif defined SYSCLK_FREQ_224MHz
+static void SetSysClockTo224M(void);
+#elif defined SYSCLK_FREQ_240MHz
+static void SetSysClockTo240M(void);
+#elif defined SYSCLK_FREQ_24MHz_HSI
+static void SetSysClockTo24MHSI(void);
+#elif defined SYSCLK_FREQ_36MHz_HSI
+static void SetSysClockTo36MHSI(void);
+#elif defined SYSCLK_FREQ_48MHz_HSI
+static void SetSysClockTo48MHSI(void);
+#elif defined SYSCLK_FREQ_56MHz_HSI
+static void SetSysClockTo56MHSI(void);
+#elif defined SYSCLK_FREQ_72MHz_HSI
+static void SetSysClockTo72MHSI(void);
+#elif defined SYSCLK_FREQ_96MHz_HSI
+static void SetSysClockTo96MHSI(void);
+#elif defined SYSCLK_FREQ_108MHz_HSI
+static void SetSysClockTo108MHSI(void);
+#elif defined SYSCLK_FREQ_120MHz_HSI
+static void SetSysClockTo120MHSI(void);
+#elif defined SYSCLK_FREQ_144MHz_HSI
+static void SetSysClockTo144MHSI(void);
+#elif defined SYSCLK_FREQ_150MHz_HSI
+static void SetSysClockTo150MHSI(void);
+#elif defined SYSCLK_FREQ_168MHz_HSI
+static void SetSysClockTo168MHSI(void);
+#elif defined SYSCLK_FREQ_176MHz_HSI
+static void SetSysClockTo176MHSI(void);
+#elif defined SYSCLK_FREQ_192MHz_HSI
+static void SetSysClockTo192MHSI(void);
+#elif defined SYSCLK_FREQ_200MHz_HSI
+static void SetSysClockTo200MHSI(void);
+#elif defined SYSCLK_FREQ_224MHz_HSI
+static void SetSysClockTo224MHSI(void);
+#elif defined SYSCLK_FREQ_240MHz_HSI
+static void SetSysClockTo240MHSI(void);
+#endif
+
+#ifdef DATA_IN_ExtSRAM
+static void SystemInit_ExtMemCtrl(void);
+#endif /* DATA_IN_ExtSRAM */
+
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Setup the microcontroller system
+ * Initialize the Embedded Flash Interface, the PLL and update the
+ * SystemCoreClock variable.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+void SystemInit (void)
+{
+#if defined (AT32F415xx)
+ /* Enable low power mode, 0x40007050[bit2] */
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_PWR, ENABLE);
+ *(volatile uint8_t *)(0x40007050) |= (uint8_t)(0x1 << 2);
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_PWR, DISABLE);
+#endif
+
+#if defined (__FPU_USED) && (__FPU_USED == 1U)
+ SCB->CPACR |= ((3U << 10U * 2U) | /* set CP10 Full Access */
+ (3U << 11U * 2U) ); /* set CP11 Full Access */
+#endif
+
+ /* Reset the RCC clock configuration to the default reset state(for debug purpose) */
+ /* Set HSIEN bit */
+ BIT_SET(RCC->CTRL, RCC_CTRL_HSIEN);
+
+ /* Reset SW, AHBPSC, APB1PSC, APB2PSC, ADCPSC and CLKOUT bits */
+ BIT_CLEAR(RCC->CFG, RCC_CFG_SYSCLKSEL | RCC_CFG_AHBPSC | \
+ RCC_CFG_APB1PSC | RCC_CFG_APB2PSC | \
+ RCC_CFG_ADCPSC | RCC_CFG_CLKOUT);
+
+ /* Reset HSEEN, HSECFDEN and PLLEN bits */
+ BIT_CLEAR(RCC->CTRL, RCC_CTRL_HSEEN | RCC_CTRL_HSECFDEN | \
+ RCC_CTRL_PLLEN);
+
+ /* Reset HSEBYPS bit */
+ BIT_CLEAR(RCC->CTRL, RCC_CTRL_HSEBYPS);
+
+ /* Reset PLLRC, PLLHSEPSC, PLLMUL, USBPSC and PLLRANGE bits */
+ BIT_CLEAR(RCC->CFG, RCC_CFG_PLLRC | RCC_CFG_PLLHSEPSC | \
+ RCC_CFG_PLLMULT | RCC_CFG_USBPSC | RCC_CFG_PLLRANGE);
+
+ /* Reset USB768B, CLKOUT[3], HSICAL_KEY[7:0] */
+ BIT_CLEAR(RCC->MISC, 0x010100FF);
+
+ /* Disable all interrupts and clear pending bits */
+ RCC->CLKINT = RCC_CLKINT_LSISTBLFC | RCC_CLKINT_LSESTBLFC | \
+ RCC_CLKINT_HSISTBLFC | RCC_CLKINT_HSESTBLFC | \
+ RCC_CLKINT_PLLSTBLFC | RCC_CLKINT_HSECFDFC;
+
+#ifdef DATA_IN_ExtSRAM
+ SystemInit_ExtMemCtrl();
+#endif /* DATA_IN_ExtSRAM */
+
+ /* Configure the System clock frequency, HCLK, PCLK2 and PCLK1 prescalers */
+ /* Configure the Flash Latency cycles and enable prefetch buffer */
+ SetSysClock();
+
+#ifdef VECT_TAB_SRAM
+ SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */
+#else
+ SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH. */
+#endif
+}
+
+/**
+ * @brief Update SystemCoreClock variable according to Clock Register Values.
+ * The SystemCoreClock variable contains the core clock (HCLK), it can
+ * be used by the user application to setup the SysTick timer or configure
+ * other parameters.
+ *
+ * @note Each time the core clock (HCLK) changes, this function must be called
+ * to update SystemCoreClock variable value. Otherwise, any configuration
+ * based on this variable will be incorrect.
+ *
+ * @note - The system frequency computed by this function is not the real
+ * frequency in the chip. It is calculated based on the predefined
+ * constant and the selected clock source:
+ *
+ * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
+ *
+ * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
+ *
+ * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
+ * or HSI_VALUE(*) multiplied by the PLL factors.
+ *
+ * (*) HSI_VALUE is a constant defined in at32f4xx.h file (default value
+ * 8 MHz) but the real value may vary depending on the variations
+ * in voltage and temperature.
+ *
+ * (**) HSE_VALUE is a constant defined in at32f4xx.h file (default value
+ * 8 MHz or 25 MHz, depedning on the product used), user has to ensure
+ * that HSE_VALUE is same as the real frequency of the crystal used.
+ * Otherwise, this function may have wrong result.
+ *
+ * - The result of this function could be not correct when using fractional
+ * value for HSE crystal.
+ * @param None
+ * @retval None
+ */
+void SystemCoreClockUpdate (void)
+{
+ uint32_t tmp = 0, pllmult = 0, pllrefclk = 0, tempcfg = 0;
+
+ /* Get SYSCLK source -------------------------------------------------------*/
+ tmp = RCC->CFG & RCC_CFG_SYSCLKSTS;
+
+ switch (tmp)
+ {
+ case RCC_CFG_SYSCLKSTS_HSI: /* HSI used as system clock */
+ SystemCoreClock = HSI_VALUE;
+ break;
+
+ case RCC_CFG_SYSCLKSTS_HSE: /* HSE used as system clock */
+ SystemCoreClock = HSE_VALUE;
+ break;
+
+ case RCC_CFG_SYSCLKSTS_PLL: /* PLL used as system clock */
+ /* Get PLL clock source and multiplication factor ----------------------*/
+ pllrefclk = RCC->CFG & RCC_CFG_PLLRC;
+ tempcfg = RCC->CFG;
+ pllmult = RCC_GET_PLLMULT(tempcfg);
+
+ if (pllrefclk == RCC_PLLRefClk_HSI_Div2)
+ {
+ /* HSI oscillator clock divided by 2 selected as PLL clock entry */
+ SystemCoreClock = (HSI_VALUE >> 1) * pllmult;
+ }
+ else
+ {
+ /* HSE selected as PLL clock entry */
+ if ((RCC->CFG & RCC_CFG_PLLHSEPSC) != (uint32_t)RESET)
+ {
+ /* HSE oscillator clock divided by 2 */
+ SystemCoreClock = (HSE_VALUE >> 1) * pllmult;
+ }
+ else
+ {
+ SystemCoreClock = HSE_VALUE * pllmult;
+ }
+ }
+
+ break;
+
+ default:
+ SystemCoreClock = HSI_VALUE;
+ break;
+ }
+
+ /* Compute HCLK clock frequency ----------------*/
+ /* Get HCLK prescaler */
+ tmp = AHBPscTable[((RCC->CFG & RCC_CFG_AHBPSC) >> 4)];
+ /* HCLK clock frequency */
+ SystemCoreClock >>= tmp;
+}
+
+/**
+ * @brief Configures the System clock frequency, HCLK, PCLK2 and PCLK1 prescalers.
+ * @param None
+ * @retval None
+ */
+static void SetSysClock(void)
+{
+#ifdef SYSCLK_FREQ_HSE
+ SetSysClockToHSE();
+#elif defined SYSCLK_FREQ_24MHz
+ SetSysClockTo24M();
+#elif defined SYSCLK_FREQ_36MHz
+ SetSysClockTo36M();
+#elif defined SYSCLK_FREQ_48MHz
+ SetSysClockTo48M();
+#elif defined SYSCLK_FREQ_56MHz
+ SetSysClockTo56M();
+#elif defined SYSCLK_FREQ_72MHz
+ SetSysClockTo72M();
+#elif defined SYSCLK_FREQ_96MHz
+ SetSysClockTo96M();
+#elif defined SYSCLK_FREQ_108MHz
+ SetSysClockTo108M();
+#elif defined SYSCLK_FREQ_120MHz
+ SetSysClockTo120M();
+#elif defined SYSCLK_FREQ_144MHz
+ SetSysClockTo144M();
+#elif defined SYSCLK_FREQ_150MHz
+ SetSysClockTo150M();
+#elif defined SYSCLK_FREQ_168MHz
+ SetSysClockTo168M();
+#elif defined SYSCLK_FREQ_176MHz
+ SetSysClockTo176M();
+#elif defined SYSCLK_FREQ_192MHz
+ SetSysClockTo192M();
+#elif defined SYSCLK_FREQ_200MHz
+ SetSysClockTo200M();
+#elif defined SYSCLK_FREQ_224MHz
+ SetSysClockTo224M();
+#elif defined SYSCLK_FREQ_240MHz
+ SetSysClockTo240M();
+#elif defined SYSCLK_FREQ_24MHz_HSI
+ SetSysClockTo24MHSI();
+#elif defined SYSCLK_FREQ_36MHz_HSI
+ SetSysClockTo36MHSI();
+#elif defined SYSCLK_FREQ_48MHz_HSI
+ SetSysClockTo48MHSI();
+#elif defined SYSCLK_FREQ_56MHz_HSI
+ SetSysClockTo56MHSI();
+#elif defined SYSCLK_FREQ_72MHz_HSI
+ SetSysClockTo72MHSI();
+#elif defined SYSCLK_FREQ_96MHz_HSI
+ SetSysClockTo96MHSI();
+#elif defined SYSCLK_FREQ_108MHz_HSI
+ SetSysClockTo108MHSI();
+#elif defined SYSCLK_FREQ_120MHz_HSI
+ SetSysClockTo120MHSI();
+#elif defined SYSCLK_FREQ_144MHz_HSI
+ SetSysClockTo144MHSI();
+#elif defined SYSCLK_FREQ_150MHz_HSI
+ SetSysClockTo150MHSI();
+#elif defined SYSCLK_FREQ_168MHz_HSI
+ SetSysClockTo168MHSI();
+#elif defined SYSCLK_FREQ_176MHz_HSI
+ SetSysClockTo176MHSI();
+#elif defined SYSCLK_FREQ_192MHz_HSI
+ SetSysClockTo192MHSI();
+#elif defined SYSCLK_FREQ_200MHz_HSI
+ SetSysClockTo200MHSI();
+#elif defined SYSCLK_FREQ_224MHz_HSI
+ SetSysClockTo224MHSI();
+#elif defined SYSCLK_FREQ_240MHz_HSI
+ SetSysClockTo240MHSI();
+#endif
+
+ /* If none of the define above is enabled, the HSI is used as System clock
+ source (default after reset) */
+}
+
+/**
+ * @brief Setup the external memory controller. Called in startup_at32f4xx.s
+ * before jump to __main
+ * @param None
+ * @retval None
+ */
+#ifdef DATA_IN_ExtSRAM
+/**
+ * @brief Setup the external memory controller.
+ * Called in startup_at32f4xx_xx.s/.c before jump to main.
+ * This function configures the external SRAM mounted
+ * (AT32 High density devices). This SRAM will be used as program
+ * data memory (including heap and stack).
+ * @param None
+ * @retval None
+ */
+void SystemInit_ExtMemCtrl(void)
+{
+ /* Enable XMC clock */
+ RCC->AHBEN = RCC_AHBEN_SRAMEN | RCC_AHBEN_FLASHEN | RCC_AHBEN_XMCEN;
+
+ /* Enable GPIOD, GPIOE, GPIOF and GPIOG clocks */
+ RCC->APB2EN = RCC_APB2EN_GPIODEN | RCC_APB2EN_GPIOEEN | RCC_APB2EN_GPIOFEN | RCC_APB2EN_GPIOGEN;
+
+ /* --------------- SRAM Data lines, NOE and NWE configuration ---------------*/
+ /*---------------- SRAM Address lines configuration -------------------------*/
+ /*---------------- NOE and NWE configuration --------------------------------*/
+ /*---------------- NE3 configuration ----------------------------------------*/
+ /*---------------- NBL0, NBL1 configuration ---------------------------------*/
+
+ GPIOD->CTRLL = 0x44BB44BB;
+ GPIOD->CTRLH = 0xBBBBBBBB;
+
+ GPIOE->CTRLL = 0xB44444BB;
+ GPIOE->CTRLH = 0xBBBBBBBB;
+
+ GPIOF->CTRLL = 0x44BBBBBB;
+ GPIOF->CTRLH = 0xBBBB4444;
+
+ GPIOG->CTRLL = 0x44BBBBBB;
+ GPIOG->CTRLH = 0x44444B44;
+
+ /*---------------- XMC Configuration ---------------------------------------*/
+ /*---------------- Enable XMC Bank1_SRAM Bank ------------------------------*/
+
+ XMC_Bank1->BK1CTRLR[4] = 0x00001011;
+ XMC_Bank1->BK1CTRLR[5] = 0x00000200;
+}
+#endif /* DATA_IN_ExtSRAM */
+
+#ifndef SYSCLK_FREQ_HSI
+#ifdef AT32F403xx
+/**
+ * @brief Delay to wait for HSE stable.
+ * @note This function should be used before reading the HSESTBL flag.
+ * @param None
+ * @retval None
+ */
+static void WaitHseStbl(uint32_t delay)
+{
+ uint32_t i;
+
+ for(i = 0; i < delay; i++)
+ ;
+}
+#endif
+#endif /* SYSCLK_FREQ_HSI */
+
+#ifdef SYSCLK_FREQ_HSE
+/**
+ * @brief Selects HSE as System clock source and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockToHSE(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_0;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV1;
+
+ /* Select HSE as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_HSE;
+
+ /* Wait till HSE is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != (uint32_t)0x04)
+ {
+ }
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+#elif defined SYSCLK_FREQ_24MHz
+/**
+ * @brief Sets System clock frequency to 24MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo24M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_0;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV1;
+
+ /* PLL configuration: = (HSE / 2) * 6 = 24 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLHSEPSC_HSE_DIV2 | RCC_CFG_PLLMULT6);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+#elif defined SYSCLK_FREQ_36MHz
+/**
+ * @brief Sets System clock frequency to 36MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo36M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV1;
+
+ /* PLL configuration: PLLCLK = (HSE / 2) * 9 = 36 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLHSEPSC_HSE_DIV2 | RCC_CFG_PLLMULT9);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+#elif defined SYSCLK_FREQ_48MHz
+/**
+ * @brief Sets System clock frequency to 48MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo48M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 6 = 48 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT6);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_56MHz
+/**
+ * @brief Sets System clock frequency to 56MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo56M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 7 = 56 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT7);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_72MHz
+/**
+ * @brief Sets System clock frequency to 72MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo72M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_2;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 9 = 72 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT9);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_96MHz
+/**
+ * @brief Sets System clock frequency to 96MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo96M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_2;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 12 = 96 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT12);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT12 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_108MHz
+/**
+ * @brief Sets System clock frequency to 108MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo108M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_3;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSE/2) * 27 = 108 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLHSEPSC_HSE_DIV2 | RCC_CFG_PLLMULT27);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLHSEPSC_HSE_DIV2 | RCC_CFG_PLLMULT27 \
+ | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_120MHz
+/**
+ * @brief Sets System clock frequency to 120MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo120M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_3;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 15 = 120 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT15);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT15 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_144MHz
+/**
+ * @brief Sets System clock frequency to 144MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo144M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_4;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 18 = 144 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT18);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT18 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_150MHz
+/**
+ * @brief Sets System clock frequency to 150MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo150M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_4;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSE * 75) / (1 * 4) = 150 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE);
+ RCC_PLLconfig2(PLL_FREF_8M, 75, 1, PLL_FR_4);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_168MHz
+/**
+ * @brief Sets System clock frequency to 168MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo168M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 21 = 168 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT21 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_176MHz
+/**
+ * @brief Sets System clock frequency to 176MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo176M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 22 = 176 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT22 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_192MHz
+/**
+ * @brief Sets System clock frequency to 192MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo192M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 24 = 192 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT24 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_200MHz
+/**
+ * @brief Sets System clock frequency to 200MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo200M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 25 = 200 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT25 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_224MHz
+/**
+ * @brief Sets System clock frequency to 224MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo224M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 28 = 224 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT28 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_240MHz
+/**
+ * @brief Sets System clock frequency to 240MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo240M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 30 = 240 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT30 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_24MHz_HSI
+/**
+ * @brief Sets System clock frequency to 24MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo24MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_0;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV1;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 6 = 24 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT6);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_36MHz_HSI
+/**
+ * @brief Sets System clock frequency to 36MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo36MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV1;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 9 = 36 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT9);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_48MHz_HSI
+/**
+ * @brief Sets System clock frequency to 48MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo48MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 12 = 48 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT12);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_56MHz_HSI
+/**
+ * @brief Sets System clock frequency to 56MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo56MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 14 = 56 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT14);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_72MHz_HSI
+/**
+ * @brief Sets System clock frequency to 72MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo72MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_2;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 18 = 72 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT18);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_96MHz_HSI
+/**
+ * @brief Sets System clock frequency to 96MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo96MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_2;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 24 = 96 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT24);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT24 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_108MHz_HSI
+/**
+ * @brief Sets System clock frequency to 108MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo108MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_3;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 27 = 108 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT27);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT27 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_120MHz_HSI
+/**
+ * @brief Sets System clock frequency to 120MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo120MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_3;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 30 = 120 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT30);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT30 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_144MHz_HSI
+/**
+ * @brief Sets System clock frequency to 144MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo144MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_4;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 36 = 144 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT36);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT36 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_150MHz_HSI
+/**
+ * @brief Sets System clock frequency to 150MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo150MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_4;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = ((HSI/2) * 150) / (1 * 4) = 150 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2);
+ RCC_PLLconfig2(PLL_FREF_4M, 150, 1, PLL_FR_4);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_168MHz_HSI
+/**
+ * @brief Sets System clock frequency to 168MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo168MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 42 = 168 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT42 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+#elif defined SYSCLK_FREQ_176MHz_HSI
+/**
+ * @brief Sets System clock frequency to 176MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo176MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 44 = 176 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT44 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+#elif defined SYSCLK_FREQ_192MHz_HSI
+/**
+ * @brief Sets System clock frequency to 192MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo192MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 48 = 192 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT48 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+#elif defined SYSCLK_FREQ_200MHz_HSI
+/**
+ * @brief Sets System clock frequency to 200MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo200MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 50 = 200 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT50 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_224MHz_HSI
+/**
+ * @brief Sets System clock frequency to 224MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo224MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 56 = 224 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT56 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_240MHz_HSI
+/**
+ * @brief Sets System clock frequency to 240MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo240MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 60 = 240 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT60 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#endif
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/******************* (C) COPYRIGHT 2018 ArteryTek *****END OF FILE****/
diff --git a/bsp/es32f0654/libraries/CMSIS/Include/arm_common_tables.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/arm_common_tables.h
similarity index 100%
rename from bsp/es32f0654/libraries/CMSIS/Include/arm_common_tables.h
rename to bsp/at32/Libraries/AT32_Std_Driver/CMSIS/arm_common_tables.h
diff --git a/bsp/es32f0654/libraries/CMSIS/Include/arm_const_structs.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/arm_const_structs.h
similarity index 100%
rename from bsp/es32f0654/libraries/CMSIS/Include/arm_const_structs.h
rename to bsp/at32/Libraries/AT32_Std_Driver/CMSIS/arm_const_structs.h
diff --git a/bsp/es32f0654/libraries/CMSIS/Include/arm_math.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/arm_math.h
similarity index 100%
rename from bsp/es32f0654/libraries/CMSIS/Include/arm_math.h
rename to bsp/at32/Libraries/AT32_Std_Driver/CMSIS/arm_math.h
diff --git a/bsp/es32f0654/libraries/CMSIS/Include/cmsis_armcc.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/cmsis_armcc.h
similarity index 100%
rename from bsp/es32f0654/libraries/CMSIS/Include/cmsis_armcc.h
rename to bsp/at32/Libraries/AT32_Std_Driver/CMSIS/cmsis_armcc.h
diff --git a/bsp/es32f0654/libraries/CMSIS/Include/cmsis_armcc_V6.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/cmsis_armcc_V6.h
similarity index 100%
rename from bsp/es32f0654/libraries/CMSIS/Include/cmsis_armcc_V6.h
rename to bsp/at32/Libraries/AT32_Std_Driver/CMSIS/cmsis_armcc_V6.h
diff --git a/bsp/es32f0654/libraries/CMSIS/Include/cmsis_gcc.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/cmsis_gcc.h
similarity index 100%
rename from bsp/es32f0654/libraries/CMSIS/Include/cmsis_gcc.h
rename to bsp/at32/Libraries/AT32_Std_Driver/CMSIS/cmsis_gcc.h
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/cmsis_iar.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/cmsis_iar.h
new file mode 100644
index 0000000000000000000000000000000000000000..a11b2fbae78f24e4b0374d4bf9385d0fcaab9b4c
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/cmsis_iar.h
@@ -0,0 +1,266 @@
+/**************************************************
+ *
+ * This file shall be included in appropriate CMSIS header
+ * files, to provide required functions and intrinsics when
+ * building with the IAR C/C++ Compiler for ARM (iccarm).
+ *
+ * Copyright 2011 IAR Systems. All rights reserved.
+ *
+ * $Revision: 78346 $
+ *
+ **************************************************/
+
+#ifndef __CMSIS_IAR_H__
+#define __CMSIS_IAR_H__
+
+#ifndef __ICCARM__
+ #error This file should only be compiled by ICCARM
+#endif
+
+#pragma system_include
+
+#include
+
+#if (__CORE__ == __ARM6M__)
+ /* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */
+ #define __CLZ __cmsis_iar_clz
+ #define __SSAT __cmsis_iar_ssat
+#endif
+
+#pragma diag_suppress=Pe940
+#pragma diag_suppress=Pe177
+
+#define __enable_irq __enable_interrupt
+#define __disable_irq __disable_interrupt
+#define __NOP __no_operation
+
+#if (__VER__ >= 6040000) /* If iccarm version is 6.40.x or newer ---------- */
+
+#define __BKPT(value) asm volatile ("BKPT\t%0" : : "i"(value))
+
+#endif
+
+#if (__VER__ < 6020000) /* If iccarm version is older than 6.20.0 ---------- */
+
+#if (__VER__ < 6010002) /* If iccarm version is older than 6.10.2 ---------- */
+
+static uint32_t __get_APSR(void)
+{
+ __ASM("mrs r0, apsr");
+}
+
+static uint32_t __get_xPSR(void)
+{
+ __ASM("mrs r0, psr"); /* assembler does not know "xpsr" */
+}
+
+#endif /* __VER__ < 6010002 */
+
+static uint32_t __get_IPSR(void)
+{
+ __ASM("mrs r0, ipsr");
+}
+
+static uint32_t __get_PSR(void)
+{
+ __ASM("mrs r0, psr");
+}
+
+static uint32_t __get_PSP(void)
+{
+ __ASM("mrs r0, psp");
+}
+
+static void __set_PSP(uint32_t topOfProcStack)
+{
+ __ASM("msr psp, r0");
+}
+
+static uint32_t __get_MSP(void)
+{
+ __ASM("mrs r0, msp");
+}
+
+static void __set_MSP(uint32_t topOfMainStack)
+{
+ __ASM("msr msp, r0");
+}
+
+static __INLINE void __WFI(void)
+{
+ __ASM ("wfi");
+}
+
+static __INLINE void __WFE(void)
+{
+ __ASM ("wfe");
+}
+
+static __INLINE void __SEV(void)
+{
+ __ASM ("sev");
+}
+
+static uint32_t __REV16(uint32_t value)
+{
+ __ASM("rev16 r0, r0");
+}
+
+#else /* __VER__ < 6020000 */
+
+static uint32_t __get_xPSR(void)
+{
+ return __get_PSR(); /* __get_PSR() intrinsic introduced in iccarm 6.20 */
+}
+
+#endif /* __VER__ < 6020000 */
+
+#if (__CORTEX_M >= 0x03) /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */
+
+#if (__VER__ < 6020000) /* If iccarm version is older than 6.20.0 ---------- */
+
+static __INLINE void __enable_fault_irq(void)
+{
+ __ASM ("cpsie f");
+}
+
+static __INLINE void __disable_fault_irq(void)
+{
+ __ASM ("cpsid f");
+}
+
+static uint32_t __RBIT(uint32_t value)
+{
+ __ASM("rbit r0, r0");
+}
+
+static uint8_t __LDREXB(volatile uint8_t *addr)
+{
+ __ASM("ldrexb r0, [r0]");
+}
+
+static uint16_t __LDREXH(volatile uint16_t *addr)
+{
+ __ASM("ldrexh r0, [r0]");
+}
+
+static uint32_t __LDREXW(volatile uint32_t *addr)
+{
+ __ASM("ldrex r0, [r0]");
+}
+
+static uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
+{
+ __ASM("strexb r0, r0, [r1]");
+}
+
+static uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
+{
+ __ASM("strexh r0, r0, [r1]");
+}
+
+static uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
+{
+ __ASM("strex r0, r0, [r1]");
+}
+
+static __INLINE void __CLREX(void)
+{
+ __ASM ("clrex");
+}
+
+#else /* __VER__ >= 6020000 --------------------- */
+
+#define __LDREXW __LDREX
+#define __STREXW __STREX
+#define __enable_fault_irq __enable_fiq
+#define __disable_fault_irq __disable_fiq
+
+#endif /* __VER__ < 6020000 */
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+#if (__CORTEX_M == 0x04) /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */
+
+#if (__VER__ < 6020000) /* If iccarm version is older than 6.20.0 ---------- */
+
+static uint32_t __get_FPSCR(void)
+{
+#if (__FPU_PRESENT == 1) /* __FPU_PRESENT is defined in the device header file, if present in current device. */
+ __ASM("vmrs r0, fpscr");
+#else
+ return(0);
+#endif
+}
+
+static void __set_FPSCR(uint32_t fpscr)
+{
+#if (__FPU_PRESENT == 1) /* __FPU_PRESENT is defined in the device header file, if present in current device. */
+ __ASM("vmsr fpscr, r0");
+#endif
+}
+
+#endif /* __VER__ < 6020000 */
+
+#endif /* (__CORTEX_M == 0x04) */
+
+#if (__VER__ >= 7000000) /* If iccarm version is 7.x or newer ---------- */
+
+#if (__CORTEX_M >= 0x03) /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */
+
+static __INLINE uint32_t __RRX(uint32_t value)
+{
+ uint32_t result;
+ __ASM("RRX %0, %1" : "=r"(result) : "r" (value) );
+ return(result);
+}
+
+static __INLINE uint8_t __LDRBT(volatile uint8_t *addr)
+{
+ uint32_t result;
+ __ASM("LDRBT %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+ return ((uint8_t) result);
+}
+
+static __INLINE uint16_t __LDRHT(volatile uint16_t *addr)
+{
+ uint32_t result;
+ __ASM("LDRHT %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+ return ((uint16_t) result);
+}
+
+static __INLINE uint32_t __LDRT(volatile uint32_t *addr)
+{
+ uint32_t result;
+ __ASM("LDRT %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+ return(result);
+}
+
+static __INLINE void __STRBT(uint8_t value, volatile uint8_t *addr)
+{
+ __ASM("STRBT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory" );
+}
+
+static __INLINE void __STRHT(uint16_t value, volatile uint16_t *addr)
+{
+ __ASM("STRHT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory" );
+}
+
+static __INLINE void __STRT(uint32_t value, volatile uint32_t *addr)
+{
+ __ASM("STRT %1, [%0]" : : "r" (addr), "r" (value) : "memory" );
+}
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+#endif /* __VER__ >= 7000000 */
+
+static __INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
+{
+ return (op1 >> op2) | (op1 << ((sizeof(op1)*8)-op2));
+}
+
+#pragma diag_default=Pe940
+#pragma diag_default=Pe177
+
+#endif /* __CMSIS_IAR_H__ */
diff --git a/bsp/es32f0654/libraries/CMSIS/Include/core_cm4.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/core_cm4.h
similarity index 100%
rename from bsp/es32f0654/libraries/CMSIS/Include/core_cm4.h
rename to bsp/at32/Libraries/AT32_Std_Driver/CMSIS/core_cm4.h
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/core_cmFunc.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/core_cmFunc.h
new file mode 100644
index 0000000000000000000000000000000000000000..652a48af07a93d9a48ea9bfa818eebd6429045da
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/core_cmFunc.h
@@ -0,0 +1,87 @@
+/**************************************************************************//**
+ * @file core_cmFunc.h
+ * @brief CMSIS Cortex-M Core Function Access Header File
+ * @version V4.30
+ * @date 20. October 2015
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2015 ARM LIMITED
+
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ - Neither the name of ARM nor the names of its contributors may be used
+ to endorse or promote products derived from this software without
+ specific prior written permission.
+ *
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ ---------------------------------------------------------------------------*/
+
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CMFUNC_H
+#define __CORE_CMFUNC_H
+
+
+/* ########################### Core Function Access ########################### */
+/** \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
+ @{
+*/
+
+/*------------------ RealView Compiler -----------------*/
+#if defined ( __CC_ARM )
+ #include "cmsis_armcc.h"
+
+/*------------------ ARM Compiler V6 -------------------*/
+#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #include "cmsis_armcc_V6.h"
+
+/*------------------ GNU Compiler ----------------------*/
+#elif defined ( __GNUC__ )
+ #include "cmsis_gcc.h"
+
+/*------------------ ICC Compiler ----------------------*/
+#elif defined ( __ICCARM__ )
+ #include
+
+/*------------------ TI CCS Compiler -------------------*/
+#elif defined ( __TMS470__ )
+ #include
+
+/*------------------ TASKING Compiler ------------------*/
+#elif defined ( __TASKING__ )
+ /*
+ * The CMSIS functions have been implemented as intrinsics in the compiler.
+ * Please use "carm -?i" to get an up to date list of all intrinsics,
+ * Including the CMSIS ones.
+ */
+
+/*------------------ COSMIC Compiler -------------------*/
+#elif defined ( __CSMC__ )
+ #include
+
+#endif
+
+/*@} end of CMSIS_Core_RegAccFunctions */
+
+#endif /* __CORE_CMFUNC_H */
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/core_cmInstr.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/core_cmInstr.h
new file mode 100644
index 0000000000000000000000000000000000000000..f474b0e6f362c73223e59af36ad30d2b87b9a61d
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/core_cmInstr.h
@@ -0,0 +1,87 @@
+/**************************************************************************//**
+ * @file core_cmInstr.h
+ * @brief CMSIS Cortex-M Core Instruction Access Header File
+ * @version V4.30
+ * @date 20. October 2015
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2015 ARM LIMITED
+
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ - Neither the name of ARM nor the names of its contributors may be used
+ to endorse or promote products derived from this software without
+ specific prior written permission.
+ *
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ ---------------------------------------------------------------------------*/
+
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CMINSTR_H
+#define __CORE_CMINSTR_H
+
+
+/* ########################## Core Instruction Access ######################### */
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
+ Access to dedicated instructions
+ @{
+*/
+
+/*------------------ RealView Compiler -----------------*/
+#if defined ( __CC_ARM )
+ #include "cmsis_armcc.h"
+
+/*------------------ ARM Compiler V6 -------------------*/
+#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #include "cmsis_armcc_V6.h"
+
+/*------------------ GNU Compiler ----------------------*/
+#elif defined ( __GNUC__ )
+ #include "cmsis_gcc.h"
+
+/*------------------ ICC Compiler ----------------------*/
+#elif defined ( __ICCARM__ )
+ #include
+
+/*------------------ TI CCS Compiler -------------------*/
+#elif defined ( __TMS470__ )
+ #include
+
+/*------------------ TASKING Compiler ------------------*/
+#elif defined ( __TASKING__ )
+ /*
+ * The CMSIS functions have been implemented as intrinsics in the compiler.
+ * Please use "carm -?i" to get an up to date list of all intrinsics,
+ * Including the CMSIS ones.
+ */
+
+/*------------------ COSMIC Compiler -------------------*/
+#elif defined ( __CSMC__ )
+ #include
+
+#endif
+
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
+
+#endif /* __CORE_CMINSTR_H */
diff --git a/bsp/es32f0654/libraries/CMSIS/Include/core_cmSimd.h b/bsp/at32/Libraries/AT32_Std_Driver/CMSIS/core_cmSimd.h
similarity index 100%
rename from bsp/es32f0654/libraries/CMSIS/Include/core_cmSimd.h
rename to bsp/at32/Libraries/AT32_Std_Driver/CMSIS/core_cmSimd.h
diff --git a/bsp/at32/Libraries/AT32_Std_Driver/SConscript b/bsp/at32/Libraries/AT32_Std_Driver/SConscript
new file mode 100644
index 0000000000000000000000000000000000000000..fd6b012d0a7d82ecc0c27c5bffb74bcf9df8327f
--- /dev/null
+++ b/bsp/at32/Libraries/AT32_Std_Driver/SConscript
@@ -0,0 +1,46 @@
+import rtconfig
+from building import *
+
+# get current directory
+cwd = GetCurrentDir()
+
+# The set of source files associated with this SConscript file.
+src = Split("""
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_adc.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_can.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_crc.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_dbgmcu.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_dma.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_exti.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_flash.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_gpio.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_i2c.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_iwdg.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_pwr.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_rcc.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_spi.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_tim.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_usart.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_wwdg.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_sdio.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_acc.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_bkp.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_rtc.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_ertc.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_eth.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_xmc.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_comp.c
+AT32F4xx_StdPeriph_Driver/src/at32f4xx_dac.c
+AT32F4xx_StdPeriph_Driver/src/misc.c
+""")
+
+path = [
+ cwd + '/CMSIS/AT32/AT32F4xx/inc',
+ cwd + '/CMSIS',
+ cwd + '/AT32F4xx_StdPeriph_Driver/inc',]
+
+CPPDEFINES = ['USE_STDPERIPH_DRIVER']
+
+group = DefineGroup('AT32_Lib', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
+
+Return('group')
diff --git a/bsp/at32/Libraries/Kconfig b/bsp/at32/Libraries/Kconfig
new file mode 100644
index 0000000000000000000000000000000000000000..5d384b51ba2665374fdcda8bec2c721b53e30741
--- /dev/null
+++ b/bsp/at32/Libraries/Kconfig
@@ -0,0 +1,27 @@
+config SOC_FAMILY_AT32
+ bool
+
+config SOC_SERIES_AT32F403
+ bool
+ select ARCH_ARM_CORTEX_M4
+ select SOC_FAMILY_AT32
+
+config SOC_SERIES_AT32F413
+ bool
+ select ARCH_ARM_CORTEX_M4
+ select SOC_FAMILY_AT32
+
+config SOC_SERIES_AT32F415
+ bool
+ select ARCH_ARM_CORTEX_M4
+ select SOC_FAMILY_AT32
+
+config SOC_SERIES_AT32F403A
+ bool
+ select ARCH_ARM_CORTEX_M4
+ select SOC_FAMILY_AT32
+
+config SOC_SERIES_AT32F407
+ bool
+ select ARCH_ARM_CORTEX_M4
+ select SOC_FAMILY_AT32
diff --git a/bsp/at32/Libraries/rt_drivers/SConscript b/bsp/at32/Libraries/rt_drivers/SConscript
new file mode 100644
index 0000000000000000000000000000000000000000..76df6014922bd70cb3b0445faa733e5617972ac8
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/SConscript
@@ -0,0 +1,53 @@
+# RT-Thread building script for component
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+cwd = GetCurrentDir()
+
+# add the general drivers.
+src = Split("""
+""")
+
+if GetDepend(['RT_USING_PIN']):
+ src += ['drv_gpio.c']
+
+if GetDepend(['RT_USING_WDT']):
+ src += ['drv_wdt.c']
+
+if GetDepend(['BSP_USING_SERIAL']):
+ src += ['drv_usart.c']
+
+if GetDepend(['BSP_USING_PWM']):
+ src += ['drv_pwm.c']
+
+if GetDepend(['BSP_USING_HWTIMER']):
+ src += ['drv_hwtimer.c']
+
+if GetDepend(['BSP_USING_SPI']):
+ src += ['drv_spi.c']
+
+if GetDepend(['RT_USING_I2C', 'RT_USING_I2C_BITOPS']):
+ if GetDepend('BSP_USING_I2C1') or GetDepend('BSP_USING_I2C2') or GetDepend('BSP_USING_I2C3') or GetDepend('BSP_USING_I2C4'):
+ src += ['drv_soft_i2c.c']
+
+if GetDepend(['BSP_USING_ADC']):
+ src += Glob('drv_adc.c')
+
+if GetDepend('BSP_USING_SRAM'):
+ src += ['drv_sram.c']
+
+if GetDepend('BSP_USING_ONCHIP_RTC'):
+ src += ['drv_rtc.c']
+
+if GetDepend(['BSP_USING_WDT']):
+ src += ['drv_wdt.c']
+
+if GetDepend(['BSP_USING_SDIO']):
+ src += ['drv_sdio.c']
+
+CPPPATH = [cwd]
+
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/at32/Libraries/rt_drivers/drv_adc.c b/bsp/at32/Libraries/rt_drivers/drv_adc.c
new file mode 100644
index 0000000000000000000000000000000000000000..02e7b602af78ba8d16b24456bb7b46b33bb66e1b
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_adc.c
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-15 Leo first version
+ */
+
+#include
+#include "drv_adc.h"
+
+#if defined(BSP_USING_ADC1) || defined(BSP_USING_ADC2) || defined(BSP_USING_ADC3)
+#define DRV_DEBUG
+#define LOG_TAG "drv.adc"
+#include
+
+struct at32_adc
+{
+ struct rt_adc_device at32_adc_device;
+ ADC_Type *ADC_Handler;
+ char *name;
+};
+
+static struct at32_adc at32_adc_obj[] =
+{
+#ifdef BSP_USING_ADC1
+ ADC1_CONFIG,
+#endif
+
+#ifdef BSP_USING_ADC2
+ ADC2_CONFIG,
+#endif
+
+#ifdef BSP_USING_ADC3
+ ADC3_CONFIG,
+#endif
+};
+
+static rt_uint32_t at32_adc_get_channel(rt_uint32_t channel)
+{
+ rt_uint32_t at32_channel = 0;
+
+ switch (channel)
+ {
+ case 0:
+ at32_channel = ADC_Channel_0;
+ break;
+ case 1:
+ at32_channel = ADC_Channel_1;
+ break;
+ case 2:
+ at32_channel = ADC_Channel_2;
+ break;
+ case 3:
+ at32_channel = ADC_Channel_3;
+ break;
+ case 4:
+ at32_channel = ADC_Channel_4;
+ break;
+ case 5:
+ at32_channel = ADC_Channel_5;
+ break;
+ case 6:
+ at32_channel = ADC_Channel_6;
+ break;
+ case 7:
+ at32_channel = ADC_Channel_7;
+ break;
+ case 8:
+ at32_channel = ADC_Channel_8;
+ break;
+ case 9:
+ at32_channel = ADC_Channel_9;
+ break;
+ case 10:
+ at32_channel = ADC_Channel_10;
+ break;
+ case 11:
+ at32_channel = ADC_Channel_11;
+ break;
+ case 12:
+ at32_channel = ADC_Channel_12;
+ break;
+ case 13:
+ at32_channel = ADC_Channel_13;
+ break;
+ case 14:
+ at32_channel = ADC_Channel_14;
+ break;
+ case 15:
+ at32_channel = ADC_Channel_15;
+ break;
+ case 16:
+ at32_channel = ADC_Channel_16;
+ break;
+ case 17:
+ at32_channel = ADC_Channel_17;
+ break;
+ }
+
+ return at32_channel;
+}
+
+static rt_err_t at32_adc_enabled(struct rt_adc_device *device, rt_uint32_t channel, rt_bool_t enabled)
+{
+ ADC_Type *at32_adc_handler;
+ ADC_InitType ADC_InitStructure;
+ RT_ASSERT(device != RT_NULL);
+ at32_adc_handler = device->parent.user_data;
+
+ at32_msp_adc_init(at32_adc_handler);
+
+ /* ADCx configuration ------------------------------------------------------*/
+ ADC_StructInit(&ADC_InitStructure);
+ ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
+ ADC_InitStructure.ADC_ScanMode = DISABLE;
+ ADC_InitStructure.ADC_ContinuousMode = DISABLE;
+ ADC_InitStructure.ADC_ExternalTrig = ADC_ExternalTrig_None;
+ ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
+ ADC_InitStructure.ADC_NumOfChannel = 1;
+ ADC_Init(at32_adc_handler, &ADC_InitStructure);
+
+ /* ADCx regular channels configuration */
+ ADC_RegularChannelConfig(at32_adc_handler, at32_adc_get_channel(channel), 1, ADC_SampleTime_28_5);
+
+ /* Enable ADCx */
+ ADC_Ctrl(at32_adc_handler, ENABLE);
+
+ /* Enable ADCx reset calibration register */
+ ADC_RstCalibration(at32_adc_handler);
+ /* Check the end of ADCx reset calibration register */
+ while(ADC_GetResetCalibrationStatus(at32_adc_handler));
+
+ /* Start ADCx calibration */
+ ADC_StartCalibration(at32_adc_handler);
+ /* Check the end of ADCx calibration */
+ while(ADC_GetCalibrationStatus(at32_adc_handler));
+
+ if (enabled)
+ {
+ /* Enable ADC1 */
+ ADC_Ctrl(at32_adc_handler, ENABLE);
+ }
+ else
+ {
+ /* Enable ADCx */
+ ADC_Ctrl(at32_adc_handler, DISABLE);
+ }
+
+ return RT_EOK;
+}
+
+static rt_err_t at32_get_adc_value(struct rt_adc_device *device, rt_uint32_t channel, rt_uint32_t *value)
+{
+ ADC_Type *at32_adc_handler;
+
+ RT_ASSERT(device != RT_NULL);
+ RT_ASSERT(value != RT_NULL);
+
+ at32_adc_handler = device->parent.user_data;
+
+ /* Start ADCx Software Conversion */
+ ADC_SoftwareStartConvCtrl(at32_adc_handler, ENABLE);
+
+ /* Wait for the ADC to convert */
+ while(ADC_GetFlagStatus(at32_adc_handler, ADC_FLAG_EC) == RESET);
+
+ /* get ADC value */
+ *value = ADC_GetConversionValue(at32_adc_handler);
+
+ return RT_EOK;
+}
+
+static const struct rt_adc_ops at_adc_ops =
+{
+ .enabled = at32_adc_enabled,
+ .convert = at32_get_adc_value,
+};
+
+static int rt_hw_adc_init(void)
+{
+ int result = RT_EOK;
+ int i = 0;
+
+ for (i = 0; i < sizeof(at32_adc_obj) / sizeof(at32_adc_obj[0]); i++)
+ {
+ /* register ADC device */
+ if (rt_hw_adc_register(&at32_adc_obj[i].at32_adc_device, at32_adc_obj[i].name, &at_adc_ops, at32_adc_obj[i].ADC_Handler) == RT_EOK)
+ {
+ LOG_D("%s register success", at32_adc_obj[i].name);
+ }
+ else
+ {
+ LOG_E("%s register failed", at32_adc_obj[i].name);
+ result = -RT_ERROR;
+ }
+
+ }
+
+ return result;
+}
+INIT_BOARD_EXPORT(rt_hw_adc_init);
+
+#endif /* BSP_USING_ADC */
diff --git a/bsp/at32/Libraries/rt_drivers/drv_adc.h b/bsp/at32/Libraries/rt_drivers/drv_adc.h
new file mode 100644
index 0000000000000000000000000000000000000000..d113d1338af9cf6dcde41da925941ab379c4213c
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_adc.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2018-12-07 Leo first version
+ */
+
+#ifndef __ADC_CONFIG_H__
+#define __ADC_CONFIG_H__
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(BSP_USING_ADC1) || defined(BSP_USING_ADC2) || defined(BSP_USING_ADC3)
+
+#ifndef ADC1_CONFIG
+#define ADC1_CONFIG \
+ { \
+ .ADC_Handler = ADC1, \
+ .name = "adc1", \
+ }
+#endif /* ADC1_CONFIG */
+
+#ifndef ADC2_CONFIG
+#define ADC2_CONFIG \
+ { \
+ .ADC_Handler = ADC2, \
+ .name = "adc2", \
+ }
+#endif /* ADC2_CONFIG */
+
+#ifndef ADC3_CONFIG
+#define ADC3_CONFIG \
+ { \
+ .ADC_Handler = ADC3, \
+ .name = "adc3", \
+ }
+#endif /* ADC3_CONFIG */
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ADC_CONFIG_H__ */
diff --git a/bsp/at32/Libraries/rt_drivers/drv_gpio.c b/bsp/at32/Libraries/rt_drivers/drv_gpio.c
new file mode 100644
index 0000000000000000000000000000000000000000..8ea3f83f43cb26406bad1f76b45ecd9153b65594
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_gpio.c
@@ -0,0 +1,639 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-07 shelton first version
+ */
+
+#include
+#include "drv_gpio.h"
+
+#ifdef RT_USING_PIN
+
+static const struct pin_index pins[] =
+{
+#if defined(GPIOA)
+ __AT32_PIN(0 , A, 0 ),
+ __AT32_PIN(1 , A, 1 ),
+ __AT32_PIN(2 , A, 2 ),
+ __AT32_PIN(3 , A, 3 ),
+ __AT32_PIN(4 , A, 4 ),
+ __AT32_PIN(5 , A, 5 ),
+ __AT32_PIN(6 , A, 6 ),
+ __AT32_PIN(7 , A, 7 ),
+ __AT32_PIN(8 , A, 8 ),
+ __AT32_PIN(9 , A, 9 ),
+ __AT32_PIN(10, A, 10),
+ __AT32_PIN(11, A, 11),
+ __AT32_PIN(12, A, 12),
+ __AT32_PIN(13, A, 13),
+ __AT32_PIN(14, A, 14),
+ __AT32_PIN(15, A, 15),
+#if defined(GPIOB)
+ __AT32_PIN(16, B, 0),
+ __AT32_PIN(17, B, 1),
+ __AT32_PIN(18, B, 2),
+ __AT32_PIN(19, B, 3),
+ __AT32_PIN(20, B, 4),
+ __AT32_PIN(21, B, 5),
+ __AT32_PIN(22, B, 6),
+ __AT32_PIN(23, B, 7),
+ __AT32_PIN(24, B, 8),
+ __AT32_PIN(25, B, 9),
+ __AT32_PIN(26, B, 10),
+ __AT32_PIN(27, B, 11),
+ __AT32_PIN(28, B, 12),
+ __AT32_PIN(29, B, 13),
+ __AT32_PIN(30, B, 14),
+ __AT32_PIN(31, B, 15),
+#if defined(GPIOC)
+ __AT32_PIN(32, C, 0),
+ __AT32_PIN(33, C, 1),
+ __AT32_PIN(34, C, 2),
+ __AT32_PIN(35, C, 3),
+ __AT32_PIN(36, C, 4),
+ __AT32_PIN(37, C, 5),
+ __AT32_PIN(38, C, 6),
+ __AT32_PIN(39, C, 7),
+ __AT32_PIN(40, C, 8),
+ __AT32_PIN(41, C, 9),
+ __AT32_PIN(42, C, 10),
+ __AT32_PIN(43, C, 11),
+ __AT32_PIN(44, C, 12),
+ __AT32_PIN(45, C, 13),
+ __AT32_PIN(46, C, 14),
+ __AT32_PIN(47, C, 15),
+#if defined(GPIOD)
+ __AT32_PIN(48, D, 0),
+ __AT32_PIN(49, D, 1),
+ __AT32_PIN(50, D, 2),
+ __AT32_PIN(51, D, 3),
+ __AT32_PIN(52, D, 4),
+ __AT32_PIN(53, D, 5),
+ __AT32_PIN(54, D, 6),
+ __AT32_PIN(55, D, 7),
+ __AT32_PIN(56, D, 8),
+ __AT32_PIN(57, D, 9),
+ __AT32_PIN(58, D, 10),
+ __AT32_PIN(59, D, 11),
+ __AT32_PIN(60, D, 12),
+ __AT32_PIN(61, D, 13),
+ __AT32_PIN(62, D, 14),
+ __AT32_PIN(63, D, 15),
+#if defined(GPIOE)
+ __AT32_PIN(64, E, 0),
+ __AT32_PIN(65, E, 1),
+ __AT32_PIN(66, E, 2),
+ __AT32_PIN(67, E, 3),
+ __AT32_PIN(68, E, 4),
+ __AT32_PIN(69, E, 5),
+ __AT32_PIN(70, E, 6),
+ __AT32_PIN(71, E, 7),
+ __AT32_PIN(72, E, 8),
+ __AT32_PIN(73, E, 9),
+ __AT32_PIN(74, E, 10),
+ __AT32_PIN(75, E, 11),
+ __AT32_PIN(76, E, 12),
+ __AT32_PIN(77, E, 13),
+ __AT32_PIN(78, E, 14),
+ __AT32_PIN(79, E, 15),
+#if defined(GPIOF)
+ __AT32_PIN(80, F, 0),
+ __AT32_PIN(81, F, 1),
+ __AT32_PIN(82, F, 2),
+ __AT32_PIN(83, F, 3),
+ __AT32_PIN(84, F, 4),
+ __AT32_PIN(85, F, 5),
+ __AT32_PIN(86, F, 6),
+ __AT32_PIN(87, F, 7),
+ __AT32_PIN(88, F, 8),
+ __AT32_PIN(89, F, 9),
+ __AT32_PIN(90, F, 10),
+ __AT32_PIN(91, F, 11),
+ __AT32_PIN(92, F, 12),
+ __AT32_PIN(93, F, 13),
+ __AT32_PIN(94, F, 14),
+ __AT32_PIN(95, F, 15),
+#if defined(GPIOG)
+ __AT32_PIN(96, G, 0),
+ __AT32_PIN(97, G, 1),
+ __AT32_PIN(98, G, 2),
+ __AT32_PIN(99, G, 3),
+ __AT32_PIN(100, G, 4),
+ __AT32_PIN(101, G, 5),
+ __AT32_PIN(102, G, 6),
+ __AT32_PIN(103, G, 7),
+ __AT32_PIN(104, G, 8),
+ __AT32_PIN(105, G, 9),
+ __AT32_PIN(106, G, 10),
+ __AT32_PIN(107, G, 11),
+ __AT32_PIN(108, G, 12),
+ __AT32_PIN(109, G, 13),
+ __AT32_PIN(110, G, 14),
+ __AT32_PIN(111, G, 15),
+#endif /* defined(GPIOG) */
+#endif /* defined(GPIOF) */
+#endif /* defined(GPIOE) */
+#endif /* defined(GPIOD) */
+#endif /* defined(GPIOC) */
+#endif /* defined(GPIOB) */
+#endif /* defined(GPIOA) */
+};
+
+static const struct pin_irq_map pin_irq_map[] =
+{
+ {GPIO_Pins_0, EXTI_Line0, EXTI0_IRQn},
+ {GPIO_Pins_1, EXTI_Line1, EXTI1_IRQn},
+ {GPIO_Pins_2, EXTI_Line2, EXTI2_IRQn},
+ {GPIO_Pins_3, EXTI_Line3, EXTI3_IRQn},
+ {GPIO_Pins_4, EXTI_Line4, EXTI4_IRQn},
+ {GPIO_Pins_5, EXTI_Line5, EXTI9_5_IRQn},
+ {GPIO_Pins_6, EXTI_Line6, EXTI9_5_IRQn},
+ {GPIO_Pins_7, EXTI_Line7, EXTI9_5_IRQn},
+ {GPIO_Pins_8, EXTI_Line8, EXTI9_5_IRQn},
+ {GPIO_Pins_9, EXTI_Line9, EXTI9_5_IRQn},
+ {GPIO_Pins_10, EXTI_Line10, EXTI15_10_IRQn},
+ {GPIO_Pins_11, EXTI_Line11, EXTI15_10_IRQn},
+ {GPIO_Pins_12, EXTI_Line12, EXTI15_10_IRQn},
+ {GPIO_Pins_13, EXTI_Line13, EXTI15_10_IRQn},
+ {GPIO_Pins_14, EXTI_Line14, EXTI15_10_IRQn},
+ {GPIO_Pins_15, EXTI_Line15, EXTI15_10_IRQn},
+};
+
+static struct rt_pin_irq_hdr pin_irq_hdr_tab[] =
+{
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+};
+static uint32_t pin_irq_enable_mask=0;
+
+#define ITEM_NUM(items) sizeof(items) / sizeof(items[0])
+static const struct pin_index *get_pin(uint8_t pin)
+{
+ const struct pin_index *index;
+
+ if (pin < ITEM_NUM(pins))
+ {
+ index = &pins[pin];
+ if (index->index == -1)
+ index = RT_NULL;
+ }
+ else
+ {
+ index = RT_NULL;
+ }
+
+ return index;
+};
+
+static void at32_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value)
+{
+ const struct pin_index *index;
+
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return;
+ }
+
+ GPIO_WriteBit(index->gpio, index->pin, (BitState)value);
+}
+
+static int at32_pin_read(rt_device_t dev, rt_base_t pin)
+{
+ int value;
+ const struct pin_index *index;
+
+ value = PIN_LOW;
+
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return value;
+ }
+
+ value = GPIO_ReadInputDataBit(index->gpio, index->pin);
+
+ return value;
+}
+
+static void at32_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
+{
+ const struct pin_index *index;
+ GPIO_InitType GPIO_InitStruct;
+
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return;
+ }
+
+ /* Configure GPIO_InitStructure */
+ GPIO_StructInit(&GPIO_InitStruct);
+ GPIO_InitStruct.GPIO_Pins = index->pin;
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
+ GPIO_InitStruct.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
+
+ if (mode == PIN_MODE_OUTPUT)
+ {
+ /* output setting */
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
+ }
+ else if (mode == PIN_MODE_INPUT)
+ {
+ /* input setting: not pull. */
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+ }
+ else if (mode == PIN_MODE_INPUT_PULLUP)
+ {
+ /* input setting: pull up. */
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_PU;
+ }
+ else if (mode == PIN_MODE_INPUT_PULLDOWN)
+ {
+ /* input setting: pull down. */
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_PD;
+ }
+ else if (mode == PIN_MODE_OUTPUT_OD)
+ {
+ /* output setting: od. */
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_OD;
+ }
+
+ GPIO_Init(index->gpio, &GPIO_InitStruct);
+}
+
+rt_inline rt_int32_t bit2bitno(rt_uint32_t bit)
+{
+ int i;
+ for (i = 0; i < 32; i++)
+ {
+ if ((0x01 << i) == bit)
+ {
+ return i;
+ }
+ }
+ return -1;
+}
+
+rt_inline const struct pin_irq_map *get_pin_irq_map(uint32_t pinbit)
+{
+ rt_int32_t mapindex = bit2bitno(pinbit);
+ if (mapindex < 0 || mapindex >= ITEM_NUM(pin_irq_map))
+ {
+ return RT_NULL;
+ }
+ return &pin_irq_map[mapindex];
+};
+
+static rt_err_t at32_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
+ rt_uint32_t mode, void (*hdr)(void *args), void *args)
+{
+ const struct pin_index *index;
+ rt_base_t level;
+ rt_int32_t irqindex = -1;
+
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return RT_ENOSYS;
+ }
+ irqindex = bit2bitno(index->pin);
+ if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
+ {
+ return RT_ENOSYS;
+ }
+
+ level = rt_hw_interrupt_disable();
+ if (pin_irq_hdr_tab[irqindex].pin == pin &&
+ pin_irq_hdr_tab[irqindex].hdr == hdr &&
+ pin_irq_hdr_tab[irqindex].mode == mode &&
+ pin_irq_hdr_tab[irqindex].args == args)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EOK;
+ }
+ if (pin_irq_hdr_tab[irqindex].pin != -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EBUSY;
+ }
+ pin_irq_hdr_tab[irqindex].pin = pin;
+ pin_irq_hdr_tab[irqindex].hdr = hdr;
+ pin_irq_hdr_tab[irqindex].mode = mode;
+ pin_irq_hdr_tab[irqindex].args = args;
+ rt_hw_interrupt_enable(level);
+
+ return RT_EOK;
+}
+
+static rt_err_t at32_pin_dettach_irq(struct rt_device *device, rt_int32_t pin)
+{
+ const struct pin_index *index;
+ rt_base_t level;
+ rt_int32_t irqindex = -1;
+
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return RT_ENOSYS;
+ }
+ irqindex = bit2bitno(index->pin);
+ if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
+ {
+ return RT_ENOSYS;
+ }
+
+ level = rt_hw_interrupt_disable();
+ if (pin_irq_hdr_tab[irqindex].pin == -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EOK;
+ }
+ pin_irq_hdr_tab[irqindex].pin = -1;
+ pin_irq_hdr_tab[irqindex].hdr = RT_NULL;
+ pin_irq_hdr_tab[irqindex].mode = 0;
+ pin_irq_hdr_tab[irqindex].args = RT_NULL;
+ rt_hw_interrupt_enable(level);
+
+ return RT_EOK;
+}
+
+static rt_err_t at32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
+ rt_uint32_t enabled)
+{
+ GPIO_InitType GPIO_InitStruct;
+ EXTI_InitType EXTI_InitStruct;
+ NVIC_InitType NVIC_InitStruct;
+ const struct pin_index *index;
+ const struct pin_irq_map *irqmap;
+ rt_base_t level;
+ rt_int32_t irqindex = -1;
+
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return RT_ENOSYS;
+ }
+
+ if (enabled == PIN_IRQ_ENABLE)
+ {
+ irqindex = bit2bitno(index->pin);
+ if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
+ {
+ return RT_ENOSYS;
+ }
+
+ level = rt_hw_interrupt_disable();
+
+ if (pin_irq_hdr_tab[irqindex].pin == -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_ENOSYS;
+ }
+
+ irqmap = &pin_irq_map[irqindex];
+
+ /* Configure GPIO_InitStructure */
+ GPIO_StructInit(&GPIO_InitStruct);
+ EXTI_StructInit(&EXTI_InitStruct);
+ GPIO_InitStruct.GPIO_Pins = irqmap->pinbit;
+ GPIO_InitStruct.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
+ EXTI_InitStruct.EXTI_Line = irqmap->pinbit;
+ EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
+ EXTI_InitStruct.EXTI_LineEnable = ENABLE;
+ switch (pin_irq_hdr_tab[irqindex].mode)
+ {
+ case PIN_IRQ_MODE_RISING:
+ EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising;
+ break;
+ case PIN_IRQ_MODE_FALLING:
+ EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Falling;
+ break;
+ case PIN_IRQ_MODE_RISING_FALLING:
+ EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
+ break;
+ }
+ GPIO_Init(index->gpio, &GPIO_InitStruct);
+ GPIO_EXTILineConfig(index->portsource, index->pinsource);
+ EXTI_Init(&EXTI_InitStruct);
+ NVIC_InitStruct.NVIC_IRQChannel = irqmap->irqno;
+ NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
+ NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 5;
+ NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0;
+ NVIC_Init(&NVIC_InitStruct);
+ pin_irq_enable_mask |= irqmap->pinbit;
+
+ rt_hw_interrupt_enable(level);
+ }
+ else if (enabled == PIN_IRQ_DISABLE)
+ {
+ irqmap = get_pin_irq_map(index->pin);
+ if (irqmap == RT_NULL)
+ {
+ return RT_ENOSYS;
+ }
+
+ level = rt_hw_interrupt_disable();
+
+ pin_irq_enable_mask &= ~irqmap->pinbit;
+
+ NVIC_InitStruct.NVIC_IRQChannelCmd = DISABLE;
+ NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 5;
+ NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0;
+
+ if (( irqmap->pinbit>=GPIO_Pins_5 )&&( irqmap->pinbit<=GPIO_Pins_9 ))
+ {
+ if(!(pin_irq_enable_mask&(GPIO_Pins_5|GPIO_Pins_6|GPIO_Pins_7|GPIO_Pins_8|GPIO_Pins_9)))
+ {
+ NVIC_InitStruct.NVIC_IRQChannel = irqmap->irqno;
+ }
+ }
+ else if (( irqmap->pinbit>=GPIO_Pins_10 )&&( irqmap->pinbit<=GPIO_Pins_15 ))
+ {
+ if(!(pin_irq_enable_mask&(GPIO_Pins_10|GPIO_Pins_11|GPIO_Pins_12|GPIO_Pins_13|GPIO_Pins_14|GPIO_Pins_15)))
+ {
+ NVIC_InitStruct.NVIC_IRQChannel = irqmap->irqno;
+ }
+ }
+ else
+ {
+ NVIC_InitStruct.NVIC_IRQChannel = irqmap->irqno;
+ }
+
+ NVIC_Init(&NVIC_InitStruct);
+ rt_hw_interrupt_enable(level);
+ }
+ else
+ {
+ return -RT_ENOSYS;
+ }
+
+ return RT_EOK;
+}
+const static struct rt_pin_ops _at32_pin_ops =
+{
+ at32_pin_mode,
+ at32_pin_write,
+ at32_pin_read,
+ at32_pin_attach_irq,
+ at32_pin_dettach_irq,
+ at32_pin_irq_enable,
+};
+
+rt_inline void pin_irq_hdr(int irqno)
+{
+ EXTI_ClearIntPendingBit(pin_irq_map[irqno].lineno);
+ if (pin_irq_hdr_tab[irqno].hdr)
+ {
+ pin_irq_hdr_tab[irqno].hdr(pin_irq_hdr_tab[irqno].args);
+ }
+}
+
+void GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
+{
+ pin_irq_hdr(bit2bitno(GPIO_Pin));
+}
+
+void EXTI0_IRQHandler(void)
+{
+ rt_interrupt_enter();
+ GPIO_EXTI_IRQHandler(GPIO_Pins_0);
+ rt_interrupt_leave();
+}
+
+void EXTI1_IRQHandler(void)
+{
+ rt_interrupt_enter();
+ EXTI_ClearIntPendingBit(GPIO_Pins_1);
+ GPIO_EXTI_IRQHandler(GPIO_Pins_1);
+ rt_interrupt_leave();
+}
+
+void EXTI2_IRQHandler(void)
+{
+ rt_interrupt_enter();
+ GPIO_EXTI_IRQHandler(GPIO_Pins_2);
+ rt_interrupt_leave();
+}
+
+void EXTI3_IRQHandler(void)
+{
+ rt_interrupt_enter();
+ GPIO_EXTI_IRQHandler(GPIO_Pins_3);
+ rt_interrupt_leave();
+}
+
+void EXTI4_IRQHandler(void)
+{
+ rt_interrupt_enter();
+ GPIO_EXTI_IRQHandler(GPIO_Pins_4);
+ rt_interrupt_leave();
+}
+
+void EXTI9_5_IRQHandler(void)
+{
+ rt_interrupt_enter();
+ if(RESET != EXTI_GetIntStatus(EXTI_Line5))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_5);
+ }
+ if(RESET != EXTI_GetIntStatus(EXTI_Line6))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_6);
+ }
+ if(RESET != EXTI_GetIntStatus(EXTI_Line7))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_7);
+ }
+ if(RESET != EXTI_GetIntStatus(EXTI_Line8))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_8);
+ }
+ if(RESET != EXTI_GetIntStatus(EXTI_Line9))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_9);
+ }
+ rt_interrupt_leave();
+}
+
+void EXTI15_10_IRQHandler(void)
+{
+ rt_interrupt_enter();
+ if(RESET != EXTI_GetIntStatus(EXTI_Line10))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_10);
+ }
+ if(RESET != EXTI_GetIntStatus(EXTI_Line11))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_11);
+ }
+ if(RESET != EXTI_GetIntStatus(EXTI_Line12))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_12);
+ }
+ if(RESET != EXTI_GetIntStatus(EXTI_Line13))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_13);
+ }
+ if(RESET != EXTI_GetIntStatus(EXTI_Line14))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_14);
+ }
+ if(RESET != EXTI_GetIntStatus(EXTI_Line15))
+ {
+ GPIO_EXTI_IRQHandler(GPIO_Pins_15);
+ }
+ rt_interrupt_leave();
+}
+
+int rt_hw_pin_init(void)
+{
+
+#ifdef GPIOA
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOA, ENABLE);
+#endif
+#ifdef GPIOB
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOB, ENABLE);
+#endif
+#ifdef GPIOC
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOC, ENABLE);
+#endif
+#ifdef GPIOD
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOD, ENABLE);
+#endif
+#ifdef GPIOE
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOE, ENABLE);
+#endif
+#ifdef GPIOF
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOF, ENABLE);
+#endif
+#ifdef GPIOG
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOG, ENABLE);
+#endif
+
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_AFIO, ENABLE);
+
+ return rt_device_pin_register("pin", &_at32_pin_ops, RT_NULL);
+}
+
+INIT_BOARD_EXPORT(rt_hw_pin_init);
+
+#endif /* RT_USING_PIN */
diff --git a/bsp/at32/Libraries/rt_drivers/drv_gpio.h b/bsp/at32/Libraries/rt_drivers/drv_gpio.h
new file mode 100644
index 0000000000000000000000000000000000000000..63870611f5d90b01003f4460be0fb88636c48f1b
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_gpio.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-07 shelton first version
+ */
+
+#ifndef __DRV_GPIO_H__
+#define __DRV_GPIO_H__
+
+#include
+#include
+#include
+
+#define __AT32_PORT(port) GPIO##port##_BASE
+
+#define GET_PIN(PORTx,PIN) (rt_base_t)((16 * ( ((rt_base_t)__AT32_PORT(PORTx) - (rt_base_t)GPIOA_BASE)/(0x0400UL) )) + PIN)
+
+#define __AT32_PIN(index, gpio, gpio_index) \
+ { \
+ index, GPIO##gpio, GPIO_Pins_##gpio_index, \
+ GPIO_PortSourceGPIO##gpio, GPIO_PinsSource##gpio_index \
+ }
+
+#define __AT32_PIN_RESERVE \
+ { \
+ -1, 0, 0, 0, 0 \
+ }
+
+/* AT32 GPIO driver */
+struct pin_index
+{
+ int index;
+ GPIO_Type *gpio;
+ rt_uint32_t pin;
+ rt_uint32_t portsource;
+ rt_uint32_t pinsource;
+};
+
+struct pin_irq_map
+{
+ rt_uint16_t pinbit;
+ rt_uint16_t lineno;
+ IRQn_Type irqno;
+};
+
+int rt_hw_pin_init(void);
+
+#endif /* __DRV_GPIO_H__ */
+
diff --git a/bsp/at32/Libraries/rt_drivers/drv_hwtimer.c b/bsp/at32/Libraries/rt_drivers/drv_hwtimer.c
new file mode 100644
index 0000000000000000000000000000000000000000..97788d22c991bfe920ad45bfce45acb5be71f2aa
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_hwtimer.c
@@ -0,0 +1,412 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-03-16 Leo first version
+ */
+
+#include
+#include "drv_hwtimer.h"
+
+#define DRV_DEBUG
+#define LOG_TAG "drv.hwtimer"
+#include
+
+#ifdef BSP_USING_HWTIMER
+enum
+{
+#ifdef BSP_USING_HWTMR1
+ TMR1_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR2
+ TMR2_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR3
+ TMR3_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR4
+ TMR4_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR5
+ TMR5_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR6
+ TMR6_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR7
+ TMR7_INDEX,
+#endif
+
+#ifdef BSP_USING_HW_TMR8
+ TMR8_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR9
+ TMR9_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR10
+ TMR10_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR11
+ TMR11_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR12
+ TMR12_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR13
+ TMR13_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR14
+ TMR14_INDEX,
+#endif
+
+#ifdef BSP_USING_HWTMR15
+ TMR15_INDEX,
+#endif
+};
+
+struct at32_hwtimer
+{
+ rt_hwtimer_t time_device;
+ TMR_Type* tim_handle;
+ IRQn_Type tim_irqn;
+ char *name;
+};
+
+static struct at32_hwtimer at32_hwtimer_obj[] =
+{
+#ifdef BSP_USING_HWTMR1
+ TMR1_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR2
+ TMR2_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR3
+ TMR3_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR4
+ TMR4_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR5
+ TMR5_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR6
+ TMR6_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR7
+ TMR7_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR8
+ TMR8_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR9
+ TMR9_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR10
+ TMR10_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR11
+ TMR11_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR12
+ TMR12_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR13
+ TMR13_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR14
+ TMR14_CONFIG,
+#endif
+
+#ifdef BSP_USING_HWTMR15
+ TMR15_CONFIG,
+#endif
+};
+
+static void at32_timer_init(struct rt_hwtimer_device *timer, rt_uint32_t state)
+{
+ RCC_ClockType RCC_ClockStruct;
+ TMR_TimerBaseInitType TMR_TMReBaseStructure;
+ NVIC_InitType NVIC_InitStructure;
+ uint32_t prescaler_value = 0;
+ TMR_Type *tim = RT_NULL;
+ struct at32_hwtimer *tim_device = RT_NULL;
+
+ RT_ASSERT(timer != RT_NULL);
+ if (state)
+ {
+ tim = (TMR_Type *)timer->parent.user_data;
+ tim_device = (struct at32_hwtimer *)timer;
+
+ /* timer clock enable */
+ at32_msp_hwtmr_init(tim);
+
+ /* timer init */
+ RCC_GetClocksFreq(&RCC_ClockStruct);
+ /* Set timer clock is 1Mhz */
+ prescaler_value = (uint32_t)(RCC_ClockStruct.SYSCLK_Freq / 10000) - 1;
+
+ TMR_TMReBaseStructure.TMR_Period = 10000 - 1;
+ TMR_TMReBaseStructure.TMR_DIV = prescaler_value;
+ TMR_TMReBaseStructure.TMR_ClockDivision = TMR_CKD_DIV1;
+ TMR_TMReBaseStructure.TMR_RepetitionCounter = 0;
+
+ if (timer->info->cntmode == HWTIMER_CNTMODE_UP)
+ {
+ TMR_TMReBaseStructure.TMR_CounterMode = TMR_CounterDIR_Up;
+ }
+ else
+ {
+ TMR_TMReBaseStructure.TMR_CounterMode = TMR_CounterDIR_Down;
+ }
+
+ TMR_TimeBaseInit(tim, &TMR_TMReBaseStructure);
+
+ /* Enable the TMRx global Interrupt */
+ NVIC_InitStructure.NVIC_IRQChannel = tim_device->tim_irqn;
+ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
+ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
+ NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
+ NVIC_Init(&NVIC_InitStructure);
+
+ TMR_INTConfig(tim, TMR_INT_Overflow ,ENABLE);
+ TMR_ClearITPendingBit(tim, TMR_INT_Overflow);
+
+ LOG_D("%s init success", tim_device->name);
+ }
+}
+
+static rt_err_t at32_timer_start(rt_hwtimer_t *timer, rt_uint32_t t, rt_hwtimer_mode_t opmode)
+{
+ rt_err_t result = RT_EOK;
+ TMR_Type *tim = RT_NULL;
+
+ RT_ASSERT(timer != RT_NULL);
+
+ tim = (TMR_Type *)timer->parent.user_data;
+
+ /* set tim cnt */
+ TMR_SetCounter(tim, 0);
+ /* set tim arr */
+ TMR_SetAutoreload(tim, t - 1);
+ if (opmode == HWTIMER_MODE_ONESHOT)
+ {
+ /* set timer to single mode */
+ TMR_SelectOnePulseMode(tim, TMR_OPMode_Once);
+ }
+ else
+ {
+ TMR_SelectOnePulseMode(tim, TMR_OPMode_Repetitive);
+ }
+
+ /* start timer */
+ TMR_Cmd(tim, ENABLE);
+
+ return result;
+}
+
+static void at32_timer_stop(rt_hwtimer_t *timer)
+{
+ TMR_Type *tim = RT_NULL;
+
+ RT_ASSERT(timer != RT_NULL);
+
+ tim = (TMR_Type *)timer->parent.user_data;
+
+ /* stop timer */
+ TMR_Cmd(tim, ENABLE);
+ /* set tim cnt */
+ TMR_SetCounter(tim, 0);
+}
+
+static rt_uint32_t at32_timer_counter_get(rt_hwtimer_t *timer)
+{
+ TMR_Type *tim = RT_NULL;
+
+ RT_ASSERT(timer != RT_NULL);
+
+ tim = (TMR_Type *)timer->parent.user_data;
+
+ return tim->CNT;
+}
+
+static rt_err_t at32_timer_ctrl(rt_hwtimer_t *timer, rt_uint32_t cmd, void *arg)
+{
+ RCC_ClockType RCC_ClockStruct;
+ TMR_Type *tim = RT_NULL;
+ rt_err_t result = RT_EOK;
+
+ RT_ASSERT(timer != RT_NULL);
+ RT_ASSERT(arg != RT_NULL);
+
+ tim = (TMR_Type *)timer->parent.user_data;
+
+ switch(cmd)
+ {
+ case HWTIMER_CTRL_FREQ_SET:
+ {
+ rt_uint32_t freq;
+ rt_uint16_t val;
+
+ /* set timer frequence */
+ freq = *((rt_uint32_t *)arg);
+
+ /* time init */
+ RCC_GetClocksFreq(&RCC_ClockStruct);
+
+ val = RCC_ClockStruct.SYSCLK_Freq / freq;
+
+ TMR_DIVConfig(tim, val - 1, TMR_DIVReloadMode_Immediate);
+ }
+ break;
+ default:
+ {
+ result = -RT_ENOSYS;
+ }
+ break;
+ }
+
+ return result;
+}
+
+static const struct rt_hwtimer_info _info = TMR_DEV_INFO_CONFIG;
+static const struct rt_hwtimer_ops _ops =
+{
+ .init = at32_timer_init,
+ .start = at32_timer_start,
+ .stop = at32_timer_stop,
+ .count_get = at32_timer_counter_get,
+ .control = at32_timer_ctrl,
+};
+
+#ifdef BSP_USING_HWTMR2
+void TMR2_GLOBAL_IRQHandler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ if(TMR_GetINTStatus(TMR2, TMR_INT_Overflow) == SET)
+ {
+
+ rt_device_hwtimer_isr(&at32_hwtimer_obj[TMR2_INDEX].time_device);
+ TMR_ClearITPendingBit(TMR2, TMR_INT_Overflow);
+
+ }
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+#endif
+
+#ifdef BSP_USING_HWTMR3
+void TMR3_GLOBAL_IRQHandler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ if(TMR_GetINTStatus(TMR3, TMR_INT_Overflow) == SET)
+ {
+
+ rt_device_hwtimer_isr(&at32_hwtimer_obj[TMR3_INDEX].time_device);
+ TMR_ClearITPendingBit(TMR3, TMR_INT_Overflow);
+
+ }
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+#endif
+
+#ifdef BSP_USING_HWTMR4
+void TMR4_GLOBAL_IRQHandler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ if(TMR_GetINTStatus(TMR4, TMR_INT_Overflow) == SET)
+ {
+
+ rt_device_hwtimer_isr(&at32_hwtimer_obj[TMR4_INDEX].time_device);
+ TMR_ClearITPendingBit(TMR4, TMR_INT_Overflow);
+
+ }
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+#endif
+
+#ifdef BSP_USING_HWTMR5
+void TMR5_GLOBAL_IRQHandler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ if(TMR_GetINTStatus(TMR5, TMR_INT_Overflow) == SET)
+ {
+
+ rt_device_hwtimer_isr(&at32_hwtimer_obj[TMR5_INDEX].time_device);
+ TMR_ClearITPendingBit(TMR5, TMR_INT_Overflow);
+
+ }
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+#endif
+
+static int rt_hw_hwtimer_init(void)
+{
+ int i = 0;
+ int result = RT_EOK;
+
+ for (i = 0; i < sizeof(at32_hwtimer_obj) / sizeof(at32_hwtimer_obj[0]); i++)
+ {
+ at32_hwtimer_obj[i].time_device.info = &_info;
+ at32_hwtimer_obj[i].time_device.ops = &_ops;
+ if (rt_device_hwtimer_register(&at32_hwtimer_obj[i].time_device, at32_hwtimer_obj[i].name, at32_hwtimer_obj[i].tim_handle) == RT_EOK)
+ {
+ LOG_D("%s register success", at32_hwtimer_obj[i].name);
+ }
+ else
+ {
+ LOG_E("%s register failed", at32_hwtimer_obj[i].name);
+ result = -RT_ERROR;
+ }
+ }
+
+ return result;
+}
+INIT_BOARD_EXPORT(rt_hw_hwtimer_init);
+
+#endif /* BSP_USING_HWTIMER */
+
+
+
+
+
+
+
diff --git a/bsp/at32/Libraries/rt_drivers/drv_hwtimer.h b/bsp/at32/Libraries/rt_drivers/drv_hwtimer.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ae4981e3f305cf1c682d5ae4270a191b819dded
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_hwtimer.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-03-16 Leo first version
+ */
+
+#ifndef __TMR_CONFIG_H__
+#define __TMR_CONFIG_H__
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef TMR_DEV_INFO_CONFIG
+#define TMR_DEV_INFO_CONFIG \
+ { \
+ .maxfreq = 1000000, \
+ .minfreq = 4000, \
+ .maxcnt = 0xFFFF, \
+ .cntmode = HWTIMER_CNTMODE_UP, \
+ }
+#endif /* TIM_DEV_INFO_CONFIG */
+
+#ifdef BSP_USING_HWTMR2
+#ifndef TMR2_CONFIG
+#define TMR2_CONFIG \
+ { \
+ .tim_handle = TMR2, \
+ .tim_irqn = TMR2_GLOBAL_IRQn, \
+ .name = "timer2", \
+ }
+#endif /* TMR2_CONFIG */
+#endif /* BSP_USING_HWTMR2 */
+
+#ifdef BSP_USING_HWTMR3
+#ifndef TMR3_CONFIG
+#define TMR3_CONFIG \
+ { \
+ .tim_handle = TMR3, \
+ .tim_irqn = TMR3_GLOBAL_IRQn, \
+ .name = "timer3", \
+ }
+#endif /* TMR3_CONFIG */
+#endif /* BSP_USING_HWTMR3 */
+
+#ifdef BSP_USING_HWTMR4
+#ifndef TMR4_CONFIG
+#define TMR4_CONFIG \
+ { \
+ .tim_handle = TMR4, \
+ .tim_irqn = TMR4_GLOBAL_IRQn, \
+ .name = "timer4", \
+ }
+#endif /* TMR4_CONFIG */
+#endif /* BSP_USING_HWTMR4 */
+
+#ifdef BSP_USING_HWTMR5
+#ifndef TMR5_CONFIG
+#define TMR5_CONFIG \
+ { \
+ .tim_handle = TMR5, \
+ .tim_irqn = TMR5_GLOBAL_IRQn, \
+ .name = "timer5", \
+ }
+#endif /* TMR5_CONFIG */
+#endif /* BSP_USING_HWTMR5 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TMR_CONFIG_H__ */
+
diff --git a/bsp/at32/Libraries/rt_drivers/drv_log.h b/bsp/at32/Libraries/rt_drivers/drv_log.h
new file mode 100644
index 0000000000000000000000000000000000000000..a813acb0cb90cf5880125659d911a16d1a8d4d21
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_log.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-09 shelton first version
+ */
+
+/*
+ * NOTE: DO NOT include this file on the header file.
+ */
+
+#ifndef LOG_TAG
+#define DBG_TAG "drv"
+#else
+#define DBG_TAG LOG_TAG
+#endif /* LOG_TAG */
+
+#ifdef DRV_DEBUG
+#define DBG_LVL DBG_LOG
+#else
+#define DBG_LVL DBG_INFO
+#endif /* DRV_DEBUG */
+
+#include
diff --git a/bsp/at32/Libraries/rt_drivers/drv_pwm.c b/bsp/at32/Libraries/rt_drivers/drv_pwm.c
new file mode 100644
index 0000000000000000000000000000000000000000..78b1b2d7a970c8882ebe4df46aa154be089b417a
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_pwm.c
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-1-13 Leo first version
+ */
+
+#include
+#include "drv_pwm.h"
+
+#ifdef RT_USING_PWM
+#if !defined(BSP_USING_TMR1_CH1) && !defined(BSP_USING_TMR1_CH2) && \
+ !defined(BSP_USING_TMR1_CH3) && !defined(BSP_USING_TMR1_CH4) && \
+ !defined(BSP_USING_TMR2_CH1) && !defined(BSP_USING_TMR2_CH2) && \
+ !defined(BSP_USING_TMR2_CH3) && !defined(BSP_USING_TMR2_CH4) && \
+ !defined(BSP_USING_TMR3_CH1) && !defined(BSP_USING_TMR3_CH2) && \
+ !defined(BSP_USING_TMR3_CH3) && !defined(BSP_USING_TMR3_CH4)
+#error "Please define at least one BSP_USING_TMRx_CHx"
+#endif
+#endif /* RT_USING_PWM */
+
+#define DRV_DEBUG
+#define LOG_TAG "drv.pwm"
+#include
+
+#define MAX_PERIOD 65535
+struct rt_device_pwm pwm_device;
+
+struct at32_pwm
+{
+ struct rt_device_pwm pwm_device;
+ TMR_Type* tim_handle;
+ rt_uint8_t channel;
+ char *name;
+};
+
+static struct at32_pwm at32_pwm_obj[] =
+{
+ #ifdef BSP_USING_TMR1_CH1
+ PWM1_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR1_CH2
+ PWM2_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR1_CH3
+ PWM3_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR1_CH4
+ PWM4_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR2_CH1
+ PWM5_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR2_CH2
+ PWM6_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR2_CH3
+ PWM7_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR2_CH4
+ PWM8_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR3_CH1
+ PWM9_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR3_CH2
+ PWM10_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR3_CH3
+ PWM11_CONFIG,
+ #endif
+
+ #ifdef BSP_USING_TMR3_CH4
+ PWM12_CONFIG,
+ #endif
+};
+
+static rt_err_t drv_pwm_control(struct rt_device_pwm *device, int cmd, void *arg);
+static struct rt_pwm_ops drv_ops =
+{
+ drv_pwm_control
+};
+
+static rt_err_t drv_pwm_enable(TMR_Type* TMRx, struct rt_pwm_configuration *configuration, rt_bool_t enable)
+{
+ /* Get the value of channel */
+ rt_uint32_t channel = configuration->channel;
+
+ if (!enable)
+ {
+ if(channel == 1)
+ {
+ TMR_CCxCmd(TMRx, TMR_Channel_1, TMR_CCx_Disable);
+ }
+ else if(channel == 2)
+ {
+ TMR_CCxCmd(TMRx, TMR_Channel_2, TMR_CCx_Disable);
+ }
+ else if(channel == 3)
+ {
+ TMR_CCxCmd(TMRx, TMR_Channel_3, TMR_CCx_Disable);
+ }
+ else if(channel == 4)
+ {
+ TMR_CCxCmd(TMRx, TMR_Channel_4, TMR_CCx_Disable);
+ }
+ }
+ else
+ {
+ if(channel == 1)
+ {
+ TMR_CCxCmd(TMRx, TMR_Channel_1, TMR_CCx_Enable);
+ }
+ else if(channel == 2)
+ {
+ TMR_CCxCmd(TMRx, TMR_Channel_1, TMR_CCx_Enable);
+ }
+ else if(channel == 3)
+ {
+ TMR_CCxCmd(TMRx, TMR_Channel_1, TMR_CCx_Enable);
+ }
+ else if(channel == 4)
+ {
+ TMR_CCxCmd(TMRx, TMR_Channel_1, TMR_CCx_Enable);
+ }
+ }
+
+ /* TMRx enable counter */
+ TMR_Cmd(TMRx, ENABLE);
+
+ return RT_EOK;
+}
+
+static rt_err_t drv_pwm_get(TMR_Type* TMRx, struct rt_pwm_configuration *configuration)
+{
+ RCC_ClockType RCC_Clockstruct;
+ rt_uint32_t ar, div, cc1, cc2, cc3, cc4;
+ rt_uint32_t channel = configuration->channel;
+ rt_uint64_t tim_clock;
+
+ ar = TMRx->AR;
+ div = TMRx->DIV;
+ cc1 = TMRx->CC1;
+ cc2 = TMRx->CC2;
+ cc3 = TMRx->CC3;
+ cc4 = TMRx->CC4;
+
+ RCC_GetClocksFreq(&RCC_Clockstruct);
+
+ tim_clock = RCC_Clockstruct.APB2CLK_Freq;
+
+ /* Convert nanosecond to frequency and duty cycle. */
+ tim_clock /= 1000000UL;
+ configuration->period = (ar + 1) * (div + 1) * 1000UL / tim_clock;
+ if(channel == 1)
+ configuration->pulse = (cc1 + 1) * (div + 1) * 1000UL / tim_clock;
+ if(channel == 2)
+ configuration->pulse = (cc2 + 1) * (div+ 1) * 1000UL / tim_clock;
+ if(channel == 3)
+ configuration->pulse = (cc3 + 1) * (div + 1) * 1000UL / tim_clock;
+ if(channel == 4)
+ configuration->pulse = (cc4 + 1) * (div + 1) * 1000UL / tim_clock;
+
+ return RT_EOK;
+}
+
+static rt_err_t drv_pwm_set(TMR_Type* TMRx, struct rt_pwm_configuration *configuration)
+{
+ TMR_TimerBaseInitType TMR_TMReBaseStructure;
+ TMR_OCInitType TMR_OCInitStructure;
+ rt_uint32_t period, pulse;
+ rt_uint64_t psc;
+ /* Get the channel number */
+ rt_uint32_t channel = configuration->channel;
+
+ /* Init timer pin and enable clock */
+ at32_msp_tmr_init(TMRx);
+
+ /* Convert nanosecond to frequency and duty cycle. */
+ period = (unsigned long long)configuration->period ;
+ psc = period / MAX_PERIOD + 1;
+ period = period / psc;
+
+ /* TMRe base configuration */
+ TMR_TimeBaseStructInit(&TMR_TMReBaseStructure);
+ TMR_TMReBaseStructure.TMR_Period = period;
+ TMR_TMReBaseStructure.TMR_DIV = psc - 1;
+ TMR_TMReBaseStructure.TMR_ClockDivision = 0;
+ TMR_TMReBaseStructure.TMR_CounterMode = TMR_CounterDIR_Up;
+
+ TMR_TimeBaseInit(TMRx, &TMR_TMReBaseStructure);
+
+ pulse = (unsigned long long)configuration->pulse;
+
+ /* PWM1 Mode configuration: Channel1 */
+ TMR_OCStructInit(&TMR_OCInitStructure);
+ TMR_OCInitStructure.TMR_OCMode = TMR_OCMode_PWM1;
+ TMR_OCInitStructure.TMR_OutputState = TMR_OutputState_Enable;
+ TMR_OCInitStructure.TMR_Pulse = pulse;
+ TMR_OCInitStructure.TMR_OCPolarity = TMR_OCPolarity_High;
+
+ if(channel == 1)
+ {
+ TMR_OC1Init(TMRx, &TMR_OCInitStructure);
+ TMR_OC1PreloadConfig(TMRx, TMR_OCPreload_Enable);
+ }
+ else if(channel == 2)
+ {
+ TMR_OC2Init(TMRx, &TMR_OCInitStructure);
+ TMR_OC2PreloadConfig(TMRx, TMR_OCPreload_Enable);
+ }
+ else if(channel == 3)
+ {
+ TMR_OC3Init(TMRx, &TMR_OCInitStructure);
+ TMR_OC3PreloadConfig(TMRx, TMR_OCPreload_Enable);
+ }
+ else if(channel == 4)
+ {
+ TMR_OC4Init(TMRx, &TMR_OCInitStructure);
+ TMR_OC4PreloadConfig(TMRx, TMR_OCPreload_Enable);
+ }
+
+ TMR_ARPreloadConfig(TMRx, ENABLE);
+
+#if defined (SOC_SERIES_AT32F415)
+ if(TMRx == TMR1)
+#else
+ if(TMRx == TMR1 || TMRx == TMR8)
+#endif
+ {
+ TMR_CtrlPWMOutputs(TMRx,ENABLE);
+ }
+
+ return RT_EOK;
+}
+
+static rt_err_t drv_pwm_control(struct rt_device_pwm *device, int cmd, void *arg)
+{
+ struct rt_pwm_configuration *configuration = (struct rt_pwm_configuration *)arg;
+ TMR_Type *TMRx = (TMR_Type *)device->parent.user_data;
+
+ switch (cmd)
+ {
+ case PWM_CMD_ENABLE:
+ return drv_pwm_enable(TMRx, configuration, RT_TRUE);
+ case PWM_CMD_DISABLE:
+ return drv_pwm_enable(TMRx, configuration, RT_FALSE);
+ case PWM_CMD_SET:
+ return drv_pwm_set(TMRx, configuration);
+ case PWM_CMD_GET:
+ return drv_pwm_get(TMRx, configuration);
+ default:
+ return RT_EINVAL;
+ }
+}
+
+static int rt_hw_pwm_init(void)
+{
+ int i = 0;
+ int result = RT_EOK;
+
+ for(i = 0; i < sizeof(at32_pwm_obj) / sizeof(at32_pwm_obj[0]); i++)
+ {
+ if(rt_device_pwm_register(&at32_pwm_obj[i].pwm_device, at32_pwm_obj[i].name, &drv_ops, at32_pwm_obj[i].tim_handle) == RT_EOK)
+ {
+ LOG_D("%s register success", at32_pwm_obj[i].name);
+ }
+ else
+ {
+ LOG_D("%s register failed", at32_pwm_obj[i].name);
+ result = -RT_ERROR;
+ }
+ }
+
+ return result;
+}
+
+INIT_BOARD_EXPORT(rt_hw_pwm_init);
diff --git a/bsp/at32/Libraries/rt_drivers/drv_pwm.h b/bsp/at32/Libraries/rt_drivers/drv_pwm.h
new file mode 100644
index 0000000000000000000000000000000000000000..6cdcfc6415a4c98564874e740d6c9c33e6580907
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_pwm.h
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-1-13 Leo first version
+ */
+
+#ifndef __PWM_CONFIG_H__
+#define __PWM_CONFIG_H__
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef BSP_USING_TMR1_CH1
+#ifndef PWM1_CONFIG
+#define PWM1_CONFIG \
+ { \
+ .tim_handle = TMR1, \
+ .name = "tmr1pwm1", \
+ .channel = 1 \
+ }
+#endif /* PWM1_CONFIG */
+#endif /* BSP_USING_TMR1_CH1 */
+
+#ifdef BSP_USING_TMR1_CH2
+#ifndef PWM2_CONFIG
+#define PWM2_CONFIG \
+ { \
+ .tim_handle = TMR1, \
+ .name = "tmr1pwm2", \
+ .channel = 2 \
+ }
+#endif /* PWM2_CONFIG */
+#endif /* BSP_USING_TMR1_CH2 */
+
+#ifdef BSP_USING_TMR1_CH3
+#ifndef PWM3_CONFIG
+#define PWM3_CONFIG \
+ { \
+ .tim_handle = TMR1, \
+ .name = "tmr1pwm3", \
+ .channel = 3 \
+ }
+#endif /* PWM3_CONFIG */
+#endif /* BSP_USING_TMR1_CH3 */
+
+#ifdef BSP_USING_TMR1_CH4
+#ifndef PWM4_CONFIG
+#define PWM4_CONFIG \
+ { \
+ .tim_handle = TMR1, \
+ .name = "tmr1pwm4", \
+ .channel = 4 \
+ }
+#endif /* PWM4_CONFIG */
+#endif /* BSP_USING_TMR1_CH4 */
+
+#ifdef BSP_USING_TMR2_CH1
+#ifndef PWM5_CONFIG
+#define PWM5_CONFIG \
+ { \
+ .tim_handle = TMR2, \
+ .name = "tmr2pwm1", \
+ .channel = 1 \
+ }
+#endif /* PWM5_CONFIG */
+#endif /* BSP_USING_TMR2_CH1 */
+
+#ifdef BSP_USING_TMR2_CH2
+#ifndef PWM6_CONFIG
+#define PWM6_CONFIG \
+ { \
+ .tim_handle = TMR2, \
+ .name = "tmr2pwm2", \
+ .channel = 2 \
+ }
+#endif /* PWM6_CONFIG */
+#endif /* BSP_USING_TMR2_CH2 */
+
+#ifdef BSP_USING_TMR2_CH3
+#ifndef PWM7_CONFIG
+#define PWM7_CONFIG \
+ { \
+ .tim_handle = TMR2, \
+ .name = "tmr2pwm3", \
+ .channel = 3 \
+ }
+#endif /* PWM7_CONFIG */
+#endif /* BSP_USING_TMR2_CH3 */
+
+#ifdef BSP_USING_TMR2_CH4
+#ifndef PWM8_CONFIG
+#define PWM8_CONFIG \
+ { \
+ .tim_handle = TMR2, \
+ .name = "tmr2pwm4", \
+ .channel = 4 \
+ }
+#endif /* PWM8_CONFIG */
+#endif /* BSP_USING_TMR2_CH4 */
+
+#ifdef BSP_USING_TMR3_CH1
+#ifndef PWM9_CONFIG
+#define PWM9_CONFIG \
+ { \
+ .tim_handle = TMR3, \
+ .name = "tmr3pwm1", \
+ .channel = 1 \
+ }
+#endif /* PWM9_CONFIG */
+#endif /* BSP_USING_TMR3_CH1 */
+
+#ifdef BSP_USING_TMR3_CH2
+#ifndef PWM10_CONFIG
+#define PWM10_CONFIG \
+ { \
+ .tim_handle = TMR3, \
+ .name = "tmr3pwm2", \
+ .channel = 2 \
+ }
+#endif /* PWM10_CONFIG */
+#endif /* BSP_USING_TMR3_CH2 */
+
+#ifdef BSP_USING_TMR3_CH3
+#ifndef PWM11_CONFIG
+#define PWM11_CONFIG \
+ { \
+ .tim_handle = TMR3, \
+ .name = "tmr3pwm3", \
+ .channel = 3 \
+ }
+#endif /* PWM11_CONFIG */
+#endif /* BSP_USING_TMR3_CH3 */
+
+#ifdef BSP_USING_TMR3_CH4
+#ifndef PWM12_CONFIG
+#define PWM12_CONFIG \
+ { \
+ .tim_handle = TMR3, \
+ .name = "tmr3pwm4", \
+ .channel = 4 \
+ }
+#endif /* PWM12_CONFIG */
+#endif /* BSP_USING_TMR3_CH4 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PWM_CONFIG_H__ */
diff --git a/bsp/at32/Libraries/rt_drivers/drv_sdio.c b/bsp/at32/Libraries/rt_drivers/drv_sdio.c
new file mode 100644
index 0000000000000000000000000000000000000000..eb721033b5e2eed476a90d2bd65c6364ab266d37
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_sdio.c
@@ -0,0 +1,835 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-14 shelton first version
+ */
+
+#include
+#include "drv_sdio.h"
+
+#ifdef BSP_USING_SDIO
+#if !defined (BSP_USING_SDIO1) && !defined (BSP_USING_SDIO2)
+#error "Please define at least one SDIOx"
+#endif
+//#define DRV_DEBUG
+#define LOG_TAG "drv.sdio"
+#include
+
+static struct at32_sdio_config sdio_config = SDIO_BUS_CONFIG;
+static struct at32_sdio_class sdio_obj;
+static struct rt_mmcsd_host *host;
+
+#define SDIO_TX_RX_COMPLETE_TIMEOUT_LOOPS (100000)
+
+#define RT_HW_SDIO_LOCK(_sdio) rt_mutex_take(&_sdio->mutex, RT_WAITING_FOREVER)
+#define RT_HW_SDIO_UNLOCK(_sdio) rt_mutex_release(&_sdio->mutex);
+
+struct sdio_pkg
+{
+ struct rt_mmcsd_cmd *cmd;
+ void *buff;
+ rt_uint32_t flag;
+};
+
+struct rt_hw_sdio
+{
+ struct rt_mmcsd_host *host;
+ struct at32_sdio_des sdio_des;
+ struct rt_event event;
+ struct rt_mutex mutex;
+ struct sdio_pkg *pkg;
+};
+
+ALIGN(SDIO_ALIGN_LEN)
+static rt_uint8_t cache_buf[SDIO_BUFF_SIZE];
+
+static rt_uint32_t at32_sdio_clk_get(struct at32_sdio *hw_sdio)
+{
+ return SDIO_CLOCK_FREQ;
+}
+
+/**
+ * @brief This function get order from sdio.
+ * @param data
+ * @retval sdio order
+ */
+static int get_order(rt_uint32_t data)
+{
+ int order = 0;
+
+ switch (data)
+ {
+ case 1:
+ order = 0;
+ break;
+ case 2:
+ order = 1;
+ break;
+ case 4:
+ order = 2;
+ break;
+ case 8:
+ order = 3;
+ break;
+ case 16:
+ order = 4;
+ break;
+ case 32:
+ order = 5;
+ break;
+ case 64:
+ order = 6;
+ break;
+ case 128:
+ order = 7;
+ break;
+ case 256:
+ order = 8;
+ break;
+ case 512:
+ order = 9;
+ break;
+ case 1024:
+ order = 10;
+ break;
+ case 2048:
+ order = 11;
+ break;
+ case 4096:
+ order = 12;
+ break;
+ case 8192:
+ order = 13;
+ break;
+ case 16384:
+ order = 14;
+ break;
+ default :
+ order = 0;
+ break;
+ }
+
+ return order;
+}
+
+/**
+ * @brief This function wait sdio completed.
+ * @param sdio rt_hw_sdio
+ * @retval None
+ */
+static void rt_hw_sdio_wait_completed(struct rt_hw_sdio *sdio)
+{
+ rt_uint32_t status;
+ struct rt_mmcsd_cmd *cmd = sdio->pkg->cmd;
+ struct rt_mmcsd_data *data = cmd->data;
+ struct at32_sdio *hw_sdio = sdio->sdio_des.hw_sdio;
+
+ if (rt_event_recv(&sdio->event, 0xffffffff, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
+ rt_tick_from_millisecond(5000), &status) != RT_EOK)
+ {
+ LOG_E("wait completed timeout");
+ cmd->err = -RT_ETIMEOUT;
+ return;
+ }
+
+ if (sdio->pkg == RT_NULL)
+ {
+ return;
+ }
+
+ cmd->resp[0] = hw_sdio->resp1;
+ cmd->resp[1] = hw_sdio->resp2;
+ cmd->resp[2] = hw_sdio->resp3;
+ cmd->resp[3] = hw_sdio->resp4;
+
+ if (status & HW_SDIO_ERRORS)
+ {
+ if ((status & HW_SDIO_IT_CCRCFAIL) && (resp_type(cmd) & (RESP_R3 | RESP_R4)))
+ {
+ cmd->err = RT_EOK;
+ }
+ else
+ {
+ cmd->err = -RT_ERROR;
+ }
+
+ if (status & HW_SDIO_IT_CTIMEOUT)
+ {
+ cmd->err = -RT_ETIMEOUT;
+ }
+
+ if (status & HW_SDIO_IT_DCRCFAIL)
+ {
+ data->err = -RT_ERROR;
+ }
+
+ if (status & HW_SDIO_IT_DTIMEOUT)
+ {
+ data->err = -RT_ETIMEOUT;
+ }
+
+ if (cmd->err == RT_EOK)
+ {
+ LOG_D("sta:0x%08X [%08X %08X %08X %08X]", status, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
+ }
+ else
+ {
+ LOG_D("err:0x%08x, %s%s%s%s%s%s%s cmd:%d arg:0x%08x rw:%c len:%d blksize:%d",
+ status,
+ status & HW_SDIO_IT_CCRCFAIL ? "CCRCFAIL " : "",
+ status & HW_SDIO_IT_DCRCFAIL ? "DCRCFAIL " : "",
+ status & HW_SDIO_IT_CTIMEOUT ? "CTIMEOUT " : "",
+ status & HW_SDIO_IT_DTIMEOUT ? "DTIMEOUT " : "",
+ status & HW_SDIO_IT_TXUNDERR ? "TXUNDERR " : "",
+ status & HW_SDIO_IT_RXOVERR ? "RXOVERR " : "",
+ status == 0 ? "NULL" : "",
+ cmd->cmd_code,
+ cmd->arg,
+ data ? (data->flags & DATA_DIR_WRITE ? 'w' : 'r') : '-',
+ data ? data->blks * data->blksize : 0,
+ data ? data->blksize : 0
+ );
+ }
+ }
+ else
+ {
+ cmd->err = RT_EOK;
+ LOG_D("sta:0x%08X [%08X %08X %08X %08X]", status, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
+ }
+}
+
+/**
+ * @brief This function transfer data by dma.
+ * @param sdio rt_hw_sdio
+ * @param pkg sdio package
+ * @retval None
+ */
+static void rt_hw_sdio_transfer_by_dma(struct rt_hw_sdio *sdio, struct sdio_pkg *pkg)
+{
+ struct rt_mmcsd_data *data;
+ int size;
+ void *buff;
+ struct at32_sdio *hw_sdio;
+
+ if ((RT_NULL == pkg) || (RT_NULL == sdio))
+ {
+ LOG_E("rt_hw_sdio_transfer_by_dma invalid args");
+ return;
+ }
+
+ data = pkg->cmd->data;
+ if (RT_NULL == data)
+ {
+ LOG_E("rt_hw_sdio_transfer_by_dma invalid args");
+ return;
+ }
+
+ buff = pkg->buff;
+ if (RT_NULL == buff)
+ {
+ LOG_E("rt_hw_sdio_transfer_by_dma invalid args");
+ return;
+ }
+ hw_sdio = sdio->sdio_des.hw_sdio;
+ size = data->blks * data->blksize;
+
+ if (data->flags & DATA_DIR_WRITE)
+ {
+ sdio->sdio_des.txconfig((rt_uint32_t *)buff, (rt_uint32_t *)&hw_sdio->fifo, size);
+ hw_sdio->dctrl |= HW_SDIO_DMA_ENABLE;
+ }
+ else if (data->flags & DATA_DIR_READ)
+ {
+ sdio->sdio_des.rxconfig((rt_uint32_t *)&hw_sdio->fifo, (rt_uint32_t *)buff, size);
+ hw_sdio->dctrl |= HW_SDIO_DMA_ENABLE | HW_SDIO_DPSM_ENABLE;
+ }
+}
+
+/**
+ * @brief This function send command.
+ * @param sdio rt_hw_sdio
+ * @param pkg sdio package
+ * @retval None
+ */
+static void rt_hw_sdio_send_command(struct rt_hw_sdio *sdio, struct sdio_pkg *pkg)
+{
+ struct rt_mmcsd_cmd *cmd = pkg->cmd;
+ struct rt_mmcsd_data *data = cmd->data;
+ struct at32_sdio *hw_sdio = sdio->sdio_des.hw_sdio;
+ rt_uint32_t reg_cmd;
+
+ /* save pkg */
+ sdio->pkg = pkg;
+
+ LOG_D("CMD:%d ARG:0x%08x RES:%s%s%s%s%s%s%s%s%s rw:%c len:%d blksize:%d",
+ cmd->cmd_code,
+ cmd->arg,
+ resp_type(cmd) == RESP_NONE ? "NONE" : "",
+ resp_type(cmd) == RESP_R1 ? "R1" : "",
+ resp_type(cmd) == RESP_R1B ? "R1B" : "",
+ resp_type(cmd) == RESP_R2 ? "R2" : "",
+ resp_type(cmd) == RESP_R3 ? "R3" : "",
+ resp_type(cmd) == RESP_R4 ? "R4" : "",
+ resp_type(cmd) == RESP_R5 ? "R5" : "",
+ resp_type(cmd) == RESP_R6 ? "R6" : "",
+ resp_type(cmd) == RESP_R7 ? "R7" : "",
+ data ? (data->flags & DATA_DIR_WRITE ? 'w' : 'r') : '-',
+ data ? data->blks * data->blksize : 0,
+ data ? data->blksize : 0
+ );
+
+ /* config cmd reg */
+ reg_cmd = cmd->cmd_code | HW_SDIO_CPSM_ENABLE;
+ if (resp_type(cmd) == RESP_NONE)
+ reg_cmd |= HW_SDIO_RESPONSE_NO;
+ else if (resp_type(cmd) == RESP_R2)
+ reg_cmd |= HW_SDIO_RESPONSE_LONG;
+ else
+ reg_cmd |= HW_SDIO_RESPONSE_SHORT;
+
+ /* config data reg */
+ if (data != RT_NULL)
+ {
+ rt_uint32_t dir = 0;
+ rt_uint32_t size = data->blks * data->blksize;
+ int order;
+
+ hw_sdio->dctrl = 0;
+ hw_sdio->dtimer = HW_SDIO_DATATIMEOUT;
+ hw_sdio->dlen = size;
+ order = get_order(data->blksize);
+ dir = (data->flags & DATA_DIR_READ) ? HW_SDIO_TO_HOST : 0;
+ hw_sdio->dctrl = /* HW_SDIO_IO_ENABLE | */ (order << 4) | dir;
+ }
+
+ /* transfer config */
+ if (data != RT_NULL)
+ {
+ rt_hw_sdio_transfer_by_dma(sdio, pkg);
+ }
+
+ /* open irq */
+ hw_sdio->mask |= HW_SDIO_IT_CMDSENT | HW_SDIO_IT_CMDREND | HW_SDIO_ERRORS;
+ if (data != RT_NULL)
+ {
+ hw_sdio->mask |= HW_SDIO_IT_DATAEND;
+ }
+
+ /* send cmd */
+ hw_sdio->arg = cmd->arg;
+ hw_sdio->cmd = reg_cmd;
+
+ /* wait completed */
+ rt_hw_sdio_wait_completed(sdio);
+
+ /* Waiting for data to be sent to completion */
+ if (data != RT_NULL)
+ {
+ volatile rt_uint32_t count = SDIO_TX_RX_COMPLETE_TIMEOUT_LOOPS;
+
+ while (count && (hw_sdio->sta & (HW_SDIO_IT_TXACT | HW_SDIO_IT_RXACT)))
+ {
+ count--;
+ }
+
+ if ((count == 0) || (hw_sdio->sta & HW_SDIO_ERRORS))
+ {
+ cmd->err = -RT_ERROR;
+ }
+ }
+
+ /* close irq, keep sdio irq */
+ hw_sdio->mask = hw_sdio->mask & HW_SDIO_IT_SDIOIT ? HW_SDIO_IT_SDIOIT : 0x00;
+
+ /* clear pkg */
+ sdio->pkg = RT_NULL;
+}
+
+/**
+ * @brief This function send sdio request.
+ * @param sdio rt_hw_sdio
+ * @param req request
+ * @retval None
+ */
+static void rt_hw_sdio_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req)
+{
+ struct sdio_pkg pkg;
+ struct rt_hw_sdio *sdio = host->private_data;
+ struct rt_mmcsd_data *data;
+
+ RT_HW_SDIO_LOCK(sdio);
+
+ if (req->cmd != RT_NULL)
+ {
+ memset(&pkg, 0, sizeof(pkg));
+ data = req->cmd->data;
+ pkg.cmd = req->cmd;
+
+ if (data != RT_NULL)
+ {
+ rt_uint32_t size = data->blks * data->blksize;
+
+ RT_ASSERT(size <= SDIO_BUFF_SIZE);
+
+ pkg.buff = data->buf;
+ if ((rt_uint32_t)data->buf & (SDIO_ALIGN_LEN - 1))
+ {
+ pkg.buff = cache_buf;
+ if (data->flags & DATA_DIR_WRITE)
+ {
+ memcpy(cache_buf, data->buf, size);
+ }
+ }
+ }
+
+ rt_hw_sdio_send_command(sdio, &pkg);
+
+ if ((data != RT_NULL) && (data->flags & DATA_DIR_READ) && ((rt_uint32_t)data->buf & (SDIO_ALIGN_LEN - 1)))
+ {
+ memcpy(data->buf, cache_buf, data->blksize * data->blks);
+ }
+ }
+
+ if (req->stop != RT_NULL)
+ {
+ memset(&pkg, 0, sizeof(pkg));
+ pkg.cmd = req->stop;
+ rt_hw_sdio_send_command(sdio, &pkg);
+ }
+
+ RT_HW_SDIO_UNLOCK(sdio);
+
+ mmcsd_req_complete(sdio->host);
+}
+
+/**
+ * @brief This function config sdio.
+ * @param host rt_mmcsd_host
+ * @param io_cfg rt_mmcsd_io_cfg
+ * @retval None
+ */
+static void rt_hw_sdio_iocfg(struct rt_mmcsd_host *host, struct rt_mmcsd_io_cfg *io_cfg)
+{
+ rt_uint32_t clkcr, div, clk_src;
+ rt_uint32_t clk = io_cfg->clock;
+ struct rt_hw_sdio *sdio = host->private_data;
+ struct at32_sdio *hw_sdio = sdio->sdio_des.hw_sdio;
+
+ clk_src = sdio->sdio_des.clk_get(sdio->sdio_des.hw_sdio);
+ if (clk_src < 400 * 1000)
+ {
+ LOG_E("The clock rate is too low! rata:%d", clk_src);
+ return;
+ }
+
+ if (clk > host->freq_max) clk = host->freq_max;
+
+ if (clk > clk_src)
+ {
+ LOG_W("Setting rate is greater than clock source rate.");
+ clk = clk_src;
+ }
+
+ LOG_D("clk:%d width:%s%s%s power:%s%s%s",
+ clk,
+ io_cfg->bus_width == MMCSD_BUS_WIDTH_8 ? "8" : "",
+ io_cfg->bus_width == MMCSD_BUS_WIDTH_4 ? "4" : "",
+ io_cfg->bus_width == MMCSD_BUS_WIDTH_1 ? "1" : "",
+ io_cfg->power_mode == MMCSD_POWER_OFF ? "OFF" : "",
+ io_cfg->power_mode == MMCSD_POWER_UP ? "UP" : "",
+ io_cfg->power_mode == MMCSD_POWER_ON ? "ON" : ""
+ );
+
+ RT_HW_SDIO_LOCK(sdio);
+
+ div = clk_src / clk;
+ if ((clk == 0) || (div == 0))
+ {
+ clkcr = 0;
+ }
+ else
+ {
+ if (div < 2)
+ {
+ div = 2;
+ }
+ else if (div > 0x3FF)
+ {
+ div = 0x3FF;
+ }
+ div -= 2;
+ clkcr = (div & 0xFF) | ((div & 0x300) << 7) | HW_SDIO_CLK_ENABLE;
+ }
+
+ if (io_cfg->bus_width == MMCSD_BUS_WIDTH_8)
+ {
+ clkcr |= HW_SDIO_BUSWIDE_8B;
+ }
+ else if (io_cfg->bus_width == MMCSD_BUS_WIDTH_4)
+ {
+ clkcr |= HW_SDIO_BUSWIDE_4B;
+ }
+ else
+ {
+ clkcr |= HW_SDIO_BUSWIDE_1B;
+ }
+
+ hw_sdio->clkcr = clkcr;
+
+ switch (io_cfg->power_mode)
+ {
+ case MMCSD_POWER_OFF:
+ hw_sdio->power = HW_SDIO_POWER_OFF;
+ break;
+ case MMCSD_POWER_UP:
+ hw_sdio->power = HW_SDIO_POWER_UP;
+ break;
+ case MMCSD_POWER_ON:
+ hw_sdio->power = HW_SDIO_POWER_ON;
+ break;
+ default:
+ LOG_W("unknown power_mode %d", io_cfg->power_mode);
+ break;
+ }
+
+ RT_HW_SDIO_UNLOCK(sdio);
+}
+
+/**
+ * @brief This function update sdio interrupt.
+ * @param host rt_mmcsd_host
+ * @param enable
+ * @retval None
+ */
+void rt_hw_sdio_irq_update(struct rt_mmcsd_host *host, rt_int32_t enable)
+{
+ struct rt_hw_sdio *sdio = host->private_data;
+ struct at32_sdio *hw_sdio = sdio->sdio_des.hw_sdio;
+
+ if (enable)
+ {
+ LOG_D("enable sdio irq");
+ hw_sdio->mask |= HW_SDIO_IT_SDIOIT;
+ }
+ else
+ {
+ LOG_D("disable sdio irq");
+ hw_sdio->mask &= ~HW_SDIO_IT_SDIOIT;
+ }
+}
+
+/**
+ * @brief This function delect sdcard.
+ * @param host rt_mmcsd_host
+ * @retval 0x01
+ */
+static rt_int32_t rt_hw_sd_delect(struct rt_mmcsd_host *host)
+{
+ LOG_D("try to detect device");
+ return 0x01;
+}
+
+/**
+ * @brief This function interrupt process function.
+ * @param host rt_mmcsd_host
+ * @retval None
+ */
+void rt_hw_sdio_irq_process(struct rt_mmcsd_host *host)
+{
+ int complete = 0;
+ struct rt_hw_sdio *sdio = host->private_data;
+ struct at32_sdio *hw_sdio = sdio->sdio_des.hw_sdio;
+ rt_uint32_t intstatus = hw_sdio->sta;
+
+ if (intstatus & HW_SDIO_ERRORS)
+ {
+ hw_sdio->icr = HW_SDIO_ERRORS;
+ complete = 1;
+ }
+ else
+ {
+ if (intstatus & HW_SDIO_IT_CMDREND)
+ {
+ hw_sdio->icr = HW_SDIO_IT_CMDREND;
+
+ if (sdio->pkg != RT_NULL)
+ {
+ if (!sdio->pkg->cmd->data)
+ {
+ complete = 1;
+ }
+ else if ((sdio->pkg->cmd->data->flags & DATA_DIR_WRITE))
+ {
+ hw_sdio->dctrl |= HW_SDIO_DPSM_ENABLE;
+ }
+ }
+ }
+
+ if (intstatus & HW_SDIO_IT_CMDSENT)
+ {
+ hw_sdio->icr = HW_SDIO_IT_CMDSENT;
+
+ if (resp_type(sdio->pkg->cmd) == RESP_NONE)
+ {
+ complete = 1;
+ }
+ }
+
+ if (intstatus & HW_SDIO_IT_DATAEND)
+ {
+ hw_sdio->icr = HW_SDIO_IT_DATAEND;
+ complete = 1;
+ }
+ }
+
+ if ((intstatus & HW_SDIO_IT_SDIOIT) && (hw_sdio->mask & HW_SDIO_IT_SDIOIT))
+ {
+ hw_sdio->icr = HW_SDIO_IT_SDIOIT;
+ sdio_irq_wakeup(host);
+ }
+
+ if (complete)
+ {
+ hw_sdio->mask &= ~HW_SDIO_ERRORS;
+ rt_event_send(&sdio->event, intstatus);
+ }
+}
+
+static const struct rt_mmcsd_host_ops ops =
+{
+ rt_hw_sdio_request,
+ rt_hw_sdio_iocfg,
+ rt_hw_sd_delect,
+ rt_hw_sdio_irq_update,
+};
+
+/**
+ * @brief This function create mmcsd host.
+ * @param sdio_des at32_sdio_des
+ * @retval rt_mmcsd_host
+ */
+struct rt_mmcsd_host *sdio_host_create(struct at32_sdio_des *sdio_des)
+{
+ struct rt_mmcsd_host *host;
+ struct rt_hw_sdio *sdio = RT_NULL;
+
+ if ((sdio_des == RT_NULL) || (sdio_des->txconfig == RT_NULL) || (sdio_des->rxconfig == RT_NULL))
+ {
+ LOG_E("L:%d F:%s %s %s %s",
+ (sdio_des == RT_NULL ? "sdio_des is NULL" : ""),
+ (sdio_des ? (sdio_des->txconfig ? "txconfig is NULL" : "") : ""),
+ (sdio_des ? (sdio_des->rxconfig ? "rxconfig is NULL" : "") : "")
+ );
+ return RT_NULL;
+ }
+
+ sdio = rt_malloc(sizeof(struct rt_hw_sdio));
+ if (sdio == RT_NULL)
+ {
+ LOG_E("L:%d F:%s malloc rt_hw_sdio fail");
+ return RT_NULL;
+ }
+ rt_memset(sdio, 0, sizeof(struct rt_hw_sdio));
+
+ host = mmcsd_alloc_host();
+ if (host == RT_NULL)
+ {
+ LOG_E("L:%d F:%s mmcsd alloc host fail");
+ rt_free(sdio);
+ return RT_NULL;
+ }
+
+ rt_memcpy(&sdio->sdio_des, sdio_des, sizeof(struct at32_sdio_des));
+ sdio->sdio_des.hw_sdio = (sdio_des->hw_sdio == RT_NULL ? (struct at32_sdio *)SDIO_BASE_ADDRESS : sdio_des->hw_sdio);
+ sdio->sdio_des.clk_get = (sdio_des->clk_get == RT_NULL ? at32_sdio_clk_get : sdio_des->clk_get);
+
+ rt_event_init(&sdio->event, "sdio", RT_IPC_FLAG_FIFO);
+ rt_mutex_init(&sdio->mutex, "sdio", RT_IPC_FLAG_FIFO);
+
+ /* set host defautl attributes */
+ host->ops = &ops;
+ host->freq_min = 400 * 1000;
+ host->freq_max = SDIO_MAX_FREQ;
+ host->valid_ocr = 0X00FFFF80;/* The voltage range supported is 1.65v-3.6v */
+#ifndef SDIO_USING_1_BIT
+ host->flags = MMCSD_BUSWIDTH_4 | MMCSD_MUTBLKWRITE | MMCSD_SUP_SDIO_IRQ;
+#else
+ host->flags = MMCSD_MUTBLKWRITE | MMCSD_SUP_SDIO_IRQ;
+#endif
+ host->max_seg_size = SDIO_BUFF_SIZE;
+ host->max_dma_segs = 1;
+ host->max_blk_size = 512;
+ host->max_blk_count = 512;
+
+ /* link up host and sdio */
+ sdio->host = host;
+ host->private_data = sdio;
+
+ rt_hw_sdio_irq_update(host, 1);
+
+ /* ready to change */
+ mmcsd_change(host);
+
+ return host;
+}
+
+/**
+ * @brief This function configures the DMATX.
+ * @param BufferSRC: pointer to the source buffer
+ * @param BufferSize: buffer size
+ * @retval None
+ */
+void SD_LowLevel_DMA_TxConfig(uint32_t *src, uint32_t *dst, uint32_t BufferSize)
+{
+ static uint32_t size = 0;
+ DMA_InitType DMA_InitStruct;
+ NVIC_InitType NVIC_InitStruct;
+
+ size += BufferSize * 4;
+ sdio_obj.cfg = &sdio_config;
+
+ DMA_DefaultInitParaConfig(&DMA_InitStruct);
+ sdio_obj.dma.handle_tx = sdio_config.dma_tx.Instance;
+ DMA_InitStruct.DMA_Direction = DMA_DIR_PERIPHERALDST;
+ DMA_InitStruct.DMA_BufferSize = BufferSize;
+ DMA_InitStruct.DMA_MemoryBaseAddr = (uint32_t)src;
+ DMA_InitStruct.DMA_MemoryDataWidth = DMA_MEMORYDATAWIDTH_WORD;
+ DMA_InitStruct.DMA_MemoryInc = DMA_MEMORYINC_ENABLE;
+ DMA_InitStruct.DMA_PeripheralBaseAddr = (uint32_t)dst;
+ DMA_InitStruct.DMA_PeripheralDataWidth = DMA_PERIPHERALDATAWIDTH_WORD;
+ DMA_InitStruct.DMA_PeripheralInc = DMA_PERIPHERALINC_DISABLE;
+ DMA_InitStruct.DMA_Priority = DMA_PRIORITY_MEDIUM;
+
+ NVIC_InitStruct.NVIC_IRQChannel = sdio_config.dma_tx.dma_irq;
+ NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
+ NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 2;
+ NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0;
+ NVIC_Init(&NVIC_InitStruct);
+
+ DMA_Init(sdio_obj.dma.handle_tx, &DMA_InitStruct);
+ DMA_INTConfig(sdio_obj.dma.handle_tx, DMA_INT_TC, ENABLE);
+ DMA_ChannelEnable(sdio_obj.dma.handle_tx, ENABLE);
+}
+
+/**
+ * @brief This function configures the DMARX.
+ * @param BufferDST: pointer to the destination buffer
+ * @param BufferSize: buffer size
+ * @retval None
+ */
+void SD_LowLevel_DMA_RxConfig(uint32_t *src, uint32_t *dst, uint32_t BufferSize)
+{
+ sdio_obj.cfg = &sdio_config;
+ DMA_InitType DMA_InitStruct;
+ NVIC_InitType NVIC_InitStruct;
+
+ DMA_DefaultInitParaConfig(&DMA_InitStruct);
+ sdio_obj.dma.handle_rx = sdio_config.dma_rx.Instance;
+ DMA_InitStruct.DMA_Direction = DMA_DIR_PERIPHERALSRC;
+ DMA_InitStruct.DMA_BufferSize = BufferSize;
+ DMA_InitStruct.DMA_MemoryDataWidth = DMA_MEMORYDATAWIDTH_WORD;
+ DMA_InitStruct.DMA_MemoryBaseAddr = (uint32_t)dst;
+ DMA_InitStruct.DMA_MemoryInc = DMA_MEMORYINC_ENABLE;
+ DMA_InitStruct.DMA_PeripheralBaseAddr = (uint32_t)src;
+ DMA_InitStruct.DMA_PeripheralDataWidth = DMA_PERIPHERALDATAWIDTH_WORD;
+ DMA_InitStruct.DMA_PeripheralInc = DMA_PERIPHERALINC_DISABLE;
+ DMA_InitStruct.DMA_Priority = DMA_PRIORITY_MEDIUM;
+
+ NVIC_InitStruct.NVIC_IRQChannel = sdio_config.dma_rx.dma_irq;
+ NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
+ NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 2;
+ NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0;
+ NVIC_Init(&NVIC_InitStruct);
+
+ DMA_Init(sdio_obj.dma.handle_rx, &DMA_InitStruct);
+ DMA_INTConfig(sdio_obj.dma.handle_rx, DMA_INT_TC, ENABLE);
+ DMA_ChannelEnable(sdio_obj.dma.handle_rx, ENABLE);
+}
+
+void DMA2_Channel4_5_IRQHandler(void)
+{
+ if(DMA_GetFlagStatus(DMA2_INT_TC4))
+ {
+ DMA_ClearITPendingBit(DMA2_INT_TC4);
+ DMA_ChannelEnable(sdio_config.dma_rx.Instance, DISABLE);
+ }
+}
+
+/**
+ * @brief This function get at32 sdio clock.
+ * @param hw_sdio: at32_sdio
+ * @retval PCLK2Freq
+ */
+static rt_uint32_t at32_sdio_clock_get(struct at32_sdio *hw_sdio)
+{
+ RCC_ClockType Clocks;
+
+ RCC_GetClocksFreq(&Clocks);
+ return Clocks.AHBCLK_Freq;
+}
+
+static rt_err_t DMA_TxConfig(rt_uint32_t *src, rt_uint32_t *dst, int Size)
+{
+ SD_LowLevel_DMA_TxConfig((uint32_t *)src, (uint32_t *)dst, Size / 4);
+ return RT_EOK;
+}
+
+static rt_err_t DMA_RxConfig(rt_uint32_t *src, rt_uint32_t *dst, int Size)
+{
+ SD_LowLevel_DMA_RxConfig((uint32_t *)src, (uint32_t *)dst, Size / 4);
+ return RT_EOK;
+}
+
+void SDIO1_IRQHandler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+ /* Process All SDIO Interrupt Sources */
+ rt_hw_sdio_irq_process(host);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+int rt_hw_sdio_init(void)
+{
+ struct at32_sdio_des sdio_des;
+ struct at32_sdio_config hsd;
+ NVIC_InitType NVIC_InitStruct;
+
+ hsd.Instance = SDCARD_INSTANCE;
+ at32_msp_sdio_init((void *)(hsd.Instance));
+
+ NVIC_InitStruct.NVIC_IRQChannel = SDIO1_IRQn;
+ NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
+ NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 2;
+ NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0;
+ NVIC_Init(&NVIC_InitStruct);
+
+ sdio_des.clk_get = at32_sdio_clock_get;
+ sdio_des.hw_sdio = (struct at32_sdio *)SDCARD_INSTANCE;
+ sdio_des.rxconfig = DMA_RxConfig;
+ sdio_des.txconfig = DMA_TxConfig;
+
+ host = sdio_host_create(&sdio_des);
+ if (host == RT_NULL)
+ {
+ LOG_E("host create fail");
+ return -1;
+ }
+
+ return 0;
+}
+
+INIT_DEVICE_EXPORT(rt_hw_sdio_init);
+
+void at32_mmcsd_change(void)
+{
+ mmcsd_change(host);
+}
+
+#endif
diff --git a/bsp/at32/Libraries/rt_drivers/drv_sdio.h b/bsp/at32/Libraries/rt_drivers/drv_sdio.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd0f05b9fb61f2b1fd868b8d91215aa74f7514d1
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_sdio.h
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-14 shelton first version
+ */
+
+#ifndef _DRV_SDIO_H
+#define _DRV_SDIO_H
+#include
+#include "rtdevice.h"
+#include
+#include
+#include
+#include
+#include "at32f4xx.h"
+
+#define SDCARD_INSTANCE_TYPE SDIO_Type
+
+#define SDCARD_INSTANCE SDIO1
+
+#define SDIO_BUFF_SIZE 4096
+#define SDIO_ALIGN_LEN 32
+
+#ifndef SDIO_MAX_FREQ
+#define SDIO_MAX_FREQ (1000000)
+#endif
+
+#ifndef SDIO_BASE_ADDRESS
+#define SDIO_BASE_ADDRESS SDIO1_BASE
+#endif
+
+#ifndef SDIO_CLOCK_FREQ
+#define SDIO_CLOCK_FREQ (48U * 1000 * 1000)
+#endif
+
+#ifndef SDIO_BUFF_SIZE
+#define SDIO_BUFF_SIZE (4096)
+#endif
+
+#ifndef SDIO_ALIGN_LEN
+#define SDIO_ALIGN_LEN (32)
+#endif
+
+#ifndef SDIO_MAX_FREQ
+#define SDIO_MAX_FREQ (24 * 1000 * 1000)
+#endif
+
+#define HW_SDIO_IT_CCRCFAIL (0x01U << 0)
+#define HW_SDIO_IT_DCRCFAIL (0x01U << 1)
+#define HW_SDIO_IT_CTIMEOUT (0x01U << 2)
+#define HW_SDIO_IT_DTIMEOUT (0x01U << 3)
+#define HW_SDIO_IT_TXUNDERR (0x01U << 4)
+#define HW_SDIO_IT_RXOVERR (0x01U << 5)
+#define HW_SDIO_IT_CMDREND (0x01U << 6)
+#define HW_SDIO_IT_CMDSENT (0x01U << 7)
+#define HW_SDIO_IT_DATAEND (0x01U << 8)
+#define HW_SDIO_IT_STBITERR (0x01U << 9)
+#define HW_SDIO_IT_DBCKEND (0x01U << 10)
+#define HW_SDIO_IT_CMDACT (0x01U << 11)
+#define HW_SDIO_IT_TXACT (0x01U << 12)
+#define HW_SDIO_IT_RXACT (0x01U << 13)
+#define HW_SDIO_IT_TXFIFOHE (0x01U << 14)
+#define HW_SDIO_IT_RXFIFOHF (0x01U << 15)
+#define HW_SDIO_IT_TXFIFOF (0x01U << 16)
+#define HW_SDIO_IT_RXFIFOF (0x01U << 17)
+#define HW_SDIO_IT_TXFIFOE (0x01U << 18)
+#define HW_SDIO_IT_RXFIFOE (0x01U << 19)
+#define HW_SDIO_IT_TXDAVL (0x01U << 20)
+#define HW_SDIO_IT_RXDAVL (0x01U << 21)
+#define HW_SDIO_IT_SDIOIT (0x01U << 22)
+
+#define HW_SDIO_ERRORS \
+ (HW_SDIO_IT_CCRCFAIL | HW_SDIO_IT_CTIMEOUT | \
+ HW_SDIO_IT_DCRCFAIL | HW_SDIO_IT_DTIMEOUT | \
+ HW_SDIO_IT_RXOVERR | HW_SDIO_IT_TXUNDERR)
+
+#define HW_SDIO_POWER_OFF (0x00U)
+#define HW_SDIO_POWER_UP (0x02U)
+#define HW_SDIO_POWER_ON (0x03U)
+
+#define HW_SDIO_FLOW_ENABLE (0x01U << 14)
+#define HW_SDIO_BUSWIDE_1B (0x00U << 11)
+#define HW_SDIO_BUSWIDE_4B (0x01U << 11)
+#define HW_SDIO_BUSWIDE_8B (0x02U << 11)
+#define HW_SDIO_BYPASS_ENABLE (0x01U << 10)
+#define HW_SDIO_IDLE_ENABLE (0x01U << 9)
+#define HW_SDIO_CLK_ENABLE (0x01U << 8)
+
+#define HW_SDIO_SUSPEND_CMD (0x01U << 11)
+#define HW_SDIO_CPSM_ENABLE (0x01U << 10)
+#define HW_SDIO_WAIT_END (0x01U << 9)
+#define HW_SDIO_WAIT_INT (0x01U << 8)
+#define HW_SDIO_RESPONSE_NO (0x00U << 6)
+#define HW_SDIO_RESPONSE_SHORT (0x01U << 6)
+#define HW_SDIO_RESPONSE_LONG (0x03U << 6)
+
+#define HW_SDIO_DATA_LEN_MASK (0x01FFFFFFU)
+
+#define HW_SDIO_IO_ENABLE (0x01U << 11)
+#define HW_SDIO_RWMOD_CK (0x01U << 10)
+#define HW_SDIO_RWSTOP_ENABLE (0x01U << 9)
+#define HW_SDIO_RWSTART_ENABLE (0x01U << 8)
+#define HW_SDIO_DBLOCKSIZE_1 (0x00U << 4)
+#define HW_SDIO_DBLOCKSIZE_2 (0x01U << 4)
+#define HW_SDIO_DBLOCKSIZE_4 (0x02U << 4)
+#define HW_SDIO_DBLOCKSIZE_8 (0x03U << 4)
+#define HW_SDIO_DBLOCKSIZE_16 (0x04U << 4)
+#define HW_SDIO_DBLOCKSIZE_32 (0x05U << 4)
+#define HW_SDIO_DBLOCKSIZE_64 (0x06U << 4)
+#define HW_SDIO_DBLOCKSIZE_128 (0x07U << 4)
+#define HW_SDIO_DBLOCKSIZE_256 (0x08U << 4)
+#define HW_SDIO_DBLOCKSIZE_512 (0x09U << 4)
+#define HW_SDIO_DBLOCKSIZE_1024 (0x0AU << 4)
+#define HW_SDIO_DBLOCKSIZE_2048 (0x0BU << 4)
+#define HW_SDIO_DBLOCKSIZE_4096 (0x0CU << 4)
+#define HW_SDIO_DBLOCKSIZE_8192 (0x0DU << 4)
+#define HW_SDIO_DBLOCKSIZE_16384 (0x0EU << 4)
+#define HW_SDIO_DMA_ENABLE (0x01U << 3)
+#define HW_SDIO_STREAM_ENABLE (0x01U << 2)
+#define HW_SDIO_TO_HOST (0x01U << 1)
+#define HW_SDIO_DPSM_ENABLE (0x01U << 0)
+
+#define HW_SDIO_DATATIMEOUT (0xF0000000U)
+
+struct at32_sdio
+{
+ volatile rt_uint32_t power;
+ volatile rt_uint32_t clkcr;
+ volatile rt_uint32_t arg;
+ volatile rt_uint32_t cmd;
+ volatile rt_uint32_t respcmd;
+ volatile rt_uint32_t resp1;
+ volatile rt_uint32_t resp2;
+ volatile rt_uint32_t resp3;
+ volatile rt_uint32_t resp4;
+ volatile rt_uint32_t dtimer;
+ volatile rt_uint32_t dlen;
+ volatile rt_uint32_t dctrl;
+ volatile rt_uint32_t dcount;
+ volatile rt_uint32_t sta;
+ volatile rt_uint32_t icr;
+ volatile rt_uint32_t mask;
+ volatile rt_uint32_t reserved0[2];
+ volatile rt_uint32_t fifocnt;
+ volatile rt_uint32_t reserved1[13];
+ volatile rt_uint32_t fifo;
+};
+
+typedef rt_err_t (*dma_txconfig)(rt_uint32_t *src, rt_uint32_t *dst, int size);
+typedef rt_err_t (*dma_rxconfig)(rt_uint32_t *src, rt_uint32_t *dst, int size);
+typedef rt_uint32_t (*sdio_clk_get)(struct at32_sdio *hw_sdio);
+
+#define SDIO_BUS_CONFIG \
+ { \
+ .Instance = SDIO1, \
+ .dma_rx.dma_rcc = RCC_AHBEN_DMA2EN, \
+ .dma_tx.dma_rcc = RCC_AHBEN_DMA2EN, \
+ .dma_rx.Instance = DMA2_Channel4, \
+ .dma_rx.dma_irq = DMA2_Channel4_5_IRQn, \
+ .dma_tx.Instance = DMA2_Channel4, \
+ .dma_tx.dma_irq = DMA2_Channel4_5_IRQn, \
+ }
+
+struct dma_config {
+ DMA_Channel_Type *Instance;
+ rt_uint32_t dma_rcc;
+ IRQn_Type dma_irq;
+};
+
+struct at32_sdio_des
+{
+ struct at32_sdio *hw_sdio;
+ dma_txconfig txconfig;
+ dma_rxconfig rxconfig;
+ sdio_clk_get clk_get;
+};
+
+struct at32_sdio_config
+{
+ SDCARD_INSTANCE_TYPE *Instance;
+ struct dma_config dma_rx, dma_tx;
+};
+
+/* at32 sdio dirver class */
+struct at32_sdio_class
+{
+ struct at32_sdio_des *des;
+ const struct at32_sdio_config *cfg;
+ struct rt_mmcsd_host host;
+ struct
+ {
+ DMA_Channel_Type* handle_rx;
+ DMA_Channel_Type* handle_tx;
+ } dma;
+};
+
+extern void at32_mmcsd_change(void);
+
+#endif
diff --git a/bsp/at32/Libraries/rt_drivers/drv_soft_i2c.c b/bsp/at32/Libraries/rt_drivers/drv_soft_i2c.c
new file mode 100644
index 0000000000000000000000000000000000000000..266209c245732f82e3351e5654c0f16e9829a298
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_soft_i2c.c
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-09 shelton first version
+ */
+
+#include
+#include "drv_soft_i2c.h"
+
+#ifdef RT_USING_I2C
+
+#define LOG_TAG "drv.i2c"
+#include
+
+#if !defined(BSP_USING_I2C1) && !defined(BSP_USING_I2C2) && !defined(BSP_USING_I2C3) && !defined(BSP_USING_I2C4)
+#error "Please define at least one BSP_USING_I2Cx"
+/* this driver can be disabled at menuconfig → RT-Thread Components → Device Drivers */
+#endif
+
+static const struct at32_soft_i2c_config soft_i2c_config[] =
+{
+#ifdef BSP_USING_I2C1
+ I2C1_BUS_CONFIG,
+#endif
+#ifdef BSP_USING_I2C2
+ i2c_bus_CONFIG,
+#endif
+#ifdef BSP_USING_I2C3
+ I2C3_BUS_CONFIG,
+#endif
+#ifdef BSP_USING_I2C4
+ I2C4_BUS_CONFIG,
+#endif
+};
+
+static struct at32_i2c i2c_obj[sizeof(soft_i2c_config) / sizeof(soft_i2c_config[0])];
+
+/**
+ * This function initializes the i2c pin.
+ *
+ * @param Stm32 i2c dirver class.
+ */
+static void at32_i2c_gpio_init(struct at32_i2c *i2c)
+{
+ struct at32_soft_i2c_config* cfg = (struct at32_soft_i2c_config*)i2c->ops.data;
+
+ rt_pin_mode(cfg->scl, PIN_MODE_OUTPUT_OD);
+ rt_pin_mode(cfg->sda, PIN_MODE_OUTPUT_OD);
+
+ rt_pin_write(cfg->scl, PIN_HIGH);
+ rt_pin_write(cfg->sda, PIN_HIGH);
+}
+
+/**
+ * This function sets the sda pin.
+ *
+ * @param Stm32 config class.
+ * @param The sda pin state.
+ */
+static void at32_set_sda(void *data, rt_int32_t state)
+{
+ struct at32_soft_i2c_config* cfg = (struct at32_soft_i2c_config*)data;
+ if (state)
+ {
+ rt_pin_write(cfg->sda, PIN_HIGH);
+ }
+ else
+ {
+ rt_pin_write(cfg->sda, PIN_LOW);
+ }
+}
+
+/**
+ * This function sets the scl pin.
+ *
+ * @param Stm32 config class.
+ * @param The scl pin state.
+ */
+static void at32_set_scl(void *data, rt_int32_t state)
+{
+ struct at32_soft_i2c_config* cfg = (struct at32_soft_i2c_config*)data;
+ if (state)
+ {
+ rt_pin_write(cfg->scl, PIN_HIGH);
+ }
+ else
+ {
+ rt_pin_write(cfg->scl, PIN_LOW);
+ }
+}
+
+/**
+ * This function gets the sda pin state.
+ *
+ * @param The sda pin state.
+ */
+static rt_int32_t at32_get_sda(void *data)
+{
+ struct at32_soft_i2c_config* cfg = (struct at32_soft_i2c_config*)data;
+ return rt_pin_read(cfg->sda);
+}
+
+/**
+ * This function gets the scl pin state.
+ *
+ * @param The scl pin state.
+ */
+static rt_int32_t at32_get_scl(void *data)
+{
+ struct at32_soft_i2c_config* cfg = (struct at32_soft_i2c_config*)data;
+ return rt_pin_read(cfg->scl);
+}
+/**
+ * The time delay function.
+ *
+ * @param microseconds.
+ */
+static void at32_udelay(rt_uint32_t us)
+{
+ rt_uint32_t ticks;
+ rt_uint32_t told, tnow, tcnt = 0;
+ rt_uint32_t reload = SysTick->LOAD;
+
+ ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
+ told = SysTick->VAL;
+ while (1)
+ {
+ tnow = SysTick->VAL;
+ if (tnow != told)
+ {
+ if (tnow < told)
+ {
+ tcnt += told - tnow;
+ }
+ else
+ {
+ tcnt += reload - tnow + told;
+ }
+ told = tnow;
+ if (tcnt >= ticks)
+ {
+ break;
+ }
+ }
+ }
+}
+
+static const struct rt_i2c_bit_ops at32_bit_ops_default =
+{
+ .data = RT_NULL,
+ .set_sda = at32_set_sda,
+ .set_scl = at32_set_scl,
+ .get_sda = at32_get_sda,
+ .get_scl = at32_get_scl,
+ .udelay = at32_udelay,
+ .delay_us = 1,
+ .timeout = 100
+};
+
+/**
+ * if i2c is locked, this function will unlock it
+ *
+ * @param at32 config class
+ *
+ * @return RT_EOK indicates successful unlock.
+ */
+static rt_err_t at32_i2c_bus_unlock(const struct at32_soft_i2c_config *cfg)
+{
+ rt_int32_t i = 0;
+
+ if (PIN_LOW == rt_pin_read(cfg->sda))
+ {
+ while (i++ < 9)
+ {
+ rt_pin_write(cfg->scl, PIN_HIGH);
+ at32_udelay(100);
+ rt_pin_write(cfg->scl, PIN_LOW);
+ at32_udelay(100);
+ }
+ }
+ if (PIN_LOW == rt_pin_read(cfg->sda))
+ {
+ return -RT_ERROR;
+ }
+
+ return RT_EOK;
+}
+
+/* I2C initialization function */
+int rt_hw_i2c_init(void)
+{
+ rt_size_t obj_num = sizeof(i2c_obj) / sizeof(struct at32_i2c);
+ rt_err_t result;
+
+ for (int i = 0; i < obj_num; i++)
+ {
+ i2c_obj[i].ops = at32_bit_ops_default;
+ i2c_obj[i].ops.data = (void*)&soft_i2c_config[i];
+ i2c_obj[i].i2c_bus.priv = &i2c_obj[i].ops;
+ at32_i2c_gpio_init(&i2c_obj[i]);
+ result = rt_i2c_bit_add_bus(&i2c_obj[i].i2c_bus, soft_i2c_config[i].bus_name);
+ RT_ASSERT(result == RT_EOK);
+ at32_i2c_bus_unlock(&soft_i2c_config[i]);
+
+ LOG_D("software simulation %s init done, pin scl: %d, pin sda %d",
+ soft_i2c_config[i].bus_name,
+ soft_i2c_config[i].scl,
+ soft_i2c_config[i].sda);
+ }
+
+ return RT_EOK;
+}
+
+INIT_BOARD_EXPORT(rt_hw_i2c_init);
+
+#endif /* RT_USING_I2C */
diff --git a/bsp/at32/Libraries/rt_drivers/drv_soft_i2c.h b/bsp/at32/Libraries/rt_drivers/drv_soft_i2c.h
new file mode 100644
index 0000000000000000000000000000000000000000..2743259ef6c82aac368916bb41dd4bae4fa7eafb
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_soft_i2c.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-09 shelton first version
+ */
+
+#ifndef __DRV_I2C__
+#define __DRV_I2C__
+
+#include
+#include
+#include
+
+/* at32 config class */
+struct at32_soft_i2c_config
+{
+ rt_uint8_t scl;
+ rt_uint8_t sda;
+ const char *bus_name;
+};
+/* at32 i2c dirver class */
+struct at32_i2c
+{
+ struct rt_i2c_bit_ops ops;
+ struct rt_i2c_bus_device i2c_bus;
+};
+
+#ifdef BSP_USING_I2C1
+#define I2C1_BUS_CONFIG \
+ { \
+ .scl = BSP_I2C1_SCL_PIN, \
+ .sda = BSP_I2C1_SDA_PIN, \
+ .bus_name = "i2c1", \
+ }
+#endif
+
+#ifdef BSP_USING_I2C2
+#define i2c_bus_CONFIG \
+ { \
+ .scl = BSP_I2C2_SCL_PIN, \
+ .sda = BSP_I2C2_SDA_PIN, \
+ .bus_name = "i2c2", \
+ }
+#endif
+
+#ifdef BSP_USING_I2C3
+#define I2C3_BUS_CONFIG \
+ { \
+ .scl = BSP_I2C3_SCL_PIN, \
+ .sda = BSP_I2C3_SDA_PIN, \
+ .bus_name = "i2c3", \
+ }
+#endif
+
+#ifdef BSP_USING_I2C4
+#define I2C4_BUS_CONFIG \
+ { \
+ .scl = BSP_I2C4_SCL_PIN, \
+ .sda = BSP_I2C4_SDA_PIN, \
+ .bus_name = "i2c4", \
+ }
+#endif
+int rt_hw_i2c_init(void);
+
+#endif
diff --git a/bsp/at32/Libraries/rt_drivers/drv_spi.c b/bsp/at32/Libraries/rt_drivers/drv_spi.c
new file mode 100644
index 0000000000000000000000000000000000000000..c7821d4053c8754720b1ed2fd489b1c13667325b
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_spi.c
@@ -0,0 +1,350 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-09 shelton first version
+ */
+
+#include
+#include "drv_spi.h"
+
+#ifdef RT_USING_SPI
+#if !defined(BSP_USING_SPI1) && !defined(BSP_USING_SPI2) && \
+ !defined(BSP_USING_SPI3) && !defined(BSP_USING_SPI4)
+#error "Please define at least one SPIx"
+#endif
+
+//#define DEBUG
+
+#define ARR_LEN(__N) (sizeof(__N) / sizeof(__N[0]))
+
+#ifdef DEBUG
+#define DEBUG_PRINTF(...) rt_kprintf(__VA_ARGS__)
+#else
+#define DEBUG_PRINTF(...)
+#endif
+
+/* private rt-thread spi ops function */
+static rt_err_t configure(struct rt_spi_device* device, struct rt_spi_configuration* configuration);
+static rt_uint32_t xfer(struct rt_spi_device* device, struct rt_spi_message* message);
+
+static struct rt_spi_ops at32_spi_ops =
+{
+ configure,
+ xfer
+};
+
+/**
+ * Attach the spi device to SPI bus, this function must be used after initialization.
+ */
+rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, GPIO_Type *cs_gpiox, uint16_t cs_gpio_pin)
+{
+ RT_ASSERT(bus_name != RT_NULL);
+ RT_ASSERT(device_name != RT_NULL);
+
+ rt_err_t result;
+ struct rt_spi_device *spi_device;
+ struct at32_spi_cs *cs_pin;
+
+ /* initialize the cs pin && select the slave*/
+ GPIO_InitType GPIO_InitStruct;
+ GPIO_InitStruct.GPIO_Pins = cs_gpio_pin;
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
+ GPIO_InitStruct.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
+ GPIO_Init(cs_gpiox, &GPIO_InitStruct);
+ GPIO_SetBits(cs_gpiox, cs_gpio_pin);
+
+ /* attach the device to spi bus*/
+ spi_device = (struct rt_spi_device *)rt_malloc(sizeof(struct rt_spi_device));
+ RT_ASSERT(spi_device != RT_NULL);
+ cs_pin = (struct at32_spi_cs *)rt_malloc(sizeof(struct at32_spi_cs));
+ RT_ASSERT(cs_pin != RT_NULL);
+ cs_pin->GPIOx = cs_gpiox;
+ cs_pin->GPIO_Pin = cs_gpio_pin;
+ result = rt_spi_bus_attach_device(spi_device, device_name, bus_name, (void *)cs_pin);
+
+ if (result != RT_EOK)
+ {
+ DEBUG_PRINTF("%s attach to %s faild, %d\n", device_name, bus_name, result);
+ }
+
+ RT_ASSERT(result == RT_EOK);
+
+ DEBUG_PRINTF("%s attach to %s done", device_name, bus_name);
+
+ return result;
+}
+
+static rt_err_t configure(struct rt_spi_device* device,
+ struct rt_spi_configuration* configuration)
+{
+ struct rt_spi_bus * spi_bus = (struct rt_spi_bus *)device->bus;
+ struct at32_spi *spi_instance = (struct at32_spi *)spi_bus->parent.user_data;
+
+ SPI_InitType SPI_InitStruct;
+
+ RT_ASSERT(device != RT_NULL);
+ RT_ASSERT(configuration != RT_NULL);
+
+ at32_msp_spi_init(spi_instance->config->spix);
+
+ /* data_width */
+ if(configuration->data_width <= 8)
+ {
+ SPI_InitStruct.SPI_FrameSize = SPI_FRAMESIZE_8BIT;
+ }
+ else if(configuration->data_width <= 16)
+ {
+ SPI_InitStruct.SPI_FrameSize = SPI_FRAMESIZE_16BIT;
+ }
+ else
+ {
+ return RT_EIO;
+ }
+
+ /* baudrate */
+ {
+ uint32_t spi_apb_clock;
+ uint32_t max_hz;
+ RCC_ClockType RCC_Clocks;
+
+ max_hz = configuration->max_hz;
+
+ RCC_GetClocksFreq(&RCC_Clocks);
+ DEBUG_PRINTF("sys freq: %d\n", RCC_Clocks.SYSCLK_Freq);
+ DEBUG_PRINTF("max freq: %d\n", max_hz);
+
+ if (spi_instance->config->spix == SPI1)
+ {
+ spi_apb_clock = RCC_Clocks.APB2CLK_Freq;
+ DEBUG_PRINTF("pclk2 freq: %d\n", RCC_Clocks.APB2CLK_Freq);
+ }
+ else
+ {
+ spi_apb_clock = RCC_Clocks.APB1CLK_Freq;
+ DEBUG_PRINTF("pclk1 freq: %d\n", RCC_Clocks.APB1CLK_Freq);
+ }
+
+ if(max_hz >= spi_apb_clock/2)
+ {
+ SPI_InitStruct.SPI_MCLKP = SPI_MCLKP_2;
+ }
+ else if (max_hz >= spi_apb_clock/4)
+ {
+ SPI_InitStruct.SPI_MCLKP = SPI_MCLKP_4;
+ }
+ else if (max_hz >= spi_apb_clock/8)
+ {
+ SPI_InitStruct.SPI_MCLKP = SPI_MCLKP_8;
+ }
+ else if (max_hz >= spi_apb_clock/16)
+ {
+ SPI_InitStruct.SPI_MCLKP = SPI_MCLKP_16;
+ }
+ else if (max_hz >= spi_apb_clock/32)
+ {
+ SPI_InitStruct.SPI_MCLKP = SPI_MCLKP_32;
+ }
+ else if (max_hz >= spi_apb_clock/64)
+ {
+ SPI_InitStruct.SPI_MCLKP = SPI_MCLKP_64;
+ }
+ else if (max_hz >= spi_apb_clock/128)
+ {
+ SPI_InitStruct.SPI_MCLKP = SPI_MCLKP_128;
+ }
+ else
+ {
+ /* min prescaler 256 */
+ SPI_InitStruct.SPI_MCLKP = SPI_MCLKP_256;
+ }
+ } /* baudrate */
+
+ switch(configuration->mode & RT_SPI_MODE_3)
+ {
+ case RT_SPI_MODE_0:
+ SPI_InitStruct.SPI_CPHA = SPI_CPHA_1EDGE;
+ SPI_InitStruct.SPI_CPOL = SPI_CPOL_LOW;
+ break;
+ case RT_SPI_MODE_1:
+ SPI_InitStruct.SPI_CPHA = SPI_CPHA_2EDGE;
+ SPI_InitStruct.SPI_CPOL = SPI_CPOL_LOW;
+ break;
+ case RT_SPI_MODE_2:
+ SPI_InitStruct.SPI_CPHA = SPI_CPHA_1EDGE;
+ SPI_InitStruct.SPI_CPOL = SPI_CPOL_HIGH;
+ break;
+ case RT_SPI_MODE_3:
+ SPI_InitStruct.SPI_CPHA = SPI_CPHA_2EDGE;
+ SPI_InitStruct.SPI_CPOL = SPI_CPOL_HIGH;
+ break;
+ }
+
+ /* MSB or LSB */
+ if(configuration->mode & RT_SPI_MSB)
+ {
+ SPI_InitStruct.SPI_FirstBit = SPI_FIRSTBIT_MSB;
+ }
+ else
+ {
+ SPI_InitStruct.SPI_FirstBit = SPI_FIRSTBIT_LSB;
+ }
+
+ SPI_InitStruct.SPI_TransMode = SPI_TRANSMODE_FULLDUPLEX;
+ SPI_InitStruct.SPI_Mode = SPI_MODE_MASTER;
+ SPI_InitStruct.SPI_NSSSEL = SPI_NSSSEL_SOFT;
+
+ /* init SPI */
+ SPI_Init(spi_instance->config->spix, &SPI_InitStruct);
+ /* Enable SPI_MASTER */
+ SPI_Enable(spi_instance->config->spix, ENABLE);
+ SPI_CRCEN(spi_instance->config->spix, DISABLE);
+
+ return RT_EOK;
+};
+
+static rt_uint32_t xfer(struct rt_spi_device* device, struct rt_spi_message* message)
+{
+ struct rt_spi_bus * at32_spi_bus = (struct rt_spi_bus *)device->bus;
+ struct at32_spi *spi_instance = (struct at32_spi *)at32_spi_bus->parent.user_data;
+ struct rt_spi_configuration * config = &device->config;
+ struct at32_spi_cs * at32_spi_cs = device->parent.user_data;
+
+ RT_ASSERT(device != NULL);
+ RT_ASSERT(message != NULL);
+
+ /* take CS */
+ if(message->cs_take)
+ {
+ GPIO_ResetBits(at32_spi_cs->GPIOx, at32_spi_cs->GPIO_Pin);
+ DEBUG_PRINTF("spi take cs\n");
+ }
+
+ {
+ if(config->data_width <= 8)
+ {
+ const rt_uint8_t * send_ptr = message->send_buf;
+ rt_uint8_t * recv_ptr = message->recv_buf;
+ rt_uint32_t size = message->length;
+
+ DEBUG_PRINTF("spi poll transfer start: %d\n", size);
+
+ while(size--)
+ {
+ rt_uint8_t data = 0xFF;
+
+ if(send_ptr != RT_NULL)
+ {
+ data = *send_ptr++;
+ }
+
+ // Todo: replace register read/write by at32 lib
+ //Wait until the transmit buffer is empty
+ while(RESET == SPI_I2S_GetFlagStatus(spi_instance->config->spix, SPI_I2S_FLAG_TE));
+ // Send the byte
+ SPI_I2S_TxData(spi_instance->config->spix, data);
+
+ //Wait until a data is received
+ while(RESET == SPI_I2S_GetFlagStatus(spi_instance->config->spix, SPI_I2S_FLAG_RNE));
+ // Get the received data
+ data = SPI_I2S_RxData(spi_instance->config->spix);
+
+ if(recv_ptr != RT_NULL)
+ {
+ *recv_ptr++ = data;
+ }
+ }
+ DEBUG_PRINTF("spi poll transfer finsh\n");
+ }
+ else if(config->data_width <= 16)
+ {
+ const rt_uint16_t * send_ptr = message->send_buf;
+ rt_uint16_t * recv_ptr = message->recv_buf;
+ rt_uint32_t size = message->length;
+
+ while(size--)
+ {
+ rt_uint16_t data = 0xFF;
+
+ if(send_ptr != RT_NULL)
+ {
+ data = *send_ptr++;
+ }
+
+ //Wait until the transmit buffer is empty
+ while(RESET == SPI_I2S_GetFlagStatus(spi_instance->config->spix, SPI_I2S_FLAG_TE));
+ // Send the byte
+ SPI_I2S_TxData(spi_instance->config->spix, data);
+
+ //Wait until a data is received
+ while(RESET == SPI_I2S_GetFlagStatus(spi_instance->config->spix, SPI_I2S_FLAG_RNE));
+ // Get the received data
+ data = SPI_I2S_RxData(spi_instance->config->spix);
+
+ if(recv_ptr != RT_NULL)
+ {
+ *recv_ptr++ = data;
+ }
+ }
+ }
+ }
+
+ /* release CS */
+ if(message->cs_release)
+ {
+ GPIO_SetBits(at32_spi_cs->GPIOx, at32_spi_cs->GPIO_Pin);
+ DEBUG_PRINTF("spi release cs\n");
+ }
+
+ return message->length;
+};
+
+static struct at32_spi_config configs[] = {
+#ifdef BSP_USING_SPI1
+ {SPI1, "spi1"},
+#endif
+
+#ifdef BSP_USING_SPI2
+ {SPI2, "spi2"},
+#endif
+
+#ifdef BSP_USING_SPI3
+ {SPI3, "spi3"},
+#endif
+
+#ifdef BSP_USING_SPI4
+ {SPI4, "spi4"},
+#endif
+};
+
+static struct at32_spi spis[sizeof(configs) / sizeof(configs[0])] = {0};
+
+/** \brief init and register at32 spi bus.
+ *
+ * \param SPI: at32 SPI, e.g: SPI1,SPI2,SPI3.
+ * \param spi_bus_name: spi bus name, e.g: "spi1"
+ * \return
+ *
+ */
+int rt_hw_spi_init(void)
+{
+ int i;
+ rt_err_t result;
+ rt_size_t obj_num = sizeof(spis) / sizeof(struct at32_spi);
+
+ for (i = 0; i < obj_num; i++)
+ {
+ spis[i].config = &configs[i];
+ spis[i].spi_bus.parent.user_data = (void *)&spis[i];
+ result = rt_spi_bus_register(&(spis[i].spi_bus), spis[i].config->spi_name, &at32_spi_ops);
+ }
+
+ return result;
+}
+
+INIT_BOARD_EXPORT(rt_hw_spi_init);
+
+#endif
diff --git a/bsp/at32/Libraries/rt_drivers/drv_spi.h b/bsp/at32/Libraries/rt_drivers/drv_spi.h
new file mode 100644
index 0000000000000000000000000000000000000000..d3134b00f02f671e8a0628b628e0037cc5d91540
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_spi.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-09 shelton first version
+ */
+
+#ifndef __DRV_SPI__
+#define __DRV_SPI__
+
+#include
+#include
+#include "at32f4xx.h"
+
+struct at32_spi_config
+{
+ SPI_Type *spix;
+ const char *spi_name;
+};
+
+struct at32_spi
+{
+ struct at32_spi_config *config;
+ struct rt_spi_bus spi_bus;
+};
+
+struct at32_spi_cs
+{
+ GPIO_Type *GPIOx;
+ uint32_t GPIO_Pin;
+};
+
+/* public function */
+int rt_hw_spi_init(void);
+rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, GPIO_Type *cs_gpiox, uint16_t cs_gpio_pin);
+
+#endif // __DRV_SPI__
diff --git a/bsp/at32/Libraries/rt_drivers/drv_sram.c b/bsp/at32/Libraries/rt_drivers/drv_sram.c
new file mode 100644
index 0000000000000000000000000000000000000000..e601b0e1a501d8f04d77648410d681b395b89d6c
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_sram.c
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2018-12-04 Leo first version
+ */
+
+#include
+#include
+#include "drv_sram.h"
+
+#ifdef BSP_USING_SRAM
+
+#define DRV_DEBUG
+#define LOG_TAG "drv.sram"
+#include
+
+uint16_t RT_TxBuffer[RT_BUFFER_SIZE];
+uint16_t RT_RxBuffer[RT_BUFFER_SIZE];
+uint32_t WriteReadStatus = 0, Index = 0;
+
+
+#ifdef RT_USING_MEMHEAP_AS_HEAP
+static struct rt_memheap system_heap;
+#endif
+
+
+
+static int rt_hw_sram_Init(void)
+{
+ int result = RT_EOK;
+ XMC_Bank1_Type *XMC;
+ XMC_NORSRAMInitType XMC_NORSRAMInitStructure;
+ XMC_NORSRAMTimingInitType p;
+
+ /* Init XMC pin */
+ at32_msp_xmc_init(XMC);
+
+ /*-- FSMC Configuration ------------------------------------------------------*/
+ p.XMC_AdrOpTime = 0x04;
+ p.XMC_AdrHoldTime = 0x04;
+ p.XMC_DataOpTime = 0x0a;
+ p.XMC_IntervalBetweenOP = 0x0;
+ p.XMC_CLKPsc = 0x0;
+ p.XMC_DataStableTime = 0x0;
+ p.XMC_Mode = XMC_Mode_A;
+
+ XMC_NORSRAMInitStructure.XMC_Bank = XMC_Bank1_NORSRAM3;
+ XMC_NORSRAMInitStructure.XMC_DataAdrMux = XMC_DataAdrMux_Disable;
+ XMC_NORSRAMInitStructure.XMC_Dev = XMC_Dev_SRAM;
+ XMC_NORSRAMInitStructure.XMC_BusType = XMC_BusType_16b;
+ XMC_NORSRAMInitStructure.XMC_EnableBurstMode = XMC_BurstMode_Disable;
+ XMC_NORSRAMInitStructure.XMC_EnableAsynWait = XMC_AsynWait_Disable;
+ XMC_NORSRAMInitStructure.XMC_WaitSignalLv = XMC_WaitSignalLv_Low;
+ XMC_NORSRAMInitStructure.XMC_EnableBurstModeSplit = XMC_BurstModeSplit_Disable;
+ XMC_NORSRAMInitStructure.XMC_WaitSignalConfig = XMC_WaitSignalConfig_BeforeWaitState;
+ XMC_NORSRAMInitStructure.XMC_EnableWrite = XMC_WriteOperation_Enable;
+ XMC_NORSRAMInitStructure.XMC_EnableWaitSignal = XMC_WaitSignal_Disable;
+ XMC_NORSRAMInitStructure.XMC_EnableWriteTiming = XMC_WriteTiming_Disable;
+ XMC_NORSRAMInitStructure.XMC_WriteBurstSyn = XMC_WriteBurstSyn_Disable;
+ XMC_NORSRAMInitStructure.XMC_RWTimingStruct = &p;
+ XMC_NORSRAMInitStructure.XMC_WTimingStruct = &p;
+
+ XMC_NORSRAMInit(&XMC_NORSRAMInitStructure);
+
+ /*!< Enable FSMC Bank1_SRAM Bank */
+ XMC_NORSRAMCmd(XMC_Bank1_NORSRAM3, ENABLE);
+
+#ifdef RT_USING_MEMHEAP_AS_HEAP
+ /* If RT_USING_MEMHEAP_AS_HEAP is enabled, SRAM is initialized to the heap */
+ rt_memheap_init(&system_heap, "sram", (void *)EXT_SRAM_BEGIN, SRAM_LENGTH);
+#endif
+
+ return result;
+}
+INIT_BOARD_EXPORT(rt_hw_sram_Init);
+
+#ifdef DRV_DEBUG
+#ifdef FINSH_USING_MSH
+/**
+ * @brief Writes a Half-word buffer to the FSMC SRAM memory.
+ * @param pBuffer : pointer to buffer.
+ * @param WriteAddr : SRAM memory internal address from which the data will be
+ * written.
+ * @param NumHalfwordToWrite : number of half-words to write.
+ * @retval None
+ */
+static void SRAM_WriteBuffer(uint16_t* pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite)
+{
+ for(; NumHalfwordToWrite != 0; NumHalfwordToWrite--) /*!< while there is data to write */
+ {
+ /*!< Transfer data to the memory */
+ *(uint16_t *) (EXT_SRAM_BEGIN + WriteAddr) = *pBuffer++;
+
+ /*!< Increment the address*/
+ WriteAddr += 2;
+ }
+}
+
+/**
+ * @brief Reads a block of data from the FSMC SRAM memory.
+ * @param pBuffer : pointer to the buffer that receives the data read from the
+ * SRAM memory.
+ * @param ReadAddr : SRAM memory internal address to read from.
+ * @param NumHalfwordToRead : number of half-words to read.
+ * @retval None
+ */
+static void SRAM_ReadBuffer(uint16_t* pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead)
+{
+ for(; NumHalfwordToRead != 0; NumHalfwordToRead--) /*!< while there is data to read */
+ {
+ /*!< Read a half-word from the memory */
+ *pBuffer++ = *(__IO uint16_t*) (EXT_SRAM_BEGIN + ReadAddr);
+
+ /*!< Increment the address*/
+ ReadAddr += 2;
+ }
+}
+
+/**
+ * @brief Fill the global buffer
+ * @param pBuffer: pointer on the Buffer to fill
+ * @param BufferSize: size of the buffer to fill
+ * @param Offset: first value to fill on the Buffer
+ */
+static void Fill_Buffer(uint16_t *pBuffer, uint16_t BufferLenght, uint32_t Offset)
+{
+ uint16_t IndexTmp = 0;
+
+ /* Put in global buffer same values */
+ for (IndexTmp = 0; IndexTmp < BufferLenght; IndexTmp++ )
+ {
+ pBuffer[IndexTmp] = IndexTmp + Offset;
+ }
+}
+
+int sram_test(void)
+{
+ /* Write data to XMC SRAM memory */
+ /* Fill the buffer to send */
+ Fill_Buffer(RT_TxBuffer, RT_BUFFER_SIZE, 0x3212);
+ SRAM_WriteBuffer(RT_TxBuffer, RT_WRITE_READ_ADDR, RT_BUFFER_SIZE);
+
+
+ /* Read data from XMC SRAM memory */
+ SRAM_ReadBuffer(RT_RxBuffer, RT_WRITE_READ_ADDR, RT_BUFFER_SIZE);
+
+ /* Read back SRAM memory and check content correctness */
+ for (Index = 0x00; (Index < RT_BUFFER_SIZE) && (WriteReadStatus == 0); Index++)
+ {
+ if (RT_RxBuffer[Index] != RT_TxBuffer[Index])
+ {
+ WriteReadStatus = Index + 1;
+ }
+ }
+
+ if(WriteReadStatus == 0)
+ {
+ LOG_D("SRAM test success!");
+ }
+ else
+ {
+ LOG_E("SRAM test failed!");
+ }
+
+ return RT_EOK;
+}
+MSH_CMD_EXPORT(sram_test, sram test)
+#endif /* FINSH_USING_MSH */
+#endif /* DRV_DEBUG */
+#endif /* BSP_USING_SRAM */
diff --git a/bsp/at32/Libraries/rt_drivers/drv_sram.h b/bsp/at32/Libraries/rt_drivers/drv_sram.h
new file mode 100644
index 0000000000000000000000000000000000000000..05b07e415509689d302f4a947218d0540f959bc1
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_sram.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-21 shelton first version
+ */
+
+#ifndef __DRV_SRAM__
+#define __DRV_SRAM__
+
+#include
+#include "at32f4xx.h"
+
+#define SRAM_LENGTH ((uint32_t)0x100000)
+#define EXT_SRAM_BEGIN ((uint32_t)0x68000000)
+#define EXT_SRAM_END (EXT_SRAM_BEGIN + SRAM_LENGTH)
+
+#define RT_BUFFER_SIZE 0x400
+#define RT_WRITE_READ_ADDR 0x8000
+
+#endif // __DRV_SRAM__
diff --git a/bsp/at32/Libraries/rt_drivers/drv_usart.c b/bsp/at32/Libraries/rt_drivers/drv_usart.c
new file mode 100644
index 0000000000000000000000000000000000000000..226d9afedaef1a0f7e8c60f9b8a0055071a2c014
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_usart.c
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-06 shelton first version
+ */
+
+#include
+#include "drv_usart.h"
+
+#ifdef RT_USING_SERIAL
+#if !defined(BSP_USING_UART1) && !defined(BSP_USING_UART2) && \
+ !defined(BSP_USING_UART3)
+ #error "Please define at least one BSP_USING_UARTx"
+ /* this driver can be disabled at menuconfig RT-Thread Components Device Drivers */
+#endif
+
+struct at32_usart {
+ char *name;
+ USART_Type* usartx;
+ IRQn_Type irqn;
+ struct rt_serial_device serial;
+};
+
+enum {
+#ifdef BSP_USING_UART1
+ USART1_INDEX,
+#endif
+#ifdef BSP_USING_UART2
+ USART2_INDEX,
+#endif
+#ifdef BSP_USING_UART3
+ USART3_INDEX,
+#endif
+};
+
+static struct at32_usart usart_config[] = {
+#ifdef BSP_USING_UART1
+ { "uart1",
+ USART1,
+ USART1_IRQn, },
+#endif
+#ifdef BSP_USING_UART2
+ { "uart2",
+ USART2,
+ USART2_IRQn, },
+#endif
+#ifdef BSP_USING_UART3
+ { "uart3",
+ USART3,
+ USART3_IRQn, },
+#endif
+};
+
+static rt_err_t at32_configure(struct rt_serial_device *serial,
+ struct serial_configure *cfg) {
+ struct at32_usart *usart_instance = (struct at32_usart *) serial->parent.user_data;
+ USART_InitType USART_InitStructure;
+
+ RT_ASSERT(serial != RT_NULL);
+ RT_ASSERT(cfg != RT_NULL);
+
+ RT_ASSERT(usart_instance != RT_NULL);
+
+ at32_msp_usart_init((void *)usart_instance->usartx);
+
+ USART_StructInit(&USART_InitStructure);
+
+ USART_Reset(usart_instance->usartx);
+ USART_InitStructure.USART_BaudRate = cfg->baud_rate;
+ USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
+ USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
+
+ switch (cfg->data_bits) {
+ case DATA_BITS_8:
+ USART_InitStructure.USART_WordLength = USART_WordLength_8b;
+ break;
+
+ case DATA_BITS_9:
+ USART_InitStructure.USART_WordLength = USART_WordLength_9b;
+ break;
+ default:
+ USART_InitStructure.USART_WordLength = USART_WordLength_8b;
+ break;
+ }
+
+ switch (cfg->stop_bits) {
+ case STOP_BITS_1:
+ USART_InitStructure.USART_StopBits = USART_StopBits_1;
+ break;
+ case STOP_BITS_2:
+ USART_InitStructure.USART_StopBits = USART_StopBits_2;
+ break;
+ default:
+ USART_InitStructure.USART_StopBits = USART_StopBits_1;
+ break;
+ }
+
+ switch (cfg->parity) {
+ case PARITY_NONE:
+ USART_InitStructure.USART_Parity = USART_Parity_No;
+ break;
+ case PARITY_ODD:
+ USART_InitStructure.USART_Parity = USART_Parity_Odd;
+ break;
+ case PARITY_EVEN:
+ USART_InitStructure.USART_Parity = USART_Parity_Even;
+ break;
+ default:
+ USART_InitStructure.USART_Parity = USART_Parity_No;
+ break;
+ }
+ USART_Init(usart_instance->usartx, &USART_InitStructure);
+ USART_Cmd(usart_instance->usartx, ENABLE);
+
+ return RT_EOK;
+}
+
+static rt_err_t at32_control(struct rt_serial_device *serial, int cmd,
+ void *arg) {
+ struct at32_usart *usart;
+
+ NVIC_InitType NVIC_InitStruct;
+
+ RT_ASSERT(serial != RT_NULL);
+ usart = (struct at32_usart *) serial->parent.user_data;
+ RT_ASSERT(usart != RT_NULL);
+
+ NVIC_InitStruct.NVIC_IRQChannel = usart->irqn;
+ NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 2;
+ NVIC_InitStruct.NVIC_IRQChannelSubPriority = 1;
+
+ switch (cmd) {
+ case RT_DEVICE_CTRL_CLR_INT:
+ NVIC_InitStruct.NVIC_IRQChannelCmd = DISABLE;
+ NVIC_Init(&NVIC_InitStruct);
+ USART_INTConfig(usart->usartx, USART_INT_RDNE, DISABLE);
+ break;
+ case RT_DEVICE_CTRL_SET_INT:
+ NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
+ NVIC_Init(&NVIC_InitStruct);
+ USART_INTConfig(usart->usartx, USART_INT_RDNE, ENABLE);
+ break;
+ }
+
+ return RT_EOK;
+}
+
+static int at32_putc(struct rt_serial_device *serial, char ch) {
+ struct at32_usart *usart;
+
+ RT_ASSERT(serial != RT_NULL);
+ usart = (struct at32_usart *) serial->parent.user_data;
+ RT_ASSERT(usart != RT_NULL);
+
+ USART_SendData(usart->usartx, (uint8_t) ch);
+ while (USART_GetFlagStatus(usart->usartx, USART_FLAG_TDE) == RESET);
+
+ return 1;
+}
+
+static int at32_getc(struct rt_serial_device *serial) {
+ int ch;
+ struct at32_usart *usart;
+
+ RT_ASSERT(serial != RT_NULL);
+ usart = (struct at32_usart *) serial->parent.user_data;
+ RT_ASSERT(usart != RT_NULL);
+
+ ch = -1;
+ if (RESET != USART_GetFlagStatus(usart->usartx, USART_FLAG_RDNE)) {
+ ch = USART_ReceiveData(usart->usartx) & 0xff;
+ }
+
+ return ch;
+}
+
+static const struct rt_uart_ops at32_usart_ops = {
+ at32_configure,
+ at32_control,
+ at32_putc,
+ at32_getc,
+ RT_NULL };
+
+static void usart_isr(struct rt_serial_device *serial) {
+ struct at32_usart *usart_instance;
+
+ RT_ASSERT(serial != RT_NULL);
+
+ usart_instance = (struct at32_usart *) serial->parent.user_data;
+ RT_ASSERT(usart_instance != RT_NULL);
+
+ if ((USART_GetITStatus(usart_instance->usartx, USART_INT_RDNE) != RESET) \
+ && (RESET != USART_GetFlagStatus(usart_instance->usartx, USART_FLAG_RDNE))) {
+ rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND);
+ USART_ClearITPendingBit(usart_instance->usartx, USART_INT_RDNE);
+ USART_ClearFlag(usart_instance->usartx, USART_FLAG_RDNE);
+ } else {
+ if (USART_GetFlagStatus(usart_instance->usartx, USART_FLAG_CTSF) != RESET) {
+ USART_ClearFlag(usart_instance->usartx, USART_FLAG_CTSF);
+ }
+
+ if (USART_GetFlagStatus(usart_instance->usartx, USART_FLAG_LBDF) != RESET) {
+ USART_ClearFlag(usart_instance->usartx, USART_FLAG_LBDF);
+ }
+
+ if (USART_GetFlagStatus(usart_instance->usartx, USART_FLAG_TRAC) != RESET) {
+ USART_ClearFlag(usart_instance->usartx, USART_FLAG_TRAC);
+ }
+ }
+}
+
+#ifdef BSP_USING_UART1
+void USART1_IRQHandler(void) {
+ rt_interrupt_enter();
+
+ usart_isr(&usart_config[USART1_INDEX].serial);
+
+ rt_interrupt_leave();
+}
+#endif
+#ifdef BSP_USING_UART2
+void USART2_IRQHandler(void) {
+ rt_interrupt_enter();
+
+ usart_isr(&usart_config[USART2_INDEX].serial);
+
+ rt_interrupt_leave();
+}
+#endif
+#ifdef BSP_USING_UART3
+void USART3_IRQHandler(void) {
+ rt_interrupt_enter();
+
+ usart_isr(&usart_config[USART3_INDEX].serial);
+
+ rt_interrupt_leave();
+}
+#endif
+
+int rt_hw_usart_init(void) {
+ rt_size_t obj_num;
+ int index;
+
+ obj_num = sizeof(usart_config) / sizeof(struct at32_usart);
+ struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
+ rt_err_t result = 0;
+
+ for (index = 0; index < obj_num; index++) {
+ usart_config[index].serial.ops = &at32_usart_ops;
+ usart_config[index].serial.config = config;
+
+ /* register UART device */
+ result = rt_hw_serial_register(&usart_config[index].serial,
+ usart_config[index].name,
+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX
+ | RT_DEVICE_FLAG_INT_TX, &usart_config[index]);
+ RT_ASSERT(result == RT_EOK);
+ }
+
+ return result;
+}
+
+INIT_BOARD_EXPORT(rt_hw_usart_init);
+
+#endif /* BSP_USING_SERIAL */
+
+/******************** end of file *******************/
diff --git a/bsp/at32/Libraries/rt_drivers/drv_usart.h b/bsp/at32/Libraries/rt_drivers/drv_usart.h
new file mode 100644
index 0000000000000000000000000000000000000000..1002a6fd518385c278cbae6fe84e6c010e47518a
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_usart.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-03-04 shelton first version
+ */
+
+#ifndef __DRV_UART_H__
+#define __DRV_UART_H__
+
+#include
+#include
+
+int rt_hw_usart_init(void);
+
+#endif /* __DRV_USART_H__ */
+
+/******************* end of file *******************/
diff --git a/bsp/at32/Libraries/rt_drivers/drv_wdt.c b/bsp/at32/Libraries/rt_drivers/drv_wdt.c
new file mode 100644
index 0000000000000000000000000000000000000000..8ab3de703d0d530565e36f15ff11335149294396
--- /dev/null
+++ b/bsp/at32/Libraries/rt_drivers/drv_wdt.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-22 shelton first version
+ */
+
+#include
+#include
+
+#ifdef RT_USING_WDT
+
+#define LSI_VALUE 40000
+
+//#define DRV_DEBUG
+#define LOG_TAG "drv.wdt"
+#include
+
+struct at32_wdt_obj
+{
+ IWDG_Type *instance;
+ rt_uint32_t Prescaler;
+ rt_uint32_t Reload;
+ rt_uint16_t is_start;
+};
+static struct at32_wdt_obj at32_wdt;
+static struct rt_watchdog_ops ops;
+static rt_watchdog_t watchdog;
+
+static rt_err_t wdt_init(rt_watchdog_t *wdt)
+{
+ return RT_EOK;
+}
+
+static rt_err_t wdt_control(rt_watchdog_t *wdt, int cmd, void *arg)
+{
+ switch (cmd)
+ {
+ /* feed the watchdog */
+ case RT_DEVICE_CTRL_WDT_KEEPALIVE:
+ IWDG_ReloadCounter();
+ break;
+ /* set watchdog timeout */
+ case RT_DEVICE_CTRL_WDT_SET_TIMEOUT:
+#if defined(LSI_VALUE)
+ if(LSI_VALUE)
+ {
+ at32_wdt.Reload = (*((rt_uint32_t*)arg)) * LSI_VALUE / 256 ;
+ }
+ else
+ {
+ LOG_E("Please define the value of LSI_VALUE!");
+ }
+ if(at32_wdt.Reload > 0xFFF)
+ {
+ LOG_E("wdg set timeout parameter too large, please less than %ds",0xFFF * 256 / LSI_VALUE);
+ return -RT_EINVAL;
+ }
+#else
+ #error "Please define the value of LSI_VALUE!"
+#endif
+ if(at32_wdt.is_start)
+ {
+ IWDG_KeyRegWrite(IWDG_KeyRegWrite_Enable);
+ IWDG_SetPrescaler(at32_wdt.Prescaler);
+ IWDG_SetReload(at32_wdt.Reload);
+ IWDG_KeyRegWrite(IWDG_KeyRegWrite_Disable);
+ IWDG_Enable();
+ }
+ break;
+ case RT_DEVICE_CTRL_WDT_GET_TIMEOUT:
+#if defined(LSI_VALUE)
+ if(LSI_VALUE)
+ {
+ (*((rt_uint32_t*)arg)) = at32_wdt.Reload * 256 / LSI_VALUE;
+ }
+ else
+ {
+ LOG_E("Please define the value of LSI_VALUE!");
+ }
+#else
+ #error "Please define the value of LSI_VALUE!"
+#endif
+ break;
+ case RT_DEVICE_CTRL_WDT_START:
+ IWDG_KeyRegWrite(IWDG_KeyRegWrite_Enable);
+ IWDG_SetPrescaler(at32_wdt.Prescaler);
+ IWDG_SetReload(at32_wdt.Reload);
+ IWDG_KeyRegWrite(IWDG_KeyRegWrite_Disable);
+ IWDG_Enable();
+ at32_wdt.is_start = 1;
+ break;
+ default:
+ LOG_W("This command is not supported.");
+ return -RT_ERROR;
+ }
+ return RT_EOK;
+}
+
+int rt_hw_wdt_init(void)
+{
+ at32_wdt.instance = IWDG;
+ at32_wdt.Prescaler = IWDG_Psc_256;
+ at32_wdt.Reload = 0x00000FFF;
+ at32_wdt.is_start = 0;
+
+ ops.init = &wdt_init;
+ ops.control = &wdt_control;
+ watchdog.ops = &ops;
+ /* register watchdog device */
+ if (rt_hw_watchdog_register(&watchdog, "wdt", RT_DEVICE_FLAG_DEACTIVATE, RT_NULL) != RT_EOK)
+ {
+ LOG_E("wdt device register failed.");
+ return -RT_ERROR;
+ }
+ LOG_D("wdt device register success.");
+ return RT_EOK;
+}
+INIT_BOARD_EXPORT(rt_hw_wdt_init);
+
+#endif /* RT_USING_WDT */
diff --git a/bsp/at32/at32f403a-start/.config b/bsp/at32/at32f403a-start/.config
new file mode 100644
index 0000000000000000000000000000000000000000..b2eee2f3438e5553e47a8756945b55efc41e8f1a
--- /dev/null
+++ b/bsp/at32/at32f403a-start/.config
@@ -0,0 +1,461 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# RT-Thread Configuration
+#
+
+#
+# RT-Thread Kernel
+#
+CONFIG_RT_NAME_MAX=8
+# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
+# CONFIG_RT_USING_SMP is not set
+CONFIG_RT_ALIGN_SIZE=4
+# CONFIG_RT_THREAD_PRIORITY_8 is not set
+CONFIG_RT_THREAD_PRIORITY_32=y
+# CONFIG_RT_THREAD_PRIORITY_256 is not set
+CONFIG_RT_THREAD_PRIORITY_MAX=32
+CONFIG_RT_TICK_PER_SECOND=1000
+CONFIG_RT_USING_OVERFLOW_CHECK=y
+CONFIG_RT_USING_HOOK=y
+CONFIG_RT_USING_IDLE_HOOK=y
+CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
+CONFIG_IDLE_THREAD_STACK_SIZE=256
+CONFIG_RT_USING_TIMER_SOFT=y
+CONFIG_RT_TIMER_THREAD_PRIO=4
+CONFIG_RT_TIMER_THREAD_STACK_SIZE=512
+CONFIG_RT_DEBUG=y
+CONFIG_RT_DEBUG_COLOR=y
+# CONFIG_RT_DEBUG_INIT_CONFIG is not set
+# CONFIG_RT_DEBUG_THREAD_CONFIG is not set
+# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set
+# CONFIG_RT_DEBUG_IPC_CONFIG is not set
+# CONFIG_RT_DEBUG_TIMER_CONFIG is not set
+# CONFIG_RT_DEBUG_IRQ_CONFIG is not set
+# CONFIG_RT_DEBUG_MEM_CONFIG is not set
+# CONFIG_RT_DEBUG_SLAB_CONFIG is not set
+# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set
+# CONFIG_RT_DEBUG_MODULE_CONFIG is not set
+
+#
+# Inter-Thread communication
+#
+CONFIG_RT_USING_SEMAPHORE=y
+CONFIG_RT_USING_MUTEX=y
+CONFIG_RT_USING_EVENT=y
+CONFIG_RT_USING_MAILBOX=y
+CONFIG_RT_USING_MESSAGEQUEUE=y
+# CONFIG_RT_USING_SIGNALS is not set
+
+#
+# Memory Management
+#
+CONFIG_RT_USING_MEMPOOL=y
+CONFIG_RT_USING_MEMHEAP=y
+# CONFIG_RT_USING_NOHEAP is not set
+CONFIG_RT_USING_SMALL_MEM=y
+# CONFIG_RT_USING_SLAB is not set
+# CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set
+# CONFIG_RT_USING_MEMTRACE is not set
+CONFIG_RT_USING_HEAP=y
+
+#
+# Kernel Device Object
+#
+CONFIG_RT_USING_DEVICE=y
+# CONFIG_RT_USING_DEVICE_OPS is not set
+# CONFIG_RT_USING_INTERRUPT_INFO is not set
+CONFIG_RT_USING_CONSOLE=y
+CONFIG_RT_CONSOLEBUF_SIZE=128
+CONFIG_RT_CONSOLE_DEVICE_NAME="uart1"
+CONFIG_RT_VER_NUM=0x40003
+CONFIG_ARCH_ARM=y
+CONFIG_RT_USING_CPU_FFS=y
+CONFIG_ARCH_ARM_CORTEX_M=y
+CONFIG_ARCH_ARM_CORTEX_M4=y
+# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
+
+#
+# RT-Thread Components
+#
+CONFIG_RT_USING_COMPONENTS_INIT=y
+CONFIG_RT_USING_USER_MAIN=y
+CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
+CONFIG_RT_MAIN_THREAD_PRIORITY=10
+
+#
+# C++ features
+#
+# CONFIG_RT_USING_CPLUSPLUS is not set
+
+#
+# Command shell
+#
+CONFIG_RT_USING_FINSH=y
+CONFIG_FINSH_THREAD_NAME="tshell"
+CONFIG_FINSH_USING_HISTORY=y
+CONFIG_FINSH_HISTORY_LINES=5
+CONFIG_FINSH_USING_SYMTAB=y
+CONFIG_FINSH_USING_DESCRIPTION=y
+# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
+CONFIG_FINSH_THREAD_PRIORITY=20
+CONFIG_FINSH_THREAD_STACK_SIZE=4096
+CONFIG_FINSH_CMD_SIZE=80
+# CONFIG_FINSH_USING_AUTH is not set
+CONFIG_FINSH_USING_MSH=y
+CONFIG_FINSH_USING_MSH_DEFAULT=y
+CONFIG_FINSH_USING_MSH_ONLY=y
+CONFIG_FINSH_ARG_MAX=10
+
+#
+# Device virtual file system
+#
+CONFIG_RT_USING_DFS=y
+CONFIG_DFS_USING_WORKDIR=y
+CONFIG_DFS_FILESYSTEMS_MAX=2
+CONFIG_DFS_FILESYSTEM_TYPES_MAX=2
+CONFIG_DFS_FD_MAX=16
+# CONFIG_RT_USING_DFS_MNTTABLE is not set
+CONFIG_RT_USING_DFS_ELMFAT=y
+
+#
+# elm-chan's FatFs, Generic FAT Filesystem Module
+#
+CONFIG_RT_DFS_ELM_CODE_PAGE=437
+CONFIG_RT_DFS_ELM_WORD_ACCESS=y
+# CONFIG_RT_DFS_ELM_USE_LFN_0 is not set
+# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set
+# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
+CONFIG_RT_DFS_ELM_USE_LFN_3=y
+CONFIG_RT_DFS_ELM_USE_LFN=3
+CONFIG_RT_DFS_ELM_MAX_LFN=255
+CONFIG_RT_DFS_ELM_DRIVES=2
+CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512
+# CONFIG_RT_DFS_ELM_USE_ERASE is not set
+CONFIG_RT_DFS_ELM_REENTRANT=y
+CONFIG_RT_USING_DFS_DEVFS=y
+# CONFIG_RT_USING_DFS_ROMFS is not set
+# CONFIG_RT_USING_DFS_RAMFS is not set
+# CONFIG_RT_USING_DFS_UFFS is not set
+# CONFIG_RT_USING_DFS_JFFS2 is not set
+
+#
+# Device Drivers
+#
+CONFIG_RT_USING_DEVICE_IPC=y
+CONFIG_RT_PIPE_BUFSZ=512
+# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
+CONFIG_RT_USING_SERIAL=y
+# CONFIG_RT_SERIAL_USING_DMA is not set
+CONFIG_RT_SERIAL_RB_BUFSZ=64
+# CONFIG_RT_USING_CAN is not set
+# CONFIG_RT_USING_HWTIMER is not set
+# CONFIG_RT_USING_CPUTIME is not set
+# CONFIG_RT_USING_I2C is not set
+CONFIG_RT_USING_PIN=y
+# CONFIG_RT_USING_ADC is not set
+# CONFIG_RT_USING_PWM is not set
+# CONFIG_RT_USING_MTD_NOR is not set
+# CONFIG_RT_USING_MTD_NAND is not set
+# CONFIG_RT_USING_PM is not set
+# CONFIG_RT_USING_RTC is not set
+# CONFIG_RT_USING_SDIO is not set
+# CONFIG_RT_USING_SPI is not set
+# CONFIG_RT_USING_WDT is not set
+# CONFIG_RT_USING_AUDIO is not set
+# CONFIG_RT_USING_SENSOR is not set
+# CONFIG_RT_USING_TOUCH is not set
+# CONFIG_RT_USING_HWCRYPTO is not set
+# CONFIG_RT_USING_PULSE_ENCODER is not set
+# CONFIG_RT_USING_INPUT_CAPTURE is not set
+# CONFIG_RT_USING_WIFI is not set
+
+#
+# Using USB
+#
+# CONFIG_RT_USING_USB_HOST is not set
+# CONFIG_RT_USING_USB_DEVICE is not set
+
+#
+# POSIX layer and C standard library
+#
+CONFIG_RT_USING_LIBC=y
+# CONFIG_RT_USING_PTHREADS is not set
+CONFIG_RT_USING_POSIX=y
+# CONFIG_RT_USING_POSIX_MMAP is not set
+# CONFIG_RT_USING_POSIX_TERMIOS is not set
+# CONFIG_RT_USING_POSIX_AIO is not set
+# CONFIG_RT_USING_MODULE is not set
+
+#
+# Network
+#
+
+#
+# Socket abstraction layer
+#
+# CONFIG_RT_USING_SAL is not set
+
+#
+# Network interface device
+#
+# CONFIG_RT_USING_NETDEV is not set
+
+#
+# light weight TCP/IP stack
+#
+# CONFIG_RT_USING_LWIP is not set
+
+#
+# AT commands
+#
+# CONFIG_RT_USING_AT is not set
+
+#
+# VBUS(Virtual Software BUS)
+#
+# CONFIG_RT_USING_VBUS is not set
+
+#
+# Utilities
+#
+# CONFIG_RT_USING_RYM is not set
+# CONFIG_RT_USING_ULOG is not set
+# CONFIG_RT_USING_UTEST is not set
+# CONFIG_RT_USING_LWP is not set
+
+#
+# RT-Thread online packages
+#
+
+#
+# IoT - internet of things
+#
+# CONFIG_PKG_USING_PAHOMQTT is not set
+# CONFIG_PKG_USING_WEBCLIENT is not set
+# CONFIG_PKG_USING_WEBNET is not set
+# CONFIG_PKG_USING_MONGOOSE is not set
+# CONFIG_PKG_USING_MYMQTT is not set
+# CONFIG_PKG_USING_KAWAII_MQTT is not set
+# CONFIG_PKG_USING_WEBTERMINAL is not set
+# CONFIG_PKG_USING_CJSON is not set
+# CONFIG_PKG_USING_JSMN is not set
+# CONFIG_PKG_USING_LIBMODBUS is not set
+# CONFIG_PKG_USING_FREEMODBUS is not set
+# CONFIG_PKG_USING_LJSON is not set
+# CONFIG_PKG_USING_EZXML is not set
+# CONFIG_PKG_USING_NANOPB is not set
+
+#
+# Wi-Fi
+#
+
+#
+# Marvell WiFi
+#
+# CONFIG_PKG_USING_WLANMARVELL is not set
+
+#
+# Wiced WiFi
+#
+# CONFIG_PKG_USING_WLAN_WICED is not set
+# CONFIG_PKG_USING_RW007 is not set
+# CONFIG_PKG_USING_COAP is not set
+# CONFIG_PKG_USING_NOPOLL is not set
+# CONFIG_PKG_USING_NETUTILS is not set
+# CONFIG_PKG_USING_PPP_DEVICE is not set
+# CONFIG_PKG_USING_AT_DEVICE is not set
+# CONFIG_PKG_USING_ATSRV_SOCKET is not set
+# CONFIG_PKG_USING_WIZNET is not set
+
+#
+# IoT Cloud
+#
+# CONFIG_PKG_USING_ONENET is not set
+# CONFIG_PKG_USING_GAGENT_CLOUD is not set
+# CONFIG_PKG_USING_ALI_IOTKIT is not set
+# CONFIG_PKG_USING_AZURE is not set
+# CONFIG_PKG_USING_TENCENT_IOTHUB is not set
+# CONFIG_PKG_USING_JIOT-C-SDK is not set
+# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
+# CONFIG_PKG_USING_NIMBLE is not set
+# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
+# CONFIG_PKG_USING_IPMSG is not set
+# CONFIG_PKG_USING_LSSDP is not set
+# CONFIG_PKG_USING_AIRKISS_OPEN is not set
+# CONFIG_PKG_USING_LIBRWS is not set
+# CONFIG_PKG_USING_TCPSERVER is not set
+# CONFIG_PKG_USING_PROTOBUF_C is not set
+# CONFIG_PKG_USING_ONNX_PARSER is not set
+# CONFIG_PKG_USING_ONNX_BACKEND is not set
+# CONFIG_PKG_USING_DLT645 is not set
+# CONFIG_PKG_USING_QXWZ is not set
+# CONFIG_PKG_USING_SMTP_CLIENT is not set
+# CONFIG_PKG_USING_ABUP_FOTA is not set
+# CONFIG_PKG_USING_LIBCURL2RTT is not set
+# CONFIG_PKG_USING_CAPNP is not set
+# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
+# CONFIG_PKG_USING_AGILE_TELNET is not set
+
+#
+# security packages
+#
+# CONFIG_PKG_USING_MBEDTLS is not set
+# CONFIG_PKG_USING_libsodium is not set
+# CONFIG_PKG_USING_TINYCRYPT is not set
+# CONFIG_PKG_USING_TFM is not set
+
+#
+# language packages
+#
+# CONFIG_PKG_USING_LUA is not set
+# CONFIG_PKG_USING_JERRYSCRIPT is not set
+# CONFIG_PKG_USING_MICROPYTHON is not set
+
+#
+# multimedia packages
+#
+# CONFIG_PKG_USING_OPENMV is not set
+# CONFIG_PKG_USING_MUPDF is not set
+# CONFIG_PKG_USING_STEMWIN is not set
+# CONFIG_PKG_USING_WAVPLAYER is not set
+# CONFIG_PKG_USING_TJPGD is not set
+
+#
+# tools packages
+#
+# CONFIG_PKG_USING_CMBACKTRACE is not set
+# CONFIG_PKG_USING_EASYFLASH is not set
+# CONFIG_PKG_USING_EASYLOGGER is not set
+# CONFIG_PKG_USING_SYSTEMVIEW is not set
+# CONFIG_PKG_USING_RDB is not set
+# CONFIG_PKG_USING_QRCODE is not set
+# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
+# CONFIG_PKG_USING_ADBD is not set
+# CONFIG_PKG_USING_COREMARK is not set
+# CONFIG_PKG_USING_DHRYSTONE is not set
+# CONFIG_PKG_USING_NR_MICRO_SHELL is not set
+# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set
+# CONFIG_PKG_USING_LUNAR_CALENDAR is not set
+# CONFIG_PKG_USING_BS8116A is not set
+
+#
+# system packages
+#
+# CONFIG_PKG_USING_GUIENGINE is not set
+# CONFIG_PKG_USING_PERSIMMON is not set
+# CONFIG_PKG_USING_CAIRO is not set
+# CONFIG_PKG_USING_PIXMAN is not set
+# CONFIG_PKG_USING_LWEXT4 is not set
+# CONFIG_PKG_USING_PARTITION is not set
+# CONFIG_PKG_USING_FAL is not set
+# CONFIG_PKG_USING_SQLITE is not set
+# CONFIG_PKG_USING_RTI is not set
+# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
+# CONFIG_PKG_USING_CMSIS is not set
+# CONFIG_PKG_USING_DFS_YAFFS is not set
+# CONFIG_PKG_USING_LITTLEFS is not set
+# CONFIG_PKG_USING_THREAD_POOL is not set
+# CONFIG_PKG_USING_ROBOTS is not set
+# CONFIG_PKG_USING_EV is not set
+# CONFIG_PKG_USING_SYSWATCH is not set
+# CONFIG_PKG_USING_SYS_LOAD_MONITOR is not set
+# CONFIG_PKG_USING_PLCCORE is not set
+
+#
+# peripheral libraries and drivers
+#
+# CONFIG_PKG_USING_SENSORS_DRIVERS is not set
+# CONFIG_PKG_USING_REALTEK_AMEBA is not set
+# CONFIG_PKG_USING_SHT2X is not set
+# CONFIG_PKG_USING_SHT3X is not set
+# CONFIG_PKG_USING_STM32_SDIO is not set
+# CONFIG_PKG_USING_ICM20608 is not set
+# CONFIG_PKG_USING_U8G2 is not set
+# CONFIG_PKG_USING_BUTTON is not set
+# CONFIG_PKG_USING_PCF8574 is not set
+# CONFIG_PKG_USING_SX12XX is not set
+# CONFIG_PKG_USING_SIGNAL_LED is not set
+# CONFIG_PKG_USING_LEDBLINK is not set
+# CONFIG_PKG_USING_LITTLED is not set
+# CONFIG_PKG_USING_WM_LIBRARIES is not set
+# CONFIG_PKG_USING_KENDRYTE_SDK is not set
+# CONFIG_PKG_USING_INFRARED is not set
+# CONFIG_PKG_USING_ROSSERIAL is not set
+# CONFIG_PKG_USING_AGILE_BUTTON is not set
+# CONFIG_PKG_USING_AGILE_LED is not set
+# CONFIG_PKG_USING_AT24CXX is not set
+# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set
+# CONFIG_PKG_USING_AD7746 is not set
+# CONFIG_PKG_USING_PCA9685 is not set
+# CONFIG_PKG_USING_I2C_TOOLS is not set
+# CONFIG_PKG_USING_NRF24L01 is not set
+# CONFIG_PKG_USING_TOUCH_DRIVERS is not set
+# CONFIG_PKG_USING_MAX17048 is not set
+# CONFIG_PKG_USING_RPLIDAR is not set
+# CONFIG_PKG_USING_AS608 is not set
+# CONFIG_PKG_USING_RC522 is not set
+# CONFIG_PKG_USING_EMBARC_BSP is not set
+# CONFIG_PKG_USING_EXTERN_RTC_DRIVERS is not set
+
+#
+# miscellaneous packages
+#
+# CONFIG_PKG_USING_LIBCSV is not set
+# CONFIG_PKG_USING_OPTPARSE is not set
+# CONFIG_PKG_USING_FASTLZ is not set
+# CONFIG_PKG_USING_MINILZO is not set
+# CONFIG_PKG_USING_QUICKLZ is not set
+# CONFIG_PKG_USING_MULTIBUTTON is not set
+# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set
+# CONFIG_PKG_USING_CANFESTIVAL is not set
+# CONFIG_PKG_USING_ZLIB is not set
+# CONFIG_PKG_USING_DSTR is not set
+# CONFIG_PKG_USING_TINYFRAME is not set
+# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
+# CONFIG_PKG_USING_DIGITALCTRL is not set
+# CONFIG_PKG_USING_UPACKER is not set
+# CONFIG_PKG_USING_UPARAM is not set
+
+#
+# samples: kernel and components samples
+#
+# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
+# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
+# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
+# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
+# CONFIG_PKG_USING_HELLO is not set
+# CONFIG_PKG_USING_VI is not set
+# CONFIG_PKG_USING_NNOM is not set
+# CONFIG_PKG_USING_LIBANN is not set
+# CONFIG_PKG_USING_ELAPACK is not set
+# CONFIG_PKG_USING_ARMv7M_DWT is not set
+# CONFIG_PKG_USING_VT100 is not set
+# CONFIG_PKG_USING_ULAPACK is not set
+# CONFIG_PKG_USING_UKAL is not set
+CONFIG_SOC_FAMILY_AT32=y
+CONFIG_SOC_SERIES_AT32F403A=y
+
+#
+# Hardware Drivers Config
+#
+CONFIG_SOC_AT32F403AVGT7=y
+
+#
+# Onboard Peripheral Drivers
+#
+CONFIG_BSP_USING_SERIAL=y
+
+#
+# On-chip Peripheral Drivers
+#
+CONFIG_BSP_USING_GPIO=y
+CONFIG_BSP_USING_UART=y
+CONFIG_BSP_USING_UART1=y
+CONFIG_BSP_USING_UART2=y
+CONFIG_BSP_USING_UART3=y
+# CONFIG_BSP_USING_PWM is not set
+# CONFIG_BSP_USING_HWTIMER is not set
+# CONFIG_BSP_USING_SPI is not set
+# CONFIG_BSP_USING_I2C1 is not set
+# CONFIG_BSP_USING_ADC is not set
+# CONFIG_BSP_USING_SDIO is not set
diff --git a/bsp/imxrt/libraries/templates/imxrt1064xxx/settings/project_rtthread.jlink b/bsp/at32/at32f403a-start/JLinkSettings.ini
similarity index 90%
rename from bsp/imxrt/libraries/templates/imxrt1064xxx/settings/project_rtthread.jlink
rename to bsp/at32/at32f403a-start/JLinkSettings.ini
index 39b6d054aa31ff6cb3097d398593ba0320c250f6..770fb65e9b77e8705a9cd9e44df492701abde5a1 100644
--- a/bsp/imxrt/libraries/templates/imxrt1064xxx/settings/project_rtthread.jlink
+++ b/bsp/at32/at32f403a-start/JLinkSettings.ini
@@ -1,39 +1,39 @@
-[BREAKPOINTS]
-ForceImpTypeAny = 0
-ShowInfoWin = 1
-EnableFlashBP = 2
-BPDuringExecution = 0
-[CFI]
-CFISize = 0x00
-CFIAddr = 0x00
-[CPU]
-MonModeVTableAddr = 0xFFFFFFFF
-MonModeDebug = 0
-MaxNumAPs = 0
-LowPowerHandlingMode = 0
-OverrideMemMap = 0
-AllowSimulation = 1
-ScriptFile=""
-[FLASH]
-CacheExcludeSize = 0x00
-CacheExcludeAddr = 0x00
-MinNumBytesFlashDL = 0
-SkipProgOnCRCMatch = 1
-VerifyDownload = 1
-AllowCaching = 1
-EnableFlashDL = 2
-Override = 0
-Device="ARM7"
-[GENERAL]
-WorkRAMSize = 0x00
-WorkRAMAddr = 0x00
-RAMUsageLimit = 0x00
-[SWO]
-SWOLogFile=""
-[MEM]
-RdOverrideOrMask = 0x00
-RdOverrideAndMask = 0xFFFFFFFF
-RdOverrideAddr = 0xFFFFFFFF
-WrOverrideOrMask = 0x00
-WrOverrideAndMask = 0xFFFFFFFF
-WrOverrideAddr = 0xFFFFFFFF
+[BREAKPOINTS]
+ForceImpTypeAny = 0
+ShowInfoWin = 1
+EnableFlashBP = 2
+BPDuringExecution = 0
+[CFI]
+CFISize = 0x00
+CFIAddr = 0x00
+[CPU]
+MonModeVTableAddr = 0xFFFFFFFF
+MonModeDebug = 0
+MaxNumAPs = 0
+LowPowerHandlingMode = 0
+OverrideMemMap = 0
+AllowSimulation = 1
+ScriptFile=""
+[FLASH]
+CacheExcludeSize = 0x00
+CacheExcludeAddr = 0x00
+MinNumBytesFlashDL = 0
+SkipProgOnCRCMatch = 1
+VerifyDownload = 1
+AllowCaching = 1
+EnableFlashDL = 2
+Override = 1
+Device="Cortex-M4"
+[GENERAL]
+WorkRAMSize = 0x00
+WorkRAMAddr = 0x00
+RAMUsageLimit = 0x00
+[SWO]
+SWOLogFile=""
+[MEM]
+RdOverrideOrMask = 0x00
+RdOverrideAndMask = 0xFFFFFFFF
+RdOverrideAddr = 0xFFFFFFFF
+WrOverrideOrMask = 0x00
+WrOverrideAndMask = 0xFFFFFFFF
+WrOverrideAddr = 0xFFFFFFFF
diff --git a/bsp/at32/at32f403a-start/Kconfig b/bsp/at32/at32f403a-start/Kconfig
new file mode 100644
index 0000000000000000000000000000000000000000..7a400db91f4a82292908c8b2b99e87e4193f78d0
--- /dev/null
+++ b/bsp/at32/at32f403a-start/Kconfig
@@ -0,0 +1,22 @@
+mainmenu "RT-Thread Configuration"
+
+config BSP_DIR
+ string
+ option env="BSP_ROOT"
+ default "."
+
+config RTT_DIR
+ string
+ option env="RTT_ROOT"
+ default "../../.."
+
+config PKGS_DIR
+ string
+ option env="PKGS_ROOT"
+ default "packages"
+
+source "$RTT_DIR/Kconfig"
+source "$PKGS_DIR/Kconfig"
+source "../libraries/Kconfig"
+source "board/Kconfig"
+
diff --git a/bsp/at32/at32f403a-start/README.md b/bsp/at32/at32f403a-start/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..59c14061f68e8e5e66b30df8dbc898c7f523fa38
--- /dev/null
+++ b/bsp/at32/at32f403a-start/README.md
@@ -0,0 +1,131 @@
+# AT32F403A AT-START 开发板 BSP 说明
+
+## 简介
+
+AT32F403A AT-START是雅特力推出的一款AT32F403A系列的评估板,其搭载的MCU主要资源参数如下:
+
+| 硬件 | 描述 |
+| --------- | ------------- |
+| 芯片型号 | AT32F403AVGT7 |
+| CPU | ARM Cortex M4 |
+| 主频 | 240M |
+| 片内SRAM | 96K可扩展224K |
+| 片内FLASH | 1024K |
+
+## 编译说明
+
+AT32F403A-START板级包支持MDK4﹑MDK5﹑IAR开发环境和GCC编译器,以下是具体版本信息:
+
+| IDE/编译器 | 已测试版本 |
+| ---------- | ---------------------------- |
+| MDK4 | MDK4.74 |
+| MDK5 | MDK523 |
+| IAR | IAR8.20 |
+| GCC | GCC 5.4.1 20160919 (release) |
+
+## 板载资源
+
+- MCU:AT32F403AVGT7,主频 240MHz,1024KB FLASH ,96KB可扩展到224KB RAM
+- 常用外设
+ - LED:3个,(红色PD13、白色PD14、绿色PD15)
+ - 按键:1个,KEY_USER(兼具唤醒功能,PA0)
+- 常用接口:插针串口J8
+- 调试接口,JLINK、板载的 AT-LINK SWD 下载
+
+## 外设支持
+
+本 BSP 目前对外设驱动的支持情况如下:
+
+| 驱动 | 支持情况 | 备注 |
+| --------- | -------- | :------------------------: |
+| UART | 支持 | USART1/2/3 |
+| GPIO | 支持 | PA0...PF7 |
+| IIC | 支持 | GPIO模拟I2C |
+| SPI | 支持 | SPI1/2 |
+| ADC | 支持 | ADC1/2 |
+| PWM | 支持 | TMR1/2 |
+| HWTIMER | 支持 | TMR3/4/5 |
+| SDIO | 支持 | SDIO1 |
+| WDT | 支持 | |
+
+### IO在板级支持包中的映射情况
+
+| IO号 | 板级包中的定义 |
+| ---- | -------------- |
+| PD13 | LED2 |
+| PD14 | LED3 |
+| PD15 | LED4 |
+| PA9 | USART1_TX |
+| PA10 | USART1_RX |
+| PA2 | USART2_TX |
+| PA3 | USART2_RX |
+| PB10 | USART3_TX |
+| PB11 | USART3_RX |
+| PA4 | SPI1_NSS |
+| PA5 | SPI1_SCK |
+| PA6 | SPI1_MISO |
+| PA7 | SPI1_MOSI |
+| PB12 | SPI2_NSS |
+| PB13 | SPI2_SCK |
+| PB14 | SPI2_MISO |
+| PB15 | SPI2_MOSI |
+| PB6 | I2C1_SCL |
+| PB7 | I2C1_SDA |
+| PC8 | SDIO1_D0 |
+| PC9 | SDIO1_D1 |
+| PC10 | SDIO1_D2 |
+| PC11 | SDIO1_D3 |
+| PC12 | SDIO1_CK |
+| PD2 | SDIO1_CMD |
+| PA8 | PWM_TMR1_CH1 |
+| PA11 | PWM_TMR1_CH4 |
+| PA0 | PWM_TMR2_CH1 |
+| PA1 | PWM_TMR2_CH2 |
+| PC0 | ADC1/2_IN10 |
+| PC1 | ADC1/2_IN11 |
+| PC2 | ADC1/2_IN12 |
+| PC3 | ADC1/2_IN13 |
+| PC4 | ADC1/2_IN14 |
+| PC5 | ADC1/2_IN15 |
+
+## 使用说明
+
+ 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
+
+### 快速上手
+
+本 BSP 为开发者提供 MDK4、MDK5 和 IAR 工程,并且支持 GCC 开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
+
+#### 硬件连接
+
+使用数据线连接开发板到 PC,打开电源开关。
+
+#### 编译下载
+
+双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。
+
+> 工程默认配置使用 JLink 下载程序,在通过 JLink 连接开发板的基础上,点击下载按钮即可下载程序到开发板
+
+#### 运行结果
+
+下载程序成功之后,系统会自动运行,观察开发板上 LED 的运行效果,LED2/3/4 会周期性闪烁。
+
+连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,在串口上可以看到 RT-Thread 的输出信息:
+
+```bash
+ \ | /
+- RT - Thread Operating System
+ / | \ 4.0.3 build Mar 9 2020
+ 2006 - 2020 Copyright by rt-thread team
+msh />
+```
+
+## 注意事项
+
+可在雅特力官方网站进行所需资料下载,如Keil_v5/Keil_v4/IAR等pack安装包和AT-START开发板原理图等(www.arterytek.com)
+
+## 联系人信息
+
+维护人:
+
+- [sheltonyu](https://github.com/sheltonyu)
\ No newline at end of file
diff --git a/bsp/at32/at32f403a-start/SConscript b/bsp/at32/at32f403a-start/SConscript
new file mode 100644
index 0000000000000000000000000000000000000000..20f7689c53ca71a676748f79187f9764065466c5
--- /dev/null
+++ b/bsp/at32/at32f403a-start/SConscript
@@ -0,0 +1,15 @@
+# for module compiling
+import os
+Import('RTT_ROOT')
+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')
diff --git a/bsp/at32/at32f403a-start/SConstruct b/bsp/at32/at32f403a-start/SConstruct
new file mode 100644
index 0000000000000000000000000000000000000000..56d254c02d87d006024baf8390cfbf228ce4cc2c
--- /dev/null
+++ b/bsp/at32/at32f403a-start/SConstruct
@@ -0,0 +1,59 @@
+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 = 'rtthread.' + 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',
+ 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 project.map')
+
+Export('RTT_ROOT')
+Export('rtconfig')
+
+SDK_ROOT = os.path.abspath('./')
+
+if os.path.exists(SDK_ROOT + '/Libraries'):
+ libraries_path_prefix = SDK_ROOT + '/Libraries'
+else:
+ libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/Libraries'
+
+SDK_LIB = libraries_path_prefix
+Export('SDK_LIB')
+
+# prepare building environment
+objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
+
+at32_library = 'AT32_Std_Driver'
+rtconfig.BSP_LIBRARY_TYPE = at32_library
+
+# include libraries
+objs.extend(SConscript(os.path.join(libraries_path_prefix, at32_library, 'SConscript')))
+
+# common include drivers
+objs.extend(SConscript(os.path.join(libraries_path_prefix, 'rt_drivers', 'SConscript')))
+
+# make a building
+DoBuilding(TARGET, objs)
diff --git a/bsp/at32/at32f403a-start/applications/SConscript b/bsp/at32/at32f403a-start/applications/SConscript
new file mode 100644
index 0000000000000000000000000000000000000000..61a0bd61dd6bbce4f5a0728ce7372a4e3c7e3628
--- /dev/null
+++ b/bsp/at32/at32f403a-start/applications/SConscript
@@ -0,0 +1,17 @@
+# RT-Thread building script for component
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+cwd = GetCurrentDir()
+
+# add the general drivers.
+src = Split("""
+main.c
+""")
+
+CPPPATH = [cwd, str(Dir('#'))]
+
+group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/at32/at32f403a-start/applications/main.c b/bsp/at32/at32f403a-start/applications/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..cb63824e27f632948b3db24079447e76e44aaa06
--- /dev/null
+++ b/bsp/at32/at32f403a-start/applications/main.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-08 shelton first version
+ */
+
+#include
+#include
+#include "board.h"
+#include "drv_gpio.h"
+
+/* defined the LED2 pin: PD13 */
+#define LED2_PIN GET_PIN(D, 13)
+/* defined the LED3 pin: PD14 */
+#define LED3_PIN GET_PIN(D, 14)
+/* defined the LED4 pin: PD15 */
+#define LED4_PIN GET_PIN(D, 15)
+
+int main(void)
+{
+ uint32_t Speed = 200;
+ /* set LED2 pin mode to output */
+ rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
+ /* set LED3 pin mode to output */
+ rt_pin_mode(LED3_PIN, PIN_MODE_OUTPUT);
+ /* set LED4 pin mode to output */
+ rt_pin_mode(LED4_PIN, PIN_MODE_OUTPUT);
+
+ while (1)
+ {
+ rt_pin_write(LED2_PIN, PIN_LOW);
+ rt_thread_mdelay(Speed);
+ rt_pin_write(LED3_PIN, PIN_LOW);
+ rt_thread_mdelay(Speed);
+ rt_pin_write(LED4_PIN, PIN_LOW);
+ rt_thread_mdelay(Speed);
+ rt_pin_write(LED2_PIN, PIN_HIGH);
+ rt_thread_mdelay(Speed);
+ rt_pin_write(LED3_PIN, PIN_HIGH);
+ rt_thread_mdelay(Speed);
+ rt_pin_write(LED4_PIN, PIN_HIGH);
+ rt_thread_mdelay(Speed);
+ }
+}
diff --git a/bsp/at32/at32f403a-start/board/Kconfig b/bsp/at32/at32f403a-start/board/Kconfig
new file mode 100644
index 0000000000000000000000000000000000000000..eddf674a68dad8eb731f00e90a9b8f957f60ec32
--- /dev/null
+++ b/bsp/at32/at32f403a-start/board/Kconfig
@@ -0,0 +1,147 @@
+menu "Hardware Drivers Config"
+
+config SOC_AT32F403AVGT7
+ bool
+ select SOC_SERIES_AT32F403A
+ select RT_USING_COMPONENTS_INIT
+ select RT_USING_USER_MAIN
+ default y
+
+menu "Onboard Peripheral Drivers"
+
+ config BSP_USING_SERIAL
+ bool "Enable USART (uart1)"
+ select BSP_USING_UART
+ select BSP_USING_UART1
+ default y
+
+endmenu
+
+menu "On-chip Peripheral Drivers"
+
+ config BSP_USING_GPIO
+ bool "Enable GPIO"
+ select RT_USING_PIN
+ default y
+
+ menuconfig BSP_USING_UART
+ bool "Enable UART"
+ default y
+ select RT_USING_SERIAL
+ if BSP_USING_UART
+ config BSP_USING_UART1
+ bool "Enable UART1"
+ default y
+
+ config BSP_USING_UART2
+ bool "Enable UART2"
+ default n
+
+ config BSP_USING_UART3
+ bool "Enable UART3"
+ default n
+ endif
+
+ menuconfig BSP_USING_PWM
+ bool "Enable PWM"
+ default n
+ select RT_USING_PWM
+ if BSP_USING_PWM
+ menuconfig BSP_USING_TMR1
+ bool "Enable timer1 output PWM"
+ default n
+ if BSP_USING_TMR1
+ config BSP_USING_TMR1_CH1
+ bool "Enable TMR1 channel1 PWM"
+ default n
+
+ config BSP_USING_TMR1_CH4
+ bool "Enable TMR1 channel4 PWM"
+ default n
+ endif
+ menuconfig BSP_USING_TMR2
+ bool "Enable timer2 output PWM"
+ default n
+ if BSP_USING_TMR2
+ config BSP_USING_TMR2_CH1
+ bool "Enable TMR2 channel1 PWM"
+ default n
+
+ config BSP_USING_TMR2_CH2
+ bool "Enable TMR2 channel2 PWM"
+ default n
+ endif
+ endif
+
+ menuconfig BSP_USING_HWTIMER
+ bool "Enable HWTIMER"
+ default n
+ select RT_USING_HWTIMER
+ if BSP_USING_HWTIMER
+ config BSP_USING_HWTMR3
+ bool "Enable hardware timer3"
+ default n
+ config BSP_USING_HWTMR4
+ bool "Enable hardware timer4"
+ default n
+ config BSP_USING_HWTMR5
+ bool "Enable hardware timer5"
+ default n
+ endif
+
+ menuconfig BSP_USING_SPI
+ bool "Enable SPI BUS"
+ default n
+ select RT_USING_SPI
+ if BSP_USING_SPI
+ config BSP_USING_SPI1
+ bool "Enable SPI1 BUS"
+ default n
+
+ config BSP_USING_SPI2
+ bool "Enable SPI2 BUS"
+ default n
+ endif
+
+ menuconfig BSP_USING_I2C1
+ bool "Enable I2C1 BUS (software simulation)"
+ default n
+ select RT_USING_I2C
+ select RT_USING_I2C_BITOPS
+ select RT_USING_PIN
+ if BSP_USING_I2C1
+ config BSP_I2C1_SCL_PIN
+ int "i2c1 scl pin number"
+ range 0 63
+ default 22
+ config BSP_I2C1_SDA_PIN
+ int "I2C1 sda pin number"
+ range 0 63
+ default 23
+ endif
+
+ menuconfig BSP_USING_ADC
+ bool "Enable ADC"
+ default n
+ select RT_USING_ADC
+ if BSP_USING_ADC
+ config BSP_USING_ADC1
+ bool "Enable ADC1"
+ default n
+ config BSP_USING_ADC2
+ bool "Enable ADC2"
+ default n
+ endif
+
+ menuconfig BSP_USING_SDIO
+ bool "Enable SDIO"
+ default n
+ select RT_USING_SDIO
+ if BSP_USING_SDIO
+ config BSP_USING_SDIO1
+ bool "Enable SDIO1"
+ default n
+ endif
+endmenu
+
+endmenu
diff --git a/bsp/at32/at32f403a-start/board/SConscript b/bsp/at32/at32f403a-start/board/SConscript
new file mode 100644
index 0000000000000000000000000000000000000000..aa7f680f6370a083b41ee763eaada71fdedd1147
--- /dev/null
+++ b/bsp/at32/at32f403a-start/board/SConscript
@@ -0,0 +1,30 @@
+import os
+import rtconfig
+from building import *
+
+Import('SDK_LIB')
+
+cwd = GetCurrentDir()
+
+# add general drivers
+src = Split('''
+board.c
+msp/at32_msp.c
+msp/system_at32f4xx.c
+''')
+
+path = [cwd]
+path += [cwd + '/msp']
+
+startup_path_prefix = SDK_LIB
+
+if rtconfig.CROSS_TOOL == 'gcc':
+ src += [startup_path_prefix + '/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/gcc/startup_at32f403avgt7.s']
+elif rtconfig.CROSS_TOOL == 'keil':
+ src += [startup_path_prefix + '/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/mdk/startup_at32f403avgt7.s']
+elif rtconfig.CROSS_TOOL == 'iar':
+ src += [startup_path_prefix + '/AT32_Std_Driver/CMSIS/AT32/AT32F4xx/src/iar/startup_at32f403avgt7.s']
+
+CPPDEFINES = ['AT32F403AVGT7']
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
+Return('group')
diff --git a/bsp/at32/at32f403a-start/board/board.c b/bsp/at32/at32f403a-start/board/board.c
new file mode 100644
index 0000000000000000000000000000000000000000..4ce5bb390907ad3f561df849fe936bacbfe479d5
--- /dev/null
+++ b/bsp/at32/at32f403a-start/board/board.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2018-11-06 balanceTWK first version
+ */
+
+#include
+#include
+#include
+
+#include
+#include
+
+#ifdef BSP_USING_SRAM
+#include "drv_sram.h"
+#endif
+/**
+ * @brief This function is executed in case of error occurrence.
+ * @param None
+ * @retval None
+ */
+void Error_Handler(void)
+{
+ /* USER CODE BEGIN Error_Handler */
+ /* User can add his own implementation to report the HAL error return state */
+ while (1)
+ {
+ }
+ /* USER CODE END Error_Handler */
+}
+
+/** System Clock Configuration
+*/
+void SystemClock_Config(void)
+{
+ SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
+ NVIC_SetPriority(SysTick_IRQn, 0);
+}
+
+/**
+ * This is the timer interrupt service routine.
+ *
+ */
+void SysTick_Handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ rt_tick_increase();
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+/**
+ * This function will initial AT32 board.
+ */
+void rt_hw_board_init()
+{
+ /* NVIC Configuration */
+#define NVIC_VTOR_MASK 0x3FFFFF80
+#ifdef VECT_TAB_RAM
+ /* Set the Vector Table base location at 0x10000000 */
+ SCB->VTOR = (0x10000000 & NVIC_VTOR_MASK);
+#else /* VECT_TAB_FLASH */
+ /* Set the Vector Table base location at 0x08000000 */
+ SCB->VTOR = (0x08000000 & NVIC_VTOR_MASK);
+#endif
+
+ SystemClock_Config();
+
+#ifdef RT_USING_COMPONENTS_INIT
+ rt_components_board_init();
+#endif
+
+#ifdef RT_USING_CONSOLE
+ rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
+#endif
+
+#ifdef BSP_USING_SRAM
+ rt_system_heap_init((void *)EXT_SRAM_BEGIN, (void *)EXT_SRAM_END);
+#else
+ rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
+#endif
+}
diff --git a/bsp/at32/at32f403a-start/board/board.h b/bsp/at32/at32f403a-start/board/board.h
new file mode 100644
index 0000000000000000000000000000000000000000..28bb16bf47309e67a7cba7287834a5f13a1ecde6
--- /dev/null
+++ b/bsp/at32/at32f403a-start/board/board.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020-01-15 shelton first version
+ */
+
+#ifndef __BOARD_H__
+#define __BOARD_H__
+
+#include
+#include "at32_msp.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Internal SRAM memory size[Kbytes] <96>, Default: 96*/
+#define AT32_SRAM_SIZE 96
+#define AT32_SRAM_END (0x20000000 + AT32_SRAM_SIZE * 1024)
+
+#if defined(__CC_ARM) || defined(__CLANG_ARM)
+extern int Image$$RW_IRAM1$$ZI$$Limit;
+#define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
+#elif __ICCARM__
+#pragma section="CSTACK"
+#define HEAP_BEGIN (__segment_end("CSTACK"))
+#else
+extern int __bss_end;
+#define HEAP_BEGIN ((void *)&__bss_end)
+#endif
+
+#define HEAP_END AT32_SRAM_END
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BOARD_H__ */
diff --git a/bsp/at32/at32f403a-start/board/linker_scripts/link.icf b/bsp/at32/at32f403a-start/board/linker_scripts/link.icf
new file mode 100644
index 0000000000000000000000000000000000000000..65c2bfc8b7c4abbd502aa79b25b00260475ba031
--- /dev/null
+++ b/bsp/at32/at32f403a-start/board/linker_scripts/link.icf
@@ -0,0 +1,28 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x08000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x080FFFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20017FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x0400;
+define symbol __ICFEDIT_size_heap__ = 0x0000;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite, last block CSTACK};
\ No newline at end of file
diff --git a/bsp/at32/at32f403a-start/board/linker_scripts/link.lds b/bsp/at32/at32f403a-start/board/linker_scripts/link.lds
new file mode 100644
index 0000000000000000000000000000000000000000..27269dd77ea51e0c09a48af982da401b1cacdc8b
--- /dev/null
+++ b/bsp/at32/at32f403a-start/board/linker_scripts/link.lds
@@ -0,0 +1,156 @@
+/*
+ * linker script for AT32 with GNU ld
+ */
+
+/* Program Entry, set to mark it as "used" and avoid gc */
+MEMORY
+{
+ ROM (rx) : ORIGIN = 0x08000000, LENGTH = 1024k /* 1024KB flash */
+ RAM (rw) : ORIGIN = 0x20000000, LENGTH = 96k /* 96K sram */
+}
+ENTRY(Reset_Handler)
+_system_stack_size = 0x200;
+
+SECTIONS
+{
+ .text :
+ {
+ . = ALIGN(4);
+ _stext = .;
+ KEEP(*(.isr_vector)) /* Startup code */
+
+ . = ALIGN(4);
+ *(.text) /* remaining code */
+ *(.text.*) /* remaining code */
+ *(.rodata) /* read-only data (constants) */
+ *(.rodata*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.gnu.linkonce.t*)
+
+ /* section information for finsh shell */
+ . = ALIGN(4);
+ __fsymtab_start = .;
+ KEEP(*(FSymTab))
+ __fsymtab_end = .;
+
+ . = ALIGN(4);
+ __vsymtab_start = .;
+ KEEP(*(VSymTab))
+ __vsymtab_end = .;
+
+ /* section information for initial. */
+ . = ALIGN(4);
+ __rt_init_start = .;
+ KEEP(*(SORT(.rti_fn*)))
+ __rt_init_end = .;
+
+ . = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
+ _etext = .;
+ } > ROM = 0
+
+ /* .ARM.exidx is sorted, so has to go in its own output section. */
+ __exidx_start = .;
+ .ARM.exidx :
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+
+ /* This is used by the startup in order to initialize the .data secion */
+ _sidata = .;
+ } > ROM
+ __exidx_end = .;
+
+ /* .data section which is used for initialized data */
+
+ .data : AT (_sidata)
+ {
+ . = ALIGN(4);
+ /* This is used by the startup in order to initialize the .data secion */
+ _sdata = . ;
+
+ *(.data)
+ *(.data.*)
+ *(.gnu.linkonce.d*)
+
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
+ . = ALIGN(4);
+ /* This is used by the startup in order to initialize the .data secion */
+ _edata = . ;
+ } >RAM
+
+ .stack :
+ {
+ . = ALIGN(4);
+ _sstack = .;
+ . = . + _system_stack_size;
+ . = ALIGN(4);
+ _estack = .;
+ } >RAM
+
+ __bss_start = .;
+ .bss :
+ {
+ . = ALIGN(4);
+ /* This is used by the startup in order to initialize the .bss secion */
+ _sbss = .;
+
+ *(.bss)
+ *(.bss.*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ /* This is used by the startup in order to initialize the .bss secion */
+ _ebss = . ;
+
+ *(.bss.init)
+ } > RAM
+ __bss_end = .;
+
+ _end = .;
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ /* DWARF debug sections.
+ * Symbols in the DWARF debugging sections are relative to the beginning
+ * of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+}
diff --git a/bsp/at32/at32f403a-start/board/linker_scripts/link.sct b/bsp/at32/at32f403a-start/board/linker_scripts/link.sct
new file mode 100644
index 0000000000000000000000000000000000000000..5498d588538d6e096a448b0a1b3ea15b123ca4a3
--- /dev/null
+++ b/bsp/at32/at32f403a-start/board/linker_scripts/link.sct
@@ -0,0 +1,15 @@
+; *************************************************************
+; *** Scatter-Loading Description File generated by uVision ***
+; *************************************************************
+
+LR_IROM1 0x08000000 0x00100000 { ; load region size_region
+ ER_IROM1 0x08000000 0x00100000 { ; load address = execution address
+ *.o (RESET, +First)
+ *(InRoot$$Sections)
+ .ANY (+RO)
+ }
+ RW_IRAM1 0x20000000 0x00018000 { ; RW data
+ .ANY (+RW +ZI)
+ }
+}
+
diff --git a/bsp/at32/at32f403a-start/board/msp/at32_msp.c b/bsp/at32/at32f403a-start/board/msp/at32_msp.c
new file mode 100644
index 0000000000000000000000000000000000000000..272c47bca44aaa6b857e1ff887566a6f085fb83c
--- /dev/null
+++ b/bsp/at32/at32f403a-start/board/msp/at32_msp.c
@@ -0,0 +1,258 @@
+/**
+ ******************************************************************************
+ * @file at32_msp.c
+ * @author Artery Technology
+ * @version V1.0.0
+ * @date 2020-01-10
+ * @brief Msp source file
+ ******************************************************************************
+ * @attention
+ *
+ * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+ * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+ * TIME. AS A RESULT, ARTERYTEK SHALL NOT BE HELD LIABLE FOR ANY
+ * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+ * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+ * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+ *
+ * © COPYRIGHT 2018 ArteryTek
+ ******************************************************************************
+ */
+
+#include
+#include
+#include "at32_msp.h"
+
+#ifdef BSP_USING_SERIAL
+void at32_msp_usart_init(void *Instance)
+{
+ GPIO_InitType GPIO_InitStruct;
+ USART_Type *USARTx = (USART_Type *)Instance;
+
+ GPIO_StructInit(&GPIO_InitStruct);
+ GPIO_InitStruct.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
+#ifdef BSP_USING_UART1
+ if(USART1 == USARTx)
+ {
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_USART1, ENABLE);
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOA, ENABLE);
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_9;
+ GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_10;
+ GPIO_Init(GPIOA, &GPIO_InitStruct);
+ }
+#endif
+#ifdef BSP_USING_UART2
+ if(USART2 == USARTx)
+ {
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_USART2, ENABLE);
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOA, ENABLE);
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_2;
+ GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_3;
+ GPIO_Init(GPIOA, &GPIO_InitStruct);
+ }
+#endif
+#ifdef BSP_USING_UART3
+ if(USART3 == USARTx)
+ {
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_USART3, ENABLE);
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOB, ENABLE);
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_10;
+ GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_11;
+ GPIO_Init(GPIOB, &GPIO_InitStruct);
+ }
+#endif
+ /* Add others */
+}
+#endif /* BSP_USING_SERIAL */
+
+#ifdef BSP_USING_SPI
+void at32_msp_spi_init(void *Instance)
+{
+ GPIO_InitType GPIO_InitStruct;
+ SPI_Type *SPIx = (SPI_Type *)Instance;
+
+ GPIO_StructInit(&GPIO_InitStruct);
+ GPIO_InitStruct.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
+#ifdef BSP_USING_SPI1
+ if(SPI1 == SPIx)
+ {
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_SPI1, ENABLE);
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOA, ENABLE);
+
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_4;
+ GPIO_Init(GPIOA, &GPIO_InitStruct);
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_5 | GPIO_Pins_7;
+ GPIO_Init(GPIOA, &GPIO_InitStruct);
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_6;
+ GPIO_Init(GPIOA, &GPIO_InitStruct);
+ }
+#endif
+#ifdef BSP_USING_SPI2
+ if(SPI2 == SPIx)
+ {
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_SPI2, ENABLE);
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOB, ENABLE);
+
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_12;
+ GPIO_Init(GPIOB, &GPIO_InitStruct);
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_13 | GPIO_Pins_15;
+ GPIO_Init(GPIOB, &GPIO_InitStruct);
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_14;
+ GPIO_Init(GPIOB, &GPIO_InitStruct);
+ }
+#endif
+ /* Add others */
+}
+#endif /* BSP_USING_SPI */
+
+#ifdef BSP_USING_SDIO
+void at32_msp_sdio_init(void *Instance)
+{
+ GPIO_InitType GPIO_InitStructure;
+ SDIO_Type *SDIOx = (SDIO_Type *)Instance;
+
+ GPIO_StructInit(&GPIO_InitStructure);
+ GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
+
+ if(SDIO1 == SDIOx)
+ {
+ /* if used dma ... */
+ RCC_AHBPeriphClockCmd(RCC_AHBPERIPH_DMA2, ENABLE);
+
+ RCC_AHBPeriphClockCmd(RCC_AHBPERIPH_SDIO1, ENABLE);
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOC | RCC_APB2PERIPH_GPIOD, ENABLE);
+ GPIO_InitStructure.GPIO_Pins = GPIO_Pins_8 | GPIO_Pins_9 | GPIO_Pins_10 | GPIO_Pins_11 | GPIO_Pins_12;
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
+ GPIO_Init(GPIOC, &GPIO_InitStructure);
+
+ GPIO_InitStructure.GPIO_Pins = GPIO_Pins_2;
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
+ GPIO_Init(GPIOD, &GPIO_InitStructure);
+ }
+}
+#endif /* BSP_USING_SDIO */
+
+#ifdef BSP_USING_PWM
+void at32_msp_tmr_init(void *Instance)
+{
+ GPIO_InitType GPIO_InitStructure;
+ TMR_Type *TMRx = (TMR_Type *)Instance;
+
+ if(TMRx == TMR1)
+ {
+ /* TMR1 clock enable */
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_TMR1, ENABLE);
+ /* GPIOA clock enable */
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOA, ENABLE);
+
+ /* GPIOA Configuration:TMR1 Channel1 and Channel4 as alternate function push-pull */
+ GPIO_InitStructure.GPIO_Pins = GPIO_Pins_8 | GPIO_Pins_11;
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
+ GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
+
+ GPIO_Init(GPIOA, &GPIO_InitStructure);
+ }
+
+ if(TMRx == TMR2)
+ {
+ /* TMR2 clock enable */
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_TMR2, ENABLE);
+ /* GPIOA clock enable */
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_GPIOA, ENABLE);
+
+ /* GPIOA Configuration:TMR2 Channel1 and Channel2 as alternate function push-pull */
+ GPIO_InitStructure.GPIO_Pins = GPIO_Pins_0 | GPIO_Pins_1;
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
+ GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
+
+ GPIO_Init(GPIOA, &GPIO_InitStructure);
+ }
+ /* Add others */
+}
+#endif /* BSP_USING_PWM */
+
+#ifdef BSP_USING_ADC
+void at32_msp_adc_init(void *Instance)
+{
+ GPIO_InitType GPIO_InitStruct;
+ ADC_Type *ADCx = (ADC_Type *)Instance;
+
+#ifdef BSP_USING_ADC1
+ if(ADCx == ADC1)
+ {
+ /* ADC1 & GPIO clock enable */
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_ADC1 | RCC_APB2PERIPH_GPIOA | RCC_APB2PERIPH_GPIOB | RCC_APB2PERIPH_GPIOC,ENABLE);
+
+ /* Configure ADC Channel as analog input */
+ GPIO_StructInit(&GPIO_InitStruct);
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_0 | GPIO_Pins_1 | GPIO_Pins_2 | GPIO_Pins_3 | GPIO_Pins_4 | GPIO_Pins_5;
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_ANALOG;
+ GPIO_Init(GPIOC, &GPIO_InitStruct);
+
+ }
+#endif
+
+#ifdef BSP_USING_ADC2
+ if(ADCx == ADC2)
+ {
+ /* ADC2 & GPIO clock enable */
+ RCC_APB2PeriphClockCmd(RCC_APB2PERIPH_ADC2 | RCC_APB2PERIPH_GPIOA | RCC_APB2PERIPH_GPIOB | RCC_APB2PERIPH_GPIOC,ENABLE);
+
+ /* Configure ADC Channel as analog input */
+ GPIO_StructInit(&GPIO_InitStruct);
+ GPIO_InitStruct.GPIO_Pins = GPIO_Pins_0 | GPIO_Pins_1 | GPIO_Pins_2 | GPIO_Pins_3 | GPIO_Pins_4 | GPIO_Pins_5;
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_ANALOG;
+ GPIO_Init(GPIOC, &GPIO_InitStruct);
+ }
+#endif
+}
+#endif /* BSP_USING_ADC */
+
+#ifdef BSP_USING_HWTIMER
+void at32_msp_hwtmr_init(void *Instance)
+{
+ TMR_Type *TMRx = (TMR_Type *)Instance;
+
+#ifdef BSP_USING_HWTMR3
+ if(TMRx == TMR3)
+ {
+ /* TMR3 clock enable */
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_TMR3, ENABLE);
+ }
+#endif
+
+#ifdef BSP_USING_HWTMR4
+ if(TMRx == TMR4)
+ {
+ /* TMR4 clock enable */
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_TMR4, ENABLE);
+ }
+#endif
+
+#ifdef BSP_USING_HWTMR5
+ if(TMRx == TMR5)
+ {
+ /* TMR5 clock enable */
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_TMR5, ENABLE);
+ }
+#endif
+}
+#endif
diff --git a/bsp/at32/at32f403a-start/board/msp/at32_msp.h b/bsp/at32/at32f403a-start/board/msp/at32_msp.h
new file mode 100644
index 0000000000000000000000000000000000000000..c59bab2b2cebb1f96a33e26c8ceed2bda0395184
--- /dev/null
+++ b/bsp/at32/at32f403a-start/board/msp/at32_msp.h
@@ -0,0 +1,33 @@
+/**
+ ******************************************************************************
+ * @file at32_msp.h
+ * @author Artery Technology
+ * @version V1.0.0
+ * @date 2020-01-10
+ * @brief Msp header file
+ ******************************************************************************
+ * @attention
+ *
+ * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+ * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+ * TIME. AS A RESULT, ARTERYTEK SHALL NOT BE HELD LIABLE FOR ANY
+ * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+ * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+ * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+ *
+ * © COPYRIGHT 2018 ArteryTek
+ ******************************************************************************
+ */
+
+#ifndef __AT32_MSP_H__
+#define __AT32_MSP_H__
+
+void at32_msp_usart_init(void *Instance);
+void at32_msp_spi_init(void *Instance);
+void at32_msp_tmr_init(void *Instance);
+void at32_msp_i2c_init(void *Instance);
+void at32_msp_sdio_init(void *Instance);
+void at32_msp_adc_init(void *Instance);
+void at32_msp_hwtmr_init(void *Instance);
+
+#endif /* __AT32_MSP_H__ */
diff --git a/bsp/at32/at32f403a-start/board/msp/system_at32f4xx.c b/bsp/at32/at32f403a-start/board/msp/system_at32f4xx.c
new file mode 100644
index 0000000000000000000000000000000000000000..ce151e2d4a4f50482e9587bf7f1f3fb7f5061252
--- /dev/null
+++ b/bsp/at32/at32f403a-start/board/msp/system_at32f4xx.c
@@ -0,0 +1,3457 @@
+/**
+ ******************************************************************************
+ * @file system_at32f4xx.c
+ * @author Artery Technology
+ * @version V1.0.0
+ * @date 2019-05-27
+ * @brief CMSIS Cortex-M4 system source file
+ ******************************************************************************
+ * @attention
+ *
+ * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
+ * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
+ * TIME. AS A RESULT, ARTERYTEK SHALL NOT BE HELD LIABLE FOR ANY
+ * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
+ * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
+ * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+ *
+ * © COPYRIGHT 2018 ArteryTek
+ ******************************************************************************
+ */
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup at32f4xx_system
+ * @{
+ */
+
+/** @addtogroup at32f4xx_System_Private_Includes
+ * @{
+ */
+
+#include "at32f4xx.h"
+
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_Defines
+ * @{
+ */
+
+/*!< Uncomment the line corresponding to the desired System clock (SYSCLK)
+ frequency (after reset the HSI is used as SYSCLK source)
+
+ IMPORTANT NOTE:
+ ==============
+ 1. After each device reset the HSI is used as System clock source.
+
+ 2. Please make sure that the selected System clock doesn't exceed your device's
+ maximum frequency.
+
+ 3. If none of the define below is enabled, the HSI is used as System clock
+ source.
+
+ 4. The System clock configuration functions provided within this file assume that:
+ - For at32f4xx devices, an external 8MHz crystal is used to drive the System clock.
+ If you are using different crystal you have to adapt those functions accordingly.
+
+ Clock (MHz)
+ PLL from HSE or HSI
+ SYSCLK HCLK PCLK2 PCLK1
+ 24 24 24 24
+ 36 36 36 36
+ 48 48 48 24
+ 56 56 56 28
+ 72 72 72 36
+ 96 96 48 48
+ 108 108 54 54
+ 120 120 60 60
+ 144 144 72 72
+ 150 150 75 75
+ 168 168 84 84
+ 176 176 88 88
+ 192 192 96 96
+ 200 200 100 100
+ 224 224 112 112
+ 240 240 120 120
+ */
+
+#if defined (AT32F403xx) || defined (AT32F413xx) || \
+ defined (AT32F415xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+/* #define SYSCLK_FREQ_HSE HSE_VALUE */
+/* #define SYSCLK_FREQ_24MHz 24000000 */
+/* #define SYSCLK_FREQ_36MHz 36000000 */
+/* #define SYSCLK_FREQ_48MHz 48000000 */
+/* #define SYSCLK_FREQ_56MHz 56000000 */
+/* #define SYSCLK_FREQ_72MHz 72000000 */
+/* #define SYSCLK_FREQ_96MHz 96000000 */
+/* #define SYSCLK_FREQ_108MHz 108000000 */
+/* #define SYSCLK_FREQ_120MHz 120000000 */
+/* #define SYSCLK_FREQ_144MHz 144000000 */
+/* #define SYSCLK_FREQ_24MHz_HSI 24000000 */
+/* #define SYSCLK_FREQ_36MHz_HSI 36000000 */
+/* #define SYSCLK_FREQ_48MHz_HSI 48000000 */
+/* #define SYSCLK_FREQ_56MHz_HSI 56000000 */
+/* #define SYSCLK_FREQ_72MHz_HSI 72000000 */
+/* #define SYSCLK_FREQ_96MHz_HSI 96000000 */
+/* #define SYSCLK_FREQ_108MHz_HSI 108000000 */
+/* #define SYSCLK_FREQ_120MHz_HSI 120000000 */
+/* #define SYSCLK_FREQ_144MHz_HSI 144000000 */
+#endif
+
+#if defined (AT32F415xx)
+/* #define SYSCLK_FREQ_150MHz 150000000 */
+/* #define SYSCLK_FREQ_150MHz_HSI 150000000 */
+#endif
+
+#if defined (AT32F403xx) || defined (AT32F413xx) || \
+ defined (AT32F403Axx)|| defined (AT32F407xx)
+/* #define SYSCLK_FREQ_168MHz 168000000 */
+/* #define SYSCLK_FREQ_176MHz 176000000 */
+/* #define SYSCLK_FREQ_192MHz 192000000 */
+/* #define SYSCLK_FREQ_200MHz 200000000 */
+/* #define SYSCLK_FREQ_168MHz_HSI 168000000 */
+/* #define SYSCLK_FREQ_176MHz_HSI 176000000 */
+/* #define SYSCLK_FREQ_192MHz_HSI 192000000 */
+/* #define SYSCLK_FREQ_200MHz_HSI 200000000 */
+#endif
+
+#if defined (AT32F403Axx)|| defined (AT32F407xx)
+/* #define SYSCLK_FREQ_224MHz 224000000 */
+#define SYSCLK_FREQ_240MHz 240000000
+/* #define SYSCLK_FREQ_224MHz_HSI 224000000 */
+/* #define SYSCLK_FREQ_240MHz_HSI 240000000 */
+#endif
+
+/*!< Uncomment the following line if you need to use external SRAM mounted
+ (AT32 High density and XL-density devices) as data memory */
+
+/* #define DATA_IN_ExtSRAM */
+
+/*!< Uncomment the following line if you need to relocate your vector Table in
+ Internal SRAM. */
+/* #define VECT_TAB_SRAM */
+#define VECT_TAB_OFFSET 0x0 /*!< Vector Table base offset field.
+This value must be a multiple of 0x200. */
+
+
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_Variables
+ * @{
+ */
+
+/*******************************************************************************
+* Clock Definitions
+*******************************************************************************/
+#ifdef SYSCLK_FREQ_HSE
+uint32_t SystemCoreClock = SYSCLK_FREQ_HSE; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_24MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_24MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_36MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_36MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_48MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_48MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_56MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_56MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_72MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_72MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_96MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_96MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_108MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_108MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_120MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_120MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_144MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_144MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_150MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_150MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_168MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_168MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_176MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_176MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_192MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_192MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_200MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_200MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_224MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_224MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_240MHz
+uint32_t SystemCoreClock = SYSCLK_FREQ_240MHz; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_24MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_24MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_36MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_36MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_48MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_48MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_56MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_56MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_72MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_72MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_96MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_96MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_108MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_108MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_120MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_120MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_144MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_144MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_150MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_150MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_168MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_168MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_176MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_176MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_192MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_192MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_200MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_200MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_224MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_224MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#elif defined SYSCLK_FREQ_240MHz_HSI
+uint32_t SystemCoreClock = SYSCLK_FREQ_240MHz_HSI; /*!< System Clock Frequency (Core Clock) */
+#else /*!< HSI Selected as System Clock source */
+#define SYSCLK_FREQ_HSI HSI_VALUE
+uint32_t SystemCoreClock = HSI_VALUE; /*!< System Clock Frequency (Core Clock) */
+#endif
+
+__I uint8_t AHBPscTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_FunctionPrototypes
+ * @{
+ */
+
+static void SetSysClock(void);
+
+#ifdef SYSCLK_FREQ_HSE
+static void SetSysClockToHSE(void);
+#elif defined SYSCLK_FREQ_24MHz
+static void SetSysClockTo24M(void);
+#elif defined SYSCLK_FREQ_36MHz
+static void SetSysClockTo36M(void);
+#elif defined SYSCLK_FREQ_48MHz
+static void SetSysClockTo48M(void);
+#elif defined SYSCLK_FREQ_56MHz
+static void SetSysClockTo56M(void);
+#elif defined SYSCLK_FREQ_72MHz
+static void SetSysClockTo72M(void);
+#elif defined SYSCLK_FREQ_96MHz
+static void SetSysClockTo96M(void);
+#elif defined SYSCLK_FREQ_108MHz
+static void SetSysClockTo108M(void);
+#elif defined SYSCLK_FREQ_120MHz
+static void SetSysClockTo120M(void);
+#elif defined SYSCLK_FREQ_144MHz
+static void SetSysClockTo144M(void);
+#elif defined SYSCLK_FREQ_150MHz
+static void SetSysClockTo150M(void);
+#elif defined SYSCLK_FREQ_168MHz
+static void SetSysClockTo168M(void);
+#elif defined SYSCLK_FREQ_176MHz
+static void SetSysClockTo176M(void);
+#elif defined SYSCLK_FREQ_192MHz
+static void SetSysClockTo192M(void);
+#elif defined SYSCLK_FREQ_200MHz
+static void SetSysClockTo200M(void);
+#elif defined SYSCLK_FREQ_224MHz
+static void SetSysClockTo224M(void);
+#elif defined SYSCLK_FREQ_240MHz
+static void SetSysClockTo240M(void);
+#elif defined SYSCLK_FREQ_24MHz_HSI
+static void SetSysClockTo24MHSI(void);
+#elif defined SYSCLK_FREQ_36MHz_HSI
+static void SetSysClockTo36MHSI(void);
+#elif defined SYSCLK_FREQ_48MHz_HSI
+static void SetSysClockTo48MHSI(void);
+#elif defined SYSCLK_FREQ_56MHz_HSI
+static void SetSysClockTo56MHSI(void);
+#elif defined SYSCLK_FREQ_72MHz_HSI
+static void SetSysClockTo72MHSI(void);
+#elif defined SYSCLK_FREQ_96MHz_HSI
+static void SetSysClockTo96MHSI(void);
+#elif defined SYSCLK_FREQ_108MHz_HSI
+static void SetSysClockTo108MHSI(void);
+#elif defined SYSCLK_FREQ_120MHz_HSI
+static void SetSysClockTo120MHSI(void);
+#elif defined SYSCLK_FREQ_144MHz_HSI
+static void SetSysClockTo144MHSI(void);
+#elif defined SYSCLK_FREQ_150MHz_HSI
+static void SetSysClockTo150MHSI(void);
+#elif defined SYSCLK_FREQ_168MHz_HSI
+static void SetSysClockTo168MHSI(void);
+#elif defined SYSCLK_FREQ_176MHz_HSI
+static void SetSysClockTo176MHSI(void);
+#elif defined SYSCLK_FREQ_192MHz_HSI
+static void SetSysClockTo192MHSI(void);
+#elif defined SYSCLK_FREQ_200MHz_HSI
+static void SetSysClockTo200MHSI(void);
+#elif defined SYSCLK_FREQ_224MHz_HSI
+static void SetSysClockTo224MHSI(void);
+#elif defined SYSCLK_FREQ_240MHz_HSI
+static void SetSysClockTo240MHSI(void);
+#endif
+
+#ifdef DATA_IN_ExtSRAM
+static void SystemInit_ExtMemCtrl(void);
+#endif /* DATA_IN_ExtSRAM */
+
+/**
+ * @}
+ */
+
+/** @addtogroup at32f4xx_System_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Setup the microcontroller system
+ * Initialize the Embedded Flash Interface, the PLL and update the
+ * SystemCoreClock variable.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+void SystemInit (void)
+{
+#if defined (AT32F415xx)
+ /* Enable low power mode, 0x40007050[bit2] */
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_PWR, ENABLE);
+ *(volatile uint8_t *)(0x40007050) |= (uint8_t)(0x1 << 2);
+ RCC_APB1PeriphClockCmd(RCC_APB1PERIPH_PWR, DISABLE);
+#endif
+
+#if defined (__FPU_USED) && (__FPU_USED == 1U)
+ SCB->CPACR |= ((3U << 10U * 2U) | /* set CP10 Full Access */
+ (3U << 11U * 2U) ); /* set CP11 Full Access */
+#endif
+
+ /* Reset the RCC clock configuration to the default reset state(for debug purpose) */
+ /* Set HSIEN bit */
+ BIT_SET(RCC->CTRL, RCC_CTRL_HSIEN);
+
+ /* Reset SW, AHBPSC, APB1PSC, APB2PSC, ADCPSC and CLKOUT bits */
+ BIT_CLEAR(RCC->CFG, RCC_CFG_SYSCLKSEL | RCC_CFG_AHBPSC | \
+ RCC_CFG_APB1PSC | RCC_CFG_APB2PSC | \
+ RCC_CFG_ADCPSC | RCC_CFG_CLKOUT);
+
+ /* Reset HSEEN, HSECFDEN and PLLEN bits */
+ BIT_CLEAR(RCC->CTRL, RCC_CTRL_HSEEN | RCC_CTRL_HSECFDEN | \
+ RCC_CTRL_PLLEN);
+
+ /* Reset HSEBYPS bit */
+ BIT_CLEAR(RCC->CTRL, RCC_CTRL_HSEBYPS);
+
+ /* Reset PLLRC, PLLHSEPSC, PLLMUL, USBPSC and PLLRANGE bits */
+ BIT_CLEAR(RCC->CFG, RCC_CFG_PLLRC | RCC_CFG_PLLHSEPSC | \
+ RCC_CFG_PLLMULT | RCC_CFG_USBPSC | RCC_CFG_PLLRANGE);
+
+ /* Reset USB768B, CLKOUT[3], HSICAL_KEY[7:0] */
+ BIT_CLEAR(RCC->MISC, 0x010100FF);
+
+ /* Disable all interrupts and clear pending bits */
+ RCC->CLKINT = RCC_CLKINT_LSISTBLFC | RCC_CLKINT_LSESTBLFC | \
+ RCC_CLKINT_HSISTBLFC | RCC_CLKINT_HSESTBLFC | \
+ RCC_CLKINT_PLLSTBLFC | RCC_CLKINT_HSECFDFC;
+
+#ifdef DATA_IN_ExtSRAM
+ SystemInit_ExtMemCtrl();
+#endif /* DATA_IN_ExtSRAM */
+
+ /* Configure the System clock frequency, HCLK, PCLK2 and PCLK1 prescalers */
+ /* Configure the Flash Latency cycles and enable prefetch buffer */
+ SetSysClock();
+
+#ifdef VECT_TAB_SRAM
+ SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */
+#else
+ SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH. */
+#endif
+}
+
+/**
+ * @brief Update SystemCoreClock variable according to Clock Register Values.
+ * The SystemCoreClock variable contains the core clock (HCLK), it can
+ * be used by the user application to setup the SysTick timer or configure
+ * other parameters.
+ *
+ * @note Each time the core clock (HCLK) changes, this function must be called
+ * to update SystemCoreClock variable value. Otherwise, any configuration
+ * based on this variable will be incorrect.
+ *
+ * @note - The system frequency computed by this function is not the real
+ * frequency in the chip. It is calculated based on the predefined
+ * constant and the selected clock source:
+ *
+ * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
+ *
+ * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
+ *
+ * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
+ * or HSI_VALUE(*) multiplied by the PLL factors.
+ *
+ * (*) HSI_VALUE is a constant defined in at32f4xx.h file (default value
+ * 8 MHz) but the real value may vary depending on the variations
+ * in voltage and temperature.
+ *
+ * (**) HSE_VALUE is a constant defined in at32f4xx.h file (default value
+ * 8 MHz or 25 MHz, depedning on the product used), user has to ensure
+ * that HSE_VALUE is same as the real frequency of the crystal used.
+ * Otherwise, this function may have wrong result.
+ *
+ * - The result of this function could be not correct when using fractional
+ * value for HSE crystal.
+ * @param None
+ * @retval None
+ */
+void SystemCoreClockUpdate (void)
+{
+ uint32_t tmp = 0, pllmult = 0, pllrefclk = 0, tempcfg = 0;
+
+ /* Get SYSCLK source -------------------------------------------------------*/
+ tmp = RCC->CFG & RCC_CFG_SYSCLKSTS;
+
+ switch (tmp)
+ {
+ case RCC_CFG_SYSCLKSTS_HSI: /* HSI used as system clock */
+ SystemCoreClock = HSI_VALUE;
+ break;
+
+ case RCC_CFG_SYSCLKSTS_HSE: /* HSE used as system clock */
+ SystemCoreClock = HSE_VALUE;
+ break;
+
+ case RCC_CFG_SYSCLKSTS_PLL: /* PLL used as system clock */
+ /* Get PLL clock source and multiplication factor ----------------------*/
+ pllrefclk = RCC->CFG & RCC_CFG_PLLRC;
+ tempcfg = RCC->CFG;
+ pllmult = RCC_GET_PLLMULT(tempcfg);
+
+ if (pllrefclk == RCC_PLLRefClk_HSI_Div2)
+ {
+ /* HSI oscillator clock divided by 2 selected as PLL clock entry */
+ SystemCoreClock = (HSI_VALUE >> 1) * pllmult;
+ }
+ else
+ {
+ /* HSE selected as PLL clock entry */
+ if ((RCC->CFG & RCC_CFG_PLLHSEPSC) != (uint32_t)RESET)
+ {
+ /* HSE oscillator clock divided by 2 */
+ SystemCoreClock = (HSE_VALUE >> 1) * pllmult;
+ }
+ else
+ {
+ SystemCoreClock = HSE_VALUE * pllmult;
+ }
+ }
+
+ break;
+
+ default:
+ SystemCoreClock = HSI_VALUE;
+ break;
+ }
+
+ /* Compute HCLK clock frequency ----------------*/
+ /* Get HCLK prescaler */
+ tmp = AHBPscTable[((RCC->CFG & RCC_CFG_AHBPSC) >> 4)];
+ /* HCLK clock frequency */
+ SystemCoreClock >>= tmp;
+}
+
+/**
+ * @brief Configures the System clock frequency, HCLK, PCLK2 and PCLK1 prescalers.
+ * @param None
+ * @retval None
+ */
+static void SetSysClock(void)
+{
+#ifdef SYSCLK_FREQ_HSE
+ SetSysClockToHSE();
+#elif defined SYSCLK_FREQ_24MHz
+ SetSysClockTo24M();
+#elif defined SYSCLK_FREQ_36MHz
+ SetSysClockTo36M();
+#elif defined SYSCLK_FREQ_48MHz
+ SetSysClockTo48M();
+#elif defined SYSCLK_FREQ_56MHz
+ SetSysClockTo56M();
+#elif defined SYSCLK_FREQ_72MHz
+ SetSysClockTo72M();
+#elif defined SYSCLK_FREQ_96MHz
+ SetSysClockTo96M();
+#elif defined SYSCLK_FREQ_108MHz
+ SetSysClockTo108M();
+#elif defined SYSCLK_FREQ_120MHz
+ SetSysClockTo120M();
+#elif defined SYSCLK_FREQ_144MHz
+ SetSysClockTo144M();
+#elif defined SYSCLK_FREQ_150MHz
+ SetSysClockTo150M();
+#elif defined SYSCLK_FREQ_168MHz
+ SetSysClockTo168M();
+#elif defined SYSCLK_FREQ_176MHz
+ SetSysClockTo176M();
+#elif defined SYSCLK_FREQ_192MHz
+ SetSysClockTo192M();
+#elif defined SYSCLK_FREQ_200MHz
+ SetSysClockTo200M();
+#elif defined SYSCLK_FREQ_224MHz
+ SetSysClockTo224M();
+#elif defined SYSCLK_FREQ_240MHz
+ SetSysClockTo240M();
+#elif defined SYSCLK_FREQ_24MHz_HSI
+ SetSysClockTo24MHSI();
+#elif defined SYSCLK_FREQ_36MHz_HSI
+ SetSysClockTo36MHSI();
+#elif defined SYSCLK_FREQ_48MHz_HSI
+ SetSysClockTo48MHSI();
+#elif defined SYSCLK_FREQ_56MHz_HSI
+ SetSysClockTo56MHSI();
+#elif defined SYSCLK_FREQ_72MHz_HSI
+ SetSysClockTo72MHSI();
+#elif defined SYSCLK_FREQ_96MHz_HSI
+ SetSysClockTo96MHSI();
+#elif defined SYSCLK_FREQ_108MHz_HSI
+ SetSysClockTo108MHSI();
+#elif defined SYSCLK_FREQ_120MHz_HSI
+ SetSysClockTo120MHSI();
+#elif defined SYSCLK_FREQ_144MHz_HSI
+ SetSysClockTo144MHSI();
+#elif defined SYSCLK_FREQ_150MHz_HSI
+ SetSysClockTo150MHSI();
+#elif defined SYSCLK_FREQ_168MHz_HSI
+ SetSysClockTo168MHSI();
+#elif defined SYSCLK_FREQ_176MHz_HSI
+ SetSysClockTo176MHSI();
+#elif defined SYSCLK_FREQ_192MHz_HSI
+ SetSysClockTo192MHSI();
+#elif defined SYSCLK_FREQ_200MHz_HSI
+ SetSysClockTo200MHSI();
+#elif defined SYSCLK_FREQ_224MHz_HSI
+ SetSysClockTo224MHSI();
+#elif defined SYSCLK_FREQ_240MHz_HSI
+ SetSysClockTo240MHSI();
+#endif
+
+ /* If none of the define above is enabled, the HSI is used as System clock
+ source (default after reset) */
+}
+
+/**
+ * @brief Setup the external memory controller. Called in startup_at32f4xx.s
+ * before jump to __main
+ * @param None
+ * @retval None
+ */
+#ifdef DATA_IN_ExtSRAM
+/**
+ * @brief Setup the external memory controller.
+ * Called in startup_at32f4xx_xx.s/.c before jump to main.
+ * This function configures the external SRAM mounted
+ * (AT32 High density devices). This SRAM will be used as program
+ * data memory (including heap and stack).
+ * @param None
+ * @retval None
+ */
+void SystemInit_ExtMemCtrl(void)
+{
+ /* Enable XMC clock */
+ RCC->AHBEN = RCC_AHBEN_SRAMEN | RCC_AHBEN_FLASHEN | RCC_AHBEN_XMCEN;
+
+ /* Enable GPIOD, GPIOE, GPIOF and GPIOG clocks */
+ RCC->APB2EN = RCC_APB2EN_GPIODEN | RCC_APB2EN_GPIOEEN | RCC_APB2EN_GPIOFEN | RCC_APB2EN_GPIOGEN;
+
+ /* --------------- SRAM Data lines, NOE and NWE configuration ---------------*/
+ /*---------------- SRAM Address lines configuration -------------------------*/
+ /*---------------- NOE and NWE configuration --------------------------------*/
+ /*---------------- NE3 configuration ----------------------------------------*/
+ /*---------------- NBL0, NBL1 configuration ---------------------------------*/
+
+ GPIOD->CTRLL = 0x44BB44BB;
+ GPIOD->CTRLH = 0xBBBBBBBB;
+
+ GPIOE->CTRLL = 0xB44444BB;
+ GPIOE->CTRLH = 0xBBBBBBBB;
+
+ GPIOF->CTRLL = 0x44BBBBBB;
+ GPIOF->CTRLH = 0xBBBB4444;
+
+ GPIOG->CTRLL = 0x44BBBBBB;
+ GPIOG->CTRLH = 0x44444B44;
+
+ /*---------------- XMC Configuration ---------------------------------------*/
+ /*---------------- Enable XMC Bank1_SRAM Bank ------------------------------*/
+
+ XMC_Bank1->BK1CTRLR[4] = 0x00001011;
+ XMC_Bank1->BK1CTRLR[5] = 0x00000200;
+}
+#endif /* DATA_IN_ExtSRAM */
+
+#ifndef SYSCLK_FREQ_HSI
+#ifdef AT32F403xx
+/**
+ * @brief Delay to wait for HSE stable.
+ * @note This function should be used before reading the HSESTBL flag.
+ * @param None
+ * @retval None
+ */
+static void WaitHseStbl(uint32_t delay)
+{
+ uint32_t i;
+
+ for(i = 0; i < delay; i++)
+ ;
+}
+#endif
+#endif /* SYSCLK_FREQ_HSI */
+
+#ifdef SYSCLK_FREQ_HSE
+/**
+ * @brief Selects HSE as System clock source and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockToHSE(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_0;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV1;
+
+ /* Select HSE as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_HSE;
+
+ /* Wait till HSE is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != (uint32_t)0x04)
+ {
+ }
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+#elif defined SYSCLK_FREQ_24MHz
+/**
+ * @brief Sets System clock frequency to 24MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo24M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_0;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV1;
+
+ /* PLL configuration: = (HSE / 2) * 6 = 24 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLHSEPSC_HSE_DIV2 | RCC_CFG_PLLMULT6);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+#elif defined SYSCLK_FREQ_36MHz
+/**
+ * @brief Sets System clock frequency to 36MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo36M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV1;
+
+ /* PLL configuration: PLLCLK = (HSE / 2) * 9 = 36 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLHSEPSC_HSE_DIV2 | RCC_CFG_PLLMULT9);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+#elif defined SYSCLK_FREQ_48MHz
+/**
+ * @brief Sets System clock frequency to 48MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo48M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 6 = 48 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT6);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_56MHz
+/**
+ * @brief Sets System clock frequency to 56MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo56M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 7 = 56 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT7);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_72MHz
+/**
+ * @brief Sets System clock frequency to 72MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo72M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_2;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 9 = 72 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT9);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_96MHz
+/**
+ * @brief Sets System clock frequency to 96MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo96M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_2;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 12 = 96 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT12);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT12 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_108MHz
+/**
+ * @brief Sets System clock frequency to 108MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo108M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_3;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSE/2) * 27 = 108 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLHSEPSC_HSE_DIV2 | RCC_CFG_PLLMULT27);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLHSEPSC_HSE_DIV2 | RCC_CFG_PLLMULT27 \
+ | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_120MHz
+/**
+ * @brief Sets System clock frequency to 120MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo120M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_3;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 15 = 120 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT15);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT15 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_144MHz
+/**
+ * @brief Sets System clock frequency to 144MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo144M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_4;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 18 = 144 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT18);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT18 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_150MHz
+/**
+ * @brief Sets System clock frequency to 150MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo150M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_4;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSE * 75) / (1 * 4) = 150 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE);
+ RCC_PLLconfig2(PLL_FREF_8M, 75, 1, PLL_FR_4);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_168MHz
+/**
+ * @brief Sets System clock frequency to 168MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo168M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 21 = 168 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT21 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_176MHz
+/**
+ * @brief Sets System clock frequency to 176MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo176M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 22 = 176 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT22 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_192MHz
+/**
+ * @brief Sets System clock frequency to 192MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo192M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 24 = 192 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT24 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_200MHz
+/**
+ * @brief Sets System clock frequency to 200MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo200M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 25 = 200 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT25 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_224MHz
+/**
+ * @brief Sets System clock frequency to 224MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo224M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 28 = 224 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT28 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_240MHz
+/**
+ * @brief Sets System clock frequency to 240MHz and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo240M(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSE */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSEEN);
+
+ /* Wait till HSE is ready and if Time out is reached exit */
+ do
+ {
+ HSEStatus = RCC->CTRL & RCC_CTRL_HSESTBL;
+ StartUpCounter++;
+ }
+ while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
+#ifdef AT32F403xx
+ WaitHseStbl(HSE_STABLE_DELAY);
+#endif
+ if ((RCC->CTRL & RCC_CTRL_HSESTBL) != RESET)
+ {
+ HSEStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSEStatus = (uint32_t)0x00;
+ }
+
+ if (HSEStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = HSE * 30 = 240 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSE | RCC_CFG_PLLMULT30 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+ else
+ {
+ /* If HSE fails to start-up, the application will have wrong clock
+ configuration. User can add here some code to deal with this error */
+ }
+}
+
+#elif defined SYSCLK_FREQ_24MHz_HSI
+/**
+ * @brief Sets System clock frequency to 24MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo24MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_0;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV1;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 6 = 24 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT6);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_36MHz_HSI
+/**
+ * @brief Sets System clock frequency to 36MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo36MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV1;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 9 = 36 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT9);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_48MHz_HSI
+/**
+ * @brief Sets System clock frequency to 48MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo48MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 12 = 48 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT12);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_56MHz_HSI
+/**
+ * @brief Sets System clock frequency to 56MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo56MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_1;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 14 = 56 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT14);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_72MHz_HSI
+/**
+ * @brief Sets System clock frequency to 72MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo72MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_2;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV1;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 18 = 72 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT18);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_96MHz_HSI
+/**
+ * @brief Sets System clock frequency to 96MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo96MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_2;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 24 = 96 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT24);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT24 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_108MHz_HSI
+/**
+ * @brief Sets System clock frequency to 108MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo108MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_3;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 27 = 108 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT27);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT27 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_120MHz_HSI
+/**
+ * @brief Sets System clock frequency to 120MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo120MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_3;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 30 = 120 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT30);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT30 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_144MHz_HSI
+/**
+ * @brief Sets System clock frequency to 144MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo144MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_4;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 36 = 144 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+
+#if defined (AT32F415xx)
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT36);
+#else
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT36 | RCC_CFG_PLLRANGE_GT72MHZ);
+#endif
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_150MHz_HSI
+/**
+ * @brief Sets System clock frequency to 150MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo150MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+#if defined (AT32F415xx)
+ /* Enable Prefetch Buffer */
+ FLASH->ACR |= FLASH_ACR_PRFTBE;
+
+ /* Flash 1 wait state */
+ FLASH->ACR &= (uint32_t)((uint32_t)~FLASH_ACR_LATENCY);
+ FLASH->ACR |= (uint32_t)FLASH_ACR_LATENCY_4;
+#endif
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = ((HSI/2) * 150) / (1 * 4) = 150 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2);
+ RCC_PLLconfig2(PLL_FREF_4M, 150, 1, PLL_FR_4);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx) || defined (AT32F415xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_168MHz_HSI
+/**
+ * @brief Sets System clock frequency to 168MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo168MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 42 = 168 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT42 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+#elif defined SYSCLK_FREQ_176MHz_HSI
+/**
+ * @brief Sets System clock frequency to 176MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo176MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 44 = 176 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT44 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+#elif defined SYSCLK_FREQ_192MHz_HSI
+/**
+ * @brief Sets System clock frequency to 192MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo192MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 48 = 192 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT48 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+#elif defined SYSCLK_FREQ_200MHz_HSI
+/**
+ * @brief Sets System clock frequency to 200MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo200MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 50 = 200 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT50 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_224MHz_HSI
+/**
+ * @brief Sets System clock frequency to 224MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo224MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 56 = 224 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT56 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#elif defined SYSCLK_FREQ_240MHz_HSI
+/**
+ * @brief Sets System clock frequency to 240MHz from HSI and configure HCLK, PCLK2
+ * and PCLK1 prescalers.
+ * @note This function should be used only after reset.
+ * @param None
+ * @retval None
+ */
+static void SetSysClockTo240MHSI(void)
+{
+ __IO uint32_t StartUpCounter = 0, HSIStatus = 0;
+
+ /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
+ /* Enable HSI */
+ RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
+
+ /* Wait till HSI is ready and if Time out is reached exit */
+ do
+ {
+ HSIStatus = RCC->CTRL & RCC_CTRL_HSISTBL;
+ StartUpCounter++;
+ }
+ while((HSIStatus == 0) && (StartUpCounter != 0xFFFF));
+
+ if ((RCC->CTRL & RCC_CTRL_HSISTBL) != RESET)
+ {
+ HSIStatus = (uint32_t)0x01;
+ }
+ else
+ {
+ HSIStatus = (uint32_t)0x00;
+ }
+
+ if (HSIStatus == (uint32_t)0x01)
+ {
+ /* HCLK = SYSCLK */
+ RCC->CFG |= (uint32_t)RCC_CFG_AHBPSC_DIV1;
+
+ /* PCLK2 = HCLK/2 */
+ RCC->CFG &= 0xFFFFC7FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB2PSC_DIV2;
+
+ /* PCLK1 = HCLK/2 */
+ RCC->CFG &= 0xFFFFF8FF;
+ RCC->CFG |= (uint32_t)RCC_CFG_APB1PSC_DIV2;
+
+ /* PLL configuration: PLLCLK = (HSI/2) * 60 = 240 MHz */
+ RCC->CFG &= RCC_CFG_PLLCFG_MASK;
+ RCC->CFG |= (uint32_t)(RCC_CFG_PLLRC_HSI_DIV2 | RCC_CFG_PLLMULT60 | RCC_CFG_PLLRANGE_GT72MHZ);
+
+ /* Enable PLL */
+ RCC->CTRL |= RCC_CTRL_PLLEN;
+
+ /* Wait till PLL is ready */
+ while((RCC->CTRL & RCC_CTRL_PLLSTBL) == 0)
+ {
+ }
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(ENABLE);
+#endif
+ /* Select PLL as system clock source */
+ RCC->CFG &= (uint32_t)((uint32_t)~(RCC_CFG_SYSCLKSEL));
+ RCC->CFG |= (uint32_t)RCC_CFG_SYSCLKSEL_PLL;
+
+ /* Wait till PLL is used as system clock source */
+ while ((RCC->CFG & (uint32_t)RCC_CFG_SYSCLKSTS) != RCC_CFG_SYSCLKSTS_PLL)
+ {
+ }
+#ifdef AT32F403xx
+ WaitHseStbl(PLL_STABLE_DELAY);
+#endif
+#if defined (AT32F413xx) || defined (AT32F403Axx)|| \
+ defined (AT32F407xx)
+ RCC_StepModeCmd(DISABLE);
+#endif
+ }
+}
+
+#endif
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/******************* (C) COPYRIGHT 2018 ArteryTek *****END OF FILE****/
diff --git a/bsp/at32/at32f403a-start/project.ewp b/bsp/at32/at32f403a-start/project.ewp
new file mode 100644
index 0000000000000000000000000000000000000000..e07f2cd4090ef2d27c33d593fa676cd0c8b70dd1
--- /dev/null
+++ b/bsp/at32/at32f403a-start/project.ewp
@@ -0,0 +1,2377 @@
+
+ 3
+
+ rt-thread
+
+ ARM
+
+ 1
+
+ General
+ 3
+
+ 30
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 34
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 10
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 20
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ Release
+
+ ARM
+
+ 0
+
+ General
+ 3
+
+ 30
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 34
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 10
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 20
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ Kernel
+
+ $PROJ_DIR$\..\..\..\src\clock.c
+
+
+ $PROJ_DIR$\..\..\..\src\components.c
+
+
+ $PROJ_DIR$\..\..\..\src\device.c
+
+
+ $PROJ_DIR$\..\..\..\src\idle.c
+
+
+ $PROJ_DIR$\..\..\..\src\ipc.c
+
+
+ $PROJ_DIR$\..\..\..\src\irq.c
+
+
+ $PROJ_DIR$\..\..\..\src\kservice.c
+
+
+ $PROJ_DIR$\..\..\..\src\mem.c
+
+
+ $PROJ_DIR$\..\..\..\src\memheap.c
+
+
+ $PROJ_DIR$\..\..\..\src\mempool.c
+
+
+ $PROJ_DIR$\..\..\..\src\object.c
+
+
+ $PROJ_DIR$\..\..\..\src\scheduler.c
+
+
+ $PROJ_DIR$\..\..\..\src\signal.c
+
+
+ $PROJ_DIR$\..\..\..\src\thread.c
+
+
+ $PROJ_DIR$\..\..\..\src\timer.c
+
+
+
+ Applications
+
+ $PROJ_DIR$\applications\main.c
+
+
+
+ Drivers
+
+ $PROJ_DIR$\board\board.c
+
+
+ $PROJ_DIR$\board\msp\at32_msp.c
+
+
+ $PROJ_DIR$\board\msp\system_at32f4xx.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\CMSIS\AT32\AT32F4xx\src\iar\startup_at32f403avgt7.s
+
+
+ $PROJ_DIR$\..\Libraries\rt_drivers\drv_gpio.c
+
+
+ $PROJ_DIR$\..\Libraries\rt_drivers\drv_usart.c
+
+
+
+ cpu
+
+ $PROJ_DIR$\..\..\..\libcpu\arm\common\backtrace.c
+
+
+ $PROJ_DIR$\..\..\..\libcpu\arm\common\div0.c
+
+
+ $PROJ_DIR$\..\..\..\libcpu\arm\common\showmem.c
+
+
+ $PROJ_DIR$\..\..\..\libcpu\arm\cortex-m4\cpuport.c
+
+
+ $PROJ_DIR$\..\..\..\libcpu\arm\cortex-m4\context_iar.S
+
+
+
+ Filesystem
+
+ $PROJ_DIR$\..\..\..\components\dfs\src\dfs.c
+
+
+ $PROJ_DIR$\..\..\..\components\dfs\src\dfs_file.c
+
+
+ $PROJ_DIR$\..\..\..\components\dfs\src\dfs_fs.c
+
+
+ $PROJ_DIR$\..\..\..\components\dfs\src\dfs_posix.c
+
+
+ $PROJ_DIR$\..\..\..\components\dfs\src\poll.c
+
+
+ $PROJ_DIR$\..\..\..\components\dfs\src\select.c
+
+
+ $PROJ_DIR$\..\..\..\components\dfs\filesystems\devfs\devfs.c
+
+
+ $PROJ_DIR$\..\..\..\components\dfs\filesystems\elmfat\dfs_elm.c
+
+
+ $PROJ_DIR$\..\..\..\components\dfs\filesystems\elmfat\ff.c
+
+
+ $PROJ_DIR$\..\..\..\components\dfs\filesystems\elmfat\option\ccsbcs.c
+
+
+
+ DeviceDrivers
+
+ $PROJ_DIR$\..\..\..\components\drivers\misc\pin.c
+
+
+ $PROJ_DIR$\..\..\..\components\drivers\serial\serial.c
+
+
+ $PROJ_DIR$\..\..\..\components\drivers\src\completion.c
+
+
+ $PROJ_DIR$\..\..\..\components\drivers\src\dataqueue.c
+
+
+ $PROJ_DIR$\..\..\..\components\drivers\src\pipe.c
+
+
+ $PROJ_DIR$\..\..\..\components\drivers\src\ringblk_buf.c
+
+
+ $PROJ_DIR$\..\..\..\components\drivers\src\ringbuffer.c
+
+
+ $PROJ_DIR$\..\..\..\components\drivers\src\waitqueue.c
+
+
+ $PROJ_DIR$\..\..\..\components\drivers\src\workqueue.c
+
+
+
+ finsh
+
+ $PROJ_DIR$\..\..\..\components\finsh\shell.c
+
+
+ $PROJ_DIR$\..\..\..\components\finsh\cmd.c
+
+
+ $PROJ_DIR$\..\..\..\components\finsh\msh.c
+
+
+ $PROJ_DIR$\..\..\..\components\finsh\msh_file.c
+
+
+
+ libc
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\common\time.c
+
+
+
+ dlib
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\environ.c
+
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\libc.c
+
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\rmtx.c
+
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\stdio.c
+
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_close.c
+
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_lseek.c
+
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_mem.c
+
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_open.c
+
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_read.c
+
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_remove.c
+
+
+ $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_write.c
+
+
+
+ AT32_Lib
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_adc.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_can.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_crc.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dbgmcu.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dma.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_exti.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_flash.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_gpio.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_i2c.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_iwdg.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_pwr.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_rcc.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_spi.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_tim.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_usart.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_wwdg.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_sdio.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_acc.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_bkp.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_rtc.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_ertc.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_eth.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_xmc.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_comp.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dac.c
+
+
+ $PROJ_DIR$\..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\misc.c
+
+
+
diff --git a/bsp/at32/at32f403a-start/project.eww b/bsp/at32/at32f403a-start/project.eww
new file mode 100644
index 0000000000000000000000000000000000000000..c2cb02eb1e89d73e24183274c1c886ddf74f9537
--- /dev/null
+++ b/bsp/at32/at32f403a-start/project.eww
@@ -0,0 +1,10 @@
+
+
+
+
+ $WS_DIR$\project.ewp
+
+
+
+
+
diff --git a/bsp/at32/at32f403a-start/project.uvopt b/bsp/at32/at32f403a-start/project.uvopt
new file mode 100644
index 0000000000000000000000000000000000000000..33eee51f0de82ffbb4c268779d98644b5d284a2e
--- /dev/null
+++ b/bsp/at32/at32f403a-start/project.uvopt
@@ -0,0 +1,162 @@
+
+
+
+ 1.0
+
+ ### uVision Project, (C) Keil Software
+
+
+ *.c
+ *.s*; *.src; *.a*
+ *.obj
+ *.lib
+ *.txt; *.h; *.inc
+ *.plm
+ *.cpp
+
+
+
+ 0
+ 0
+
+
+
+ rt-thread
+ 0x4
+ ARM-ADS
+
+ 8000000
+
+ 1
+ 1
+ 1
+ 0
+
+
+ 1
+ 65535
+ 0
+ 0
+ 0
+
+
+ 79
+ 66
+ 8
+ .\build\keil\List\
+
+
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+
+
+ 0
+ 0
+ 1
+
+ 0
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 6
+
+
+
+
+
+
+
+
+
+
+ Segger\JL2CM3.dll
+
+
+
+ 0
+ JL2CM3
+ -U788529815 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC800 -FN1 -FF0AT32F403A_1024 -FS08000000 -FL0100000
+
+
+ 0
+ UL2CM3
+ UL2CM3(-O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FN1 -FC800 -FD20000000 -FF0AT32F403A_1024 -FL0100000 -FS08000000
+
+
+
+
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
diff --git a/bsp/at32/at32f403a-start/project.uvoptx b/bsp/at32/at32f403a-start/project.uvoptx
new file mode 100644
index 0000000000000000000000000000000000000000..534820338f59ec56c9edb60311743a6a23ea1515
--- /dev/null
+++ b/bsp/at32/at32f403a-start/project.uvoptx
@@ -0,0 +1,1226 @@
+
+
+
+ 1.0
+
+ ### uVision Project, (C) Keil Software
+
+
+ *.c
+ *.s*; *.src; *.a*
+ *.obj; *.o
+ *.lib
+ *.txt; *.h; *.inc
+ *.plm
+ *.cpp
+ 0
+
+
+
+ 0
+ 0
+
+
+
+ rt-thread
+ 0x4
+ ARM-ADS
+
+ 12000000
+
+ 1
+ 1
+ 0
+ 1
+ 0
+
+
+ 1
+ 65535
+ 0
+ 0
+ 0
+
+
+ 79
+ 66
+ 8
+ .\build\keil\List\
+
+
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+
+
+ 1
+ 0
+ 1
+
+ 255
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 4
+
+
+
+
+
+
+
+
+
+
+ Segger\JL2CM3.dll
+
+
+
+ 0
+ JL2CM3
+ -U788529815 -O14 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight JTAG-DP") -D00(4BA00477) -L00(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC1000 -FN1 -FF0AT32F403A_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:AT32F403AVGT7$Flash\AT32F403A_1024.FLM)
+
+
+ 0
+ UL2CM3
+ UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0AT32F403A_1024 -FL0100000 -FS08000000 -FP0($$Device:AT32F403AVGT7$Flash\AT32F403A_1024.FLM)
+
+
+ 0
+ ST-LINKIII-KEIL_SWO
+ -U066EFF495056867767222250 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)
+
+
+
+
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+ Kernel
+ 0
+ 0
+ 0
+ 0
+
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\clock.c
+ clock.c
+ 0
+ 0
+
+
+ 1
+ 2
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\components.c
+ components.c
+ 0
+ 0
+
+
+ 1
+ 3
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\device.c
+ device.c
+ 0
+ 0
+
+
+ 1
+ 4
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\idle.c
+ idle.c
+ 0
+ 0
+
+
+ 1
+ 5
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\ipc.c
+ ipc.c
+ 0
+ 0
+
+
+ 1
+ 6
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\irq.c
+ irq.c
+ 0
+ 0
+
+
+ 1
+ 7
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\kservice.c
+ kservice.c
+ 0
+ 0
+
+
+ 1
+ 8
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\mem.c
+ mem.c
+ 0
+ 0
+
+
+ 1
+ 9
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\memheap.c
+ memheap.c
+ 0
+ 0
+
+
+ 1
+ 10
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\mempool.c
+ mempool.c
+ 0
+ 0
+
+
+ 1
+ 11
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\object.c
+ object.c
+ 0
+ 0
+
+
+ 1
+ 12
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\scheduler.c
+ scheduler.c
+ 0
+ 0
+
+
+ 1
+ 13
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\signal.c
+ signal.c
+ 0
+ 0
+
+
+ 1
+ 14
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\thread.c
+ thread.c
+ 0
+ 0
+
+
+ 1
+ 15
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\src\timer.c
+ timer.c
+ 0
+ 0
+
+
+
+
+ Applications
+ 0
+ 0
+ 0
+ 0
+
+ 2
+ 16
+ 1
+ 0
+ 0
+ 0
+ applications\main.c
+ main.c
+ 0
+ 0
+
+
+
+
+ Drivers
+ 0
+ 0
+ 0
+ 0
+
+ 3
+ 17
+ 1
+ 0
+ 0
+ 0
+ board\board.c
+ board.c
+ 0
+ 0
+
+
+ 3
+ 18
+ 1
+ 0
+ 0
+ 0
+ board\msp\at32_msp.c
+ at32_msp.c
+ 0
+ 0
+
+
+ 3
+ 19
+ 1
+ 0
+ 0
+ 0
+ board\msp\system_at32f4xx.c
+ system_at32f4xx.c
+ 0
+ 0
+
+
+ 3
+ 20
+ 2
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\CMSIS\AT32\AT32F4xx\src\mdk\startup_at32f403avgt7.s
+ startup_at32f403avgt7.s
+ 0
+ 0
+
+
+ 3
+ 21
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\rt_drivers\drv_gpio.c
+ drv_gpio.c
+ 0
+ 0
+
+
+ 3
+ 22
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\rt_drivers\drv_usart.c
+ drv_usart.c
+ 0
+ 0
+
+
+
+
+ cpu
+ 0
+ 0
+ 0
+ 0
+
+ 4
+ 23
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\libcpu\arm\common\backtrace.c
+ backtrace.c
+ 0
+ 0
+
+
+ 4
+ 24
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\libcpu\arm\common\div0.c
+ div0.c
+ 0
+ 0
+
+
+ 4
+ 25
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\libcpu\arm\common\showmem.c
+ showmem.c
+ 0
+ 0
+
+
+ 4
+ 26
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\libcpu\arm\cortex-m4\cpuport.c
+ cpuport.c
+ 0
+ 0
+
+
+ 4
+ 27
+ 2
+ 0
+ 0
+ 0
+ ..\..\..\libcpu\arm\cortex-m4\context_rvds.S
+ context_rvds.S
+ 0
+ 0
+
+
+
+
+ Filesystem
+ 0
+ 0
+ 0
+ 0
+
+ 5
+ 28
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\dfs\src\dfs.c
+ dfs.c
+ 0
+ 0
+
+
+ 5
+ 29
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\dfs\src\dfs_file.c
+ dfs_file.c
+ 0
+ 0
+
+
+ 5
+ 30
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\dfs\src\dfs_fs.c
+ dfs_fs.c
+ 0
+ 0
+
+
+ 5
+ 31
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\dfs\src\dfs_posix.c
+ dfs_posix.c
+ 0
+ 0
+
+
+ 5
+ 32
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\dfs\src\poll.c
+ poll.c
+ 0
+ 0
+
+
+ 5
+ 33
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\dfs\src\select.c
+ select.c
+ 0
+ 0
+
+
+ 5
+ 34
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\dfs\filesystems\devfs\devfs.c
+ devfs.c
+ 0
+ 0
+
+
+ 5
+ 35
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\dfs\filesystems\elmfat\dfs_elm.c
+ dfs_elm.c
+ 0
+ 0
+
+
+ 5
+ 36
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\dfs\filesystems\elmfat\ff.c
+ ff.c
+ 0
+ 0
+
+
+ 5
+ 37
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\dfs\filesystems\elmfat\option\ccsbcs.c
+ ccsbcs.c
+ 0
+ 0
+
+
+
+
+ DeviceDrivers
+ 0
+ 0
+ 0
+ 0
+
+ 6
+ 38
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\drivers\misc\pin.c
+ pin.c
+ 0
+ 0
+
+
+ 6
+ 39
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\drivers\serial\serial.c
+ serial.c
+ 0
+ 0
+
+
+ 6
+ 40
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\drivers\src\completion.c
+ completion.c
+ 0
+ 0
+
+
+ 6
+ 41
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\drivers\src\dataqueue.c
+ dataqueue.c
+ 0
+ 0
+
+
+ 6
+ 42
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\drivers\src\pipe.c
+ pipe.c
+ 0
+ 0
+
+
+ 6
+ 43
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\drivers\src\ringblk_buf.c
+ ringblk_buf.c
+ 0
+ 0
+
+
+ 6
+ 44
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\drivers\src\ringbuffer.c
+ ringbuffer.c
+ 0
+ 0
+
+
+ 6
+ 45
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\drivers\src\waitqueue.c
+ waitqueue.c
+ 0
+ 0
+
+
+ 6
+ 46
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\drivers\src\workqueue.c
+ workqueue.c
+ 0
+ 0
+
+
+
+
+ finsh
+ 0
+ 0
+ 0
+ 0
+
+ 7
+ 47
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\finsh\shell.c
+ shell.c
+ 0
+ 0
+
+
+ 7
+ 48
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\finsh\cmd.c
+ cmd.c
+ 0
+ 0
+
+
+ 7
+ 49
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\finsh\msh.c
+ msh.c
+ 0
+ 0
+
+
+ 7
+ 50
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\finsh\msh_file.c
+ msh_file.c
+ 0
+ 0
+
+
+
+
+ libc
+ 0
+ 0
+ 0
+ 0
+
+ 8
+ 51
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\libc\compilers\armlibc\libc.c
+ libc.c
+ 0
+ 0
+
+
+ 8
+ 52
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\libc\compilers\armlibc\mem_std.c
+ mem_std.c
+ 0
+ 0
+
+
+ 8
+ 53
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\libc\compilers\armlibc\stdio.c
+ stdio.c
+ 0
+ 0
+
+
+ 8
+ 54
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\libc\compilers\armlibc\stubs.c
+ stubs.c
+ 0
+ 0
+
+
+ 8
+ 55
+ 1
+ 0
+ 0
+ 0
+ ..\..\..\components\libc\compilers\common\time.c
+ time.c
+ 0
+ 0
+
+
+
+
+ AT32_Lib
+ 0
+ 0
+ 0
+ 0
+
+ 9
+ 56
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_adc.c
+ at32f4xx_adc.c
+ 0
+ 0
+
+
+ 9
+ 57
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_can.c
+ at32f4xx_can.c
+ 0
+ 0
+
+
+ 9
+ 58
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_crc.c
+ at32f4xx_crc.c
+ 0
+ 0
+
+
+ 9
+ 59
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dbgmcu.c
+ at32f4xx_dbgmcu.c
+ 0
+ 0
+
+
+ 9
+ 60
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dma.c
+ at32f4xx_dma.c
+ 0
+ 0
+
+
+ 9
+ 61
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_exti.c
+ at32f4xx_exti.c
+ 0
+ 0
+
+
+ 9
+ 62
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_flash.c
+ at32f4xx_flash.c
+ 0
+ 0
+
+
+ 9
+ 63
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_gpio.c
+ at32f4xx_gpio.c
+ 0
+ 0
+
+
+ 9
+ 64
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_i2c.c
+ at32f4xx_i2c.c
+ 0
+ 0
+
+
+ 9
+ 65
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_iwdg.c
+ at32f4xx_iwdg.c
+ 0
+ 0
+
+
+ 9
+ 66
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_pwr.c
+ at32f4xx_pwr.c
+ 0
+ 0
+
+
+ 9
+ 67
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_rcc.c
+ at32f4xx_rcc.c
+ 0
+ 0
+
+
+ 9
+ 68
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_spi.c
+ at32f4xx_spi.c
+ 0
+ 0
+
+
+ 9
+ 69
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_tim.c
+ at32f4xx_tim.c
+ 0
+ 0
+
+
+ 9
+ 70
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_usart.c
+ at32f4xx_usart.c
+ 0
+ 0
+
+
+ 9
+ 71
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_wwdg.c
+ at32f4xx_wwdg.c
+ 0
+ 0
+
+
+ 9
+ 72
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_sdio.c
+ at32f4xx_sdio.c
+ 0
+ 0
+
+
+ 9
+ 73
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_acc.c
+ at32f4xx_acc.c
+ 0
+ 0
+
+
+ 9
+ 74
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_bkp.c
+ at32f4xx_bkp.c
+ 0
+ 0
+
+
+ 9
+ 75
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_rtc.c
+ at32f4xx_rtc.c
+ 0
+ 0
+
+
+ 9
+ 76
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_ertc.c
+ at32f4xx_ertc.c
+ 0
+ 0
+
+
+ 9
+ 77
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_eth.c
+ at32f4xx_eth.c
+ 0
+ 0
+
+
+ 9
+ 78
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_xmc.c
+ at32f4xx_xmc.c
+ 0
+ 0
+
+
+ 9
+ 79
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_comp.c
+ at32f4xx_comp.c
+ 0
+ 0
+
+
+ 9
+ 80
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dac.c
+ at32f4xx_dac.c
+ 0
+ 0
+
+
+ 9
+ 81
+ 1
+ 0
+ 0
+ 0
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\misc.c
+ misc.c
+ 0
+ 0
+
+
+
+
diff --git a/bsp/at32/at32f403a-start/project.uvproj b/bsp/at32/at32f403a-start/project.uvproj
new file mode 100644
index 0000000000000000000000000000000000000000..8c764ab732a177889b3982b51a282585c435b69c
--- /dev/null
+++ b/bsp/at32/at32f403a-start/project.uvproj
@@ -0,0 +1,999 @@
+
+
+ 1.1
+ ### uVision Project, (C) Keil Software
+
+
+ rt-thread
+ 0x4
+ ARM-ADS
+
+
+ AT32F403AVGT7
+ ArteryTek
+ IRAM(0x20000000-0x20037FFF) IROM(0x08000000-0x080FFFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2
+
+ "Startup\ArteryTek\AT32F4xx\startup_at32f403avgt7.s" ("AT32F403A Startup Code")
+ UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0AT32F403A_1024 -FS08000000 -FL0100000)
+ 0
+ at32f4xx.h
+
+
+
+
+
+
+
+
+
+ SFD\ArteryTek\AT32F403A\AT32F403Axx.SFR
+ 0
+ 0
+
+
+
+ ArteryTek\AT32F4xx\
+ ArteryTek\AT32F4xx\
+
+ 0
+ 0
+ 0
+ 0
+ 1
+
+ .\build\keil\Obj\
+ rt-thread
+ 1
+ 0
+ 0
+ 1
+ 0
+ .\build\keil\List\
+ 1
+ 0
+ 0
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 1
+ 0
+ fromelf --bin !L --output rtthread.bin
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 3
+
+
+ 1
+
+
+ SARMCM3.DLL
+ -REMAP
+ DCM.DLL
+ -pCM4
+ SARMCM3.DLL
+
+ TCM.DLL
+ -pCM4
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 16
+
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 0
+ 1
+ 0
+
+ 0
+ 6
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Segger\JL2CM3.dll
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+ 1
+ 4096
+
+ 1
+ BIN\UL2CM3.DLL
+
+
+
+
+
+ 0
+
+
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ "Cortex-M4"
+
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 0
+ 2
+ 0
+ 0
+ 8
+ 0
+ 0
+ 0
+ 3
+ 3
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x38000
+
+
+ 1
+ 0x8000000
+ 0x100000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x8000000
+ 0x100000
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x38000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+
+
+
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+ USE_STDPERIPH_DRIVER, AT32F403AVGT7, RT_USING_ARM_LIBC
+
+ .;..\..\..\include;applications;.;board;board\msp;..\Libraries\rt_drivers;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\dfs\include;..\..\..\components\dfs\filesystems\devfs;..\..\..\components\dfs\filesystems\elmfat;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\..\..\components\libc\compilers\armlibc;..\..\..\components\libc\compilers\common;..\Libraries\AT32_Std_Driver\CMSIS\AT32\AT32F4xx\inc;..\Libraries\AT32_Std_Driver\CMSIS;..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\inc
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0x08000000
+ 0x20000000
+
+ .\board\linker_scripts\link.sct
+
+
+
+
+
+
+
+
+
+
+ Kernel
+
+
+ clock.c
+ 1
+ ..\..\..\src\clock.c
+
+
+
+
+ components.c
+ 1
+ ..\..\..\src\components.c
+
+
+
+
+ device.c
+ 1
+ ..\..\..\src\device.c
+
+
+
+
+ idle.c
+ 1
+ ..\..\..\src\idle.c
+
+
+
+
+ ipc.c
+ 1
+ ..\..\..\src\ipc.c
+
+
+
+
+ irq.c
+ 1
+ ..\..\..\src\irq.c
+
+
+
+
+ kservice.c
+ 1
+ ..\..\..\src\kservice.c
+
+
+
+
+ mem.c
+ 1
+ ..\..\..\src\mem.c
+
+
+
+
+ memheap.c
+ 1
+ ..\..\..\src\memheap.c
+
+
+
+
+ mempool.c
+ 1
+ ..\..\..\src\mempool.c
+
+
+
+
+ object.c
+ 1
+ ..\..\..\src\object.c
+
+
+
+
+ scheduler.c
+ 1
+ ..\..\..\src\scheduler.c
+
+
+
+
+ signal.c
+ 1
+ ..\..\..\src\signal.c
+
+
+
+
+ thread.c
+ 1
+ ..\..\..\src\thread.c
+
+
+
+
+ timer.c
+ 1
+ ..\..\..\src\timer.c
+
+
+
+
+ Applications
+
+
+ main.c
+ 1
+ applications\main.c
+
+
+
+
+ Drivers
+
+
+ board.c
+ 1
+ board\board.c
+
+
+
+
+ at32_msp.c
+ 1
+ board\msp\at32_msp.c
+
+
+
+
+ system_at32f4xx.c
+ 1
+ board\msp\system_at32f4xx.c
+
+
+
+
+ startup_at32f403avgt7.s
+ 2
+ ..\Libraries\AT32_Std_Driver\CMSIS\AT32\AT32F4xx\src\mdk\startup_at32f403avgt7.s
+
+
+
+
+ drv_gpio.c
+ 1
+ ..\Libraries\rt_drivers\drv_gpio.c
+
+
+
+
+ drv_usart.c
+ 1
+ ..\Libraries\rt_drivers\drv_usart.c
+
+
+
+
+ cpu
+
+
+ backtrace.c
+ 1
+ ..\..\..\libcpu\arm\common\backtrace.c
+
+
+
+
+ div0.c
+ 1
+ ..\..\..\libcpu\arm\common\div0.c
+
+
+
+
+ showmem.c
+ 1
+ ..\..\..\libcpu\arm\common\showmem.c
+
+
+
+
+ cpuport.c
+ 1
+ ..\..\..\libcpu\arm\cortex-m4\cpuport.c
+
+
+
+
+ context_rvds.S
+ 2
+ ..\..\..\libcpu\arm\cortex-m4\context_rvds.S
+
+
+
+
+ Filesystem
+
+
+ dfs.c
+ 1
+ ..\..\..\components\dfs\src\dfs.c
+
+
+
+
+ dfs_file.c
+ 1
+ ..\..\..\components\dfs\src\dfs_file.c
+
+
+
+
+ dfs_fs.c
+ 1
+ ..\..\..\components\dfs\src\dfs_fs.c
+
+
+
+
+ dfs_posix.c
+ 1
+ ..\..\..\components\dfs\src\dfs_posix.c
+
+
+
+
+ poll.c
+ 1
+ ..\..\..\components\dfs\src\poll.c
+
+
+
+
+ select.c
+ 1
+ ..\..\..\components\dfs\src\select.c
+
+
+
+
+ devfs.c
+ 1
+ ..\..\..\components\dfs\filesystems\devfs\devfs.c
+
+
+
+
+ dfs_elm.c
+ 1
+ ..\..\..\components\dfs\filesystems\elmfat\dfs_elm.c
+
+
+
+
+ ff.c
+ 1
+ ..\..\..\components\dfs\filesystems\elmfat\ff.c
+
+
+
+
+ ccsbcs.c
+ 1
+ ..\..\..\components\dfs\filesystems\elmfat\option\ccsbcs.c
+
+
+
+
+ DeviceDrivers
+
+
+ pin.c
+ 1
+ ..\..\..\components\drivers\misc\pin.c
+
+
+
+
+ serial.c
+ 1
+ ..\..\..\components\drivers\serial\serial.c
+
+
+
+
+ completion.c
+ 1
+ ..\..\..\components\drivers\src\completion.c
+
+
+
+
+ dataqueue.c
+ 1
+ ..\..\..\components\drivers\src\dataqueue.c
+
+
+
+
+ pipe.c
+ 1
+ ..\..\..\components\drivers\src\pipe.c
+
+
+
+
+ ringblk_buf.c
+ 1
+ ..\..\..\components\drivers\src\ringblk_buf.c
+
+
+
+
+ ringbuffer.c
+ 1
+ ..\..\..\components\drivers\src\ringbuffer.c
+
+
+
+
+ waitqueue.c
+ 1
+ ..\..\..\components\drivers\src\waitqueue.c
+
+
+
+
+ workqueue.c
+ 1
+ ..\..\..\components\drivers\src\workqueue.c
+
+
+
+
+ finsh
+
+
+ shell.c
+ 1
+ ..\..\..\components\finsh\shell.c
+
+
+
+
+ cmd.c
+ 1
+ ..\..\..\components\finsh\cmd.c
+
+
+
+
+ msh.c
+ 1
+ ..\..\..\components\finsh\msh.c
+
+
+
+
+ msh_file.c
+ 1
+ ..\..\..\components\finsh\msh_file.c
+
+
+
+
+ libc
+
+
+ libc.c
+ 1
+ ..\..\..\components\libc\compilers\armlibc\libc.c
+
+
+
+
+ mem_std.c
+ 1
+ ..\..\..\components\libc\compilers\armlibc\mem_std.c
+
+
+
+
+ stdio.c
+ 1
+ ..\..\..\components\libc\compilers\armlibc\stdio.c
+
+
+
+
+ stubs.c
+ 1
+ ..\..\..\components\libc\compilers\armlibc\stubs.c
+
+
+
+
+ time.c
+ 1
+ ..\..\..\components\libc\compilers\common\time.c
+
+
+
+
+ AT32_Lib
+
+
+ at32f4xx_adc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_adc.c
+
+
+
+
+ at32f4xx_can.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_can.c
+
+
+
+
+ at32f4xx_crc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_crc.c
+
+
+
+
+ at32f4xx_dbgmcu.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dbgmcu.c
+
+
+
+
+ at32f4xx_dma.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dma.c
+
+
+
+
+ at32f4xx_exti.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_exti.c
+
+
+
+
+ at32f4xx_flash.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_flash.c
+
+
+
+
+ at32f4xx_gpio.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_gpio.c
+
+
+
+
+ at32f4xx_i2c.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_i2c.c
+
+
+
+
+ at32f4xx_iwdg.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_iwdg.c
+
+
+
+
+ at32f4xx_pwr.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_pwr.c
+
+
+
+
+ at32f4xx_rcc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_rcc.c
+
+
+
+
+ at32f4xx_spi.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_spi.c
+
+
+
+
+ at32f4xx_tim.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_tim.c
+
+
+
+
+ at32f4xx_usart.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_usart.c
+
+
+
+
+ at32f4xx_wwdg.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_wwdg.c
+
+
+
+
+ at32f4xx_sdio.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_sdio.c
+
+
+
+
+ at32f4xx_acc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_acc.c
+
+
+
+
+ at32f4xx_bkp.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_bkp.c
+
+
+
+
+ at32f4xx_rtc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_rtc.c
+
+
+
+
+ at32f4xx_ertc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_ertc.c
+
+
+
+
+ at32f4xx_eth.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_eth.c
+
+
+
+
+ at32f4xx_xmc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_xmc.c
+
+
+
+
+ at32f4xx_comp.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_comp.c
+
+
+
+
+ at32f4xx_dac.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dac.c
+
+
+
+
+ misc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\misc.c
+
+
+
+
+
+
+
diff --git a/bsp/at32/at32f403a-start/project.uvprojx b/bsp/at32/at32f403a-start/project.uvprojx
new file mode 100644
index 0000000000000000000000000000000000000000..1aacf820355eb67976165fdad3c2e1d1fb9bb36c
--- /dev/null
+++ b/bsp/at32/at32f403a-start/project.uvprojx
@@ -0,0 +1,841 @@
+
+
+
+ 2.1
+
+ ### uVision Project, (C) Keil Software
+
+
+
+ rt-thread
+ 0x4
+ ARM-ADS
+ 5060750::V5.06 update 6 (build 750)::ARMCC
+ 0
+
+
+ AT32F403AVGT7
+ ArteryTek
+ Keil.AT32F4xx_DFP.1.3.1
+ IRAM(0x20000000,0x38000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE
+
+
+ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0AT32F403A_1024 -FS08000000 -FL0100000 -FP0($$Device:AT32F403AVGT7$Flash\AT32F403A_1024.FLM))
+ 0
+ $$Device:AT32F403AVGT7$Device\Include\at32f4xx.h
+
+
+
+
+
+
+
+
+
+ $$Device:AT32F403AVGT7$SVD\AT32F403Axx.svd
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+
+ .\build\keil\Obj\
+ rt-thread
+ 1
+ 0
+ 0
+ 1
+ 0
+ .\build\keil\List\
+ 1
+ 0
+ 0
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 1
+ 0
+ fromelf --bin !L --output rtthread.bin
+
+ 0
+ 0
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 3
+
+
+ 1
+
+
+ SARMCM3.DLL
+ -REMAP
+ DCM.DLL
+ -pCM4
+ SARMCM3.DLL
+
+ TCM.DLL
+ -pCM4
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 16
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+ 1
+ 4096
+
+ 1
+ BIN\UL2CM3.DLL
+
+
+
+
+
+ 0
+
+
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ "Cortex-M4"
+
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 0
+ 2
+ 0
+ 0
+ 0
+ 8
+ 0
+ 0
+ 0
+ 0
+ 3
+ 3
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x38000
+
+
+ 1
+ 0x8000000
+ 0x100000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x8000000
+ 0x100000
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x38000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+
+
+
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 2
+ 0
+ 0
+ 1
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+
+
+ USE_STDPERIPH_DRIVER, AT32F403AVGT7, RT_USING_ARM_LIBC
+
+ .;..\..\..\include;applications;.;board;board\msp;..\Libraries\rt_drivers;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\dfs\include;..\..\..\components\dfs\filesystems\devfs;..\..\..\components\dfs\filesystems\elmfat;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\..\..\components\libc\compilers\armlibc;..\..\..\components\libc\compilers\common;..\Libraries\AT32_Std_Driver\CMSIS\AT32\AT32F4xx\inc;..\Libraries\AT32_Std_Driver\CMSIS;..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\inc
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0x08000000
+ 0x20000000
+
+ .\board\linker_scripts\link.sct
+
+
+
+
+
+
+
+
+
+
+ Kernel
+
+
+ clock.c
+ 1
+ ..\..\..\src\clock.c
+
+
+ components.c
+ 1
+ ..\..\..\src\components.c
+
+
+ device.c
+ 1
+ ..\..\..\src\device.c
+
+
+ idle.c
+ 1
+ ..\..\..\src\idle.c
+
+
+ ipc.c
+ 1
+ ..\..\..\src\ipc.c
+
+
+ irq.c
+ 1
+ ..\..\..\src\irq.c
+
+
+ kservice.c
+ 1
+ ..\..\..\src\kservice.c
+
+
+ mem.c
+ 1
+ ..\..\..\src\mem.c
+
+
+ memheap.c
+ 1
+ ..\..\..\src\memheap.c
+
+
+ mempool.c
+ 1
+ ..\..\..\src\mempool.c
+
+
+ object.c
+ 1
+ ..\..\..\src\object.c
+
+
+ scheduler.c
+ 1
+ ..\..\..\src\scheduler.c
+
+
+ signal.c
+ 1
+ ..\..\..\src\signal.c
+
+
+ thread.c
+ 1
+ ..\..\..\src\thread.c
+
+
+ timer.c
+ 1
+ ..\..\..\src\timer.c
+
+
+
+
+ Applications
+
+
+ main.c
+ 1
+ applications\main.c
+
+
+
+
+ Drivers
+
+
+ board.c
+ 1
+ board\board.c
+
+
+ at32_msp.c
+ 1
+ board\msp\at32_msp.c
+
+
+ system_at32f4xx.c
+ 1
+ board\msp\system_at32f4xx.c
+
+
+ startup_at32f403avgt7.s
+ 2
+ ..\Libraries\AT32_Std_Driver\CMSIS\AT32\AT32F4xx\src\mdk\startup_at32f403avgt7.s
+
+
+ drv_gpio.c
+ 1
+ ..\Libraries\rt_drivers\drv_gpio.c
+
+
+ drv_usart.c
+ 1
+ ..\Libraries\rt_drivers\drv_usart.c
+
+
+
+
+ cpu
+
+
+ backtrace.c
+ 1
+ ..\..\..\libcpu\arm\common\backtrace.c
+
+
+ div0.c
+ 1
+ ..\..\..\libcpu\arm\common\div0.c
+
+
+ showmem.c
+ 1
+ ..\..\..\libcpu\arm\common\showmem.c
+
+
+ cpuport.c
+ 1
+ ..\..\..\libcpu\arm\cortex-m4\cpuport.c
+
+
+ context_rvds.S
+ 2
+ ..\..\..\libcpu\arm\cortex-m4\context_rvds.S
+
+
+
+
+ Filesystem
+
+
+ dfs.c
+ 1
+ ..\..\..\components\dfs\src\dfs.c
+
+
+ dfs_file.c
+ 1
+ ..\..\..\components\dfs\src\dfs_file.c
+
+
+ dfs_fs.c
+ 1
+ ..\..\..\components\dfs\src\dfs_fs.c
+
+
+ dfs_posix.c
+ 1
+ ..\..\..\components\dfs\src\dfs_posix.c
+
+
+ poll.c
+ 1
+ ..\..\..\components\dfs\src\poll.c
+
+
+ select.c
+ 1
+ ..\..\..\components\dfs\src\select.c
+
+
+ devfs.c
+ 1
+ ..\..\..\components\dfs\filesystems\devfs\devfs.c
+
+
+ dfs_elm.c
+ 1
+ ..\..\..\components\dfs\filesystems\elmfat\dfs_elm.c
+
+
+ ff.c
+ 1
+ ..\..\..\components\dfs\filesystems\elmfat\ff.c
+
+
+ ccsbcs.c
+ 1
+ ..\..\..\components\dfs\filesystems\elmfat\option\ccsbcs.c
+
+
+
+
+ DeviceDrivers
+
+
+ pin.c
+ 1
+ ..\..\..\components\drivers\misc\pin.c
+
+
+ serial.c
+ 1
+ ..\..\..\components\drivers\serial\serial.c
+
+
+ completion.c
+ 1
+ ..\..\..\components\drivers\src\completion.c
+
+
+ dataqueue.c
+ 1
+ ..\..\..\components\drivers\src\dataqueue.c
+
+
+ pipe.c
+ 1
+ ..\..\..\components\drivers\src\pipe.c
+
+
+ ringblk_buf.c
+ 1
+ ..\..\..\components\drivers\src\ringblk_buf.c
+
+
+ ringbuffer.c
+ 1
+ ..\..\..\components\drivers\src\ringbuffer.c
+
+
+ waitqueue.c
+ 1
+ ..\..\..\components\drivers\src\waitqueue.c
+
+
+ workqueue.c
+ 1
+ ..\..\..\components\drivers\src\workqueue.c
+
+
+
+
+ finsh
+
+
+ shell.c
+ 1
+ ..\..\..\components\finsh\shell.c
+
+
+ cmd.c
+ 1
+ ..\..\..\components\finsh\cmd.c
+
+
+ msh.c
+ 1
+ ..\..\..\components\finsh\msh.c
+
+
+ msh_file.c
+ 1
+ ..\..\..\components\finsh\msh_file.c
+
+
+
+
+ libc
+
+
+ libc.c
+ 1
+ ..\..\..\components\libc\compilers\armlibc\libc.c
+
+
+ mem_std.c
+ 1
+ ..\..\..\components\libc\compilers\armlibc\mem_std.c
+
+
+ stdio.c
+ 1
+ ..\..\..\components\libc\compilers\armlibc\stdio.c
+
+
+ stubs.c
+ 1
+ ..\..\..\components\libc\compilers\armlibc\stubs.c
+
+
+ time.c
+ 1
+ ..\..\..\components\libc\compilers\common\time.c
+
+
+
+
+ AT32_Lib
+
+
+ at32f4xx_adc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_adc.c
+
+
+ at32f4xx_can.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_can.c
+
+
+ at32f4xx_crc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_crc.c
+
+
+ at32f4xx_dbgmcu.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dbgmcu.c
+
+
+ at32f4xx_dma.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dma.c
+
+
+ at32f4xx_exti.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_exti.c
+
+
+ at32f4xx_flash.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_flash.c
+
+
+ at32f4xx_gpio.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_gpio.c
+
+
+ at32f4xx_i2c.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_i2c.c
+
+
+ at32f4xx_iwdg.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_iwdg.c
+
+
+ at32f4xx_pwr.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_pwr.c
+
+
+ at32f4xx_rcc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_rcc.c
+
+
+ at32f4xx_spi.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_spi.c
+
+
+ at32f4xx_tim.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_tim.c
+
+
+ at32f4xx_usart.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_usart.c
+
+
+ at32f4xx_wwdg.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_wwdg.c
+
+
+ at32f4xx_sdio.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_sdio.c
+
+
+ at32f4xx_acc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_acc.c
+
+
+ at32f4xx_bkp.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_bkp.c
+
+
+ at32f4xx_rtc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_rtc.c
+
+
+ at32f4xx_ertc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_ertc.c
+
+
+ at32f4xx_eth.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_eth.c
+
+
+ at32f4xx_xmc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_xmc.c
+
+
+ at32f4xx_comp.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_comp.c
+
+
+ at32f4xx_dac.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\at32f4xx_dac.c
+
+
+ misc.c
+ 1
+ ..\Libraries\AT32_Std_Driver\AT32F4xx_StdPeriph_Driver\src\misc.c
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/at32/at32f403a-start/rtconfig.h b/bsp/at32/at32f403a-start/rtconfig.h
new file mode 100644
index 0000000000000000000000000000000000000000..d5b7d5e7e59af43274ad493a1ee4c0fbc9876949
--- /dev/null
+++ b/bsp/at32/at32f403a-start/rtconfig.h
@@ -0,0 +1,193 @@
+#ifndef RT_CONFIG_H__
+#define RT_CONFIG_H__
+
+/* Automatically generated file; DO NOT EDIT. */
+/* RT-Thread Configuration */
+
+/* RT-Thread Kernel */
+
+#define RT_NAME_MAX 8
+#define RT_ALIGN_SIZE 4
+#define RT_THREAD_PRIORITY_32
+#define RT_THREAD_PRIORITY_MAX 32
+#define RT_TICK_PER_SECOND 1000
+#define RT_USING_OVERFLOW_CHECK
+#define RT_USING_HOOK
+#define RT_USING_IDLE_HOOK
+#define RT_IDLE_HOOK_LIST_SIZE 4
+#define IDLE_THREAD_STACK_SIZE 256
+#define RT_USING_TIMER_SOFT
+#define RT_TIMER_THREAD_PRIO 4
+#define RT_TIMER_THREAD_STACK_SIZE 512
+#define RT_DEBUG
+#define RT_DEBUG_COLOR
+
+/* Inter-Thread communication */
+
+#define RT_USING_SEMAPHORE
+#define RT_USING_MUTEX
+#define RT_USING_EVENT
+#define RT_USING_MAILBOX
+#define RT_USING_MESSAGEQUEUE
+
+/* Memory Management */
+
+#define RT_USING_MEMPOOL
+#define RT_USING_MEMHEAP
+#define RT_USING_SMALL_MEM
+#define RT_USING_HEAP
+
+/* Kernel Device Object */
+
+#define RT_USING_DEVICE
+#define RT_USING_CONSOLE
+#define RT_CONSOLEBUF_SIZE 128
+#define RT_CONSOLE_DEVICE_NAME "uart1"
+#define RT_VER_NUM 0x40003
+#define ARCH_ARM
+#define RT_USING_CPU_FFS
+#define ARCH_ARM_CORTEX_M
+#define ARCH_ARM_CORTEX_M4
+
+/* RT-Thread Components */
+
+#define RT_USING_COMPONENTS_INIT
+#define RT_USING_USER_MAIN
+#define RT_MAIN_THREAD_STACK_SIZE 2048
+#define RT_MAIN_THREAD_PRIORITY 10
+
+/* C++ features */
+
+
+/* Command shell */
+
+#define RT_USING_FINSH
+#define FINSH_THREAD_NAME "tshell"
+#define FINSH_USING_HISTORY
+#define FINSH_HISTORY_LINES 5
+#define FINSH_USING_SYMTAB
+#define FINSH_USING_DESCRIPTION
+#define FINSH_THREAD_PRIORITY 20
+#define FINSH_THREAD_STACK_SIZE 4096
+#define FINSH_CMD_SIZE 80
+#define FINSH_USING_MSH
+#define FINSH_USING_MSH_DEFAULT
+#define FINSH_USING_MSH_ONLY
+#define FINSH_ARG_MAX 10
+
+/* Device virtual file system */
+
+#define RT_USING_DFS
+#define DFS_USING_WORKDIR
+#define DFS_FILESYSTEMS_MAX 2
+#define DFS_FILESYSTEM_TYPES_MAX 2
+#define DFS_FD_MAX 16
+#define RT_USING_DFS_ELMFAT
+
+/* elm-chan's FatFs, Generic FAT Filesystem Module */
+
+#define RT_DFS_ELM_CODE_PAGE 437
+#define RT_DFS_ELM_WORD_ACCESS
+#define RT_DFS_ELM_USE_LFN_3
+#define RT_DFS_ELM_USE_LFN 3
+#define RT_DFS_ELM_MAX_LFN 255
+#define RT_DFS_ELM_DRIVES 2
+#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
+#define RT_DFS_ELM_REENTRANT
+#define RT_USING_DFS_DEVFS
+
+/* Device Drivers */
+
+#define RT_USING_DEVICE_IPC
+#define RT_PIPE_BUFSZ 512
+#define RT_USING_SERIAL
+#define RT_SERIAL_RB_BUFSZ 64
+#define RT_USING_PIN
+
+/* Using USB */
+
+
+/* POSIX layer and C standard library */
+
+#define RT_USING_LIBC
+#define RT_USING_POSIX
+
+/* Network */
+
+/* Socket abstraction layer */
+
+
+/* Network interface device */
+
+
+/* light weight TCP/IP stack */
+
+
+/* AT commands */
+
+
+/* VBUS(Virtual Software BUS) */
+
+
+/* Utilities */
+
+
+/* RT-Thread online packages */
+
+/* IoT - internet of things */
+
+
+/* Wi-Fi */
+
+/* Marvell WiFi */
+
+
+/* Wiced WiFi */
+
+
+/* IoT Cloud */
+
+
+/* security packages */
+
+
+/* language packages */
+
+
+/* multimedia packages */
+
+
+/* tools packages */
+
+
+/* system packages */
+
+
+/* peripheral libraries and drivers */
+
+
+/* miscellaneous packages */
+
+
+/* samples: kernel and components samples */
+
+#define SOC_FAMILY_AT32
+#define SOC_SERIES_AT32F403A
+
+/* Hardware Drivers Config */
+
+#define SOC_AT32F403AVGT7
+
+/* Onboard Peripheral Drivers */
+
+#define BSP_USING_SERIAL
+
+/* On-chip Peripheral Drivers */
+
+#define BSP_USING_GPIO
+#define BSP_USING_UART
+#define BSP_USING_UART1
+#define BSP_USING_UART2
+#define BSP_USING_UART3
+
+#endif
diff --git a/bsp/at32/at32f403a-start/rtconfig.py b/bsp/at32/at32f403a-start/rtconfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..1d63cabb9675201230fdce7f9238a30c4b12aa80
--- /dev/null
+++ b/bsp/at32/at32f403a-start/rtconfig.py
@@ -0,0 +1,143 @@
+import os
+
+# toolchains options
+ARCH='arm'
+CPU='cortex-m4'
+CROSS_TOOL='gcc'
+
+# bsp lib config
+BSP_LIBRARY_TYPE = None
+
+if os.getenv('RTT_CC'):
+ CROSS_TOOL = os.getenv('RTT_CC')
+if os.getenv('RTT_ROOT'):
+ RTT_ROOT = os.getenv('RTT_ROOT')
+
+# cross_tool provides the cross compiler
+# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
+if CROSS_TOOL == 'gcc':
+ PLATFORM = 'gcc'
+ EXEC_PATH = r'C:\Users\XXYYZZ'
+elif CROSS_TOOL == 'keil':
+ PLATFORM = 'armcc'
+ EXEC_PATH = r'C:/Keil_v5'
+elif CROSS_TOOL == 'iar':
+ PLATFORM = 'iar'
+ EXEC_PATH = r'C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.0'
+
+if os.getenv('RTT_EXEC_PATH'):
+ EXEC_PATH = os.getenv('RTT_EXEC_PATH')
+
+BUILD = 'debug'
+
+if PLATFORM == 'gcc':
+ # toolchains
+ PREFIX = 'arm-none-eabi-'
+ CC = PREFIX + 'gcc'
+ AS = PREFIX + 'gcc'
+ AR = PREFIX + 'ar'
+ CXX = PREFIX + 'g++'
+ LINK = PREFIX + 'gcc'
+ TARGET_EXT = 'elf'
+ SIZE = PREFIX + 'size'
+ OBJDUMP = PREFIX + 'objdump'
+ OBJCPY = PREFIX + 'objcopy'
+
+ DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
+ CFLAGS = DEVICE + ' -Dgcc'
+ AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
+ LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
+
+ CPATH = ''
+ LPATH = ''
+
+ if BUILD == 'debug':
+ CFLAGS += ' -O0 -gdwarf-2 -g'
+ AFLAGS += ' -gdwarf-2'
+ else:
+ CFLAGS += ' -O2'
+
+ CXXFLAGS = CFLAGS
+
+ POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
+
+elif PLATFORM == 'armcc':
+ # toolchains
+ CC = 'armcc'
+ CXX = 'armcc'
+ AS = 'armasm'
+ AR = 'armar'
+ LINK = 'armlink'
+ TARGET_EXT = 'axf'
+
+ DEVICE = ' --cpu Cortex-M4.fp '
+ CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99'
+ AFLAGS = DEVICE + ' --apcs=interwork '
+ LFLAGS = DEVICE + ' --scatter "board\linker_scripts\link.sct" --info sizes --info totals --info unused --info veneers --list rt-thread.map --strict'
+ CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/include'
+ LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCC/lib'
+
+ CFLAGS += ' -D__MICROLIB '
+ AFLAGS += ' --pd "__MICROLIB SETA 1" '
+ LFLAGS += ' --library_type=microlib '
+ EXEC_PATH += '/ARM/ARMCC/bin/'
+
+ if BUILD == 'debug':
+ CFLAGS += ' -g -O0'
+ AFLAGS += ' -g'
+ else:
+ CFLAGS += ' -O2'
+
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
+ POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
+
+elif PLATFORM == 'iar':
+ # toolchains
+ CC = 'iccarm'
+ CXX = 'iccarm'
+ AS = 'iasmarm'
+ AR = 'iarchive'
+ LINK = 'ilinkarm'
+ TARGET_EXT = 'out'
+
+ DEVICE = '-Dewarm'
+
+ CFLAGS = DEVICE
+ CFLAGS += ' --diag_suppress Pa050'
+ CFLAGS += ' --no_cse'
+ CFLAGS += ' --no_unroll'
+ CFLAGS += ' --no_inline'
+ CFLAGS += ' --no_code_motion'
+ CFLAGS += ' --no_tbaa'
+ CFLAGS += ' --no_clustering'
+ CFLAGS += ' --no_scheduling'
+ CFLAGS += ' --endian=little'
+ CFLAGS += ' --cpu=Cortex-M4'
+ CFLAGS += ' -e'
+ CFLAGS += ' --fpu=VFPv4_sp'
+ CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
+ CFLAGS += ' --silent'
+
+ AFLAGS = DEVICE
+ AFLAGS += ' -s+'
+ AFLAGS += ' -w+'
+ AFLAGS += ' -r'
+ AFLAGS += ' --cpu Cortex-M4'
+ AFLAGS += ' --fpu VFPv4_sp'
+ AFLAGS += ' -S'
+
+ if BUILD == 'debug':
+ CFLAGS += ' --debug'
+ CFLAGS += ' -On'
+ else:
+ CFLAGS += ' -Oh'
+
+ LFLAGS = ' --config "board/linker_scripts/link.icf"'
+ LFLAGS += ' --entry __iar_program_start'
+
+ CXXFLAGS = CFLAGS
+
+ EXEC_PATH = EXEC_PATH + '/arm/bin/'
+ POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/at32/at32f403a-start/template.ewd b/bsp/at32/at32f403a-start/template.ewd
new file mode 100644
index 0000000000000000000000000000000000000000..03cabc06218e0ba95d25fe821d5d7b14d41cf3bc
--- /dev/null
+++ b/bsp/at32/at32f403a-start/template.ewd
@@ -0,0 +1,2908 @@
+
+
+ 3
+
+ rt-thread
+
+ ARM
+
+ 1
+
+ C-SPY
+ 2
+
+ 29
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ARMSIM_ID
+ 2
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ CADI_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+
+ CMSISDAP_ID
+ 2
+
+ 4
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GDBSERVER_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+ IJET_ID
+ 2
+
+ 8
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JLINK_ID
+ 2
+
+ 16
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LMIFTDI_ID
+ 2
+
+ 2
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+ NULINK_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+ PEMICRO_ID
+ 2
+
+ 3
+ 1
+ 1
+
+
+
+
+
+
+
+ STLINK_ID
+ 2
+
+ 5
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ THIRDPARTY_ID
+ 2
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+
+ TIFET_ID
+ 2
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ XDS100_ID
+ 2
+
+ 6
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8BE.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin
+ 1
+
+
+ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin
+ 0
+
+
+
+
+ Release
+
+ ARM
+
+ 0
+
+ C-SPY
+ 2
+
+ 29
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ARMSIM_ID
+ 2
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+ CADI_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+
+ CMSISDAP_ID
+ 2
+
+ 4
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GDBSERVER_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+ IJET_ID
+ 2
+
+ 8
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JLINK_ID
+ 2
+
+ 16
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LMIFTDI_ID
+ 2
+
+ 2
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+ NULINK_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+ PEMICRO_ID
+ 2
+
+ 3
+ 1
+ 0
+
+
+
+
+
+
+
+ STLINK_ID
+ 2
+
+ 5
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ THIRDPARTY_ID
+ 2
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+ TIFET_ID
+ 2
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ XDS100_ID
+ 2
+
+ 6
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8BE.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin
+ 0
+
+
+ $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin
+ 1
+
+
+ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin
+ 0
+
+
+ $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin
+ 0
+
+
+
+
diff --git a/bsp/at32/at32f403a-start/template.ewp b/bsp/at32/at32f403a-start/template.ewp
new file mode 100644
index 0000000000000000000000000000000000000000..a89908e2dea41d373e67ec1be60ed485ed2b41a1
--- /dev/null
+++ b/bsp/at32/at32f403a-start/template.ewp
@@ -0,0 +1,2040 @@
+
+
+ 3
+
+ rt-thread
+
+ ARM
+
+ 1
+
+ General
+ 3
+
+ 30
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 34
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 10
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 20
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 1
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
+ Release
+
+ ARM
+
+ 0
+
+ General
+ 3
+
+ 30
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ICCARM
+ 2
+
+ 34
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AARM
+ 2
+
+ 10
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OBJCOPY
+ 0
+
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+ CUSTOM
+ 3
+
+
+
+ 0
+
+
+
+ BICOMP
+ 0
+
+
+
+ BUILDACTION
+ 1
+
+
+
+
+
+
+ ILINK
+ 0
+
+ 20
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IARCHIVE
+ 0
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+ BILINK
+ 0
+
+
+
+
diff --git a/bsp/at32/at32f403a-start/template.eww b/bsp/at32/at32f403a-start/template.eww
new file mode 100644
index 0000000000000000000000000000000000000000..bd036bb4c98c1598f04b85f64b0dff37f6ec6028
--- /dev/null
+++ b/bsp/at32/at32f403a-start/template.eww
@@ -0,0 +1,10 @@
+
+
+
+
+ $WS_DIR$\template.ewp
+
+
+
+
+
diff --git a/bsp/at32/at32f403a-start/template.uvopt b/bsp/at32/at32f403a-start/template.uvopt
new file mode 100644
index 0000000000000000000000000000000000000000..33eee51f0de82ffbb4c268779d98644b5d284a2e
--- /dev/null
+++ b/bsp/at32/at32f403a-start/template.uvopt
@@ -0,0 +1,162 @@
+
+
+
+ 1.0
+
+ ### uVision Project, (C) Keil Software
+
+
+ *.c
+ *.s*; *.src; *.a*
+ *.obj
+ *.lib
+ *.txt; *.h; *.inc
+ *.plm
+ *.cpp
+
+
+
+ 0
+ 0
+
+
+
+ rt-thread
+ 0x4
+ ARM-ADS
+
+ 8000000
+
+ 1
+ 1
+ 1
+ 0
+
+
+ 1
+ 65535
+ 0
+ 0
+ 0
+
+
+ 79
+ 66
+ 8
+ .\build\keil\List\
+
+
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+
+
+ 0
+ 0
+ 1
+
+ 0
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 6
+
+
+
+
+
+
+
+
+
+
+ Segger\JL2CM3.dll
+
+
+
+ 0
+ JL2CM3
+ -U788529815 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC800 -FN1 -FF0AT32F403A_1024 -FS08000000 -FL0100000
+
+
+ 0
+ UL2CM3
+ UL2CM3(-O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FN1 -FC800 -FD20000000 -FF0AT32F403A_1024 -FL0100000 -FS08000000
+
+
+
+
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
diff --git a/bsp/at32/at32f403a-start/template.uvoptx b/bsp/at32/at32f403a-start/template.uvoptx
new file mode 100644
index 0000000000000000000000000000000000000000..769c7372f0d4fa414b2b6d38ea400ff416725c1f
--- /dev/null
+++ b/bsp/at32/at32f403a-start/template.uvoptx
@@ -0,0 +1,184 @@
+
+
+
+ 1.0
+
+ ### uVision Project, (C) Keil Software
+
+
+ *.c
+ *.s*; *.src; *.a*
+ *.obj; *.o
+ *.lib
+ *.txt; *.h; *.inc
+ *.plm
+ *.cpp
+ 0
+
+
+
+ 0
+ 0
+
+
+
+ rt-thread
+ 0x4
+ ARM-ADS
+
+ 12000000
+
+ 1
+ 1
+ 0
+ 1
+ 0
+
+
+ 1
+ 65535
+ 0
+ 0
+ 0
+
+
+ 79
+ 66
+ 8
+ .\build\keil\List\
+
+
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+
+
+ 1
+ 0
+ 1
+
+ 255
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 1
+ 6
+
+
+
+
+
+
+
+
+
+
+ Segger\JL2CM3.dll
+
+
+
+ 0
+ JL2CM3
+ -U788529815 -O14 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight JTAG-DP") -D00(4BA00477) -L00(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC1000 -FN1 -FF0AT32F403A_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:AT32F403AVGT7$Flash\AT32F403A_1024.FLM)
+
+
+ 0
+ UL2CM3
+ UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0AT32F403A_1024 -FL0100000 -FS08000000 -FP0($$Device:AT32F403AVGT7$Flash\AT32F403A_1024.FLM)
+
+
+ 0
+ ST-LINKIII-KEIL_SWO
+ -U066EFF495056867767222250 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)
+
+
+
+
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ Source Group 1
+ 0
+ 0
+ 0
+ 0
+
+
+
diff --git a/bsp/at32/at32f403a-start/template.uvproj b/bsp/at32/at32f403a-start/template.uvproj
new file mode 100644
index 0000000000000000000000000000000000000000..7f6d829aff0b93277d4f39893544b8645f1686e0
--- /dev/null
+++ b/bsp/at32/at32f403a-start/template.uvproj
@@ -0,0 +1,407 @@
+
+
+
+ 1.1
+
+ ### uVision Project, (C) Keil Software
+
+
+
+ rt-thread
+ 0x4
+ ARM-ADS
+
+
+ AT32F403AVGT7
+ ArteryTek
+ IRAM(0x20000000-0x20037FFF) IROM(0x08000000-0x080FFFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2
+
+ "Startup\ArteryTek\AT32F4xx\startup_at32f403avgt7.s" ("AT32F403A Startup Code")
+ UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0AT32F403A_1024 -FS08000000 -FL0100000)
+ 0
+ at32f4xx.h
+
+
+
+
+
+
+
+
+
+ SFD\ArteryTek\AT32F403A\AT32F403Axx.SFR
+ 0
+ 0
+
+
+
+ ArteryTek\AT32F4xx\
+ ArteryTek\AT32F4xx\
+
+ 0
+ 0
+ 0
+ 0
+ 1
+
+ .\build\keil\Obj\
+ rt-thread
+ 1
+ 0
+ 0
+ 1
+ 0
+ .\build\keil\List\
+ 1
+ 0
+ 0
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 1
+ 0
+ fromelf --bin !L --output rtthread.bin
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 3
+
+
+ 1
+
+
+ SARMCM3.DLL
+ -REMAP
+ DCM.DLL
+ -pCM4
+ SARMCM3.DLL
+
+ TCM.DLL
+ -pCM4
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 16
+
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+
+
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 0
+ 1
+ 0
+
+ 0
+ 6
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Segger\JL2CM3.dll
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+ 1
+ 4096
+
+ 1
+ BIN\UL2CM3.DLL
+
+
+
+
+
+ 0
+
+
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ "Cortex-M4"
+
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 0
+ 2
+ 0
+ 0
+ 8
+ 0
+ 0
+ 0
+ 3
+ 3
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x38000
+
+
+ 1
+ 0x8000000
+ 0x100000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x8000000
+ 0x100000
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x38000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+
+
+
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0x08000000
+ 0x20000000
+
+ .\board\linker_scripts\link.sct
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/at32/at32f403a-start/template.uvprojx b/bsp/at32/at32f403a-start/template.uvprojx
new file mode 100644
index 0000000000000000000000000000000000000000..9f3a44663de699198579f3420ac6489bc445a708
--- /dev/null
+++ b/bsp/at32/at32f403a-start/template.uvprojx
@@ -0,0 +1,391 @@
+
+
+
+ 2.1
+
+ ### uVision Project, (C) Keil Software
+
+
+
+ rt-thread
+ 0x4
+ ARM-ADS
+ 5060750::V5.06 update 6 (build 750)::ARMCC
+
+
+ AT32F403AVGT7
+ ArteryTek
+ Keil.AT32F4xx_DFP.1.3.1
+ IRAM(0x20000000,0x38000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE
+
+
+ UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0AT32F403A_1024 -FS08000000 -FL0100000 -FP0($$Device:AT32F403AVGT7$Flash\AT32F403A_1024.FLM))
+ 0
+ $$Device:AT32F403AVGT7$Device\Include\at32f4xx.h
+
+
+
+
+
+
+
+
+
+ $$Device:AT32F403AVGT7$SVD\AT32F403Axx.svd
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+
+ .\build\keil\Obj\
+ rt-thread
+ 1
+ 0
+ 0
+ 1
+ 0
+ .\build\keil\List\
+ 1
+ 0
+ 0
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 1
+ 0
+ fromelf --bin !L --output rtthread.bin
+
+ 0
+ 0
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 3
+
+
+ 1
+
+
+ SARMCM3.DLL
+ -REMAP
+ DCM.DLL
+ -pCM4
+ SARMCM3.DLL
+
+ TCM.DLL
+ -pCM4
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 16
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+ 1
+ 4096
+
+ 1
+ BIN\UL2CM3.DLL
+
+
+
+
+
+ 0
+
+
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ "Cortex-M4"
+
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 0
+ 2
+ 0
+ 0
+ 8
+ 0
+ 0
+ 0
+ 0
+ 3
+ 3
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x38000
+
+
+ 1
+ 0x8000000
+ 0x100000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x8000000
+ 0x100000
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x38000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+
+
+
+ 1
+ 1
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 2
+ 0
+ 0
+ 1
+ 0
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0x08000000
+ 0x20000000
+
+ .\board\linker_scripts\link.sct
+
+
+
+
+
+
+
+
+
+
+ Source Group 1
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.cproject b/bsp/cypress/psoc6-pioneerkit_modus/.cproject
new file mode 100644
index 0000000000000000000000000000000000000000..fbb8aa3a9c4159edf489e3cbd1cf8e02ac875598
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.cproject
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Attach (JLink).launch b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Attach (JLink).launch
new file mode 100644
index 0000000000000000000000000000000000000000..5a9b77907e272e4654b48dc544791bd38c8b5794
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Attach (JLink).launch
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Attach (KitProg3).launch b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Attach (KitProg3).launch
new file mode 100644
index 0000000000000000000000000000000000000000..63fbcc50a156134d5c5e0456d565287db49f0bf0
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Attach (KitProg3).launch
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Debug (JLink).launch b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Debug (JLink).launch
new file mode 100644
index 0000000000000000000000000000000000000000..5280966cf9d08023ed22ae7c1810f4f44beaf352
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Debug (JLink).launch
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Debug (KitProg3).launch b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Debug (KitProg3).launch
new file mode 100644
index 0000000000000000000000000000000000000000..8ca00070b2c0cb055ecf477ebf59b2513900a91c
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Debug (KitProg3).launch
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Erase (JLink).launch b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Erase (JLink).launch
new file mode 100644
index 0000000000000000000000000000000000000000..86a77fd13617ef030b415f86a1b2a801653345bf
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Erase (JLink).launch
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Erase (KitProg3).launch b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Erase (KitProg3).launch
new file mode 100644
index 0000000000000000000000000000000000000000..712c9743809254c8032b07239f4fc95de6f53f8e
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Erase (KitProg3).launch
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Program (JLink).launch b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Program (JLink).launch
new file mode 100644
index 0000000000000000000000000000000000000000..7469c742e92c0d18900f542f61f9528a06a9bf84
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Program (JLink).launch
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Program (KitProg3).launch b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Program (KitProg3).launch
new file mode 100644
index 0000000000000000000000000000000000000000..0e5bbc11ec1d61bc2bc7b74ca54b6c670ae827a7
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.mtbLaunchConfigs/psoc6-pioneerkit_modus Program (KitProg3).launch
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.project b/bsp/cypress/psoc6-pioneerkit_modus/.project
new file mode 100644
index 0000000000000000000000000000000000000000..e9e2cefe654d93982b5c01546a0ef3dc78294eea
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.project
@@ -0,0 +1,28 @@
+
+
+ psoc6-pioneerkit_modus
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.core.ccnature
+ com.cypress.studio.app.cymodusnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/.settings/language.settings.xml b/bsp/cypress/psoc6-pioneerkit_modus/.settings/language.settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6fdfc52492554d4e6aa638d5bca4c4bdfa38d0a9
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/.settings/language.settings.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/LICENSE b/bsp/cypress/psoc6-pioneerkit_modus/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..91c81ad20b740069cd5e098f7cd2674d75a933ee
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/LICENSE
@@ -0,0 +1,210 @@
+CYPRESS END USER LICENSE AGREEMENT
+
+PLEASE READ THIS END USER LICENSE AGREEMENT ("Agreement") CAREFULLY BEFORE
+DOWNLOADING, INSTALLING, COPYING, OR USING THIS SOFTWARE AND ACCOMPANYING
+DOCUMENTATION. BY DOWNLOADING, INSTALLING, COPYING OR USING THE SOFTWARE,
+YOU ARE AGREEING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL
+OF THE TERMS OF THIS AGREEMENT, PROMPTLY RETURN AND DO NOT USE THE SOFTWARE.
+IF YOU HAVE PURCHASED THIS LICENSE TO THE SOFTWARE, YOUR RIGHT TO RETURN THE
+SOFTWARE EXPIRES 30 DAYS AFTER YOUR PURCHASE AND APPLIES ONLY TO THE ORIGINAL
+PURCHASER.
+
+1. Definitions.
+
+ "Software" means this software and any accompanying documentation,
+ including any upgrades, updates, bug fixes or modified versions provided
+ to you by Cypress.
+
+ "Source Code" means software in human-readable form.
+
+ "Binary Code" means the software in binary code form such as object code or
+ an executable.
+
+ "Development Tools" means software that is intended to be installed on a
+ personal computer and used to create programming code for Firmware,
+ Drivers, or Host Applications. Examples of Development Tools are
+ Cypress's PSoC Creator software, Cypress's WICED SDKs, and Cypress's
+ ModusToolbox software.
+
+ "Firmware" means software that executes on a Cypress hardware product.
+
+ "Driver" means software that enables the use of a Cypress hardware product
+ on a particular host operating system such as GNU/Linux, Windows, MacOS,
+ Android, and iOS.
+
+ "Host Application" means software that executes on a device other than a
+ Cypress hardware product in order to program, control, or communicate
+ with a Cypress hardware product.
+
+ "inf File" means a hardware setup information file (.inf file) created by
+ the Software to allow a Microsoft Windows operating system to install
+ the driver for a Cypress hardware product.
+
+2. License. Subject to the terms and conditions of this Agreement, Cypress
+Semiconductor Corporation ("Cypress") and its suppliers grant to you a
+non-exclusive, non-transferable license under their copyright rights:
+
+ a. to use the Development Tools in object code form solely for the purpose
+ of creating Firmware, Drivers, Host Applications, and inf Files for
+ Cypress hardware products; and
+
+ b. (i) if provided in Source Code form, to copy, modify, and compile the
+ Firmware Source Code to create Firmware for execution on a Cypress
+ hardware product, and
+ (ii) to distribute Firmware in binary code form only, only when
+ installed onto a Cypress hardware product; and
+
+ c. (i) if provided in Source Code form, to copy, modify, and compile the
+ Driver Source Code to create one or more Drivers to enable the use
+ of a Cypress hardware product on a particular host operating
+ system, and
+ (ii) to distribute the Driver, in binary code form only, only when
+ installed on a device that includes the Cypress hardware product
+ that the Driver is intended to enable; and
+
+ d. (i) if provided in Source Code form, to copy, modify, and compile the
+ Host Application Source Code to create one or more Host
+ Applications to program, control, or communicate with a Cypress
+ hardware product, and
+ (ii) to distribute Host Applications, in binary code form only, only
+ when installed on a device that includes a Cypress hardware product
+ that the Host Application is intended to program, control, or
+ communicate with; and
+
+ e. to freely distribute any inf File.
+
+Any distribution of Software permitted under this Agreement must be made
+pursuant to your standard end user license agreement used for your proprietary
+(closed source) software products, such end user license agreement to include,
+at a minimum, provisions limiting your licensors' liability and prohibiting
+reverse engineering of the Software, consistent with such provisions in this
+Agreement.
+
+3. Free and Open Source Software. Portions of the Software may be licensed
+under free and/or open source licenses such as the GNU General Public License
+or other licenses from third parties ("Third Party Software"). Third Party
+Software is subject to the applicable license agreement and not this
+Agreement. If you are entitled to receive the source code from Cypress for
+any Third Party Software included with the Software, either the source code
+will be included with the Software or you may obtain the source code at no
+charge from . The applicable license
+terms will accompany each source code package. To review the license terms
+applicable to any Third Party Software for which Cypress is not required to
+provide you with source code, please see the Software's installation directory
+on your computer.
+
+4. Proprietary Rights; Ownership. The Software, including all intellectual
+property rights therein, is and will remain the sole and exclusive property of
+Cypress or its suppliers. Cypress retains ownership of the Source Code and
+any compiled version thereof. Subject to Cypress' ownership of the underlying
+Software (including Source Code), you retain ownership of any modifications
+you make to the Source Code. You agree not to remove any Cypress copyright or
+other notices from the Source Code and any modifications thereof. You agree
+to keep the Source Code confidential. Any reproduction, modification,
+translation, compilation, or representation of the Source Code except as
+permitted in Section 2 ("License") is prohibited without the express written
+permission of Cypress. Except as otherwise expressly provided in this
+Agreement, you may not:
+ (i) modify, adapt, or create derivative works based upon the Software;
+ (ii) copy the Software;
+ (iii) except and only to the extent explicitly permitted by applicable
+ law despite this limitation, decompile, translate, reverse engineer,
+ disassemble or otherwise reduce the Software to human-readable form;
+ or
+ (iv) use the Software or any sample code other than for the Purpose.
+You hereby covenant that you will not assert any claim that the Software, or
+derivative works thereof created by or for Cypress, infringe any intellectual
+property right owned or controlled by you
+
+5. No Support. Cypress may, but is not required to, provide technical support
+for the Software.
+
+6. Term and Termination. This Agreement is effective until terminated, and
+either party may terminate this Agreement at any time with or without cause.
+This Agreement and your license rights under this Agreement will terminate
+immediately without notice from Cypress if you fail to comply with any
+provision of this Agreement. Upon termination, you must destroy all copies of
+Software in your possession or control. The following paragraphs shall
+survive any termination of this Agreement: "Free and Open Source Software,"
+"Proprietary Rights; Ownership," "Compliance With Law," "Disclaimer,"
+"Limitation of Liability," and "General."
+
+7. Compliance With Law. Each party agrees to comply with all applicable laws,
+rules and regulations in connection with its activities under this Agreement.
+Without limiting the foregoing, the Software may be subject to export control
+laws and regulations of the United States and other countries. You agree to
+comply strictly with all such laws and regulations and acknowledge that you
+have the responsibility to obtain licenses to export, re-export, or import the
+Software.
+
+8. Disclaimer. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS
+MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THE
+SOFTWARE, INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+reserves the right to make changes to the Software without notice. Cypress
+does not assume any liability arising out of the application or use of
+Software or any product or circuit described in the Software. It is the
+responsibility of the user of the Software to properly design, program, and
+test the functionality and safety of any application made of the Software and
+any resulting product. Cypress does not authorize its Software or products
+for use in any products where a malfunction or failure of the Software or
+Cypress product may reasonably be expected to result in significant property
+damage, injury or death ("High Risk Product"). If you include any Software or
+Cypress product in a High Risk Product, you assume all risk of such use and
+agree to indemnify Cypress and its suppliers against all liability. No
+computing device can be absolutely secure. Therefore, despite security
+measures implemented in Cypress hardware or software products, Cypress does
+not assume any liability arising out of any security breach, such as
+unauthorized access to or use of a Cypress product.
+
+9. Limitation of Liability. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE
+LAW, IN NO EVENT WILL CYPRESS OR ITS SUPPLIERS, RESELLERS, OR DISTRIBUTORS BE
+LIABLE FOR ANY LOST REVENUE, PROFIT, OR DATA, OR FOR SPECIAL, INDIRECT,
+CONSEQUENTIAL, INCIDENTAL, OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS
+OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR
+INABILITY TO USE THE SOFTWARE EVEN IF CYPRESS OR ITS SUPPLIERS, RESELLERS, OR
+DISTRIBUTORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO
+EVENT SHALL CYPRESS' OR ITS SUPPLIERS', RESELLERS', OR DISTRIBUTORS' TOTAL
+LIABILITY TO YOU, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE), OR
+OTHERWISE, EXCEED THE GREATER OF US$500 OR THE PRICE PAID BY YOU FOR THE
+SOFTWARE. THE FOREGOING LIMITATIONS SHALL APPLY EVEN IF THE ABOVE-STATED
+WARRANTY FAILS OF ITS ESSENTIAL PURPOSE. BECAUSE SOME STATES OR JURISDICTIONS
+DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL OR INCIDENTAL DAMAGES,
+ALL OR PORTIONS OF THE ABOVE LIMITATION MAY NOT APPLY TO YOU.
+
+10. Restricted Rights. The Software is commercial computer software as that
+term is described in 48 C.F.R. 252.227-7014(a)(1). If the Software is being
+acquired by or on behalf of the U.S. Government or by a U.S. Government prime
+contractor or subcontractor (at any tier), then the Government's rights in
+Software shall be only those set forth in this Agreement.
+
+11. Personal Information. You agree that information you provide through your
+registration on Cypress IoT Community Forum or other Cypress websites,
+including contact information or other personal information, may be collected
+and used by Cypress consistent with its Data Privacy Policy
+(www.cypress.com/privacy-policy), as updated or revised from time to time, and
+may be provided to its third party sales representatives, distributors and
+other entities conducting sales activities for Cypress for sales-related and
+other business purposes.
+
+12. General. This Agreement will bind and inure to the benefit of each
+party's successors and assigns, provided that you may not assign or transfer
+this Agreement, in whole or in part, without Cypress' written consent. This
+Agreement shall be governed by and construed in accordance with the laws of
+the State of California, United States of America, as if performed wholly
+within the state and without giving effect to the principles of conflict of
+law. The parties consent to personal and exclusive jurisdiction of and venue
+in, the state and federal courts within Santa Clara County, California;
+provided however, that nothing in this Agreement will limit Cypress' right to
+bring legal action in any venue in order to protect or enforce its
+intellectual property rights. No failure of either party to exercise or
+enforce any of its rights under this Agreement will act as a waiver of such
+rights. If any portion of this Agreement is found to be void or
+unenforceable, the remaining provisions of this Agreement shall remain in full
+force and effect. This Agreement is the complete and exclusive agreement
+between the parties with respect to the subject matter hereof, superseding and
+replacing any and all prior agreements, communications, and understandings
+(both written and oral) regarding such subject matter. Any notice to Cypress
+will be deemed effective when actually received and must be sent to Cypress
+Semiconductor Corporation, ATTN: Chief Legal Officer, 198 Champion Court, San
+Jose, CA 95134 USA.
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/Makefile b/bsp/cypress/psoc6-pioneerkit_modus/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..61a750c0c12a64278c16a437b082e476f2bf215e
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/Makefile
@@ -0,0 +1,183 @@
+################################################################################
+# \file Makefile
+# \version 1.0
+#
+# \brief
+# Top-level application make file.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+
+################################################################################
+# Basic Configuration
+################################################################################
+
+# Target board/hardware
+TARGET=CY8CKIT-062-BLE
+# Name of application (used to derive name of final linked file).
+APPNAME=mtb-example-psoc6-empty-app
+
+# Name of toolchain to use. Options include:
+#
+# GCC_ARM -- GCC 7.2.1, provided with ModusToolbox IDE
+# ARM -- ARM Compiler (must be installed separately)
+# IAR -- IAR Compiler (must be installed separately)
+#
+# See also: CY_COMPILER_PATH below
+TOOLCHAIN=GCC_ARM
+
+# Default build configuration. Options include:
+#
+# Debug -- build with minimal optimizations, focus on debugging.
+# Release -- build with full optimizations
+CONFIG=Debug
+
+# If set to "true" or "1", display full command-lines when building.
+VERBOSE=
+
+# RT-Thread root directory
+RTT_ROOT_DIR=../../../
+
+################################################################################
+# Advanced Configuration
+################################################################################
+
+# Enable optional code that is ordinarily disabled by default.
+#
+# Available components depend on the specific targeted hardware and firmware
+# in use. In general, if you have
+#
+# COMPONENTS=foo bar
+#
+# ... then code in directories named COMPONENT_foo and COMPONENT_bar will be
+# added to the build
+#
+COMPONENTS=
+
+# Like COMPONENTS, but disable optional code that was enabled by default.
+DISABLE_COMPONENTS=
+
+# By default the build system automatically looks in the Makefile's directory
+# tree for source code and builds it. The SOURCES variable can be used to
+# manually add source code to the build process from a location not searched
+# by default, or otherwise not found by the build system.
+SOURCES=$(wildcard $(RTT_ROOT_DIR)/libcpu/arm/cortex-m4/*.c) \
+ $(wildcard $(RTT_ROOT_DIR)/libcpu/arm/common/*.c) \
+ $(wildcard $(RTT_ROOT_DIR)/src/*.c) \
+ $(wildcard $(RTT_ROOT_DIR)/components/drivers/src/*.c) \
+ $(wildcard $(RTT_ROOT_DIR)/components/drivers/serial/*.c) \
+ $(wildcard $(RTT_ROOT_DIR)/components/finsh/*.c)
+ifeq ($(TOOLCHAIN),GCC_ARM)
+ SOURCES+=$(RTT_ROOT_DIR)/libcpu/arm/cortex-m4/context_gcc.S
+else ifeq ($(TOOLCHAIN),ARM)
+ SOURCES+=$(RTT_ROOT_DIR)/libcpu/arm/cortex-m4/context_rvds.S
+else
+ SOURCES+=$(RTT_ROOT_DIR)/libcpu/arm/cortex-m4/context_iar.S
+endif
+
+# Like SOURCES, but for include directories. Value should be paths to
+# directories (without a leading -I).
+INCLUDES=$(RTT_ROOT_DIR)/include/ \
+ $(RTT_ROOT_DIR)/components/finsh/ \
+ $(RTT_ROOT_DIR)/components/drivers/include/
+
+# Add additional defines to the build process (without a leading -D).
+DEFINES=HAVE_SIGVAL HAVE_SIGEVENT HAVE_SIGINFO RT_USING_NEWLIB
+
+# Select softfp or hardfp floating point. Default is softfp.
+VFP_SELECT=hardfp
+
+# Additional / custom C compiler flags.
+#
+# NOTE: Includes and defines should use the INCLUDES and DEFINES variable
+# above.
+CFLAGS=
+
+# Additional / custom C++ compiler flags.
+#
+# NOTE: Includes and defines should use the INCLUDES and DEFINES variable
+# above.
+CXXFLAGS=
+
+# Additional / custom assembler flags.
+#
+# NOTE: Includes and defines should use the INCLUDES and DEFINES variable
+# above.
+ASFLAGS=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wa,-mimplicit-it=always
+
+# Additional / custom linker flags.
+LDFLAGS=
+
+# Additional / custom libraries to link in to the application.
+LDLIBS=
+
+# Path to the linker script to use (if empty, use the default linker script).
+LINKER_SCRIPT=
+
+# Custom pre-build commands to run.
+PREBUILD=
+
+# Custom post-build commands to run.
+POSTBUILD=
+
+
+################################################################################
+# Paths
+################################################################################
+
+# Relative path to the project directory (default is the Makefile's directory).
+#
+# This controls where automatic source code discovery looks for code.
+CY_APP_PATH=
+
+# Relative path to the "base" library. It provides the core makefile build
+# infrastructure.
+CY_BASELIB_PATH=libs/psoc6make
+
+# Absolute path to the compiler's "bin" directory.
+#
+# The default depends on the selected TOOLCHAIN (GCC_ARM uses the ModusToolbox
+# IDE provided compiler by default).
+CY_COMPILER_PATH=
+
+
+# Locate ModusToolbox IDE helper tools folders in default installation
+# locations for Windows, Linux, and macOS.
+CY_WIN_HOME=$(subst \,/,$(USERPROFILE))
+CY_TOOLS_PATHS ?= $(wildcard \
+ $(CY_WIN_HOME)/ModusToolbox/tools_* \
+ $(HOME)/ModusToolbox/tools_* \
+ /Applications/ModusToolbox/tools_*)
+
+# If you install ModusToolbox IDE in a custom location, add the path to its
+# "tools_X.Y" folder (where X and Y are the version number of the tools
+# folder).
+CY_TOOLS_PATHS+=
+
+# Default to the newest installed tools folder, or the users override (if it's
+# found).
+CY_TOOLS_DIR=$(lastword $(sort $(wildcard $(CY_TOOLS_PATHS))))
+
+ifeq ($(CY_TOOLS_DIR),)
+$(error Unable to find any of the available CY_TOOLS_PATHS -- $(CY_TOOLS_PATHS))
+endif
+
+$(info Tools Directory: $(CY_TOOLS_DIR))
+
+include $(CY_TOOLS_DIR)/make/start.mk
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/README.md b/bsp/cypress/psoc6-pioneerkit_modus/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..bf886a707349138962bf4247237ad9cbdbebbefc
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/README.md
@@ -0,0 +1,98 @@
+# Cypress CY8CKIT-062-BLE PSoC 6 BLE Pioneer Kit 说明
+
+## 简介
+
+本文档为Cypress为PSoC6 BLE Pioneer Kit开发板提供的 BSP (板级支持包) 说明。
+
+主要内容如下:
+
+- 开发板资源介绍
+- BSP 快速上手
+- 进阶使用方法
+
+通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。
+
+## 开发板介绍
+
+CY8CKIT-062-BLE PSoC6 BLE Pioneer Kit 是赛普拉斯推出的一款32位双核CPU子系统( ARM Cortex-M4 和 ARM Cortex-M0)的开发板,具有单周期乘法的150-MHz Arm Cortex-M4F CPU (浮点和
+存储器保护单元),100-MHz Cortex M0+ CPU,带单周期乘法和MPU,可以充分发挥 PSoC6 双核芯片性能。
+
+开发板外观详细信息:https://www.cypress.com/file/390496/download
+
+
+该开发板常用 **板载资源** 如下:
+
+- MCU:CY8C6347BZI-BLD53,Cortex-M4主频 150MHz,Cortex-M0主频 100MHz,1 MB 应用闪存,32 KB EEPROM 区域和32 KB 安全闪存 ,288 KB 集成SRAM
+ MCU手册更多详细信息请参考文档 https://www.cypress.com/file/457541/download
+
+- 开发环境:ModusToolbox 2.0
+ PSoC® Creator™ 下载链接 https://www.cypress.com/products/modustoolbox-software-environment
+
+- 开发板:CY8CKIT-062-BLE PSoC 6 BLE Pioneer Kit
+ 开发板更多详细信息请参考文档 https://www.cypress.com/file/390496/download
+
+
+## 外设支持
+
+本 BSP 目前对外设的支持情况详细信息请参考文档 https://www.cypress.com/file/390496/download
+
+## 使用说明
+
+使用说明分为如下两个章节:
+
+- 快速上手
+
+ 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
+
+- 进阶使用
+
+ 本章节是为需要在 RT-Thread 操作系统上使用赛普拉斯开发板资源的开发者准备的。
+
+
+### 快速上手
+
+本 BSP 以 ModusToolbox 2.0开发环境(GCC),介绍如何将系统运行起来。
+
+#### 硬件连接
+
+使用Type-C数据线连接开发板到 PC.
+
+#### 编译下载
+1, 安装ModusToolbox 2.0时请使用默认路径
+
+2, 打开ModusToolbox 2.0时workspace选择工程所在目录下(例如workspace: C:\Git\rt-thread\bsp\cypress)
+
+3, 在Project Explorer的空白处右键,点击import,General->Existing Projects into Workspace ->next,点击Browse选择
+ 此BSP所在目录加载工程->Finish
+
+4, 下载lib:在左下角Quick Panel的Tools栏,点击library Manager-> BSPs下面勾选CY8CKIT-062-BLE (若已勾选可以不用再选)
+ -> Libraries里PSoC6 Base Libraries下面全部勾选core-lib,psoc6cm0p,psoc6hal,psoc6make,psoc6pdl -> 点击apply 进行下载
+
+5, 编译此工程
+
+6, 下载此工程
+
+
+工程默认配置使用 SWD方式下载程序,Type-C数据线连接开发板,编译之后直接点击下载按钮即可。
+
+#### 运行结果
+
+下载程序成功之后,系统会自动运行。打开终端工具串口小助手,复位设备后,可以看到 RT-Thread 的输出信息:
+
+注:推荐使用串口调试助手如:sscom
+
+```
+ \ | /
+- RT - Thread Operating System
+ / | \ 4.0.3 build Jan 6 2020
+ 2006 - 2019 Copyright by rt-thread team
+hello rt-thread
+msh >hello rt-thread
+hello rt-thread
+```
+
+## 联系人信息
+
+维护人:
+
+- [amyqian379](https://github.com/amyqian379)
\ No newline at end of file
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/applications/main.c b/bsp/cypress/psoc6-pioneerkit_modus/applications/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..56fc49240b1c39c9d0dfb64ff8a3f1981614f9ef
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/applications/main.c
@@ -0,0 +1,67 @@
+/******************************************************************************
+* File Name: main.c
+*
+* Description: This is the source code for the Empty PSoC6 Application
+* for ModusToolbox.
+*
+* Related Document: See Readme.md
+*
+*
+*******************************************************************************
+* (c) 2019, Cypress Semiconductor Corporation. All rights reserved.
+*******************************************************************************
+* This software, including source code, documentation and related materials
+* ("Software"), is owned by Cypress Semiconductor Corporation or one of its
+* subsidiaries ("Cypress") and is protected by and subject to worldwide patent
+* protection (United States and foreign), United States copyright laws and
+* international treaty provisions. Therefore, you may use this Software only
+* as provided in the license agreement accompanying the software package from
+* which you obtained this Software ("EULA").
+*
+* If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+* non-transferable license to copy, modify, and compile the Software source
+* code solely for use in connection with Cypress's integrated circuit products.
+* Any reproduction, modification, translation, compilation, or representation
+* of this Software except as specified above is prohibited without the express
+* written permission of Cypress.
+*
+* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+* reserves the right to make changes to the Software without notice. Cypress
+* does not assume any liability arising out of the application or use of the
+* Software or any product or circuit described in the Software. Cypress does
+* not authorize its products for use in any products where a malfunction or
+* failure of the Cypress product may reasonably be expected to result in
+* significant property damage, injury or death ("High Risk Product"). By
+* including Cypress's product in a High Risk Product, the manufacturer of such
+* system or application assumes all risk of such use and in doing so agrees to
+* indemnify Cypress against all liability.
+*******************************************************************************/
+
+#include "cy_pdl.h"
+#include "cycfg.h"
+#include "cy_device_headers.h"
+#include "cycfg_peripherals.h"
+#include
+#include "board.h"
+#include "cybsp.h"
+
+#ifdef RT_USING_FINSH
+#include
+#include
+#endif
+
+int main(void)
+{
+
+ for(;;)
+ {
+ rt_kprintf("hello rt-thread\n");
+ rt_thread_mdelay(1000);
+
+
+ }
+}
+
+/* [] END OF FILE */
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/drivers/board.c b/bsp/cypress/psoc6-pioneerkit_modus/drivers/board.c
new file mode 100644
index 0000000000000000000000000000000000000000..00b6607a7fa4b325e6d4a75cada5616403d5e8a1
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/drivers/board.c
@@ -0,0 +1,51 @@
+
+#include
+#include
+#include
+#include "cy_device_headers.h"
+#include "board.h"
+#include "uart.h"
+#include "cy_systick.h"
+#include "cycfg.h"
+
+#define configTOTAL_HEAP_SIZE (24*1024)
+/* Allocate the memory for the heap. */
+ALIGN(RT_ALIGN_SIZE)
+static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
+/**
+ * This is the timer interrupt service routine.
+ *
+ */
+void SysTick_Handler_CB(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ rt_tick_increase();
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+
+void rt_hw_board_init()
+{
+ /* init systick */
+ init_cycfg_all();
+
+ SystemCoreClockUpdate();
+
+ Cy_SysTick_Init(CY_SYSTICK_CLOCK_SOURCE_CLK_CPU, SystemCoreClock/RT_TICK_PER_SECOND);
+ Cy_SysTick_SetCallback(0, SysTick_Handler_CB);
+ Cy_SysTick_EnableInterrupt();
+
+ rt_system_heap_init((void*)ucHeap, (void*)(ucHeap+configTOTAL_HEAP_SIZE));
+ /* initialize UART device */
+ rt_hw_uart_init();
+
+#ifdef RT_USING_CONSOLE
+ rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
+#endif
+}
+
+/*@}*/
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/drivers/board.h b/bsp/cypress/psoc6-pioneerkit_modus/drivers/board.h
new file mode 100644
index 0000000000000000000000000000000000000000..54fb261397c6d500a042a2e0e5534153c4de2f9f
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/drivers/board.h
@@ -0,0 +1,21 @@
+
+#ifndef __BOARD_H__
+#define __BOARD_H__
+
+#ifdef __CC_ARM
+extern int Image$$RW_IRAM1$$ZI$$Limit;
+#define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
+#elif __ICCARM__
+#pragma section="HEAP"
+#define HEAP_BEGIN (__segment_end("HEAP"))
+#else
+extern unsigned int __end__;
+extern unsigned int __HeapLimit;
+#define HEAP_BEGIN (void*)&__end__
+#define HEAP_END (void*)&__HeapLimit
+#endif
+
+void rt_hw_board_init(void);
+
+#endif
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/drivers/uart.c b/bsp/cypress/psoc6-pioneerkit_modus/drivers/uart.c
new file mode 100644
index 0000000000000000000000000000000000000000..54ba921ed9ce361059d688f9d42a25ba6b54176c
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/drivers/uart.c
@@ -0,0 +1,350 @@
+#include
+#include "uart.h"
+#include "cycfg_peripherals.h"
+/**
+ * @addtogroup
+ */
+/*@{*/
+
+/* RT-Thread Device Interface */
+/**
+ * This function initializes uart
+ */
+static rt_err_t rt_uart_init (rt_device_t dev)
+{
+ struct uart_device* uart = (struct uart_device*) dev->user_data;
+
+ if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
+ {
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ rt_memset(uart->int_rx->rx_buffer, 0,
+ sizeof(uart->int_rx->rx_buffer));
+ uart->int_rx->read_index = uart->int_rx->save_index = 0;
+ }
+
+ if (dev->flag & RT_DEVICE_FLAG_INT_TX)
+ {
+ rt_memset(uart->int_tx->tx_buffer, 0,
+ sizeof(uart->int_tx->tx_buffer));
+ uart->int_tx->write_index = uart->int_tx->save_index = 0;
+ }
+
+ dev->flag |= RT_DEVICE_FLAG_ACTIVATED;
+ }
+
+ return RT_EOK;
+}
+
+/* save a char to uart buffer */
+static void rt_uart_savechar(struct uart_device* uart, char ch)
+{
+ rt_base_t level;
+
+ /* disable interrupt */
+ level = rt_hw_interrupt_disable();
+
+ uart->int_rx->rx_buffer[uart->int_rx->save_index] = ch;
+ uart->int_rx->save_index ++;
+ if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE)
+ uart->int_rx->save_index = 0;
+
+ /* if the next position is read index, discard this 'read char' */
+ if (uart->int_rx->save_index == uart->int_rx->read_index)
+ {
+ uart->int_rx->read_index ++;
+ if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE)
+ uart->int_rx->read_index = 0;
+ }
+
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+}
+
+static rt_err_t rt_uart_open(rt_device_t dev, rt_uint16_t oflag)
+{
+ struct uart_device* uart;
+ oflag = oflag;
+
+ RT_ASSERT(dev != RT_NULL);
+ uart = (struct uart_device*) dev->user_data;
+
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ /* enable interrupt */
+ UART_ENABLE_IRQ(uart->rx_irq);
+ }
+
+ return RT_EOK;
+}
+
+static rt_err_t rt_uart_close(rt_device_t dev)
+{
+ struct uart_device* uart;
+
+ RT_ASSERT(dev != RT_NULL);
+ uart = (struct uart_device*) dev->user_data;
+
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ /* disable interrupt */
+ UART_DISABLE_IRQ(uart->rx_irq);
+ }
+
+ return RT_EOK;
+}
+
+static rt_size_t rt_uart_read (rt_device_t dev, rt_off_t pos, void* buffer,
+ rt_size_t size)
+{
+ rt_uint8_t* ptr;
+ rt_err_t err_code;
+ struct uart_device* uart;
+ pos = pos;
+
+ ptr = buffer;
+ err_code = RT_EOK;
+ uart = (struct uart_device*)dev->user_data;
+
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ rt_base_t level;
+
+ /* interrupt mode Rx */
+ while (size)
+ {
+ if (uart->int_rx->read_index != uart->int_rx->save_index)
+ {
+ *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index];
+ size --;
+
+ /* disable interrupt */
+ level = rt_hw_interrupt_disable();
+
+ uart->int_rx->read_index ++;
+ if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE)
+ uart->int_rx->read_index = 0;
+
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+ }
+ else
+ {
+ /* set error code */
+ err_code = -RT_EEMPTY;
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* polling mode */
+ while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size)
+ {
+ while (0UL != Cy_SCB_UART_GetNumInRxFifo(uart->scb_device))
+ {
+ *ptr = Cy_SCB_UART_Get(uart->scb_device);
+ ptr ++;
+ }
+ }
+ }
+
+ /* set error code */
+ rt_set_errno(err_code);
+ return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
+}
+
+static rt_size_t rt_uart_write (rt_device_t dev, rt_off_t pos,
+ const void* buffer, rt_size_t size)
+{
+ rt_uint8_t* ptr;
+ rt_err_t err_code;
+ struct uart_device* uart;
+ pos = pos;
+
+ err_code = RT_EOK;
+ ptr = (rt_uint8_t*)buffer;
+ uart = (struct uart_device*)dev->user_data;
+
+ if (dev->flag & RT_DEVICE_FLAG_INT_TX)
+ {
+ /* interrupt mode Tx */
+ while (uart->int_tx->save_index != uart->int_tx->write_index)
+ {
+ /* save on tx buffer */
+ uart->int_tx->tx_buffer[uart->int_tx->save_index] = *ptr++;
+
+ -- size;
+
+ /* move to next position */
+ uart->int_tx->save_index ++;
+
+ /* wrap save index */
+ if (uart->int_tx->save_index >= UART_TX_BUFFER_SIZE)
+ uart->int_tx->save_index = 0;
+ }
+
+ /* set error code */
+ if (size > 0)
+ err_code = -RT_EFULL;
+ }
+ else
+ {
+ /* polling mode */
+ while (size)
+ {
+ /*
+ * to be polite with serial console add a line feed
+ * to the carriage return character
+ */
+ if (*ptr == '\n' && (dev->flag & RT_DEVICE_FLAG_STREAM))
+ {
+ while(0 == Cy_SCB_UART_Put(uart->scb_device, '\r'));
+ }
+ while(0 == Cy_SCB_UART_Put(uart->scb_device, (*ptr & 0x1FF)));
+
+ ++ptr;
+ --size;
+ }
+ }
+
+ /* set error code */
+ rt_set_errno(err_code);
+
+ return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
+}
+
+static rt_err_t rt_uart_control (rt_device_t dev, int cmd, void *args)
+{
+ RT_ASSERT(dev != RT_NULL);
+ args = args;
+
+ switch (cmd)
+ {
+ case RT_DEVICE_CTRL_SUSPEND:
+ /* suspend device */
+ dev->flag |= RT_DEVICE_FLAG_SUSPENDED;
+ break;
+
+ case RT_DEVICE_CTRL_RESUME:
+ /* resume device */
+ dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED;
+ break;
+ }
+
+ return RT_EOK;
+}
+
+/*
+ * serial register
+ */
+rt_err_t rt_hw_uart_register(rt_device_t device, const char* name,
+ rt_uint32_t flag, struct uart_device *serial)
+{
+ RT_ASSERT(device != RT_NULL);
+
+ device->type = RT_Device_Class_Char;
+ device->rx_indicate = RT_NULL;
+ device->tx_complete = RT_NULL;
+ device->init = rt_uart_init;
+ device->open = rt_uart_open;
+ device->close = rt_uart_close;
+ device->read = rt_uart_read;
+ device->write = rt_uart_write;
+ device->control = rt_uart_control;
+ device->user_data = serial;
+
+ /* register a character device */
+ return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
+}
+
+/* ISR for uart interrupt */
+void rt_hw_uart_isr(rt_device_t device)
+{
+ struct uart_device* uart = (struct uart_device*) device->user_data;
+
+ /* interrupt mode receive */
+ RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX);
+
+ /* Check for "RX fifo not empty interrupt" */
+ if((uart->scb_device->INTR_RX_MASKED & SCB_INTR_RX_MASKED_NOT_EMPTY_Msk ) != 0)
+ {
+ /* Clear UART "RX fifo not empty interrupt" */
+ uart->scb_device->INTR_RX = uart->scb_device->INTR_RX & SCB_INTR_RX_NOT_EMPTY_Msk;
+ /* Get the character from terminal */
+ rt_uart_savechar(uart, Cy_SCB_UART_Get(uart->scb_device));
+ }
+
+ /* invoke callback */
+ if (device->rx_indicate != RT_NULL)
+ {
+ rt_size_t rx_length;
+
+ /* get rx length */
+ rx_length = uart->int_rx->read_index > uart->int_rx->save_index ?
+ UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index :
+ uart->int_rx->save_index - uart->int_rx->read_index;
+
+ device->rx_indicate(device, rx_length);
+ }
+}
+
+#ifdef RT_USING_UART0
+/* UART0 device driver structure */
+#define UART0_SCB_IRQ__INTC_NUMBER 46u
+cy_stc_scb_uart_context_t UART0_context;
+const cy_stc_sysint_t UART0_SCB_IRQ_cfg =
+{
+ .intrSrc = scb_5_interrupt_IRQn,
+ .intrPriority = 3u,
+};
+
+/* UART0 device driver structure */
+struct uart_int_rx uart0_int_rx;
+struct uart_device uart0 =
+{
+ UART0_HW,
+ &UART0_config,
+ &UART0_context,
+ &UART0_SCB_IRQ_cfg,
+ (IRQn_Type)UART0_SCB_IRQ__INTC_NUMBER,
+ (IRQn_Type)UART0_SCB_IRQ__INTC_NUMBER,
+ &uart0_int_rx,
+ RT_NULL
+};
+struct rt_device uart0_device;
+/* UART0 Interrupt Hanlder */
+void uart0_isr_callback(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+ rt_hw_uart_isr(&uart0_device);
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+#endif
+
+
+void rt_hw_uart_init(void)
+{
+ /* Start UART operation. */
+ if(Cy_SCB_UART_Init(uart0.scb_device, uart0.uart_config, uart0.uart_context) != CY_SCB_UART_SUCCESS)
+ {
+ rt_assert_handler("UART0 init", __FUNCTION__, __LINE__);
+ }
+ Cy_SCB_UART_Enable(uart0.scb_device);
+ /* Unmasking only the RX fifo not empty interrupt bit */
+ uart0.scb_device->INTR_RX_MASK = SCB_INTR_RX_MASK_NOT_EMPTY_Msk;
+ /* Interrupt Settings for UART */
+ Cy_SysInt_Init(uart0.uart_int, uart0_isr_callback);
+ /* Enable the interrupt */
+ NVIC_EnableIRQ(uart0.uart_int->intrSrc);
+ /* register UART0 device */
+ rt_hw_uart_register(&uart0_device,
+ "uart0",
+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
+ &uart0);
+
+}
+
+/*@}*/
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/drivers/uart.h b/bsp/cypress/psoc6-pioneerkit_modus/drivers/uart.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a2c6dd3bf3129734828d930db70d102470aaf9d
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/drivers/uart.h
@@ -0,0 +1,50 @@
+
+#ifndef __UART_H__
+#define __UART_H__
+
+#include
+#include
+#include "cy_device_headers.h"
+#include "board.h"
+#include "cy_pdl.h"
+
+#define UART_RX_BUFFER_SIZE 128u
+#define UART_TX_BUFFER_SIZE 128u
+
+#define UART_ENABLE_IRQ(n) NVIC_EnableIRQ((n))
+#define UART_DISABLE_IRQ(n) NVIC_DisableIRQ((n))
+
+struct uart_int_rx
+{
+ rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE];
+ rt_uint32_t read_index, save_index;
+};
+
+struct uart_int_tx
+{
+ rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE];
+ rt_uint32_t write_index, save_index;
+};
+
+struct uart_device
+{
+ CySCB_Type* scb_device;
+ /* uart config */
+ cy_stc_scb_uart_config_t const *uart_config;
+ /* uart context */
+ cy_stc_scb_uart_context_t *uart_context;
+ /* uart interrupt */
+ const cy_stc_sysint_t *uart_int;
+ /* irq number */
+ IRQn_Type rx_irq;
+ IRQn_Type tx_irq;
+
+ /* rx structure */
+ struct uart_int_rx* int_rx;
+ /* tx structure */
+ struct uart_int_tx* int_tx;
+};
+
+void rt_hw_uart_init(void);
+
+#endif
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE.lib b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE.lib
new file mode 100644
index 0000000000000000000000000000000000000000..e144e75a2aaf70f5c3595e42dfd3179527421285
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE.lib
@@ -0,0 +1 @@
+https://github.com/cypresssemiconductorco/TARGET_CY8CKIT-062-BLE/#latest-v1.X
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/cyreservedresources.list b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/cyreservedresources.list
new file mode 100644
index 0000000000000000000000000000000000000000..28210ff4663fd3b7bd99275b46b019b84c7ddfc0
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/cyreservedresources.list
@@ -0,0 +1,4 @@
+[Device=CY8C6347BZI-BLD53]
+
+[Blocks]
+# Nothing needs to be reserved for this device
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/design.cycapsense b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/design.cycapsense
new file mode 100644
index 0000000000000000000000000000000000000000..43d6108110ef1f589154c962d54deeef30fc7ac1
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/design.cycapsense
@@ -0,0 +1,409 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/design.cyqspi b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/design.cyqspi
new file mode 100644
index 0000000000000000000000000000000000000000..3c5fbe94fb8be83c8bd7a567161ece0a531a8f92
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/design.cyqspi
@@ -0,0 +1,63 @@
+
+
+
+ PSoC 6.xml
+
+
+ 0
+ S25FL512S-4byteaddr
+ true
+ None
+ 0x18000000
+ 0x4000000
+ 0x1BFFFFFF
+ true
+ false
+ QUAD_SPI_DATA_0_3
+ S25FL512S-4byteaddr
+ true
+
+
+ 1
+ Not used
+ false
+ None
+ 0x18010000
+ 0x10000
+ 0x1801FFFF
+ false
+ false
+ SPI_MOSI_MISO_DATA_0_1
+ default_memory.xml
+ true
+
+
+ 2
+ Not used
+ false
+ None
+ 0x18020000
+ 0x10000
+ 0x1802FFFF
+ false
+ false
+ SPI_MOSI_MISO_DATA_0_1
+ default_memory.xml
+ true
+
+
+ 3
+ Not used
+ false
+ None
+ 0x18030000
+ 0x10000
+ 0x1803FFFF
+ false
+ false
+ SPI_MOSI_MISO_DATA_0_1
+ default_memory.xml
+ true
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/design.modus b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/design.modus
new file mode 100644
index 0000000000000000000000000000000000000000..839d49276bd84d5a4b2d2f6e56e580d01d4444dd
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/COMPONENT_BSP_DESIGN_MODUS/design.modus
@@ -0,0 +1,288 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/CY8CKIT-062-BLE.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/CY8CKIT-062-BLE.mk
new file mode 100644
index 0000000000000000000000000000000000000000..520a7087fac102e2d99b7c2b1d4334daefdb82a7
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/CY8CKIT-062-BLE.mk
@@ -0,0 +1,37 @@
+################################################################################
+# \file CY8CKIT-062-BLE.mk
+# \version 1.0
+#
+# \brief
+# Define the CY8CKIT-062-BLE target.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+# MCU device selection
+DEVICE:=CY8C6347BZI-BLD53
+
+# Additional components supported by the target
+COMPONENTS+=CM0P_SLEEP BSP_DESIGN_MODUS
+
+# Use CyHAL
+DEFINES+=CY_USING_HAL
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/EULA b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/EULA
new file mode 100644
index 0000000000000000000000000000000000000000..f10c742b1023a8993a0a287d3afc221f20330147
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/EULA
@@ -0,0 +1,55 @@
+CYPRESS END USER LICENSE AGREEMENT
+
+PLEASE READ THIS END USER LICENSE AGREEMENT ("Agreement") CAREFULLY BEFORE DOWNLOADING, INSTALLING, COPYING, OR USING THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION. BY DOWNLOADING, INSTALLING, COPYING OR USING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, PROMPTLY RETURN AND DO NOT USE THE SOFTWARE. IF YOU HAVE PURCHASED THIS LICENSE TO THE SOFTWARE, YOUR RIGHT TO RETURN THE SOFTWARE EXPIRES 30 DAYS AFTER YOUR PURCHASE AND APPLIES ONLY TO THE ORIGINAL PURCHASER.
+
+1. Definitions.
+
+ "Software" means this software and any accompanying documentation, including any upgrades, updates, bug fixes or modified versions provided to you by Cypress.
+
+ "Source Code" means software in human-readable form.
+
+ "Binary Code" means the software in binary code form such as object code or an executable.
+
+ "Development Tools" means software that is intended to be installed on a personal computer and used to create programming code for Firmware, Drivers, or Host Applications. Examples of Development Tools are Cypress's PSoC Creator software, Cypress's WICED SDKs, and Cypress's ModusToolbox software.
+
+ "Firmware" means software that executes on a Cypress hardware product.
+
+ "Driver" means software that enables the use of a Cypress hardware product on a particular host operating system such as GNU/Linux, Windows, MacOS, Android, and iOS.
+
+ "Host Application" means software that executes on a device other than a Cypress hardware product in order to program, control, or communicate with a Cypress hardware product.
+
+ "inf File" means a hardware setup information file (.inf file) created by the Software to allow a Microsoft Windows operating system to install the driver for a Cypress hardware product.
+
+2. License. Subject to the terms and conditions of this Agreement, Cypress Semiconductor Corporation ("Cypress") and its suppliers grant to you a non-exclusive, non-transferable license under their copyright rights:
+
+ a. to use the Development Tools in object code form solely for the purpose of creating Firmware, Drivers, Host Applications, and inf Files for Cypress hardware products; and
+
+ b. (i) if provided in Source Code form, to copy, modify, and compile the Firmware Source Code to create Firmware for execution on a Cypress hardware product, and (ii) to distribute Firmware in binary code form only, only when installed onto a Cypress hardware product; and
+
+ c. (i) if provided in Source Code form, to copy, modify, and compile the Driver Source Code to create one or more Drivers to enable the use of a Cypress hardware product on a particular host operating system, and (ii) to distribute the Driver, in binary code form only, only when installed on a device that includes the Cypress hardware product that the Driver is intended to enable; and
+
+ d. (i) if provided in Source Code form, to copy, modify, and compile the Host Application Source Code to create one or more Host Applications to program, control, or communicate with a Cypress hardware product, and (ii) to distribute Host Applications, in binary code form only, only when installed on a device that includes a Cypress hardware product that the Host Application is intended to program, control, or communicate with; and
+
+ e. to freely distribute any inf File.
+
+Any distribution of Software permitted under this Agreement must be made pursuant to your standard end user license agreement used for your proprietary (closed source) software products, such end user license agreement to include, at a minimum, provisions limiting your licensors' liability and prohibiting reverse engineering of the Software, consistent with such provisions in this Agreement.
+
+3. Free and Open Source Software. Portions of the Software may be licensed under free and/or open source licenses such as the GNU General Public License or other licenses from third parties ("Third Party Software"). Third Party Software is subject to the applicable license agreement and not this Agreement. If you are entitled to receive the source code from Cypress for any Third Party Software included with the Software, either the source code will be included with the Software or you may obtain the source code at no charge from . The applicable license terms will accompany each source code package. To review the license terms applicable to any Third Party Software for which Cypress is not required to provide you with source code, please see the Software's installation directory on your computer.
+
+4. Proprietary Rights; Ownership. The Software, including all intellectual property rights therein, is and will remain the sole and exclusive property of Cypress or its suppliers. Cypress retains ownership of the Source Code and any compiled version thereof. Subject to Cypress' ownership of the underlying Software (including Source Code), you retain ownership of any modifications you make to the Source Code. You agree not to remove any Cypress copyright or other notices from the Source Code and any modifications thereof. You agree to keep the Source Code confidential. Any reproduction, modification, translation, compilation, or representation of the Source Code except as permitted in Section 2 ("License") is prohibited without the express written permission of Cypress. Except as otherwise expressly provided in this Agreement, you may not: (i) modify, adapt, or create derivative works based upon the Software; (ii) copy the Software; (iii) except and only to the extent explicitly permitted by applicable law despite this limitation, decompile, translate, reverse engineer, disassemble or otherwise reduce the Software to human-readable form; or (iv) use the Software or any sample code other than for the Purpose. You hereby covenant that you will not assert any claim that the Software, or derivative works thereof created by or for Cypress, infringe any intellectual property right owned or controlled by you
+
+5. No Support. Cypress may, but is not required to, provide technical support for the Software.
+
+6. Term and Termination. This Agreement is effective until terminated, and either party may terminate this Agreement at any time with or without cause. This Agreement and your license rights under this Agreement will terminate immediately without notice from Cypress if you fail to comply with any provision of this Agreement. Upon termination, you must destroy all copies of Software in your possession or control. The following paragraphs shall survive any termination of this Agreement: "Free and Open Source Software," "Proprietary Rights; Ownership," "Compliance With Law," "Disclaimer," "Limitation of Liability," and "General."
+
+7. Compliance With Law. Each party agrees to comply with all applicable laws, rules and regulations in connection with its activities under this Agreement. Without limiting the foregoing, the Software may be subject to export control laws and regulations of the United States and other countries. You agree to comply strictly with all such laws and regulations and acknowledge that you have the responsibility to obtain licenses to export, re-export, or import the Software.
+
+8. Disclaimer. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THE SOFTWARE, INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes to the Software without notice. Cypress does not assume any liability arising out of the application or use of Software or any product or circuit described in the Software. It is the responsibility of the user of the Software to properly design, program, and test the functionality and safety of any application made of the Software and any resulting product. Cypress does not authorize its Software or products for use in any products where a malfunction or failure of the Software or Cypress product may reasonably be expected to result in significant property damage, injury or death ("High Risk Product"). If you include any Software or Cypress product in a High Risk Product, you assume all risk of such use and agree to indemnify Cypress and its suppliers against all liability. No computing device can be absolutely secure. Therefore, despite security measures implemented in Cypress hardware or software products, Cypress does not assume any liability arising out of any security breach, such as unauthorized access to or use of a Cypress product.
+
+9. Limitation of Liability. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL CYPRESS OR ITS SUPPLIERS, RESELLERS, OR DISTRIBUTORS BE LIABLE FOR ANY LOST REVENUE, PROFIT, OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL, OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF CYPRESS OR ITS SUPPLIERS, RESELLERS, OR DISTRIBUTORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT SHALL CYPRESS' OR ITS SUPPLIERS', RESELLERS', OR DISTRIBUTORS' TOTAL LIABILITY TO YOU, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE, EXCEED THE GREATER OF US$500 OR THE PRICE PAID BY YOU FOR THE SOFTWARE. THE FOREGOING LIMITATIONS SHALL APPLY EVEN IF THE ABOVE-STATED WARRANTY FAILS OF ITS ESSENTIAL PURPOSE. BECAUSE SOME STATES OR JURISDICTIONS DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL OR INCIDENTAL DAMAGES, ALL OR PORTIONS OF THE ABOVE LIMITATION MAY NOT APPLY TO YOU.
+
+10. Restricted Rights. The Software is commercial computer software as that term is described in 48 C.F.R. 252.227-7014(a)(1). If the Software is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the Government's rights in Software shall be only those set forth in this Agreement.
+
+11. Personal Information. You agree that information you provide through your registration on Cypress IoT Community Forum or other Cypress websites, including contact information or other personal information, may be collected and used by Cypress consistent with its Data Privacy Policy (www.cypress.com/privacy-policy), as updated or revised from time to time, and may be provided to its third party sales representatives, distributors and other entities conducting sales activities for Cypress for sales-related and other business purposes.
+
+12. General. This Agreement will bind and inure to the benefit of each party's successors and assigns, provided that you may not assign or transfer this Agreement, in whole or in part, without Cypress' written consent. This Agreement shall be governed by and construed in accordance with the laws of the State of California, United States of America, as if performed wholly within the state and without giving effect to the principles of conflict of law. The parties consent to personal and exclusive jurisdiction of and venue in, the state and federal courts within Santa Clara County, California; provided however, that nothing in this Agreement will limit Cypress' right to bring legal action in any venue in order to protect or enforce its intellectual property rights. No failure of either party to exercise or enforce any of its rights under this Agreement will act as a waiver of such rights. If any portion of this Agreement is found to be void or unenforceable, the remaining provisions of this Agreement shall remain in full force and effect. This Agreement is the complete and exclusive agreement between the parties with respect to the subject matter hereof, superseding and replacing any and all prior agreements, communications, and understandings (both written and oral) regarding such subject matter. Any notice to Cypress will be deemed effective when actually received and must be sent to Cypress Semiconductor Corporation, ATTN: Chief Legal Officer, 198 Champion Court, San Jose, CA 95134 USA.
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/LICENSE b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..59cd3f8a320657c5748e85f7b247eb838f39acfb
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/LICENSE
@@ -0,0 +1,165 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright
+owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities
+that control, are controlled by, or are under common control with that entity.
+For the purposes of this definition, "control" means (i) the power, direct or
+indirect, to cause the direction or management of such entity, whether by
+contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
+outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including
+but not limited to software source code, documentation source, and configuration
+files.
+
+"Object" form shall mean any form resulting from mechanical transformation or
+translation of a Source form, including but not limited to compiled object code,
+generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made
+available under the License, as indicated by a copyright notice that is included
+in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that
+is based on (or derived from) the Work and for which the editorial revisions,
+annotations, elaborations, or other modifications represent, as a whole, an
+original work of authorship. For the purposes of this License, Derivative Works
+shall not include works that remain separable from, or merely link (or bind by
+name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version
+of the Work and any modifications or additions to that Work or Derivative Works
+thereof, that is intentionally submitted to Licensor for inclusion in the Work
+by the copyright owner or by an individual or Legal Entity authorized to submit
+on behalf of the copyright owner. For the purposes of this definition,
+"submitted" means any form of electronic, verbal, or written communication sent
+to the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control systems, and
+issue tracking systems that are managed by, or on behalf of, the Licensor for
+the purpose of discussing and improving the Work, but excluding communication
+that is conspicuously marked or otherwise designated in writing by the copyright
+owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
+of whom a Contribution has been received by Licensor and subsequently
+incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable (except as stated in this section) patent license to make, have
+made, use, offer to sell, sell, import, and otherwise transfer the Work, where
+such license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by combination
+of their Contribution(s) with the Work to which such Contribution(s) was
+submitted. If You institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work or a
+Contribution incorporated within the Work constitutes direct or contributory
+patent infringement, then any patent licenses granted to You under this License
+for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof
+in any medium, with or without modifications, and in Source or Object form,
+provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of
+this License; and
+You must cause any modified files to carry prominent notices stating that You
+changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute,
+all copyright, patent, trademark, and attribution notices from the Source form
+of the Work, excluding those notices that do not pertain to any part of the
+Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any
+Derivative Works that You distribute must include a readable copy of the
+attribution notices contained within such NOTICE file, excluding those notices
+that do not pertain to any part of the Derivative Works, in at least one of the
+following places: within a NOTICE text file distributed as part of the
+Derivative Works; within the Source form or documentation, if provided along
+with the Derivative Works; or, within a display generated by the Derivative
+Works, if and wherever such third-party notices normally appear. The contents of
+the NOTICE file are for informational purposes only and do not modify the
+License. You may add Your own attribution notices within Derivative Works that
+You distribute, alongside or as an addendum to the NOTICE text from the Work,
+provided that such additional attribution notices cannot be construed as
+modifying the License.
+You may add Your own copyright statement to Your modifications and may provide
+additional or different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works as a whole,
+provided Your use, reproduction, and distribution of the Work otherwise complies
+with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted
+for inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the terms of
+any separate license agreement you may have executed with Licensor regarding
+such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks,
+service marks, or product names of the Licensor, except as required for
+reasonable and customary use in describing the origin of the Work and
+reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the
+Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+including, without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
+solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise of
+permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence),
+contract, or otherwise, unless required by applicable law (such as deliberate
+and grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special, incidental,
+or consequential damages of any character arising as a result of this License or
+out of the use or inability to use the Work (including but not limited to
+damages for loss of goodwill, work stoppage, computer failure or malfunction, or
+any and all other commercial damages or losses), even if such Contributor has
+been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to
+offer, and charge a fee for, acceptance of support, warranty, indemnity, or
+other liability obligations and/or rights consistent with this License. However,
+in accepting such obligations, You may act only on Your own behalf and on Your
+sole responsibility, not on behalf of any other Contributor, and only if You
+agree to indemnify, defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason of your
+accepting any such warranty or additional liability.
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/README.md b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..36884311c740786dbf89f3cc3450abfb836dd2a6
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/README.md
@@ -0,0 +1,57 @@
+# CY8CKIT-062-BLE BSP
+
+## Overview
+
+The PSoC 6 BLE Pioneer Kit is a low-cost hardware platform that enables design and debug of the PSoC 63 Line (CY8C6347BZI-BLD53).
+
+
+To use code from the BSP, simply include a reference to `cybsp.h`.
+
+## Features
+
+### Kit Features:
+
+* BLE v5.0
+* Serial memory interface
+* PDM-PCM digital microphone interface
+* Industry-leading CapSense
+
+### Kit Contents:
+
+* CY8CKIT-062-BLE evaluation board
+* E-Ink display shield with an ultra-low-power 2.7" E-ink display, thermistor, 6-axis motion sensor, and digital microphone
+* USB cable
+
+## BSP Configuration
+
+### Clock Configuration
+
+| Clock | Source | Output Frequency |
+|----------|-----------|------------------|
+| CLK_HF0 | CLK_PATH0 | 100 MHz |
+| CLK_HF1 | CLK_PATH1 | 48 MHz |
+| CLK_HF2 | CLK_PATH0 | 50 MHz |
+| CLK_HF3 | CLK_PATH1 | 48 MHz |
+
+### Power Configuration
+
+* System Active Power Mode: LP
+* System Idle Power Mode: Deep Sleep
+* VDDA Voltage: 3300 mV
+* VDDD Voltage: 3300 mV
+
+## API Reference Manual
+
+The CY8CKIT-062-BLE Board Support Package provides a set of APIs to configure, initialize and use the board resources.
+
+See the [BSP API Reference Manual][api] for the complete list of the provided interfaces.
+
+## More information
+* [CY8CKIT-062-BLE BSP API Reference Manual][api]
+* [CY8CKIT-062-BLE Documentation](http://www.cypress.com/documentation/development-kitsboards/psoc-6-ble-pioneer-kit)
+* [Cypress Semiconductor](http://www.cypress.com)
+
+[api]: https://cypresssemiconductorco.github.io/TARGET_CY8CKIT-062-BLE/html/modules.html
+
+---
+© Cypress Semiconductor Corporation, 2019.
\ No newline at end of file
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/RELEASE.md b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/RELEASE.md
new file mode 100644
index 0000000000000000000000000000000000000000..2f6d7a9551ae5064adfe97ab99be01404e7d553f
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/RELEASE.md
@@ -0,0 +1,35 @@
+### CY8CKIT-062-BLE BSP
+The PSoC 6 BLE Pioneer Kit is a low-cost hardware platform that enables design and debug of the PSoC 63 Line (CY8C6347BZI-BLD53).
+
+### What's New In This Release?
+* Added pin references for the board's J2 Header
+
+### What's Included?
+The CY8CKIT-062-BLE library includes the following:
+* BSP specific makefile to configure the build process for the board
+* cybsp.c/h files to initialize the board and any system peripherals
+* cybsp_types.h file describing basic board setup
+* Linker script & startup code for GCC, IAR, ARM toolchains
+* Configurator design files (and generated code) to setup board specific peripherals
+* .lib file references for all dependent libraries
+* API documentation
+
+### Supported Software and Tools
+This version of the CY8CKIT-062-BLE BSP was validated for compatibility with the following Software and Tools:
+
+| Software and Tools | Version |
+| :--- | :----: |
+| ModusToolbox Software Environment | 2.0 |
+| GCC Compiler | 7.4 |
+| IAR Compiler | 8.32 |
+| ARM Compiler | 6.11 |
+
+### More information
+* [CY8CKIT-062-BLE BSP API Reference Manual][api]
+* [CY8CKIT-062-BLE Documentation](http://www.cypress.com/documentation/development-kitsboards/psoc-6-ble-pioneer-kit)
+* [Cypress Semiconductor](http://www.cypress.com)
+
+[api]: modules.html
+
+---
+© Cypress Semiconductor Corporation, 2019.
\ No newline at end of file
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/cybsp.c b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/cybsp.c
new file mode 100644
index 0000000000000000000000000000000000000000..30540962ab07dea262868333b2b0d60d1701d57f
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/cybsp.c
@@ -0,0 +1,124 @@
+/***************************************************************************//**
+* \file cybsp.c
+*
+* Description:
+* Provides initialization code for starting up the hardware contained on the
+* Cypress board.
+*
+********************************************************************************
+* \copyright
+* Copyright 2018-2019 Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed 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.
+*******************************************************************************/
+
+#include
+#include "cybsp.h"
+#if defined(CY_USING_HAL)
+#include "cyhal_hwmgr.h"
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* The sysclk deep sleep callback is recommended to be the last callback that
+* is executed before entry into deep sleep mode and the first one upon
+* exit the deep sleep mode.
+* Doing so minimizes the time spent on low power mode entry and exit.
+*/
+#ifndef CYBSP_SYSCLK_PM_CALLBACK_ORDER
+ #define CYBSP_SYSCLK_PM_CALLBACK_ORDER (255u)
+#endif
+
+#if defined(CYBSP_WIFI_CAPABLE) && defined(CY_USING_HAL)
+static cyhal_sdio_t sdio_obj;
+
+cyhal_sdio_t* cybsp_get_wifi_sdio_obj(void)
+{
+ return &sdio_obj;
+}
+#endif
+
+/**
+ * Registers a power management callback that prepares the clock system
+ * for entering deep sleep mode and restore the clocks upon wakeup from deep sleep.
+ * NOTE: This is called automatically as part of \ref cybsp_init
+ */
+static cy_rslt_t cybsp_register_sysclk_pm_callback(void)
+{
+ cy_rslt_t result = CY_RSLT_SUCCESS;
+ static cy_stc_syspm_callback_params_t cybsp_sysclk_pm_callback_param = {NULL, NULL};
+ static cy_stc_syspm_callback_t cybsp_sysclk_pm_callback = {
+ .callback = &Cy_SysClk_DeepSleepCallback,
+ .type = CY_SYSPM_DEEPSLEEP,
+ .callbackParams = &cybsp_sysclk_pm_callback_param,
+ .order = CYBSP_SYSCLK_PM_CALLBACK_ORDER
+ };
+
+ if (!Cy_SysPm_RegisterCallback(&cybsp_sysclk_pm_callback))
+ {
+ result = CYBSP_RSLT_ERR_SYSCLK_PM_CALLBACK;
+ }
+ return result;
+}
+
+cy_rslt_t cybsp_init(void)
+{
+ /* Setup hardware manager to track resource usage then initialize all system (clock/power) board configuration */
+#if defined(CY_USING_HAL)
+ cy_rslt_t result = cyhal_hwmgr_init();
+#else
+ cy_rslt_t result = CY_RSLT_SUCCESS;
+#endif
+
+ init_cycfg_all();
+
+ if (CY_RSLT_SUCCESS == result)
+ {
+ result = cybsp_register_sysclk_pm_callback();
+ }
+
+#if defined(CYBSP_WIFI_CAPABLE) && defined(CY_USING_HAL)
+ /* Initialize SDIO interface. This must be done before other HAL API calls as some SDIO implementations require
+ * specific peripheral instances.
+ * NOTE: The full WiFi interface still needs to be initialized via cybsp_wifi_init_primary(). This is typically
+ * done when starting up WiFi.
+ */
+ if (CY_RSLT_SUCCESS == result)
+ {
+ /* Reserves: CYBSP_WIFI_SDIO, CYBSP_WIFI_SDIO_D0, CYBSP_WIFI_SDIO_D1, CYBSP_WIFI_SDIO_D2, CYBSP_WIFI_SDIO_D3
+ * CYBSP_WIFI_SDIO_CMD and CYBSP_WIFI_SDIO_CLK.
+ */
+ result = cyhal_sdio_init(
+ &sdio_obj,
+ CYBSP_WIFI_SDIO_CMD,
+ CYBSP_WIFI_SDIO_CLK,
+ CYBSP_WIFI_SDIO_D0,
+ CYBSP_WIFI_SDIO_D1,
+ CYBSP_WIFI_SDIO_D2,
+ CYBSP_WIFI_SDIO_D3);
+ }
+#endif /* defined(CYBSP_WIFI_CAPABLE) */
+
+ /* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by
+ * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
+ * (cyreservedresources.list) to make sure no resources are reserved by both.
+ */
+ return result;
+}
+
+#if defined(__cplusplus)
+}
+#endif
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/cybsp.h b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/cybsp.h
new file mode 100644
index 0000000000000000000000000000000000000000..80ab3c2a1d804b8799323a228e70a022604c1805
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/cybsp.h
@@ -0,0 +1,74 @@
+/***************************************************************************//**
+* \file cybsp.h
+*
+* \brief
+* Basic API for setting up boards containing a Cypress MCU.
+*
+********************************************************************************
+* \copyright
+* Copyright 2018-2019 Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed 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.
+*******************************************************************************/
+
+#pragma once
+
+#include "cy_result.h"
+#include "cybsp_types.h"
+#include "cycfg.h"
+#if defined(CYBSP_WIFI_CAPABLE) && defined(CY_USING_HAL)
+#include "cyhal_sdio.h"
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/**
+* \addtogroup group_bsp_macros Macros
+* \{
+*/
+
+/** Failed to configure sysclk power management callback */
+#define CYBSP_RSLT_ERR_SYSCLK_PM_CALLBACK (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_BSP, 0))
+
+/** \} group_bsp_macros */
+
+/**
+* \addtogroup group_bsp_functions Functions
+* \{
+*/
+
+/**
+ * \brief Initialize all hardware on the board
+ * \returns CY_RSLT_SUCCESS if the board is sucessfully initialized, if there is
+ * a problem initializing any hardware it returns an error code specific
+ * to the hardware module that had a problem.
+ */
+cy_rslt_t cybsp_init(void);
+
+#if defined(CYBSP_WIFI_CAPABLE) && defined(CY_USING_HAL)
+/**
+ * \brief Get the initialized sdio object used for communicating with the WiFi Chip.
+ * \note This function should only be called after cybsp_init();
+ * \returns The initialized sdio object.
+ */
+cyhal_sdio_t* cybsp_get_wifi_sdio_obj(void);
+#endif /* defined(CYBSP_WIFI_CAPABLE) */
+
+/** \} group_bsp_functions */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/cybsp_types.h b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/cybsp_types.h
new file mode 100644
index 0000000000000000000000000000000000000000..89f543b1812ba9dae7b430a4fe1711a62589b2c4
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/cybsp_types.h
@@ -0,0 +1,279 @@
+/***************************************************************************//**
+* \file CY8CKIT-062-BLE/cybsp_types.h
+*
+* Description:
+* Provides APIs for interacting with the hardware contained on the Cypress
+* CY8CKIT-062-BLE pioneer kit.
+*
+********************************************************************************
+* \copyright
+* Copyright 2018-2019 Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed 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.
+*******************************************************************************/
+
+#pragma once
+
+#if defined(CY_USING_HAL)
+#include "cyhal_pin_package.h"
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/**
+* \addtogroup group_bsp_settings BSP Settings
+* \{
+*
+* Peripheral Default HAL Settings:
+* | Resource | Parameter | Value | Remarks |
+* | :------: | :-------: | :---: | :------ |
+* | ADC | VREF | 1.2 V | |
+* | ^ | Measurement type | Single Ended | |
+* | ^ | Input voltage range | 0 to 2.4 V (0 to 2*VREF) | |
+* | ^ | Output range | 0x000 to 0x7FF | |
+* | DAC | Reference source | VDDA | |
+* | ^ | Input range | 0x000 to 0xFFF | |
+* | ^ | Output range | 0 to VDDA | |
+* | ^ | Output type | Unbuffered output | |
+* | I2C | Role | Master | Configurable to slave mode through HAL function |
+* | ^ | Data rate | 100 kbps | Configurable through HAL function |
+* | ^ | Drive mode of SCL & SDA pins | Open Drain (drives low) | External pull-up resistors are required |
+* | LpTimer | Uses WCO (32.768 kHz) as clock source & MCWDT as counter. 1 count = 1/32768 second or 32768 counts = 1 second. |||
+* | SPI | Data rate | 100 kpbs | Configurable through HAL function |
+* | ^ | Slave select polarity | Active low | |
+* | UART | Flow control | No flow control | Configurable through HAL function |
+* | ^ | Data format | 8N1 | Configurable through HAL function |
+* | ^ | Baud rate | 115200 | Configurable through HAL function |
+*/
+/** \} group_bsp_settings */
+
+/**
+* \addtogroup group_bsp_pin_state Pin States
+* \{
+*/
+
+/** Pin state for the LED on. */
+#define CYBSP_LED_STATE_ON (0U)
+/** Pin state for the LED off. */
+#define CYBSP_LED_STATE_OFF (1U)
+
+/** Pin state for when a button is pressed. */
+#define CYBSP_BTN_PRESSED (0U)
+/** Pin state for when a button is released. */
+#define CYBSP_BTN_OFF (1U)
+
+/** \} group_bsp_pin_state */
+
+#if defined(CY_USING_HAL)
+
+/**
+* \addtogroup group_bsp_pins Pin Mappings
+* \{
+*/
+
+/**
+* \addtogroup group_bsp_pins_led LED Pins
+* \{
+*/
+
+/** LED 8; User LED1 */
+#define CYBSP_LED8 (P1_5)
+/** LED 9; User LED2 */
+#define CYBSP_LED9 (P13_7)
+/** LED 5: RGB LED - Red; User LED3 */
+#define CYBSP_LED_RGB_RED (P0_3)
+/** LED 5: RGB LED - Green; User LED4 */
+#define CYBSP_LED_RGB_GREEN (P1_1)
+/** LED 5: RGB LED - Blue; User LED5 */
+#define CYBSP_LED_RGB_BLUE (P11_1)
+
+/** LED 8; User LED1 */
+#define CYBSP_USER_LED1 (CYBSP_LED8)
+/** LED 9; User LED2 */
+#define CYBSP_USER_LED2 (CYBSP_LED9)
+/** LED 5: RGB LED - Red; User LED3 */
+#define CYBSP_USER_LED3 (CYBSP_LED_RGB_RED)
+/** LED 5: RGB LED - Green; User LED4 */
+#define CYBSP_USER_LED4 (CYBSP_LED_RGB_GREEN)
+/** LED 5: RGB LED - Blue; User LED5 */
+#define CYBSP_USER_LED5 (CYBSP_LED_RGB_BLUE)
+/** LED 8; User LED1 */
+#define CYBSP_USER_LED (CYBSP_USER_LED1)
+
+/** \} group_bsp_pins_led */
+
+/**
+* \addtogroup group_bsp_pins_btn Button Pins
+* \{
+*/
+
+/** Switch 2; User Button 1 */
+#define CYBSP_SW2 (P0_4)
+
+/** Switch 2; User Button 1 */
+#define CYBSP_USER_BTN1 (CYBSP_SW2)
+/** Switch 2; User Button 1 */
+#define CYBSP_USER_BTN (CYBSP_USER_BTN1)
+
+/** \} group_bsp_pins_btn */
+
+
+/**
+* \addtogroup group_bsp_pins_comm Communication Pins
+* \{
+*/
+
+/** Pin: UART RX */
+#define CYBSP_DEBUG_UART_RX (P5_0)
+/** Pin: UART TX */
+#define CYBSP_DEBUG_UART_TX (P5_1)
+
+/** Pin: I2C SCL */
+#define CYBSP_I2C_SCL (P6_0)
+/** Pin: I2C SDA */
+#define CYBSP_I2C_SDA (P6_1)
+
+/** Pin: SWO */
+#define CYBSP_SWO (P6_4)
+/** Pin: SWDIO */
+#define CYBSP_SWDIO (P6_6)
+/** Pin: SWDCK */
+#define CYBSP_SWDCK (P6_7)
+
+/** Pin: QUAD SPI SS */
+#define CYBSP_QSPI_SS (P11_2)
+/** Pin: QUAD SPI D3 */
+#define CYBSP_QSPI_D3 (P11_3)
+/** Pin: QUAD SPI D2 */
+#define CYBSP_QSPI_D2 (P11_4)
+/** Pin: QUAD SPI D1 */
+#define CYBSP_QSPI_D1 (P11_5)
+/** Pin: QUAD SPI D0 */
+#define CYBSP_QSPI_D0 (P11_6)
+/** Pin: QUAD SPI SCK */
+#define CYBSP_QSPI_SCK (P11_7)
+
+/** \} group_bsp_pins_comm */
+
+
+/**
+* \addtogroup group_bsp_pins_arduino Arduino Header Pins
+* \{
+*/
+
+/** Arduino A0 */
+#define CYBSP_A0 (P10_0)
+/** Arduino A1 */
+#define CYBSP_A1 (P10_1)
+/** Arduino A2 */
+#define CYBSP_A2 (P10_2)
+/** Arduino A3 */
+#define CYBSP_A3 (P10_3)
+/** Arduino A4 */
+#define CYBSP_A4 (P10_4)
+/** Arduino A5 */
+#define CYBSP_A5 (P10_5)
+/** Arduino D0 */
+#define CYBSP_D0 (P5_0)
+/** Arduino D1 */
+#define CYBSP_D1 (P5_1)
+/** Arduino D2 */
+#define CYBSP_D2 (P5_2)
+/** Arduino D3 */
+#define CYBSP_D3 (P5_3)
+/** Arduino D4 */
+#define CYBSP_D4 (P5_4)
+/** Arduino D5 */
+#define CYBSP_D5 (P5_5)
+/** Arduino D6 */
+#define CYBSP_D6 (P5_6)
+/** Arduino D7 */
+#define CYBSP_D7 (P0_2)
+/** Arduino D8 */
+#define CYBSP_D8 (P13_0)
+/** Arduino D9 */
+#define CYBSP_D9 (P13_1)
+/** Arduino D10 */
+#define CYBSP_D10 (P12_3)
+/** Arduino D11 */
+#define CYBSP_D11 (P12_0)
+/** Arduino D12 */
+#define CYBSP_D12 (P12_1)
+/** Arduino D13 */
+#define CYBSP_D13 (P12_2)
+/** Arduino D14 */
+#define CYBSP_D14 (P6_1)
+/** Arduino D15 */
+#define CYBSP_D15 (P6_0)
+
+/** \} group_bsp_pins_arduino */
+
+
+/**
+* \addtogroup group_bsp_pins_j2 J2 Header Pins
+* \{
+*/
+
+/** Cypress J2 Header pin 1 */
+#define CYBSP_J2_1 (CYBSP_A0)
+/** Cypress J2 Header pin 2 */
+#define CYBSP_J2_2 (P9_0)
+/** Cypress J2 Header pin 3 */
+#define CYBSP_J2_3 (CYBSP_A1)
+/** Cypress J2 Header pin 4 */
+#define CYBSP_J2_4 (P9_1)
+/** Cypress J2 Header pin 5 */
+#define CYBSP_J2_5 (CYBSP_A2)
+/** Cypress J2 Header pin 6 */
+#define CYBSP_J2_6 (P9_2)
+/** Cypress J2 Header pin 7 */
+#define CYBSP_J2_7 (CYBSP_A3)
+/** Cypress J2 Header pin 8 */
+#define CYBSP_J2_8 (P9_3)
+/** Cypress J2 Header pin 9 */
+#define CYBSP_J2_9 (CYBSP_A4)
+/** Cypress J2 Header pin 10 */
+#define CYBSP_J2_10 (P9_4)
+/** Cypress J2 Header pin 11 */
+#define CYBSP_J2_11 (CYBSP_A5)
+/** Cypress J2 Header pin 12 */
+#define CYBSP_J2_12 (P9_5)
+/** Cypress J2 Header pin 13 */
+#define CYBSP_J2_13 (P10_6)
+/** Cypress J2 Header pin 14 */
+#define CYBSP_J2_14 (NC)
+/** Cypress J2 Header pin 15 */
+#define CYBSP_J2_15 (P6_2)
+/** Cypress J2 Header pin 16 */
+#define CYBSP_J2_16 (P9_6)
+/** Cypress J2 Header pin 17 */
+#define CYBSP_J2_17 (P6_3)
+/** Cypress J2 Header pin 18 */
+#define CYBSP_J2_18 (P9_7)
+/** Cypress J2 Header pin 19 */
+#define CYBSP_J2_19 (P13_6)
+/** Cypress J2 Header pin 20 */
+#define CYBSP_J2_20 (P13_7)
+
+/** \} group_bsp_pins_j2 */
+
+/** \} group_bsp_pins */
+
+#endif /* defined(CY_USING_HAL) */
+
+#if defined(__cplusplus)
+}
+#endif
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_ARM/cy8c6xx7_cm4_dual.sct b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_ARM/cy8c6xx7_cm4_dual.sct
new file mode 100644
index 0000000000000000000000000000000000000000..5af1eb206720af5358ae0010495d52c7c927df7f
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_ARM/cy8c6xx7_cm4_dual.sct
@@ -0,0 +1,274 @@
+#! armclang -E --target=arm-arm-none-eabi -x c -mcpu=cortex-m4
+; The first line specifies a preprocessor command that the linker invokes
+; to pass a scatter file through a C preprocessor.
+
+;*******************************************************************************
+;* \file cy8c6xx7_cm4_dual.sct
+;* \version 2.60
+;*
+;* Linker file for the ARMCC.
+;*
+;* The main purpose of the linker script is to describe how the sections in the
+;* input files should be mapped into the output file, and to control the memory
+;* layout of the output file.
+;*
+;* \note The entry point location is fixed and starts at 0x10000000. The valid
+;* application image should be placed there.
+;*
+;* \note The linker files included with the PDL template projects must be
+;* generic and handle all common use cases. Your project may not use every
+;* section defined in the linker files. In that case you may see the warnings
+;* during the build process: L6314W (no section matches pattern) and/or L6329W
+;* (pattern only matches removed unused sections). In your project, you can
+;* suppress the warning by passing the "--diag_suppress=L6314W,L6329W" option to
+;* the linker, simply comment out or remove the relevant code in the linker
+;* file.
+;*
+;*******************************************************************************
+;* \copyright
+;* Copyright 2016-2019 Cypress Semiconductor Corporation
+;* SPDX-License-Identifier: Apache-2.0
+;*
+;* Licensed 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.
+;******************************************************************************/
+
+; The defines below describe the location and size of blocks of memory in the target.
+; Use these defines to specify the memory regions available for allocation.
+
+; The following defines control RAM and flash memory allocation for the CM4 core.
+; You can change the memory allocation by editing RAM and Flash defines.
+; Note that 2 KB of RAM (at the end of the SRAM) are reserved for system use.
+; Using this memory region for other purposes will lead to unexpected behavior.
+; Your changes must be aligned with the corresponding defines for CM0+ core in 'xx_cm0plus.scat',
+; where 'xx' is the device group; for example, 'cy8c6xx7_cm0plus.scat'.
+; RAM
+#define RAM_START 0x08002000
+#define RAM_SIZE 0x00045800
+; Flash
+#define FLASH_START 0x10000000
+#define FLASH_SIZE 0x00100000
+
+; Size of the stack section at the end of CM4 SRAM
+#define STACK_SIZE 0x00001000
+
+; Size of the Cortex-M0+ application flash image
+#define FLASH_CM0P_SIZE 0x2000
+
+; The following defines describe a 32K flash region used for EEPROM emulation.
+; This region can also be used as the general purpose flash.
+; You can assign sections to this memory region for only one of the cores.
+; Note some middleware (e.g. BLE, Emulated EEPROM) can place their data into this memory region.
+; Therefore, repurposing this memory region will prevent such middleware from operation.
+#define EM_EEPROM_START 0x14000000
+#define EM_EEPROM_SIZE 0x8000
+
+; The following defines describe device specific memory regions and must not be changed.
+; Supervisory flash: User data
+#define SFLASH_USER_DATA_START 0x16000800
+#define SFLASH_USER_DATA_SIZE 0x00000800
+
+; Supervisory flash: Normal Access Restrictions (NAR)
+#define SFLASH_NAR_START 0x16001A00
+#define SFLASH_NAR_SIZE 0x00000200
+
+; Supervisory flash: Public Key
+#define SFLASH_PUBLIC_KEY_START 0x16005A00
+#define SFLASH_PUBLIC_KEY_SIZE 0x00000C00
+
+; Supervisory flash: Table of Content # 2
+#define SFLASH_TOC_2_START 0x16007C00
+#define SFLASH_TOC_2_SIZE 0x00000200
+
+; Supervisory flash: Table of Content # 2 Copy
+#define SFLASH_RTOC_2_START 0x16007E00
+#define SFLASH_RTOC_2_SIZE 0x00000200
+
+; External memory
+#define XIP_START 0x18000000
+#define XIP_SIZE 0x08000000
+
+; eFuse
+#define EFUSE_START 0x90700000
+#define EFUSE_SIZE 0x100000
+
+
+; Cortex-M0+ application flash image area
+LR_IROM FLASH_START FLASH_CM0P_SIZE
+{
+ .cy_m0p_image +0 FLASH_CM0P_SIZE
+ {
+ * (.cy_m0p_image)
+ }
+}
+
+; Cortex-M4 application flash area
+LR_IROM1 (FLASH_START + FLASH_CM0P_SIZE) (FLASH_SIZE - FLASH_CM0P_SIZE)
+{
+ ER_FLASH_VECTORS +0
+ {
+ * (RESET, +FIRST)
+ }
+
+ ER_FLASH_CODE +0 FIXED
+ {
+ * (InRoot$$Sections)
+ * (+RO)
+ }
+
+ ER_RAM_VECTORS RAM_START UNINIT
+ {
+ * (RESET_RAM, +FIRST)
+ }
+
+ RW_RAM_DATA +0
+ {
+ * (.cy_ramfunc)
+ * (+RW, +ZI)
+ }
+
+ ; Place variables in the section that should not be initialized during the
+ ; device startup.
+ RW_IRAM1 +0 UNINIT
+ {
+ * (.noinit)
+ }
+
+ ; Application heap area (HEAP)
+ ARM_LIB_HEAP +0 EMPTY ((RAM_START+RAM_SIZE)-AlignExpr(ImageLimit(RW_IRAM1), 8)-STACK_SIZE)
+ {
+ }
+
+ ; Stack region growing down
+ ARM_LIB_STACK (RAM_START+RAM_SIZE) EMPTY -STACK_SIZE
+ {
+ }
+
+ ; Used for the digital signature of the secure application and the
+ ; Bootloader SDK application. The size of the section depends on the required
+ ; data size.
+ .cy_app_signature (FLASH_START + FLASH_SIZE - 256) 256
+ {
+ * (.cy_app_signature)
+ }
+}
+
+
+; Emulated EEPROM Flash area
+LR_EM_EEPROM EM_EEPROM_START EM_EEPROM_SIZE
+{
+ .cy_em_eeprom +0
+ {
+ * (.cy_em_eeprom)
+ }
+}
+
+; Supervisory flash: User data
+LR_SFLASH_USER_DATA SFLASH_USER_DATA_START SFLASH_USER_DATA_SIZE
+{
+ .cy_sflash_user_data +0
+ {
+ * (.cy_sflash_user_data)
+ }
+}
+
+; Supervisory flash: Normal Access Restrictions (NAR)
+LR_SFLASH_NAR SFLASH_NAR_START SFLASH_NAR_SIZE
+{
+ .cy_sflash_nar +0
+ {
+ * (.cy_sflash_nar)
+ }
+}
+
+; Supervisory flash: Public Key
+LR_SFLASH_PUBLIC_KEY SFLASH_PUBLIC_KEY_START SFLASH_PUBLIC_KEY_SIZE
+{
+ .cy_sflash_public_key +0
+ {
+ * (.cy_sflash_public_key)
+ }
+}
+
+; Supervisory flash: Table of Content # 2
+LR_SFLASH_TOC_2 SFLASH_TOC_2_START SFLASH_TOC_2_SIZE
+{
+ .cy_toc_part2 +0
+ {
+ * (.cy_toc_part2)
+ }
+}
+
+; Supervisory flash: Table of Content # 2 Copy
+LR_SFLASH_RTOC_2 SFLASH_RTOC_2_START SFLASH_RTOC_2_SIZE
+{
+ .cy_rtoc_part2 +0
+ {
+ * (.cy_rtoc_part2)
+ }
+}
+
+
+; Places the code in the Execute in Place (XIP) section. See the smif driver documentation for details.
+LR_EROM XIP_START XIP_SIZE
+{
+ .cy_xip +0
+ {
+ * (.cy_xip)
+ }
+}
+
+
+; eFuse
+LR_EFUSE EFUSE_START EFUSE_SIZE
+{
+ .cy_efuse +0
+ {
+ * (.cy_efuse)
+ }
+}
+
+
+; The section is used for additional metadata (silicon revision, Silicon/JTAG ID, etc.) storage.
+CYMETA 0x90500000
+{
+ .cymeta +0 { * (.cymeta) }
+}
+
+/* The following symbols used by the cymcuelftool. */
+/* Flash */
+#define __cy_memory_0_start 0x10000000
+#define __cy_memory_0_length 0x00100000
+#define __cy_memory_0_row_size 0x200
+
+/* Emulated EEPROM Flash area */
+#define __cy_memory_1_start 0x14000000
+#define __cy_memory_1_length 0x8000
+#define __cy_memory_1_row_size 0x200
+
+/* Supervisory Flash */
+#define __cy_memory_2_start 0x16000000
+#define __cy_memory_2_length 0x8000
+#define __cy_memory_2_row_size 0x200
+
+/* XIP */
+#define __cy_memory_3_start 0x18000000
+#define __cy_memory_3_length 0x08000000
+#define __cy_memory_3_row_size 0x200
+
+/* eFuse */
+#define __cy_memory_4_start 0x90700000
+#define __cy_memory_4_length 0x100000
+#define __cy_memory_4_row_size 1
+
+
+/* [] END OF FILE */
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_A_Clang/cy8c6xx7_cm4_dual.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_A_Clang/cy8c6xx7_cm4_dual.mk
new file mode 100644
index 0000000000000000000000000000000000000000..212b141d2c3ef45ebc8d524e0550816d5f797e0b
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_A_Clang/cy8c6xx7_cm4_dual.mk
@@ -0,0 +1,85 @@
+################################################################################
+# \file cy8c6xx7_cm4_dual.mk
+# \version 2.60
+#
+# \brief
+# Specifies the starting address and the size of the segments in the output
+# file.
+#
+# \note The section definitions in this file are generic and handle all common
+# use cases.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+### CM0P ###
+export HEAP_SIZE_CM0P := 0x400
+export VECT_BASE_CM0P := 0x10000000
+export RAM_VECT_BASE_CM0P := 0x08000000
+export VECT_SIZE_CM0P := 0x000000C0
+export TEXT_BASE_CM0P := 0x100000C0
+export TEXT_SIZE_CM0P := 0x00002000
+export RAM_BASE_CM0P := 0x080000C0
+export RAM_SIZE_CM0P := 0x00002000
+export CYMETA_BASE_CM0P := 0x90500000
+export STACK_SIZE_CM0P := 0x2000
+
+STACK_ADDRESS_TOP_CM0P := $(shell printf "0x%x" $$(($(RAM_VECT_BASE_CM0P) + $(RAM_SIZE_CM0P))))
+STACK_ADDRESS_BOTTOM_CM0P := $(shell printf "0x%x" $$(($(STACK_ADDRESS_TOP_CM0P) - $(STACK_SIZE_CM0P))))
+TOOLCHAIN_VECT_BASE_CM0 := $(VECT_BASE_CM0P)
+
+SECTIONS_CM0P := \
+ -segaddr __VECT $(VECT_BASE_CM0P) \
+ -segaddr __TEXT $(TEXT_BASE_CM0P) \
+ -segaddr __DATA $(RAM_BASE_CM0P) \
+ -segaddr __RAMVECTORS $(RAM_VECT_BASE_CM0P) \
+ -segaddr __CYMETA $(CYMETA_BASE_CM0P) \
+ -segaddr __STACK $(STACK_ADDRESS_TOP_CM0P)
+
+### CM4 ###
+export HEAP_SIZE_CM4 := 0x400
+export VECT_BASE_CM4 := 0x10002000
+export RAM_VECT_BASE_CM4 := 0x08002000
+export VECT_SIZE_CM4 := 0x0000028C
+export TEXT_BASE_CM4 := 0x1000228C
+export TEXT_SIZE_CM4 := 0x000FE000
+export RAM_BASE_CM4 := 0x0800228C
+export RAM_SIZE_CM4 := 0x00045800
+export CYMETA_BASE_CM4 := 0x90500000
+export STACK_SIZE_CM4 := 0x2000
+STACK_ADDRESS_TOP_CM4 := $(shell printf "0x%x" $$(($(RAM_VECT_BASE_CM4) + $(RAM_SIZE_CM4))))
+STACK_ADDRESS_BOTTOM_CM4 := $(shell printf "0x%x" $$(($(STACK_ADDRESS_TOP_CM4) - $(STACK_SIZE_CM4))))
+TOOLCHAIN_VECT_BASE_CM4 := $(VECT_BASE_CM4)
+
+SECTIONS_CM4 := \
+ -segaddr __CY_M0P_IMAGE $(VECT_BASE_CM0P) \
+ -segaddr __VECT $(VECT_BASE_CM4) \
+ -segaddr __TEXT $(TEXT_BASE_CM4) \
+ -segaddr __DATA $(RAM_BASE_CM4) \
+ -segaddr __RAMVECTORS $(RAM_VECT_BASE_CM4) \
+ -segaddr __CYMETA $(CYMETA_BASE_CM4) \
+ -segaddr __STACK $(STACK_ADDRESS_TOP_CM4)
+
+# Pass section addresses to the linker
+ifeq ($(CORE),CM4)
+LDFLAGS += $(SECTIONS_CM4)
+else ifeq ($(CORE),CM0P)
+LDFLAGS += $(SECTIONS_CM0P)
+endif
+
+# EOF
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_GCC_ARM/cy8c6xx7_cm4_dual.ld b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_GCC_ARM/cy8c6xx7_cm4_dual.ld
new file mode 100644
index 0000000000000000000000000000000000000000..012a379e70269854ad46d8517e8dc3a82b59c647
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_GCC_ARM/cy8c6xx7_cm4_dual.ld
@@ -0,0 +1,459 @@
+/***************************************************************************//**
+* \file cy8c6xx7_cm4_dual.ld
+* \version 2.60
+*
+* Linker file for the GNU C compiler.
+*
+* The main purpose of the linker script is to describe how the sections in the
+* input files should be mapped into the output file, and to control the memory
+* layout of the output file.
+*
+* \note The entry point location is fixed and starts at 0x10000000. The valid
+* application image should be placed there.
+*
+* \note The linker files included with the PDL template projects must be generic
+* and handle all common use cases. Your project may not use every section
+* defined in the linker files. In that case you may see warnings during the
+* build process. In your project, you can simply comment out or remove the
+* relevant code in the linker file.
+*
+********************************************************************************
+* \copyright
+* Copyright 2016-2019 Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed 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.
+*******************************************************************************/
+
+OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
+SEARCH_DIR(.)
+GROUP(-lgcc -lc -lnosys)
+ENTRY(Reset_Handler)
+
+/* Size of the stack section at the end of CM4 SRAM */
+STACK_SIZE = 0x1000;
+
+/* Size of the Cortex-M0+ application image at the start of FLASH */
+FLASH_CM0P_SIZE = 0x2000;
+
+/* Force symbol to be entered in the output file as an undefined symbol. Doing
+* this may, for example, trigger linking of additional modules from standard
+* libraries. You may list several symbols for each EXTERN, and you may use
+* EXTERN multiple times. This command has the same effect as the -u command-line
+* option.
+*/
+EXTERN(Reset_Handler)
+
+/* The MEMORY section below describes the location and size of blocks of memory in the target.
+* Use this section to specify the memory regions available for allocation.
+*/
+MEMORY
+{
+ /* The ram and flash regions control RAM and flash memory allocation for the CM4 core.
+ * You can change the memory allocation by editing the 'ram' and 'flash' regions.
+ * Note that 2 KB of RAM (at the end of the SRAM) are reserved for system use.
+ * Using this memory region for other purposes will lead to unexpected behavior.
+ * Your changes must be aligned with the corresponding memory regions for CM0+ core in 'xx_cm0plus.ld',
+ * where 'xx' is the device group; for example, 'cy8c6xx7_cm0plus.ld'.
+ */
+ ram (rwx) : ORIGIN = 0x08002000, LENGTH = 0x45800
+ flash (rx) : ORIGIN = 0x10000000, LENGTH = 0x100000
+
+ /* This is a 32K flash region used for EEPROM emulation. This region can also be used as the general purpose flash.
+ * You can assign sections to this memory region for only one of the cores.
+ * Note some middleware (e.g. BLE, Emulated EEPROM) can place their data into this memory region.
+ * Therefore, repurposing this memory region will prevent such middleware from operation.
+ */
+ em_eeprom (rx) : ORIGIN = 0x14000000, LENGTH = 0x8000 /* 32 KB */
+
+ /* The following regions define device specific memory regions and must not be changed. */
+ sflash_user_data (rx) : ORIGIN = 0x16000800, LENGTH = 0x800 /* Supervisory flash: User data */
+ sflash_nar (rx) : ORIGIN = 0x16001A00, LENGTH = 0x200 /* Supervisory flash: Normal Access Restrictions (NAR) */
+ sflash_public_key (rx) : ORIGIN = 0x16005A00, LENGTH = 0xC00 /* Supervisory flash: Public Key */
+ sflash_toc_2 (rx) : ORIGIN = 0x16007C00, LENGTH = 0x200 /* Supervisory flash: Table of Content # 2 */
+ sflash_rtoc_2 (rx) : ORIGIN = 0x16007E00, LENGTH = 0x200 /* Supervisory flash: Table of Content # 2 Copy */
+ xip (rx) : ORIGIN = 0x18000000, LENGTH = 0x8000000 /* 128 MB */
+ efuse (r) : ORIGIN = 0x90700000, LENGTH = 0x100000 /* 1 MB */
+}
+
+/* Library configurations */
+GROUP(libgcc.a libc.a libm.a libnosys.a)
+
+/* Linker script to place sections and symbol values. Should be used together
+ * with other linker script that defines memory regions FLASH and RAM.
+ * It references following symbols, which must be defined in code:
+ * Reset_Handler : Entry of reset handler
+ *
+ * It defines following symbols, which code can use without definition:
+ * __exidx_start
+ * __exidx_end
+ * __copy_table_start__
+ * __copy_table_end__
+ * __zero_table_start__
+ * __zero_table_end__
+ * __etext
+ * __data_start__
+ * __preinit_array_start
+ * __preinit_array_end
+ * __init_array_start
+ * __init_array_end
+ * __fini_array_start
+ * __fini_array_end
+ * __data_end__
+ * __bss_start__
+ * __bss_end__
+ * __end__
+ * end
+ * __HeapLimit
+ * __StackLimit
+ * __StackTop
+ * __stack
+ * __Vectors_End
+ * __Vectors_Size
+ */
+
+
+SECTIONS
+{
+ /* Cortex-M0+ application flash image area */
+ .cy_m0p_image ORIGIN(flash) :
+ {
+ . = ALIGN(4);
+ __cy_m0p_code_start = . ;
+ KEEP(*(.cy_m0p_image))
+ __cy_m0p_code_end = . ;
+ } > flash
+
+ /* Check if .cy_m0p_image size exceeds FLASH_CM0P_SIZE */
+ ASSERT(__cy_m0p_code_end <= ORIGIN(flash) + FLASH_CM0P_SIZE, "CM0+ flash image overflows with CM4, increase FLASH_CM0P_SIZE")
+
+ /* Cortex-M4 application flash area */
+ .text ORIGIN(flash) + FLASH_CM0P_SIZE :
+ {
+ . = ALIGN(4);
+ __Vectors = . ;
+ KEEP(*(.vectors))
+ . = ALIGN(4);
+ __Vectors_End = .;
+ __Vectors_Size = __Vectors_End - __Vectors;
+ __end__ = .;
+
+ . = ALIGN(4);
+ *(.text*)
+
+ KEEP(*(.init))
+ KEEP(*(.fini))
+
+ /* .ctors */
+ *crtbegin.o(.ctors)
+ *crtbegin?.o(.ctors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+ *(SORT(.ctors.*))
+ *(.ctors)
+
+ /* .dtors */
+ *crtbegin.o(.dtors)
+ *crtbegin?.o(.dtors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+ *(SORT(.dtors.*))
+ *(.dtors)
+
+ /* Read-only code (constants). */
+ *(.rodata .rodata.* .constdata .constdata.* .conststring .conststring.*)
+
+ KEEP(*(.eh_frame*))
+ } > flash
+
+
+ .ARM.extab :
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > flash
+
+ __exidx_start = .;
+
+ .ARM.exidx :
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } > flash
+ __exidx_end = .;
+
+
+ /* To copy multiple ROM to RAM sections,
+ * uncomment .copy.table section and,
+ * define __STARTUP_COPY_MULTIPLE in startup_psoc6_01_cm4.S */
+ .copy.table :
+ {
+ . = ALIGN(4);
+ __copy_table_start__ = .;
+
+ /* Copy interrupt vectors from flash to RAM */
+ LONG (__Vectors) /* From */
+ LONG (__ram_vectors_start__) /* To */
+ LONG (__Vectors_End - __Vectors) /* Size */
+
+ /* Copy data section to RAM */
+ LONG (__etext) /* From */
+ LONG (__data_start__) /* To */
+ LONG (__data_end__ - __data_start__) /* Size */
+
+ __copy_table_end__ = .;
+ } > flash
+
+ /* setction information for finsh shell begin */
+ FSymTab :
+ {
+ . = ALIGN(4);
+ __fsymtab_start = .;
+ KEEP(*(FSymTab))
+ __fsymtab_end = .;
+ } > flash
+ VSymTab :
+ {
+ . = ALIGN(4);
+ __vsymtab_start = .;
+ KEEP(*(VSymTab))
+ __vsymtab_end = .;
+ } > flash
+ rti_fn :
+ {
+ . = ALIGN(4);
+ __rt_init_start = .;
+ KEEP(*(SORT(.rti_fn*)))
+ __rt_init_end = .;
+ } > flash
+ /* setction information for finsh shell end */
+
+ /* To clear multiple BSS sections,
+ * uncomment .zero.table section and,
+ * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_psoc6_01_cm4.S */
+ .zero.table :
+ {
+ . = ALIGN(4);
+ __zero_table_start__ = .;
+ LONG (__bss_start__)
+ LONG (__bss_end__ - __bss_start__)
+ __zero_table_end__ = .;
+ } > flash
+
+ __etext = . ;
+
+
+ .ramVectors (NOLOAD) : ALIGN(8)
+ {
+ __ram_vectors_start__ = .;
+ KEEP(*(.ram_vectors))
+ __ram_vectors_end__ = .;
+ } > ram
+
+
+ .data __ram_vectors_end__ : AT (__etext)
+ {
+ __data_start__ = .;
+
+ *(vtable)
+ *(.data*)
+
+ . = ALIGN(4);
+ /* preinit data */
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP(*(.preinit_array))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+
+ . = ALIGN(4);
+ /* init data */
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP(*(SORT(.init_array.*)))
+ KEEP(*(.init_array))
+ PROVIDE_HIDDEN (__init_array_end = .);
+
+ . = ALIGN(4);
+ /* finit data */
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP(*(SORT(.fini_array.*)))
+ KEEP(*(.fini_array))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+
+ KEEP(*(.jcr*))
+ . = ALIGN(4);
+
+ KEEP(*(.cy_ramfunc*))
+ . = ALIGN(4);
+
+ __data_end__ = .;
+
+ } > ram
+
+
+ /* Place variables in the section that should not be initialized during the
+ * device startup.
+ */
+ .noinit (NOLOAD) : ALIGN(8)
+ {
+ KEEP(*(.noinit))
+ } > ram
+
+
+ /* The uninitialized global or static variables are placed in this section.
+ *
+ * The NOLOAD attribute tells linker that .bss section does not consume
+ * any space in the image. The NOLOAD attribute changes the .bss type to
+ * NOBITS, and that makes linker to A) not allocate section in memory, and
+ * A) put information to clear the section with all zeros during application
+ * loading.
+ *
+ * Without the NOLOAD attribute, the .bss section might get PROGBITS type.
+ * This makes linker to A) allocate zeroed section in memory, and B) copy
+ * this section to RAM during application loading.
+ */
+ .bss (NOLOAD):
+ {
+ . = ALIGN(4);
+ __bss_start__ = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4);
+ __bss_end__ = .;
+ } > ram
+
+
+ .heap (NOLOAD):
+ {
+ __HeapBase = .;
+ __end__ = .;
+ end = __end__;
+ KEEP(*(.heap*))
+ . = ORIGIN(ram) + LENGTH(ram) - STACK_SIZE;
+ __HeapLimit = .;
+ } > ram
+
+
+ /* .stack_dummy section doesn't contains any symbols. It is only
+ * used for linker to calculate size of stack sections, and assign
+ * values to stack symbols later */
+ .stack_dummy (NOLOAD):
+ {
+ KEEP(*(.stack*))
+ } > ram
+
+
+ /* Set stack top to end of RAM, and stack limit move down by
+ * size of stack_dummy section */
+ __StackTop = ORIGIN(ram) + LENGTH(ram);
+ __StackLimit = __StackTop - SIZEOF(.stack_dummy);
+ PROVIDE(__stack = __StackTop);
+
+ /* Check if data + heap + stack exceeds RAM limit */
+ ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
+
+
+ /* Used for the digital signature of the secure application and the Bootloader SDK application.
+ * The size of the section depends on the required data size. */
+ .cy_app_signature ORIGIN(flash) + LENGTH(flash) - 256 :
+ {
+ KEEP(*(.cy_app_signature))
+ } > flash
+
+
+ /* Emulated EEPROM Flash area */
+ .cy_em_eeprom :
+ {
+ KEEP(*(.cy_em_eeprom))
+ } > em_eeprom
+
+
+ /* Supervisory Flash: User data */
+ .cy_sflash_user_data :
+ {
+ KEEP(*(.cy_sflash_user_data))
+ } > sflash_user_data
+
+
+ /* Supervisory Flash: Normal Access Restrictions (NAR) */
+ .cy_sflash_nar :
+ {
+ KEEP(*(.cy_sflash_nar))
+ } > sflash_nar
+
+
+ /* Supervisory Flash: Public Key */
+ .cy_sflash_public_key :
+ {
+ KEEP(*(.cy_sflash_public_key))
+ } > sflash_public_key
+
+
+ /* Supervisory Flash: Table of Content # 2 */
+ .cy_toc_part2 :
+ {
+ KEEP(*(.cy_toc_part2))
+ } > sflash_toc_2
+
+
+ /* Supervisory Flash: Table of Content # 2 Copy */
+ .cy_rtoc_part2 :
+ {
+ KEEP(*(.cy_rtoc_part2))
+ } > sflash_rtoc_2
+
+
+ /* Places the code in the Execute in Place (XIP) section. See the smif driver
+ * documentation for details.
+ */
+ .cy_xip :
+ {
+ KEEP(*(.cy_xip))
+ } > xip
+
+
+ /* eFuse */
+ .cy_efuse :
+ {
+ KEEP(*(.cy_efuse))
+ } > efuse
+
+
+ /* These sections are used for additional metadata (silicon revision,
+ * Silicon/JTAG ID, etc.) storage.
+ */
+ .cymeta 0x90500000 : { KEEP(*(.cymeta)) } :NONE
+}
+
+
+/* The following symbols used by the cymcuelftool. */
+/* Flash */
+__cy_memory_0_start = 0x10000000;
+__cy_memory_0_length = 0x00100000;
+__cy_memory_0_row_size = 0x200;
+
+/* Emulated EEPROM Flash area */
+__cy_memory_1_start = 0x14000000;
+__cy_memory_1_length = 0x8000;
+__cy_memory_1_row_size = 0x200;
+
+/* Supervisory Flash */
+__cy_memory_2_start = 0x16000000;
+__cy_memory_2_length = 0x8000;
+__cy_memory_2_row_size = 0x200;
+
+/* XIP */
+__cy_memory_3_start = 0x18000000;
+__cy_memory_3_length = 0x08000000;
+__cy_memory_3_row_size = 0x200;
+
+/* eFuse */
+__cy_memory_4_start = 0x90700000;
+__cy_memory_4_length = 0x100000;
+__cy_memory_4_row_size = 1;
+
+/* EOF */
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_IAR/cy8c6xx7_cm4_dual.icf b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_IAR/cy8c6xx7_cm4_dual.icf
new file mode 100644
index 0000000000000000000000000000000000000000..e30133713a85ee0957db57ccaa674262a742e307
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/linker/TOOLCHAIN_IAR/cy8c6xx7_cm4_dual.icf
@@ -0,0 +1,240 @@
+/***************************************************************************//**
+* \file cy8c6xx7_cm4_dual.icf
+* \version 2.60
+*
+* Linker file for the IAR compiler.
+*
+* The main purpose of the linker script is to describe how the sections in the
+* input files should be mapped into the output file, and to control the memory
+* layout of the output file.
+*
+* \note The entry point is fixed and starts at 0x10000000. The valid application
+* image should be placed there.
+*
+* \note The linker files included with the PDL template projects must be generic
+* and handle all common use cases. Your project may not use every section
+* defined in the linker files. In that case you may see warnings during the
+* build process. In your project, you can simply comment out or remove the
+* relevant code in the linker file.
+*
+********************************************************************************
+* \copyright
+* Copyright 2016-2019 Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed 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.
+*******************************************************************************/
+
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_4.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x00000000;
+
+/* The symbols below define the location and size of blocks of memory in the target.
+ * Use these symbols to specify the memory regions available for allocation.
+ */
+
+/* The following symbols control RAM and flash memory allocation for the CM4 core.
+ * You can change the memory allocation by editing RAM and Flash symbols.
+ * Note that 2 KB of RAM (at the end of the SRAM) are reserved for system use.
+ * Using this memory region for other purposes will lead to unexpected behavior.
+ * Your changes must be aligned with the corresponding symbols for CM0+ core in 'xx_cm0plus.icf',
+ * where 'xx' is the device group; for example, 'cy8c6xx7_cm0plus.icf'.
+ */
+/* RAM */
+define symbol __ICFEDIT_region_IRAM1_start__ = 0x08002000;
+define symbol __ICFEDIT_region_IRAM1_end__ = 0x08047800;
+/* Flash */
+define symbol __ICFEDIT_region_IROM1_start__ = 0x10000000;
+define symbol __ICFEDIT_region_IROM1_end__ = 0x10100000;
+
+/* The following symbols define a 32K flash region used for EEPROM emulation.
+ * This region can also be used as the general purpose flash.
+ * You can assign sections to this memory region for only one of the cores.
+ * Note some middleware (e.g. BLE, Emulated EEPROM) can place their data into this memory region.
+ * Therefore, repurposing this memory region will prevent such middleware from operation.
+ */
+define symbol __ICFEDIT_region_IROM2_start__ = 0x14000000;
+define symbol __ICFEDIT_region_IROM2_end__ = 0x14007FFF;
+
+/* The following symbols define device specific memory regions and must not be changed. */
+/* Supervisory FLASH - User Data */
+define symbol __ICFEDIT_region_IROM3_start__ = 0x16000800;
+define symbol __ICFEDIT_region_IROM3_end__ = 0x160007FF;
+
+/* Supervisory FLASH - Normal Access Restrictions (NAR) */
+define symbol __ICFEDIT_region_IROM4_start__ = 0x16001A00;
+define symbol __ICFEDIT_region_IROM4_end__ = 0x16001BFF;
+
+/* Supervisory FLASH - Public Key */
+define symbol __ICFEDIT_region_IROM5_start__ = 0x16005A00;
+define symbol __ICFEDIT_region_IROM5_end__ = 0x160065FF;
+
+/* Supervisory FLASH - Table of Content # 2 */
+define symbol __ICFEDIT_region_IROM6_start__ = 0x16007C00;
+define symbol __ICFEDIT_region_IROM6_end__ = 0x16007DFF;
+
+/* Supervisory FLASH - Table of Content # 2 Copy */
+define symbol __ICFEDIT_region_IROM7_start__ = 0x16007E00;
+define symbol __ICFEDIT_region_IROM7_end__ = 0x16007FFF;
+
+/* eFuse */
+define symbol __ICFEDIT_region_IROM8_start__ = 0x90700000;
+define symbol __ICFEDIT_region_IROM8_end__ = 0x907FFFFF;
+
+/* XIP */
+define symbol __ICFEDIT_region_EROM1_start__ = 0x18000000;
+define symbol __ICFEDIT_region_EROM1_end__ = 0x1FFFFFFF;
+
+define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
+define symbol __ICFEDIT_region_EROM2_end__ = 0x0;
+define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
+define symbol __ICFEDIT_region_EROM3_end__ = 0x0;
+
+
+define symbol __ICFEDIT_region_IRAM2_start__ = 0x0;
+define symbol __ICFEDIT_region_IRAM2_end__ = 0x0;
+define symbol __ICFEDIT_region_ERAM1_start__ = 0x0;
+define symbol __ICFEDIT_region_ERAM1_end__ = 0x0;
+define symbol __ICFEDIT_region_ERAM2_start__ = 0x0;
+define symbol __ICFEDIT_region_ERAM2_end__ = 0x0;
+define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
+define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
+/*-Sizes-*/
+if (!isdefinedsymbol(__STACK_SIZE)) {
+ define symbol __ICFEDIT_size_cstack__ = 0x1000;
+} else {
+ define symbol __ICFEDIT_size_cstack__ = __STACK_SIZE;
+}
+define symbol __ICFEDIT_size_proc_stack__ = 0x0;
+
+/* Defines the minimum heap size. The actual heap size will be expanded to the end of the stack region */
+if (!isdefinedsymbol(__HEAP_SIZE)) {
+ define symbol __ICFEDIT_size_heap__ = 0x0400;
+} else {
+ define symbol __ICFEDIT_size_heap__ = __HEAP_SIZE;
+}
+/**** End of ICF editor section. ###ICF###*/
+
+/* Size of the Cortex-M0+ application image */
+define symbol FLASH_CM0P_SIZE = 0x2000;
+
+define memory mem with size = 4G;
+define region IROM1_region = mem:[from __ICFEDIT_region_IROM1_start__ to __ICFEDIT_region_IROM1_end__];
+define region IROM2_region = mem:[from __ICFEDIT_region_IROM2_start__ to __ICFEDIT_region_IROM2_end__];
+define region IROM3_region = mem:[from __ICFEDIT_region_IROM3_start__ to __ICFEDIT_region_IROM3_end__];
+define region IROM4_region = mem:[from __ICFEDIT_region_IROM4_start__ to __ICFEDIT_region_IROM4_end__];
+define region IROM5_region = mem:[from __ICFEDIT_region_IROM5_start__ to __ICFEDIT_region_IROM5_end__];
+define region IROM6_region = mem:[from __ICFEDIT_region_IROM6_start__ to __ICFEDIT_region_IROM6_end__];
+define region IROM7_region = mem:[from __ICFEDIT_region_IROM7_start__ to __ICFEDIT_region_IROM7_end__];
+define region IROM8_region = mem:[from __ICFEDIT_region_IROM8_start__ to __ICFEDIT_region_IROM8_end__];
+define region EROM1_region = mem:[from __ICFEDIT_region_EROM1_start__ to __ICFEDIT_region_EROM1_end__];
+define region IRAM1_region = mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFEDIT_region_IRAM1_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+define block PROC_STACK with alignment = 8, size = __ICFEDIT_size_proc_stack__ { };
+define block HEAP with expanding size, alignment = 8, minimum size = __ICFEDIT_size_heap__ { };
+define block HSTACK {block HEAP, block PROC_STACK, last block CSTACK};
+define block CM0P_RO with size = FLASH_CM0P_SIZE { readonly section .cy_m0p_image };
+define block RO {first section .intvec, readonly};
+
+/*-Initializations-*/
+initialize by copy { readwrite };
+do not initialize { section .noinit, section .intvec_ram };
+
+/*-Placement-*/
+
+/* Flash - Cortex-M0+ application image */
+place at start of IROM1_region { block CM0P_RO };
+
+/* Flash - Cortex-M4 application */
+place in IROM1_region { block RO };
+
+/* Used for the digital signature of the secure application and the Bootloader SDK application. */
+".cy_app_signature" : place at address (__ICFEDIT_region_IROM1_end__ - 0x200) { section .cy_app_signature };
+
+/* Emulated EEPROM Flash area */
+".cy_em_eeprom" : place at start of IROM2_region { section .cy_em_eeprom };
+
+/* Supervisory Flash - User Data */
+".cy_sflash_user_data" : place at start of IROM3_region { section .cy_sflash_user_data };
+
+/* Supervisory Flash - NAR */
+".cy_sflash_nar" : place at start of IROM4_region { section .cy_sflash_nar };
+
+/* Supervisory Flash - Public Key */
+".cy_sflash_public_key" : place at start of IROM5_region { section .cy_sflash_public_key };
+
+/* Supervisory Flash - TOC2 */
+".cy_toc_part2" : place at start of IROM6_region { section .cy_toc_part2 };
+
+/* Supervisory Flash - RTOC2 */
+".cy_rtoc_part2" : place at start of IROM7_region { section .cy_rtoc_part2 };
+
+/* eFuse */
+".cy_efuse" : place at start of IROM8_region { section .cy_efuse };
+
+/* Execute in Place (XIP). See the smif driver documentation for details. */
+".cy_xip" : place at start of EROM1_region { section .cy_xip };
+
+/* RAM */
+place at start of IRAM1_region { readwrite section .intvec_ram};
+place in IRAM1_region { readwrite };
+place at end of IRAM1_region { block HSTACK };
+
+/* These sections are used for additional metadata (silicon revision, Silicon/JTAG ID, etc.) storage. */
+".cymeta" : place at address mem : 0x90500000 { readonly section .cymeta };
+
+
+keep { section .cy_m0p_image,
+ section .cy_app_signature,
+ section .cy_em_eeprom,
+ section .cy_sflash_user_data,
+ section .cy_sflash_nar,
+ section .cy_sflash_public_key,
+ section .cy_toc_part2,
+ section .cy_rtoc_part2,
+ section .cy_efuse,
+ section .cy_xip,
+ section .cymeta,
+ };
+
+
+/* The following symbols used by the cymcuelftool. */
+/* Flash */
+define exported symbol __cy_memory_0_start = 0x10000000;
+define exported symbol __cy_memory_0_length = 0x00100000;
+define exported symbol __cy_memory_0_row_size = 0x200;
+
+/* Emulated EEPROM Flash area */
+define exported symbol __cy_memory_1_start = 0x14000000;
+define exported symbol __cy_memory_1_length = 0x8000;
+define exported symbol __cy_memory_1_row_size = 0x200;
+
+/* Supervisory Flash */
+define exported symbol __cy_memory_2_start = 0x16000000;
+define exported symbol __cy_memory_2_length = 0x8000;
+define exported symbol __cy_memory_2_row_size = 0x200;
+
+/* XIP */
+define exported symbol __cy_memory_3_start = 0x18000000;
+define exported symbol __cy_memory_3_length = 0x08000000;
+define exported symbol __cy_memory_3_row_size = 0x200;
+
+/* eFuse */
+define exported symbol __cy_memory_4_start = 0x90700000;
+define exported symbol __cy_memory_4_length = 0x100000;
+define exported symbol __cy_memory_4_row_size = 1;
+
+/* EOF */
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_ARM/startup_psoc6_01_cm4.s b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_ARM/startup_psoc6_01_cm4.s
new file mode 100644
index 0000000000000000000000000000000000000000..dd04a07d304493584d1520b059b67a4985b82471
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_ARM/startup_psoc6_01_cm4.s
@@ -0,0 +1,645 @@
+;/**************************************************************************//**
+; * @file startup_psoc6_01_cm4.s
+; * @brief CMSIS Core Device Startup File for
+; * ARMCM4 Device Series
+; * @version V5.00
+; * @date 02. March 2016
+; ******************************************************************************/
+;/*
+; * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
+; *
+; * SPDX-License-Identifier: Apache-2.0
+; *
+; * Licensed 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
+; *
+; * 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.
+; */
+
+ PRESERVE8
+ THUMB
+
+; Vector Table Mapped to Address 0 at Reset
+
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+ IMPORT |Image$$ARM_LIB_STACK$$ZI$$Base|
+ IMPORT |Image$$ARM_LIB_STACK$$ZI$$Length|
+
+__Vectors DCD |Image$$ARM_LIB_STACK$$ZI$$Base| + |Image$$ARM_LIB_STACK$$ZI$$Length| ; Top of Stack
+
+ DCD Reset_Handler ; Reset Handler
+
+ DCD 0x0000000D ; NMI Handler located at ROM code
+ DCD HardFault_Handler ; Hard Fault Handler
+ DCD MemManage_Handler ; MPU Fault Handler
+ DCD BusFault_Handler ; Bus Fault Handler
+ DCD UsageFault_Handler ; Usage Fault Handler
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall Handler
+ DCD DebugMon_Handler ; Debug Monitor Handler
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV Handler
+ DCD SysTick_Handler ; SysTick Handler
+
+ ; External interrupts Description
+ DCD ioss_interrupts_gpio_0_IRQHandler ; GPIO Port Interrupt #0
+ DCD ioss_interrupts_gpio_1_IRQHandler ; GPIO Port Interrupt #1
+ DCD ioss_interrupts_gpio_2_IRQHandler ; GPIO Port Interrupt #2
+ DCD ioss_interrupts_gpio_3_IRQHandler ; GPIO Port Interrupt #3
+ DCD ioss_interrupts_gpio_4_IRQHandler ; GPIO Port Interrupt #4
+ DCD ioss_interrupts_gpio_5_IRQHandler ; GPIO Port Interrupt #5
+ DCD ioss_interrupts_gpio_6_IRQHandler ; GPIO Port Interrupt #6
+ DCD ioss_interrupts_gpio_7_IRQHandler ; GPIO Port Interrupt #7
+ DCD ioss_interrupts_gpio_8_IRQHandler ; GPIO Port Interrupt #8
+ DCD ioss_interrupts_gpio_9_IRQHandler ; GPIO Port Interrupt #9
+ DCD ioss_interrupts_gpio_10_IRQHandler ; GPIO Port Interrupt #10
+ DCD ioss_interrupts_gpio_11_IRQHandler ; GPIO Port Interrupt #11
+ DCD ioss_interrupts_gpio_12_IRQHandler ; GPIO Port Interrupt #12
+ DCD ioss_interrupts_gpio_13_IRQHandler ; GPIO Port Interrupt #13
+ DCD ioss_interrupts_gpio_14_IRQHandler ; GPIO Port Interrupt #14
+ DCD ioss_interrupt_gpio_IRQHandler ; GPIO All Ports
+ DCD ioss_interrupt_vdd_IRQHandler ; GPIO Supply Detect Interrupt
+ DCD lpcomp_interrupt_IRQHandler ; Low Power Comparator Interrupt
+ DCD scb_8_interrupt_IRQHandler ; Serial Communication Block #8 (DeepSleep capable)
+ DCD srss_interrupt_mcwdt_0_IRQHandler ; Multi Counter Watchdog Timer interrupt
+ DCD srss_interrupt_mcwdt_1_IRQHandler ; Multi Counter Watchdog Timer interrupt
+ DCD srss_interrupt_backup_IRQHandler ; Backup domain interrupt
+ DCD srss_interrupt_IRQHandler ; Other combined Interrupts for SRSS (LVD, WDT, CLKCAL)
+ DCD pass_interrupt_ctbs_IRQHandler ; CTBm Interrupt (all CTBms)
+ DCD bless_interrupt_IRQHandler ; Bluetooth Radio interrupt
+ DCD cpuss_interrupts_ipc_0_IRQHandler ; CPUSS Inter Process Communication Interrupt #0
+ DCD cpuss_interrupts_ipc_1_IRQHandler ; CPUSS Inter Process Communication Interrupt #1
+ DCD cpuss_interrupts_ipc_2_IRQHandler ; CPUSS Inter Process Communication Interrupt #2
+ DCD cpuss_interrupts_ipc_3_IRQHandler ; CPUSS Inter Process Communication Interrupt #3
+ DCD cpuss_interrupts_ipc_4_IRQHandler ; CPUSS Inter Process Communication Interrupt #4
+ DCD cpuss_interrupts_ipc_5_IRQHandler ; CPUSS Inter Process Communication Interrupt #5
+ DCD cpuss_interrupts_ipc_6_IRQHandler ; CPUSS Inter Process Communication Interrupt #6
+ DCD cpuss_interrupts_ipc_7_IRQHandler ; CPUSS Inter Process Communication Interrupt #7
+ DCD cpuss_interrupts_ipc_8_IRQHandler ; CPUSS Inter Process Communication Interrupt #8
+ DCD cpuss_interrupts_ipc_9_IRQHandler ; CPUSS Inter Process Communication Interrupt #9
+ DCD cpuss_interrupts_ipc_10_IRQHandler ; CPUSS Inter Process Communication Interrupt #10
+ DCD cpuss_interrupts_ipc_11_IRQHandler ; CPUSS Inter Process Communication Interrupt #11
+ DCD cpuss_interrupts_ipc_12_IRQHandler ; CPUSS Inter Process Communication Interrupt #12
+ DCD cpuss_interrupts_ipc_13_IRQHandler ; CPUSS Inter Process Communication Interrupt #13
+ DCD cpuss_interrupts_ipc_14_IRQHandler ; CPUSS Inter Process Communication Interrupt #14
+ DCD cpuss_interrupts_ipc_15_IRQHandler ; CPUSS Inter Process Communication Interrupt #15
+ DCD scb_0_interrupt_IRQHandler ; Serial Communication Block #0
+ DCD scb_1_interrupt_IRQHandler ; Serial Communication Block #1
+ DCD scb_2_interrupt_IRQHandler ; Serial Communication Block #2
+ DCD scb_3_interrupt_IRQHandler ; Serial Communication Block #3
+ DCD scb_4_interrupt_IRQHandler ; Serial Communication Block #4
+ DCD scb_5_interrupt_IRQHandler ; Serial Communication Block #5
+ DCD scb_6_interrupt_IRQHandler ; Serial Communication Block #6
+ DCD scb_7_interrupt_IRQHandler ; Serial Communication Block #7
+ DCD csd_interrupt_IRQHandler ; CSD (Capsense) interrupt
+ DCD cpuss_interrupts_dw0_0_IRQHandler ; CPUSS DataWire #0, Channel #0
+ DCD cpuss_interrupts_dw0_1_IRQHandler ; CPUSS DataWire #0, Channel #1
+ DCD cpuss_interrupts_dw0_2_IRQHandler ; CPUSS DataWire #0, Channel #2
+ DCD cpuss_interrupts_dw0_3_IRQHandler ; CPUSS DataWire #0, Channel #3
+ DCD cpuss_interrupts_dw0_4_IRQHandler ; CPUSS DataWire #0, Channel #4
+ DCD cpuss_interrupts_dw0_5_IRQHandler ; CPUSS DataWire #0, Channel #5
+ DCD cpuss_interrupts_dw0_6_IRQHandler ; CPUSS DataWire #0, Channel #6
+ DCD cpuss_interrupts_dw0_7_IRQHandler ; CPUSS DataWire #0, Channel #7
+ DCD cpuss_interrupts_dw0_8_IRQHandler ; CPUSS DataWire #0, Channel #8
+ DCD cpuss_interrupts_dw0_9_IRQHandler ; CPUSS DataWire #0, Channel #9
+ DCD cpuss_interrupts_dw0_10_IRQHandler ; CPUSS DataWire #0, Channel #10
+ DCD cpuss_interrupts_dw0_11_IRQHandler ; CPUSS DataWire #0, Channel #11
+ DCD cpuss_interrupts_dw0_12_IRQHandler ; CPUSS DataWire #0, Channel #12
+ DCD cpuss_interrupts_dw0_13_IRQHandler ; CPUSS DataWire #0, Channel #13
+ DCD cpuss_interrupts_dw0_14_IRQHandler ; CPUSS DataWire #0, Channel #14
+ DCD cpuss_interrupts_dw0_15_IRQHandler ; CPUSS DataWire #0, Channel #15
+ DCD cpuss_interrupts_dw1_0_IRQHandler ; CPUSS DataWire #1, Channel #0
+ DCD cpuss_interrupts_dw1_1_IRQHandler ; CPUSS DataWire #1, Channel #1
+ DCD cpuss_interrupts_dw1_2_IRQHandler ; CPUSS DataWire #1, Channel #2
+ DCD cpuss_interrupts_dw1_3_IRQHandler ; CPUSS DataWire #1, Channel #3
+ DCD cpuss_interrupts_dw1_4_IRQHandler ; CPUSS DataWire #1, Channel #4
+ DCD cpuss_interrupts_dw1_5_IRQHandler ; CPUSS DataWire #1, Channel #5
+ DCD cpuss_interrupts_dw1_6_IRQHandler ; CPUSS DataWire #1, Channel #6
+ DCD cpuss_interrupts_dw1_7_IRQHandler ; CPUSS DataWire #1, Channel #7
+ DCD cpuss_interrupts_dw1_8_IRQHandler ; CPUSS DataWire #1, Channel #8
+ DCD cpuss_interrupts_dw1_9_IRQHandler ; CPUSS DataWire #1, Channel #9
+ DCD cpuss_interrupts_dw1_10_IRQHandler ; CPUSS DataWire #1, Channel #10
+ DCD cpuss_interrupts_dw1_11_IRQHandler ; CPUSS DataWire #1, Channel #11
+ DCD cpuss_interrupts_dw1_12_IRQHandler ; CPUSS DataWire #1, Channel #12
+ DCD cpuss_interrupts_dw1_13_IRQHandler ; CPUSS DataWire #1, Channel #13
+ DCD cpuss_interrupts_dw1_14_IRQHandler ; CPUSS DataWire #1, Channel #14
+ DCD cpuss_interrupts_dw1_15_IRQHandler ; CPUSS DataWire #1, Channel #15
+ DCD cpuss_interrupts_fault_0_IRQHandler ; CPUSS Fault Structure Interrupt #0
+ DCD cpuss_interrupts_fault_1_IRQHandler ; CPUSS Fault Structure Interrupt #1
+ DCD cpuss_interrupt_crypto_IRQHandler ; CRYPTO Accelerator Interrupt
+ DCD cpuss_interrupt_fm_IRQHandler ; FLASH Macro Interrupt
+ DCD cpuss_interrupts_cm0_cti_0_IRQHandler ; CM0+ CTI #0
+ DCD cpuss_interrupts_cm0_cti_1_IRQHandler ; CM0+ CTI #1
+ DCD cpuss_interrupts_cm4_cti_0_IRQHandler ; CM4 CTI #0
+ DCD cpuss_interrupts_cm4_cti_1_IRQHandler ; CM4 CTI #1
+ DCD tcpwm_0_interrupts_0_IRQHandler ; TCPWM #0, Counter #0
+ DCD tcpwm_0_interrupts_1_IRQHandler ; TCPWM #0, Counter #1
+ DCD tcpwm_0_interrupts_2_IRQHandler ; TCPWM #0, Counter #2
+ DCD tcpwm_0_interrupts_3_IRQHandler ; TCPWM #0, Counter #3
+ DCD tcpwm_0_interrupts_4_IRQHandler ; TCPWM #0, Counter #4
+ DCD tcpwm_0_interrupts_5_IRQHandler ; TCPWM #0, Counter #5
+ DCD tcpwm_0_interrupts_6_IRQHandler ; TCPWM #0, Counter #6
+ DCD tcpwm_0_interrupts_7_IRQHandler ; TCPWM #0, Counter #7
+ DCD tcpwm_1_interrupts_0_IRQHandler ; TCPWM #1, Counter #0
+ DCD tcpwm_1_interrupts_1_IRQHandler ; TCPWM #1, Counter #1
+ DCD tcpwm_1_interrupts_2_IRQHandler ; TCPWM #1, Counter #2
+ DCD tcpwm_1_interrupts_3_IRQHandler ; TCPWM #1, Counter #3
+ DCD tcpwm_1_interrupts_4_IRQHandler ; TCPWM #1, Counter #4
+ DCD tcpwm_1_interrupts_5_IRQHandler ; TCPWM #1, Counter #5
+ DCD tcpwm_1_interrupts_6_IRQHandler ; TCPWM #1, Counter #6
+ DCD tcpwm_1_interrupts_7_IRQHandler ; TCPWM #1, Counter #7
+ DCD tcpwm_1_interrupts_8_IRQHandler ; TCPWM #1, Counter #8
+ DCD tcpwm_1_interrupts_9_IRQHandler ; TCPWM #1, Counter #9
+ DCD tcpwm_1_interrupts_10_IRQHandler ; TCPWM #1, Counter #10
+ DCD tcpwm_1_interrupts_11_IRQHandler ; TCPWM #1, Counter #11
+ DCD tcpwm_1_interrupts_12_IRQHandler ; TCPWM #1, Counter #12
+ DCD tcpwm_1_interrupts_13_IRQHandler ; TCPWM #1, Counter #13
+ DCD tcpwm_1_interrupts_14_IRQHandler ; TCPWM #1, Counter #14
+ DCD tcpwm_1_interrupts_15_IRQHandler ; TCPWM #1, Counter #15
+ DCD tcpwm_1_interrupts_16_IRQHandler ; TCPWM #1, Counter #16
+ DCD tcpwm_1_interrupts_17_IRQHandler ; TCPWM #1, Counter #17
+ DCD tcpwm_1_interrupts_18_IRQHandler ; TCPWM #1, Counter #18
+ DCD tcpwm_1_interrupts_19_IRQHandler ; TCPWM #1, Counter #19
+ DCD tcpwm_1_interrupts_20_IRQHandler ; TCPWM #1, Counter #20
+ DCD tcpwm_1_interrupts_21_IRQHandler ; TCPWM #1, Counter #21
+ DCD tcpwm_1_interrupts_22_IRQHandler ; TCPWM #1, Counter #22
+ DCD tcpwm_1_interrupts_23_IRQHandler ; TCPWM #1, Counter #23
+ DCD udb_interrupts_0_IRQHandler ; UDB Interrupt #0
+ DCD udb_interrupts_1_IRQHandler ; UDB Interrupt #1
+ DCD udb_interrupts_2_IRQHandler ; UDB Interrupt #2
+ DCD udb_interrupts_3_IRQHandler ; UDB Interrupt #3
+ DCD udb_interrupts_4_IRQHandler ; UDB Interrupt #4
+ DCD udb_interrupts_5_IRQHandler ; UDB Interrupt #5
+ DCD udb_interrupts_6_IRQHandler ; UDB Interrupt #6
+ DCD udb_interrupts_7_IRQHandler ; UDB Interrupt #7
+ DCD udb_interrupts_8_IRQHandler ; UDB Interrupt #8
+ DCD udb_interrupts_9_IRQHandler ; UDB Interrupt #9
+ DCD udb_interrupts_10_IRQHandler ; UDB Interrupt #10
+ DCD udb_interrupts_11_IRQHandler ; UDB Interrupt #11
+ DCD udb_interrupts_12_IRQHandler ; UDB Interrupt #12
+ DCD udb_interrupts_13_IRQHandler ; UDB Interrupt #13
+ DCD udb_interrupts_14_IRQHandler ; UDB Interrupt #14
+ DCD udb_interrupts_15_IRQHandler ; UDB Interrupt #15
+ DCD pass_interrupt_sar_IRQHandler ; SAR ADC interrupt
+ DCD audioss_interrupt_i2s_IRQHandler ; I2S Audio interrupt
+ DCD audioss_interrupt_pdm_IRQHandler ; PDM/PCM Audio interrupt
+ DCD profile_interrupt_IRQHandler ; Energy Profiler interrupt
+ DCD smif_interrupt_IRQHandler ; Serial Memory Interface interrupt
+ DCD usb_interrupt_hi_IRQHandler ; USB Interrupt
+ DCD usb_interrupt_med_IRQHandler ; USB Interrupt
+ DCD usb_interrupt_lo_IRQHandler ; USB Interrupt
+ DCD pass_interrupt_dacs_IRQHandler ; Consolidated interrrupt for all DACs
+
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+ EXPORT __ramVectors
+ AREA RESET_RAM, READWRITE, NOINIT
+__ramVectors SPACE __Vectors_Size
+
+
+ AREA |.text|, CODE, READONLY
+
+
+; Weak function for startup customization
+;
+; Note. The global resources are not yet initialized (for example global variables, peripherals, clocks)
+; because this function is executed as the first instruction in the ResetHandler.
+; The PDL is also not initialized to use the proper register offsets.
+; The user of this function is responsible for initializing the PDL and resources before using them.
+;
+Cy_OnResetUser PROC
+ EXPORT Cy_OnResetUser [WEAK]
+ BX LR
+ ENDP
+
+; Reset Handler
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT Cy_SystemInitFpuEnable
+ IMPORT __main
+
+ ; Define strong function for startup customization
+ BL Cy_OnResetUser
+
+ ; Disable global interrupts
+ CPSID I
+
+ ; Copy vectors from ROM to RAM
+ LDR r1, =__Vectors
+ LDR r0, =__ramVectors
+ LDR r2, =__Vectors_Size
+Vectors_Copy
+ LDR r3, [r1]
+ STR r3, [r0]
+ ADDS r0, r0, #4
+ ADDS r1, r1, #4
+ SUBS r2, r2, #1
+ CMP r2, #0
+ BNE Vectors_Copy
+
+ ; Update Vector Table Offset Register. */
+ LDR r0, =__ramVectors
+ LDR r1, =0xE000ED08
+ STR r0, [r1]
+ dsb 0xF
+
+ ; Enable the FPU if used
+ LDR R0, =Cy_SystemInitFpuEnable
+ BLX R0
+
+ LDR R0, =__main
+ BLX R0
+
+ ; Should never get here
+ B .
+
+ ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+
+Cy_SysLib_FaultHandler PROC
+ EXPORT Cy_SysLib_FaultHandler [WEAK]
+ B .
+ ENDP
+HardFault_Wrapper\
+ PROC
+ EXPORT HardFault_Wrapper [WEAK]
+ movs r0, #4
+ mov r1, LR
+ tst r0, r1
+ beq L_MSP
+ mrs r0, PSP
+ bl L_API_call
+L_MSP
+ mrs r0, MSP
+L_API_call
+ bl Cy_SysLib_FaultHandler
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B HardFault_Wrapper
+ ENDP
+MemManage_Handler\
+ PROC
+ EXPORT MemManage_Handler [WEAK]
+ B HardFault_Wrapper
+ ENDP
+BusFault_Handler\
+ PROC
+ EXPORT BusFault_Handler [WEAK]
+ B HardFault_Wrapper
+ ENDP
+UsageFault_Handler\
+ PROC
+ EXPORT UsageFault_Handler [WEAK]
+ B HardFault_Wrapper
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+DebugMon_Handler\
+ PROC
+ EXPORT DebugMon_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+ EXPORT Default_Handler [WEAK]
+ EXPORT ioss_interrupts_gpio_0_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_1_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_2_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_3_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_4_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_5_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_6_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_7_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_8_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_9_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_10_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_11_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_12_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_13_IRQHandler [WEAK]
+ EXPORT ioss_interrupts_gpio_14_IRQHandler [WEAK]
+ EXPORT ioss_interrupt_gpio_IRQHandler [WEAK]
+ EXPORT ioss_interrupt_vdd_IRQHandler [WEAK]
+ EXPORT lpcomp_interrupt_IRQHandler [WEAK]
+ EXPORT scb_8_interrupt_IRQHandler [WEAK]
+ EXPORT srss_interrupt_mcwdt_0_IRQHandler [WEAK]
+ EXPORT srss_interrupt_mcwdt_1_IRQHandler [WEAK]
+ EXPORT srss_interrupt_backup_IRQHandler [WEAK]
+ EXPORT srss_interrupt_IRQHandler [WEAK]
+ EXPORT pass_interrupt_ctbs_IRQHandler [WEAK]
+ EXPORT bless_interrupt_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_0_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_1_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_2_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_3_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_4_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_5_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_6_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_7_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_8_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_9_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_10_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_11_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_12_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_13_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_14_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_ipc_15_IRQHandler [WEAK]
+ EXPORT scb_0_interrupt_IRQHandler [WEAK]
+ EXPORT scb_1_interrupt_IRQHandler [WEAK]
+ EXPORT scb_2_interrupt_IRQHandler [WEAK]
+ EXPORT scb_3_interrupt_IRQHandler [WEAK]
+ EXPORT scb_4_interrupt_IRQHandler [WEAK]
+ EXPORT scb_5_interrupt_IRQHandler [WEAK]
+ EXPORT scb_6_interrupt_IRQHandler [WEAK]
+ EXPORT scb_7_interrupt_IRQHandler [WEAK]
+ EXPORT csd_interrupt_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_0_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_1_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_2_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_3_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_4_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_5_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_6_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_7_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_8_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_9_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_10_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_11_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_12_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_13_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_14_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw0_15_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_0_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_1_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_2_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_3_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_4_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_5_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_6_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_7_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_8_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_9_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_10_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_11_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_12_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_13_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_14_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_dw1_15_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_fault_0_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_fault_1_IRQHandler [WEAK]
+ EXPORT cpuss_interrupt_crypto_IRQHandler [WEAK]
+ EXPORT cpuss_interrupt_fm_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_cm0_cti_0_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_cm0_cti_1_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_cm4_cti_0_IRQHandler [WEAK]
+ EXPORT cpuss_interrupts_cm4_cti_1_IRQHandler [WEAK]
+ EXPORT tcpwm_0_interrupts_0_IRQHandler [WEAK]
+ EXPORT tcpwm_0_interrupts_1_IRQHandler [WEAK]
+ EXPORT tcpwm_0_interrupts_2_IRQHandler [WEAK]
+ EXPORT tcpwm_0_interrupts_3_IRQHandler [WEAK]
+ EXPORT tcpwm_0_interrupts_4_IRQHandler [WEAK]
+ EXPORT tcpwm_0_interrupts_5_IRQHandler [WEAK]
+ EXPORT tcpwm_0_interrupts_6_IRQHandler [WEAK]
+ EXPORT tcpwm_0_interrupts_7_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_0_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_1_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_2_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_3_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_4_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_5_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_6_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_7_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_8_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_9_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_10_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_11_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_12_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_13_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_14_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_15_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_16_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_17_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_18_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_19_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_20_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_21_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_22_IRQHandler [WEAK]
+ EXPORT tcpwm_1_interrupts_23_IRQHandler [WEAK]
+ EXPORT udb_interrupts_0_IRQHandler [WEAK]
+ EXPORT udb_interrupts_1_IRQHandler [WEAK]
+ EXPORT udb_interrupts_2_IRQHandler [WEAK]
+ EXPORT udb_interrupts_3_IRQHandler [WEAK]
+ EXPORT udb_interrupts_4_IRQHandler [WEAK]
+ EXPORT udb_interrupts_5_IRQHandler [WEAK]
+ EXPORT udb_interrupts_6_IRQHandler [WEAK]
+ EXPORT udb_interrupts_7_IRQHandler [WEAK]
+ EXPORT udb_interrupts_8_IRQHandler [WEAK]
+ EXPORT udb_interrupts_9_IRQHandler [WEAK]
+ EXPORT udb_interrupts_10_IRQHandler [WEAK]
+ EXPORT udb_interrupts_11_IRQHandler [WEAK]
+ EXPORT udb_interrupts_12_IRQHandler [WEAK]
+ EXPORT udb_interrupts_13_IRQHandler [WEAK]
+ EXPORT udb_interrupts_14_IRQHandler [WEAK]
+ EXPORT udb_interrupts_15_IRQHandler [WEAK]
+ EXPORT pass_interrupt_sar_IRQHandler [WEAK]
+ EXPORT audioss_interrupt_i2s_IRQHandler [WEAK]
+ EXPORT audioss_interrupt_pdm_IRQHandler [WEAK]
+ EXPORT profile_interrupt_IRQHandler [WEAK]
+ EXPORT smif_interrupt_IRQHandler [WEAK]
+ EXPORT usb_interrupt_hi_IRQHandler [WEAK]
+ EXPORT usb_interrupt_med_IRQHandler [WEAK]
+ EXPORT usb_interrupt_lo_IRQHandler [WEAK]
+ EXPORT pass_interrupt_dacs_IRQHandler [WEAK]
+
+ioss_interrupts_gpio_0_IRQHandler
+ioss_interrupts_gpio_1_IRQHandler
+ioss_interrupts_gpio_2_IRQHandler
+ioss_interrupts_gpio_3_IRQHandler
+ioss_interrupts_gpio_4_IRQHandler
+ioss_interrupts_gpio_5_IRQHandler
+ioss_interrupts_gpio_6_IRQHandler
+ioss_interrupts_gpio_7_IRQHandler
+ioss_interrupts_gpio_8_IRQHandler
+ioss_interrupts_gpio_9_IRQHandler
+ioss_interrupts_gpio_10_IRQHandler
+ioss_interrupts_gpio_11_IRQHandler
+ioss_interrupts_gpio_12_IRQHandler
+ioss_interrupts_gpio_13_IRQHandler
+ioss_interrupts_gpio_14_IRQHandler
+ioss_interrupt_gpio_IRQHandler
+ioss_interrupt_vdd_IRQHandler
+lpcomp_interrupt_IRQHandler
+scb_8_interrupt_IRQHandler
+srss_interrupt_mcwdt_0_IRQHandler
+srss_interrupt_mcwdt_1_IRQHandler
+srss_interrupt_backup_IRQHandler
+srss_interrupt_IRQHandler
+pass_interrupt_ctbs_IRQHandler
+bless_interrupt_IRQHandler
+cpuss_interrupts_ipc_0_IRQHandler
+cpuss_interrupts_ipc_1_IRQHandler
+cpuss_interrupts_ipc_2_IRQHandler
+cpuss_interrupts_ipc_3_IRQHandler
+cpuss_interrupts_ipc_4_IRQHandler
+cpuss_interrupts_ipc_5_IRQHandler
+cpuss_interrupts_ipc_6_IRQHandler
+cpuss_interrupts_ipc_7_IRQHandler
+cpuss_interrupts_ipc_8_IRQHandler
+cpuss_interrupts_ipc_9_IRQHandler
+cpuss_interrupts_ipc_10_IRQHandler
+cpuss_interrupts_ipc_11_IRQHandler
+cpuss_interrupts_ipc_12_IRQHandler
+cpuss_interrupts_ipc_13_IRQHandler
+cpuss_interrupts_ipc_14_IRQHandler
+cpuss_interrupts_ipc_15_IRQHandler
+scb_0_interrupt_IRQHandler
+scb_1_interrupt_IRQHandler
+scb_2_interrupt_IRQHandler
+scb_3_interrupt_IRQHandler
+scb_4_interrupt_IRQHandler
+scb_5_interrupt_IRQHandler
+scb_6_interrupt_IRQHandler
+scb_7_interrupt_IRQHandler
+csd_interrupt_IRQHandler
+cpuss_interrupts_dw0_0_IRQHandler
+cpuss_interrupts_dw0_1_IRQHandler
+cpuss_interrupts_dw0_2_IRQHandler
+cpuss_interrupts_dw0_3_IRQHandler
+cpuss_interrupts_dw0_4_IRQHandler
+cpuss_interrupts_dw0_5_IRQHandler
+cpuss_interrupts_dw0_6_IRQHandler
+cpuss_interrupts_dw0_7_IRQHandler
+cpuss_interrupts_dw0_8_IRQHandler
+cpuss_interrupts_dw0_9_IRQHandler
+cpuss_interrupts_dw0_10_IRQHandler
+cpuss_interrupts_dw0_11_IRQHandler
+cpuss_interrupts_dw0_12_IRQHandler
+cpuss_interrupts_dw0_13_IRQHandler
+cpuss_interrupts_dw0_14_IRQHandler
+cpuss_interrupts_dw0_15_IRQHandler
+cpuss_interrupts_dw1_0_IRQHandler
+cpuss_interrupts_dw1_1_IRQHandler
+cpuss_interrupts_dw1_2_IRQHandler
+cpuss_interrupts_dw1_3_IRQHandler
+cpuss_interrupts_dw1_4_IRQHandler
+cpuss_interrupts_dw1_5_IRQHandler
+cpuss_interrupts_dw1_6_IRQHandler
+cpuss_interrupts_dw1_7_IRQHandler
+cpuss_interrupts_dw1_8_IRQHandler
+cpuss_interrupts_dw1_9_IRQHandler
+cpuss_interrupts_dw1_10_IRQHandler
+cpuss_interrupts_dw1_11_IRQHandler
+cpuss_interrupts_dw1_12_IRQHandler
+cpuss_interrupts_dw1_13_IRQHandler
+cpuss_interrupts_dw1_14_IRQHandler
+cpuss_interrupts_dw1_15_IRQHandler
+cpuss_interrupts_fault_0_IRQHandler
+cpuss_interrupts_fault_1_IRQHandler
+cpuss_interrupt_crypto_IRQHandler
+cpuss_interrupt_fm_IRQHandler
+cpuss_interrupts_cm0_cti_0_IRQHandler
+cpuss_interrupts_cm0_cti_1_IRQHandler
+cpuss_interrupts_cm4_cti_0_IRQHandler
+cpuss_interrupts_cm4_cti_1_IRQHandler
+tcpwm_0_interrupts_0_IRQHandler
+tcpwm_0_interrupts_1_IRQHandler
+tcpwm_0_interrupts_2_IRQHandler
+tcpwm_0_interrupts_3_IRQHandler
+tcpwm_0_interrupts_4_IRQHandler
+tcpwm_0_interrupts_5_IRQHandler
+tcpwm_0_interrupts_6_IRQHandler
+tcpwm_0_interrupts_7_IRQHandler
+tcpwm_1_interrupts_0_IRQHandler
+tcpwm_1_interrupts_1_IRQHandler
+tcpwm_1_interrupts_2_IRQHandler
+tcpwm_1_interrupts_3_IRQHandler
+tcpwm_1_interrupts_4_IRQHandler
+tcpwm_1_interrupts_5_IRQHandler
+tcpwm_1_interrupts_6_IRQHandler
+tcpwm_1_interrupts_7_IRQHandler
+tcpwm_1_interrupts_8_IRQHandler
+tcpwm_1_interrupts_9_IRQHandler
+tcpwm_1_interrupts_10_IRQHandler
+tcpwm_1_interrupts_11_IRQHandler
+tcpwm_1_interrupts_12_IRQHandler
+tcpwm_1_interrupts_13_IRQHandler
+tcpwm_1_interrupts_14_IRQHandler
+tcpwm_1_interrupts_15_IRQHandler
+tcpwm_1_interrupts_16_IRQHandler
+tcpwm_1_interrupts_17_IRQHandler
+tcpwm_1_interrupts_18_IRQHandler
+tcpwm_1_interrupts_19_IRQHandler
+tcpwm_1_interrupts_20_IRQHandler
+tcpwm_1_interrupts_21_IRQHandler
+tcpwm_1_interrupts_22_IRQHandler
+tcpwm_1_interrupts_23_IRQHandler
+udb_interrupts_0_IRQHandler
+udb_interrupts_1_IRQHandler
+udb_interrupts_2_IRQHandler
+udb_interrupts_3_IRQHandler
+udb_interrupts_4_IRQHandler
+udb_interrupts_5_IRQHandler
+udb_interrupts_6_IRQHandler
+udb_interrupts_7_IRQHandler
+udb_interrupts_8_IRQHandler
+udb_interrupts_9_IRQHandler
+udb_interrupts_10_IRQHandler
+udb_interrupts_11_IRQHandler
+udb_interrupts_12_IRQHandler
+udb_interrupts_13_IRQHandler
+udb_interrupts_14_IRQHandler
+udb_interrupts_15_IRQHandler
+pass_interrupt_sar_IRQHandler
+audioss_interrupt_i2s_IRQHandler
+audioss_interrupt_pdm_IRQHandler
+profile_interrupt_IRQHandler
+smif_interrupt_IRQHandler
+usb_interrupt_hi_IRQHandler
+usb_interrupt_med_IRQHandler
+usb_interrupt_lo_IRQHandler
+pass_interrupt_dacs_IRQHandler
+
+ B .
+ ENDP
+
+ ALIGN
+
+
+; User Initial Stack & Heap
+ IMPORT __use_two_region_memory
+
+ END
+
+
+; [] END OF FILE
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_A_Clang/startup_psoc6_01_cm4.S b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_A_Clang/startup_psoc6_01_cm4.S
new file mode 100644
index 0000000000000000000000000000000000000000..e641b3cc42c1cd588686198a46eed314762f6947
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_A_Clang/startup_psoc6_01_cm4.S
@@ -0,0 +1,554 @@
+/**************************************************************************//**
+ * @file startup_psoc6_01_cm4.S
+ * @brief CMSIS Core Device Startup File for
+ * ARMCM4 Device Series
+ * @version V5.00
+ * @date 02. March 2016
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+ /* Address of the NMI handler */
+ #define CY_NMI_HANLDER_ADDR 0x0000000D
+
+ /* The CPU VTOR register */
+ #define CY_CPU_VTOR_ADDR 0xE000ED08
+
+ .syntax unified
+ .section __STACK , __stack
+ .align 3
+
+#ifdef __STACK_SIZE
+ .equ Stack_Size, __STACK_SIZE
+#else
+ .equ Stack_Size, 0x00001000
+#endif
+ .globl __StackTop
+ .globl __StackLimit
+ __StackLimit:
+ .space Stack_Size
+ .equ __StackTop, . - Stack_Size
+
+ .section __HEAP, __heap
+ .align 3
+#ifdef __HEAP_SIZE
+ .equ Heap_Size, __HEAP_SIZE
+#else
+ .equ Heap_Size, 0x00000400
+#endif
+ .globl __HeapBase
+__HeapBase:
+ .if Heap_Size
+ .space Heap_Size
+ .endif
+
+ .section __VECT, ___Vectors
+ .align 2
+ .globl ___Vectors
+___Vectors:
+ .long __StackTop /* Top of Stack */
+ .long Reset_Handler+1 /* Reset Handler. Added +1, clang doesn't make lsb to 1 for thumb */
+ .long CY_NMI_HANLDER_ADDR /* NMI Handler */
+ .long HardFault_Handler /* Hard Fault Handler */
+ .long MemManage_Handler /* MPU Fault Handler */
+ .long BusFault_Handler /* Bus Fault Handler */
+ .long UsageFault_Handler /* Usage Fault Handler */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long SVC_Handler /* SVCall Handler */
+ .long DebugMon_Handler /* Debug Monitor Handler */
+ .long 0 /* Reserved */
+ .long PendSV_Handler /* PendSV Handler */
+ .long SysTick_Handler /* SysTick Handler */
+
+ /* External interrupts Description */
+ .long ioss_interrupts_gpio_0_IRQHandler /* GPIO Port Interrupt #0 */
+ .long ioss_interrupts_gpio_1_IRQHandler /* GPIO Port Interrupt #1 */
+ .long ioss_interrupts_gpio_2_IRQHandler /* GPIO Port Interrupt #2 */
+ .long ioss_interrupts_gpio_3_IRQHandler /* GPIO Port Interrupt #3 */
+ .long ioss_interrupts_gpio_4_IRQHandler /* GPIO Port Interrupt #4 */
+ .long ioss_interrupts_gpio_5_IRQHandler /* GPIO Port Interrupt #5 */
+ .long ioss_interrupts_gpio_6_IRQHandler /* GPIO Port Interrupt #6 */
+ .long ioss_interrupts_gpio_7_IRQHandler /* GPIO Port Interrupt #7 */
+ .long ioss_interrupts_gpio_8_IRQHandler /* GPIO Port Interrupt #8 */
+ .long ioss_interrupts_gpio_9_IRQHandler /* GPIO Port Interrupt #9 */
+ .long ioss_interrupts_gpio_10_IRQHandler /* GPIO Port Interrupt #10 */
+ .long ioss_interrupts_gpio_11_IRQHandler /* GPIO Port Interrupt #11 */
+ .long ioss_interrupts_gpio_12_IRQHandler /* GPIO Port Interrupt #12 */
+ .long ioss_interrupts_gpio_13_IRQHandler /* GPIO Port Interrupt #13 */
+ .long ioss_interrupts_gpio_14_IRQHandler /* GPIO Port Interrupt #14 */
+ .long ioss_interrupt_gpio_IRQHandler /* GPIO All Ports */
+ .long ioss_interrupt_vdd_IRQHandler /* GPIO Supply Detect Interrupt */
+ .long lpcomp_interrupt_IRQHandler /* Low Power Comparator Interrupt */
+ .long scb_8_interrupt_IRQHandler /* Serial Communication Block #8 (DeepSleep capable) */
+ .long srss_interrupt_mcwdt_0_IRQHandler /* Multi Counter Watchdog Timer interrupt */
+ .long srss_interrupt_mcwdt_1_IRQHandler /* Multi Counter Watchdog Timer interrupt */
+ .long srss_interrupt_backup_IRQHandler /* Backup domain interrupt */
+ .long srss_interrupt_IRQHandler /* Other combined Interrupts for SRSS (LVD, WDT, CLKCAL) */
+ .long pass_interrupt_ctbs_IRQHandler /* CTBm Interrupt (all CTBms) */
+ .long bless_interrupt_IRQHandler /* Bluetooth Radio interrupt */
+ .long cpuss_interrupts_ipc_0_IRQHandler /* CPUSS Inter Process Communication Interrupt #0 */
+ .long cpuss_interrupts_ipc_1_IRQHandler /* CPUSS Inter Process Communication Interrupt #1 */
+ .long cpuss_interrupts_ipc_2_IRQHandler /* CPUSS Inter Process Communication Interrupt #2 */
+ .long cpuss_interrupts_ipc_3_IRQHandler /* CPUSS Inter Process Communication Interrupt #3 */
+ .long cpuss_interrupts_ipc_4_IRQHandler /* CPUSS Inter Process Communication Interrupt #4 */
+ .long cpuss_interrupts_ipc_5_IRQHandler /* CPUSS Inter Process Communication Interrupt #5 */
+ .long cpuss_interrupts_ipc_6_IRQHandler /* CPUSS Inter Process Communication Interrupt #6 */
+ .long cpuss_interrupts_ipc_7_IRQHandler /* CPUSS Inter Process Communication Interrupt #7 */
+ .long cpuss_interrupts_ipc_8_IRQHandler /* CPUSS Inter Process Communication Interrupt #8 */
+ .long cpuss_interrupts_ipc_9_IRQHandler /* CPUSS Inter Process Communication Interrupt #9 */
+ .long cpuss_interrupts_ipc_10_IRQHandler /* CPUSS Inter Process Communication Interrupt #10 */
+ .long cpuss_interrupts_ipc_11_IRQHandler /* CPUSS Inter Process Communication Interrupt #11 */
+ .long cpuss_interrupts_ipc_12_IRQHandler /* CPUSS Inter Process Communication Interrupt #12 */
+ .long cpuss_interrupts_ipc_13_IRQHandler /* CPUSS Inter Process Communication Interrupt #13 */
+ .long cpuss_interrupts_ipc_14_IRQHandler /* CPUSS Inter Process Communication Interrupt #14 */
+ .long cpuss_interrupts_ipc_15_IRQHandler /* CPUSS Inter Process Communication Interrupt #15 */
+ .long scb_0_interrupt_IRQHandler /* Serial Communication Block #0 */
+ .long scb_1_interrupt_IRQHandler /* Serial Communication Block #1 */
+ .long scb_2_interrupt_IRQHandler /* Serial Communication Block #2 */
+ .long scb_3_interrupt_IRQHandler /* Serial Communication Block #3 */
+ .long scb_4_interrupt_IRQHandler /* Serial Communication Block #4 */
+ .long scb_5_interrupt_IRQHandler /* Serial Communication Block #5 */
+ .long scb_6_interrupt_IRQHandler /* Serial Communication Block #6 */
+ .long scb_7_interrupt_IRQHandler /* Serial Communication Block #7 */
+ .long csd_interrupt_IRQHandler /* CSD (Capsense) interrupt */
+ .long cpuss_interrupts_dw0_0_IRQHandler /* CPUSS DataWire #0, Channel #0 */
+ .long cpuss_interrupts_dw0_1_IRQHandler /* CPUSS DataWire #0, Channel #1 */
+ .long cpuss_interrupts_dw0_2_IRQHandler /* CPUSS DataWire #0, Channel #2 */
+ .long cpuss_interrupts_dw0_3_IRQHandler /* CPUSS DataWire #0, Channel #3 */
+ .long cpuss_interrupts_dw0_4_IRQHandler /* CPUSS DataWire #0, Channel #4 */
+ .long cpuss_interrupts_dw0_5_IRQHandler /* CPUSS DataWire #0, Channel #5 */
+ .long cpuss_interrupts_dw0_6_IRQHandler /* CPUSS DataWire #0, Channel #6 */
+ .long cpuss_interrupts_dw0_7_IRQHandler /* CPUSS DataWire #0, Channel #7 */
+ .long cpuss_interrupts_dw0_8_IRQHandler /* CPUSS DataWire #0, Channel #8 */
+ .long cpuss_interrupts_dw0_9_IRQHandler /* CPUSS DataWire #0, Channel #9 */
+ .long cpuss_interrupts_dw0_10_IRQHandler /* CPUSS DataWire #0, Channel #10 */
+ .long cpuss_interrupts_dw0_11_IRQHandler /* CPUSS DataWire #0, Channel #11 */
+ .long cpuss_interrupts_dw0_12_IRQHandler /* CPUSS DataWire #0, Channel #12 */
+ .long cpuss_interrupts_dw0_13_IRQHandler /* CPUSS DataWire #0, Channel #13 */
+ .long cpuss_interrupts_dw0_14_IRQHandler /* CPUSS DataWire #0, Channel #14 */
+ .long cpuss_interrupts_dw0_15_IRQHandler /* CPUSS DataWire #0, Channel #15 */
+ .long cpuss_interrupts_dw1_0_IRQHandler /* CPUSS DataWire #1, Channel #0 */
+ .long cpuss_interrupts_dw1_1_IRQHandler /* CPUSS DataWire #1, Channel #1 */
+ .long cpuss_interrupts_dw1_2_IRQHandler /* CPUSS DataWire #1, Channel #2 */
+ .long cpuss_interrupts_dw1_3_IRQHandler /* CPUSS DataWire #1, Channel #3 */
+ .long cpuss_interrupts_dw1_4_IRQHandler /* CPUSS DataWire #1, Channel #4 */
+ .long cpuss_interrupts_dw1_5_IRQHandler /* CPUSS DataWire #1, Channel #5 */
+ .long cpuss_interrupts_dw1_6_IRQHandler /* CPUSS DataWire #1, Channel #6 */
+ .long cpuss_interrupts_dw1_7_IRQHandler /* CPUSS DataWire #1, Channel #7 */
+ .long cpuss_interrupts_dw1_8_IRQHandler /* CPUSS DataWire #1, Channel #8 */
+ .long cpuss_interrupts_dw1_9_IRQHandler /* CPUSS DataWire #1, Channel #9 */
+ .long cpuss_interrupts_dw1_10_IRQHandler /* CPUSS DataWire #1, Channel #10 */
+ .long cpuss_interrupts_dw1_11_IRQHandler /* CPUSS DataWire #1, Channel #11 */
+ .long cpuss_interrupts_dw1_12_IRQHandler /* CPUSS DataWire #1, Channel #12 */
+ .long cpuss_interrupts_dw1_13_IRQHandler /* CPUSS DataWire #1, Channel #13 */
+ .long cpuss_interrupts_dw1_14_IRQHandler /* CPUSS DataWire #1, Channel #14 */
+ .long cpuss_interrupts_dw1_15_IRQHandler /* CPUSS DataWire #1, Channel #15 */
+ .long cpuss_interrupts_fault_0_IRQHandler /* CPUSS Fault Structure Interrupt #0 */
+ .long cpuss_interrupts_fault_1_IRQHandler /* CPUSS Fault Structure Interrupt #1 */
+ .long cpuss_interrupt_crypto_IRQHandler /* CRYPTO Accelerator Interrupt */
+ .long cpuss_interrupt_fm_IRQHandler /* FLASH Macro Interrupt */
+ .long cpuss_interrupts_cm0_cti_0_IRQHandler /* CM0+ CTI #0 */
+ .long cpuss_interrupts_cm0_cti_1_IRQHandler /* CM0+ CTI #1 */
+ .long cpuss_interrupts_cm4_cti_0_IRQHandler /* CM4 CTI #0 */
+ .long cpuss_interrupts_cm4_cti_1_IRQHandler /* CM4 CTI #1 */
+ .long tcpwm_0_interrupts_0_IRQHandler /* TCPWM #0, Counter #0 */
+ .long tcpwm_0_interrupts_1_IRQHandler /* TCPWM #0, Counter #1 */
+ .long tcpwm_0_interrupts_2_IRQHandler /* TCPWM #0, Counter #2 */
+ .long tcpwm_0_interrupts_3_IRQHandler /* TCPWM #0, Counter #3 */
+ .long tcpwm_0_interrupts_4_IRQHandler /* TCPWM #0, Counter #4 */
+ .long tcpwm_0_interrupts_5_IRQHandler /* TCPWM #0, Counter #5 */
+ .long tcpwm_0_interrupts_6_IRQHandler /* TCPWM #0, Counter #6 */
+ .long tcpwm_0_interrupts_7_IRQHandler /* TCPWM #0, Counter #7 */
+ .long tcpwm_1_interrupts_0_IRQHandler /* TCPWM #1, Counter #0 */
+ .long tcpwm_1_interrupts_1_IRQHandler /* TCPWM #1, Counter #1 */
+ .long tcpwm_1_interrupts_2_IRQHandler /* TCPWM #1, Counter #2 */
+ .long tcpwm_1_interrupts_3_IRQHandler /* TCPWM #1, Counter #3 */
+ .long tcpwm_1_interrupts_4_IRQHandler /* TCPWM #1, Counter #4 */
+ .long tcpwm_1_interrupts_5_IRQHandler /* TCPWM #1, Counter #5 */
+ .long tcpwm_1_interrupts_6_IRQHandler /* TCPWM #1, Counter #6 */
+ .long tcpwm_1_interrupts_7_IRQHandler /* TCPWM #1, Counter #7 */
+ .long tcpwm_1_interrupts_8_IRQHandler /* TCPWM #1, Counter #8 */
+ .long tcpwm_1_interrupts_9_IRQHandler /* TCPWM #1, Counter #9 */
+ .long tcpwm_1_interrupts_10_IRQHandler /* TCPWM #1, Counter #10 */
+ .long tcpwm_1_interrupts_11_IRQHandler /* TCPWM #1, Counter #11 */
+ .long tcpwm_1_interrupts_12_IRQHandler /* TCPWM #1, Counter #12 */
+ .long tcpwm_1_interrupts_13_IRQHandler /* TCPWM #1, Counter #13 */
+ .long tcpwm_1_interrupts_14_IRQHandler /* TCPWM #1, Counter #14 */
+ .long tcpwm_1_interrupts_15_IRQHandler /* TCPWM #1, Counter #15 */
+ .long tcpwm_1_interrupts_16_IRQHandler /* TCPWM #1, Counter #16 */
+ .long tcpwm_1_interrupts_17_IRQHandler /* TCPWM #1, Counter #17 */
+ .long tcpwm_1_interrupts_18_IRQHandler /* TCPWM #1, Counter #18 */
+ .long tcpwm_1_interrupts_19_IRQHandler /* TCPWM #1, Counter #19 */
+ .long tcpwm_1_interrupts_20_IRQHandler /* TCPWM #1, Counter #20 */
+ .long tcpwm_1_interrupts_21_IRQHandler /* TCPWM #1, Counter #21 */
+ .long tcpwm_1_interrupts_22_IRQHandler /* TCPWM #1, Counter #22 */
+ .long tcpwm_1_interrupts_23_IRQHandler /* TCPWM #1, Counter #23 */
+ .long udb_interrupts_0_IRQHandler /* UDB Interrupt #0 */
+ .long udb_interrupts_1_IRQHandler /* UDB Interrupt #1 */
+ .long udb_interrupts_2_IRQHandler /* UDB Interrupt #2 */
+ .long udb_interrupts_3_IRQHandler /* UDB Interrupt #3 */
+ .long udb_interrupts_4_IRQHandler /* UDB Interrupt #4 */
+ .long udb_interrupts_5_IRQHandler /* UDB Interrupt #5 */
+ .long udb_interrupts_6_IRQHandler /* UDB Interrupt #6 */
+ .long udb_interrupts_7_IRQHandler /* UDB Interrupt #7 */
+ .long udb_interrupts_8_IRQHandler /* UDB Interrupt #8 */
+ .long udb_interrupts_9_IRQHandler /* UDB Interrupt #9 */
+ .long udb_interrupts_10_IRQHandler /* UDB Interrupt #10 */
+ .long udb_interrupts_11_IRQHandler /* UDB Interrupt #11 */
+ .long udb_interrupts_12_IRQHandler /* UDB Interrupt #12 */
+ .long udb_interrupts_13_IRQHandler /* UDB Interrupt #13 */
+ .long udb_interrupts_14_IRQHandler /* UDB Interrupt #14 */
+ .long udb_interrupts_15_IRQHandler /* UDB Interrupt #15 */
+ .long pass_interrupt_sar_IRQHandler /* SAR ADC interrupt */
+ .long audioss_interrupt_i2s_IRQHandler /* I2S Audio interrupt */
+ .long audioss_interrupt_pdm_IRQHandler /* PDM/PCM Audio interrupt */
+ .long profile_interrupt_IRQHandler /* Energy Profiler interrupt */
+ .long smif_interrupt_IRQHandler /* Serial Memory Interface interrupt */
+ .long usb_interrupt_hi_IRQHandler /* USB Interrupt */
+ .long usb_interrupt_med_IRQHandler /* USB Interrupt */
+ .long usb_interrupt_lo_IRQHandler /* USB Interrupt */
+ .long pass_interrupt_dacs_IRQHandler /* Consolidated interrrupt for all DACs */
+
+ .equ __VectorsSize, . - ___Vectors
+
+ .section __RAMVECTORS, ___ramVectors
+ .align 2
+ .globl ___ramVectors
+___ramVectors:
+ .space __VectorsSize
+
+
+ /* Only .text, otherwise the linker is smart enough to treat .thumb_func as 2 byte aligned and the
+ * Reset handler vector + 1 in the vector table ends up at +2 and boot fails. Clang/LLVM issue.
+ */
+ .text
+ /* Reset handler */
+ .globl Reset_Handler
+
+Reset_Handler:
+ bl Cy_OnResetUser
+ cpsid i
+
+/* Single section scheme.
+ *
+ * The ranges of copy from/to are specified by following symbols
+ * __etext: LMA of start of the section to copy from. Usually end of text
+ * __data_start__: VMA of start of the section to copy to
+ * __data_end__: VMA of end of the section to copy to
+ *
+ * All addresses must be aligned to 4 bytes boundary.
+ */
+ .equ __copy_table_start__, ___Vectors
+ .equ __data_start__, ___ramVectors
+ .equ __data_end__, __data_start__ + __VectorsSize
+ ldr r1, =__copy_table_start__
+ ldr r2, =__data_start__
+ ldr r3, =__data_end__
+.L_loop_copy_table:
+ subs r4, r3, r2
+ ble .L_loop_copy_table_done
+ ldr r0, [r1,r4]
+ str r0, [r2,r4]
+ subs r3, #4
+ bgt .L_loop_copy_table
+.L_loop_copy_table_done:
+ ldr r1, =segment$end$__TEXT
+ ldr r2, =section$start$__DATA$__data
+ ldr r3, =section$end$__DATA$__data
+ mov r4, #3
+ adds r1, #3
+ mvn r4, r4
+ and r1, r4
+.L_loop_copy_data:
+ subs r4, r3, r2
+ ble .L_loop_copy_data_done
+ ldr r0, [r1,r4]
+ str r0, [r2,r4]
+ subs r3, #4
+ bgt .L_loop_copy_data
+.L_loop_copy_data_done:
+ ldr r2, =section$start$__DATA$__bss
+ ldr r3, =section$end$__DATA$__bss
+.L_loop_bss:
+ subs r1, r3, r2
+ ble .L_loop_bss_done
+ movs r0, #0
+ str r0, [r2,r1]
+ subs r3, #4
+ bgt .L_loop_bss
+.L_loop_bss_done:
+ ldr r2, =section$start$__DATA$__zerofill
+ ldr r3, =section$end$__DATA$__zerofill
+.L_loop_zerofill:
+ subs r1, r3, r2
+ ble .L_loop_zerofill_done
+ movs r0, #0
+ str r0, [r2,r1]
+ subs r3, #4
+ bgt .L_loop_zerofill
+.L_loop_zerofill_done:
+
+ /* Update Vector Table Offset Register. */
+ ldr r0, =___ramVectors
+ ldr r1, =CY_CPU_VTOR_ADDR
+ str r0, [r1]
+ dsb 0xF
+
+ /* Enable the FPU if used */
+ bl _Cy_SystemInitFpuEnable
+
+ bl _HeapInit
+#ifndef __NO_SYSTEM_INIT
+ bl _SystemInit
+#endif
+
+ bl _main
+
+ /* Should never get here */
+ b .
+
+ .pool
+
+ .text
+ .thumb
+ .thumb_func
+ .align 2
+
+ /* Device startup customization */
+ .weak_definition Cy_OnResetUser
+ .global Cy_OnResetUser, Cy_OnResetUser
+Cy_OnResetUser:
+ bx lr
+
+ .text
+ .align 1
+ .thumb_func
+ .weak_reference Default_Handler
+
+Default_Handler:
+ b .
+
+ .text
+ .thumb_func
+ .align 2
+ .weak_definition Cy_SysLib_FaultHandler
+
+Cy_SysLib_FaultHandler:
+ b .
+
+ .text
+ .thumb_func
+ .align 2
+
+Fault_Handler:
+ /* Storing LR content for Creator call stack trace */
+ push {LR}
+ movs r0, #4
+ mov r1, LR
+ tst r0, r1
+ beq .L_MSP
+ mrs r0, PSP
+ b .L_API_call
+.L_MSP:
+ mrs r0, MSP
+.L_API_call:
+ /* Compensation of stack pointer address due to pushing 4 bytes of LR */
+ adds r0, r0, #4
+ bl Cy_SysLib_FaultHandler
+ b .
+
+.macro def_fault_Handler fault_handler_name
+ .weak_definition \fault_handler_name
+ .set \fault_handler_name, Fault_Handler
+ .endm
+
+/* Macro to define default handlers. Default handler
+ * will be weak symbol and just dead loops. They can be
+ * overwritten by other handlers */
+ .macro def_irq_handler handler_name
+ .weak_definition \handler_name
+ .set \handler_name, Default_Handler
+ .endm
+
+ def_irq_handler NMI_Handler
+
+ def_fault_Handler HardFault_Handler
+ def_fault_Handler MemManage_Handler
+ def_fault_Handler BusFault_Handler
+ def_fault_Handler UsageFault_Handler
+
+ def_irq_handler SVC_Handler
+ def_irq_handler DebugMon_Handler
+ def_irq_handler PendSV_Handler
+ def_irq_handler SysTick_Handler
+
+ def_irq_handler ioss_interrupts_gpio_0_IRQHandler /* GPIO Port Interrupt #0 */
+ def_irq_handler ioss_interrupts_gpio_1_IRQHandler /* GPIO Port Interrupt #1 */
+ def_irq_handler ioss_interrupts_gpio_2_IRQHandler /* GPIO Port Interrupt #2 */
+ def_irq_handler ioss_interrupts_gpio_3_IRQHandler /* GPIO Port Interrupt #3 */
+ def_irq_handler ioss_interrupts_gpio_4_IRQHandler /* GPIO Port Interrupt #4 */
+ def_irq_handler ioss_interrupts_gpio_5_IRQHandler /* GPIO Port Interrupt #5 */
+ def_irq_handler ioss_interrupts_gpio_6_IRQHandler /* GPIO Port Interrupt #6 */
+ def_irq_handler ioss_interrupts_gpio_7_IRQHandler /* GPIO Port Interrupt #7 */
+ def_irq_handler ioss_interrupts_gpio_8_IRQHandler /* GPIO Port Interrupt #8 */
+ def_irq_handler ioss_interrupts_gpio_9_IRQHandler /* GPIO Port Interrupt #9 */
+ def_irq_handler ioss_interrupts_gpio_10_IRQHandler /* GPIO Port Interrupt #10 */
+ def_irq_handler ioss_interrupts_gpio_11_IRQHandler /* GPIO Port Interrupt #11 */
+ def_irq_handler ioss_interrupts_gpio_12_IRQHandler /* GPIO Port Interrupt #12 */
+ def_irq_handler ioss_interrupts_gpio_13_IRQHandler /* GPIO Port Interrupt #13 */
+ def_irq_handler ioss_interrupts_gpio_14_IRQHandler /* GPIO Port Interrupt #14 */
+ def_irq_handler ioss_interrupt_gpio_IRQHandler /* GPIO All Ports */
+ def_irq_handler ioss_interrupt_vdd_IRQHandler /* GPIO Supply Detect Interrupt */
+ def_irq_handler lpcomp_interrupt_IRQHandler /* Low Power Comparator Interrupt */
+ def_irq_handler scb_8_interrupt_IRQHandler /* Serial Communication Block #8 (DeepSleep capable) */
+ def_irq_handler srss_interrupt_mcwdt_0_IRQHandler /* Multi Counter Watchdog Timer interrupt */
+ def_irq_handler srss_interrupt_mcwdt_1_IRQHandler /* Multi Counter Watchdog Timer interrupt */
+ def_irq_handler srss_interrupt_backup_IRQHandler /* Backup domain interrupt */
+ def_irq_handler srss_interrupt_IRQHandler /* Other combined Interrupts for SRSS (LVD, WDT, CLKCAL) */
+ def_irq_handler pass_interrupt_ctbs_IRQHandler /* CTBm Interrupt (all CTBms) */
+ def_irq_handler bless_interrupt_IRQHandler /* Bluetooth Radio interrupt */
+ def_irq_handler cpuss_interrupts_ipc_0_IRQHandler /* CPUSS Inter Process Communication Interrupt #0 */
+ def_irq_handler cpuss_interrupts_ipc_1_IRQHandler /* CPUSS Inter Process Communication Interrupt #1 */
+ def_irq_handler cpuss_interrupts_ipc_2_IRQHandler /* CPUSS Inter Process Communication Interrupt #2 */
+ def_irq_handler cpuss_interrupts_ipc_3_IRQHandler /* CPUSS Inter Process Communication Interrupt #3 */
+ def_irq_handler cpuss_interrupts_ipc_4_IRQHandler /* CPUSS Inter Process Communication Interrupt #4 */
+ def_irq_handler cpuss_interrupts_ipc_5_IRQHandler /* CPUSS Inter Process Communication Interrupt #5 */
+ def_irq_handler cpuss_interrupts_ipc_6_IRQHandler /* CPUSS Inter Process Communication Interrupt #6 */
+ def_irq_handler cpuss_interrupts_ipc_7_IRQHandler /* CPUSS Inter Process Communication Interrupt #7 */
+ def_irq_handler cpuss_interrupts_ipc_8_IRQHandler /* CPUSS Inter Process Communication Interrupt #8 */
+ def_irq_handler cpuss_interrupts_ipc_9_IRQHandler /* CPUSS Inter Process Communication Interrupt #9 */
+ def_irq_handler cpuss_interrupts_ipc_10_IRQHandler /* CPUSS Inter Process Communication Interrupt #10 */
+ def_irq_handler cpuss_interrupts_ipc_11_IRQHandler /* CPUSS Inter Process Communication Interrupt #11 */
+ def_irq_handler cpuss_interrupts_ipc_12_IRQHandler /* CPUSS Inter Process Communication Interrupt #12 */
+ def_irq_handler cpuss_interrupts_ipc_13_IRQHandler /* CPUSS Inter Process Communication Interrupt #13 */
+ def_irq_handler cpuss_interrupts_ipc_14_IRQHandler /* CPUSS Inter Process Communication Interrupt #14 */
+ def_irq_handler cpuss_interrupts_ipc_15_IRQHandler /* CPUSS Inter Process Communication Interrupt #15 */
+ def_irq_handler scb_0_interrupt_IRQHandler /* Serial Communication Block #0 */
+ def_irq_handler scb_1_interrupt_IRQHandler /* Serial Communication Block #1 */
+ def_irq_handler scb_2_interrupt_IRQHandler /* Serial Communication Block #2 */
+ def_irq_handler scb_3_interrupt_IRQHandler /* Serial Communication Block #3 */
+ def_irq_handler scb_4_interrupt_IRQHandler /* Serial Communication Block #4 */
+ def_irq_handler scb_5_interrupt_IRQHandler /* Serial Communication Block #5 */
+ def_irq_handler scb_6_interrupt_IRQHandler /* Serial Communication Block #6 */
+ def_irq_handler scb_7_interrupt_IRQHandler /* Serial Communication Block #7 */
+ def_irq_handler csd_interrupt_IRQHandler /* CSD (Capsense) interrupt */
+ def_irq_handler cpuss_interrupts_dw0_0_IRQHandler /* CPUSS DataWire #0, Channel #0 */
+ def_irq_handler cpuss_interrupts_dw0_1_IRQHandler /* CPUSS DataWire #0, Channel #1 */
+ def_irq_handler cpuss_interrupts_dw0_2_IRQHandler /* CPUSS DataWire #0, Channel #2 */
+ def_irq_handler cpuss_interrupts_dw0_3_IRQHandler /* CPUSS DataWire #0, Channel #3 */
+ def_irq_handler cpuss_interrupts_dw0_4_IRQHandler /* CPUSS DataWire #0, Channel #4 */
+ def_irq_handler cpuss_interrupts_dw0_5_IRQHandler /* CPUSS DataWire #0, Channel #5 */
+ def_irq_handler cpuss_interrupts_dw0_6_IRQHandler /* CPUSS DataWire #0, Channel #6 */
+ def_irq_handler cpuss_interrupts_dw0_7_IRQHandler /* CPUSS DataWire #0, Channel #7 */
+ def_irq_handler cpuss_interrupts_dw0_8_IRQHandler /* CPUSS DataWire #0, Channel #8 */
+ def_irq_handler cpuss_interrupts_dw0_9_IRQHandler /* CPUSS DataWire #0, Channel #9 */
+ def_irq_handler cpuss_interrupts_dw0_10_IRQHandler /* CPUSS DataWire #0, Channel #10 */
+ def_irq_handler cpuss_interrupts_dw0_11_IRQHandler /* CPUSS DataWire #0, Channel #11 */
+ def_irq_handler cpuss_interrupts_dw0_12_IRQHandler /* CPUSS DataWire #0, Channel #12 */
+ def_irq_handler cpuss_interrupts_dw0_13_IRQHandler /* CPUSS DataWire #0, Channel #13 */
+ def_irq_handler cpuss_interrupts_dw0_14_IRQHandler /* CPUSS DataWire #0, Channel #14 */
+ def_irq_handler cpuss_interrupts_dw0_15_IRQHandler /* CPUSS DataWire #0, Channel #15 */
+ def_irq_handler cpuss_interrupts_dw1_0_IRQHandler /* CPUSS DataWire #1, Channel #0 */
+ def_irq_handler cpuss_interrupts_dw1_1_IRQHandler /* CPUSS DataWire #1, Channel #1 */
+ def_irq_handler cpuss_interrupts_dw1_2_IRQHandler /* CPUSS DataWire #1, Channel #2 */
+ def_irq_handler cpuss_interrupts_dw1_3_IRQHandler /* CPUSS DataWire #1, Channel #3 */
+ def_irq_handler cpuss_interrupts_dw1_4_IRQHandler /* CPUSS DataWire #1, Channel #4 */
+ def_irq_handler cpuss_interrupts_dw1_5_IRQHandler /* CPUSS DataWire #1, Channel #5 */
+ def_irq_handler cpuss_interrupts_dw1_6_IRQHandler /* CPUSS DataWire #1, Channel #6 */
+ def_irq_handler cpuss_interrupts_dw1_7_IRQHandler /* CPUSS DataWire #1, Channel #7 */
+ def_irq_handler cpuss_interrupts_dw1_8_IRQHandler /* CPUSS DataWire #1, Channel #8 */
+ def_irq_handler cpuss_interrupts_dw1_9_IRQHandler /* CPUSS DataWire #1, Channel #9 */
+ def_irq_handler cpuss_interrupts_dw1_10_IRQHandler /* CPUSS DataWire #1, Channel #10 */
+ def_irq_handler cpuss_interrupts_dw1_11_IRQHandler /* CPUSS DataWire #1, Channel #11 */
+ def_irq_handler cpuss_interrupts_dw1_12_IRQHandler /* CPUSS DataWire #1, Channel #12 */
+ def_irq_handler cpuss_interrupts_dw1_13_IRQHandler /* CPUSS DataWire #1, Channel #13 */
+ def_irq_handler cpuss_interrupts_dw1_14_IRQHandler /* CPUSS DataWire #1, Channel #14 */
+ def_irq_handler cpuss_interrupts_dw1_15_IRQHandler /* CPUSS DataWire #1, Channel #15 */
+ def_irq_handler cpuss_interrupts_fault_0_IRQHandler /* CPUSS Fault Structure Interrupt #0 */
+ def_irq_handler cpuss_interrupts_fault_1_IRQHandler /* CPUSS Fault Structure Interrupt #1 */
+ def_irq_handler cpuss_interrupt_crypto_IRQHandler /* CRYPTO Accelerator Interrupt */
+ def_irq_handler cpuss_interrupt_fm_IRQHandler /* FLASH Macro Interrupt */
+ def_irq_handler cpuss_interrupts_cm0_cti_0_IRQHandler /* CM0+ CTI #0 */
+ def_irq_handler cpuss_interrupts_cm0_cti_1_IRQHandler /* CM0+ CTI #1 */
+ def_irq_handler cpuss_interrupts_cm4_cti_0_IRQHandler /* CM4 CTI #0 */
+ def_irq_handler cpuss_interrupts_cm4_cti_1_IRQHandler /* CM4 CTI #1 */
+ def_irq_handler tcpwm_0_interrupts_0_IRQHandler /* TCPWM #0, Counter #0 */
+ def_irq_handler tcpwm_0_interrupts_1_IRQHandler /* TCPWM #0, Counter #1 */
+ def_irq_handler tcpwm_0_interrupts_2_IRQHandler /* TCPWM #0, Counter #2 */
+ def_irq_handler tcpwm_0_interrupts_3_IRQHandler /* TCPWM #0, Counter #3 */
+ def_irq_handler tcpwm_0_interrupts_4_IRQHandler /* TCPWM #0, Counter #4 */
+ def_irq_handler tcpwm_0_interrupts_5_IRQHandler /* TCPWM #0, Counter #5 */
+ def_irq_handler tcpwm_0_interrupts_6_IRQHandler /* TCPWM #0, Counter #6 */
+ def_irq_handler tcpwm_0_interrupts_7_IRQHandler /* TCPWM #0, Counter #7 */
+ def_irq_handler tcpwm_1_interrupts_0_IRQHandler /* TCPWM #1, Counter #0 */
+ def_irq_handler tcpwm_1_interrupts_1_IRQHandler /* TCPWM #1, Counter #1 */
+ def_irq_handler tcpwm_1_interrupts_2_IRQHandler /* TCPWM #1, Counter #2 */
+ def_irq_handler tcpwm_1_interrupts_3_IRQHandler /* TCPWM #1, Counter #3 */
+ def_irq_handler tcpwm_1_interrupts_4_IRQHandler /* TCPWM #1, Counter #4 */
+ def_irq_handler tcpwm_1_interrupts_5_IRQHandler /* TCPWM #1, Counter #5 */
+ def_irq_handler tcpwm_1_interrupts_6_IRQHandler /* TCPWM #1, Counter #6 */
+ def_irq_handler tcpwm_1_interrupts_7_IRQHandler /* TCPWM #1, Counter #7 */
+ def_irq_handler tcpwm_1_interrupts_8_IRQHandler /* TCPWM #1, Counter #8 */
+ def_irq_handler tcpwm_1_interrupts_9_IRQHandler /* TCPWM #1, Counter #9 */
+ def_irq_handler tcpwm_1_interrupts_10_IRQHandler /* TCPWM #1, Counter #10 */
+ def_irq_handler tcpwm_1_interrupts_11_IRQHandler /* TCPWM #1, Counter #11 */
+ def_irq_handler tcpwm_1_interrupts_12_IRQHandler /* TCPWM #1, Counter #12 */
+ def_irq_handler tcpwm_1_interrupts_13_IRQHandler /* TCPWM #1, Counter #13 */
+ def_irq_handler tcpwm_1_interrupts_14_IRQHandler /* TCPWM #1, Counter #14 */
+ def_irq_handler tcpwm_1_interrupts_15_IRQHandler /* TCPWM #1, Counter #15 */
+ def_irq_handler tcpwm_1_interrupts_16_IRQHandler /* TCPWM #1, Counter #16 */
+ def_irq_handler tcpwm_1_interrupts_17_IRQHandler /* TCPWM #1, Counter #17 */
+ def_irq_handler tcpwm_1_interrupts_18_IRQHandler /* TCPWM #1, Counter #18 */
+ def_irq_handler tcpwm_1_interrupts_19_IRQHandler /* TCPWM #1, Counter #19 */
+ def_irq_handler tcpwm_1_interrupts_20_IRQHandler /* TCPWM #1, Counter #20 */
+ def_irq_handler tcpwm_1_interrupts_21_IRQHandler /* TCPWM #1, Counter #21 */
+ def_irq_handler tcpwm_1_interrupts_22_IRQHandler /* TCPWM #1, Counter #22 */
+ def_irq_handler tcpwm_1_interrupts_23_IRQHandler /* TCPWM #1, Counter #23 */
+ def_irq_handler udb_interrupts_0_IRQHandler /* UDB Interrupt #0 */
+ def_irq_handler udb_interrupts_1_IRQHandler /* UDB Interrupt #1 */
+ def_irq_handler udb_interrupts_2_IRQHandler /* UDB Interrupt #2 */
+ def_irq_handler udb_interrupts_3_IRQHandler /* UDB Interrupt #3 */
+ def_irq_handler udb_interrupts_4_IRQHandler /* UDB Interrupt #4 */
+ def_irq_handler udb_interrupts_5_IRQHandler /* UDB Interrupt #5 */
+ def_irq_handler udb_interrupts_6_IRQHandler /* UDB Interrupt #6 */
+ def_irq_handler udb_interrupts_7_IRQHandler /* UDB Interrupt #7 */
+ def_irq_handler udb_interrupts_8_IRQHandler /* UDB Interrupt #8 */
+ def_irq_handler udb_interrupts_9_IRQHandler /* UDB Interrupt #9 */
+ def_irq_handler udb_interrupts_10_IRQHandler /* UDB Interrupt #10 */
+ def_irq_handler udb_interrupts_11_IRQHandler /* UDB Interrupt #11 */
+ def_irq_handler udb_interrupts_12_IRQHandler /* UDB Interrupt #12 */
+ def_irq_handler udb_interrupts_13_IRQHandler /* UDB Interrupt #13 */
+ def_irq_handler udb_interrupts_14_IRQHandler /* UDB Interrupt #14 */
+ def_irq_handler udb_interrupts_15_IRQHandler /* UDB Interrupt #15 */
+ def_irq_handler pass_interrupt_sar_IRQHandler /* SAR ADC interrupt */
+ def_irq_handler audioss_interrupt_i2s_IRQHandler /* I2S Audio interrupt */
+ def_irq_handler audioss_interrupt_pdm_IRQHandler /* PDM/PCM Audio interrupt */
+ def_irq_handler profile_interrupt_IRQHandler /* Energy Profiler interrupt */
+ def_irq_handler smif_interrupt_IRQHandler /* Serial Memory Interface interrupt */
+ def_irq_handler usb_interrupt_hi_IRQHandler /* USB Interrupt */
+ def_irq_handler usb_interrupt_med_IRQHandler /* USB Interrupt */
+ def_irq_handler usb_interrupt_lo_IRQHandler /* USB Interrupt */
+ def_irq_handler pass_interrupt_dacs_IRQHandler /* Consolidated interrrupt for all DACs */
+
+ .end
+
+
+/* [] END OF FILE */
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_GCC_ARM/startup_psoc6_01_cm4.S b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_GCC_ARM/startup_psoc6_01_cm4.S
new file mode 100644
index 0000000000000000000000000000000000000000..2220eb3a06290a655a97913b806ab5ebc4a71d08
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_GCC_ARM/startup_psoc6_01_cm4.S
@@ -0,0 +1,656 @@
+/**************************************************************************//**
+ * @file startup_psoc6_01_cm4.S
+ * @brief CMSIS Core Device Startup File for
+ * ARMCM4 Device Series
+ * @version V5.00
+ * @date 02. March 2016
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+ /* Address of the NMI handler */
+ #define CY_NMI_HANLDER_ADDR 0x0000000D
+
+ /* The CPU VTOR register */
+ #define CY_CPU_VTOR_ADDR 0xE000ED08
+
+ /* Copy flash vectors and data section to RAM */
+ #define __STARTUP_COPY_MULTIPLE
+
+ /* Clear single BSS section */
+ #define __STARTUP_CLEAR_BSS
+
+ .syntax unified
+ .arch armv7-m
+
+ .section .stack
+ .align 3
+#ifdef __STACK_SIZE
+ .equ Stack_Size, __STACK_SIZE
+#else
+ .equ Stack_Size, 0x00001000
+#endif
+ .globl __StackTop
+ .globl __StackLimit
+__StackLimit:
+ .space Stack_Size
+ .size __StackLimit, . - __StackLimit
+__StackTop:
+ .size __StackTop, . - __StackTop
+
+ .section .heap
+ .align 3
+#ifdef __HEAP_SIZE
+ .equ Heap_Size, __HEAP_SIZE
+#else
+ .equ Heap_Size, 0x00000400
+#endif
+ .globl __HeapBase
+ .globl __HeapLimit
+__HeapBase:
+ .if Heap_Size
+ .space Heap_Size
+ .endif
+ .size __HeapBase, . - __HeapBase
+__HeapLimit:
+ .size __HeapLimit, . - __HeapLimit
+
+ .section .vectors
+ .align 2
+ .globl __Vectors
+__Vectors:
+ .long __StackTop /* Top of Stack */
+ .long Reset_Handler /* Reset Handler */
+ .long CY_NMI_HANLDER_ADDR /* NMI Handler */
+ .long HardFault_Handler /* Hard Fault Handler */
+ .long MemManage_Handler /* MPU Fault Handler */
+ .long BusFault_Handler /* Bus Fault Handler */
+ .long UsageFault_Handler /* Usage Fault Handler */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long SVC_Handler /* SVCall Handler */
+ .long DebugMon_Handler /* Debug Monitor Handler */
+ .long 0 /* Reserved */
+ .long PendSV_Handler /* PendSV Handler */
+ .long SysTick_Handler /* SysTick Handler */
+
+ /* External interrupts Description */
+ .long ioss_interrupts_gpio_0_IRQHandler /* GPIO Port Interrupt #0 */
+ .long ioss_interrupts_gpio_1_IRQHandler /* GPIO Port Interrupt #1 */
+ .long ioss_interrupts_gpio_2_IRQHandler /* GPIO Port Interrupt #2 */
+ .long ioss_interrupts_gpio_3_IRQHandler /* GPIO Port Interrupt #3 */
+ .long ioss_interrupts_gpio_4_IRQHandler /* GPIO Port Interrupt #4 */
+ .long ioss_interrupts_gpio_5_IRQHandler /* GPIO Port Interrupt #5 */
+ .long ioss_interrupts_gpio_6_IRQHandler /* GPIO Port Interrupt #6 */
+ .long ioss_interrupts_gpio_7_IRQHandler /* GPIO Port Interrupt #7 */
+ .long ioss_interrupts_gpio_8_IRQHandler /* GPIO Port Interrupt #8 */
+ .long ioss_interrupts_gpio_9_IRQHandler /* GPIO Port Interrupt #9 */
+ .long ioss_interrupts_gpio_10_IRQHandler /* GPIO Port Interrupt #10 */
+ .long ioss_interrupts_gpio_11_IRQHandler /* GPIO Port Interrupt #11 */
+ .long ioss_interrupts_gpio_12_IRQHandler /* GPIO Port Interrupt #12 */
+ .long ioss_interrupts_gpio_13_IRQHandler /* GPIO Port Interrupt #13 */
+ .long ioss_interrupts_gpio_14_IRQHandler /* GPIO Port Interrupt #14 */
+ .long ioss_interrupt_gpio_IRQHandler /* GPIO All Ports */
+ .long ioss_interrupt_vdd_IRQHandler /* GPIO Supply Detect Interrupt */
+ .long lpcomp_interrupt_IRQHandler /* Low Power Comparator Interrupt */
+ .long scb_8_interrupt_IRQHandler /* Serial Communication Block #8 (DeepSleep capable) */
+ .long srss_interrupt_mcwdt_0_IRQHandler /* Multi Counter Watchdog Timer interrupt */
+ .long srss_interrupt_mcwdt_1_IRQHandler /* Multi Counter Watchdog Timer interrupt */
+ .long srss_interrupt_backup_IRQHandler /* Backup domain interrupt */
+ .long srss_interrupt_IRQHandler /* Other combined Interrupts for SRSS (LVD, WDT, CLKCAL) */
+ .long pass_interrupt_ctbs_IRQHandler /* CTBm Interrupt (all CTBms) */
+ .long bless_interrupt_IRQHandler /* Bluetooth Radio interrupt */
+ .long cpuss_interrupts_ipc_0_IRQHandler /* CPUSS Inter Process Communication Interrupt #0 */
+ .long cpuss_interrupts_ipc_1_IRQHandler /* CPUSS Inter Process Communication Interrupt #1 */
+ .long cpuss_interrupts_ipc_2_IRQHandler /* CPUSS Inter Process Communication Interrupt #2 */
+ .long cpuss_interrupts_ipc_3_IRQHandler /* CPUSS Inter Process Communication Interrupt #3 */
+ .long cpuss_interrupts_ipc_4_IRQHandler /* CPUSS Inter Process Communication Interrupt #4 */
+ .long cpuss_interrupts_ipc_5_IRQHandler /* CPUSS Inter Process Communication Interrupt #5 */
+ .long cpuss_interrupts_ipc_6_IRQHandler /* CPUSS Inter Process Communication Interrupt #6 */
+ .long cpuss_interrupts_ipc_7_IRQHandler /* CPUSS Inter Process Communication Interrupt #7 */
+ .long cpuss_interrupts_ipc_8_IRQHandler /* CPUSS Inter Process Communication Interrupt #8 */
+ .long cpuss_interrupts_ipc_9_IRQHandler /* CPUSS Inter Process Communication Interrupt #9 */
+ .long cpuss_interrupts_ipc_10_IRQHandler /* CPUSS Inter Process Communication Interrupt #10 */
+ .long cpuss_interrupts_ipc_11_IRQHandler /* CPUSS Inter Process Communication Interrupt #11 */
+ .long cpuss_interrupts_ipc_12_IRQHandler /* CPUSS Inter Process Communication Interrupt #12 */
+ .long cpuss_interrupts_ipc_13_IRQHandler /* CPUSS Inter Process Communication Interrupt #13 */
+ .long cpuss_interrupts_ipc_14_IRQHandler /* CPUSS Inter Process Communication Interrupt #14 */
+ .long cpuss_interrupts_ipc_15_IRQHandler /* CPUSS Inter Process Communication Interrupt #15 */
+ .long scb_0_interrupt_IRQHandler /* Serial Communication Block #0 */
+ .long scb_1_interrupt_IRQHandler /* Serial Communication Block #1 */
+ .long scb_2_interrupt_IRQHandler /* Serial Communication Block #2 */
+ .long scb_3_interrupt_IRQHandler /* Serial Communication Block #3 */
+ .long scb_4_interrupt_IRQHandler /* Serial Communication Block #4 */
+ .long scb_5_interrupt_IRQHandler /* Serial Communication Block #5 */
+ .long scb_6_interrupt_IRQHandler /* Serial Communication Block #6 */
+ .long scb_7_interrupt_IRQHandler /* Serial Communication Block #7 */
+ .long csd_interrupt_IRQHandler /* CSD (Capsense) interrupt */
+ .long cpuss_interrupts_dw0_0_IRQHandler /* CPUSS DataWire #0, Channel #0 */
+ .long cpuss_interrupts_dw0_1_IRQHandler /* CPUSS DataWire #0, Channel #1 */
+ .long cpuss_interrupts_dw0_2_IRQHandler /* CPUSS DataWire #0, Channel #2 */
+ .long cpuss_interrupts_dw0_3_IRQHandler /* CPUSS DataWire #0, Channel #3 */
+ .long cpuss_interrupts_dw0_4_IRQHandler /* CPUSS DataWire #0, Channel #4 */
+ .long cpuss_interrupts_dw0_5_IRQHandler /* CPUSS DataWire #0, Channel #5 */
+ .long cpuss_interrupts_dw0_6_IRQHandler /* CPUSS DataWire #0, Channel #6 */
+ .long cpuss_interrupts_dw0_7_IRQHandler /* CPUSS DataWire #0, Channel #7 */
+ .long cpuss_interrupts_dw0_8_IRQHandler /* CPUSS DataWire #0, Channel #8 */
+ .long cpuss_interrupts_dw0_9_IRQHandler /* CPUSS DataWire #0, Channel #9 */
+ .long cpuss_interrupts_dw0_10_IRQHandler /* CPUSS DataWire #0, Channel #10 */
+ .long cpuss_interrupts_dw0_11_IRQHandler /* CPUSS DataWire #0, Channel #11 */
+ .long cpuss_interrupts_dw0_12_IRQHandler /* CPUSS DataWire #0, Channel #12 */
+ .long cpuss_interrupts_dw0_13_IRQHandler /* CPUSS DataWire #0, Channel #13 */
+ .long cpuss_interrupts_dw0_14_IRQHandler /* CPUSS DataWire #0, Channel #14 */
+ .long cpuss_interrupts_dw0_15_IRQHandler /* CPUSS DataWire #0, Channel #15 */
+ .long cpuss_interrupts_dw1_0_IRQHandler /* CPUSS DataWire #1, Channel #0 */
+ .long cpuss_interrupts_dw1_1_IRQHandler /* CPUSS DataWire #1, Channel #1 */
+ .long cpuss_interrupts_dw1_2_IRQHandler /* CPUSS DataWire #1, Channel #2 */
+ .long cpuss_interrupts_dw1_3_IRQHandler /* CPUSS DataWire #1, Channel #3 */
+ .long cpuss_interrupts_dw1_4_IRQHandler /* CPUSS DataWire #1, Channel #4 */
+ .long cpuss_interrupts_dw1_5_IRQHandler /* CPUSS DataWire #1, Channel #5 */
+ .long cpuss_interrupts_dw1_6_IRQHandler /* CPUSS DataWire #1, Channel #6 */
+ .long cpuss_interrupts_dw1_7_IRQHandler /* CPUSS DataWire #1, Channel #7 */
+ .long cpuss_interrupts_dw1_8_IRQHandler /* CPUSS DataWire #1, Channel #8 */
+ .long cpuss_interrupts_dw1_9_IRQHandler /* CPUSS DataWire #1, Channel #9 */
+ .long cpuss_interrupts_dw1_10_IRQHandler /* CPUSS DataWire #1, Channel #10 */
+ .long cpuss_interrupts_dw1_11_IRQHandler /* CPUSS DataWire #1, Channel #11 */
+ .long cpuss_interrupts_dw1_12_IRQHandler /* CPUSS DataWire #1, Channel #12 */
+ .long cpuss_interrupts_dw1_13_IRQHandler /* CPUSS DataWire #1, Channel #13 */
+ .long cpuss_interrupts_dw1_14_IRQHandler /* CPUSS DataWire #1, Channel #14 */
+ .long cpuss_interrupts_dw1_15_IRQHandler /* CPUSS DataWire #1, Channel #15 */
+ .long cpuss_interrupts_fault_0_IRQHandler /* CPUSS Fault Structure Interrupt #0 */
+ .long cpuss_interrupts_fault_1_IRQHandler /* CPUSS Fault Structure Interrupt #1 */
+ .long cpuss_interrupt_crypto_IRQHandler /* CRYPTO Accelerator Interrupt */
+ .long cpuss_interrupt_fm_IRQHandler /* FLASH Macro Interrupt */
+ .long cpuss_interrupts_cm0_cti_0_IRQHandler /* CM0+ CTI #0 */
+ .long cpuss_interrupts_cm0_cti_1_IRQHandler /* CM0+ CTI #1 */
+ .long cpuss_interrupts_cm4_cti_0_IRQHandler /* CM4 CTI #0 */
+ .long cpuss_interrupts_cm4_cti_1_IRQHandler /* CM4 CTI #1 */
+ .long tcpwm_0_interrupts_0_IRQHandler /* TCPWM #0, Counter #0 */
+ .long tcpwm_0_interrupts_1_IRQHandler /* TCPWM #0, Counter #1 */
+ .long tcpwm_0_interrupts_2_IRQHandler /* TCPWM #0, Counter #2 */
+ .long tcpwm_0_interrupts_3_IRQHandler /* TCPWM #0, Counter #3 */
+ .long tcpwm_0_interrupts_4_IRQHandler /* TCPWM #0, Counter #4 */
+ .long tcpwm_0_interrupts_5_IRQHandler /* TCPWM #0, Counter #5 */
+ .long tcpwm_0_interrupts_6_IRQHandler /* TCPWM #0, Counter #6 */
+ .long tcpwm_0_interrupts_7_IRQHandler /* TCPWM #0, Counter #7 */
+ .long tcpwm_1_interrupts_0_IRQHandler /* TCPWM #1, Counter #0 */
+ .long tcpwm_1_interrupts_1_IRQHandler /* TCPWM #1, Counter #1 */
+ .long tcpwm_1_interrupts_2_IRQHandler /* TCPWM #1, Counter #2 */
+ .long tcpwm_1_interrupts_3_IRQHandler /* TCPWM #1, Counter #3 */
+ .long tcpwm_1_interrupts_4_IRQHandler /* TCPWM #1, Counter #4 */
+ .long tcpwm_1_interrupts_5_IRQHandler /* TCPWM #1, Counter #5 */
+ .long tcpwm_1_interrupts_6_IRQHandler /* TCPWM #1, Counter #6 */
+ .long tcpwm_1_interrupts_7_IRQHandler /* TCPWM #1, Counter #7 */
+ .long tcpwm_1_interrupts_8_IRQHandler /* TCPWM #1, Counter #8 */
+ .long tcpwm_1_interrupts_9_IRQHandler /* TCPWM #1, Counter #9 */
+ .long tcpwm_1_interrupts_10_IRQHandler /* TCPWM #1, Counter #10 */
+ .long tcpwm_1_interrupts_11_IRQHandler /* TCPWM #1, Counter #11 */
+ .long tcpwm_1_interrupts_12_IRQHandler /* TCPWM #1, Counter #12 */
+ .long tcpwm_1_interrupts_13_IRQHandler /* TCPWM #1, Counter #13 */
+ .long tcpwm_1_interrupts_14_IRQHandler /* TCPWM #1, Counter #14 */
+ .long tcpwm_1_interrupts_15_IRQHandler /* TCPWM #1, Counter #15 */
+ .long tcpwm_1_interrupts_16_IRQHandler /* TCPWM #1, Counter #16 */
+ .long tcpwm_1_interrupts_17_IRQHandler /* TCPWM #1, Counter #17 */
+ .long tcpwm_1_interrupts_18_IRQHandler /* TCPWM #1, Counter #18 */
+ .long tcpwm_1_interrupts_19_IRQHandler /* TCPWM #1, Counter #19 */
+ .long tcpwm_1_interrupts_20_IRQHandler /* TCPWM #1, Counter #20 */
+ .long tcpwm_1_interrupts_21_IRQHandler /* TCPWM #1, Counter #21 */
+ .long tcpwm_1_interrupts_22_IRQHandler /* TCPWM #1, Counter #22 */
+ .long tcpwm_1_interrupts_23_IRQHandler /* TCPWM #1, Counter #23 */
+ .long udb_interrupts_0_IRQHandler /* UDB Interrupt #0 */
+ .long udb_interrupts_1_IRQHandler /* UDB Interrupt #1 */
+ .long udb_interrupts_2_IRQHandler /* UDB Interrupt #2 */
+ .long udb_interrupts_3_IRQHandler /* UDB Interrupt #3 */
+ .long udb_interrupts_4_IRQHandler /* UDB Interrupt #4 */
+ .long udb_interrupts_5_IRQHandler /* UDB Interrupt #5 */
+ .long udb_interrupts_6_IRQHandler /* UDB Interrupt #6 */
+ .long udb_interrupts_7_IRQHandler /* UDB Interrupt #7 */
+ .long udb_interrupts_8_IRQHandler /* UDB Interrupt #8 */
+ .long udb_interrupts_9_IRQHandler /* UDB Interrupt #9 */
+ .long udb_interrupts_10_IRQHandler /* UDB Interrupt #10 */
+ .long udb_interrupts_11_IRQHandler /* UDB Interrupt #11 */
+ .long udb_interrupts_12_IRQHandler /* UDB Interrupt #12 */
+ .long udb_interrupts_13_IRQHandler /* UDB Interrupt #13 */
+ .long udb_interrupts_14_IRQHandler /* UDB Interrupt #14 */
+ .long udb_interrupts_15_IRQHandler /* UDB Interrupt #15 */
+ .long pass_interrupt_sar_IRQHandler /* SAR ADC interrupt */
+ .long audioss_interrupt_i2s_IRQHandler /* I2S Audio interrupt */
+ .long audioss_interrupt_pdm_IRQHandler /* PDM/PCM Audio interrupt */
+ .long profile_interrupt_IRQHandler /* Energy Profiler interrupt */
+ .long smif_interrupt_IRQHandler /* Serial Memory Interface interrupt */
+ .long usb_interrupt_hi_IRQHandler /* USB Interrupt */
+ .long usb_interrupt_med_IRQHandler /* USB Interrupt */
+ .long usb_interrupt_lo_IRQHandler /* USB Interrupt */
+ .long pass_interrupt_dacs_IRQHandler /* Consolidated interrrupt for all DACs */
+
+
+ .size __Vectors, . - __Vectors
+ .equ __VectorsSize, . - __Vectors
+
+ .section .ram_vectors
+ .align 2
+ .globl __ramVectors
+__ramVectors:
+ .space __VectorsSize
+ .size __ramVectors, . - __ramVectors
+
+
+ .text
+ .thumb
+ .thumb_func
+ .align 2
+
+ /*
+ * Device startup customization
+ *
+ * Note. The global resources are not yet initialized (for example global variables, peripherals, clocks)
+ * because this function is executed as the first instruction in the ResetHandler.
+ * The PDL is also not initialized to use the proper register offsets.
+ * The user of this function is responsible for initializing the PDL and resources before using them.
+ */
+ .weak Cy_OnResetUser
+ .func Cy_OnResetUser, Cy_OnResetUser
+ .type Cy_OnResetUser, %function
+
+Cy_OnResetUser:
+ bx lr
+ .size Cy_OnResetUser, . - Cy_OnResetUser
+ .endfunc
+
+ /* OS-specific low-level initialization */
+ .weak cy_toolchain_init
+ .func cy_toolchain_init, cy_toolchain_init
+ .type cy_toolchain_init, %function
+
+cy_toolchain_init:
+ bx lr
+ .size cy_toolchain_init, . - cy_toolchain_init
+ .endfunc
+
+ /* Reset handler */
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+
+Reset_Handler:
+ bl Cy_OnResetUser
+ cpsid i
+
+/* Firstly it copies data from read only memory to RAM. There are two schemes
+ * to copy. One can copy more than one sections. Another can only copy
+ * one section. The former scheme needs more instructions and read-only
+ * data to implement than the latter.
+ * Macro __STARTUP_COPY_MULTIPLE is used to choose between two schemes. */
+
+#ifdef __STARTUP_COPY_MULTIPLE
+/* Multiple sections scheme.
+ *
+ * Between symbol address __copy_table_start__ and __copy_table_end__,
+ * there are array of triplets, each of which specify:
+ * offset 0: LMA of start of a section to copy from
+ * offset 4: VMA of start of a section to copy to
+ * offset 8: size of the section to copy. Must be multiply of 4
+ *
+ * All addresses must be aligned to 4 bytes boundary.
+ */
+ ldr r4, =__copy_table_start__
+ ldr r5, =__copy_table_end__
+
+.L_loop0:
+ cmp r4, r5
+ bge .L_loop0_done
+ ldr r1, [r4]
+ ldr r2, [r4, #4]
+ ldr r3, [r4, #8]
+
+.L_loop0_0:
+ subs r3, #4
+ ittt ge
+ ldrge r0, [r1, r3]
+ strge r0, [r2, r3]
+ bge .L_loop0_0
+
+ adds r4, #12
+ b .L_loop0
+
+.L_loop0_done:
+#else
+/* Single section scheme.
+ *
+ * The ranges of copy from/to are specified by following symbols
+ * __etext: LMA of start of the section to copy from. Usually end of text
+ * __data_start__: VMA of start of the section to copy to
+ * __data_end__: VMA of end of the section to copy to
+ *
+ * All addresses must be aligned to 4 bytes boundary.
+ */
+ ldr r1, =__etext
+ ldr r2, =__data_start__
+ ldr r3, =__data_end__
+
+.L_loop1:
+ cmp r2, r3
+ ittt lt
+ ldrlt r0, [r1], #4
+ strlt r0, [r2], #4
+ blt .L_loop1
+#endif /*__STARTUP_COPY_MULTIPLE */
+
+/* This part of work usually is done in C library startup code. Otherwise,
+ * define this macro to enable it in this startup.
+ *
+ * There are two schemes too. One can clear multiple BSS sections. Another
+ * can only clear one section. The former is more size expensive than the
+ * latter.
+ *
+ * Define macro __STARTUP_CLEAR_BSS_MULTIPLE to choose the former.
+ * Otherwise define macro __STARTUP_CLEAR_BSS to choose the later.
+ */
+#ifdef __STARTUP_CLEAR_BSS_MULTIPLE
+/* Multiple sections scheme.
+ *
+ * Between symbol address __copy_table_start__ and __copy_table_end__,
+ * there are array of tuples specifying:
+ * offset 0: Start of a BSS section
+ * offset 4: Size of this BSS section. Must be multiply of 4
+ */
+ ldr r3, =__zero_table_start__
+ ldr r4, =__zero_table_end__
+
+.L_loop2:
+ cmp r3, r4
+ bge .L_loop2_done
+ ldr r1, [r3]
+ ldr r2, [r3, #4]
+ movs r0, 0
+
+.L_loop2_0:
+ subs r2, #4
+ itt ge
+ strge r0, [r1, r2]
+ bge .L_loop2_0
+
+ adds r3, #8
+ b .L_loop2
+.L_loop2_done:
+#elif defined (__STARTUP_CLEAR_BSS)
+/* Single BSS section scheme.
+ *
+ * The BSS section is specified by following symbols
+ * __bss_start__: start of the BSS section.
+ * __bss_end__: end of the BSS section.
+ *
+ * Both addresses must be aligned to 4 bytes boundary.
+ */
+ ldr r1, =__bss_start__
+ ldr r2, =__bss_end__
+
+ movs r0, 0
+.L_loop3:
+ cmp r1, r2
+ itt lt
+ strlt r0, [r1], #4
+ blt .L_loop3
+#endif /* __STARTUP_CLEAR_BSS_MULTIPLE || __STARTUP_CLEAR_BSS */
+
+ /* Update Vector Table Offset Register. */
+ ldr r0, =__ramVectors
+ ldr r1, =CY_CPU_VTOR_ADDR
+ str r0, [r1]
+ dsb 0xF
+
+ /* Enable the FPU if used */
+ bl Cy_SystemInitFpuEnable
+
+#ifndef __NO_SYSTEM_INIT
+ bl SystemInit
+#endif
+
+ /* OS-specific low-level initialization */
+ bl cy_toolchain_init
+
+ /* Call C/C++ static constructors */
+ bl __libc_init_array
+
+ /* Execute main application */
+ /*bl main */
+ bl entry
+
+ /* Call C/C++ static destructors */
+ bl __libc_fini_array
+
+ /* Should never get here */
+ b .
+
+ .pool
+ .size Reset_Handler, . - Reset_Handler
+
+ .align 1
+ .thumb_func
+ .weak Default_Handler
+ .type Default_Handler, %function
+
+Default_Handler:
+ b .
+ .size Default_Handler, . - Default_Handler
+
+
+ .weak Cy_SysLib_FaultHandler
+ .type Cy_SysLib_FaultHandler, %function
+
+Cy_SysLib_FaultHandler:
+ b .
+ .size Cy_SysLib_FaultHandler, . - Cy_SysLib_FaultHandler
+ .type Fault_Handler, %function
+
+Fault_Handler:
+ /* Storing LR content for Creator call stack trace */
+ push {LR}
+ movs r0, #4
+ mov r1, LR
+ tst r0, r1
+ beq .L_MSP
+ mrs r0, PSP
+ b .L_API_call
+.L_MSP:
+ mrs r0, MSP
+.L_API_call:
+ /* Compensation of stack pointer address due to pushing 4 bytes of LR */
+ adds r0, r0, #4
+ bl Cy_SysLib_FaultHandler
+ b .
+ .size Fault_Handler, . - Fault_Handler
+
+.macro def_fault_Handler fault_handler_name
+ .weak \fault_handler_name
+ .set \fault_handler_name, Fault_Handler
+ .endm
+
+/* Macro to define default handlers. Default handler
+ * will be weak symbol and just dead loops. They can be
+ * overwritten by other handlers */
+ .macro def_irq_handler handler_name
+ .weak \handler_name
+ .set \handler_name, Default_Handler
+ .endm
+
+ def_irq_handler NMI_Handler
+
+ def_fault_Handler HardFault_Handler
+ def_fault_Handler MemManage_Handler
+ def_fault_Handler BusFault_Handler
+ def_fault_Handler UsageFault_Handler
+
+ def_irq_handler SVC_Handler
+ def_irq_handler DebugMon_Handler
+ def_irq_handler PendSV_Handler
+ def_irq_handler SysTick_Handler
+
+ def_irq_handler ioss_interrupts_gpio_0_IRQHandler /* GPIO Port Interrupt #0 */
+ def_irq_handler ioss_interrupts_gpio_1_IRQHandler /* GPIO Port Interrupt #1 */
+ def_irq_handler ioss_interrupts_gpio_2_IRQHandler /* GPIO Port Interrupt #2 */
+ def_irq_handler ioss_interrupts_gpio_3_IRQHandler /* GPIO Port Interrupt #3 */
+ def_irq_handler ioss_interrupts_gpio_4_IRQHandler /* GPIO Port Interrupt #4 */
+ def_irq_handler ioss_interrupts_gpio_5_IRQHandler /* GPIO Port Interrupt #5 */
+ def_irq_handler ioss_interrupts_gpio_6_IRQHandler /* GPIO Port Interrupt #6 */
+ def_irq_handler ioss_interrupts_gpio_7_IRQHandler /* GPIO Port Interrupt #7 */
+ def_irq_handler ioss_interrupts_gpio_8_IRQHandler /* GPIO Port Interrupt #8 */
+ def_irq_handler ioss_interrupts_gpio_9_IRQHandler /* GPIO Port Interrupt #9 */
+ def_irq_handler ioss_interrupts_gpio_10_IRQHandler /* GPIO Port Interrupt #10 */
+ def_irq_handler ioss_interrupts_gpio_11_IRQHandler /* GPIO Port Interrupt #11 */
+ def_irq_handler ioss_interrupts_gpio_12_IRQHandler /* GPIO Port Interrupt #12 */
+ def_irq_handler ioss_interrupts_gpio_13_IRQHandler /* GPIO Port Interrupt #13 */
+ def_irq_handler ioss_interrupts_gpio_14_IRQHandler /* GPIO Port Interrupt #14 */
+ def_irq_handler ioss_interrupt_gpio_IRQHandler /* GPIO All Ports */
+ def_irq_handler ioss_interrupt_vdd_IRQHandler /* GPIO Supply Detect Interrupt */
+ def_irq_handler lpcomp_interrupt_IRQHandler /* Low Power Comparator Interrupt */
+ def_irq_handler scb_8_interrupt_IRQHandler /* Serial Communication Block #8 (DeepSleep capable) */
+ def_irq_handler srss_interrupt_mcwdt_0_IRQHandler /* Multi Counter Watchdog Timer interrupt */
+ def_irq_handler srss_interrupt_mcwdt_1_IRQHandler /* Multi Counter Watchdog Timer interrupt */
+ def_irq_handler srss_interrupt_backup_IRQHandler /* Backup domain interrupt */
+ def_irq_handler srss_interrupt_IRQHandler /* Other combined Interrupts for SRSS (LVD, WDT, CLKCAL) */
+ def_irq_handler pass_interrupt_ctbs_IRQHandler /* CTBm Interrupt (all CTBms) */
+ def_irq_handler bless_interrupt_IRQHandler /* Bluetooth Radio interrupt */
+ def_irq_handler cpuss_interrupts_ipc_0_IRQHandler /* CPUSS Inter Process Communication Interrupt #0 */
+ def_irq_handler cpuss_interrupts_ipc_1_IRQHandler /* CPUSS Inter Process Communication Interrupt #1 */
+ def_irq_handler cpuss_interrupts_ipc_2_IRQHandler /* CPUSS Inter Process Communication Interrupt #2 */
+ def_irq_handler cpuss_interrupts_ipc_3_IRQHandler /* CPUSS Inter Process Communication Interrupt #3 */
+ def_irq_handler cpuss_interrupts_ipc_4_IRQHandler /* CPUSS Inter Process Communication Interrupt #4 */
+ def_irq_handler cpuss_interrupts_ipc_5_IRQHandler /* CPUSS Inter Process Communication Interrupt #5 */
+ def_irq_handler cpuss_interrupts_ipc_6_IRQHandler /* CPUSS Inter Process Communication Interrupt #6 */
+ def_irq_handler cpuss_interrupts_ipc_7_IRQHandler /* CPUSS Inter Process Communication Interrupt #7 */
+ def_irq_handler cpuss_interrupts_ipc_8_IRQHandler /* CPUSS Inter Process Communication Interrupt #8 */
+ def_irq_handler cpuss_interrupts_ipc_9_IRQHandler /* CPUSS Inter Process Communication Interrupt #9 */
+ def_irq_handler cpuss_interrupts_ipc_10_IRQHandler /* CPUSS Inter Process Communication Interrupt #10 */
+ def_irq_handler cpuss_interrupts_ipc_11_IRQHandler /* CPUSS Inter Process Communication Interrupt #11 */
+ def_irq_handler cpuss_interrupts_ipc_12_IRQHandler /* CPUSS Inter Process Communication Interrupt #12 */
+ def_irq_handler cpuss_interrupts_ipc_13_IRQHandler /* CPUSS Inter Process Communication Interrupt #13 */
+ def_irq_handler cpuss_interrupts_ipc_14_IRQHandler /* CPUSS Inter Process Communication Interrupt #14 */
+ def_irq_handler cpuss_interrupts_ipc_15_IRQHandler /* CPUSS Inter Process Communication Interrupt #15 */
+ def_irq_handler scb_0_interrupt_IRQHandler /* Serial Communication Block #0 */
+ def_irq_handler scb_1_interrupt_IRQHandler /* Serial Communication Block #1 */
+ def_irq_handler scb_2_interrupt_IRQHandler /* Serial Communication Block #2 */
+ def_irq_handler scb_3_interrupt_IRQHandler /* Serial Communication Block #3 */
+ def_irq_handler scb_4_interrupt_IRQHandler /* Serial Communication Block #4 */
+ def_irq_handler scb_5_interrupt_IRQHandler /* Serial Communication Block #5 */
+ def_irq_handler scb_6_interrupt_IRQHandler /* Serial Communication Block #6 */
+ def_irq_handler scb_7_interrupt_IRQHandler /* Serial Communication Block #7 */
+ def_irq_handler csd_interrupt_IRQHandler /* CSD (Capsense) interrupt */
+ def_irq_handler cpuss_interrupts_dw0_0_IRQHandler /* CPUSS DataWire #0, Channel #0 */
+ def_irq_handler cpuss_interrupts_dw0_1_IRQHandler /* CPUSS DataWire #0, Channel #1 */
+ def_irq_handler cpuss_interrupts_dw0_2_IRQHandler /* CPUSS DataWire #0, Channel #2 */
+ def_irq_handler cpuss_interrupts_dw0_3_IRQHandler /* CPUSS DataWire #0, Channel #3 */
+ def_irq_handler cpuss_interrupts_dw0_4_IRQHandler /* CPUSS DataWire #0, Channel #4 */
+ def_irq_handler cpuss_interrupts_dw0_5_IRQHandler /* CPUSS DataWire #0, Channel #5 */
+ def_irq_handler cpuss_interrupts_dw0_6_IRQHandler /* CPUSS DataWire #0, Channel #6 */
+ def_irq_handler cpuss_interrupts_dw0_7_IRQHandler /* CPUSS DataWire #0, Channel #7 */
+ def_irq_handler cpuss_interrupts_dw0_8_IRQHandler /* CPUSS DataWire #0, Channel #8 */
+ def_irq_handler cpuss_interrupts_dw0_9_IRQHandler /* CPUSS DataWire #0, Channel #9 */
+ def_irq_handler cpuss_interrupts_dw0_10_IRQHandler /* CPUSS DataWire #0, Channel #10 */
+ def_irq_handler cpuss_interrupts_dw0_11_IRQHandler /* CPUSS DataWire #0, Channel #11 */
+ def_irq_handler cpuss_interrupts_dw0_12_IRQHandler /* CPUSS DataWire #0, Channel #12 */
+ def_irq_handler cpuss_interrupts_dw0_13_IRQHandler /* CPUSS DataWire #0, Channel #13 */
+ def_irq_handler cpuss_interrupts_dw0_14_IRQHandler /* CPUSS DataWire #0, Channel #14 */
+ def_irq_handler cpuss_interrupts_dw0_15_IRQHandler /* CPUSS DataWire #0, Channel #15 */
+ def_irq_handler cpuss_interrupts_dw1_0_IRQHandler /* CPUSS DataWire #1, Channel #0 */
+ def_irq_handler cpuss_interrupts_dw1_1_IRQHandler /* CPUSS DataWire #1, Channel #1 */
+ def_irq_handler cpuss_interrupts_dw1_2_IRQHandler /* CPUSS DataWire #1, Channel #2 */
+ def_irq_handler cpuss_interrupts_dw1_3_IRQHandler /* CPUSS DataWire #1, Channel #3 */
+ def_irq_handler cpuss_interrupts_dw1_4_IRQHandler /* CPUSS DataWire #1, Channel #4 */
+ def_irq_handler cpuss_interrupts_dw1_5_IRQHandler /* CPUSS DataWire #1, Channel #5 */
+ def_irq_handler cpuss_interrupts_dw1_6_IRQHandler /* CPUSS DataWire #1, Channel #6 */
+ def_irq_handler cpuss_interrupts_dw1_7_IRQHandler /* CPUSS DataWire #1, Channel #7 */
+ def_irq_handler cpuss_interrupts_dw1_8_IRQHandler /* CPUSS DataWire #1, Channel #8 */
+ def_irq_handler cpuss_interrupts_dw1_9_IRQHandler /* CPUSS DataWire #1, Channel #9 */
+ def_irq_handler cpuss_interrupts_dw1_10_IRQHandler /* CPUSS DataWire #1, Channel #10 */
+ def_irq_handler cpuss_interrupts_dw1_11_IRQHandler /* CPUSS DataWire #1, Channel #11 */
+ def_irq_handler cpuss_interrupts_dw1_12_IRQHandler /* CPUSS DataWire #1, Channel #12 */
+ def_irq_handler cpuss_interrupts_dw1_13_IRQHandler /* CPUSS DataWire #1, Channel #13 */
+ def_irq_handler cpuss_interrupts_dw1_14_IRQHandler /* CPUSS DataWire #1, Channel #14 */
+ def_irq_handler cpuss_interrupts_dw1_15_IRQHandler /* CPUSS DataWire #1, Channel #15 */
+ def_irq_handler cpuss_interrupts_fault_0_IRQHandler /* CPUSS Fault Structure Interrupt #0 */
+ def_irq_handler cpuss_interrupts_fault_1_IRQHandler /* CPUSS Fault Structure Interrupt #1 */
+ def_irq_handler cpuss_interrupt_crypto_IRQHandler /* CRYPTO Accelerator Interrupt */
+ def_irq_handler cpuss_interrupt_fm_IRQHandler /* FLASH Macro Interrupt */
+ def_irq_handler cpuss_interrupts_cm0_cti_0_IRQHandler /* CM0+ CTI #0 */
+ def_irq_handler cpuss_interrupts_cm0_cti_1_IRQHandler /* CM0+ CTI #1 */
+ def_irq_handler cpuss_interrupts_cm4_cti_0_IRQHandler /* CM4 CTI #0 */
+ def_irq_handler cpuss_interrupts_cm4_cti_1_IRQHandler /* CM4 CTI #1 */
+ def_irq_handler tcpwm_0_interrupts_0_IRQHandler /* TCPWM #0, Counter #0 */
+ def_irq_handler tcpwm_0_interrupts_1_IRQHandler /* TCPWM #0, Counter #1 */
+ def_irq_handler tcpwm_0_interrupts_2_IRQHandler /* TCPWM #0, Counter #2 */
+ def_irq_handler tcpwm_0_interrupts_3_IRQHandler /* TCPWM #0, Counter #3 */
+ def_irq_handler tcpwm_0_interrupts_4_IRQHandler /* TCPWM #0, Counter #4 */
+ def_irq_handler tcpwm_0_interrupts_5_IRQHandler /* TCPWM #0, Counter #5 */
+ def_irq_handler tcpwm_0_interrupts_6_IRQHandler /* TCPWM #0, Counter #6 */
+ def_irq_handler tcpwm_0_interrupts_7_IRQHandler /* TCPWM #0, Counter #7 */
+ def_irq_handler tcpwm_1_interrupts_0_IRQHandler /* TCPWM #1, Counter #0 */
+ def_irq_handler tcpwm_1_interrupts_1_IRQHandler /* TCPWM #1, Counter #1 */
+ def_irq_handler tcpwm_1_interrupts_2_IRQHandler /* TCPWM #1, Counter #2 */
+ def_irq_handler tcpwm_1_interrupts_3_IRQHandler /* TCPWM #1, Counter #3 */
+ def_irq_handler tcpwm_1_interrupts_4_IRQHandler /* TCPWM #1, Counter #4 */
+ def_irq_handler tcpwm_1_interrupts_5_IRQHandler /* TCPWM #1, Counter #5 */
+ def_irq_handler tcpwm_1_interrupts_6_IRQHandler /* TCPWM #1, Counter #6 */
+ def_irq_handler tcpwm_1_interrupts_7_IRQHandler /* TCPWM #1, Counter #7 */
+ def_irq_handler tcpwm_1_interrupts_8_IRQHandler /* TCPWM #1, Counter #8 */
+ def_irq_handler tcpwm_1_interrupts_9_IRQHandler /* TCPWM #1, Counter #9 */
+ def_irq_handler tcpwm_1_interrupts_10_IRQHandler /* TCPWM #1, Counter #10 */
+ def_irq_handler tcpwm_1_interrupts_11_IRQHandler /* TCPWM #1, Counter #11 */
+ def_irq_handler tcpwm_1_interrupts_12_IRQHandler /* TCPWM #1, Counter #12 */
+ def_irq_handler tcpwm_1_interrupts_13_IRQHandler /* TCPWM #1, Counter #13 */
+ def_irq_handler tcpwm_1_interrupts_14_IRQHandler /* TCPWM #1, Counter #14 */
+ def_irq_handler tcpwm_1_interrupts_15_IRQHandler /* TCPWM #1, Counter #15 */
+ def_irq_handler tcpwm_1_interrupts_16_IRQHandler /* TCPWM #1, Counter #16 */
+ def_irq_handler tcpwm_1_interrupts_17_IRQHandler /* TCPWM #1, Counter #17 */
+ def_irq_handler tcpwm_1_interrupts_18_IRQHandler /* TCPWM #1, Counter #18 */
+ def_irq_handler tcpwm_1_interrupts_19_IRQHandler /* TCPWM #1, Counter #19 */
+ def_irq_handler tcpwm_1_interrupts_20_IRQHandler /* TCPWM #1, Counter #20 */
+ def_irq_handler tcpwm_1_interrupts_21_IRQHandler /* TCPWM #1, Counter #21 */
+ def_irq_handler tcpwm_1_interrupts_22_IRQHandler /* TCPWM #1, Counter #22 */
+ def_irq_handler tcpwm_1_interrupts_23_IRQHandler /* TCPWM #1, Counter #23 */
+ def_irq_handler udb_interrupts_0_IRQHandler /* UDB Interrupt #0 */
+ def_irq_handler udb_interrupts_1_IRQHandler /* UDB Interrupt #1 */
+ def_irq_handler udb_interrupts_2_IRQHandler /* UDB Interrupt #2 */
+ def_irq_handler udb_interrupts_3_IRQHandler /* UDB Interrupt #3 */
+ def_irq_handler udb_interrupts_4_IRQHandler /* UDB Interrupt #4 */
+ def_irq_handler udb_interrupts_5_IRQHandler /* UDB Interrupt #5 */
+ def_irq_handler udb_interrupts_6_IRQHandler /* UDB Interrupt #6 */
+ def_irq_handler udb_interrupts_7_IRQHandler /* UDB Interrupt #7 */
+ def_irq_handler udb_interrupts_8_IRQHandler /* UDB Interrupt #8 */
+ def_irq_handler udb_interrupts_9_IRQHandler /* UDB Interrupt #9 */
+ def_irq_handler udb_interrupts_10_IRQHandler /* UDB Interrupt #10 */
+ def_irq_handler udb_interrupts_11_IRQHandler /* UDB Interrupt #11 */
+ def_irq_handler udb_interrupts_12_IRQHandler /* UDB Interrupt #12 */
+ def_irq_handler udb_interrupts_13_IRQHandler /* UDB Interrupt #13 */
+ def_irq_handler udb_interrupts_14_IRQHandler /* UDB Interrupt #14 */
+ def_irq_handler udb_interrupts_15_IRQHandler /* UDB Interrupt #15 */
+ def_irq_handler pass_interrupt_sar_IRQHandler /* SAR ADC interrupt */
+ def_irq_handler audioss_interrupt_i2s_IRQHandler /* I2S Audio interrupt */
+ def_irq_handler audioss_interrupt_pdm_IRQHandler /* PDM/PCM Audio interrupt */
+ def_irq_handler profile_interrupt_IRQHandler /* Energy Profiler interrupt */
+ def_irq_handler smif_interrupt_IRQHandler /* Serial Memory Interface interrupt */
+ def_irq_handler usb_interrupt_hi_IRQHandler /* USB Interrupt */
+ def_irq_handler usb_interrupt_med_IRQHandler /* USB Interrupt */
+ def_irq_handler usb_interrupt_lo_IRQHandler /* USB Interrupt */
+ def_irq_handler pass_interrupt_dacs_IRQHandler /* Consolidated interrrupt for all DACs */
+
+ .end
+
+
+/* [] END OF FILE */
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_IAR/startup_psoc6_01_cm4.s b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_IAR/startup_psoc6_01_cm4.s
new file mode 100644
index 0000000000000000000000000000000000000000..2ce41f1064f252eb4fe6ccd02076bfbbea6ff3b9
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/TOOLCHAIN_IAR/startup_psoc6_01_cm4.s
@@ -0,0 +1,1150 @@
+;/**************************************************************************//**
+; * @file startup_psoc6_01_cm4.s
+; * @brief CMSIS Core Device Startup File for
+; * ARMCM4 Device Series
+; * @version V5.00
+; * @date 08. March 2016
+; ******************************************************************************/
+;/*
+; * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
+; *
+; * SPDX-License-Identifier: Apache-2.0
+; *
+; * Licensed 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
+; *
+; * 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.
+; */
+
+;
+; The modules in this file are included in the libraries, and may be replaced
+; by any user-defined modules that define the PUBLIC symbol _program_start or
+; a user defined start symbol.
+; To override the cstartup defined in the library, simply add your modified
+; version to the workbench project.
+;
+; The vector table is normally located at address 0.
+; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
+; The name "__vector_table" has special meaning for C-SPY:
+; it is where the SP start value is found, and the NVIC vector
+; table register (VTOR) is initialized to this address if != 0.
+;
+; Cortex-M version
+;
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+ SECTION .intvec_ram:DATA:NOROOT(2)
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ EXTERN Cy_SystemInitFpuEnable
+ EXTERN __iar_data_init3
+ PUBLIC __vector_table
+ PUBLIC __vector_table_0x1c
+ PUBLIC __Vectors
+ PUBLIC __Vectors_End
+ PUBLIC __Vectors_Size
+ PUBLIC __ramVectors
+
+ DATA
+
+__vector_table
+ DCD sfe(CSTACK)
+ DCD Reset_Handler
+
+ DCD 0x0000000D ; NMI_Handler is defined in ROM code
+ DCD HardFault_Handler
+ DCD MemManage_Handler
+ DCD BusFault_Handler
+ DCD UsageFault_Handler
+__vector_table_0x1c
+ DCD 0
+ DCD 0
+ DCD 0
+ DCD 0
+ DCD SVC_Handler
+ DCD DebugMon_Handler
+ DCD 0
+ DCD PendSV_Handler
+ DCD SysTick_Handler
+
+ ; External interrupts Description
+ DCD ioss_interrupts_gpio_0_IRQHandler ; GPIO Port Interrupt #0
+ DCD ioss_interrupts_gpio_1_IRQHandler ; GPIO Port Interrupt #1
+ DCD ioss_interrupts_gpio_2_IRQHandler ; GPIO Port Interrupt #2
+ DCD ioss_interrupts_gpio_3_IRQHandler ; GPIO Port Interrupt #3
+ DCD ioss_interrupts_gpio_4_IRQHandler ; GPIO Port Interrupt #4
+ DCD ioss_interrupts_gpio_5_IRQHandler ; GPIO Port Interrupt #5
+ DCD ioss_interrupts_gpio_6_IRQHandler ; GPIO Port Interrupt #6
+ DCD ioss_interrupts_gpio_7_IRQHandler ; GPIO Port Interrupt #7
+ DCD ioss_interrupts_gpio_8_IRQHandler ; GPIO Port Interrupt #8
+ DCD ioss_interrupts_gpio_9_IRQHandler ; GPIO Port Interrupt #9
+ DCD ioss_interrupts_gpio_10_IRQHandler ; GPIO Port Interrupt #10
+ DCD ioss_interrupts_gpio_11_IRQHandler ; GPIO Port Interrupt #11
+ DCD ioss_interrupts_gpio_12_IRQHandler ; GPIO Port Interrupt #12
+ DCD ioss_interrupts_gpio_13_IRQHandler ; GPIO Port Interrupt #13
+ DCD ioss_interrupts_gpio_14_IRQHandler ; GPIO Port Interrupt #14
+ DCD ioss_interrupt_gpio_IRQHandler ; GPIO All Ports
+ DCD ioss_interrupt_vdd_IRQHandler ; GPIO Supply Detect Interrupt
+ DCD lpcomp_interrupt_IRQHandler ; Low Power Comparator Interrupt
+ DCD scb_8_interrupt_IRQHandler ; Serial Communication Block #8 (DeepSleep capable)
+ DCD srss_interrupt_mcwdt_0_IRQHandler ; Multi Counter Watchdog Timer interrupt
+ DCD srss_interrupt_mcwdt_1_IRQHandler ; Multi Counter Watchdog Timer interrupt
+ DCD srss_interrupt_backup_IRQHandler ; Backup domain interrupt
+ DCD srss_interrupt_IRQHandler ; Other combined Interrupts for SRSS (LVD, WDT, CLKCAL)
+ DCD pass_interrupt_ctbs_IRQHandler ; CTBm Interrupt (all CTBms)
+ DCD bless_interrupt_IRQHandler ; Bluetooth Radio interrupt
+ DCD cpuss_interrupts_ipc_0_IRQHandler ; CPUSS Inter Process Communication Interrupt #0
+ DCD cpuss_interrupts_ipc_1_IRQHandler ; CPUSS Inter Process Communication Interrupt #1
+ DCD cpuss_interrupts_ipc_2_IRQHandler ; CPUSS Inter Process Communication Interrupt #2
+ DCD cpuss_interrupts_ipc_3_IRQHandler ; CPUSS Inter Process Communication Interrupt #3
+ DCD cpuss_interrupts_ipc_4_IRQHandler ; CPUSS Inter Process Communication Interrupt #4
+ DCD cpuss_interrupts_ipc_5_IRQHandler ; CPUSS Inter Process Communication Interrupt #5
+ DCD cpuss_interrupts_ipc_6_IRQHandler ; CPUSS Inter Process Communication Interrupt #6
+ DCD cpuss_interrupts_ipc_7_IRQHandler ; CPUSS Inter Process Communication Interrupt #7
+ DCD cpuss_interrupts_ipc_8_IRQHandler ; CPUSS Inter Process Communication Interrupt #8
+ DCD cpuss_interrupts_ipc_9_IRQHandler ; CPUSS Inter Process Communication Interrupt #9
+ DCD cpuss_interrupts_ipc_10_IRQHandler ; CPUSS Inter Process Communication Interrupt #10
+ DCD cpuss_interrupts_ipc_11_IRQHandler ; CPUSS Inter Process Communication Interrupt #11
+ DCD cpuss_interrupts_ipc_12_IRQHandler ; CPUSS Inter Process Communication Interrupt #12
+ DCD cpuss_interrupts_ipc_13_IRQHandler ; CPUSS Inter Process Communication Interrupt #13
+ DCD cpuss_interrupts_ipc_14_IRQHandler ; CPUSS Inter Process Communication Interrupt #14
+ DCD cpuss_interrupts_ipc_15_IRQHandler ; CPUSS Inter Process Communication Interrupt #15
+ DCD scb_0_interrupt_IRQHandler ; Serial Communication Block #0
+ DCD scb_1_interrupt_IRQHandler ; Serial Communication Block #1
+ DCD scb_2_interrupt_IRQHandler ; Serial Communication Block #2
+ DCD scb_3_interrupt_IRQHandler ; Serial Communication Block #3
+ DCD scb_4_interrupt_IRQHandler ; Serial Communication Block #4
+ DCD scb_5_interrupt_IRQHandler ; Serial Communication Block #5
+ DCD scb_6_interrupt_IRQHandler ; Serial Communication Block #6
+ DCD scb_7_interrupt_IRQHandler ; Serial Communication Block #7
+ DCD csd_interrupt_IRQHandler ; CSD (Capsense) interrupt
+ DCD cpuss_interrupts_dw0_0_IRQHandler ; CPUSS DataWire #0, Channel #0
+ DCD cpuss_interrupts_dw0_1_IRQHandler ; CPUSS DataWire #0, Channel #1
+ DCD cpuss_interrupts_dw0_2_IRQHandler ; CPUSS DataWire #0, Channel #2
+ DCD cpuss_interrupts_dw0_3_IRQHandler ; CPUSS DataWire #0, Channel #3
+ DCD cpuss_interrupts_dw0_4_IRQHandler ; CPUSS DataWire #0, Channel #4
+ DCD cpuss_interrupts_dw0_5_IRQHandler ; CPUSS DataWire #0, Channel #5
+ DCD cpuss_interrupts_dw0_6_IRQHandler ; CPUSS DataWire #0, Channel #6
+ DCD cpuss_interrupts_dw0_7_IRQHandler ; CPUSS DataWire #0, Channel #7
+ DCD cpuss_interrupts_dw0_8_IRQHandler ; CPUSS DataWire #0, Channel #8
+ DCD cpuss_interrupts_dw0_9_IRQHandler ; CPUSS DataWire #0, Channel #9
+ DCD cpuss_interrupts_dw0_10_IRQHandler ; CPUSS DataWire #0, Channel #10
+ DCD cpuss_interrupts_dw0_11_IRQHandler ; CPUSS DataWire #0, Channel #11
+ DCD cpuss_interrupts_dw0_12_IRQHandler ; CPUSS DataWire #0, Channel #12
+ DCD cpuss_interrupts_dw0_13_IRQHandler ; CPUSS DataWire #0, Channel #13
+ DCD cpuss_interrupts_dw0_14_IRQHandler ; CPUSS DataWire #0, Channel #14
+ DCD cpuss_interrupts_dw0_15_IRQHandler ; CPUSS DataWire #0, Channel #15
+ DCD cpuss_interrupts_dw1_0_IRQHandler ; CPUSS DataWire #1, Channel #0
+ DCD cpuss_interrupts_dw1_1_IRQHandler ; CPUSS DataWire #1, Channel #1
+ DCD cpuss_interrupts_dw1_2_IRQHandler ; CPUSS DataWire #1, Channel #2
+ DCD cpuss_interrupts_dw1_3_IRQHandler ; CPUSS DataWire #1, Channel #3
+ DCD cpuss_interrupts_dw1_4_IRQHandler ; CPUSS DataWire #1, Channel #4
+ DCD cpuss_interrupts_dw1_5_IRQHandler ; CPUSS DataWire #1, Channel #5
+ DCD cpuss_interrupts_dw1_6_IRQHandler ; CPUSS DataWire #1, Channel #6
+ DCD cpuss_interrupts_dw1_7_IRQHandler ; CPUSS DataWire #1, Channel #7
+ DCD cpuss_interrupts_dw1_8_IRQHandler ; CPUSS DataWire #1, Channel #8
+ DCD cpuss_interrupts_dw1_9_IRQHandler ; CPUSS DataWire #1, Channel #9
+ DCD cpuss_interrupts_dw1_10_IRQHandler ; CPUSS DataWire #1, Channel #10
+ DCD cpuss_interrupts_dw1_11_IRQHandler ; CPUSS DataWire #1, Channel #11
+ DCD cpuss_interrupts_dw1_12_IRQHandler ; CPUSS DataWire #1, Channel #12
+ DCD cpuss_interrupts_dw1_13_IRQHandler ; CPUSS DataWire #1, Channel #13
+ DCD cpuss_interrupts_dw1_14_IRQHandler ; CPUSS DataWire #1, Channel #14
+ DCD cpuss_interrupts_dw1_15_IRQHandler ; CPUSS DataWire #1, Channel #15
+ DCD cpuss_interrupts_fault_0_IRQHandler ; CPUSS Fault Structure Interrupt #0
+ DCD cpuss_interrupts_fault_1_IRQHandler ; CPUSS Fault Structure Interrupt #1
+ DCD cpuss_interrupt_crypto_IRQHandler ; CRYPTO Accelerator Interrupt
+ DCD cpuss_interrupt_fm_IRQHandler ; FLASH Macro Interrupt
+ DCD cpuss_interrupts_cm0_cti_0_IRQHandler ; CM0+ CTI #0
+ DCD cpuss_interrupts_cm0_cti_1_IRQHandler ; CM0+ CTI #1
+ DCD cpuss_interrupts_cm4_cti_0_IRQHandler ; CM4 CTI #0
+ DCD cpuss_interrupts_cm4_cti_1_IRQHandler ; CM4 CTI #1
+ DCD tcpwm_0_interrupts_0_IRQHandler ; TCPWM #0, Counter #0
+ DCD tcpwm_0_interrupts_1_IRQHandler ; TCPWM #0, Counter #1
+ DCD tcpwm_0_interrupts_2_IRQHandler ; TCPWM #0, Counter #2
+ DCD tcpwm_0_interrupts_3_IRQHandler ; TCPWM #0, Counter #3
+ DCD tcpwm_0_interrupts_4_IRQHandler ; TCPWM #0, Counter #4
+ DCD tcpwm_0_interrupts_5_IRQHandler ; TCPWM #0, Counter #5
+ DCD tcpwm_0_interrupts_6_IRQHandler ; TCPWM #0, Counter #6
+ DCD tcpwm_0_interrupts_7_IRQHandler ; TCPWM #0, Counter #7
+ DCD tcpwm_1_interrupts_0_IRQHandler ; TCPWM #1, Counter #0
+ DCD tcpwm_1_interrupts_1_IRQHandler ; TCPWM #1, Counter #1
+ DCD tcpwm_1_interrupts_2_IRQHandler ; TCPWM #1, Counter #2
+ DCD tcpwm_1_interrupts_3_IRQHandler ; TCPWM #1, Counter #3
+ DCD tcpwm_1_interrupts_4_IRQHandler ; TCPWM #1, Counter #4
+ DCD tcpwm_1_interrupts_5_IRQHandler ; TCPWM #1, Counter #5
+ DCD tcpwm_1_interrupts_6_IRQHandler ; TCPWM #1, Counter #6
+ DCD tcpwm_1_interrupts_7_IRQHandler ; TCPWM #1, Counter #7
+ DCD tcpwm_1_interrupts_8_IRQHandler ; TCPWM #1, Counter #8
+ DCD tcpwm_1_interrupts_9_IRQHandler ; TCPWM #1, Counter #9
+ DCD tcpwm_1_interrupts_10_IRQHandler ; TCPWM #1, Counter #10
+ DCD tcpwm_1_interrupts_11_IRQHandler ; TCPWM #1, Counter #11
+ DCD tcpwm_1_interrupts_12_IRQHandler ; TCPWM #1, Counter #12
+ DCD tcpwm_1_interrupts_13_IRQHandler ; TCPWM #1, Counter #13
+ DCD tcpwm_1_interrupts_14_IRQHandler ; TCPWM #1, Counter #14
+ DCD tcpwm_1_interrupts_15_IRQHandler ; TCPWM #1, Counter #15
+ DCD tcpwm_1_interrupts_16_IRQHandler ; TCPWM #1, Counter #16
+ DCD tcpwm_1_interrupts_17_IRQHandler ; TCPWM #1, Counter #17
+ DCD tcpwm_1_interrupts_18_IRQHandler ; TCPWM #1, Counter #18
+ DCD tcpwm_1_interrupts_19_IRQHandler ; TCPWM #1, Counter #19
+ DCD tcpwm_1_interrupts_20_IRQHandler ; TCPWM #1, Counter #20
+ DCD tcpwm_1_interrupts_21_IRQHandler ; TCPWM #1, Counter #21
+ DCD tcpwm_1_interrupts_22_IRQHandler ; TCPWM #1, Counter #22
+ DCD tcpwm_1_interrupts_23_IRQHandler ; TCPWM #1, Counter #23
+ DCD udb_interrupts_0_IRQHandler ; UDB Interrupt #0
+ DCD udb_interrupts_1_IRQHandler ; UDB Interrupt #1
+ DCD udb_interrupts_2_IRQHandler ; UDB Interrupt #2
+ DCD udb_interrupts_3_IRQHandler ; UDB Interrupt #3
+ DCD udb_interrupts_4_IRQHandler ; UDB Interrupt #4
+ DCD udb_interrupts_5_IRQHandler ; UDB Interrupt #5
+ DCD udb_interrupts_6_IRQHandler ; UDB Interrupt #6
+ DCD udb_interrupts_7_IRQHandler ; UDB Interrupt #7
+ DCD udb_interrupts_8_IRQHandler ; UDB Interrupt #8
+ DCD udb_interrupts_9_IRQHandler ; UDB Interrupt #9
+ DCD udb_interrupts_10_IRQHandler ; UDB Interrupt #10
+ DCD udb_interrupts_11_IRQHandler ; UDB Interrupt #11
+ DCD udb_interrupts_12_IRQHandler ; UDB Interrupt #12
+ DCD udb_interrupts_13_IRQHandler ; UDB Interrupt #13
+ DCD udb_interrupts_14_IRQHandler ; UDB Interrupt #14
+ DCD udb_interrupts_15_IRQHandler ; UDB Interrupt #15
+ DCD pass_interrupt_sar_IRQHandler ; SAR ADC interrupt
+ DCD audioss_interrupt_i2s_IRQHandler ; I2S Audio interrupt
+ DCD audioss_interrupt_pdm_IRQHandler ; PDM/PCM Audio interrupt
+ DCD profile_interrupt_IRQHandler ; Energy Profiler interrupt
+ DCD smif_interrupt_IRQHandler ; Serial Memory Interface interrupt
+ DCD usb_interrupt_hi_IRQHandler ; USB Interrupt
+ DCD usb_interrupt_med_IRQHandler ; USB Interrupt
+ DCD usb_interrupt_lo_IRQHandler ; USB Interrupt
+ DCD pass_interrupt_dacs_IRQHandler ; Consolidated interrrupt for all DACs
+
+__Vectors_End
+
+__Vectors EQU __vector_table
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ SECTION .intvec_ram:DATA:REORDER:NOROOT(2)
+__ramVectors
+ DS32 __Vectors_Size
+
+
+ THUMB
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default handlers
+;;
+ PUBWEAK Default_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Default_Handler
+ B Default_Handler
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Weak function for startup customization
+;;
+;; Note. The global resources are not yet initialized (for example global variables, peripherals, clocks)
+;; because this function is executed as the first instruction in the ResetHandler.
+;; The PDL is also not initialized to use the proper register offsets.
+;; The user of this function is responsible for initializing the PDL and resources before using them.
+;;
+ PUBWEAK Cy_OnResetUser
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Cy_OnResetUser
+ BX LR
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Weak function for OS-specific customization
+;;
+ PUBWEAK cy_toolchain_init
+ SECTION .text:CODE:REORDER:NOROOT(2)
+cy_toolchain_init
+ BX LR
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Define strong version to return zero for
+;; __iar_program_start to skip data sections
+;; initialization.
+;;
+ PUBLIC __low_level_init
+ SECTION .text:CODE:REORDER:NOROOT(2)
+__low_level_init
+ MOVS R0, #0
+ BX LR
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+Reset_Handler
+
+ ; Define strong function for startup customization
+ LDR R0, =Cy_OnResetUser
+ BLX R0
+
+ ; Disable global interrupts
+ CPSID I
+
+ ; Copy vectors from ROM to RAM
+ LDR r1, =__vector_table
+ LDR r0, =__ramVectors
+ LDR r2, =__Vectors_Size
+intvec_copy
+ LDR r3, [r1]
+ STR r3, [r0]
+ ADDS r0, r0, #4
+ ADDS r1, r1, #4
+ SUBS r2, r2, #1
+ CMP r2, #0
+ BNE intvec_copy
+
+ ; Update Vector Table Offset Register
+ LDR r0, =__ramVectors
+ LDR r1, =0xE000ED08
+ STR r0, [r1]
+ dsb
+
+ ; OS-specific low-level initialization
+ LDR R0, =cy_toolchain_init
+ BLX R0
+
+ ; Initialize data sections
+ LDR R0, =__iar_data_init3
+ BLX R0
+
+ LDR R0, =SystemInit
+ BLX R0
+
+ LDR R0, =__iar_program_start
+ BLX R0
+
+; Should never get here
+Cy_Main_Exited
+ B Cy_Main_Exited
+
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+NMI_Handler
+ B NMI_Handler
+
+
+ PUBWEAK Cy_SysLib_FaultHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+Cy_SysLib_FaultHandler
+ B Cy_SysLib_FaultHandler
+
+ PUBWEAK HardFault_Wrapper
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Wrapper
+ IMPORT Cy_SysLib_FaultHandler
+ movs r0, #4
+ mov r1, LR
+ tst r0, r1
+ beq L_MSP
+ mrs r0, PSP
+ b L_API_call
+L_MSP
+ mrs r0, MSP
+L_API_call
+ ; Storing LR content for Creator call stack trace
+ push {LR}
+ bl Cy_SysLib_FaultHandler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+HardFault_Handler
+ B HardFault_Wrapper
+
+ PUBWEAK MemManage_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+MemManage_Handler
+ B HardFault_Wrapper
+
+ PUBWEAK BusFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+BusFault_Handler
+ B HardFault_Wrapper
+
+ PUBWEAK UsageFault_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+UsageFault_Handler
+ B HardFault_Wrapper
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK DebugMon_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+DebugMon_Handler
+ B DebugMon_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+SysTick_Handler
+ B SysTick_Handler
+
+
+ ; External interrupts
+ PUBWEAK ioss_interrupts_gpio_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_0_IRQHandler
+ B ioss_interrupts_gpio_0_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_1_IRQHandler
+ B ioss_interrupts_gpio_1_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_2_IRQHandler
+ B ioss_interrupts_gpio_2_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_3_IRQHandler
+ B ioss_interrupts_gpio_3_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_4_IRQHandler
+ B ioss_interrupts_gpio_4_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_5_IRQHandler
+ B ioss_interrupts_gpio_5_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_6_IRQHandler
+ B ioss_interrupts_gpio_6_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_7_IRQHandler
+ B ioss_interrupts_gpio_7_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_8_IRQHandler
+ B ioss_interrupts_gpio_8_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_9_IRQHandler
+ B ioss_interrupts_gpio_9_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_10_IRQHandler
+ B ioss_interrupts_gpio_10_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_11_IRQHandler
+ B ioss_interrupts_gpio_11_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_12_IRQHandler
+ B ioss_interrupts_gpio_12_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_13_IRQHandler
+ B ioss_interrupts_gpio_13_IRQHandler
+
+ PUBWEAK ioss_interrupts_gpio_14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupts_gpio_14_IRQHandler
+ B ioss_interrupts_gpio_14_IRQHandler
+
+ PUBWEAK ioss_interrupt_gpio_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupt_gpio_IRQHandler
+ B ioss_interrupt_gpio_IRQHandler
+
+ PUBWEAK ioss_interrupt_vdd_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+ioss_interrupt_vdd_IRQHandler
+ B ioss_interrupt_vdd_IRQHandler
+
+ PUBWEAK lpcomp_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+lpcomp_interrupt_IRQHandler
+ B lpcomp_interrupt_IRQHandler
+
+ PUBWEAK scb_8_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+scb_8_interrupt_IRQHandler
+ B scb_8_interrupt_IRQHandler
+
+ PUBWEAK srss_interrupt_mcwdt_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+srss_interrupt_mcwdt_0_IRQHandler
+ B srss_interrupt_mcwdt_0_IRQHandler
+
+ PUBWEAK srss_interrupt_mcwdt_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+srss_interrupt_mcwdt_1_IRQHandler
+ B srss_interrupt_mcwdt_1_IRQHandler
+
+ PUBWEAK srss_interrupt_backup_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+srss_interrupt_backup_IRQHandler
+ B srss_interrupt_backup_IRQHandler
+
+ PUBWEAK srss_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+srss_interrupt_IRQHandler
+ B srss_interrupt_IRQHandler
+
+ PUBWEAK pass_interrupt_ctbs_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+pass_interrupt_ctbs_IRQHandler
+ B pass_interrupt_ctbs_IRQHandler
+
+ PUBWEAK bless_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+bless_interrupt_IRQHandler
+ B bless_interrupt_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_0_IRQHandler
+ B cpuss_interrupts_ipc_0_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_1_IRQHandler
+ B cpuss_interrupts_ipc_1_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_2_IRQHandler
+ B cpuss_interrupts_ipc_2_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_3_IRQHandler
+ B cpuss_interrupts_ipc_3_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_4_IRQHandler
+ B cpuss_interrupts_ipc_4_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_5_IRQHandler
+ B cpuss_interrupts_ipc_5_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_6_IRQHandler
+ B cpuss_interrupts_ipc_6_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_7_IRQHandler
+ B cpuss_interrupts_ipc_7_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_8_IRQHandler
+ B cpuss_interrupts_ipc_8_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_9_IRQHandler
+ B cpuss_interrupts_ipc_9_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_10_IRQHandler
+ B cpuss_interrupts_ipc_10_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_11_IRQHandler
+ B cpuss_interrupts_ipc_11_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_12_IRQHandler
+ B cpuss_interrupts_ipc_12_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_13_IRQHandler
+ B cpuss_interrupts_ipc_13_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_14_IRQHandler
+ B cpuss_interrupts_ipc_14_IRQHandler
+
+ PUBWEAK cpuss_interrupts_ipc_15_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_ipc_15_IRQHandler
+ B cpuss_interrupts_ipc_15_IRQHandler
+
+ PUBWEAK scb_0_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+scb_0_interrupt_IRQHandler
+ B scb_0_interrupt_IRQHandler
+
+ PUBWEAK scb_1_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+scb_1_interrupt_IRQHandler
+ B scb_1_interrupt_IRQHandler
+
+ PUBWEAK scb_2_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+scb_2_interrupt_IRQHandler
+ B scb_2_interrupt_IRQHandler
+
+ PUBWEAK scb_3_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+scb_3_interrupt_IRQHandler
+ B scb_3_interrupt_IRQHandler
+
+ PUBWEAK scb_4_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+scb_4_interrupt_IRQHandler
+ B scb_4_interrupt_IRQHandler
+
+ PUBWEAK scb_5_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+scb_5_interrupt_IRQHandler
+ B scb_5_interrupt_IRQHandler
+
+ PUBWEAK scb_6_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+scb_6_interrupt_IRQHandler
+ B scb_6_interrupt_IRQHandler
+
+ PUBWEAK scb_7_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+scb_7_interrupt_IRQHandler
+ B scb_7_interrupt_IRQHandler
+
+ PUBWEAK csd_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+csd_interrupt_IRQHandler
+ B csd_interrupt_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_0_IRQHandler
+ B cpuss_interrupts_dw0_0_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_1_IRQHandler
+ B cpuss_interrupts_dw0_1_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_2_IRQHandler
+ B cpuss_interrupts_dw0_2_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_3_IRQHandler
+ B cpuss_interrupts_dw0_3_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_4_IRQHandler
+ B cpuss_interrupts_dw0_4_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_5_IRQHandler
+ B cpuss_interrupts_dw0_5_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_6_IRQHandler
+ B cpuss_interrupts_dw0_6_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_7_IRQHandler
+ B cpuss_interrupts_dw0_7_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_8_IRQHandler
+ B cpuss_interrupts_dw0_8_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_9_IRQHandler
+ B cpuss_interrupts_dw0_9_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_10_IRQHandler
+ B cpuss_interrupts_dw0_10_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_11_IRQHandler
+ B cpuss_interrupts_dw0_11_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_12_IRQHandler
+ B cpuss_interrupts_dw0_12_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_13_IRQHandler
+ B cpuss_interrupts_dw0_13_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_14_IRQHandler
+ B cpuss_interrupts_dw0_14_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw0_15_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw0_15_IRQHandler
+ B cpuss_interrupts_dw0_15_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_0_IRQHandler
+ B cpuss_interrupts_dw1_0_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_1_IRQHandler
+ B cpuss_interrupts_dw1_1_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_2_IRQHandler
+ B cpuss_interrupts_dw1_2_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_3_IRQHandler
+ B cpuss_interrupts_dw1_3_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_4_IRQHandler
+ B cpuss_interrupts_dw1_4_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_5_IRQHandler
+ B cpuss_interrupts_dw1_5_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_6_IRQHandler
+ B cpuss_interrupts_dw1_6_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_7_IRQHandler
+ B cpuss_interrupts_dw1_7_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_8_IRQHandler
+ B cpuss_interrupts_dw1_8_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_9_IRQHandler
+ B cpuss_interrupts_dw1_9_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_10_IRQHandler
+ B cpuss_interrupts_dw1_10_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_11_IRQHandler
+ B cpuss_interrupts_dw1_11_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_12_IRQHandler
+ B cpuss_interrupts_dw1_12_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_13_IRQHandler
+ B cpuss_interrupts_dw1_13_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_14_IRQHandler
+ B cpuss_interrupts_dw1_14_IRQHandler
+
+ PUBWEAK cpuss_interrupts_dw1_15_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_dw1_15_IRQHandler
+ B cpuss_interrupts_dw1_15_IRQHandler
+
+ PUBWEAK cpuss_interrupts_fault_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_fault_0_IRQHandler
+ B cpuss_interrupts_fault_0_IRQHandler
+
+ PUBWEAK cpuss_interrupts_fault_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_fault_1_IRQHandler
+ B cpuss_interrupts_fault_1_IRQHandler
+
+ PUBWEAK cpuss_interrupt_crypto_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupt_crypto_IRQHandler
+ B cpuss_interrupt_crypto_IRQHandler
+
+ PUBWEAK cpuss_interrupt_fm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupt_fm_IRQHandler
+ B cpuss_interrupt_fm_IRQHandler
+
+ PUBWEAK cpuss_interrupts_cm0_cti_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_cm0_cti_0_IRQHandler
+ B cpuss_interrupts_cm0_cti_0_IRQHandler
+
+ PUBWEAK cpuss_interrupts_cm0_cti_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_cm0_cti_1_IRQHandler
+ B cpuss_interrupts_cm0_cti_1_IRQHandler
+
+ PUBWEAK cpuss_interrupts_cm4_cti_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_cm4_cti_0_IRQHandler
+ B cpuss_interrupts_cm4_cti_0_IRQHandler
+
+ PUBWEAK cpuss_interrupts_cm4_cti_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+cpuss_interrupts_cm4_cti_1_IRQHandler
+ B cpuss_interrupts_cm4_cti_1_IRQHandler
+
+ PUBWEAK tcpwm_0_interrupts_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_0_interrupts_0_IRQHandler
+ B tcpwm_0_interrupts_0_IRQHandler
+
+ PUBWEAK tcpwm_0_interrupts_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_0_interrupts_1_IRQHandler
+ B tcpwm_0_interrupts_1_IRQHandler
+
+ PUBWEAK tcpwm_0_interrupts_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_0_interrupts_2_IRQHandler
+ B tcpwm_0_interrupts_2_IRQHandler
+
+ PUBWEAK tcpwm_0_interrupts_3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_0_interrupts_3_IRQHandler
+ B tcpwm_0_interrupts_3_IRQHandler
+
+ PUBWEAK tcpwm_0_interrupts_4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_0_interrupts_4_IRQHandler
+ B tcpwm_0_interrupts_4_IRQHandler
+
+ PUBWEAK tcpwm_0_interrupts_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_0_interrupts_5_IRQHandler
+ B tcpwm_0_interrupts_5_IRQHandler
+
+ PUBWEAK tcpwm_0_interrupts_6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_0_interrupts_6_IRQHandler
+ B tcpwm_0_interrupts_6_IRQHandler
+
+ PUBWEAK tcpwm_0_interrupts_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_0_interrupts_7_IRQHandler
+ B tcpwm_0_interrupts_7_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_0_IRQHandler
+ B tcpwm_1_interrupts_0_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_1_IRQHandler
+ B tcpwm_1_interrupts_1_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_2_IRQHandler
+ B tcpwm_1_interrupts_2_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_3_IRQHandler
+ B tcpwm_1_interrupts_3_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_4_IRQHandler
+ B tcpwm_1_interrupts_4_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_5_IRQHandler
+ B tcpwm_1_interrupts_5_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_6_IRQHandler
+ B tcpwm_1_interrupts_6_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_7_IRQHandler
+ B tcpwm_1_interrupts_7_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_8_IRQHandler
+ B tcpwm_1_interrupts_8_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_9_IRQHandler
+ B tcpwm_1_interrupts_9_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_10_IRQHandler
+ B tcpwm_1_interrupts_10_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_11_IRQHandler
+ B tcpwm_1_interrupts_11_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_12_IRQHandler
+ B tcpwm_1_interrupts_12_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_13_IRQHandler
+ B tcpwm_1_interrupts_13_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_14_IRQHandler
+ B tcpwm_1_interrupts_14_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_15_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_15_IRQHandler
+ B tcpwm_1_interrupts_15_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_16_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_16_IRQHandler
+ B tcpwm_1_interrupts_16_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_17_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_17_IRQHandler
+ B tcpwm_1_interrupts_17_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_18_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_18_IRQHandler
+ B tcpwm_1_interrupts_18_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_19_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_19_IRQHandler
+ B tcpwm_1_interrupts_19_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_20_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_20_IRQHandler
+ B tcpwm_1_interrupts_20_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_21_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_21_IRQHandler
+ B tcpwm_1_interrupts_21_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_22_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_22_IRQHandler
+ B tcpwm_1_interrupts_22_IRQHandler
+
+ PUBWEAK tcpwm_1_interrupts_23_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+tcpwm_1_interrupts_23_IRQHandler
+ B tcpwm_1_interrupts_23_IRQHandler
+
+ PUBWEAK udb_interrupts_0_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_0_IRQHandler
+ B udb_interrupts_0_IRQHandler
+
+ PUBWEAK udb_interrupts_1_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_1_IRQHandler
+ B udb_interrupts_1_IRQHandler
+
+ PUBWEAK udb_interrupts_2_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_2_IRQHandler
+ B udb_interrupts_2_IRQHandler
+
+ PUBWEAK udb_interrupts_3_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_3_IRQHandler
+ B udb_interrupts_3_IRQHandler
+
+ PUBWEAK udb_interrupts_4_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_4_IRQHandler
+ B udb_interrupts_4_IRQHandler
+
+ PUBWEAK udb_interrupts_5_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_5_IRQHandler
+ B udb_interrupts_5_IRQHandler
+
+ PUBWEAK udb_interrupts_6_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_6_IRQHandler
+ B udb_interrupts_6_IRQHandler
+
+ PUBWEAK udb_interrupts_7_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_7_IRQHandler
+ B udb_interrupts_7_IRQHandler
+
+ PUBWEAK udb_interrupts_8_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_8_IRQHandler
+ B udb_interrupts_8_IRQHandler
+
+ PUBWEAK udb_interrupts_9_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_9_IRQHandler
+ B udb_interrupts_9_IRQHandler
+
+ PUBWEAK udb_interrupts_10_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_10_IRQHandler
+ B udb_interrupts_10_IRQHandler
+
+ PUBWEAK udb_interrupts_11_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_11_IRQHandler
+ B udb_interrupts_11_IRQHandler
+
+ PUBWEAK udb_interrupts_12_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_12_IRQHandler
+ B udb_interrupts_12_IRQHandler
+
+ PUBWEAK udb_interrupts_13_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_13_IRQHandler
+ B udb_interrupts_13_IRQHandler
+
+ PUBWEAK udb_interrupts_14_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_14_IRQHandler
+ B udb_interrupts_14_IRQHandler
+
+ PUBWEAK udb_interrupts_15_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+udb_interrupts_15_IRQHandler
+ B udb_interrupts_15_IRQHandler
+
+ PUBWEAK pass_interrupt_sar_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+pass_interrupt_sar_IRQHandler
+ B pass_interrupt_sar_IRQHandler
+
+ PUBWEAK audioss_interrupt_i2s_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+audioss_interrupt_i2s_IRQHandler
+ B audioss_interrupt_i2s_IRQHandler
+
+ PUBWEAK audioss_interrupt_pdm_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+audioss_interrupt_pdm_IRQHandler
+ B audioss_interrupt_pdm_IRQHandler
+
+ PUBWEAK profile_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+profile_interrupt_IRQHandler
+ B profile_interrupt_IRQHandler
+
+ PUBWEAK smif_interrupt_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+smif_interrupt_IRQHandler
+ B smif_interrupt_IRQHandler
+
+ PUBWEAK usb_interrupt_hi_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+usb_interrupt_hi_IRQHandler
+ B usb_interrupt_hi_IRQHandler
+
+ PUBWEAK usb_interrupt_med_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+usb_interrupt_med_IRQHandler
+ B usb_interrupt_med_IRQHandler
+
+ PUBWEAK usb_interrupt_lo_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+usb_interrupt_lo_IRQHandler
+ B usb_interrupt_lo_IRQHandler
+
+ PUBWEAK pass_interrupt_dacs_IRQHandler
+ SECTION .text:CODE:REORDER:NOROOT(1)
+pass_interrupt_dacs_IRQHandler
+ B pass_interrupt_dacs_IRQHandler
+
+
+ END
+
+
+; [] END OF FILE
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/system_psoc6.h b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/system_psoc6.h
new file mode 100644
index 0000000000000000000000000000000000000000..f0276e37948c9e426a1cf487c009dd30bb39bde5
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/system_psoc6.h
@@ -0,0 +1,684 @@
+/***************************************************************************//**
+* \file system_psoc6.h
+* \version 2.60
+*
+* \brief Device system header file.
+*
+********************************************************************************
+* \copyright
+* Copyright 2016-2019 Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed 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 _SYSTEM_PSOC6_H_
+#define _SYSTEM_PSOC6_H_
+
+/**
+* \addtogroup group_system_config
+* \{
+* Provides device startup, system configuration, and linker script files.
+* The system startup provides the followings features:
+* - See \ref group_system_config_device_initialization for the:
+* * \ref group_system_config_dual_core_device_initialization
+* * \ref group_system_config_single_core_device_initialization
+* - \ref group_system_config_device_memory_definition
+* - \ref group_system_config_heap_stack_config
+* - \ref group_system_config_merge_apps
+* - \ref group_system_config_default_handlers
+* - \ref group_system_config_device_vector_table
+* - \ref group_system_config_cm4_functions
+*
+* \section group_system_config_configuration Configuration Considerations
+*
+* \subsection group_system_config_device_memory_definition Device Memory Definition
+* The flash and RAM allocation for each CPU is defined by the linker scripts.
+* For dual-core devices, the physical flash and RAM memory is shared between the CPU cores.
+* 2 KB of RAM (allocated at the end of RAM) are reserved for system use.
+* For Single-Core devices the system reserves additional 80 bytes of RAM.
+* Using the reserved memory area for other purposes will lead to unexpected behavior.
+*
+* \note The linker files provided with the PDL are generic and handle all common
+* use cases. Your project may not use every section defined in the linker files.
+* In that case you may see warnings during the build process. To eliminate build
+* warnings in your project, you can simply comment out or remove the relevant
+* code in the linker file.
+*
+* ARM GCC\n
+* The flash and RAM sections for the CPU are defined in the linker files:
+* 'xx_yy.ld', where 'xx' is the device group, and 'yy' is the target CPU; for example,
+* 'cy8c6xx7_cm0plus.ld' and 'cy8c6xx7_cm4_dual.ld'.
+* \note If the start of the Cortex-M4 application image is changed, the value
+* of the of the \ref CY_CORTEX_M4_APPL_ADDR should also be changed. The
+* \ref CY_CORTEX_M4_APPL_ADDR macro should be used as the parameter for the
+* Cy_SysEnableCM4() function call.
+*
+* Change the flash and RAM sizes by editing the macros value in the
+* linker files for both CPUs:
+* - 'xx_cm0plus.ld', where 'xx' is the device group:
+* \code
+* flash (rx) : ORIGIN = 0x10000000, LENGTH = 0x00080000
+* ram (rwx) : ORIGIN = 0x08000000, LENGTH = 0x00024000
+* \endcode
+* - 'xx_cm4_dual.ld', where 'xx' is the device group:
+* \code
+* flash (rx) : ORIGIN = 0x10080000, LENGTH = 0x00080000
+* ram (rwx) : ORIGIN = 0x08024000, LENGTH = 0x00023800
+* \endcode
+*
+* Change the value of the \ref CY_CORTEX_M4_APPL_ADDR macro to the rom ORIGIN's
+* value in the 'xx_cm4_dual.ld' file, where 'xx' is the device group. Do this
+* by either:
+* - Passing the following commands to the compiler:\n
+* \code -D CY_CORTEX_M4_APPL_ADDR=0x10080000 \endcode
+* - Editing the \ref CY_CORTEX_M4_APPL_ADDR value in the 'system_xx.h', where 'xx' is device family:\n
+* \code #define CY_CORTEX_M4_APPL_ADDR (0x10080000u) \endcode
+*
+* ARM MDK\n
+* The flash and RAM sections for the CPU are defined in the linker files:
+* 'xx_yy.scat', where 'xx' is the device group, and 'yy' is the target CPU; for example,
+* 'cy8c6xx7_cm0plus.scat' and 'cy8c6xx7_cm4_dual.scat'.
+* \note If the start of the Cortex-M4 application image is changed, the value
+* of the of the \ref CY_CORTEX_M4_APPL_ADDR should also be changed. The
+* \ref CY_CORTEX_M4_APPL_ADDR macro should be used as the parameter for the \ref
+* Cy_SysEnableCM4() function call.
+*
+* \note The linker files provided with the PDL are generic and handle all common
+* use cases. Your project may not use every section defined in the linker files.
+* In that case you may see the warnings during the build process:
+* L6314W (no section matches pattern) and/or L6329W
+* (pattern only matches removed unused sections). In your project, you can
+* suppress the warning by passing the "--diag_suppress=L6314W,L6329W" option to
+* the linker. You can also comment out or remove the relevant code in the linker
+* file.
+*
+* Change the flash and RAM sizes by editing the macros value in the
+* linker files for both CPUs:
+* - 'xx_cm0plus.scat', where 'xx' is the device group:
+* \code
+* #define FLASH_START 0x10000000
+* #define FLASH_SIZE 0x00080000
+* #define RAM_START 0x08000000
+* #define RAM_SIZE 0x00024000
+* \endcode
+* - 'xx_cm4_dual.scat', where 'xx' is the device group:
+* \code
+* #define FLASH_START 0x10080000
+* #define FLASH_SIZE 0x00080000
+* #define RAM_START 0x08024000
+* #define RAM_SIZE 0x00023800
+* \endcode
+*
+* Change the value of the \ref CY_CORTEX_M4_APPL_ADDR macro to the FLASH_START
+* value in the 'xx_cm4_dual.scat' file,
+* where 'xx' is the device group. Do this by either:
+* - Passing the following commands to the compiler:\n
+* \code -D CY_CORTEX_M4_APPL_ADDR=0x10080000 \endcode
+* - Editing the \ref CY_CORTEX_M4_APPL_ADDR value in the 'system_xx.h', where
+* 'xx' is device family:\n
+* \code #define CY_CORTEX_M4_APPL_ADDR (0x10080000u) \endcode
+*
+* IAR\n
+* The flash and RAM sections for the CPU are defined in the linker files:
+* 'xx_yy.icf', where 'xx' is the device group, and 'yy' is the target CPU; for example,
+* 'cy8c6xx7_cm0plus.icf' and 'cy8c6xx7_cm4_dual.icf'.
+* \note If the start of the Cortex-M4 application image is changed, the value
+* of the of the \ref CY_CORTEX_M4_APPL_ADDR should also be changed. The
+* \ref CY_CORTEX_M4_APPL_ADDR macro should be used as the parameter for the \ref
+* Cy_SysEnableCM4() function call.
+*
+* Change the flash and RAM sizes by editing the macros value in the
+* linker files for both CPUs:
+* - 'xx_cm0plus.icf', where 'xx' is the device group:
+* \code
+* define symbol __ICFEDIT_region_IROM1_start__ = 0x10000000;
+* define symbol __ICFEDIT_region_IROM1_end__ = 0x10080000;
+* define symbol __ICFEDIT_region_IRAM1_start__ = 0x08000000;
+* define symbol __ICFEDIT_region_IRAM1_end__ = 0x08024000;
+* \endcode
+* - 'xx_cm4_dual.icf', where 'xx' is the device group:
+* \code
+* define symbol __ICFEDIT_region_IROM1_start__ = 0x10080000;
+* define symbol __ICFEDIT_region_IROM1_end__ = 0x10100000;
+* define symbol __ICFEDIT_region_IRAM1_start__ = 0x08024000;
+* define symbol __ICFEDIT_region_IRAM1_end__ = 0x08047800;
+* \endcode
+*
+* Change the value of the \ref CY_CORTEX_M4_APPL_ADDR macro to the
+* __ICFEDIT_region_IROM1_start__ value in the 'xx_cm4_dual.icf' file, where 'xx'
+* is the device group. Do this by either:
+* - Passing the following commands to the compiler:\n
+* \code -D CY_CORTEX_M4_APPL_ADDR=0x10080000 \endcode
+* - Editing the \ref CY_CORTEX_M4_APPL_ADDR value in the 'system_xx.h', where
+* 'xx' is device family:\n
+* \code #define CY_CORTEX_M4_APPL_ADDR (0x10080000u) \endcode
+*
+* \subsection group_system_config_device_initialization Device Initialization
+* After a power-on-reset (POR), the boot process is handled by the boot code
+* from the on-chip ROM that is always executed by the Cortex-M0+ core. The boot
+* code passes the control to the Cortex-M0+ startup code located in flash.
+*
+* \subsubsection group_system_config_dual_core_device_initialization Dual-Core Devices
+* The Cortex-M0+ startup code performs the device initialization by a call to
+* SystemInit() and then calls the main() function. The Cortex-M4 core is disabled
+* by default. Enable the core using the \ref Cy_SysEnableCM4() function.
+* See \ref group_system_config_cm4_functions for more details.
+* \note Startup code executes SystemInit() function for the both Cortex-M0+ and Cortex-M4 cores.
+* The function has a separate implementation on each core.
+* Both function implementations unlock and disable the WDT.
+* Therefore enable the WDT after both cores have been initialized.
+*
+* \subsubsection group_system_config_single_core_device_initialization Single-Core Devices
+* The Cortex-M0+ core is not user-accessible on these devices. In this case the
+* Flash Boot handles setup of the CM0+ core and starts the Cortex-M4 core.
+*
+* \subsection group_system_config_heap_stack_config Heap and Stack Configuration
+* There are two ways to adjust heap and stack configurations:
+* -# Editing source code files
+* -# Specifying via command line
+*
+* By default, the stack size is set to 0x00001000 and the heap size is set to 0x00000400.
+*
+* \subsubsection group_system_config_heap_stack_config_gcc ARM GCC
+* - Editing source code files\n
+* The heap and stack sizes are defined in the assembler startup files
+* (e.g. startup_psoc6_01_cm0plus.S and startup_psoc6_01_cm4.S).
+* Change the heap and stack sizes by modifying the following lines:\n
+* \code .equ Stack_Size, 0x00001000 \endcode
+* \code .equ Heap_Size, 0x00000400 \endcode
+*
+* - Specifying via command line\n
+* Change the heap and stack sizes passing the following commands to the compiler:\n
+* \code -D __STACK_SIZE=0x000000400 \endcode
+* \code -D __HEAP_SIZE=0x000000100 \endcode
+*
+* \subsubsection group_system_config_heap_stack_config_mdk ARM MDK
+* - Editing source code files\n
+* The heap and stack sizes are defined in the assembler startup files
+* (e.g. startup_psoc6_01_cm0plus.s and startup_psoc6_01_cm4.s).
+* Change the heap and stack sizes by modifying the following lines:\n
+* \code Stack_Size EQU 0x00001000 \endcode
+* \code Heap_Size EQU 0x00000400 \endcode
+*
+* - Specifying via command line\n
+* Change the heap and stack sizes passing the following commands to the assembler:\n
+* \code "--predefine=___STACK_SIZE SETA 0x000000400" \endcode
+* \code "--predefine=__HEAP_SIZE SETA 0x000000100" \endcode
+*
+* \subsubsection group_system_config_heap_stack_config_iar IAR
+* - Editing source code files\n
+* The heap and stack sizes are defined in the linker scatter files: 'xx_yy.icf',
+* where 'xx' is the device family, and 'yy' is the target CPU; for example,
+* cy8c6xx7_cm0plus.icf and cy8c6xx7_cm4_dual.icf.
+* Change the heap and stack sizes by modifying the following lines:\n
+* \code Stack_Size EQU 0x00001000 \endcode
+* \code Heap_Size EQU 0x00000400 \endcode
+*
+* - Specifying via command line\n
+* Change the heap and stack sizes passing the following commands to the
+* linker (including quotation marks):\n
+* \code --define_symbol __STACK_SIZE=0x000000400 \endcode
+* \code --define_symbol __HEAP_SIZE=0x000000100 \endcode
+*
+* \subsection group_system_config_merge_apps Merging CM0+ and CM4 Executables
+* The CM0+ project and linker script build the CM0+ application image. Similarly,
+* the CM4 linker script builds the CM4 application image. Each specifies
+* locations, sizes, and contents of sections in memory. See
+* \ref group_system_config_device_memory_definition for the symbols and default
+* values.
+*
+* The cymcuelftool is invoked by a post-build command. The precise project
+* setting is IDE-specific.
+*
+* The cymcuelftool combines the two executables. The tool examines the
+* executables to ensure that memory regions either do not overlap, or contain
+* identical bytes (shared). If there are no problems, it creates a new ELF file
+* with the merged image, without changing any of the addresses or data.
+*
+* \subsection group_system_config_default_handlers Default Interrupt Handlers Definition
+* The default interrupt handler functions are defined as weak functions to a dummy
+* handler in the startup file. The naming convention for the interrupt handler names
+* is \_IRQHandler. A default interrupt handler can be overwritten in
+* user code by defining the handler function using the same name. For example:
+* \code
+* void scb_0_interrupt_IRQHandler(void)
+*{
+* ...
+*}
+* \endcode
+*
+* \subsection group_system_config_device_vector_table Vectors Table Copy from Flash to RAM
+* This process uses memory sections defined in the linker script. The startup
+* code actually defines the contents of the vector table and performs the copy.
+* \subsubsection group_system_config_device_vector_table_gcc ARM GCC
+* The linker script file is 'xx_yy.ld', where 'xx' is the device family, and
+* 'yy' is the target CPU; for example, cy8c6xx7_cm0plus.ld and cy8c6xx7_cm4_dual.ld.
+* It defines sections and locations in memory.\n
+* Copy interrupt vectors from flash to RAM: \n
+* From: \code LONG (__Vectors) \endcode
+* To: \code LONG (__ram_vectors_start__) \endcode
+* Size: \code LONG (__Vectors_End - __Vectors) \endcode
+* The vector table address (and the vector table itself) are defined in the
+* assembler startup files (e.g. startup_psoc6_01_cm0plus.S and startup_psoc6_01_cm4.S).
+* The code in these files copies the vector table from Flash to RAM.
+* \subsubsection group_system_config_device_vector_table_mdk ARM MDK
+* The linker script file is 'xx_yy.scat', where 'xx' is the device family,
+* and 'yy' is the target CPU; for example, cy8c6xx7_cm0plus.scat and
+* cy8c6xx7_cm4_dual.scat. The linker script specifies that the vector table
+* (RESET_RAM) shall be first in the RAM section.\n
+* RESET_RAM represents the vector table. It is defined in the assembler startup
+* files (e.g. startup_psoc6_01_cm0plus.s and startup_psoc6_01_cm4.s).
+* The code in these files copies the vector table from Flash to RAM.
+*
+* \subsubsection group_system_config_device_vector_table_iar IAR
+* The linker script file is 'xx_yy.icf', where 'xx' is the device family, and
+* 'yy' is the target CPU; for example, cy8c6xx7_cm0plus.icf and cy8c6xx7_cm4_dual.icf.
+* This file defines the .intvec_ram section and its location.
+* \code place at start of IRAM1_region { readwrite section .intvec_ram}; \endcode
+* The vector table address (and the vector table itself) are defined in the
+* assembler startup files (e.g. startup_psoc6_01_cm0plus.s and startup_psoc6_01_cm4.s).
+* The code in these files copies the vector table from Flash to RAM.
+*
+* \section group_system_config_more_information More Information
+* Refer to the PDL User Guide for the
+* more details.
+*
+* \section group_system_config_MISRA MISRA Compliance
+*
+*
+*
+* MISRA Rule |
+* Rule Class (Required/Advisory) |
+* Rule Description |
+* Description of Deviation(s) |
+*
+*
+* 2.3 |
+* R |
+* The character sequence // shall not be used within a comment. |
+* The comments provide a useful WEB link to the documentation. |
+*
+*
+*
+* \section group_system_config_changelog Changelog
+*
+*
+* Version |
+* Changes |
+* Reason for Change |
+*
+*
+* 2.60 |
+* Updated linker scripts. |
+* Provided support for new devices, updated usage of CM0p prebuilt image. |
+*
+*
+* 2.50 |
+* Updated assembler files, C files, linker scripts. |
+* Dynamic allocated HEAP size for Arm Compiler 6, IAR 8. |
+*
+*
+* 2.40 |
+* Updated assembler files, C files, linker scripts. |
+* Added Arm Compiler 6 support. |
+*
+*
+* 2.30 |
+* Added assembler files, linker scripts for Mbed OS. |
+* Added Arm Mbed OS embedded operating system support. |
+*
+*
+* Updated linker scripts to extend the Flash and Ram memories size available for the CM4 core. |
+* Enhanced PDL usability. |
+*
+*
+* 2.20 |
+* Moved the Cy_IPC_SystemSemaInit(), Cy_IPC_SystemPipeInit() functions implementation from IPC to Startup. |
+* Changed the IPC driver configuration method from compile time to run time. |
+*
+*
+* 2.10 |
+* Added constructor attribute to SystemInit() function declaration for ARM MDK compiler. \n
+* Removed $Sub$$main symbol for ARM MDK compiler.
+* |
+* uVision Debugger support. |
+*
+*
+* Updated description of the Startup behavior for Single-Core Devices. \n
+* Added note about WDT disabling by SystemInit() function.
+* |
+* Documentation improvement. |
+*
+*
+* 2.0 |
+* Added restoring of FLL registers to the default state in SystemInit() API for single core devices.
+* Single core device support.
+* |
+* |
+*
+*
+* Added Normal Access Restrictions, Public Key, TOC part2 and TOC part2 copy to Supervisory flash linker memory regions. \n
+* Renamed 'wflash' memory region to 'em_eeprom'.
+* |
+* Linker scripts usability improvement. |
+*
+*
+* Added Cy_IPC_SystemSemaInit(), Cy_IPC_SystemPipeInit(), Cy_Flash_Init() functions call to SystemInit() API. |
+* Reserved system resources for internal operations. |
+*
+*
+* Added clearing and releasing of IPC structure #7 (reserved for the Deep-Sleep operations) to SystemInit() API. |
+* To avoid deadlocks in case of SW or WDT reset during Deep-Sleep entering. |
+*
+*
+* 1.0 |
+* Initial version |
+* |
+*
+*
+*
+*
+* \defgroup group_system_config_macro Macro
+* \{
+* \defgroup group_system_config_system_macro System
+* \defgroup group_system_config_cm4_status_macro Cortex-M4 Status
+* \defgroup group_system_config_user_settings_macro User Settings
+* \}
+* \defgroup group_system_config_functions Functions
+* \{
+* \defgroup group_system_config_system_functions System
+* \defgroup group_system_config_cm4_functions Cortex-M4 Control
+* \}
+* \defgroup group_system_config_globals Global Variables
+*
+* \}
+*/
+
+/**
+* \addtogroup group_system_config_system_functions
+* \{
+* \details
+* The following system functions implement CMSIS Core functions.
+* Refer to the [CMSIS documentation]
+* (http://www.keil.com/pack/doc/CMSIS/Core/html/group__system__init__gr.html "System and Clock Configuration")
+* for more details.
+* \}
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*******************************************************************************
+* Include files
+*******************************************************************************/
+#include
+
+
+/*******************************************************************************
+* Global preprocessor symbols/macros ('define')
+*******************************************************************************/
+#if ((defined(__GNUC__) && (__ARM_ARCH == 6) && (__ARM_ARCH_6M__ == 1)) || \
+ (defined (__ICCARM__) && (__CORE__ == __ARM6M__)) || \
+ (defined(__ARMCC_VERSION) && (__TARGET_ARCH_THUMB == 3)))
+ #define CY_SYSTEM_CPU_CM0P 1UL
+#else
+ #define CY_SYSTEM_CPU_CM0P 0UL
+#endif
+
+#if defined (CY_PSOC_CREATOR_USED) && (CY_PSOC_CREATOR_USED == 1U)
+ #include "cyfitter.h"
+#endif /* (CY_PSOC_CREATOR_USED) && (CY_PSOC_CREATOR_USED == 1U) */
+
+
+
+
+/*******************************************************************************
+*
+* START OF USER SETTINGS HERE
+* ===========================
+*
+* All lines with '<<<' can be set by user.
+*
+*******************************************************************************/
+
+/**
+* \addtogroup group_system_config_user_settings_macro
+* \{
+*/
+
+#if defined (CYDEV_CLK_EXTCLK__HZ)
+ #define CY_CLK_EXT_FREQ_HZ (CYDEV_CLK_EXTCLK__HZ)
+#else
+ /***************************************************************************//**
+ * External Clock Frequency (in Hz, [value]UL). If compiled within
+ * PSoC Creator and the clock is enabled in the DWR, the value from DWR used.
+ * Otherwise, edit the value below.
+ * (USER SETTING)
+ *******************************************************************************/
+ #define CY_CLK_EXT_FREQ_HZ (24000000UL) /* <<< 24 MHz */
+#endif /* (CYDEV_CLK_EXTCLK__HZ) */
+
+
+#if defined (CYDEV_CLK_ECO__HZ)
+ #define CY_CLK_ECO_FREQ_HZ (CYDEV_CLK_ECO__HZ)
+#else
+ /***************************************************************************//**
+ * \brief External crystal oscillator frequency (in Hz, [value]UL). If compiled
+ * within PSoC Creator and the clock is enabled in the DWR, the value from DWR
+ * used.
+ * (USER SETTING)
+ *******************************************************************************/
+ #define CY_CLK_ECO_FREQ_HZ (24000000UL) /* <<< 24 MHz */
+#endif /* (CYDEV_CLK_ECO__HZ) */
+
+
+#if defined (CYDEV_CLK_ALTHF__HZ)
+ #define CY_CLK_ALTHF_FREQ_HZ (CYDEV_CLK_ALTHF__HZ)
+#else
+ /***************************************************************************//**
+ * \brief Alternate high frequency (in Hz, [value]UL). If compiled within
+ * PSoC Creator and the clock is enabled in the DWR, the value from DWR used.
+ * Otherwise, edit the value below.
+ * (USER SETTING)
+ *******************************************************************************/
+ #define CY_CLK_ALTHF_FREQ_HZ (32000000UL) /* <<< 32 MHz */
+#endif /* (CYDEV_CLK_ALTHF__HZ) */
+
+
+/***************************************************************************//**
+* \brief Start address of the Cortex-M4 application ([address]UL)
+* (USER SETTING)
+*******************************************************************************/
+#if !defined (CY_CORTEX_M4_APPL_ADDR)
+ #define CY_CORTEX_M4_APPL_ADDR (CY_FLASH_BASE + 0x2000U) /* <<< 8 kB of flash is reserved for the Cortex-M0+ application */
+#endif /* (CY_CORTEX_M4_APPL_ADDR) */
+
+
+/***************************************************************************//**
+* \brief IPC Semaphores allocation ([value]UL).
+* (USER SETTING)
+*******************************************************************************/
+#define CY_IPC_SEMA_COUNT (128UL) /* <<< This will allow 128 (4*32) semaphores */
+
+
+/***************************************************************************//**
+* \brief IPC Pipe definitions ([value]UL).
+* (USER SETTING)
+*******************************************************************************/
+#define CY_IPC_MAX_ENDPOINTS (8UL) /* <<< 8 endpoints */
+
+
+/*******************************************************************************
+*
+* END OF USER SETTINGS HERE
+* =========================
+*
+*******************************************************************************/
+
+/** \} group_system_config_user_settings_macro */
+
+
+/**
+* \addtogroup group_system_config_system_macro
+* \{
+*/
+
+#if (CY_SYSTEM_CPU_CM0P == 1UL) || defined(CY_DOXYGEN)
+ /** The Cortex-M0+ startup driver identifier */
+ #define CY_STARTUP_M0P_ID ((uint32_t)((uint32_t)((0x0EU) & 0x3FFFU) << 18U))
+#endif /* (CY_SYSTEM_CPU_CM0P == 1UL) */
+
+#if (CY_SYSTEM_CPU_CM0P != 1UL) || defined(CY_DOXYGEN)
+ /** The Cortex-M4 startup driver identifier */
+ #define CY_STARTUP_M4_ID ((uint32_t)((uint32_t)((0x0FU) & 0x3FFFU) << 18U))
+#endif /* (CY_SYSTEM_CPU_CM0P != 1UL) */
+
+/** \} group_system_config_system_macro */
+
+
+/**
+* \addtogroup group_system_config_system_functions
+* \{
+*/
+#if defined(__ARMCC_VERSION)
+ extern void SystemInit(void) __attribute__((constructor));
+#else
+ extern void SystemInit(void);
+#endif /* (__ARMCC_VERSION) */
+
+extern void SystemCoreClockUpdate(void);
+/** \} group_system_config_system_functions */
+
+
+/**
+* \addtogroup group_system_config_cm4_functions
+* \{
+*/
+extern uint32_t Cy_SysGetCM4Status(void);
+extern void Cy_SysEnableCM4(uint32_t vectorTableOffset);
+extern void Cy_SysDisableCM4(void);
+extern void Cy_SysRetainCM4(void);
+extern void Cy_SysResetCM4(void);
+/** \} group_system_config_cm4_functions */
+
+
+/** \cond */
+extern void Default_Handler (void);
+
+void Cy_SysIpcPipeIsrCm0(void);
+void Cy_SysIpcPipeIsrCm4(void);
+
+extern void Cy_SystemInit(void);
+extern void Cy_SystemInitFpuEnable(void);
+
+extern uint32_t cy_delayFreqHz;
+extern uint32_t cy_delayFreqKhz;
+extern uint8_t cy_delayFreqMhz;
+extern uint32_t cy_delay32kMs;
+/** \endcond */
+
+
+#if (CY_SYSTEM_CPU_CM0P == 1UL) || defined(CY_DOXYGEN)
+/**
+* \addtogroup group_system_config_cm4_status_macro
+* \{
+*/
+#define CY_SYS_CM4_STATUS_ENABLED (3U) /**< The Cortex-M4 core is enabled: power on, clock on, no isolate, no reset and no retain. */
+#define CY_SYS_CM4_STATUS_DISABLED (0U) /**< The Cortex-M4 core is disabled: power off, clock off, isolate, reset and no retain. */
+#define CY_SYS_CM4_STATUS_RETAINED (2U) /**< The Cortex-M4 core is retained. power off, clock off, isolate, no reset and retain. */
+#define CY_SYS_CM4_STATUS_RESET (1U) /**< The Cortex-M4 core is in the Reset mode: clock off, no isolated, no retain and reset. */
+/** \} group_system_config_cm4_status_macro */
+
+#endif /* (CY_SYSTEM_CPU_CM0P == 1UL) */
+
+
+/*******************************************************************************
+* IPC Configuration
+* =========================
+*******************************************************************************/
+/* IPC CY_PIPE default configuration */
+#define CY_SYS_CYPIPE_CLIENT_CNT (8UL)
+
+#define CY_SYS_INTR_CYPIPE_MUX_EP0 (1UL) /* IPC CYPRESS PIPE */
+#define CY_SYS_INTR_CYPIPE_PRIOR_EP0 (1UL) /* Notifier Priority */
+#define CY_SYS_INTR_CYPIPE_PRIOR_EP1 (1UL) /* Notifier Priority */
+
+#define CY_SYS_CYPIPE_CHAN_MASK_EP0 (0x0001UL << CY_IPC_CHAN_CYPIPE_EP0)
+#define CY_SYS_CYPIPE_CHAN_MASK_EP1 (0x0001UL << CY_IPC_CHAN_CYPIPE_EP1)
+
+
+/******************************************************************************/
+/*
+ * The System pipe configuration defines the IPC channel number, interrupt
+ * number, and the pipe interrupt mask for the endpoint.
+ *
+ * The format of the endPoint configuration
+ * Bits[31:16] Interrupt Mask
+ * Bits[15:8 ] IPC interrupt
+ * Bits[ 7:0 ] IPC channel
+ */
+
+/* System Pipe addresses */
+/* CyPipe defines */
+
+#define CY_SYS_CYPIPE_INTR_MASK ( CY_SYS_CYPIPE_CHAN_MASK_EP0 | CY_SYS_CYPIPE_CHAN_MASK_EP1 )
+
+#define CY_SYS_CYPIPE_CONFIG_EP0 ( (CY_SYS_CYPIPE_INTR_MASK << CY_IPC_PIPE_CFG_IMASK_Pos) \
+ | (CY_IPC_INTR_CYPIPE_EP0 << CY_IPC_PIPE_CFG_INTR_Pos) \
+ | CY_IPC_CHAN_CYPIPE_EP0)
+#define CY_SYS_CYPIPE_CONFIG_EP1 ( (CY_SYS_CYPIPE_INTR_MASK << CY_IPC_PIPE_CFG_IMASK_Pos) \
+ | (CY_IPC_INTR_CYPIPE_EP1 << CY_IPC_PIPE_CFG_INTR_Pos) \
+ | CY_IPC_CHAN_CYPIPE_EP1)
+
+/******************************************************************************/
+
+
+/** \addtogroup group_system_config_globals
+* \{
+*/
+
+extern uint32_t SystemCoreClock;
+extern uint32_t cy_BleEcoClockFreqHz;
+extern uint32_t cy_Hfclk0FreqHz;
+extern uint32_t cy_PeriClkFreqHz;
+
+/** \} group_system_config_globals */
+
+
+
+/** \cond INTERNAL */
+/*******************************************************************************
+* Backward compatibility macro. The following code is DEPRECATED and must
+* not be used in new projects
+*******************************************************************************/
+
+/* BWC defines for functions related to enter/exit critical section */
+#define Cy_SaveIRQ Cy_SysLib_EnterCriticalSection
+#define Cy_RestoreIRQ Cy_SysLib_ExitCriticalSection
+#define CY_SYS_INTR_CYPIPE_EP0 (CY_IPC_INTR_CYPIPE_EP0)
+#define CY_SYS_INTR_CYPIPE_EP1 (CY_IPC_INTR_CYPIPE_EP1)
+
+/** \endcond */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYSTEM_PSOC6_H_ */
+
+
+/* [] END OF FILE */
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/system_psoc6_cm4.c b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/system_psoc6_cm4.c
new file mode 100644
index 0000000000000000000000000000000000000000..0a18f50a4d4ccf0d9c684c493c929103c66c1be1
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/TARGET_CY8CKIT-062-BLE/startup/system_psoc6_cm4.c
@@ -0,0 +1,552 @@
+/***************************************************************************//**
+* \file system_psoc6_cm4.c
+* \version 2.60
+*
+* The device system-source file.
+*
+********************************************************************************
+* \copyright
+* Copyright 2016-2019 Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed 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.
+*******************************************************************************/
+
+#include
+#include "system_psoc6.h"
+#include "cy_device.h"
+#include "cy_device_headers.h"
+#include "cy_syslib.h"
+#include "cy_wdt.h"
+
+#if !defined(CY_IPC_DEFAULT_CFG_DISABLE)
+ #include "cy_ipc_sema.h"
+ #include "cy_ipc_pipe.h"
+ #include "cy_ipc_drv.h"
+
+ #if defined(CY_DEVICE_PSOC6ABLE2)
+ #include "cy_flash.h"
+ #endif /* defined(CY_DEVICE_PSOC6ABLE2) */
+#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */
+
+
+/*******************************************************************************
+* SystemCoreClockUpdate()
+*******************************************************************************/
+
+/** Default HFClk frequency in Hz */
+#define CY_CLK_HFCLK0_FREQ_HZ_DEFAULT (8000000UL)
+
+/** Default PeriClk frequency in Hz */
+#define CY_CLK_PERICLK_FREQ_HZ_DEFAULT (4000000UL)
+
+/** Default SlowClk system core frequency in Hz */
+#define CY_CLK_SYSTEM_FREQ_HZ_DEFAULT (8000000UL)
+
+/** IMO frequency in Hz */
+#define CY_CLK_IMO_FREQ_HZ (8000000UL)
+
+/** HVILO frequency in Hz */
+#define CY_CLK_HVILO_FREQ_HZ (32000UL)
+
+/** PILO frequency in Hz */
+#define CY_CLK_PILO_FREQ_HZ (32768UL)
+
+/** WCO frequency in Hz */
+#define CY_CLK_WCO_FREQ_HZ (32768UL)
+
+/** ALTLF frequency in Hz */
+#define CY_CLK_ALTLF_FREQ_HZ (32768UL)
+
+
+/**
+* Holds the SlowClk (Cortex-M0+) or FastClk (Cortex-M4) system core clock,
+* which is the system clock frequency supplied to the SysTick timer and the
+* processor core clock.
+* This variable implements CMSIS Core global variable.
+* Refer to the [CMSIS documentation]
+* (http://www.keil.com/pack/doc/CMSIS/Core/html/group__system__init__gr.html "System and Clock Configuration")
+* for more details.
+* This variable can be used by debuggers to query the frequency
+* of the debug timer or to configure the trace clock speed.
+*
+* \attention Compilers must be configured to avoid removing this variable in case
+* the application program is not using it. Debugging systems require the variable
+* to be physically present in memory so that it can be examined to configure the debugger. */
+uint32_t SystemCoreClock = CY_CLK_SYSTEM_FREQ_HZ_DEFAULT;
+
+/** Holds the HFClk0 clock frequency. Updated by \ref SystemCoreClockUpdate(). */
+uint32_t cy_Hfclk0FreqHz = CY_CLK_HFCLK0_FREQ_HZ_DEFAULT;
+
+/** Holds the PeriClk clock frequency. Updated by \ref SystemCoreClockUpdate(). */
+uint32_t cy_PeriClkFreqHz = CY_CLK_PERICLK_FREQ_HZ_DEFAULT;
+
+/** Holds the Alternate high frequency clock in Hz. Updated by \ref SystemCoreClockUpdate(). */
+#if (defined (CY_IP_MXBLESS) && (CY_IP_MXBLESS == 1UL)) || defined (CY_DOXYGEN)
+ uint32_t cy_BleEcoClockFreqHz = CY_CLK_ALTHF_FREQ_HZ;
+#endif /* (defined (CY_IP_MXBLESS) && (CY_IP_MXBLESS == 1UL)) || defined (CY_DOXYGEN) */
+
+/* SCB->CPACR */
+#define SCB_CPACR_CP10_CP11_ENABLE (0xFUL << 20u)
+
+
+/*******************************************************************************
+* SystemInit()
+*******************************************************************************/
+
+/* CLK_FLL_CONFIG default values */
+#define CY_FB_CLK_FLL_CONFIG_VALUE (0x01000000u)
+#define CY_FB_CLK_FLL_CONFIG2_VALUE (0x00020001u)
+#define CY_FB_CLK_FLL_CONFIG3_VALUE (0x00002800u)
+#define CY_FB_CLK_FLL_CONFIG4_VALUE (0x000000FFu)
+
+
+/*******************************************************************************
+* SystemCoreClockUpdate (void)
+*******************************************************************************/
+
+/* Do not use these definitions directly in your application */
+#define CY_DELAY_MS_OVERFLOW_THRESHOLD (0x8000u)
+#define CY_DELAY_1K_THRESHOLD (1000u)
+#define CY_DELAY_1K_MINUS_1_THRESHOLD (CY_DELAY_1K_THRESHOLD - 1u)
+#define CY_DELAY_1M_THRESHOLD (1000000u)
+#define CY_DELAY_1M_MINUS_1_THRESHOLD (CY_DELAY_1M_THRESHOLD - 1u)
+uint32_t cy_delayFreqHz = CY_CLK_SYSTEM_FREQ_HZ_DEFAULT;
+
+uint32_t cy_delayFreqKhz = (CY_CLK_SYSTEM_FREQ_HZ_DEFAULT + CY_DELAY_1K_MINUS_1_THRESHOLD) /
+ CY_DELAY_1K_THRESHOLD;
+
+uint8_t cy_delayFreqMhz = (uint8_t)((CY_CLK_SYSTEM_FREQ_HZ_DEFAULT + CY_DELAY_1M_MINUS_1_THRESHOLD) /
+ CY_DELAY_1M_THRESHOLD);
+
+uint32_t cy_delay32kMs = CY_DELAY_MS_OVERFLOW_THRESHOLD *
+ ((CY_CLK_SYSTEM_FREQ_HZ_DEFAULT + CY_DELAY_1K_MINUS_1_THRESHOLD) / CY_DELAY_1K_THRESHOLD);
+
+#define CY_ROOT_PATH_SRC_IMO (0UL)
+#define CY_ROOT_PATH_SRC_EXT (1UL)
+#if (SRSS_ECO_PRESENT == 1U)
+ #define CY_ROOT_PATH_SRC_ECO (2UL)
+#endif /* (SRSS_ECO_PRESENT == 1U) */
+#if (SRSS_ALTHF_PRESENT == 1U)
+ #define CY_ROOT_PATH_SRC_ALTHF (3UL)
+#endif /* (SRSS_ALTHF_PRESENT == 1U) */
+#define CY_ROOT_PATH_SRC_DSI_MUX (4UL)
+#define CY_ROOT_PATH_SRC_DSI_MUX_HVILO (16UL)
+#define CY_ROOT_PATH_SRC_DSI_MUX_WCO (17UL)
+#if (SRSS_ALTLF_PRESENT == 1U)
+ #define CY_ROOT_PATH_SRC_DSI_MUX_ALTLF (18UL)
+#endif /* (SRSS_ALTLF_PRESENT == 1U) */
+#if (SRSS_PILO_PRESENT == 1U)
+ #define CY_ROOT_PATH_SRC_DSI_MUX_PILO (19UL)
+#endif /* (SRSS_PILO_PRESENT == 1U) */
+
+
+/*******************************************************************************
+* Function Name: SystemInit
+****************************************************************************//**
+* \cond
+* Initializes the system:
+* - Restores FLL registers to the default state for single core devices.
+* - Unlocks and disables WDT.
+* - Calls Cy_PDL_Init() function to define the driver library.
+* - Calls the Cy_SystemInit() function, if compiled from PSoC Creator.
+* - Calls \ref SystemCoreClockUpdate().
+* \endcond
+*******************************************************************************/
+void SystemInit(void)
+{
+ Cy_PDL_Init(CY_DEVICE_CFG);
+
+#ifdef __CM0P_PRESENT
+ #if (__CM0P_PRESENT == 0)
+ /* Restore FLL registers to the default state as they are not restored by the ROM code */
+ uint32_t copy = SRSS->CLK_FLL_CONFIG;
+ copy &= ~SRSS_CLK_FLL_CONFIG_FLL_ENABLE_Msk;
+ SRSS->CLK_FLL_CONFIG = copy;
+
+ copy = SRSS->CLK_ROOT_SELECT[0u];
+ copy &= ~SRSS_CLK_ROOT_SELECT_ROOT_DIV_Msk; /* Set ROOT_DIV = 0*/
+ SRSS->CLK_ROOT_SELECT[0u] = copy;
+
+ SRSS->CLK_FLL_CONFIG = CY_FB_CLK_FLL_CONFIG_VALUE;
+ SRSS->CLK_FLL_CONFIG2 = CY_FB_CLK_FLL_CONFIG2_VALUE;
+ SRSS->CLK_FLL_CONFIG3 = CY_FB_CLK_FLL_CONFIG3_VALUE;
+ SRSS->CLK_FLL_CONFIG4 = CY_FB_CLK_FLL_CONFIG4_VALUE;
+
+ /* Unlock and disable WDT */
+ Cy_WDT_Unlock();
+ Cy_WDT_Disable();
+ #endif /* (__CM0P_PRESENT == 0) */
+#endif /* __CM0P_PRESENT */
+
+ Cy_SystemInit();
+ SystemCoreClockUpdate();
+
+#if !defined(CY_IPC_DEFAULT_CFG_DISABLE)
+
+#ifdef __CM0P_PRESENT
+ #if (__CM0P_PRESENT == 0)
+ /* Allocate and initialize semaphores for the system operations. */
+ static uint32_t ipcSemaArray[CY_IPC_SEMA_COUNT / CY_IPC_SEMA_PER_WORD];
+ (void) Cy_IPC_Sema_Init(CY_IPC_CHAN_SEMA, CY_IPC_SEMA_COUNT, ipcSemaArray);
+ #else
+ (void) Cy_IPC_Sema_Init(CY_IPC_CHAN_SEMA, 0ul, NULL);
+ #endif /* (__CM0P_PRESENT) */
+#else
+ (void) Cy_IPC_Sema_Init(CY_IPC_CHAN_SEMA, 0ul, NULL);
+#endif /* __CM0P_PRESENT */
+
+
+ /********************************************************************************
+ *
+ * Initializes the system pipes. The system pipes are used by BLE and Flash.
+ *
+ * If the default startup file is not used, or SystemInit() is not called in your
+ * project, call the following three functions prior to executing any flash or
+ * EmEEPROM write or erase operation:
+ * -# Cy_IPC_Sema_Init()
+ * -# Cy_IPC_Pipe_Config()
+ * -# Cy_IPC_Pipe_Init()
+ * -# Cy_Flash_Init()
+ *
+ *******************************************************************************/
+ /* Create an array of endpoint structures */
+ static cy_stc_ipc_pipe_ep_t systemIpcPipeEpArray[CY_IPC_MAX_ENDPOINTS];
+
+ Cy_IPC_Pipe_Config(systemIpcPipeEpArray);
+
+ static cy_ipc_pipe_callback_ptr_t systemIpcPipeSysCbArray[CY_SYS_CYPIPE_CLIENT_CNT];
+
+ static const cy_stc_ipc_pipe_config_t systemIpcPipeConfigCm4 =
+ {
+ /* .ep0ConfigData */
+ {
+ /* .ipcNotifierNumber */ CY_IPC_INTR_CYPIPE_EP0,
+ /* .ipcNotifierPriority */ CY_SYS_INTR_CYPIPE_PRIOR_EP0,
+ /* .ipcNotifierMuxNumber */ CY_SYS_INTR_CYPIPE_MUX_EP0,
+ /* .epAddress */ CY_IPC_EP_CYPIPE_CM0_ADDR,
+ /* .epConfig */ CY_SYS_CYPIPE_CONFIG_EP0
+ },
+ /* .ep1ConfigData */
+ {
+ /* .ipcNotifierNumber */ CY_IPC_INTR_CYPIPE_EP1,
+ /* .ipcNotifierPriority */ CY_SYS_INTR_CYPIPE_PRIOR_EP1,
+ /* .ipcNotifierMuxNumber */ 0u,
+ /* .epAddress */ CY_IPC_EP_CYPIPE_CM4_ADDR,
+ /* .epConfig */ CY_SYS_CYPIPE_CONFIG_EP1
+ },
+ /* .endpointClientsCount */ CY_SYS_CYPIPE_CLIENT_CNT,
+ /* .endpointsCallbacksArray */ systemIpcPipeSysCbArray,
+ /* .userPipeIsrHandler */ &Cy_SysIpcPipeIsrCm4
+ };
+
+ if (cy_device->flashPipeRequired != 0u)
+ {
+ Cy_IPC_Pipe_Init(&systemIpcPipeConfigCm4);
+ }
+
+#if defined(CY_DEVICE_PSOC6ABLE2)
+ Cy_Flash_Init();
+#endif /* defined(CY_DEVICE_PSOC6ABLE2) */
+
+#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */
+}
+
+
+/*******************************************************************************
+* Function Name: Cy_SystemInit
+****************************************************************************//**
+*
+* The function is called during device startup. Once project compiled as part of
+* the PSoC Creator project, the Cy_SystemInit() function is generated by the
+* PSoC Creator.
+*
+* The function generated by PSoC Creator performs all of the necessary device
+* configuration based on the design settings. This includes settings from the
+* Design Wide Resources (DWR) such as Clocks and Pins as well as any component
+* configuration that is necessary.
+*
+*******************************************************************************/
+__WEAK void Cy_SystemInit(void)
+{
+ /* Empty weak function. The actual implementation to be in the PSoC Creator
+ * generated strong function.
+ */
+}
+
+
+/*******************************************************************************
+* Function Name: SystemCoreClockUpdate
+****************************************************************************//**
+*
+* Gets core clock frequency and updates \ref SystemCoreClock, \ref
+* cy_Hfclk0FreqHz, and \ref cy_PeriClkFreqHz.
+*
+* Updates global variables used by the \ref Cy_SysLib_Delay(), \ref
+* Cy_SysLib_DelayUs(), and \ref Cy_SysLib_DelayCycles().
+*
+*******************************************************************************/
+void SystemCoreClockUpdate (void)
+{
+ uint32_t srcFreqHz;
+ uint32_t pathFreqHz;
+ uint32_t fastClkDiv;
+ uint32_t periClkDiv;
+ uint32_t rootPath;
+ uint32_t srcClk;
+
+ /* Get root path clock for the high-frequency clock # 0 */
+ rootPath = _FLD2VAL(SRSS_CLK_ROOT_SELECT_ROOT_MUX, SRSS->CLK_ROOT_SELECT[0u]);
+
+ /* Get source of the root path clock */
+ srcClk = _FLD2VAL(SRSS_CLK_PATH_SELECT_PATH_MUX, SRSS->CLK_PATH_SELECT[rootPath]);
+
+ /* Get frequency of the source */
+ switch (srcClk)
+ {
+ case CY_ROOT_PATH_SRC_IMO:
+ srcFreqHz = CY_CLK_IMO_FREQ_HZ;
+ break;
+
+ case CY_ROOT_PATH_SRC_EXT:
+ srcFreqHz = CY_CLK_EXT_FREQ_HZ;
+ break;
+
+ #if (SRSS_ECO_PRESENT == 1U)
+ case CY_ROOT_PATH_SRC_ECO:
+ srcFreqHz = CY_CLK_ECO_FREQ_HZ;
+ break;
+ #endif /* (SRSS_ECO_PRESENT == 1U) */
+
+#if defined (CY_IP_MXBLESS) && (CY_IP_MXBLESS == 1UL) && (SRSS_ALTHF_PRESENT == 1U)
+ case CY_ROOT_PATH_SRC_ALTHF:
+ srcFreqHz = cy_BleEcoClockFreqHz;
+ break;
+#endif /* defined (CY_IP_MXBLESS) && (CY_IP_MXBLESS == 1UL) && (SRSS_ALTHF_PRESENT == 1U) */
+
+ case CY_ROOT_PATH_SRC_DSI_MUX:
+ {
+ uint32_t dsi_src;
+ dsi_src = _FLD2VAL(SRSS_CLK_DSI_SELECT_DSI_MUX, SRSS->CLK_DSI_SELECT[rootPath]);
+ switch (dsi_src)
+ {
+ case CY_ROOT_PATH_SRC_DSI_MUX_HVILO:
+ srcFreqHz = CY_CLK_HVILO_FREQ_HZ;
+ break;
+
+ case CY_ROOT_PATH_SRC_DSI_MUX_WCO:
+ srcFreqHz = CY_CLK_WCO_FREQ_HZ;
+ break;
+
+ #if (SRSS_ALTLF_PRESENT == 1U)
+ case CY_ROOT_PATH_SRC_DSI_MUX_ALTLF:
+ srcFreqHz = CY_CLK_ALTLF_FREQ_HZ;
+ break;
+ #endif /* (SRSS_ALTLF_PRESENT == 1U) */
+
+ #if (SRSS_PILO_PRESENT == 1U)
+ case CY_ROOT_PATH_SRC_DSI_MUX_PILO:
+ srcFreqHz = CY_CLK_PILO_FREQ_HZ;
+ break;
+ #endif /* (SRSS_PILO_PRESENT == 1U) */
+
+ default:
+ srcFreqHz = CY_CLK_HVILO_FREQ_HZ;
+ break;
+ }
+ }
+ break;
+
+ default:
+ srcFreqHz = CY_CLK_EXT_FREQ_HZ;
+ break;
+ }
+
+ if (rootPath == 0UL)
+ {
+ /* FLL */
+ bool fllLocked = ( 0UL != _FLD2VAL(SRSS_CLK_FLL_STATUS_LOCKED, SRSS->CLK_FLL_STATUS));
+ bool fllOutputOutput = ( 3UL == _FLD2VAL(SRSS_CLK_FLL_CONFIG3_BYPASS_SEL, SRSS->CLK_FLL_CONFIG3));
+ bool fllOutputAuto = ((0UL == _FLD2VAL(SRSS_CLK_FLL_CONFIG3_BYPASS_SEL, SRSS->CLK_FLL_CONFIG3)) ||
+ (1UL == _FLD2VAL(SRSS_CLK_FLL_CONFIG3_BYPASS_SEL, SRSS->CLK_FLL_CONFIG3)));
+ if ((fllOutputAuto && fllLocked) || fllOutputOutput)
+ {
+ uint32_t fllMult;
+ uint32_t refDiv;
+ uint32_t outputDiv;
+
+ fllMult = _FLD2VAL(SRSS_CLK_FLL_CONFIG_FLL_MULT, SRSS->CLK_FLL_CONFIG);
+ refDiv = _FLD2VAL(SRSS_CLK_FLL_CONFIG2_FLL_REF_DIV, SRSS->CLK_FLL_CONFIG2);
+ outputDiv = _FLD2VAL(SRSS_CLK_FLL_CONFIG_FLL_OUTPUT_DIV, SRSS->CLK_FLL_CONFIG) + 1UL;
+
+ pathFreqHz = ((srcFreqHz / refDiv) * fllMult) / outputDiv;
+ }
+ else
+ {
+ pathFreqHz = srcFreqHz;
+ }
+ }
+ else if ((rootPath == 1UL) || (rootPath == 2UL))
+ {
+ /* PLL */
+ bool pllLocked = ( 0UL != _FLD2VAL(SRSS_CLK_PLL_STATUS_LOCKED, SRSS->CLK_PLL_STATUS[rootPath - 1UL]));
+ bool pllOutputOutput = ( 3UL == _FLD2VAL(SRSS_CLK_PLL_CONFIG_BYPASS_SEL, SRSS->CLK_PLL_CONFIG[rootPath - 1UL]));
+ bool pllOutputAuto = ((0UL == _FLD2VAL(SRSS_CLK_PLL_CONFIG_BYPASS_SEL, SRSS->CLK_PLL_CONFIG[rootPath - 1UL])) ||
+ (1UL == _FLD2VAL(SRSS_CLK_PLL_CONFIG_BYPASS_SEL, SRSS->CLK_PLL_CONFIG[rootPath - 1UL])));
+ if ((pllOutputAuto && pllLocked) || pllOutputOutput)
+ {
+ uint32_t feedbackDiv;
+ uint32_t referenceDiv;
+ uint32_t outputDiv;
+
+ feedbackDiv = _FLD2VAL(SRSS_CLK_PLL_CONFIG_FEEDBACK_DIV, SRSS->CLK_PLL_CONFIG[rootPath - 1UL]);
+ referenceDiv = _FLD2VAL(SRSS_CLK_PLL_CONFIG_REFERENCE_DIV, SRSS->CLK_PLL_CONFIG[rootPath - 1UL]);
+ outputDiv = _FLD2VAL(SRSS_CLK_PLL_CONFIG_OUTPUT_DIV, SRSS->CLK_PLL_CONFIG[rootPath - 1UL]);
+
+ pathFreqHz = ((srcFreqHz * feedbackDiv) / referenceDiv) / outputDiv;
+
+ }
+ else
+ {
+ pathFreqHz = srcFreqHz;
+ }
+ }
+ else
+ {
+ /* Direct */
+ pathFreqHz = srcFreqHz;
+ }
+
+ /* Get frequency after hf_clk pre-divider */
+ pathFreqHz = pathFreqHz >> _FLD2VAL(SRSS_CLK_ROOT_SELECT_ROOT_DIV, SRSS->CLK_ROOT_SELECT[0u]);
+ cy_Hfclk0FreqHz = pathFreqHz;
+
+ /* Fast Clock Divider */
+ fastClkDiv = 1u + _FLD2VAL(CPUSS_CM4_CLOCK_CTL_FAST_INT_DIV, CPUSS->CM4_CLOCK_CTL);
+
+ /* Peripheral Clock Divider */
+ periClkDiv = 1u + _FLD2VAL(CPUSS_CM0_CLOCK_CTL_PERI_INT_DIV, CPUSS->CM0_CLOCK_CTL);
+ cy_PeriClkFreqHz = pathFreqHz / periClkDiv;
+
+ pathFreqHz = pathFreqHz / fastClkDiv;
+ SystemCoreClock = pathFreqHz;
+
+ /* Sets clock frequency for Delay API */
+ cy_delayFreqHz = SystemCoreClock;
+ cy_delayFreqMhz = (uint8_t)((cy_delayFreqHz + CY_DELAY_1M_MINUS_1_THRESHOLD) / CY_DELAY_1M_THRESHOLD);
+ cy_delayFreqKhz = (cy_delayFreqHz + CY_DELAY_1K_MINUS_1_THRESHOLD) / CY_DELAY_1K_THRESHOLD;
+ cy_delay32kMs = CY_DELAY_MS_OVERFLOW_THRESHOLD * cy_delayFreqKhz;
+}
+
+
+/*******************************************************************************
+* Function Name: Cy_SystemInitFpuEnable
+****************************************************************************//**
+*
+* Enables the FPU if it is used. The function is called from the startup file.
+*
+*******************************************************************************/
+void Cy_SystemInitFpuEnable(void)
+{
+ #if defined (__FPU_USED) && (__FPU_USED == 1U)
+ uint32_t interruptState;
+ interruptState = Cy_SysLib_EnterCriticalSection();
+ SCB->CPACR |= SCB_CPACR_CP10_CP11_ENABLE;
+ __DSB();
+ __ISB();
+ Cy_SysLib_ExitCriticalSection(interruptState);
+ #endif /* (__FPU_USED) && (__FPU_USED == 1U) */
+}
+
+
+#if !defined(CY_IPC_DEFAULT_CFG_DISABLE)
+/*******************************************************************************
+* Function Name: Cy_SysIpcPipeIsrCm4
+****************************************************************************//**
+*
+* This is the interrupt service routine for the system pipe.
+*
+*******************************************************************************/
+void Cy_SysIpcPipeIsrCm4(void)
+{
+ Cy_IPC_Pipe_ExecuteCallback(CY_IPC_EP_CYPIPE_CM4_ADDR);
+}
+#endif
+
+
+/*******************************************************************************
+* Function Name: Cy_MemorySymbols
+****************************************************************************//**
+*
+* The intention of the function is to declare boundaries of the memories for the
+* MDK compilers. For the rest of the supported compilers, this is done using
+* linker configuration files. The following symbols used by the cymcuelftool.
+*
+*******************************************************************************/
+#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050)
+__asm void Cy_MemorySymbols(void)
+{
+ /* Flash */
+ EXPORT __cy_memory_0_start
+ EXPORT __cy_memory_0_length
+ EXPORT __cy_memory_0_row_size
+
+ /* Working Flash */
+ EXPORT __cy_memory_1_start
+ EXPORT __cy_memory_1_length
+ EXPORT __cy_memory_1_row_size
+
+ /* Supervisory Flash */
+ EXPORT __cy_memory_2_start
+ EXPORT __cy_memory_2_length
+ EXPORT __cy_memory_2_row_size
+
+ /* XIP */
+ EXPORT __cy_memory_3_start
+ EXPORT __cy_memory_3_length
+ EXPORT __cy_memory_3_row_size
+
+ /* eFuse */
+ EXPORT __cy_memory_4_start
+ EXPORT __cy_memory_4_length
+ EXPORT __cy_memory_4_row_size
+
+ /* Flash */
+__cy_memory_0_start EQU __cpp(CY_FLASH_BASE)
+__cy_memory_0_length EQU __cpp(CY_FLASH_SIZE)
+__cy_memory_0_row_size EQU 0x200
+
+ /* Flash region for EEPROM emulation */
+__cy_memory_1_start EQU __cpp(CY_EM_EEPROM_BASE)
+__cy_memory_1_length EQU __cpp(CY_EM_EEPROM_SIZE)
+__cy_memory_1_row_size EQU 0x200
+
+ /* Supervisory Flash */
+__cy_memory_2_start EQU __cpp(CY_SFLASH_BASE)
+__cy_memory_2_length EQU __cpp(CY_SFLASH_SIZE)
+__cy_memory_2_row_size EQU 0x200
+
+ /* XIP */
+__cy_memory_3_start EQU __cpp(CY_XIP_BASE)
+__cy_memory_3_length EQU __cpp(CY_XIP_SIZE)
+__cy_memory_3_row_size EQU 0x200
+
+ /* eFuse */
+__cy_memory_4_start EQU __cpp(0x90700000)
+__cy_memory_4_length EQU __cpp(0x100000)
+__cy_memory_4_row_size EQU __cpp(1)
+}
+#endif /* defined (__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050) */
+
+
+/* [] END OF FILE */
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/EULA b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/EULA
new file mode 100644
index 0000000000000000000000000000000000000000..f10c742b1023a8993a0a287d3afc221f20330147
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/EULA
@@ -0,0 +1,55 @@
+CYPRESS END USER LICENSE AGREEMENT
+
+PLEASE READ THIS END USER LICENSE AGREEMENT ("Agreement") CAREFULLY BEFORE DOWNLOADING, INSTALLING, COPYING, OR USING THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION. BY DOWNLOADING, INSTALLING, COPYING OR USING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, PROMPTLY RETURN AND DO NOT USE THE SOFTWARE. IF YOU HAVE PURCHASED THIS LICENSE TO THE SOFTWARE, YOUR RIGHT TO RETURN THE SOFTWARE EXPIRES 30 DAYS AFTER YOUR PURCHASE AND APPLIES ONLY TO THE ORIGINAL PURCHASER.
+
+1. Definitions.
+
+ "Software" means this software and any accompanying documentation, including any upgrades, updates, bug fixes or modified versions provided to you by Cypress.
+
+ "Source Code" means software in human-readable form.
+
+ "Binary Code" means the software in binary code form such as object code or an executable.
+
+ "Development Tools" means software that is intended to be installed on a personal computer and used to create programming code for Firmware, Drivers, or Host Applications. Examples of Development Tools are Cypress's PSoC Creator software, Cypress's WICED SDKs, and Cypress's ModusToolbox software.
+
+ "Firmware" means software that executes on a Cypress hardware product.
+
+ "Driver" means software that enables the use of a Cypress hardware product on a particular host operating system such as GNU/Linux, Windows, MacOS, Android, and iOS.
+
+ "Host Application" means software that executes on a device other than a Cypress hardware product in order to program, control, or communicate with a Cypress hardware product.
+
+ "inf File" means a hardware setup information file (.inf file) created by the Software to allow a Microsoft Windows operating system to install the driver for a Cypress hardware product.
+
+2. License. Subject to the terms and conditions of this Agreement, Cypress Semiconductor Corporation ("Cypress") and its suppliers grant to you a non-exclusive, non-transferable license under their copyright rights:
+
+ a. to use the Development Tools in object code form solely for the purpose of creating Firmware, Drivers, Host Applications, and inf Files for Cypress hardware products; and
+
+ b. (i) if provided in Source Code form, to copy, modify, and compile the Firmware Source Code to create Firmware for execution on a Cypress hardware product, and (ii) to distribute Firmware in binary code form only, only when installed onto a Cypress hardware product; and
+
+ c. (i) if provided in Source Code form, to copy, modify, and compile the Driver Source Code to create one or more Drivers to enable the use of a Cypress hardware product on a particular host operating system, and (ii) to distribute the Driver, in binary code form only, only when installed on a device that includes the Cypress hardware product that the Driver is intended to enable; and
+
+ d. (i) if provided in Source Code form, to copy, modify, and compile the Host Application Source Code to create one or more Host Applications to program, control, or communicate with a Cypress hardware product, and (ii) to distribute Host Applications, in binary code form only, only when installed on a device that includes a Cypress hardware product that the Host Application is intended to program, control, or communicate with; and
+
+ e. to freely distribute any inf File.
+
+Any distribution of Software permitted under this Agreement must be made pursuant to your standard end user license agreement used for your proprietary (closed source) software products, such end user license agreement to include, at a minimum, provisions limiting your licensors' liability and prohibiting reverse engineering of the Software, consistent with such provisions in this Agreement.
+
+3. Free and Open Source Software. Portions of the Software may be licensed under free and/or open source licenses such as the GNU General Public License or other licenses from third parties ("Third Party Software"). Third Party Software is subject to the applicable license agreement and not this Agreement. If you are entitled to receive the source code from Cypress for any Third Party Software included with the Software, either the source code will be included with the Software or you may obtain the source code at no charge from . The applicable license terms will accompany each source code package. To review the license terms applicable to any Third Party Software for which Cypress is not required to provide you with source code, please see the Software's installation directory on your computer.
+
+4. Proprietary Rights; Ownership. The Software, including all intellectual property rights therein, is and will remain the sole and exclusive property of Cypress or its suppliers. Cypress retains ownership of the Source Code and any compiled version thereof. Subject to Cypress' ownership of the underlying Software (including Source Code), you retain ownership of any modifications you make to the Source Code. You agree not to remove any Cypress copyright or other notices from the Source Code and any modifications thereof. You agree to keep the Source Code confidential. Any reproduction, modification, translation, compilation, or representation of the Source Code except as permitted in Section 2 ("License") is prohibited without the express written permission of Cypress. Except as otherwise expressly provided in this Agreement, you may not: (i) modify, adapt, or create derivative works based upon the Software; (ii) copy the Software; (iii) except and only to the extent explicitly permitted by applicable law despite this limitation, decompile, translate, reverse engineer, disassemble or otherwise reduce the Software to human-readable form; or (iv) use the Software or any sample code other than for the Purpose. You hereby covenant that you will not assert any claim that the Software, or derivative works thereof created by or for Cypress, infringe any intellectual property right owned or controlled by you
+
+5. No Support. Cypress may, but is not required to, provide technical support for the Software.
+
+6. Term and Termination. This Agreement is effective until terminated, and either party may terminate this Agreement at any time with or without cause. This Agreement and your license rights under this Agreement will terminate immediately without notice from Cypress if you fail to comply with any provision of this Agreement. Upon termination, you must destroy all copies of Software in your possession or control. The following paragraphs shall survive any termination of this Agreement: "Free and Open Source Software," "Proprietary Rights; Ownership," "Compliance With Law," "Disclaimer," "Limitation of Liability," and "General."
+
+7. Compliance With Law. Each party agrees to comply with all applicable laws, rules and regulations in connection with its activities under this Agreement. Without limiting the foregoing, the Software may be subject to export control laws and regulations of the United States and other countries. You agree to comply strictly with all such laws and regulations and acknowledge that you have the responsibility to obtain licenses to export, re-export, or import the Software.
+
+8. Disclaimer. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THE SOFTWARE, INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes to the Software without notice. Cypress does not assume any liability arising out of the application or use of Software or any product or circuit described in the Software. It is the responsibility of the user of the Software to properly design, program, and test the functionality and safety of any application made of the Software and any resulting product. Cypress does not authorize its Software or products for use in any products where a malfunction or failure of the Software or Cypress product may reasonably be expected to result in significant property damage, injury or death ("High Risk Product"). If you include any Software or Cypress product in a High Risk Product, you assume all risk of such use and agree to indemnify Cypress and its suppliers against all liability. No computing device can be absolutely secure. Therefore, despite security measures implemented in Cypress hardware or software products, Cypress does not assume any liability arising out of any security breach, such as unauthorized access to or use of a Cypress product.
+
+9. Limitation of Liability. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL CYPRESS OR ITS SUPPLIERS, RESELLERS, OR DISTRIBUTORS BE LIABLE FOR ANY LOST REVENUE, PROFIT, OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL, OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF CYPRESS OR ITS SUPPLIERS, RESELLERS, OR DISTRIBUTORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT SHALL CYPRESS' OR ITS SUPPLIERS', RESELLERS', OR DISTRIBUTORS' TOTAL LIABILITY TO YOU, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE, EXCEED THE GREATER OF US$500 OR THE PRICE PAID BY YOU FOR THE SOFTWARE. THE FOREGOING LIMITATIONS SHALL APPLY EVEN IF THE ABOVE-STATED WARRANTY FAILS OF ITS ESSENTIAL PURPOSE. BECAUSE SOME STATES OR JURISDICTIONS DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL OR INCIDENTAL DAMAGES, ALL OR PORTIONS OF THE ABOVE LIMITATION MAY NOT APPLY TO YOU.
+
+10. Restricted Rights. The Software is commercial computer software as that term is described in 48 C.F.R. 252.227-7014(a)(1). If the Software is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the Government's rights in Software shall be only those set forth in this Agreement.
+
+11. Personal Information. You agree that information you provide through your registration on Cypress IoT Community Forum or other Cypress websites, including contact information or other personal information, may be collected and used by Cypress consistent with its Data Privacy Policy (www.cypress.com/privacy-policy), as updated or revised from time to time, and may be provided to its third party sales representatives, distributors and other entities conducting sales activities for Cypress for sales-related and other business purposes.
+
+12. General. This Agreement will bind and inure to the benefit of each party's successors and assigns, provided that you may not assign or transfer this Agreement, in whole or in part, without Cypress' written consent. This Agreement shall be governed by and construed in accordance with the laws of the State of California, United States of America, as if performed wholly within the state and without giving effect to the principles of conflict of law. The parties consent to personal and exclusive jurisdiction of and venue in, the state and federal courts within Santa Clara County, California; provided however, that nothing in this Agreement will limit Cypress' right to bring legal action in any venue in order to protect or enforce its intellectual property rights. No failure of either party to exercise or enforce any of its rights under this Agreement will act as a waiver of such rights. If any portion of this Agreement is found to be void or unenforceable, the remaining provisions of this Agreement shall remain in full force and effect. This Agreement is the complete and exclusive agreement between the parties with respect to the subject matter hereof, superseding and replacing any and all prior agreements, communications, and understandings (both written and oral) regarding such subject matter. Any notice to Cypress will be deemed effective when actually received and must be sent to Cypress Semiconductor Corporation, ATTN: Chief Legal Officer, 198 Champion Court, San Jose, CA 95134 USA.
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/LICENSE b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..59cd3f8a320657c5748e85f7b247eb838f39acfb
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/LICENSE
@@ -0,0 +1,165 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright
+owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities
+that control, are controlled by, or are under common control with that entity.
+For the purposes of this definition, "control" means (i) the power, direct or
+indirect, to cause the direction or management of such entity, whether by
+contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
+outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including
+but not limited to software source code, documentation source, and configuration
+files.
+
+"Object" form shall mean any form resulting from mechanical transformation or
+translation of a Source form, including but not limited to compiled object code,
+generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made
+available under the License, as indicated by a copyright notice that is included
+in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that
+is based on (or derived from) the Work and for which the editorial revisions,
+annotations, elaborations, or other modifications represent, as a whole, an
+original work of authorship. For the purposes of this License, Derivative Works
+shall not include works that remain separable from, or merely link (or bind by
+name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version
+of the Work and any modifications or additions to that Work or Derivative Works
+thereof, that is intentionally submitted to Licensor for inclusion in the Work
+by the copyright owner or by an individual or Legal Entity authorized to submit
+on behalf of the copyright owner. For the purposes of this definition,
+"submitted" means any form of electronic, verbal, or written communication sent
+to the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control systems, and
+issue tracking systems that are managed by, or on behalf of, the Licensor for
+the purpose of discussing and improving the Work, but excluding communication
+that is conspicuously marked or otherwise designated in writing by the copyright
+owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
+of whom a Contribution has been received by Licensor and subsequently
+incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable (except as stated in this section) patent license to make, have
+made, use, offer to sell, sell, import, and otherwise transfer the Work, where
+such license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by combination
+of their Contribution(s) with the Work to which such Contribution(s) was
+submitted. If You institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work or a
+Contribution incorporated within the Work constitutes direct or contributory
+patent infringement, then any patent licenses granted to You under this License
+for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof
+in any medium, with or without modifications, and in Source or Object form,
+provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of
+this License; and
+You must cause any modified files to carry prominent notices stating that You
+changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute,
+all copyright, patent, trademark, and attribution notices from the Source form
+of the Work, excluding those notices that do not pertain to any part of the
+Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any
+Derivative Works that You distribute must include a readable copy of the
+attribution notices contained within such NOTICE file, excluding those notices
+that do not pertain to any part of the Derivative Works, in at least one of the
+following places: within a NOTICE text file distributed as part of the
+Derivative Works; within the Source form or documentation, if provided along
+with the Derivative Works; or, within a display generated by the Derivative
+Works, if and wherever such third-party notices normally appear. The contents of
+the NOTICE file are for informational purposes only and do not modify the
+License. You may add Your own attribution notices within Derivative Works that
+You distribute, alongside or as an addendum to the NOTICE text from the Work,
+provided that such additional attribution notices cannot be construed as
+modifying the License.
+You may add Your own copyright statement to Your modifications and may provide
+additional or different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works as a whole,
+provided Your use, reproduction, and distribution of the Work otherwise complies
+with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted
+for inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the terms of
+any separate license agreement you may have executed with Licensor regarding
+such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks,
+service marks, or product names of the Licensor, except as required for
+reasonable and customary use in describing the origin of the Work and
+reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the
+Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+including, without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
+solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise of
+permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence),
+contract, or otherwise, unless required by applicable law (such as deliberate
+and grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special, incidental,
+or consequential damages of any character arising as a result of this License or
+out of the use or inability to use the Work (including but not limited to
+damages for loss of goodwill, work stoppage, computer failure or malfunction, or
+any and all other commercial damages or losses), even if such Contributor has
+been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to
+offer, and charge a fee for, acceptance of support, warranty, indemnity, or
+other liability obligations and/or rights consistent with this License. However,
+in accepting such obligations, You may act only on Your own behalf and on Your
+sole responsibility, not on behalf of any other Contributor, and only if You
+agree to indemnify, defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason of your
+accepting any such warranty or additional liability.
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/README.md b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..17eac80954e583fcad5a1f0312c29cdf8da016b4
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/README.md
@@ -0,0 +1,22 @@
+# PSoC 6 GNU make Build System
+
+## Overview
+
+This repo provides the build recipe make files and scripts for building and programming PSoC 6 applications. Builds can be run either through a command-line interface (CLI) or through the ModusToolbox Integrated Devlopment Environment (IDE).
+
+## Prerequisite
+
+Builds require that the ModusToolbox tools be installed on your machine. This comes with the ModusToolbox IDE install. On Windows machines, it is recommended that CLI builds be executed using the Cygwin.bat located in ModusToolBox/tools_x.y/modus-shell install directory. This guarantees a consistent shell environment for your builds.
+
+## Options
+
+To list the build options, run the "help" target by typing "make help" in CLI. For a verbose documentation on a specific subject type "make help CY_HELP={variable/target}", where "variable" or "target" is one of the listed make variables or targets.
+
+
+## More information
+* [Cypress Semiconductor](http://www.cypress.com)
+* [Cypress Semiconductor GitHub](https://github.com/cypresssemiconductorco)
+* [ModusToolbox](https://www.cypress.com/products/modustoolbox-software-environment)
+
+---
+© Cypress Semiconductor Corporation, 2019.
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/RELEASE.md b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/RELEASE.md
new file mode 100644
index 0000000000000000000000000000000000000000..7aefc341c5bdc14bbe5570561f35abaf6f934533
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/RELEASE.md
@@ -0,0 +1,39 @@
+### PSoC 6 GNU make Build System 1.0
+This repo provides the build recipe make files and scripts for building and programming PSoC 6 applications. Builds can be run either through a command-line interface (CLI) or through the ModusToolbox Integrated Devlopment Environment (IDE).
+
+### What's Included?
+The this release of the PSoC 6 GNU make Build System includes complete support for building, programming, and debugging PSoC 6 application projects. It is expected that a code example contains a top level make file for itself and references a Board Support Package (BSP) that defines specifics items, like the PSoC 6 part, for the target board. This includes the following:
+* Supported operations:
+ * Build
+ * Program
+ * Debug
+* Supported toolchains:
+ * GCC
+ * IAR
+ * ARMv6
+
+This also includes the getlibs.bash script that can be used directly, or via the make target to download additional git repo based libraries for the application.
+
+### Product/Asset Specific Instructions
+Builds require that the ModusToolbox tools be installed on your machine. This comes with the ModusToolbox IDE install. On Windows machines, it is recommended that CLI builds be executed using the Cygwin.bat located in ModusToolBox/tools_x.y/modus-shell install directory. This guarantees a consistent shell environment for your builds.
+
+To list the build options, run the "help" target by typing "make help" in CLI. For a verbose documentation on a specific subject type "make help CY_HELP={variable/target}", where "variable" or "target" is one of the listed make variables or targets.
+
+### Supported Software and Tools
+This version of the Cypress PSoC 6 Hardware Abstraction Layer was validated for compatibility with the following Software and Tools:
+
+| Software and Tools | Version |
+| :--- | :----: |
+| ModusToolbox Software Environment | 2.0 |
+| GCC Compiler | 7.4 |
+| IAR Compiler | 8.32 |
+| ARM Compiler | 6.11 |
+
+### More information
+Use the following links for more information, as needed:
+* [Cypress Semiconductor](http://www.cypress.com)
+* [Cypress Semiconductor GitHub](https://github.com/cypresssemiconductorco)
+* [ModusToolbox](https://www.cypress.com/products/modustoolbox-software-environment)
+
+---
+© Cypress Semiconductor Corporation, 2019.
\ No newline at end of file
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/build.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/build.mk
new file mode 100644
index 0000000000000000000000000000000000000000..72a867e5545167c0f88d2662939a050d71bb3863
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/build.mk
@@ -0,0 +1,694 @@
+################################################################################
+# \file build.mk
+# \version 1.0
+#
+# \brief
+# Performs the compilation and linking steps.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+
+################################################################################
+# Target output
+################################################################################
+
+ifneq ($(LIBNAME),)
+CY_BUILD_TARGET=$(CY_CONFIG_DIR)/$(LIBNAME).$(CY_TOOLCHAIN_SUFFIX_ARCHIVE)
+else
+CY_BUILD_TARGET=$(CY_CONFIG_DIR)/$(APPNAME).$(CY_TOOLCHAIN_SUFFIX_TARGET)
+endif
+CY_BUILD_MAPFILE=$(CY_CONFIG_DIR)/$(APPNAME).$(CY_TOOLCHAIN_SUFFIX_MAP)
+
+
+################################################################################
+# VPATH resolution
+################################################################################
+
+#
+# Search for relative path patterns in source list
+# $(1) : Pattern
+# $(2) : Sources
+#
+CY_MACRO_VPATH_FIND=$(foreach level,$(1),$(if $(filter $(level)%,$(2)),$(level)))
+
+#
+# Search for relative paths in user sources and include them in the VPATH
+#
+CY_BUILD_VPATH_PATTERN=./ ./../ ./../../ ./../../../ ./../../../../ ./../../../../../ ./../../../../../../ ./../../../../../../../ \
+ ../ ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../../
+VPATH+=$(call CY_MACRO_VPATH_FIND,$(CY_BUILD_VPATH_PATTERN),$(SOURCES))
+
+
+##############################################################################
+#
+# Macro to construct recursive make for dependent lib apps
+#
+# Arguments:
+# 1: The name of the target
+# 2: The lib app directory
+#
+define CY_MACRO_SHAREDLIB_DEPENDENCIES
+
+$(1)_SED_PATTERN=$(subst /,\/,$(subst .,\.,$(2)))
+ifeq ($(CY_BUILD_LOC),$(CY_APP_LOCATION)/build)
+$(1)_SHAREDLIB_BUILD_LOCATION?=$(2)/build/$(TARGET)/$(CONFIG)
+else
+$(1)_SHAREDLIB_BUILD_LOCATION?=$(CY_INTERNAL_BUILD_LOCATION)/$(1)/$(TARGET)/$(CONFIG)
+endif
+
+# Satisfy dependencies
+$$($(1)_SHAREDLIB_BUILD_LOCATION)/inclist.rsp: | shared_libs
+$$($(1)_SHAREDLIB_BUILD_LOCATION)/liblist.rsp: | shared_libs
+$$($(1)_SHAREDLIB_BUILD_LOCATION)/artifact.rsp: | shared_libs
+$(1)_shared_lib: | $$($(1)_SHAREDLIB_BUILD_LOCATION)/inclist.rsp $$($(1)_SHAREDLIB_BUILD_LOCATION)/liblist.rsp $$($(1)_SHAREDLIB_BUILD_LOCATION)/artifact.rsp
+
+$(1)_shared_lib:
+ @inclist_read=$$$$(cat $$($(1)_SHAREDLIB_BUILD_LOCATION)/inclist.rsp | sed -e "s/I\.\//I$$($(1)_SED_PATTERN)\//g" | tr " " "\n"); \
+ if [ -f "$$($(1)_SHAREDLIB_BUILD_LOCATION)/inclist_export.rsp" ]; then \
+ inclist_export_read=$$$$(cat $$($(1)_SHAREDLIB_BUILD_LOCATION)/inclist_export.rsp | tr " " "\n"); \
+ else \
+ echo $$$$inclist_read > $$($(1)_SHAREDLIB_BUILD_LOCATION)/inclist_export.rsp ;\
+ fi;\
+ if [[ "$$$$inclist_read" != "$$$$inclist_export_read" ]]; then \
+ echo $$$$inclist_read > $$($(1)_SHAREDLIB_BUILD_LOCATION)/inclist_export.rsp ;\
+ fi; \
+ liblist_read=$$$$(cat $$($(1)_SHAREDLIB_BUILD_LOCATION)/liblist.rsp | sed -e "s/\.\//$$($(1)_SED_PATTERN)\//g" | tr " " "\n"); \
+ if [ -f "$$($(1)_SHAREDLIB_BUILD_LOCATION)/liblist_export.rsp" ]; then \
+ liblist_export_read=$$$$(cat $$($(1)_SHAREDLIB_BUILD_LOCATION)/liblist_export.rsp | tr " " "\n"); \
+ else \
+ echo $$$$liblist_read > $$($(1)_SHAREDLIB_BUILD_LOCATION)/liblist_export.rsp ;\
+ fi;\
+ if [[ "$$$$liblist_read" != "$$$$liblist_export_read" ]]; then \
+ echo $$$$liblist_read > $$($(1)_SHAREDLIB_BUILD_LOCATION)/liblist_export.rsp ;\
+ fi; \
+ artifact_read=$$$$(sed '1s;^;$$($(1)_SHAREDLIB_BUILD_LOCATION)/;' $$($(1)_SHAREDLIB_BUILD_LOCATION)/artifact.rsp); \
+ if [ -f "$$($(1)_SHAREDLIB_BUILD_LOCATION)/artifact_export.rsp" ]; then \
+ artifact_export_read=$$$$(cat $$($(1)_SHAREDLIB_BUILD_LOCATION)/artifact_export.rsp); \
+ else \
+ echo $$$$artifact_read > $$($(1)_SHAREDLIB_BUILD_LOCATION)/artifact_export.rsp;\
+ fi;\
+ if [[ "$$$$artifact_read" -nt "$(CY_BUILD_TARGET)" ]] || [[ "$$$$artifact_read" != "$$$$artifact_export_read" ]]; then\
+ echo $$$$artifact_read > $$($(1)_SHAREDLIB_BUILD_LOCATION)/artifact_export.rsp;\
+ fi;
+
+# Satisfy dependencies
+$$($(1)_SHAREDLIB_BUILD_LOCATION)/inclist_export.rsp: | $(1)_shared_lib
+$$($(1)_SHAREDLIB_BUILD_LOCATION)/liblist_export.rsp: | $(1)_shared_lib
+$$($(1)_SHAREDLIB_BUILD_LOCATION)/artifact_export.rsp: | $(1)_shared_lib
+
+endef
+
+
+################################################################################
+# Shared libraries
+################################################################################
+
+ifneq ($(SEARCH_LIBS_AND_INCLUDES),)
+
+# Construct targets for all dependent lib apps
+$(foreach lib,$(SEARCH_LIBS_AND_INCLUDES),$(eval $(call CY_MACRO_SHAREDLIB_DEPENDENCIES,$(notdir $(lib)),$(lib))))
+
+CY_SHAREDLIB_LIST=$(foreach lib,$(SEARCH_LIBS_AND_INCLUDES),$(notdir $(lib)_shared_lib))
+CY_SHAREDLIB_ARTIFACT_LIST=$(foreach lib,$(SEARCH_LIBS_AND_INCLUDES),$($(notdir $(lib))_SHAREDLIB_BUILD_LOCATION)/artifact.rsp)
+
+CY_SHAREDLIB_INCLUDES_EXPORT_LIST=$(foreach lib,$(SEARCH_LIBS_AND_INCLUDES),$($(notdir $(lib))_SHAREDLIB_BUILD_LOCATION)/inclist_export.rsp)
+CY_SHAREDLIB_LIBS_EXPORT_LIST=$(foreach lib,$(SEARCH_LIBS_AND_INCLUDES),$($(notdir $(lib))_SHAREDLIB_BUILD_LOCATION)/liblist_export.rsp)
+CY_SHAREDLIB_ARTIFACT_EXPORT_LIST=$(foreach lib,$(SEARCH_LIBS_AND_INCLUDES),$($(notdir $(lib))_SHAREDLIB_BUILD_LOCATION)/artifact_export.rsp)
+
+CY_BUILD_SHAREDLIB_INCLIST=$(foreach inc,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST),$(addprefix $(CY_TOOLCHAIN_INCRSPFILE),$(inc)))
+CY_BUILD_SHAREDLIB_LIBLIST=$(foreach lib,$(CY_SHAREDLIB_LIBS_EXPORT_LIST),$(addprefix $(CY_TOOLCHAIN_OBJRSPFILE),$(lib)))\
+ $(foreach artifact,$(CY_SHAREDLIB_ARTIFACT_EXPORT_LIST),$(addprefix $(CY_TOOLCHAIN_OBJRSPFILE),$(artifact)))
+
+# Sentinel file to always trigger link step
+CY_SHAREDLIB_TIMESTAMP=$(CY_CONFIG_DIR)/shared_libs.timestamp
+$(shell touch $(CY_SHAREDLIB_TIMESTAMP))
+
+endif
+
+
+################################################################################
+# Build arguments
+################################################################################
+
+#
+# The list of C and S source files that come from the application and generated source
+#
+CY_BUILD_SRC_S_FILES=$(patsubst $(CY_INTERNAL_APP_PATH)/%,/%,$(patsubst $(CY_INTERNAL_EXTAPP_PATH)/%,/%,\
+ $(filter %.$(CY_TOOLCHAIN_SUFFIX_S),$(CY_RECIPE_SOURCE))))
+CY_BUILD_SRC_s_FILES=$(patsubst $(CY_INTERNAL_APP_PATH)/%,/%,$(patsubst $(CY_INTERNAL_EXTAPP_PATH)/%,/%,\
+ $(filter %.$(CY_TOOLCHAIN_SUFFIX_s),$(CY_RECIPE_SOURCE))))
+CY_BUILD_SRC_C_FILES=$(patsubst $(CY_INTERNAL_APP_PATH)/%,/%,$(patsubst $(CY_INTERNAL_EXTAPP_PATH)/%,/%,\
+ $(filter %.$(CY_TOOLCHAIN_SUFFIX_C),$(CY_RECIPE_SOURCE))))
+CY_BUILD_SRC_CPP_FILES=$(patsubst $(CY_INTERNAL_APP_PATH)/%,/%,$(patsubst $(CY_INTERNAL_EXTAPP_PATH)/%,/%,\
+ $(filter %.$(CY_TOOLCHAIN_SUFFIX_CPP),$(CY_RECIPE_SOURCE))))
+CY_BUILD_GENSRC_S_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_S),$(CY_RECIPE_GENERATED))
+CY_BUILD_GENSRC_s_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_s),$(CY_RECIPE_GENERATED))
+CY_BUILD_GENSRC_C_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_C),$(CY_RECIPE_GENERATED))
+CY_BUILD_GENSRC_CPP_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_CPP),$(CY_RECIPE_GENERATED))
+CY_BUILD_EXTSRC_S_FILES=$(patsubst $(CY_INTERNAL_APP_PATH)/%,/%,$(subst ../,,$(filter %.$(CY_TOOLCHAIN_SUFFIX_S),$(SOURCES))))
+CY_BUILD_EXTSRC_s_FILES=$(patsubst $(CY_INTERNAL_APP_PATH)/%,/%,$(subst ../,,$(filter %.$(CY_TOOLCHAIN_SUFFIX_s),$(SOURCES))))
+CY_BUILD_EXTSRC_C_FILES=$(patsubst $(CY_INTERNAL_APP_PATH)/%,/%,$(subst ../,,$(filter %.$(CY_TOOLCHAIN_SUFFIX_C),$(SOURCES))))
+CY_BUILD_EXTSRC_CPP_FILES=$(patsubst $(CY_INTERNAL_APP_PATH)/%,/%,$(subst ../,,$(filter %.$(CY_TOOLCHAIN_SUFFIX_CPP),$(SOURCES))))
+
+#
+# The list of object files
+#
+CY_BUILD_SRC_S_OBJ_FILES=$(addprefix $(CY_CONFIG_DIR)/,$(CY_BUILD_SRC_S_FILES:%.$(CY_TOOLCHAIN_SUFFIX_S)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_SRC_s_OBJ_FILES=$(addprefix $(CY_CONFIG_DIR)/,$(CY_BUILD_SRC_s_FILES:%.$(CY_TOOLCHAIN_SUFFIX_s)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_SRC_C_OBJ_FILES=$(addprefix $(CY_CONFIG_DIR)/,$(CY_BUILD_SRC_C_FILES:%.$(CY_TOOLCHAIN_SUFFIX_C)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_SRC_CPP_OBJ_FILES=$(addprefix $(CY_CONFIG_DIR)/,$(CY_BUILD_SRC_CPP_FILES:%.$(CY_TOOLCHAIN_SUFFIX_CPP)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_GENSRC_S_OBJ_FILES=$(patsubst $(CY_BUILDTARGET_DIR)/%,$(CY_CONFIG_DIR)/%,$(CY_BUILD_GENSRC_S_FILES:%.$(CY_TOOLCHAIN_SUFFIX_S)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_GENSRC_s_OBJ_FILES=$(patsubst $(CY_BUILDTARGET_DIR)/%,$(CY_CONFIG_DIR)/%,$(CY_BUILD_GENSRC_s_FILES:%.$(CY_TOOLCHAIN_SUFFIX_s)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_GENSRC_C_OBJ_FILES=$(patsubst $(CY_BUILDTARGET_DIR)/%,$(CY_CONFIG_DIR)/%,$(CY_BUILD_GENSRC_C_FILES:%.$(CY_TOOLCHAIN_SUFFIX_C)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_GENSRC_CPP_OBJ_FILES=$(patsubst $(CY_BUILDTARGET_DIR)/%,$(CY_CONFIG_DIR)/%,$(CY_BUILD_GENSRC_CPP_FILES:%.$(CY_TOOLCHAIN_SUFFIX_CPP)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_EXTSRC_S_OBJ_FILES=$(addprefix $(CY_CONFIG_DIR)/user/,$(CY_BUILD_EXTSRC_S_FILES:%.$(CY_TOOLCHAIN_SUFFIX_S)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_EXTSRC_s_OBJ_FILES=$(addprefix $(CY_CONFIG_DIR)/user/,$(CY_BUILD_EXTSRC_s_FILES:%.$(CY_TOOLCHAIN_SUFFIX_s)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_EXTSRC_C_OBJ_FILES=$(addprefix $(CY_CONFIG_DIR)/user/,$(CY_BUILD_EXTSRC_C_FILES:%.$(CY_TOOLCHAIN_SUFFIX_C)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+CY_BUILD_EXTSRC_CPP_OBJ_FILES=$(addprefix $(CY_CONFIG_DIR)/user/,$(CY_BUILD_EXTSRC_CPP_FILES:%.$(CY_TOOLCHAIN_SUFFIX_CPP)=%.$(CY_TOOLCHAIN_SUFFIX_O)))
+
+CY_BUILD_ALL_OBJ_FILES=\
+ $(call CY_MACRO_REMOVE_DOUBLESLASH,\
+ $(CY_BUILD_SRC_S_OBJ_FILES)\
+ $(CY_BUILD_SRC_s_OBJ_FILES)\
+ $(CY_BUILD_SRC_C_OBJ_FILES)\
+ $(CY_BUILD_SRC_CPP_OBJ_FILES)\
+ $(CY_BUILD_GENSRC_S_OBJ_FILES)\
+ $(CY_BUILD_GENSRC_s_OBJ_FILES)\
+ $(CY_BUILD_GENSRC_C_OBJ_FILES)\
+ $(CY_BUILD_GENSRC_CPP_OBJ_FILES)\
+ $(CY_BUILD_EXTSRC_S_OBJ_FILES)\
+ $(CY_BUILD_EXTSRC_s_OBJ_FILES)\
+ $(CY_BUILD_EXTSRC_C_OBJ_FILES)\
+ $(CY_BUILD_EXTSRC_CPP_OBJ_FILES))
+
+#
+# Dependency files
+#
+CY_DEPENDENCY_FILES=$(CY_BUILD_ALL_OBJ_FILES:%.$(CY_TOOLCHAIN_SUFFIX_O)=%.$(CY_TOOLCHAIN_SUFFIX_D))
+
+#
+# The list of static libraries
+#
+CY_BUILD_ALL_LIB_FILES=$(CY_RECIPE_LIBS)
+
+#
+# Output directories
+#
+CY_BUILD_DIRS=$(sort $(call CY_MACRO_DIR,$(CY_BUILD_ALL_OBJ_FILES)) $(call CY_MACRO_DIR,$(CY_BUILD_TARGET)))
+
+#
+# Check Windows path length limit for build directories
+#
+ifeq ($(OS),Windows_NT)
+CY_BUILD_CHECK_STRLEN:=$(shell \
+ for directory in $(CY_BUILD_DIRS); do\
+ if [ "$${\#directory}" -ge 260 ]; then\
+ echo "$$directory";\
+ fi;\
+ done)
+
+ifneq ($(strip $(CY_BUILD_CHECK_STRLEN)),)
+$(error Detected path(s) that exceed the Windows path length: $(CY_BUILD_CHECK_STRLEN))
+endif
+endif
+
+#
+# Prints full/shortened source name
+#
+ifneq (,$(filter $(VERBOSE),true 1))
+CY_COMPILE_PRINT=$<
+else
+CY_COMPILE_PRINT=$(notdir $<)
+endif
+
+#
+# Gather the includes in inclist_export.rsp files
+# $(1) : List of inclist_export.rsp files
+#
+CY_MACRO_ECLIPSE_PRINT=$(shell \
+ for incFile in $(1); do\
+ incDirs="$$incDirs $$(cat $$incFile)";\
+ done;\
+ echo $$incDirs)
+
+#
+# Construct the full list of flags
+#
+CY_BUILD_ALL_ASFLAGS_UC=\
+ $(CY_RECIPE_ASFLAGS)\
+ $(CY_RECIPE_DEFINES)
+
+CY_BUILD_ALL_ASFLAGS_LC=\
+ $(CY_RECIPE_ASFLAGS)
+
+CY_BUILD_ALL_CFLAGS=\
+ $(CY_RECIPE_CFLAGS)\
+ $(CY_RECIPE_DEFINES)
+
+CY_BUILD_ALL_CXXFLAGS=\
+ $(CY_RECIPE_CXXFLAGS)\
+ $(CY_RECIPE_DEFINES)
+
+#
+# Compiler arguments
+#
+CY_BUILD_COMPILE_AS_UC=$(AS) $(CY_BUILD_ALL_ASFLAGS_UC) $(CY_TOOLCHAIN_INCRSPFILE_ASM)$(CY_CONFIG_DIR)/inclist.rsp \
+ $(CY_BUILD_SHAREDLIB_INCLIST) $(CY_TOOLCHAIN_OUTPUT_OPTION)
+CY_BUILD_COMPILE_AS_LC=$(AS) $(CY_BUILD_ALL_ASFLAGS_LC) $(CY_TOOLCHAIN_INCRSPFILE_ASM)$(CY_CONFIG_DIR)/inclist.rsp \
+ $(CY_BUILD_SHAREDLIB_INCLIST) $(CY_TOOLCHAIN_OUTPUT_OPTION)
+CY_BUILD_COMPILE_C=$(CC) $(CY_BUILD_ALL_CFLAGS) $(CY_TOOLCHAIN_INCRSPFILE)$(CY_CONFIG_DIR)/inclist.rsp \
+ $(CY_BUILD_SHAREDLIB_INCLIST) $(CY_TOOLCHAIN_DEPENDENCIES) $(CY_TOOLCHAIN_OUTPUT_OPTION)
+CY_BUILD_COMPILE_CPP=$(CXX) $(CY_BUILD_ALL_CXXFLAGS) $(CY_TOOLCHAIN_INCRSPFILE)$(CY_CONFIG_DIR)/inclist.rsp \
+ $(CY_BUILD_SHAREDLIB_INCLIST) $(CY_TOOLCHAIN_DEPENDENCIES) $(CY_TOOLCHAIN_OUTPUT_OPTION)
+
+#
+# Linker arguments
+#
+CY_BUILD_LINK=$(LD) $(CY_RECIPE_LDFLAGS) $(CY_TOOLCHAIN_OUTPUT_OPTION) $@ $(CY_TOOLCHAIN_MAPFILE)$(CY_BUILD_MAPFILE) \
+ $(CY_TOOLCHAIN_OBJRSPFILE)$(CY_CONFIG_DIR)/objlist.rsp \
+ $(CY_TOOLCHAIN_STARTGROUP) $(CY_RECIPE_EXTRA_LIBS) $(CY_BUILD_ALL_LIB_FILES) $(CY_BUILD_SHAREDLIB_LIBLIST) $(CY_TOOLCHAIN_ENDGROUP)
+
+#
+# Archiver arguments
+#
+CY_BUILD_ARCHIVE=$(AR) $(CY_RECIPE_ARFLAGS) $(CY_TOOLCHAIN_OUTPUT_OPTION) $@ $(CY_TOOLCHAIN_OBJRSPFILE)$(CY_CONFIG_DIR)/objlist.rsp
+
+
+################################################################################
+# Dependency construction
+################################################################################
+
+#
+# Dependency variables for compilation
+#
+CY_BUILD_COMPILER_DEPS=\
+ $(CY_BUILD_COMPILE_AS_UC)\
+ $(CY_BUILD_COMPILE_AS_LC)\
+ $(CY_BUILD_COMPILE_C)\
+ $(CY_BUILD_COMPILE_CPP)\
+ $(CY_RECIPE_INCLUDES)
+
+#
+# Dependency variables for link/archive
+#
+CY_BUILD_LINKER_DEPS=\
+ $(CY_BUILD_LINK)\
+ $(CY_BUILD_ARCHIVE)\
+ $(CY_SHAREDLIB_ARTIFACT_EXPORT_LIST)
+
+#
+# Read previous build's configuration if one exists
+#
+CY_BUILD_COMPILER_PREV=$(shell if [ -f "$(CY_CONFIG_DIR)/.cycompiler" ]; then cat $(CY_CONFIG_DIR)/.cycompiler; fi)
+CY_BUILD_LINKER_PREV=$(shell if [ -f "$(CY_CONFIG_DIR)/.cylinker" ]; then cat $(CY_CONFIG_DIR)/.cylinker; fi)
+
+#
+# Take care of the quotes for the echo command
+#
+CY_BUILD_COMPILER_DEPS_FORMATTED=$(subst ',,$(subst ",,$(CY_BUILD_COMPILER_DEPS)))
+CY_BUILD_LINKER_DEPS_FORMATTED=$(subst ',,$(subst ",,$(CY_BUILD_LINKER_DEPS)))
+
+#
+# Create compilation dependency file
+#
+ifneq ($(strip $(CY_BUILD_COMPILER_DEPS_FORMATTED)),$(strip $(CY_BUILD_COMPILER_PREV)))
+ifeq ($(CY_BUILD_COMPILER_PREV),)
+$(shell mkdir -p $(CY_CONFIG_DIR))
+endif
+$(shell echo "$(CY_BUILD_COMPILER_DEPS_FORMATTED)" > $(CY_CONFIG_DIR)/.cycompiler)
+endif
+
+#
+# Create link dependency file
+#
+ifneq ($(strip $(CY_BUILD_LINKER_DEPS_FORMATTED)),$(strip $(CY_BUILD_LINKER_PREV)))
+ifneq ($(CY_BUILD_LINKER_PREV),)
+$(shell mkdir -p $(CY_CONFIG_DIR))
+endif
+$(shell echo "$(CY_BUILD_LINKER_DEPS_FORMATTED)" > $(CY_CONFIG_DIR)/.cylinker)
+endif
+
+
+################################################################################
+# Application source Compilation
+################################################################################
+
+# Compile .S source
+$(CY_CONFIG_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_INTERNAL_APP_PATH)/%.$(CY_TOOLCHAIN_SUFFIX_S)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling app file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_AS_UC) $@ $<
+
+# Compile .s source
+$(CY_CONFIG_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_INTERNAL_APP_PATH)/%.$(CY_TOOLCHAIN_SUFFIX_s)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling app file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_AS_LC) $@ $<
+
+# Compile .c source
+$(CY_CONFIG_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_INTERNAL_APP_PATH)/%.$(CY_TOOLCHAIN_SUFFIX_C)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling app file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_C) $@ $<
+
+# Compile .cpp source
+$(CY_CONFIG_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_INTERNAL_APP_PATH)/%.$(CY_TOOLCHAIN_SUFFIX_CPP)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling app file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_CPP) $@ $<
+
+
+################################################################################
+# ExtApp source Compilation
+################################################################################
+
+# Compile .S source
+$(CY_CONFIG_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_INTERNAL_EXTAPP_PATH)/%.$(CY_TOOLCHAIN_SUFFIX_S)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling extapp file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_AS_UC) $@ $<
+
+# Compile .s source
+$(CY_CONFIG_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_INTERNAL_EXTAPP_PATH)/%.$(CY_TOOLCHAIN_SUFFIX_s)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling extapp file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_AS_LC) $@ $<
+
+# Compile .c source
+$(CY_CONFIG_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_INTERNAL_EXTAPP_PATH)/%.$(CY_TOOLCHAIN_SUFFIX_C)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling extapp file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_C) $@ $<
+
+# Compile .cpp source
+$(CY_CONFIG_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_INTERNAL_EXTAPP_PATH)/%.$(CY_TOOLCHAIN_SUFFIX_CPP)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling extapp file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_CPP) $@ $<
+
+
+################################################################################
+# Generated Source Compilation
+################################################################################
+
+# Compile .S source
+$(CY_CONFIG_DIR)/generated/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_GENERATED_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_S)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling generated file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_AS_UC) $@ $<
+
+# Compile .s source
+$(CY_CONFIG_DIR)/generated/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_GENERATED_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_s)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling generated file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_AS_LC) $@ $<
+
+# Compile .c source
+$(CY_CONFIG_DIR)/generated/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_GENERATED_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_C)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling generated file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_C) $@ $<
+
+# Compile .cpp source
+$(CY_CONFIG_DIR)/generated/%.$(CY_TOOLCHAIN_SUFFIX_O) : $(CY_GENERATED_DIR)/%.$(CY_TOOLCHAIN_SUFFIX_CPP)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling generated file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_CPP) $@ $<
+
+
+################################################################################
+# User source Compilation
+################################################################################
+
+# Compile .S source
+$(CY_CONFIG_DIR)/user/%.$(CY_TOOLCHAIN_SUFFIX_O) : %.$(CY_TOOLCHAIN_SUFFIX_S)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling user file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_AS_UC) $@ $<
+
+# Compile .s source
+$(CY_CONFIG_DIR)/user/%.$(CY_TOOLCHAIN_SUFFIX_O) : %.$(CY_TOOLCHAIN_SUFFIX_s)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling user file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_AS_LC) $@ $<
+
+# Compile .c source
+$(CY_CONFIG_DIR)/user/%.$(CY_TOOLCHAIN_SUFFIX_O) : %.$(CY_TOOLCHAIN_SUFFIX_C)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling user file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_C) $@ $<
+
+# Compile .cpp source
+$(CY_CONFIG_DIR)/user/%.$(CY_TOOLCHAIN_SUFFIX_O) : %.$(CY_TOOLCHAIN_SUFFIX_CPP)
+ifneq ($(CY_MAKE_IDE),eclipse)
+ $(info $(CY_INDENT)Compiling user file $(CY_COMPILE_PRINT))
+else
+ $(info Compiling $< $(CY_RECIPE_DEFINES) $(sort $(CY_RECIPE_INCLUDES) $(call CY_MACRO_ECLIPSE_PRINT,$(CY_SHAREDLIB_INCLUDES_EXPORT_LIST))))
+endif
+ $(CY_NOISE)$(CY_BUILD_COMPILE_CPP) $@ $<
+
+
+################################################################################
+# Prebuild, Postbuild and Link
+################################################################################
+
+#
+# Top-level application dependency
+#
+app: CY_BUILD_sentinel
+
+#
+# Print information before we start the build
+#
+CY_BUILD_preprint: | $(CY_SHAREDLIB_INCLUDES_EXPORT_LIST) $(CY_SHAREDLIB_LIBS_EXPORT_LIST) $(CY_SHAREDLIB_ARTIFACT_EXPORT_LIST)
+ $(info )
+ $(info ==============================================================================)
+ $(info = Building application =)
+ $(info ==============================================================================)
+
+#
+# Create the directories needed to do the build
+#
+CY_BUILD_mkdirs: CY_BUILD_preprint
+ $(CY_NOISE)mkdir -p $(CY_BUILD_DIRS) $(CY_CMD_TERM)
+ifeq ($(CY_RECIPE_GENERATED_FLAG),TRUE)
+ $(CY_NOISE)mkdir -p $(CY_GENERATED_DIR) $(CY_CMD_TERM)
+endif
+
+#
+# Run BSP pre-build step
+#
+CY_BUILD_bsp_prebuild: CY_BUILD_mkdirs
+ $(CY_BSP_PREBUILD)
+
+#
+# Run application pre-build step
+#
+CY_BUILD_app_prebuild: CY_BUILD_bsp_prebuild
+ $(PREBUILD)
+
+#
+# Run generate source step
+#
+CY_BUILD_gensrc: CY_BUILD_app_prebuild
+ifneq ($(CY_SEARCH_RESOURCE_FILES),)
+ @echo $(CY_RECIPE_RESOURCE_FILES) > $(CY_GENERATED_DIR)/resources.cyrsc
+endif
+ifeq ($(CY_RECIPE_GENERATED_FLAG),TRUE)
+ $(CY_NOISE)$(CY_RECIPE_GENSRC) $(CY_CMD_TERM)
+ $(info Generated $(words $(CY_RECIPE_GENERATED)) source file(s))
+endif
+
+#
+# Add dependancy to support parallel builds
+#
+$(CY_BUILD_GENSRC_C_FILES): | CY_BUILD_gensrc
+
+#
+# Run pre-build step
+#
+CY_BUILD_prebuild: CY_BUILD_gensrc
+ $(CY_NOISE)$(CY_RECIPE_PREBUILD) $(CY_CMD_TERM)
+
+#
+# Print before compilation
+#
+CY_BUILD_precompile: CY_BUILD_prebuild
+ $(info Building $(words $(CY_BUILD_ALL_OBJ_FILES)) file(s))
+ @echo $(CY_RECIPE_INCLUDES) | tr " " "\n" > $(CY_CONFIG_DIR)/inclist.rsp; \
+ echo $(CY_BUILD_ALL_OBJ_FILES) | tr " " "\n" > $(CY_CONFIG_DIR)/objlist.rsp; \
+ echo $(CY_BUILD_ALL_LIB_FILES) | tr " " "\n" > $(CY_CONFIG_DIR)/liblist.rsp;
+
+#
+# Dependencies for compilation
+#
+$(CY_BUILD_ALL_OBJ_FILES): | CY_BUILD_precompile
+$(CY_BUILD_ALL_OBJ_FILES): $(CY_CONFIG_DIR)/.cycompiler $(CY_SHAREDLIB_INCLUDES_EXPORT_LIST)
+
+#
+# Dependencies for link
+#
+$(CY_BUILD_TARGET): | CY_BUILD_precompile
+$(CY_BUILD_TARGET): $(CY_CONFIG_DIR)/.cylinker $(CY_SHAREDLIB_LIBS_EXPORT_LIST) $(CY_SHAREDLIB_ARTIFACT_EXPORT_LIST)
+
+#
+# Link/archive the application
+#
+ifneq ($(LIBNAME),)
+$(CY_BUILD_TARGET): $(CY_BUILD_ALL_OBJ_FILES) $(CY_BUILD_ALL_LIB_FILES)
+ifneq ($(strip $(CY_BUILD_ALL_OBJ_FILES) $(CY_BUILD_ALL_LIB_FILES)),)
+ $(info $(CY_INDENT)Archiving output file $(notdir $@))
+ $(CY_NOISE)$(CY_BUILD_ARCHIVE) $(CY_CMD_TERM)
+endif
+else
+$(CY_BUILD_TARGET): $(CY_BUILD_ALL_OBJ_FILES) $(CY_BUILD_ALL_LIB_FILES) $(LINKER_SCRIPT) $(CY_SHAREDLIB_TIMESTAMP)
+ifneq ($(SEARCH_LIBS_AND_INCLUDES),)
+ @libArray=($(CY_SHAREDLIB_LIBS_EXPORT_LIST)); \
+ for libFile in "$${libArray[@]}"; do \
+ if [ "$$libFile" -nt "$(CY_BUILD_TARGET)" ]; then \
+ relink=true; \
+ fi; \
+ done; \
+ artifactArray=($(CY_SHAREDLIB_ARTIFACT_EXPORT_LIST)); \
+ for artifactFile in "$${artifactArray[@]}"; do \
+ if [ "$$artifactFile" -nt "$(CY_BUILD_TARGET)" ]; then \
+ relink=true; \
+ fi; \
+ done; \
+ if [[ "$?" == *".$(CY_TOOLCHAIN_SUFFIX_O)"* ]] || [[ "$?" == *".$(CY_TOOLCHAIN_SUFFIX_A)"* ]]; then \
+ relink=true; \
+ fi; \
+ if [ $$relink ]; then \
+ echo " Linking output file $(notdir $@)"; \
+ $(CY_BUILD_LINK); \
+ fi
+else
+ $(info $(CY_INDENT)Linking output file $(notdir $@))
+ $(CY_NOISE)$(CY_BUILD_LINK)
+endif
+endif
+
+#
+# Perform post-build step
+#
+CY_BUILD_postbuild: $(CY_BUILD_TARGET)
+ $(CY_NOISE)$(CY_RECIPE_POSTBUILD) $(CY_CMD_TERM)
+
+#
+# Run BSP post-build step
+#
+CY_BUILD_bsp_postbuild: CY_BUILD_postbuild
+ $(CY_BSP_POSTBUILD)
+
+#
+# Perform application post-build step
+#
+CY_BUILD_app_postbuild: CY_BUILD_bsp_postbuild
+ $(POSTBUILD)
+
+#
+# Perform the post build print step, basically stating we are done
+#
+CY_BUILD_postprint: CY_BUILD_app_postbuild
+ $(info ==============================================================================)
+ $(info = Build complete =)
+ $(info ==============================================================================)
+ $(info )
+
+#
+# Create an artifact sentinel file for shared libs
+#
+ifneq ($(LIBNAME),)
+CY_BUILD_sentinel: CY_BUILD_postprint
+ifneq ($(strip $(CY_BUILD_ALL_OBJ_FILES) $(CY_BUILD_ALL_LIB_FILES)),)
+ @echo $(LIBNAME).$(CY_TOOLCHAIN_SUFFIX_ARCHIVE) > $(CY_CONFIG_DIR)/artifact.rsp
+else
+ @touch $(CY_CONFIG_DIR)/artifact.rsp
+endif
+else
+CY_BUILD_sentinel: CY_BUILD_postprint
+
+endif
+
+#
+# Include generated dependency files (if rebuilding)
+#
+-include $(CY_DEPENDENCY_FILES)
+
+#
+# Indicate all phony targets that should be built regardless
+#
+.PHONY: app $(CY_SHAREDLIB_LIST)
+.PHONY: CY_BUILD_mkdirs
+.PHONY: CY_BUILD_prebuild CY_BUILD_app_prebuild CY_BUILD_bsp_prebuild
+.PHONY: CY_BUILD_postbuild CY_BUILD_app_postbuild CY_BUILD_bsp_postbuild
+.PHONY: CY_BUILD_gensrc
+.PHONY: CY_BUILD_genresource
+.PHONY: CY_BUILD_preprint
+.PHONY: CY_BUILD_postprint
+.PHONY: CY_BUILD_sentinel
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/config.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/config.mk
new file mode 100644
index 0000000000000000000000000000000000000000..dbfd07a6221c9f1dbb89279fa9df70cd31fa207d
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/config.mk
@@ -0,0 +1,235 @@
+################################################################################
+# \file config.mk
+# \version 1.0
+#
+# \brief
+# Configurator-related routines
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+#
+# Default file extension
+#
+CY_CONFIG_FILE_EXT?=modus
+
+
+################################################################################
+# Search
+################################################################################
+
+CY_CONFIG_MODUS_EXT=modus
+CY_CONFIG_CYBT_EXT=cybt
+CY_CONFIG_CYUSBDEV_EXT=cyusbdev
+
+#
+# Search for configuration files and filter
+#
+CY_CONFIG_MODUS_FILES:=$(call CY_MACRO_SEARCH,.$(CY_CONFIG_MODUS_EXT),$(CY_INTERNAL_APP_PATH))\
+ $(if $(CY_INTERNAL_EXTAPP_PATH),$(call CY_MACRO_SEARCH,.$(CY_CONFIG_MODUS_EXT),$(CY_INTERNAL_EXTAPP_PATH)))\
+ $(if $(SEARCH_LIBS_AND_INCLUDES),$(foreach d,$(SEARCH_LIBS_AND_INCLUDES),$(call CY_MACRO_SEARCH,.$(CY_CONFIG_MODUS_EXT),$(d))))
+CY_CONFIG_CYBT_FILES:=$(call CY_MACRO_SEARCH,.$(CY_CONFIG_CYBT_EXT),$(CY_INTERNAL_APP_PATH))\
+ $(if $(CY_INTERNAL_EXTAPP_PATH),$(call CY_MACRO_SEARCH,.$(CY_CONFIG_CYBT_EXT),$(CY_INTERNAL_EXTAPP_PATH)))\
+ $(if $(SEARCH_LIBS_AND_INCLUDES),$(foreach d,$(SEARCH_LIBS_AND_INCLUDES),$(call CY_MACRO_SEARCH,.$(CY_CONFIG_CYBT_EXT),$(d))))
+CY_CONFIG_CYUSBDEV_FILES:=$(call CY_MACRO_SEARCH,.$(CY_CONFIG_CYUSBDEV_EXT),$(CY_INTERNAL_APP_PATH))\
+ $(if $(CY_INTERNAL_EXTAPP_PATH),$(call CY_MACRO_SEARCH,.$(CY_CONFIG_CYUSBDEV_EXT),$(CY_INTERNAL_EXTAPP_PATH)))\
+ $(if $(SEARCH_LIBS_AND_INCLUDES),$(foreach d,$(SEARCH_LIBS_AND_INCLUDES),$(call CY_MACRO_SEARCH,.$(CY_CONFIG_CYUSBDEV_EXT),$(d))))
+
+CY_SEARCH_PRUNED_MODUS_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_DIRS),$(filter $(d)%,$(CY_CONFIG_MODUS_FILES))),$(CY_CONFIG_MODUS_FILES))
+CY_SEARCH_PRUNED_CYBT_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_DIRS),$(filter $(d)%,$(CY_CONFIG_CYBT_FILES))),$(CY_CONFIG_CYBT_FILES))
+CY_SEARCH_PRUNED_CYUSBDEV_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_DIRS),$(filter $(d)%,$(CY_CONFIG_CYUSBDEV_FILES))),$(CY_CONFIG_CYUSBDEV_FILES))
+
+CY_SEARCH_AVAILABLE_MODUS_SOURCES=$(call CY_MACRO_FILTER_FILES,MODUS)
+CY_SEARCH_AVAILABLE_CYBT_SOURCES=$(call CY_MACRO_FILTER_FILES,CYBT)
+CY_SEARCH_AVAILABLE_CYUSBDEV_SOURCES=$(call CY_MACRO_FILTER_FILES,CYUSBDEV)
+
+ifneq ($(words $(CY_SEARCH_AVAILABLE_MODUS_SOURCES)),1)
+ifneq ($(words $(CY_SEARCH_AVAILABLE_MODUS_SOURCES)),0)
+$(call CY_MACRO_ERROR,Multiple device configuration files detected: $(CY_SEARCH_AVAILABLE_MODUS_SOURCES))
+endif
+endif
+ifneq ($(words $(CY_SEARCH_AVAILABLE_CYBT_SOURCES)),1)
+ifneq ($(words $(CY_SEARCH_AVAILABLE_CYBT_SOURCES)),0)
+$(call CY_MACRO_ERROR,Multiple BT configuration files detected: $(CY_SEARCH_AVAILABLE_CYBT_SOURCES))
+endif
+endif
+ifneq ($(words $(CY_SEARCH_AVAILABLE_CYUSBDEV_SOURCES)),1)
+ifneq ($(words $(CY_SEARCH_AVAILABLE_CYUSBDEV_SOURCES)),0)
+$(call CY_MACRO_ERROR,Multiple USBDEV configuration files detected: $(CY_SEARCH_AVAILABLE_CYUSBDEV_SOURCES))
+endif
+endif
+
+
+################################################################################
+# Arguments constructions
+################################################################################
+
+##########################
+# .modus (HW)
+##########################
+
+CY_CONFIG_MODUS_FILE?=$(CY_SEARCH_AVAILABLE_MODUS_SOURCES)
+CY_CONFIG_MODUS_OUTPUT=$(call CY_MACRO_DIR,$(CY_CONFIG_MODUS_FILE))/GeneratedSource
+
+ifeq ($(CY_DEVICESUPPORT_PATH),)
+CY_CONFIG_LIBFILE=
+else
+CY_CONFIG_LIBFILE=--library $(CY_INTERNAL_DEVICESUPPORT_PATH)/devicesupport.xml
+endif
+
+CY_CONFIG_MODUS_EXEC=$(CY_CFG_BACKEND_CLI_DIR)/cfg-backend-cli
+CY_CONFIG_MODUS_EXEC_FLAGS=\
+ $(CY_CONFIG_LIBFILE)\
+ --build $(CY_CONFIG_MODUS_FILE)\
+ --set-device=$(subst $(CY_SPACE),$(CY_COMMA),$(DEVICE) $(ADDITIONAL_DEVICES))
+
+CY_CONFIG_MODUS_GUI=$(CY_DEVICE_CONFIGURATOR_DIR)/device-configurator
+CY_CONFIG_MODUS_GUI_FLAGS=\
+ --design
+
+##########################
+# .cybt (SW)
+##########################
+
+CY_CONFIG_CYBT_FILE?=$(CY_SEARCH_AVAILABLE_CYBT_SOURCES)
+CY_CONFIG_CYBT_OUTPUT=$(call CY_MACRO_DIR,$(CY_CONFIG_CYBT_FILE))/GeneratedSource
+
+CY_CONFIG_CYBT_EXEC=$(CY_BT_CONFIGURATOR_DIR)/bt-configurator-cli
+CY_CONFIG_CYBT_EXEC_FLAGS=\
+ --config $(CY_CONFIG_CYBT_FILE)
+
+CY_CONFIG_CYBT_GUI=$(CY_BT_CONFIGURATOR_DIR)/bt-configurator
+CY_CONFIG_CYBT_GUI_FLAGS=\
+ --config
+
+##########################
+# .cyusbdev (SW)
+##########################
+
+CY_CONFIG_CYUSBDEV_FILE?=$(CY_SEARCH_AVAILABLE_CYUSBDEV_SOURCES)
+CY_CONFIG_CYUSBDEV_OUTPUT=$(call CY_MACRO_DIR,$(CY_CONFIG_CYUSBDEV_FILE))/GeneratedSource
+
+CY_CONFIG_CYUSBDEV_EXEC=$(CY_USBDEV_CONFIGURATOR_DIR)/usbdev-configurator-cli
+CY_CONFIG_CYUSBDEV_EXEC_FLAGS=\
+ --config $(CY_CONFIG_CYUSBDEV_FILE)
+
+CY_CONFIG_CYUSBDEV_GUI=$(CY_USBDEV_CONFIGURATOR_DIR)/usbdev-configurator
+CY_CONFIG_CYUSBDEV_GUI_FLAGS=\
+ --config
+
+
+################################################################################
+# Source generation
+################################################################################
+
+ifeq ($(CY_COMMENCE_BUILD),true)
+
+##########################
+# .modus
+##########################
+
+# Check the timestamps and re-run the configurator if it's stale
+ifneq ($(CY_CONFIG_MODUS_FILE),)
+CY_CONFIG_MODUS_STATE=$(shell if [ "$(CY_CONFIG_MODUS_FILE)" -nt "$(CY_CONFIG_MODUS_OUTPUT)/cycfg.timestamp" ]; then echo 1; else echo 0; fi)
+ifeq ($(CY_CONFIG_MODUS_STATE),1)
+$(info $(CY_INDENT)Stale device files detected. Running device configurator to regenerate files...)
+ifneq ($(shell $(CY_CONFIG_MODUS_EXEC) $(CY_CONFIG_MODUS_EXEC_FLAGS) 1> /dev/null; echo $$?),0)
+ $(error Error(s) encountered while running the configurator on $(CY_CONFIG_MODUS_FILE))
+endif
+endif
+endif
+
+##########################
+# .cybt
+##########################
+
+# Check the timestamps and re-run the configurator if it's stale
+ifneq ($(CY_CONFIG_CYBT_FILE),)
+CY_CONFIG_CYBT_STATE=$(shell if [ "$(CY_CONFIG_CYBT_FILE)" -nt "$(CY_CONFIG_CYBT_OUTPUT)/cycfg_bt.timestamp" ]; then echo 1; else echo 0; fi)
+ifeq ($(CY_CONFIG_CYBT_STATE),1)
+$(info $(CY_INDENT)Stale BT files detected. Running BT-configurator to regenerate files...)
+ifneq ($(shell $(CY_CONFIG_CYBT_EXEC) $(CY_CONFIG_CYBT_EXEC_FLAGS) 1> /dev/null; echo $$?),0)
+ $(error Error(s) encountered while running the configurator on $(CY_CONFIG_CYBT_FILE))
+endif
+endif
+endif
+
+##########################
+# .cyusbdev
+##########################
+
+# Check the timestamps and re-run the configurator if it's stale
+ifneq ($(CY_CONFIG_CYUSBDEV_FILE),)
+CY_CONFIG_CYUSBDEV_STATE=$(shell if [ "$(CY_CONFIG_CYUSBDEV_FILE)" -nt "$(CY_CONFIG_CYUSBDEV_OUTPUT)/cycfg_usbdev.timestamp" ]; then echo 1; else echo 0; fi)
+ifeq ($(CY_CONFIG_CYUSBDEV_STATE),1)
+$(info $(CY_INDENT)Stale USBDEV files detected. Running USBDEV-configurator to regenerate files...)
+ifneq ($(shell $(CY_CONFIG_CYUSBDEV_EXEC) $(CY_CONFIG_CYUSBDEV_EXEC_FLAGS) 1> /dev/null; echo $$?),0)
+ $(error Error(s) encountered while running the configurator on $(CY_CONFIG_CYUSBDEV_FILE))
+endif
+endif
+endif
+
+endif
+
+
+################################################################################
+# Targets
+################################################################################
+
+# Extract the names for the variable name construction
+CY_CONFIG_CONVERT=$(foreach ext,$(CY_CONFIG_FILE_EXT),$(call CY_MACRO_UC,$(ext)))
+
+# Gather the files. Find all files that match the extensions in the design.modus location
+CY_CONFIG_FILES=$(sort $(foreach ext,$(CY_CONFIG_CONVERT),$(CY_CONFIG_$(ext)_FILE))\
+ $(foreach ext,$(CY_CONFIG_FILE_EXT),$(wildcard $(call CY_MACRO_DIR,$(CY_CONFIG_MODUS_FILE))/*.$(ext))))
+
+config:
+ifeq ($(CY_CONFIG_MODUS_FILE),)
+ $(info $(CY_NEWLINE)Could not find any device configuration files)
+ $(info Launching device-configurator for a new configuration)
+ $(CY_NOISE) $(CY_CONFIG_MODUS_GUI) $(CY_CONFIG_LIBFILE)
+else
+ $(info $(CY_NEWLINE)Launching device-configurator on $(CY_CONFIG_MODUS_FILE))
+ $(CY_NOISE) $(CY_CONFIG_MODUS_GUI) $(CY_CONFIG_LIBFILE) $(CY_CONFIG_MODUS_GUI_FLAGS) $(CY_CONFIG_MODUS_FILE)
+endif
+
+config_bt:
+ifeq ($(CY_CONFIG_CYBT_FILE),)
+ $(info $(CY_NEWLINE)Could not find any bt-configuration files)
+ $(info Launching bt-configurator for a new configuration)
+ $(CY_NOISE) $(CY_CONFIG_CYBT_GUI)
+else
+ $(info $(CY_NEWLINE)Launching bt-configurator on $(CY_CONFIG_CYBT_FILE))
+ $(CY_NOISE) $(CY_CONFIG_CYBT_GUI) $(CY_CONFIG_CYBT_GUI_FLAGS) $(CY_CONFIG_CYBT_FILE)
+endif
+
+config_usbdev:
+ifeq ($(CY_CONFIG_CYUSBDEV_FILE),)
+ $(info $(CY_NEWLINE)Could not find any usbdev-configuration files)
+ $(info Launching usbdev-configurator for a new configuration)
+ $(CY_NOISE) $(CY_CONFIG_CYUSBDEV_GUI)
+else
+ $(info $(CY_NEWLINE)Launching usbdev-configurator on $(CY_CONFIG_CYUSBDEV_FILE))
+ $(CY_NOISE) $(CY_CONFIG_CYUSBDEV_GUI) $(CY_CONFIG_CYUSBDEV_GUI_FLAGS) $(CY_CONFIG_CYUSBDEV_FILE)
+endif
+
+.PHONY: config config_bt config_usbdev
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/help.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/help.mk
new file mode 100644
index 0000000000000000000000000000000000000000..ee62eac005b90be401ff708e1a361ae8525f4041
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/help.mk
@@ -0,0 +1,374 @@
+################################################################################
+# \file help.mk
+# \version 1.0
+#
+# \brief
+# Default help documentation
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+#
+# General Targets
+#
+CY_HELP_all_VERBOSE=This target is equivalent to the "build" target.
+CY_HELP_getlibs_VERBOSE=The repos are cloned to the libs directory. By default, this directory is\
+ created in the application directory. It may be directed to other locations using\
+ the CY_GETLIBS_PATH variable.
+CY_HELP_build_VERBOSE=The build process involves source auto-discovery, code generation, prebuilds, and postbuilds.\
+ For faster incremental builds, use the "qbuild" target to skip the auto-generation step.
+CY_HELP_qbuild_VERBOSE=When no other sources need to be auto-discovered, this target can be used to skip\
+ the auto-discovery step for a faster incremental build.
+CY_HELP_program_VERBOSE=The build process performs the same operations as the "build" target. Upon completion,\
+ the artifact is programmed to the board.
+CY_HELP_qprogram_VERBOSE=This target allows programming an existing artifact to the board without a build step.
+CY_HELP_debug_VERBOSE=Once the GDB server is launched, another shell should be opened to launch a GDB client.
+CY_HELP_qdebug_VERBOSE=Once the GDB server is launched, another shell should be opened to launch a GDB client.
+CY_HELP_clean_VERBOSE=The directory and all its contents are deleted from disk.
+CY_HELP_help_VERBOSE=Use the CY_HELP= to see the verbose documentation for a\
+ particular target or a variable.
+
+#
+# Configurator Targets
+#
+CY_HELP_open_VERBOSE=This target accepts two variables – CY_OPEN_TYPE and CY_OPEN_FILE. At least one of\
+ these must be provided. The tool can be specified by setting the CY_OPEN_TYPE variable.\
+ A specific file can also be passed using the CY_OPEN_FILE variable. If only CY_OPEN_FILE is given,\
+ the build system will launch the default tool associated with the file’s extension.
+CY_HELP_config_VERBOSE=If no existing device-configuration files are found, the configurator is launched to create one.
+CY_HELP_config_bt_VERBOSE=If no existing bt-configuration files are found, the configurator is launched to create one.
+CY_HELP_config_usbdev_VERBOSE=If no existing usbdev-configuration files are found, the configurator is launched to create one.
+
+#
+# Utility Targets
+#
+CY_HELP_eclipse_VERBOSE=This target expects the CY_IDE_PRJNAME variable to be set to the name of the project\
+ as defined in the eclipse IDE. E.g. "make eclipse CY_IDE_PRJNAME=AppV1". If this variable\
+ is not defined, it will use the APPNAME for the launch configs.
+CY_HELP_check_VERBOSE=Not all tools are necessary for every build recipe. This target allows the user\
+ to get an idea of which tools are missing if a build fails in an unexpected way.
+CY_HELP_get_app_info_VERBOSE=The file types can be specified by setting the\
+ CY_CONFIG_FILE_EXT variable. E.g. "make get_app_info "CY_CONFIG_FILE_EXT=modus cybt cyusbdev"".
+CY_HELP_get_env_info_VERBOSE=This allows a quick printout of the current app repo and the "make" and "git"\
+ tool locations and versions.
+CY_HELP_printlibs_VERBOSE=This target parses through the library repos and prints the SHA1 commit id for each library.\
+ It also shows whether the repo is clean (no changes) or dirty (modified or new files).
+
+#
+# Basic configuration
+#
+CY_HELP_TARGET=Specifies the target board/kit. E.g. CY8CPROTO-062-4343W.
+CY_HELP_TARGET_VERBOSE=Currently available target(s) in this application is/are, [ $(CY_TARGET_AVAILABLE) ].
+CY_HELP_APPNAME=Specifies the name of the application. E.g. AppV1.
+CY_HELP_APPNAME_VERBOSE=This variable signifies that the application will build an artifact that is\
+ intended for a target board. For applications that need to build into an archive (library),\
+ use the LIBNAME variable.
+CY_HELP_LIBNAME=Specifies the name of the library application. E.g. LibV1.
+CY_HELP_LIBNAME_VERBOSE=This variable signifies that the application will build an archive (library).\
+ These library applications can be added as a dependency to an artifact producing application\
+ using the SEARCH_LIBS_AND_INCLUDES variable.
+CY_HELP_TOOLCHAIN=Specifies the toolchain for building the application. E.g. GCC_ARM.
+CY_HELP_TOOLCHAIN_VERBOSE=Supported toolchains for this target are, [ $(CY_SUPPORTED_TOOLCHAINS) ].
+CY_HELP_CONFIG=Specifies the configuration option for the build [Debug Release].
+CY_HELP_CONFIG_VERBOSE=The CONFIG variable is not limited to Debug/Release. It can be\
+ other values. However in those instances, the build system will not configure the optimization flags.\
+ Debug=lowest optimization, Release=highest optimization. The optimization flags are toolchain-specific.\
+ If you go with your custom config then you can manually set the optimization flag in the CFLAGS.
+CY_HELP_VERBOSE=Specifies whether the build is silent [false] or verbose [true].
+CY_HELP_VERBOSE_VERBOSE=Setting VERBOSE to true may help in debuggging build errors/warnings.
+
+#
+# Advanced configuration
+#
+CY_HELP_SOURCES=Specifies C/C++ and assembly files not under the working directory.
+CY_HELP_SOURCES_VERBOSE=This can be used to include files external to the application directory.
+CY_HELP_INCLUDES=Specifies include paths not under the working directory.
+CY_HELP_INCLUDES_VERBOSE=Note: These MUST NOT have -I prepended.
+CY_HELP_DEFINES=Specifies additional defines passed to the compiler.
+CY_HELP_DEFINES_VERBOSE=Note: These MUST NOT have -D prepended.
+CY_HELP_VFP_SELECT=Selects hard/soft ABI for floating-point operations [softfp hardfp].
+CY_HELP_VFP_SELECT_VERBOSE=If not defined, this value defaults to softfp.
+CY_HELP_CFLAGS=Prepends additional C compiler flags.
+CY_HELP_CFLAGS_VERBOSE=Note: If the entire C compiler flags list needs to be replaced, define the\
+ CY_RECIPE_CFLAGS make variable with the desired C flags.
+CY_HELP_CXXFLAGS=Prepends additional C++ compiler flags.
+CY_HELP_CXXFLAGS_VERBOSE=Note: If the entire C++ compiler flags list needs to be replaced, define the\
+ CY_RECIPE_CXXFLAGS make variable with the desired C++ flags.
+CY_HELP_ASFLAGS=Prepends additional assembler flags.
+CY_HELP_ASFLAGS_VERBOSE=Note: If the entire assembler flags list needs to be replaced, define the\
+ CY_RECIPE_ASFLAGS make variable with the desired assembly flags.
+CY_HELP_LDFLAGS=Prepends additional linker flags.
+CY_HELP_LDFLAGS_VERBOSE=Note: If the entire linker flags list needs to be replaced, define the\
+ CY_RECIPE_LDFLAGS make variable with the desired linker flags.
+CY_HELP_LDLIBS=Includes application-specific prebuilt libraries.
+CY_HELP_LDLIBS_VERBOSE=Note: If additional libraries need to be added using -l or -L, add to the\
+ CY_RECIPE_EXTRA_LIBS make variable.
+CY_HELP_LINKER_SCRIPT=Specifies a custom linker script location.
+CY_HELP_LINKER_SCRIPT_VERBOSE=This linker script overrides the default. Note: Additional\
+ linker scripts can be added for GCC via the LDFLAGS variable as a -L option.
+CY_HELP_PREBUILD=Specifies the location of a custom prebuild step and its arguments.
+CY_HELP_PREBUILD_VERBOSE=This operation runs before the build recipe's prebuild step.\
+ $(CY_NEWLINE)Note: BSPs can also define a prebuild step. This runs before the\
+ application prebuild step.\
+ $(CY_NEWLINE)Note: If the default prebuild step needs to be replaced, define the\
+ CY_RECIPE_PREBUILD make variable with the desired prebuild step.
+CY_HELP_POSTBUILD=Specifies the location of a custom postbuild step and its arguments.
+CY_HELP_POSTBUILD_VERBOSE=This operation runs after the build recipe's postbuild step.\
+ $(CY_NEWLINE)Note: BSPs can also define a postbuild step. This runs before the\
+ application postbuild step.\
+ $(CY_NEWLINE)Note: If the default postbuild step needs to be replaced, define the\
+ CY_RECIPE_POSTBUILD make variable with the desired postbuild step.
+CY_HELP_COMPONENTS=Adds component-specific files to the build.
+CY_HELP_COMPONENTS_VERBOSE=Create a directory named COMPONENT_ and place your files.\
+ Then include the to this make variable to have that feature library\
+ be included in the build. E.g. Create a directory named COMPONENT_ACCELEROMETER.\
+ Then include it in the make variable. COMPONENT=ACCELEROMETER. If the make variable\
+ does not include the , then that library will not be included in the build.\
+ $(CY_NEWLINE)Note: If the default COMPONENT list must be overridden, defined the CY_COMPONENT_LIST\
+ make variable with the list of component values.
+CY_HELP_DISABLE_COMPONENTS=Removes component-specific files from the build.
+CY_HELP_DISABLE_COMPONENTS_VERBOSE=Include a to this make variable to have that feature library\
+ be excluded in the build. E.g. To exclude the contents of COMPONENT_BSP_DESIGN_MODUS\
+ directory, set DISABLE_COMPONENTS=BSP_DESIGN_MODUS.
+CY_HELP_SEARCH_LIBS_AND_INCLUDES=List of dependent library application paths. E.g. ../bspLib.
+CY_HELP_SEARCH_LIBS_AND_INCLUDES_VERBOSE=An artifact producing application (Defined by setting APPNAME),\
+ can have a dependency on library applications (Defined by setting LIBNAME). This variable\
+ defines those dependencies for the artifact producing application. The actual build invocation\
+ of those libraries are handled at the application level by defining the "shared_libs" target. E.g.\
+ $(CY_NEWLINE)$(CY_NEWLINE)shared_libs: $(CY_NEWLINE)$(CY_INDENT)make -C ../bspLib build -j
+
+#
+# Path variables
+#
+CY_HELP_CY_APP_PATH=Relative path to the top-level of application. E.g. ./
+CY_HELP_CY_APP_PATH_VERBOSE=Settings this path to other than ./ allows the auto-discovery mechanism\
+ to search from a root directory location that is higher than the app directory.\
+ E.g. CY_APP_PATH=../../ allows auto-discovery of files from a location that is\
+ two directories above the location of ./Makefile.
+CY_HELP_CY_BASELIB_PATH=Relative path to the base library. E.g. ./libs/psoc6make
+CY_HELP_CY_BASELIB_PATH_VERBOSE=This directory must be relative to CY_APP_PATH. It defines the location\
+ of the library containing the recipe make files, where the expected directory structure\
+ is /make. All applications must set the location of the base library.
+CY_HELP_CY_GETLIBS_PATH=Absolute path to the intended location of libs directory.
+CY_HELP_CY_GETLIBS_PATH_VERBOSE=The library repos are cloned into a directory named, libs (Default: /libs).\
+ Setting this variable allows specifying the location of the libs directory to elsewhere on disk.
+CY_HELP_CY_GETLIBS_SEARCH_PATH=Relative path to the top directory for "getlibs" operation.
+CY_HELP_CY_GETLIBS_SEARCH_PATH_VERBOSE=The getlibs operation by default executes at the location of the CY_APP_PATH. This can\
+ be overridden by specifying this variable to point to a specific location.
+CY_HELP_CY_DEVICESUPPORT_PATH=Relative path to the devicesupport.xml file.
+CY_HELP_CY_DEVICESUPPORT_PATH_VERBOSE=This path specifies the location of the devicesupport.xml file for device-configurators.\
+ It is used when the configurator needs to be run in a multi-app scenario.
+CY_HELP_CY_SHARED_PATH=Relative path to the location of shared .lib files.
+CY_HELP_CY_SHARED_PATH_VERBOSE=This variable is used in shared library applications to point to the location of external .lib files.
+CY_HELP_CY_COMPILER_PATH=Absolute path to the compiler (Default: GCC_ARM in CY_TOOLS_DIR).
+CY_HELP_CY_COMPILER_PATH_VERBOSE=Setting this path allows custom toolchains to be used instead of the defaults.\
+ This should be the location of the /bin directory containing the compiler, assembler and\
+ linker. E.g. CY_COMPILER_PATH="C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.2/arm/bin".
+CY_HELP_CY_TOOLS_DIR=Absolute path to the tools root directory.
+CY_HELP_CY_TOOLS_DIR_VERBOSE=Applications must specify the directory of the tools install, which contains the\
+ root makefile and the necessary tools and scripts to build an application. Application Makefiles\
+ are configured to automatically search in the standard locations for various platforms.\
+ If the tools are not located in the standard location, you may explicitly set this.
+CY_HELP_CY_BUILD_LOCATION=Absolute path to the build output directory (Default: pwd/build).
+CY_HELP_CY_BUILD_LOCATION_VERBOSE=The build output directory is structured as /TARGET/CONFIG/. Setting this variable\
+ allows the build artifacts to be located in the directory pointed to by this variable.
+CY_HELP_CY_EXTAPP_PATH=Relative path to an external app directory. E.g. ../external
+CY_HELP_CY_EXTAPP_PATH_VERBOSE=This directory must be relative to CY_APP_PATH. Setting this path\
+ allows incorporating files external to CY_APP_PATH. E.g. CY_EXTAPP_PATH=../external\
+ lets the auto-discovery to pull in the contents of ../external directory into the build.\
+ $(CY_NEWLINE)Note: This variable is only supported in CLI. Use the shared_libs mechanism and\
+ CY_HELP_SEARCH_LIBS_AND_INCLUDES for tools and IDE support.
+
+#
+# Miscellaneous variables
+#
+CY_HELP_CY_IGNORE=Adds to the directory and file ignore list. E.g. ./file1.c ./inc1
+CY_HELP_CY_IGNORE_VERBOSE=Directories and files listed in this variable are ignored in the auto-discovery.\
+ This mechanism works in combination with any existing .cyignore files in the application.
+CY_HELP_CY_IDE_PRJNAME=Name of the eclipse IDE project.
+CY_HELP_CY_IDE_PRJNAME_VERBOSE=This variable can be used to define the file and target project name when\
+ generating eclipse launch configurations in the "eclipse" target.
+CY_HELP_CY_CONFIG_FILE_EXT=Specifies the configurator file extension. E.g. modus
+CY_HELP_CY_CONFIG_FILE_EXT_VERBOSE=This variable accepts a space-separated list of configurator file extensions\
+ that should be searched for when running the "get_app_info" target.
+CY_HELP_CY_SKIP_RECIPE=Skip including the recipe make files.
+CY_HELP_CY_SKIP_RECIPE_VERBOSE=This allows the application to not include any recipe makefiles and only\
+ include the start.mk file from the tools install.
+CY_HELP_CY_SUPPORTED_TOOL_TYPES=Defines the supported tools for a BSP.
+CY_HELP_CY_SUPPORTED_TOOL_TYPES_VERBOSE=BSPs can define the supported tools that can be launched using the\
+ "open" target. The supported tool types are $(CY_OPEN_TYPE_LIST).
+CY_HELP_CY_LIBS_SEARCH_DEPTH=Search depth for .lib files (Default: 5).
+CY_HELP_CY_LIBS_SEARCH_DEPTH_VERBOSE=This variable controls how deep (directory) the search mechanism in getlibs looks for .lib files.\
+ $(CY_NEWLINE)Note: Deeper searches take longer to process.
+CY_HELP_CY_UTILS_SEARCH_DEPTH=Search depth for .cyignore and TARGET.mk files (Default: 5).
+CY_HELP_CY_UTILS_SEARCH_DEPTH_VERBOSE=This variable controls how deep (directory) the search mechanism looks for .cyignore\
+ and TARGET.mk files. Min=1, Max=9.\
+ $(CY_NEWLINE)Note: Deeper searches take longer to process.
+CY_HELP_CY_EXTRA_INCLUDES=Specifies additional makefiles to add to the build.
+CY_HELP_CY_EXTRA_INCLUDES_VERBOSE=The application Makefile cannot add additional make files directly. Instead, use\
+ this variable to include these in the build. E.g. CY_EXTRA_INCLUDES=./custom1.mk ./custom2.mk
+CY_HELP_TOOLCHAIN_MK_PATH=Specifies the location of a custom TOOLCHAIN makefile.
+CY_HELP_TOOLCHAIN_MK_PATH_VERBOSE=Defining this path allows the build system to use a custom TOOLCHAIN.mk\
+ pointed to by this variable.\
+ $(CY_NEWLINE)Note: The make variables in this file should match the\
+ variables used in existing TOOLCHAIN.mk files.
+
+# Pass these to CY_HELP to get the full verbose info
+CY_HELP_TARGETS_ALL=all getlibs build qbuild program qprogram debug qdebug clean help open config config_bt config_usbdev \
+ eclipse check get_app_info get_env_info printlibs
+CY_HELP_BASIC_CFG_ALL=TARGET APPNAME LIBNAME TOOLCHAIN CONFIG VERBOSE
+CY_HELP_ADVANCED_CFG_ALL=SOURCES INCLUDES DEFINES VFP_SELECT CFLAGS CXXFLAGS ASFLAGS LDFLAGS LDLIBS LINKER_SCRIPT \
+ PREBUILD POSTBUILD COMPONENTS DISABLE_COMPONENTS SEARCH_LIBS_AND_INCLUDES
+CY_HELP_PATHS_ALL=CY_APP_PATH CY_BASELIB_PATH CY_EXTAPP_PATH CY_GETLIBS_PATH CY_GETLIBS_SEARCH_PATH CY_DEVICESUPPORT_PATH \
+ CY_SHARED_PATH CY_COMPILER_PATH CY_TOOLS_DIR CY_BUILD_LOCATION
+CY_HELP_MISC_ALL=CY_IGNORE CY_IDE_PRJNAME CY_CONFIG_FILE_EXT CY_SKIP_RECIPE CY_SUPPORTED_TOOL_TYPES CY_LIBS_SEARCH_DEPTH \
+ CY_UTILS_SEARCH_DEPTH CY_EXTRA_INCLUDES TOOLCHAIN_MK_PATH
+CY_HELP_PRINT_ALL=$(CY_HELP_TARGETS_ALL) $(CY_HELP_BASIC_CFG_ALL) $(CY_HELP_ADVANCED_CFG_ALL) $(CY_HELP_PATHS_ALL) $(CY_HELP_MISC_ALL)
+
+
+help_default:
+ifneq ($(CY_HELP),)
+ @echo
+ $(foreach topic,$(CY_HELP),\
+ $(info $(CY_NEWLINE)Topic-specific help for "$(topic)")\
+ $(info $(CY_SPACE)$(CY_SPACE)Brief: $(CY_HELP_$(topic)))\
+ $(info $(CY_SPACE)$(CY_SPACE)Verbose: $(CY_HELP_$(topic)_VERBOSE)))
+else
+ @echo
+ $(info )
+ $(info ============================================================================== )
+ $(info $(CY_SPACE)Cypress Build System )
+ $(info ============================================================================== )
+ $(info $(CY_SPACE)Copyright 2018-2019 Cypress Semiconductor Corporation )
+ $(info $(CY_SPACE)SPDX-License-Identifier: Apache-2.0 )
+ $(info )
+ $(info $(CY_SPACE)Licensed under the Apache License, Version 2.0 (the "License"); )
+ $(info $(CY_SPACE)you may not use this file except in compliance with the License. )
+ $(info $(CY_SPACE)You may obtain a copy of the License at )
+ $(info )
+ $(info $(CY_SPACE)$(CY_SPACE) http://www.apache.org/licenses/LICENSE-2.0 )
+ $(info )
+ $(info $(CY_SPACE)Unless required by applicable law or agreed to in writing, software )
+ $(info $(CY_SPACE)distributed under the License is distributed on an "AS IS" BASIS, )
+ $(info $(CY_SPACE)WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.)
+ $(info $(CY_SPACE)See the License for the specific language governing permissions and )
+ $(info $(CY_SPACE)limitations under the License. )
+ $(info ============================================================================== )
+ $(info )
+ $(info $(CY_SPACE)This is the help documentation for the Cypress build system. )
+ $(info $(CY_SPACE)It lists the supported make targets and make variables. )
+ $(info )
+ $(info $(CY_SPACE)Usage: make [target][variable] )
+ $(info $(CY_SPACE)Example: make help CY_HELP=TOOLCHAIN )
+ $(info )
+ $(info ======================================= )
+ $(info $(CY_SPACE)General make targets )
+ $(info ======================================= )
+ $(info $(CY_SPACE)all $(CY_HELP_all))
+ $(info $(CY_SPACE)getlibs $(CY_HELP_getlibs))
+ $(info $(CY_SPACE)build $(CY_HELP_build))
+ $(info $(CY_SPACE)qbuild $(CY_HELP_qbuild))
+ $(info $(CY_SPACE)program $(CY_HELP_program))
+ $(info $(CY_SPACE)qprogram $(CY_HELP_qprogram))
+ $(info $(CY_SPACE)debug $(CY_HELP_debug))
+ $(info $(CY_SPACE)qdebug $(CY_HELP_qdebug))
+ $(info $(CY_SPACE)clean $(CY_HELP_clean))
+ $(info $(CY_SPACE)help $(CY_HELP_help))
+ $(info )
+ $(info ======================================= )
+ $(info $(CY_SPACE)Tools make targets )
+ $(info ======================================= )
+ $(info $(CY_SPACE)open $(CY_HELP_open))
+ $(info $(CY_SPACE)config $(CY_HELP_config))
+ $(info $(CY_SPACE)config_bt $(CY_HELP_config_bt))
+ $(info $(CY_SPACE)config_usbdev $(CY_HELP_config_usbdev))
+ $(info )
+ $(info ======================================= )
+ $(info $(CY_SPACE)Utility make targets )
+ $(info ======================================= )
+ $(info $(CY_SPACE)eclipse $(CY_HELP_eclipse))
+ $(info $(CY_SPACE)check $(CY_HELP_check))
+ $(info $(CY_SPACE)get_app_info $(CY_HELP_get_app_info))
+ $(info $(CY_SPACE)get_env_info $(CY_HELP_get_env_info))
+ $(info $(CY_SPACE)printlibs $(CY_HELP_printlibs))
+ $(info )
+ $(info ======================================= )
+ $(info $(CY_SPACE)Basic configuration make variables )
+ $(info ======================================= )
+ $(info $(CY_SPACE)TARGET $(CY_HELP_TARGET))
+ $(info $(CY_SPACE)APPNAME $(CY_HELP_APPNAME))
+ $(info $(CY_SPACE)LIBNAME $(CY_HELP_LIBNAME))
+ $(info $(CY_SPACE)TOOLCHAIN $(CY_HELP_TOOLCHAIN))
+ $(info $(CY_SPACE)CONFIG $(CY_HELP_CONFIG))
+ $(info $(CY_SPACE)VERBOSE $(CY_HELP_VERBOSE))
+ $(info )
+ $(info ======================================= )
+ $(info $(CY_SPACE)Advanced configuration make variables )
+ $(info ======================================= )
+ $(info $(CY_SPACE)SOURCES $(CY_HELP_SOURCES))
+ $(info $(CY_SPACE)INCLUDES $(CY_HELP_INCLUDES))
+ $(info $(CY_SPACE)DEFINES $(CY_HELP_DEFINES))
+ $(info $(CY_SPACE)VFP_SELECT $(CY_HELP_VFP_SELECT))
+ $(info $(CY_SPACE)CFLAGS $(CY_HELP_CFLAGS))
+ $(info $(CY_SPACE)CXXFLAGS $(CY_HELP_CXXFLAGS))
+ $(info $(CY_SPACE)ASFLAGS $(CY_HELP_ASFLAGS))
+ $(info $(CY_SPACE)LDFLAGS $(CY_HELP_LDFLAGS))
+ $(info $(CY_SPACE)LDLIBS $(CY_HELP_LDLIBS))
+ $(info $(CY_SPACE)LINKER_SCRIPT $(CY_HELP_LINKER_SCRIPT))
+ $(info $(CY_SPACE)PREBUILD $(CY_HELP_PREBUILD))
+ $(info $(CY_SPACE)POSTBUILD $(CY_HELP_POSTBUILD))
+ $(info $(CY_SPACE)COMPONENTS $(CY_HELP_COMPONENTS))
+ $(info $(CY_SPACE)DISABLE_COMPONENTS $(CY_HELP_DISABLE_COMPONENTS))
+ $(info $(CY_SPACE)SEARCH_LIBS_AND_INCLUDES $(CY_HELP_SEARCH_LIBS_AND_INCLUDES))
+ $(info )
+ $(info ======================================= )
+ $(info $(CY_SPACE)Path make variables )
+ $(info ======================================= )
+ $(info $(CY_SPACE)CY_APP_PATH $(CY_HELP_CY_APP_PATH))
+ $(info $(CY_SPACE)CY_BASELIB_PATH $(CY_HELP_CY_BASELIB_PATH))
+ $(info $(CY_SPACE)CY_EXTAPP_PATH $(CY_HELP_CY_EXTAPP_PATH))
+ $(info $(CY_SPACE)CY_GETLIBS_PATH $(CY_HELP_CY_GETLIBS_PATH))
+ $(info $(CY_SPACE)CY_GETLIBS_SEARCH_PATH $(CY_HELP_CY_GETLIBS_SEARCH_PATH))
+ $(info $(CY_SPACE)CY_DEVICESUPPORT_PATH $(CY_HELP_CY_DEVICESUPPORT_PATH))
+ $(info $(CY_SPACE)CY_SHARED_PATH $(CY_HELP_CY_SHARED_PATH))
+ $(info $(CY_SPACE)CY_COMPILER_PATH $(CY_HELP_CY_COMPILER_PATH))
+ $(info $(CY_SPACE)CY_TOOLS_DIR $(CY_HELP_CY_TOOLS_DIR))
+ $(info $(CY_SPACE)CY_BUILD_LOCATION $(CY_HELP_CY_BUILD_LOCATION))
+ $(info )
+ $(info ======================================= )
+ $(info $(CY_SPACE)Miscellaneous make variables )
+ $(info ======================================= )
+ $(info $(CY_SPACE)CY_IGNORE $(CY_HELP_CY_IGNORE))
+ $(info $(CY_SPACE)CY_IDE_PRJNAME $(CY_HELP_CY_IDE_PRJNAME))
+ $(info $(CY_SPACE)CY_CONFIG_FILE_EXT $(CY_HELP_CY_CONFIG_FILE_EXT))
+ $(info $(CY_SPACE)CY_SKIP_RECIPE $(CY_HELP_CY_SKIP_RECIPE))
+ $(info $(CY_SPACE)CY_SUPPORTED_TOOL_TYPES $(CY_HELP_CY_SUPPORTED_TOOL_TYPES))
+ $(info $(CY_SPACE)CY_LIBS_SEARCH_DEPTH $(CY_HELP_CY_LIBS_SEARCH_DEPTH))
+ $(info $(CY_SPACE)CY_UTILS_SEARCH_DEPTH $(CY_HELP_CY_UTILS_SEARCH_DEPTH))
+ $(info $(CY_SPACE)CY_EXTRA_INCLUDES $(CY_HELP_CY_EXTRA_INCLUDES))
+ $(info $(CY_SPACE)TOOLCHAIN_MK_PATH $(CY_HELP_TOOLCHAIN_MK_PATH))
+endif
+
+#
+# Identify the phony targets
+#
+.PHONY: help help_default
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/main.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/main.mk
new file mode 100644
index 0000000000000000000000000000000000000000..3defc841a91dd994c1a50c4b3ec4b531a4e84aed
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/main.mk
@@ -0,0 +1,317 @@
+################################################################################
+# \file main.mk
+# \version 1.0
+#
+# \brief
+# Defines the public facing build targets common to all recipes and includes
+# the core makefiles.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+
+################################################################################
+# Paths
+################################################################################
+
+#
+# Set the build location. Append app dir if CY_BUILD_LOCATION is defined
+#
+ifneq ($(CY_BUILD_LOCATION),)
+CY_BUILD_LOC=$(CY_BUILD_LOCATION)/$(notdir $(CY_APP_LOCATION))
+else
+CY_BUILD_LOC=$(CY_APP_LOCATION)/build
+endif
+
+#
+# Windows paths
+#
+ifeq ($(OS),Windows_NT)
+
+#
+# CygWin/MSYS
+#
+ifneq ($(CY_WHICH_CYGPATH),)
+CY_INTERNAL_BUILD_LOC:=$(shell cygpath -m --absolute $(subst \,/,$(CY_BUILD_LOC)))
+ifneq ($(CY_BUILD_LOCATION),)
+CY_INTERNAL_BUILD_LOCATION:=$(shell cygpath -m --absolute $(subst \,/,$(CY_BUILD_LOCATION)))
+endif
+ifneq ($(CY_DEVICESUPPORT_PATH),)
+CY_INTERNAL_DEVICESUPPORT_PATH:=$(shell cygpath -m --absolute $(subst \,/,$(CY_DEVICESUPPORT_PATH)))
+endif
+
+#
+# Other Windows environments
+#
+else
+CY_INTERNAL_BUILD_LOC:=$(subst \,/,$(CY_BUILD_LOC))
+CY_INTERNAL_BUILD_LOCATION:=$(subst \,/,$(CY_BUILD_LOCATION))
+CY_INTERNAL_DEVICESUPPORT_PATH:=$(abspath $(subst \,/,$(CY_DEVICESUPPORT_PATH)))
+endif
+
+#
+# Linux and macOS paths
+#
+else
+CY_INTERNAL_BUILD_LOC:=$(CY_BUILD_LOC)
+CY_INTERNAL_BUILD_LOCATION:=$(CY_BUILD_LOCATION)
+CY_INTERNAL_DEVICESUPPORT_PATH:=$(abspath $(CY_DEVICESUPPORT_PATH))
+endif
+
+#
+# Build directories
+#
+CY_RECIPE_DIR=$(CY_INTERNAL_BUILD_LOC)
+CY_BUILDTARGET_DIR=$(CY_RECIPE_DIR)/$(TARGET)
+CY_CONFIG_DIR=$(CY_BUILDTARGET_DIR)/$(CONFIG)
+CY_GENERATED_DIR=$(CY_BUILDTARGET_DIR)/generated
+
+#
+# Default toolchain locations
+#
+CY_COMPILER_GCC_ARM_DEFAULT_DIR=$(CY_COMPILER_DEFAULT_DIR)
+CY_COMPILER_IAR_DEFAULT_DIR="C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.2/arm"
+CY_COMPILER_ARM_DEFAULT_DIR="C:/Program Files/ARMCompiler6.11"
+CY_COMPILER_A_Clang_DEFAULT_DIR=/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0
+
+#
+# Toolchain locations
+#
+CY_COMPILER_GCC_ARM_DIR?=$(CY_COMPILER_GCC_ARM_DEFAULT_DIR)
+CY_COMPILER_IAR_DIR?=$(CY_COMPILER_IAR_DEFAULT_DIR)
+CY_COMPILER_ARM_DIR?=$(CY_COMPILER_ARM_DEFAULT_DIR)
+CY_COMPILER_A_Clang_DIR?=$(CY_COMPILER_A_Clang_DEFAULT_DIR)
+
+
+################################################################################
+# User-facing make targets
+################################################################################
+
+CY_HELP_all=Same as build. i.e. Builds the application.
+all: build
+
+CY_HELP_getlibs=Clones the repositories, and checks out the identified commit.
+getlibs:
+
+CY_HELP_build=Builds the application.
+build: app memcalc
+
+CY_HELP_qbuild=Builds the application using the previous build's source list.
+qbuild: app memcalc
+
+CY_HELP_program=Builds the application and programs it to the target device.
+program:
+
+CY_HELP_qprogram=Programs a built application to the target device without rebuilding.
+qprogram:
+
+CY_HELP_debug=Builds and programs. Then launches a GDB server.
+debug:
+
+CY_HELP_qdebug=Skips the build and program step. Launches a GDB server.
+qdebug:
+
+CY_HELP_clean=Cleans the /build/ directory.
+clean: shared_libs
+ rm -rf $(CY_BUILDTARGET_DIR)
+
+# Note: Define the help target in BSP/recipe for custom help
+CY_HELP_help=Prints the help documentation.
+help: help_default
+
+CY_HELP_open=Opens/launches a specified tool.
+open:
+
+CY_HELP_config=Runs the configurator on the target .modus file.
+config:
+
+CY_HELP_config_bt=Runs the bt-configurator on the target .cybt file.
+config_bt:
+
+CY_HELP_config_usbdev=Runs the usbdev-configurator on the target .cyusbdev file.
+config_usbdev:
+
+
+################################################################################
+# Include make files
+################################################################################
+
+# Make a decision on including logic pertinent to builds.
+# If it's not any of these targets, then it's an actual build.
+CY_COMMENCE_BUILD=false
+ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
+ifneq ($(findstring qprogram,$(MAKECMDGOALS)),qprogram)
+ifneq ($(findstring qdebug,$(MAKECMDGOALS)),qdebug)
+ifneq ($(findstring erase,$(MAKECMDGOALS)),erase)
+ifneq ($(findstring attach,$(MAKECMDGOALS)),attach)
+ifneq ($(findstring eclipse,$(MAKECMDGOALS)),eclipse)
+ifneq ($(findstring check,$(MAKECMDGOALS)),check)
+ifneq ($(findstring get_env_info,$(MAKECMDGOALS)),get_env_info)
+ifneq ($(findstring get_app_info,$(MAKECMDGOALS)),get_app_info)
+ifneq ($(findstring help,$(MAKECMDGOALS)),help)
+# Note: covers config config_bt and config_usbdev
+ifneq ($(findstring config,$(MAKECMDGOALS)),config)
+ifneq ($(findstring open,$(MAKECMDGOALS)),open)
+CY_COMMENCE_BUILD=true
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+
+ifeq ($(CY_COMMENCE_BUILD),true)
+$(info )
+$(info Initializing build: $(APPNAME)$(LIBNAME) $(CONFIG) $(TARGET) $(TOOLCHAIN))
+ifeq ($(wildcard $(CY_INTERNAL_BASELIB_PATH)),)
+$(info )
+$(error Cannot find the base library. Run "make getlibs" and/or check\
+that the library location is correct in the CY_BASELIB_PATH variable)
+endif
+endif
+
+#
+# Include utilities used by all make files
+#
+include $(CY_BASELIB_CORE_PATH)/make/core/utils.mk
+
+#
+# Include any extra makefiles defined by app
+#
+include $(CY_EXTRA_INCLUDES)
+
+#
+# Find the target and check that the device is valid
+#
+include $(CY_BASELIB_CORE_PATH)/make/core/target.mk
+-include $(CY_INTERNAL_BASELIB_PATH)/make/udd/features.mk
+include $(CY_INTERNAL_BASELIB_PATH)/make/recipe/defines.mk
+
+#
+# Check if the user-data is correct
+#
+ifneq ($(APPNAME),)
+ifneq ($(LIBNAME),)
+$(error An application cannot define both APPNAME and LIBNAME. Define one or the other)
+endif
+endif
+ifneq ($(findstring -I,$(INCLUDES)),)
+$(error INCLUDES must be directories without -I prepended)
+endif
+ifneq ($(findstring -D,$(DEFINES)),)
+$(error DEFINES must be specified without -D prepended)
+endif
+ifneq ($(findstring -I,$(CFLAGS)),)
+$(error Include paths must be specified in the INCLUDES variable instead\
+of directly in CFLAGS. These must be directories without -I prepended)
+endif
+ifneq ($(findstring -D,$(CFLAGS)),)
+$(error Defines must be specified in the DEFINES variable instead\
+of directly in CFLAGS. These must be specified without -D prepended)
+endif
+ifneq ($(findstring -I,$(CXXFLAGS)),)
+$(error Include paths must be specified in the INCLUDES variable instead\
+of directly in CXXFLAGS. These must be directories without -I prepended)
+endif
+ifneq ($(findstring -D,$(CXXFLAGS)),)
+$(error Defines must be specified in the DEFINES variable instead\
+of directly in CXXFLAGS. These must be specified without -D prepended)
+endif
+ifneq ($(findstring -I,$(ASFLAGS)),)
+$(error Include paths must be specified in the INCLUDES variable instead\
+of directly in ASFLAGS. These must be directories without -I prepended)
+endif
+ifneq ($(findstring -D,$(ASFLAGS)),)
+$(error Defines must be specified in the DEFINES variable instead\
+of directly in ASFLAGS. These must be specified without -D prepended)
+endif
+
+#
+# Choose local or default toolchain makefile
+#
+ifeq ($(TOOLCHAIN_MK_PATH),)
+include $(CY_INTERNAL_BASELIB_PATH)/make/toolchains/$(TOOLCHAIN).mk
+else
+# Include the custom app-specific toolchain file
+include $(TOOLCHAIN_MK_PATH)
+endif
+
+#
+# Configurator-related routines
+#
+ifeq ($(CY_SKIP_CONFIGURATOR),)
+include $(CY_BASELIB_CORE_PATH)/make/core/config.mk
+endif
+
+#
+# Build-related routines
+#
+ifeq ($(CY_COMMENCE_BUILD),true)
+
+ifneq ($(findstring qbuild,$(MAKECMDGOALS)),qbuild)
+include $(CY_BASELIB_CORE_PATH)/make/core/search.mk
+else
+# Skip the auto-discovery and re-use the last build's source list
+-include $(CY_CONFIG_DIR)/cyqbuild.mk
+CY_QBUILD=$(shell if [ -f $(CY_CONFIG_DIR)/cyqbuild.mk ]; then echo "true"; fi;)
+ifneq ($(CY_QBUILD),true)
+$(info WARNING: Cannot find the auto-discovery make file. Run "make build" to generate it.)
+endif
+endif
+
+include $(CY_INTERNAL_BASELIB_PATH)/make/recipe/recipe.mk
+
+ifneq ($(findstring vscode,$(MAKECMDGOALS)),vscode)
+include $(CY_BASELIB_CORE_PATH)/make/core/build.mk
+endif
+
+endif
+
+#
+# Optional recipe-specific program routine
+#
+ifndef CY_BSP_PROGRAM
+-include $(CY_INTERNAL_BASELIB_PATH)/make/recipe/program.mk
+endif
+
+#
+# Launch tools
+#
+-include $(CY_INTERNAL_TOOLS)/make/tools.mk
+include $(CY_BASELIB_CORE_PATH)/make/core/open.mk
+
+#
+# Help documentation
+#
+include $(CY_BASELIB_CORE_PATH)/make/core/help.mk
+
+#
+# Identify the phony targets
+#
+.PHONY: all build qbuild getlibs clean program quickprogram help
+.PHONY: app memcalc
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/open.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/open.mk
new file mode 100644
index 0000000000000000000000000000000000000000..6be2460f2dabee2b4097cbbd1bd63dd790fcf3be
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/open.mk
@@ -0,0 +1,126 @@
+################################################################################
+# \file open.mk
+# \version 1.0
+#
+# \brief
+# Opens/launches a specified tool
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+
+# Verify that the tool is supported
+ifneq ($(CY_OPEN_TYPE),)
+ifeq ($(filter $(CY_OPEN_TYPE),$(CY_OPEN_TYPE_LIST)),)
+$(error Unsupported tool type - $(CY_OPEN_TYPE). $(CY_NEWLINE)Supported types are: $(CY_OPEN_TYPE_LIST))
+endif
+endif
+
+# Extension construction from given file
+ifneq ($(CY_OPEN_FILE)),)
+CY_OPEN_EXT=$(subst .,,$(suffix $(CY_OPEN_FILE)))
+endif
+
+
+################################################################################
+# New configurations
+################################################################################
+
+# Limit this as it can be a performance hit
+ifneq ($(filter get_app_info open,$(MAKECMDGOALS)),)
+
+# Look for tools that DISALLOW new configurations
+CY_OPEN_NEWCFG_XML_TYPES+=$(shell \
+ xmlFileArray=($$(find $(CY_INTERNAL_TOOLS) -maxdepth 2 -name "configurator.xml" \
+ -exec grep "false" {} +));\
+ for xmlFile in "$${xmlFileArray[@]}"; do\
+ if [[ "$$xmlFile" == *"configurator.xml"* ]]; then\
+ toolNameDir="$${xmlFile%/*}";\
+ toolName="$${toolNameDir\#\#*/}";\
+ echo "$$toolName";\
+ fi;\
+ done;\
+)
+
+endif
+
+# Tools for existing files
+CY_OPEN_NEWCFG_EXISTING_TYPES=$(foreach ext,$(subst .,,$(suffix $(CY_CONFIG_FILES))),$($(addsuffix _DEFAULT_TYPE,$(ext))))
+# Tools that do not have an existing file
+CY_OPEN_NEWCFG_POSSIBLE_TYPES=$(filter-out $(CY_OPEN_NEWCFG_EXISTING_TYPES) $(CY_OPEN_NEWCFG_XML_TYPES),$(CY_SUPPORTED_TOOL_TYPES))
+# Complete list of supported files
+CY_OPEN_FILTERED_SUPPORTED_TYPES=$(sort $(CY_OPEN_NEWCFG_POSSIBLE_TYPES) $(CY_OPEN_NEWCFG_EXISTING_TYPES))
+
+
+################################################################################
+# Prepare tool launch
+################################################################################
+
+# Only file is given. Use the default type for that file extension
+ifneq ($(CY_OPEN_FILE),)
+ifeq ($(CY_OPEN_TYPE),)
+CY_OPEN_TYPE=$(firstword $($(CY_OPEN_EXT)_DEFAULT_TYPE))
+endif
+endif
+
+# Set the tool and its arguments
+CY_OPEN_TOOL_FILE=$(CY_OPEN_$(subst -,_,$(CY_OPEN_TYPE))_FILE)
+CY_OPEN_TOOL_LAUNCH=$(CY_OPEN_$(subst -,_,$(CY_OPEN_TYPE))_TOOL)
+CY_OPEN_TOOL_FLAGS=$(CY_OPEN_$(subst -,_,$(CY_OPEN_TYPE))_TOOL_FLAGS)
+CY_OPEN_TOOL_ARGS=$(CY_OPEN_$(subst -,_,$(CY_OPEN_TYPE))_TOOL_ARGS)
+CY_OPEN_TOOL_NEWCFG_FLAGS=$(CY_OPEN_$(subst -,_,$(CY_OPEN_TYPE))_TOOL_NEWCFG_FLAGS)
+
+# Use the file if provided
+ifneq ($(CY_OPEN_FILE),)
+CY_OPEN_TOOL_FILE=$(CY_OPEN_FILE)
+endif
+
+ifneq ($(CY_MAKE_IDE),)
+CY_OPEN_STDOUT=>& /dev/null
+endif
+
+
+################################################################################
+# Tool launch target
+################################################################################
+
+open:
+ifeq ($(CY_OPEN_FILE),)
+ifeq ($(CY_OPEN_TYPE),)
+ $(error Neither tool type or file specified to launch a tool)
+endif
+endif
+ifeq ($(CY_OPEN_TOOL_LAUNCH),)
+ $(error Unable to find a default tool to launch .$(CY_OPEN_EXT) file extension)
+endif
+ifeq ($(CY_OPEN_TOOL_FILE),)
+ $(info Launching $(notdir $(CY_OPEN_TOOL_LAUNCH)) tool for a new configuration)
+ $(CY_NOISE) $(CY_OPEN_TOOL_LAUNCH) $(CY_OPEN_TOOL_ARGS) $(CY_OPEN_TOOL_NEWCFG_FLAGS) $(CY_OPEN_STDOUT) &
+else
+ $(info $(CY_NEWLINE)Launching $(notdir $(CY_OPEN_TOOL_LAUNCH)) tool on $(CY_OPEN_TOOL_FILE))
+ $(CY_NOISE) $(CY_OPEN_TOOL_LAUNCH) $(CY_OPEN_TOOL_ARGS) $(CY_OPEN_TOOL_FLAGS) $(CY_OPEN_TOOL_FILE) $(CY_OPEN_STDOUT) &
+endif
+
+#
+# Identify the phony targets
+#
+.PHONY: open
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/search.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/search.mk
new file mode 100644
index 0000000000000000000000000000000000000000..5e11ec073bb467066e24a74b2a238e73a4dc0de1
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/search.mk
@@ -0,0 +1,158 @@
+################################################################################
+# \file search.mk
+# \version 1.0
+#
+# \brief
+# Performs auto-discovery of files in the project directories.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+
+################################################################################
+# Search Files
+################################################################################
+
+$(info )
+$(info Auto-discovery in progress...)
+
+#
+# Search for files. Use := assignment for better performance. Need to look in both project and shared lib.
+#
+CY_SEARCH_ALL_FILES:=$(sort $(shell $(CY_FIND) -L $(CY_INTERNAL_APP_PATH) $(CY_INTERNAL_EXTAPP_PATH) \
+ \( $(CY_IGNORE_PRUNE) \) -prune \
+ -o -type f -name "*.$(CY_TOOLCHAIN_SUFFIX_C)" -print \
+ -o -type f -name "*.$(CY_TOOLCHAIN_SUFFIX_S)" -print \
+ -o -type f -name "*.$(CY_TOOLCHAIN_SUFFIX_s)" -print \
+ -o -type f -name "*.$(CY_TOOLCHAIN_SUFFIX_CPP)" -print \
+ -o -type f -name "*.$(CY_TOOLCHAIN_SUFFIX_O)" -print \
+ -o -type f -name "*.$(CY_TOOLCHAIN_SUFFIX_A)" -print \
+ -o -type f -name "*.$(CY_TOOLCHAIN_SUFFIX_H)" -print \
+ -o -type f -name "*.$(CY_TOOLCHAIN_SUFFIX_HPP)" -print \
+ -o -type d -name "COMPONENT_RESOURCE" -print \
+ -o -type d -name "* *" -print))
+
+CY_SEARCH_C_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_C),$(CY_SEARCH_ALL_FILES))
+CY_SEARCH_S_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_S),$(CY_SEARCH_ALL_FILES))
+CY_SEARCH_s_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_s),$(CY_SEARCH_ALL_FILES))
+CY_SEARCH_CPP_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_CPP),$(CY_SEARCH_ALL_FILES))
+CY_SEARCH_O_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_O),$(CY_SEARCH_ALL_FILES))
+CY_SEARCH_A_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_A),$(CY_SEARCH_ALL_FILES))
+CY_SEARCH_H_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_H),$(CY_SEARCH_ALL_FILES))
+CY_SEARCH_HPP_FILES=$(filter %.$(CY_TOOLCHAIN_SUFFIX_HPP),$(CY_SEARCH_ALL_FILES))
+
+#
+# Search for resource directories and gather the files
+#
+CY_SEARCH_RESOURCE_DIR=$(filter %/COMPONENT_RESOURCE,$(CY_SEARCH_ALL_FILES))
+CY_SEARCH_RESOURCE_FILES=$(foreach dir,$(CY_SEARCH_RESOURCE_DIR),$(wildcard $(dir)/*))
+
+#
+# Check that the directories do not contain spaces
+#
+CY_SEARCH_EMPTY_DIRS=$(filter-out $(CY_SEARCH_C_FILES) $(CY_SEARCH_S_FILES) $(CY_SEARCH_s_FILES) $(CY_SEARCH_CPP_FILES)\
+ $(CY_SEARCH_O_FILES) $(CY_SEARCH_A_FILES) $(CY_SEARCH_H_FILES) $(CY_SEARCH_HPP_FILES)\
+ $(CY_SEARCH_RESOURCE_DIR),$(CY_SEARCH_ALL_FILES))
+
+#
+# Print the number of discovered files
+#
+ifneq ($(CY_SEARCH_EMPTY_DIRS),)
+$(error The application must not contain spaces in the paths. Detected dir(s): $(CY_SEARCH_EMPTY_DIRS))
+else
+$(info -> Found $(words $(CY_SEARCH_C_FILES)) .$(CY_TOOLCHAIN_SUFFIX_C) file(s))
+$(info -> Found $(words $(CY_SEARCH_S_FILES)) .$(CY_TOOLCHAIN_SUFFIX_S) file(s))
+$(info -> Found $(words $(CY_SEARCH_s_FILES)) .$(CY_TOOLCHAIN_SUFFIX_s) file(s))
+$(info -> Found $(words $(CY_SEARCH_CPP_FILES)) .$(CY_TOOLCHAIN_SUFFIX_CPP) file(s))
+$(info -> Found $(words $(CY_SEARCH_O_FILES)) .$(CY_TOOLCHAIN_SUFFIX_O) file(s))
+$(info -> Found $(words $(CY_SEARCH_A_FILES)) .$(CY_TOOLCHAIN_SUFFIX_A) file(s))
+$(info -> Found $(words $(CY_SEARCH_H_FILES)) .$(CY_TOOLCHAIN_SUFFIX_H) file(s))
+$(info -> Found $(words $(CY_SEARCH_HPP_FILES)) .$(CY_TOOLCHAIN_SUFFIX_HPP) file(s))
+$(info -> Found $(words $(CY_SEARCH_RESOURCE_FILES)) resource file(s))
+endif
+
+
+################################################################################
+# Filter lists
+################################################################################
+
+$(info Applying filters...)
+
+#
+# Apply the filtering for files in .cyignore
+#
+CY_SEARCH_PRUNED_C_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_FILES),$(filter $(d)%,$(CY_SEARCH_C_FILES))),$(CY_SEARCH_C_FILES))
+CY_SEARCH_PRUNED_S_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_FILES),$(filter $(d)%,$(CY_SEARCH_S_FILES))),$(CY_SEARCH_S_FILES))
+CY_SEARCH_PRUNED_s_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_FILES),$(filter $(d)%,$(CY_SEARCH_s_FILES))),$(CY_SEARCH_s_FILES))
+CY_SEARCH_PRUNED_CPP_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_FILES),$(filter $(d)%,$(CY_SEARCH_CPP_FILES))),$(CY_SEARCH_CPP_FILES))
+CY_SEARCH_PRUNED_O_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_FILES),$(filter $(d)%,$(CY_SEARCH_O_FILES))),$(CY_SEARCH_O_FILES))
+CY_SEARCH_PRUNED_A_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_FILES),$(filter $(d)%,$(CY_SEARCH_A_FILES))),$(CY_SEARCH_A_FILES))
+CY_SEARCH_PRUNED_H_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_FILES),$(filter $(d)%,$(CY_SEARCH_H_FILES))),$(CY_SEARCH_H_FILES))
+CY_SEARCH_PRUNED_HPP_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_FILES),$(filter $(d)%,$(CY_SEARCH_HPP_FILES))),$(CY_SEARCH_HPP_FILES))
+
+#
+# Apply the COMPONENT and configuration filtering
+#
+CY_SEARCH_AVAILABLE_C_SOURCES=$(call CY_MACRO_FILTER_FILES,C)
+CY_SEARCH_AVAILABLE_S_SOURCES=$(call CY_MACRO_FILTER_FILES,S)
+CY_SEARCH_AVAILABLE_s_SOURCES=$(call CY_MACRO_FILTER_FILES,s)
+CY_SEARCH_AVAILABLE_CPP_SOURCES=$(call CY_MACRO_FILTER_FILES,CPP)
+CY_SEARCH_AVAILABLE_O_SOURCES=$(call CY_MACRO_FILTER_FILES,O)
+CY_SEARCH_AVAILABLE_A_LIBS=$(call CY_MACRO_FILTER_FILES,A)
+
+CY_SEARCH_AVAILABLE_H_INCLUDES=$(sort $(call CY_MACRO_DIR,$(call CY_MACRO_FILTER_FILES,H)))
+CY_SEARCH_AVAILABLE_HPP_INCLUDES=$(sort $(call CY_MACRO_DIR,$(call CY_MACRO_FILTER_FILES,HPP)))
+
+#
+# Combine the directories of the header files and its parent directories
+#
+CY_SEARCH_AVAILABLE_INCLUDES=\
+ $(CY_SEARCH_AVAILABLE_H_INCLUDES)\
+ $(call CY_MACRO_SEARCH_PARENT,$(CY_SEARCH_AVAILABLE_H_INCLUDES))\
+ $(CY_SEARCH_AVAILABLE_HPP_INCLUDES)\
+ $(call CY_MACRO_SEARCH_PARENT,$(CY_SEARCH_AVAILABLE_HPP_INCLUDES))\
+
+# Conditionally add the generated source includes
+ifneq ($(CY_SEARCH_RESOURCE_FILES),)
+CY_SEARCH_AVAILABLE_INCLUDES+=$(CY_GENERATED_DIR)
+endif
+
+#
+# Add to the list
+#
+CY_SEARCH_APP_SOURCE=$(sort $(CY_SEARCH_AVAILABLE_S_SOURCES) $(CY_SEARCH_AVAILABLE_s_SOURCES)\
+ $(CY_SEARCH_AVAILABLE_C_SOURCES) $(CY_SEARCH_AVAILABLE_CPP_SOURCES))
+CY_SEARCH_APP_LIBS=$(sort $(CY_SEARCH_AVAILABLE_O_SOURCES) $(CY_SEARCH_AVAILABLE_A_LIBS))
+CY_SEARCH_APP_INCLUDES=$(sort $(CY_SEARCH_AVAILABLE_INCLUDES))
+
+#
+# Create cyqbuild makefile
+#
+$(shell \
+mkdir -p $(CY_CONFIG_DIR); \
+echo "CY_COMPONENT_LIST:=$(CY_COMPONENT_LIST)" > $(CY_CONFIG_DIR)/cyqbuild.mk; \
+echo "CY_SEARCH_APP_SOURCE:=$(CY_SEARCH_APP_SOURCE)" >> $(CY_CONFIG_DIR)/cyqbuild.mk; \
+echo "CY_SEARCH_APP_LIBS:=$(CY_SEARCH_APP_LIBS)" >> $(CY_CONFIG_DIR)/cyqbuild.mk; \
+echo "CY_SEARCH_APP_INCLUDES:=$(CY_SEARCH_APP_INCLUDES)" >> $(CY_CONFIG_DIR)/cyqbuild.mk; \
+)
+
+$(info Auto-discovery complete)
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/target.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/target.mk
new file mode 100644
index 0000000000000000000000000000000000000000..5c005cc1c05f34ef619e8666f4c6a0d825724bf1
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/target.mk
@@ -0,0 +1,79 @@
+################################################################################
+# \file target.mk
+# \version 1.0
+#
+# \brief
+# Finds available targets in the design.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+
+#
+# Search for target make files and BSPs. Use := assignment for better performance.
+#
+CY_TARGET_MAKEFILE_SEARCH:=$(call CY_MACRO_SEARCH,$(TARGET).mk,$(CY_INTERNAL_APP_PATH))\
+ $(if $(CY_INTERNAL_EXTAPP_PATH),$(call CY_MACRO_SEARCH,$(TARGET).mk,$(CY_INTERNAL_EXTAPP_PATH)))\
+ $(if $(SEARCH_LIBS_AND_INCLUDES),$(foreach d,$(SEARCH_LIBS_AND_INCLUDES),$(call CY_MACRO_SEARCH,$(TARGET).mk,$(d))))
+CY_TARGET_AVAILABLE_SEARCH:=$(call CY_MACRO_SEARCH,.mk,$(CY_INTERNAL_APP_PATH))\
+ $(if $(CY_INTERNAL_EXTAPP_PATH),$(call CY_MACRO_SEARCH,.mk,$(CY_INTERNAL_EXTAPP_PATH)))\
+ $(if $(SEARCH_LIBS_AND_INCLUDES),$(foreach d,$(SEARCH_LIBS_AND_INCLUDES),$(call CY_MACRO_SEARCH,.mk,$(d))))\
+
+# Gather and filter the found files
+CY_SEARCH_PRUNED_MAKE_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_DIRS),$(filter $(d)%,$(CY_TARGET_MAKEFILE_SEARCH))),$(CY_TARGET_MAKEFILE_SEARCH))
+CY_SEARCH_PRUNED_AVAILABLEMAKE_FILES:=$(filter-out $(foreach d,$(CY_IGNORE_DIRS),$(filter $(d)%,$(CY_TARGET_AVAILABLE_SEARCH))),$(CY_TARGET_AVAILABLE_SEARCH))
+
+# Target makefile
+CY_TARGET_MAKEFILE=$(call CY_MACRO_FILTER_FILES,MAKE)
+
+# Check if the TARGET.mk was brought in through CY_EXTRA_INCLUDES or directly in the app makefile
+CY_TARGET_EXTRA_INCLUDES=$(filter %/$(TARGET).mk,$(MAKEFILE_LIST))
+CY_TARGET_EXTRA_FILTERED=$(filter-out $(CY_TARGET_EXTRA_INCLUDES),$(CY_TARGET_MAKEFILE))
+
+# Full list of available targets
+CY_TARGET_AVAILABLE_DIRS=$(notdir $(call CY_MACRO_DIR,$(CY_SEARCH_PRUNED_AVAILABLEMAKE_FILES) $(CY_TARGET_EXTRA_INCLUDES)))
+CY_TARGET_AVAILABLE=$(sort $(subst TARGET_,,$(foreach item,$(CY_TARGET_AVAILABLE_DIRS),$(if $(findstring /TARGET_,/$(item)),$(item),))))
+
+#
+# Set the target makefile and directory
+#
+ifneq ($(CY_TARGET_EXTRA_INCLUDES),)
+
+ifneq ($(CY_TARGET_EXTRA_FILTERED),)
+$(call CY_MACRO_ERROR,Found multiple identical targets: $(CY_TARGET_EXTRA_INCLUDES) $(CY_TARGET_EXTRA_FILTERED))
+else
+CY_TARGET_DIR=$(call CY_MACRO_DIR,$(CY_TARGET_EXTRA_INCLUDES))
+endif
+
+else
+
+ifeq ($(words $(CY_TARGET_MAKEFILE)),0)
+$(info Available target(s): $(CY_TARGET_AVAILABLE))
+$(call CY_MACRO_ERROR,Target "$(TARGET)" not found)
+else ifeq ($(words $(CY_TARGET_MAKEFILE)),1)
+CY_TARGET_DIR=$(call CY_MACRO_DIR,$(CY_TARGET_MAKEFILE)$(CY_TARGET_MAKEFILE_SEARCH_LIBS))
+include $(CY_TARGET_MAKEFILE) $(CY_TARGET_MAKEFILE_SEARCH_LIBS)
+else
+$(call CY_MACRO_ERROR,Found multiple identical targets:$(CY_TARGET_MAKEFILE))
+endif
+
+endif
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/utils.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/utils.mk
new file mode 100644
index 0000000000000000000000000000000000000000..16b3a6413ad0f5ee0a571899778178507272f9a7
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/core/utils.mk
@@ -0,0 +1,358 @@
+################################################################################
+# \file utils.mk
+# \version 1.0
+#
+# \brief
+# Global utilities used across the application recipes and BSPs
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+
+################################################################################
+# Components
+################################################################################
+
+#
+# VFP-specific component
+#
+ifeq ($(VFP_SELECT),hardfp)
+CY_COMPONENT_VFP=HARDFP
+else
+CY_COMPONENT_VFP=SOFTFP
+endif
+
+#
+# Component list
+#
+CY_COMPONENT_LIST_DEFAULT=$(CORE) $(CY_COMPONENT_VFP) $(COMPONENTS)
+# Note: CY_DEFAULT_COMPONENT is needed as DISABLE_COMPONENTS cannot be empty
+DISABLE_COMPONENTS+=CY_DEFAULT_COMPONENT
+CY_COMPONENT_LIST?=$(sort $(filter-out $(DISABLE_COMPONENTS),$(CY_COMPONENT_LIST_DEFAULT)))
+
+
+################################################################################
+# Utility variables
+################################################################################
+
+# Create a make variable that contains a space
+CY_SPACE=
+CY_SPACE+=
+
+# Create a make variable that contains a soft tab
+CY_INDENT=$(CY_SPACE)$(CY_SPACE)$(CY_SPACE)$(CY_SPACE)
+
+# Create a make variable that contains a line break
+define CY_NEWLINE
+
+
+endef
+
+# Create a make variable that contains a comma
+CY_COMMA=,
+
+# Displays/Hides the build steps
+ifneq (,$(filter $(VERBOSE),true 1))
+CY_NOISE=
+CY_CMD_TERM=
+else
+CY_NOISE=@
+CY_CMD_TERM= > /dev/null 2>&1
+endif
+
+# Set the location of the find utility (Avoid conflict with Windows system32/find.exe)
+CY_QUERY_FIND=$(findstring /usr/bin/find,$(shell whereis find))
+ifeq ($(CY_QUERY_FIND),)
+CY_FIND=find
+else
+CY_FIND=/usr/bin/find
+endif
+
+#
+# Prints for bypassing TARGET/DEVICE checks
+# $(1) : String to print
+#
+ifeq ($(CY_COMMENCE_BUILD),true)
+CY_MACRO_ERROR=$(error $(1))
+else
+CY_MACRO_ERROR=$(info WARNING: $(1))
+endif
+
+
+################################################################################
+# Search macros
+################################################################################
+
+#
+# Macros to find all COMPONENTS not listed in the component list.
+# Step 1: Find all COMPONENT directories in app
+# Step 2: Process the list and get a list of all COMPONENTS
+# Step 3: Compare the found COMPONENTS with the expected components list
+#
+# $(1): List of files of a certain file type
+#
+CY_MACRO_FIND_COMPONENTS=$(strip $(foreach item,$(1),$(if $(findstring /COMPONENT_,/$(item)),$(item),)))
+CY_MACRO_PROCESS_COMPONENTS=\
+$(foreach item,$(1),\
+ $(if $(findstring /COMPONENT_,/$(notdir $(item))),$(subst COMPONENT_,,$(notdir $(item))),)\
+ $(if $(call CY_MACRO_EQUALITY,$(CY_INTERNAL_APP_PATH),$(item)),,$(call CY_MACRO_PROCESS_COMPONENTS,$(call CY_MACRO_DIR,$(item))))\
+)
+CY_MACRO_COMPARE_COMPONENTS=$(filter-out $(CY_COMPONENT_LIST),$(sort $(call CY_MACRO_PROCESS_COMPONENTS,$(call CY_MACRO_FIND_COMPONENTS,$(1)))))
+
+#
+# Filters for components. Iterates through CY_COMPONENT_LIST
+# $(1) : List of files of a certain file type
+#
+CY_MACRO_MATCH_COMPONENT=$(sort $(foreach component,$(2),\
+ $(foreach item,$(1),$(if $(findstring /COMPONENT_$(component)/,/$(item)/),$(item),))))
+CY_MACRO_GET_COMPONENT=$(filter-out \
+ $(call CY_MACRO_MATCH_COMPONENT,$(1),$(call CY_MACRO_COMPARE_COMPONENTS,$(1))),\
+ $(call CY_MACRO_MATCH_COMPONENT,$(1),$(CY_COMPONENT_LIST)))
+CY_MACRO_REMOVE_COMPONENT=$(strip $(foreach item,$(1),$(if $(findstring /COMPONENT_,/$(item)),,$(item))))
+CY_MACRO_FILTER_COMPONENT=$(call CY_MACRO_REMOVE_COMPONENT,$(1)) $(call CY_MACRO_GET_COMPONENT,$(1))
+
+#
+# Filters for configurations
+# $(1) : List of files of a certain file type
+# $(2) : Filter string
+#
+CY_MACRO_MATCH_CONFIGURATION=$(strip $(foreach item,$(1),$(if $(findstring $(2),/$(item)/),$(item),)))
+CY_MACRO_REMOVE_CONFIGURATION=$(strip $(foreach item,$(1),$(if $(findstring $(2),/$(item)),,$(item))))
+CY_MACRO_FILTER_CONFIGURATION=$(call CY_MACRO_REMOVE_CONFIGURATION,$(1),/$(strip $(2))_)\
+ $(call CY_MACRO_MATCH_CONFIGURATION,$(1),/$(strip $(2))_$($(strip $(2)))/)
+
+#
+# Filter for defined components and configurations
+# $(1) : List of files of a certain file type
+#
+CY_MACRO_FILTER=\
+ $(strip \
+ $(call CY_MACRO_FILTER_COMPONENT,\
+ $(call CY_MACRO_FILTER_CONFIGURATION,\
+ $(call CY_MACRO_FILTER_CONFIGURATION,\
+ $(call CY_MACRO_FILTER_CONFIGURATION,\
+ $(1),\
+ TOOLCHAIN),\
+ TARGET),\
+ CONFIG)))
+
+#
+# Search for files
+# $(1) : File type
+#
+CY_MACRO_FILTER_FILES=$(call CY_MACRO_FILTER,$(CY_SEARCH_PRUNED_$(1)_FILES))
+
+#
+# Test for equality
+# $(1) : Base path
+# $(2) : Directory containing header file
+#
+CY_MACRO_EQUALITY=$(if $(and $(findstring $1,$2),$(findstring $2,$1)),TRUE)
+
+#
+# Recursively search for the parent directories up to the project root directory
+# $(1) : Directories containing header files
+#
+CY_MACRO_SEARCH_PARENT=\
+$(foreach item,$(1),\
+ $(if $(call CY_MACRO_EQUALITY,.,$(item)),\
+ .\
+ ,\
+ $(call CY_MACRO_DIR,$(item))\
+ $(call CY_MACRO_SEARCH_PARENT,$(call CY_MACRO_DIR,$(item)))\
+ )\
+)
+
+#
+# Convert to lower case
+# $(1) : String to convert to lower case
+#
+CY_MACRO_LC=$(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst \
+ H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst \
+ Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst \
+ W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
+
+#
+# Convert to upper case
+# $(1) : String to convert to upper case
+#
+CY_MACRO_UC=$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst \
+ h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst \
+ q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst \
+ w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
+
+
+################################################################################
+# IDE-specifc targets
+################################################################################
+
+CY_VSCODE_OUT_PATH=$(CY_INTERNAL_APP_PATH)/.vscode
+CY_VSCODE_OUT_TEMPLATE_PATH=$(CY_VSCODE_OUT_PATH)/cytemplates
+CY_VSCODE_BACKUP_PATH=$(CY_VSCODE_OUT_PATH)/backup
+CY_VSCODE_TEMPLATE_PATH=$(CY_INTERNAL_BASELIB_PATH)/make/scripts/vscode
+CY_VSCODE_TEMPFILE=$(CY_CONFIG_DIR)/vscode_launch.temp
+
+CY_ECLIPSE_OUT_PATH=$(CY_INTERNAL_APP_PATH)/.mtbLaunchConfigs
+CY_ECLIPSE_TEMPLATE_PATH=$(CY_INTERNAL_BASELIB_PATH)/make/scripts/eclipse
+CY_ECLIPSE_TEMPFILE=$(CY_CONFIG_DIR)/eclipse_launch.temp
+CY_ECLIPSE_TEMPLATES_WILDCARD?=*
+
+ifeq ($(CY_IDE_PRJNAME),)
+CY_IDE_PRJNAME=$(APPNAME)
+endif
+
+vscode:
+ifeq ($(LIBNAME),)
+ @mkdir -p $(CY_CONFIG_DIR);\
+ mkdir -p $(CY_VSCODE_OUT_TEMPLATE_PATH);\
+ mkdir -p $(CY_VSCODE_BACKUP_PATH);\
+ echo $(CY_VSCODE_ARGS) > $(CY_VSCODE_TEMPFILE);\
+ echo "s|&&JSONINCLUDELIST&&|$(foreach onedef,$(subst -I,,$(CY_RECIPE_INCLUDES)),\"$(onedef)\",)|" >> $(CY_VSCODE_TEMPFILE);\
+ echo "s|&&JSONDEFINELIST&&|$(foreach onedef,$(subst -D,,$(CY_RECIPE_DEFINES)),\"$(onedef)\",)|" >> $(CY_VSCODE_TEMPFILE);\
+ for json in $(CY_VSCODE_TEMPLATE_PATH)/*; do\
+ jsonFile="$${json##*/}";\
+ if [[ $$jsonFile == *"c_cpp_properties"* ]] && [[ $$jsonFile != *"c_cpp_properties_$(TOOLCHAIN).json" ]]; then\
+ continue;\
+ fi;\
+ sed -f $(CY_VSCODE_TEMPFILE) $(CY_VSCODE_TEMPLATE_PATH)/$$jsonFile > $(CY_VSCODE_OUT_TEMPLATE_PATH)/$$jsonFile;\
+ jsonFiles="$$jsonFiles $$jsonFile";\
+ if [ -f $(CY_VSCODE_OUT_PATH)/$$jsonFile ] && [[ $$jsonFile == *"settings.json" ]]; then\
+ echo "Modifying existing settings.json file";\
+ mv $(CY_VSCODE_OUT_PATH)/$$jsonFile $(CY_VSCODE_BACKUP_PATH)/$$jsonFile;\
+ sed \
+ -e /cortex-debug\\.armToolchainPath/s%:.*%:\ \"$(CY_COMPILER_DIR)/bin\",% \
+ -e /cortex-debug\\.openocdPath/s%:.*%:\ \"$(CY_OPENOCD_DIR)/bin/openocd\",% \
+ $(CY_VSCODE_BACKUP_PATH)/$$jsonFile > $(CY_VSCODE_OUT_PATH)/$$jsonFile;\
+ else\
+ cp $(CY_VSCODE_OUT_TEMPLATE_PATH)/$$jsonFile $(CY_VSCODE_OUT_PATH)/$$jsonFile;\
+ fi;\
+ done;\
+ mv $(CY_VSCODE_OUT_PATH)/c_cpp_properties_$(TOOLCHAIN).json $(CY_VSCODE_OUT_PATH)/c_cpp_properties.json;\
+ mv $(CY_VSCODE_OUT_PATH)/openocd.tcl $(CY_INTERNAL_APP_PATH)/openocd.tcl;\
+ rm $(CY_VSCODE_TEMPFILE);\
+ rm -rf $(CY_VSCODE_OUT_TEMPLATE_PATH);\
+ echo;\
+ echo Generated Visual Studio Code files: $$jsonFiles;\
+ echo;\
+ echo WARNING: The vscode target is preliminary...
+else
+ @echo
+endif
+
+CY_HELP_eclipse=Generates eclipse IDE launch configs.
+eclipse:
+ifeq ($(LIBNAME),)
+ @mkdir -p $(CY_CONFIG_DIR);\
+ mkdir -p $(CY_ECLIPSE_OUT_PATH);\
+ echo $(CY_ECLIPSE_ARGS) > $(CY_ECLIPSE_TEMPFILE);\
+ for launch in $(CY_ECLIPSE_TEMPLATE_PATH)/$(CY_ECLIPSE_TEMPLATES_WILDCARD); do\
+ launchFile="$${launch##*/}";\
+ launchFileName="$${launchFile%.*}";\
+ sed -f $(CY_ECLIPSE_TEMPFILE) "$(CY_ECLIPSE_TEMPLATE_PATH)/$$launchFileName.xml" > "$(CY_ECLIPSE_OUT_PATH)/$(CY_IDE_PRJNAME) $$launchFileName.launch";\
+ launchConfigs="$$launchConfigs \"$(CY_IDE_PRJNAME) $$launchFileName.launch"\";\
+ done;\
+ rm $(CY_ECLIPSE_TEMPFILE);\
+ echo;\
+ echo Generated Eclipse launch config files: "$$launchConfigs"
+else
+ @echo
+endif
+
+ifneq ($(SEARCH_LIBS_AND_INCLUDES),)
+CY_SHARED_ALL_LIB_FILES=$(call CY_MACRO_SEARCH,.lib,$(CY_SHARED_PATH))
+CY_SHARED_USED_LIB_NAMES=$(foreach item,$(SEARCH_LIBS_AND_INCLUDES),$(notdir $(item).lib))
+CY_SHARED_USED_LIB_FILES=$(foreach name,$(CY_SHARED_USED_LIB_NAMES),$(filter %/$(name),$(CY_SHARED_ALL_LIB_FILES)))
+endif
+
+CY_HELP_get_app_info=Prints the app info for the eclipse IDE.
+get_app_info:
+ @echo;\
+ echo "APP_NAME=$(APPNAME)";\
+ echo "LIB_NAME=$(LIBNAME)";\
+ echo "TARGET=$(TARGET)";\
+ echo "TARGET_DEVICE=$(DEVICE)";\
+ echo "CONFIGURATOR_FILES=$(CY_CONFIG_FILES)";\
+ echo "SUPPORTED_TOOL_TYPES=$(CY_OPEN_FILTERED_SUPPORTED_TYPES)";\
+ echo "CY_TOOLS_PATH=$(CY_TOOLS_DIR)";\
+ echo "CY_GETLIBS_PATH=$(CY_INTERNAL_GETLIBS_PATH)";\
+ echo "SHAREDLIBS_ROOT=$(CY_SHARED_PATH)";\
+ echo "SHAREDLIBS=$(SEARCH_LIBS_AND_INCLUDES)";\
+ echo "SHAREDLIBS_FILES=$(CY_SHARED_USED_LIB_FILES)";\
+ echo "CY_DEPENDENT_PROJECTS=$(CY_DEPENDENT_PROJECTS)"
+
+
+################################################################################
+# Test/debug targets
+################################################################################
+
+CY_TOOLS_LIST+=bash git find ls cp mkdir rm cat sed awk perl file whereis
+
+CY_HELP_check=Checks for the necessary tools.
+check:
+ $(info )
+ $(foreach tool,$(CY_TOOLS_LIST),$(if $(shell which $(tool)),,$(error "$(tool) was not found in user's PATH")))
+ @if [ ! -d $(CY_BT_CONFIGURATOR_DIR) ]; then toolsTest+=("bt-configurator could not be found"); fi;\
+ if [ ! -d $(CY_CAPSENSE_CONFIGURATOR_DIR) ]; then toolsTest+=("capsense-configurator could not be found"); fi;\
+ if [ ! -d $(CY_CFG_BACKEND_CLI_DIR) ]; then toolsTest+=("cfg-backend-cli could not be found"); fi;\
+ if [ ! -d $(CY_MCUELFTOOL_DIR) ]; then toolsTest+=("cymcuelftool could not be found"); fi;\
+ if [ ! -d $(CY_PE_TOOL_DIR) ]; then toolsTest+=("cype-tool could not be found"); fi;\
+ if [ ! -d $(CY_DEVICE_CONFIGURATOR_DIR) ]; then toolsTest+=("device-configurator could not be found"); fi;\
+ if [ ! -d $(CY_DFUH_TOOL_DIR) ]; then toolsTest+=("dfuh-tool could not be found"); fi;\
+ if [ ! -d $(CY_FW_LOADER_DIR) ]; then toolsTest+=("fw-loader could not be found"); fi;\
+ if [ ! -d $(CY_COMPILER_DIR) ]; then toolsTest+=("Default ARM GCC toolchain could not be found"); fi;\
+ if [ ! -d $(CY_JRE_DIR) ]; then toolsTest+=("Java Runtime Environment tool could not be found"); fi;\
+ if [ ! -d $(CY_LIBRARY_MANAGER_DIR) ]; then toolsTest+=("Library Manager could not be found"); fi;\
+ if [ ! -d $(CY_MODUS_SHELL_DIR) ]; then toolsTest+=("modus-shell could not be found"); fi;\
+ if [ ! -d $(CY_OPENOCD_DIR) ]; then toolsTest+=("openocd could not be found"); fi;\
+ if [ ! -d $(CY_PROJECT_CREATOR_DIR) ]; then toolsTest+=("Project Creator could not be found"); fi;\
+ if [ ! -d $(CY_QSPI_CONFIGURATOR_DIR) ]; then toolsTest+=("qspi-configurator could not be found"); fi;\
+ if [ ! -d $(CY_SEGLCD_CONFIGURATOR_DIR) ]; then toolsTest+=("seglcd-configurator could not be found"); fi;\
+ if [ ! -d $(CY_SMARTIO_CONFIGURATOR_DIR) ]; then toolsTest+=("smartio-configurator could not be found"); fi;\
+ if [ ! -d $(CY_MAKEFILES_DIR) ]; then toolsTest+=("Tools make files could not be found"); fi;\
+ if [ $${#toolsTest[@]} -eq 0 ]; then\
+ printf "SUCCESS: All tools are present";\
+ else\
+ printf "FAILED: The following tools are missing\n";\
+ printf ' %s\n' "$${toolsTest[@]}";\
+ fi;
+
+CY_HELP_get_env_info=Prints the make, git, and app repo info.
+get_env_info:
+ @echo;\
+ echo "make location :" $$(which make);\
+ echo "make version :" $(MAKE_VERSION);\
+ echo "git location :" $$(which git);\
+ echo "git version :" $$(git --version);\
+ echo "git remote :";\
+ git remote -v;\
+ echo "git rev-parse :" $$(git rev-parse HEAD)
+
+# Empty libs on purpose. May be defined by the application
+shared_libs:
+
+CY_HELP_printlibs=Prints the status of the library repos.
+printlibs:
+
+#
+# Identify the phony targets
+#
+.PHONY: help help_default vscode eclipse check shared_libs get_env_info get_app_info
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/recipe/defines.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/recipe/defines.mk
new file mode 100644
index 0000000000000000000000000000000000000000..c57aca59927616065016e155ce29b610504f7031
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/recipe/defines.mk
@@ -0,0 +1,295 @@
+################################################################################
+# \file defines.mk
+# \version 1.0
+#
+# \brief
+# Defines, needed for the PSoC 6 build recipe.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+
+#
+# List the supported toolchains
+#
+CY_SUPPORTED_TOOLCHAINS=GCC_ARM IAR ARM A_Clang
+
+#
+# Define the default core
+#
+CORE?=CM4
+CY_START_FLASH=0x10000000
+CY_START_SRAM=0x08000000
+
+CY_OPEN_bt_configurator_DEVICE=--device PSoC6
+CY_OPENOCD_CHIP_NAME=psoc6
+CY_OPENOCD_SECOND_RESET_TYPE=run
+CY_OPENOCD_OTHER_RUN_CMD=mon psoc6 reset_halt sysresetreq
+CY_OPENOCD_OTHER_RUN_CMD_ECLIPSE=$(CY_OPENOCD_OTHER_RUN_CMD)\&\#13;\&\#10;
+
+#
+# Core specifics
+#
+ifeq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_M0P)))
+ifeq ($(CORE),CM0P)
+$(call CY_MACRO_ERROR,$(DEVICE) does not have a CM0+ core)
+endif
+CY_LINKERSCRIPT_SUFFIX=cm4
+CY_OPENOCD_EXTRA_PORT_FLAG=
+CY_OPENOCD_EXTRA_PORT_ECLIPSE=
+CY_OPENOCD_CM0_DISABLE_FLAG=set ENABLE_CM0 0
+CY_OPENOCD_CM0_DISABLE_ECLIPSE=-c \"$(CY_OPENOCD_CM0_DISABLE_FLAG)\"\&\#13;\&\#10;
+else
+ifeq ($(CORE),CM0P)
+CY_LINKERSCRIPT_SUFFIX=cm0plus
+else
+CY_LINKERSCRIPT_SUFFIX=cm4_dual
+CY_OPENOCD_EXTRA_PORT_FLAG=gdb_port 3332
+CY_OPENOCD_EXTRA_PORT_ECLIPSE=-c \"$(CY_OPENOCD_EXTRA_PORT_FLAG)\"\&\#13;\&\#10;
+CY_OPENOCD_CM0_DISABLE_FLAG=
+CY_OPENOCD_CM0_DISABLE_ECLIPSE=
+endif
+endif
+
+#
+# Architecure specifics
+#
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_DIE_PSOC6ABLE2)))
+
+CY_PSOC_ARCH=psoc6_01
+CY_PSOC_DIE_NAME=PSoC6ABLE2
+CY_OPENOCD_DEVICE_CFG=psoc6.cfg
+CY_JLINK_DEVICE_CFG_PROGRAM=CY8C6xx7_CM0p_sect256KB_tm
+CY_JLINK_DEVICE_CFG_DEBUG=CY8C6xx7_CM4_sect256KB
+ifeq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_M0P)))
+CY_JLINK_DEVICE_CFG_PROGRAM=CY8C6xx6_CM4_sect256KB
+CY_JLINK_DEVICE_CFG_DEBUG=CY8C6xx6_CM4_sect256KB
+endif
+ifneq (,$(findstring CYB0,$(DEVICE)))
+CY_PSOC_ARCH=psoc6_secure
+CY_PSOC_DIE_NAME=PSoC6ABLE2Secure
+CY_OPENOCD_CHIP_NAME=psoc64
+CY_OPENOCD_DEVICE_CFG=psoc6_secure.cfg
+CY_OPENOCD_CM0_DISABLE_FLAG=set TARGET_AP cm4_ap
+CY_OPENOCD_EXTRA_PORT_FLAG=
+CY_OPENOCD_CM0_DISABLE_ECLIPSE=-c \"$(CY_OPENOCD_CM0_DISABLE_FLAG)\"\&\#13;\&\#10;
+CY_OPENOCD_EXTRA_PORT_ECLIPSE=
+CY_OPENOCD_SECOND_RESET_TYPE=init
+CY_OPENOCD_OTHER_RUN_CMD=
+CY_OPENOCD_OTHER_RUN_CMD_ECLIPSE=
+CY_OPENOCD_SMIF_DISABLE=set DISABLE_SMIF 1
+CY_OPENOCD_SMIF_DISABLE_ECLIPSE=-c \"$(CY_OPENOCD_SMIF_DISABLE)\"\&\#13;\&\#10;
+endif
+
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_DIE_PSOC6A2M)))
+
+CY_PSOC_ARCH=psoc6_02
+CY_PSOC_DIE_NAME=PSoC6A2M
+CY_OPENOCD_DEVICE_CFG=psoc6_2m.cfg
+CY_JLINK_DEVICE_CFG_PROGRAM=CY8C6xxA_CM0p_sect256KB_tm
+CY_JLINK_DEVICE_CFG_DEBUG=CY8C6xxA_CM4_sect256KB
+ifneq (,$(findstring CYB0,$(DEVICE)))
+CY_PSOC_ARCH=psoc6_2m_secure
+CY_PSOC_DIE_NAME=PSoC6A2MSecure
+CY_OPENOCD_CHIP_NAME=psoc64_2m
+CY_OPENOCD_DEVICE_CFG=psoc6_2m_secure.cfg
+CY_OPENOCD_CM0_DISABLE_FLAG=set TARGET_AP cm4_ap
+CY_OPENOCD_EXTRA_PORT_FLAG=
+CY_OPENOCD_CM0_DISABLE_ECLIPSE=-c \"$(CY_OPENOCD_CM0_DISABLE_FLAG)\"\&\#13;\&\#10;
+CY_OPENOCD_EXTRA_PORT_ECLIPSE=
+CY_OPENOCD_SECOND_RESET_TYPE=init
+CY_OPENOCD_OTHER_RUN_CMD=
+CY_OPENOCD_OTHER_RUN_CMD_ECLIPSE=
+CY_OPENOCD_SMIF_DISABLE=set DISABLE_SMIF 1
+CY_OPENOCD_SMIF_DISABLE_ECLIPSE=-c \"$(CY_OPENOCD_SMIF_DISABLE)\"\&\#13;\&\#10;
+endif
+
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_DIE_PSOC6A512K)))
+
+CY_PSOC_ARCH=psoc6_03
+CY_PSOC_DIE_NAME=PSoC6A512K
+CY_OPENOCD_DEVICE_CFG=psoc6_512k.cfg
+CY_JLINK_DEVICE_CFG_PROGRAM=CY8C6xx5_CM0p_sect256KB_tm
+CY_JLINK_DEVICE_CFG_DEBUG=CY8C6xx5_CM4_sect256KB
+
+else
+$(call CY_MACRO_ERROR,Incorrect part number $(DEVICE). Check DEVICE variable.)
+endif
+
+#
+# Flash memory specifics
+#
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_512)))
+CY_MEMORY_FLASH=524288
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_832)))
+CY_MEMORY_FLASH=850944
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_1024)))
+CY_MEMORY_FLASH=1048576
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_1856)))
+CY_MEMORY_FLASH=1899520
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_2048)))
+CY_MEMORY_FLASH=2097152
+else
+$(call CY_MACRO_ERROR,No Flash memory size defined for $(DEVICE))
+endif
+
+#
+# SRAM memory specifics
+#
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_SRAM_KB_128)))
+CY_MEMORY_SRAM=129024
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_SRAM_KB_256)))
+CY_MEMORY_SRAM=260096
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_SRAM_KB_288)))
+CY_MEMORY_SRAM=292864
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_SRAM_KB_512)))
+CY_MEMORY_SRAM=522240
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_SRAM_KB_1024)))
+CY_MEMORY_SRAM=1046528
+else
+$(call CY_MACRO_ERROR,No SRAM memory size defined for $(DEVICE))
+endif
+
+#
+# linker scripts
+#
+
+# Secure parts
+ifneq (,$(findstring CYB06,$(DEVICE)))
+
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_DIE_PSOC6ABLE2)))
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_832)))
+CY_LINKER_SCRIPT_NAME=cyb06xx7
+endif
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_DIE_PSOC6A2M)))
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_1856)))
+CY_LINKER_SCRIPT_NAME=cyb06xxa
+endif
+endif
+
+# Non-secure part
+else
+
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_DIE_PSOC6A512K)))
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_512)))
+CY_LINKER_SCRIPT_NAME=cy8c6xx5
+endif
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_DIE_PSOC6ABLE2)))
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_512)))
+CY_LINKER_SCRIPT_NAME=cy8c6xx6
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_1024)))
+CY_LINKER_SCRIPT_NAME=cy8c6xx7
+endif
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_DIE_PSOC6A2M)))
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_1024)))
+CY_LINKER_SCRIPT_NAME=cy8c6xx8
+else ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FLASH_KB_2048)))
+CY_LINKER_SCRIPT_NAME=cy8c6xxa
+endif
+endif
+
+endif
+
+ifeq ($(CY_LINKER_SCRIPT_NAME),)
+$(call CY_MACRO_ERROR,Could not resolve device series for linker script)
+endif
+
+#
+# Paths used in program/debug
+#
+ifeq ($(CY_DEVICESUPPORT_PATH),)
+CY_OPENOCD_SVD_PATH?=
+else
+CY_OPENOCD_SVD_PATH?=
+endif
+CY_OPENOCD_QSPI_CFG_PATH=$(CY_TARGET_DIR)/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource
+
+#
+# Set the output file paths
+#
+ifneq ($(CY_BUILD_LOCATION),)
+CY_SYM_FILE?=$(CY_INTERNAL_BUILD_LOCATION)/$(APPNAME)/$(TARGET)/$(CONFIG)/$(APPNAME).elf
+CY_PROG_FILE?=$(CY_INTERNAL_BUILD_LOCATION)/$(APPNAME)/$(TARGET)/$(CONFIG)/$(APPNAME).hex
+else
+CY_SYM_FILE?=\$$\{cy_prj_path\}/$(notdir $(CY_INTERNAL_BUILD_LOC))/$(TARGET)/$(CONFIG)/$(APPNAME).elf
+CY_PROG_FILE?=\$$\{cy_prj_path\}/$(notdir $(CY_INTERNAL_BUILD_LOC))/$(TARGET)/$(CONFIG)/$(APPNAME).hex
+endif
+
+#
+# IDE specifics
+#
+ifneq (,$(findstring CYB0,$(DEVICE)))
+CY_ECLIPSE_TEMPLATES_WILDCARD=*KitProg3*
+endif
+
+CY_VSCODE_ARGS="s|&&RELEASETARGET&&|build/$(TARGET)/Release/$(APPNAME).elf|g;"\
+ "s|&&DEBUGTARGET&&|build/$(TARGET)/Debug/$(APPNAME).elf|g;"\
+ "s|&&PSOCFAMILY&&|$(CY_PSOC_ARCH)|g;"\
+ "s|&&MODUSSHELL&&|$(CY_MODUS_SHELL_DIR)|g;"\
+ "s|&&OPENOCDFILE&&|$(CY_OPENOCD_DEVICE_CFG)|g;"\
+ "s|&&SVDFILENAME&&|$(CY_OPENOCD_SVD_PATH)|g;"\
+ "s|&&MODUSTOOLCHAIN&&|$(CY_COMPILER_DIR)|g;"\
+ "s|&&MODUSTOOLCHAINVERSION&&|$(notdir $(CY_COMPILER_DIR))|g;"\
+ "s|&&MODUSOPENCOD&&|$(CY_OPENOCD_DIR)|g;"\
+ "s|&&MODUSLIBMANAGER&&|$(CY_LIBRARY_MANAGER_DIR)|g;"\
+
+CY_ECLIPSE_ARGS="s|&&CY_OPENOCD_CFG&&|$(CY_OPENOCD_DEVICE_CFG)|;"\
+ "s|&&CY_OPENOCD_CHIP&&|$(CY_OPENOCD_CHIP_NAME)|;"\
+ "s|&&CY_OPENOCD_SECOND_RESET&&|$(CY_OPENOCD_SECOND_RESET_TYPE)|;"\
+ "s|&&CY_OPENOCD_OTHER_RUN_CMD&&|$(CY_OPENOCD_OTHER_RUN_CMD_ECLIPSE)|;"\
+ "s|&&CY_JLINK_CFG_PROGRAM&&|$(CY_JLINK_DEVICE_CFG_PROGRAM)|;"\
+ "s|&&CY_JLINK_CFG_DEBUG&&|$(CY_JLINK_DEVICE_CFG_DEBUG)|;"\
+ "s|&&CY_OPENOCD_PORT_SELECT&&|$(CY_OPENOCD_EXTRA_PORT_ECLIPSE)|;"\
+ "s|&&CY_OPENOCD_CM0_FLAG&&|$(CY_OPENOCD_CM0_DISABLE_ECLIPSE)|;"\
+ "s|&&CY_OPENOCD_SMIF_DISABLE&&|$(CY_OPENOCD_SMIF_DISABLE_ECLIPSE)|;"\
+ "s|&&CY_APPNAME&&|$(CY_IDE_PRJNAME)|;"\
+ "s|&&CY_CONFIG&&|$(CONFIG)|;"\
+ "s|&&CY_QSPI_CFG_PATH&&|$(CY_OPENOCD_QSPI_CFG_PATH)|;"\
+ "s|&&CY_SVD_PATH&&|$(CY_OPENOCD_SVD_PATH)|;"\
+ "s|&&CY_SYM_FILE&&|$(CY_SYM_FILE)|;"\
+ "s|&&CY_PROG_FILE&&|$(CY_PROG_FILE)|;"
+
+#
+# Tools specifics
+#
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_CAPSENSE)))
+CY_SUPPORTED_TOOL_TYPES+=capsense-configurator capsense-tuner
+endif
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_BLE)))
+CY_SUPPORTED_TOOL_TYPES+=bt-configurator
+endif
+ifneq (,$(findstring $(DEVICE),$(CY_DEVICES_WITH_FS_USB)))
+CY_SUPPORTED_TOOL_TYPES+=usbdev-configurator
+endif
+CY_SUPPORTED_TOOL_TYPES+=\
+ device-configurator\
+ qspi-configurator\
+ seglcd-configurator\
+ smartio-configurator\
+ cype-tool\
+ dfuh-tool
+
+# PSoC 6 smartio also uses the .modus extension
+modus_DEFAULT_TYPE+=device-configurator smartio-configurator
+
+# PSoC 6 capsense-tuner shares its existence with capsense-configurator
+CY_OPEN_NEWCFG_XML_TYPES+=capsense-tuner
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/recipe/program.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/recipe/program.mk
new file mode 100644
index 0000000000000000000000000000000000000000..8697f3915259aa8f29ee9e7aa2066a10792fb19b
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/recipe/program.mk
@@ -0,0 +1,104 @@
+################################################################################
+# \file program.mk
+# \version 1.0
+#
+# \brief
+# This make file is called recursively and is used to build the
+# resoures file system. It is expected to be run from the example directory.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+
+CY_GDB_CLIENT=$(CY_COMPILER_DIR)/bin/arm-none-eabi-gdb
+CY_GDB_ARGS=$(CY_INTERNAL_BASELIB_PATH)/make/scripts/gdbinit
+
+ifeq ($(TOOLCHAIN),A_Clang)
+CY_OPENOCD_PROGRAM_IMG=$(CY_CONFIG_DIR)/$(APPNAME).bin $(TOOLCHAIN_VECT_BASE_CM4)
+else
+CY_OPENOCD_SYMBOL_IMG=$(CY_CONFIG_DIR)/$(APPNAME).elf
+CY_OPENOCD_PROGRAM_IMG=$(CY_CONFIG_DIR)/$(APPNAME).hex
+endif
+
+CY_OPENOCD_SCRIPTS=-s $(CY_OPENOCD_DIR)/scripts
+CY_OPENOCD_QSPI=-s $(CY_OPENOCD_QSPI_CFG_PATH)
+CY_OPENOCD_INTERFACE=source [find interface/kitprog3.cfg];
+CY_OPENOCD_TARGET=source [find target/$(CY_OPENOCD_DEVICE_CFG)];
+ifeq (,$(findstring CYB0,$(DEVICE)))
+CY_OPENOCD_CUSTOM_COMMAND?=psoc6 allow_efuse_program off;
+else
+CY_GDB_ARGS=$(CY_INTERNAL_BASELIB_PATH)/make/scripts/gdbinit_secure
+endif
+
+CY_OPENOCD_ERASE=init; reset init; psoc6 sflash_restrictions 1; erase_all; exit;
+CY_OPENOCD_PROGRAM=psoc6 sflash_restrictions 1; program $(CY_OPENOCD_PROGRAM_IMG) verify reset exit;
+CY_OPENOCD_DEBUG=$(CY_OPENOCD_CHIP_NAME).cpu.cm4 configure -rtos auto -rtos-wipe-on-reset-halt 1; $(CY_OPENOCD_EXTRA_PORT_FLAG); init; reset init;
+
+CY_OPENOCD_ERASE_ARGS=$(CY_OPENOCD_SCRIPTS) -c \
+ "$(CY_OPENOCD_INTERFACE) $(CY_OPENOCD_CM0_DISABLE_FLAG); $(CY_OPENOCD_SMIF_DISABLE); $(CY_OPENOCD_TARGET) $(CY_OPENOCD_CUSTOM_COMMAND) $(CY_OPENOCD_ERASE)"
+CY_OPENOCD_PROGRAM_ARGS=$(CY_OPENOCD_SCRIPTS) $(CY_OPENOCD_QSPI) -c \
+ "$(CY_OPENOCD_INTERFACE) $(CY_OPENOCD_CM0_DISABLE_FLAG); $(CY_OPENOCD_TARGET) $(CY_OPENOCD_CUSTOM_COMMAND) $(CY_OPENOCD_PROGRAM)"
+CY_OPENOCD_DEBUG_ARGS=$(CY_OPENOCD_SCRIPTS) $(CY_OPENOCD_QSPI) -c \
+ "$(CY_OPENOCD_INTERFACE) $(CY_OPENOCD_CM0_DISABLE_FLAG); $(CY_OPENOCD_TARGET) $(CY_OPENOCD_CUSTOM_COMMAND) $(CY_OPENOCD_DEBUG)"
+
+erase:
+ @echo;\
+ echo "Erasing target device... ";\
+ $(CY_OPENOCD_DIR)/bin/openocd $(CY_OPENOCD_ERASE_ARGS)
+
+program: build qprogram
+
+qprogram: memcalc
+ifeq ($(LIBNAME),)
+ @echo;\
+ echo "Programming target device... ";\
+ $(CY_OPENOCD_DIR)/bin/openocd $(CY_OPENOCD_PROGRAM_ARGS)
+else
+ @echo "Library application detected. Skip programming... ";\
+ echo
+endif
+
+debug: program qdebug
+
+qdebug: qprogram
+ifeq ($(LIBNAME),)
+ @echo;\
+ echo ==============================================================================;\
+ echo "Instruction:";\
+ echo "Open a separate shell and run the attach target (make attach)";\
+ echo "to start the GDB client. Then use the GDB commands to debug.";\
+ echo ==============================================================================;\
+ echo;\
+ echo "Opening GDB port ... ";\
+ $(CY_OPENOCD_DIR)/bin/openocd $(CY_OPENOCD_DEBUG_ARGS)
+else
+ @echo "Library application detected. Skip debug... ";\
+ echo
+endif
+
+attach:
+ @echo;\
+ echo "Starting GDB Client... ";\
+ $(CY_GDB_CLIENT) $(CY_OPENOCD_SYMBOL_IMG) -x $(CY_GDB_ARGS)
+
+
+.PHONY: erase program qprogram debug qdebug attach
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/recipe/recipe.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/recipe/recipe.mk
new file mode 100644
index 0000000000000000000000000000000000000000..ed0f70866ee78bd41e74f8997213f430e0432f10
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/recipe/recipe.mk
@@ -0,0 +1,202 @@
+################################################################################
+# \file recipe.mk
+# \version 1.0
+#
+# \brief
+# Set up a set of defines, includes, software components, linker script,
+# Pre and Post build steps and call a macro to create a specific ELF file.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+
+#
+# linker script construction
+#
+ifeq ($(LINKER_SCRIPT),)
+LINKER_SCRIPT=$(CY_TARGET_DIR)/linker/TOOLCHAIN_$(TOOLCHAIN)/$(CY_LINKER_SCRIPT_NAME)_$(CY_LINKERSCRIPT_SUFFIX).$(CY_TOOLCHAIN_SUFFIX_LS)
+endif
+
+ifeq ($(shell if [ -f $(LINKER_SCRIPT) ]; then echo 1; else echo 0; fi;),0)
+$(error The specified linker script could not be found at $(LINKER_SCRIPT))
+endif
+
+ifeq ($(TOOLCHAIN),A_Clang)
+include $(LINKER_SCRIPT)
+else
+CY_RECIPE_LSFLAG=$(CY_TOOLCHAIN_LSFLAGS)$(LINKER_SCRIPT)
+endif
+
+#
+# Flags construction
+#
+CY_RECIPE_CFLAGS?=\
+ $(CFLAGS)\
+ $(CY_TOOLCHAIN_CFLAGS)
+
+CY_RECIPE_CXXFLAGS?=\
+ $(CXXFLAGS)\
+ $(CY_TOOLCHAIN_CXXFLAGS)
+
+CY_RECIPE_ASFLAGS?=\
+ $(ASFLAGS)\
+ $(CY_TOOLCHAIN_ASFLAGS)
+
+CY_RECIPE_ARFLAGS?=\
+ $(CY_TOOLCHAIN_ARFLAGS)
+
+CY_RECIPE_LDFLAGS?=\
+ $(LDFLAGS)\
+ $(CY_TOOLCHAIN_LDFLAGS)\
+ $(CY_RECIPE_LSFLAG)
+
+#
+# Defines construction
+#
+ifneq ($(DEFINES),)
+CY_RECIPE_USER_DEFINES=$(addprefix -D,$(DEFINES))
+endif
+ifneq ($(LIBNAME),)
+CY_RECIPE_USER_NAME=-DCY_LIBNAME_$(subst -,_,$(LIBNAME))
+else
+CY_RECIPE_USER_NAME=-DCY_APPNAME_$(subst -,_,$(APPNAME))
+endif
+
+CY_RECIPE_DEFINES=\
+ $(CY_RECIPE_USER_DEFINES)\
+ $(CY_RECIPE_USER_NAME)\
+ -D$(subst -,_,$(DEVICE))\
+ -DCY_TARGET_DEVICE=$(subst -,_,$(DEVICE))\
+ -DTARGET_$(subst -,_,$(TARGET))\
+ -DCY_TARGET_BOARD=$(subst -,_,$(TARGET))\
+ $(foreach feature,$(CY_COMPONENT_LIST),-DCOMPONENT_$(subst -,_,$(feature)))\
+ $(CY_TOOLCHAIN_DEBUG_FLAG)\
+ $(CY_TOOLCHAIN_DEFINES)
+
+#
+# Includes construction
+#
+CY_RECIPE_INCLUDES=\
+ $(addprefix -I,$(INCLUDES))\
+ $(addprefix -I,$(CY_SEARCH_APP_INCLUDES))\
+ $(addprefix -I,$(CY_TOOLCHAIN_INCLUDES))
+
+#
+# Sources construction
+#
+CY_RECIPE_SOURCE=$(CY_SEARCH_APP_SOURCE)
+
+#
+# Libraries construction
+#
+CY_RECIPE_LIBS=$(LDLIBS) $(CY_SEARCH_APP_LIBS)
+
+#
+# Generate source step
+#
+ifneq ($(CY_SEARCH_RESOURCE_FILES),)
+CY_RECIPE_RESOURCE_FILES=$(CY_SEARCH_RESOURCE_FILES)
+CY_RECIPE_GENERATED_FLAG=TRUE
+
+# Define the generated source file. Use := for better performance
+CY_RECIPE_GENERATED:=$(addprefix $(CY_GENERATED_DIR)/,$(addsuffix .$(CY_TOOLCHAIN_SUFFIX_C),\
+ $(basename $(notdir $(subst .,_,$(CY_SEARCH_RESOURCE_FILES))))))
+
+CY_RECIPE_GENSRC=\
+ bash --norc --noprofile\
+ $(CY_INTERNAL_BASELIB_PATH)/make/scripts/genresources.bash\
+ $(CY_INTERNAL_BASELIB_PATH)/make/scripts\
+ $(CY_GENERATED_DIR)/resources.cyrsc\
+ $(CY_INTERNAL_APP_PATH)\
+ $(CY_GENERATED_DIR)\
+ "MEM"
+endif
+
+#
+# Prebuild step
+#
+CY_RECIPE_PREBUILD?=
+
+#
+# Postbuild step
+#
+ifeq ($(LIBNAME),)
+
+ifeq ($(TOOLCHAIN),A_Clang)
+CY_RECIPE_POSTBUILD?=\
+ $(CY_TOOLCHAIN_M2BIN)\
+ --verbose --vect $(VECT_BASE_CM4) --text $(TEXT_BASE_CM4) --data $(RAM_BASE_CM4) --size $(TEXT_SIZE_CM4)\
+ $(CY_CONFIG_DIR)/$(APPNAME).mach_o\
+ $(CY_CONFIG_DIR)/$(APPNAME).bin
+
+else ifeq ($(TOOLCHAIN),ARM)
+ifeq ($(CY_COMPILER_PATH),)
+CY_RECIPE_POSTBUILD?=$(CY_COMPILER_ARM_DIR)/bin/fromelf --output $(CY_CONFIG_DIR)/$(APPNAME).hex --i32combined $(CY_CONFIG_DIR)/$(APPNAME).elf
+else
+CY_RECIPE_POSTBUILD?=$(CY_COMPILER_PATH)/bin/fromelf --output $(CY_CONFIG_DIR)/$(APPNAME).hex --i32combined $(CY_CONFIG_DIR)/$(APPNAME).elf
+endif
+
+else ifeq ($(TOOLCHAIN),IAR)
+CY_RECIPE_POSTBUILD?=$(CY_COMPILER_GCC_ARM_DIR)/bin/arm-none-eabi-objcopy -O ihex $(CY_CONFIG_DIR)/$(APPNAME).elf $(CY_CONFIG_DIR)/$(APPNAME).hex
+
+else ifeq ($(TOOLCHAIN),GCC_ARM)
+ifeq ($(CY_COMPILER_PATH),)
+CY_RECIPE_POSTBUILD?=$(CY_COMPILER_GCC_ARM_DIR)/bin/arm-none-eabi-objcopy -O ihex $(CY_CONFIG_DIR)/$(APPNAME).elf $(CY_CONFIG_DIR)/$(APPNAME).hex
+else
+CY_RECIPE_POSTBUILD?=$(CY_COMPILER_PATH)/bin/arm-none-eabi-objcopy -O ihex $(CY_CONFIG_DIR)/$(APPNAME).elf $(CY_CONFIG_DIR)/$(APPNAME).hex
+endif
+endif
+
+endif
+
+################################################################################
+# Memory Consumption
+################################################################################
+
+ifeq ($(TOOLCHAIN),A_Clang)
+CY_GEN_READELF=
+CY_MEMORY_CALC=
+else
+CY_GEN_READELF=$(CY_COMPILER_DIR)/bin/arm-none-eabi-readelf -Sl $(CY_CONFIG_DIR)/$(APPNAME).elf > $(CY_CONFIG_DIR)/$(APPNAME).readelf
+CY_MEM_CALC=\
+ bash --norc --noprofile\
+ $(CY_INTERNAL_BASELIB_PATH)/make/scripts/memcalc.bash\
+ $(CY_CONFIG_DIR)/$(APPNAME).readelf\
+ $(CY_MEMORY_FLASH)\
+ $(CY_MEMORY_SRAM)\
+ $(CY_START_FLASH)\
+ $(CY_START_SRAM)
+endif
+
+memcalc: app
+ifneq ($(LIBNAME),)
+else
+ @echo Calculating memory consumption: $(DEVICE) $(TOOLCHAIN) $(CY_TOOLCHAIN_OPTIMIZATION)
+ @echo
+ $(CY_NOISE)$(CY_GEN_READELF)
+ $(CY_NOISE)$(CY_MEM_CALC)
+endif
+
+#
+# Identify the phony targets
+#
+.PHONY: memcalc
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/bin_to_resource_c.pl b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/bin_to_resource_c.pl
new file mode 100644
index 0000000000000000000000000000000000000000..20b6c767f08b403c4807fb20dac5c547c11fd595
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/bin_to_resource_c.pl
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+
+#
+# Copyright 2019, Cypress Semiconductor Corporation or a subsidiary of
+# Cypress Semiconductor Corporation. All Rights Reserved.
+#
+# This software, including source code, documentation and related
+# materials ("Software"), is owned by Cypress Semiconductor Corporation
+# or one of its subsidiaries ("Cypress") and is protected by and subject to
+# worldwide patent protection (United States and foreign),
+# United States copyright laws and international treaty provisions.
+# Therefore, you may use this Software only as provided in the license
+# agreement accompanying the software package from which you
+# obtained this Software ("EULA").
+# If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+# non-transferable license to copy, modify, and compile the Software
+# source code solely for use in connection with Cypress's
+# integrated circuit products. Any reproduction, modification, translation,
+# compilation, or representation of this Software except as specified
+# above is prohibited without the express written permission of Cypress.
+#
+# Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+# reserves the right to make changes to the Software without notice. Cypress
+# does not assume any liability arising out of the application or use of the
+# Software or any product or circuit described in the Software. Cypress does
+# not authorize its products for use in any products where a malfunction or
+# failure of the Cypress product may reasonably be expected to result in
+# significant property damage, injury or death ("High Risk Product"). By
+# including Cypress's product in a High Risk Product, the manufacturer
+# of such system or application assumes all risk of such use and in doing
+# so agrees to indemnify Cypress against all liability.
+#
+
+if (! $ARGV[0] )
+{
+ print "Usage ./bin_to_resource_c.pl ";
+ exit;
+}
+
+# Print start of output
+my $location = shift @ARGV;
+my $variable_name = shift @ARGV;
+my $original_variable_name = $variable_name;
+my $file = shift @ARGV;
+
+#open the file
+open INFILE, "<:raw", $file or die "cant open " . $file;
+@file_cont_array = ;
+close INFILE;
+$file_cont = join('',@file_cont_array);
+
+
+print "#include \"cy_abs_resource.h\"\n";
+print "\n";
+$name = $file;
+$name=~s/^.+\/(.*?)/$1/;
+
+if ( $location ne "MEM" )
+{
+ print "const cy_resource_handle_t ${variable_name} = { CY_RESOURCE_IN_FILESYSTEM, " . (length( $file_cont )) . ", {.fs = { 0, \"$name\" } }};\n";
+ print "\n";
+}
+else
+{
+ print "const uint8_t ${variable_name}_data[" . (length( $file_cont )) . "] = {\n";
+ my @vals = unpack( "C*", $file_cont );
+
+ my $linepos;
+ my $firstval = 1;
+
+ foreach $val (@vals)
+ {
+ my $valsize = 1;
+ if ( ( $val >= 10 ) && ( $val < 100 ) )
+ {
+ $valsize = 2;
+ }
+ elsif ( $val >= 100 )
+ {
+ $valsize = 3;
+ }
+
+ if ( $firstval == 1 )
+ {
+ print " $val";
+ $linepos = 8 + $valsize;
+ $firstval = 0;
+ }
+ elsif ( $linepos + 5 >= 79 )
+ {
+ print ",\n $val";
+ $linepos = 8 + $valsize;
+ }
+ else
+ {
+ print ", $val";
+ $linepos += 2 + $valsize;
+ }
+ }
+
+ print "\n};\n";
+ print "const cy_resource_handle_t ${variable_name} = { CY_RESOURCE_IN_MEMORY, " . (length( $file_cont )) . ", {.mem_data = ${variable_name}_data }};\n";
+ print "\n";
+}
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Attach (JLink).xml b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Attach (JLink).xml
new file mode 100644
index 0000000000000000000000000000000000000000..ca684385bd86b81c48f5cfdfb11ae83e2a062e44
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Attach (JLink).xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Attach (KitProg3).xml b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Attach (KitProg3).xml
new file mode 100644
index 0000000000000000000000000000000000000000..f3ab745d535b4d4f3697790b6f617ebef9a0d727
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Attach (KitProg3).xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Debug (JLink).xml b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Debug (JLink).xml
new file mode 100644
index 0000000000000000000000000000000000000000..5247c6f900f567ef5eeafd9694df67f77227c1d2
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Debug (JLink).xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Debug (KitProg3).xml b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Debug (KitProg3).xml
new file mode 100644
index 0000000000000000000000000000000000000000..17516255644f9dc25ec6917a85cbdbb1cb814fca
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Debug (KitProg3).xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Erase (JLink).xml b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Erase (JLink).xml
new file mode 100644
index 0000000000000000000000000000000000000000..ad502c569337a9d5b87bc3f6f66098a5f2a84eef
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Erase (JLink).xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Erase (KitProg3).xml b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Erase (KitProg3).xml
new file mode 100644
index 0000000000000000000000000000000000000000..43f7970efd4e699720fa2498d4a36c33fda98d82
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Erase (KitProg3).xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Program (JLink).xml b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Program (JLink).xml
new file mode 100644
index 0000000000000000000000000000000000000000..590852931aa120d687751abbba159e0ed10c8900
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Program (JLink).xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Program (KitProg3).xml b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Program (KitProg3).xml
new file mode 100644
index 0000000000000000000000000000000000000000..d597267bf2e0429910f3c65b7b238f8ef28448dd
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/eclipse/Program (KitProg3).xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/gdbinit b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/gdbinit
new file mode 100644
index 0000000000000000000000000000000000000000..03e0e87df88bf7c4c6771bf81638d4b34a052e1d
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/gdbinit
@@ -0,0 +1,32 @@
+# CM4 port
+target remote:3333
+
+# Open all memory
+set mem inaccessible-by-default off
+
+# Enable semihosting
+monitor arm semihosting enable
+
+# Load the executable
+# load
+
+# Reset device
+monitor reset run
+
+# Halt device
+monitor halt
+
+# Reset device via dedicated reset method
+monitor psoc6 reset_halt sysresetreq
+flushregs
+mon gdb_sync
+stepi
+
+# Set temporary breakpoint at main
+tbreak main
+
+# Print registers
+monitor reg
+
+# Continue program execution
+continue
\ No newline at end of file
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/gdbinit_secure b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/gdbinit_secure
new file mode 100644
index 0000000000000000000000000000000000000000..c107ba49b344e8ae7bf9d4ec83a99e80eb793b8e
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/gdbinit_secure
@@ -0,0 +1,34 @@
+# CM4 port
+target remote:3333
+
+# Open all memory
+set mem inaccessible-by-default off
+
+# Target acquisition timeout
+set remotetimeout 15
+
+# Enable semihosting
+monitor arm semihosting enable
+
+# Load the executable
+# load
+
+# Reset device
+monitor reset init
+
+# Halt device
+monitor halt
+
+# Synchronize client and server
+flushregs
+mon gdb_sync
+stepi
+
+# Set temporary breakpoint at main
+tbreak main
+
+# Print registers
+monitor reg
+
+# Continue program execution
+continue
\ No newline at end of file
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/genresources.bash b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/genresources.bash
new file mode 100644
index 0000000000000000000000000000000000000000..3aa2083628c315d7c242fee1552eb4dd481abdc4
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/genresources.bash
@@ -0,0 +1,177 @@
+#!/bin/bash
+(set -o igncr) 2>/dev/null && set -o igncr; # this comment is required
+set -$-ue${DEBUG+x}
+
+#######################################################################################################################
+# This script is designed to process resource files that are necessary for a single component. It converts each
+# resource file into a binary object and then stores that into an array in a .c file. The .c file can then be compiled
+# with and linked into an application image.
+#
+# Once all resources files have been converted it will generate a header file that references each of them.
+#
+# usage:
+# genresources.bash [s]
+#
+#######################################################################################################################
+
+RECIPE_DIR=$1 #eg: ./tools
+RESOURCE_FILE=$2 #eg: ./generated/temp.cyrsc
+PROJECT_DIR=$3 #eg: ./project_mainapp
+TARGET_DIR=$4 #eg: ./project_resources
+RESOURCE_TYPE=$5 #eg: FILESYSTEM or MEM
+
+echo Script: genresources.bash
+echo " 1: Recipe Dir : '"$RECIPE_DIR"'"
+echo " 3: Resource Files : '"$RESOURCE_FILE"'"
+echo " 4: Project Dir : '"$PROJECT_DIR"'"
+echo " 5: Target Dir : '"$TARGET_DIR"'"
+echo " 6: Resource Type : '"$RESOURCE_TYPE"'"
+
+#
+# File in the target directory
+#
+RES_FILE="$TARGET_DIR/cy_resources.h"
+
+# array of c source files parsed for declarations to generate resources.h
+declare SOURCE_ARRAY=()
+
+#
+# Print nice error messages
+#
+function error() {
+ echo "ERROR: $1"
+ shift
+
+ while (( $# > 0 )); do
+ echo " : $1:"
+ shift
+ done
+
+ echo "—ABORTING--"
+ exit 1
+}
+
+#
+# Checks if the value $1 is in the array $element
+#
+array_contains () {
+ local seeking=$1; shift
+ local in=0
+ for element; do
+ if [[ $element == $seeking ]]; then
+ in=1
+ break
+ fi
+ done
+ echo $in
+}
+
+#
+# Prepares the resource file for outputing as c-file
+#
+convert_resource_name() {
+ local input=$1
+ local result=${input//\//_DIR_} #replace '/' with '_DIR_'
+ result=${result//./_} #replace '.' with '_'
+ result=${result//-/_} #replace '-' with '_'
+ result=${result//resources_DIR/resources} #replace 'resources_DIR' with 'resources'
+ echo $result
+}
+
+#
+# Process the resources listed in the .cyrsc file by converting them to .c and creating
+# a list of files for the resource header script
+#
+processResources() {
+ local TEXT_FILTERS=(html htm txt eml js css dat cer pem json xml py key)
+ local BINARY_FILTERS=(jpg jpeg png ico gif bin flac wav clm_blob gz mp3 wmfw)
+
+ local TEXT_TO_RES="$RECIPE_DIR/text_to_resource_c.pl"
+ local BIN_TO_RES="$RECIPE_DIR/bin_to_resource_c.pl"
+
+ local resourceList=($(<$1))
+
+ # Parse through each element in the .cyrsc file
+ for ((i = 0; i < ${#resourceList[@]}; i++)); do
+
+ # Evaluate the file
+ local resourceFile="${resourceList[$i]}"
+ local filename="${resourceFile##*/}"
+ local extension="${filename##*.}"
+
+ # only process the file if it exists
+ if [ -f "$resourceFile" ]; then
+
+ local resourceName=$(convert_resource_name "$resourceFile")
+ local outputFile="$TARGET_DIR/$(convert_resource_name $filename).c"
+
+ SOURCE_ARRAY+=("$TARGET_DIR/$(convert_resource_name $filename).c")
+
+ local script
+ local isText=$(array_contains $extension "${TEXT_FILTERS[@]}")
+ if [ "1" == "$isText" ]; then
+ script=$TEXT_TO_RES
+ fi
+
+ local isBinary=$(array_contains $extension "${BINARY_FILTERS[@]}")
+ if [ "1" == "$isBinary" ]; then
+ script=$BIN_TO_RES
+ fi
+
+ local outputFileTmp="$TARGET_DIR/$(convert_resource_name $filename).c"
+ perl "$script" "$RESOURCE_TYPE" "$resourceName" "$resourceFile" > "$outputFileTmp"
+ else
+ error "Listed resource $resourceFile does not exist"
+ fi
+ done
+}
+
+#
+# Remove stale files from previous run
+#
+cleanStale() {
+ local staleList=($(find $TARGET_DIR -name "*.c"))
+ local resourceList=($(<$1))
+ local fileFound=0
+
+ for ((j = 0; j < ${#staleList[@]}; j++)); do
+ for ((i = 0; i < ${#resourceList[@]}; i++)); do
+ local file="${resourceList[$i]}"
+ local filename="${file##*/}"
+ local outputFile="$TARGET_DIR/$(convert_resource_name $filename).c"
+
+ if [[ $(basename $outputFile) == $(basename "${staleList[$j]}") ]]; then
+ fileFound=1
+ fi
+ done
+ if [[ $fileFound == 0 ]]; then
+ rm -rf "${staleList[$j]}"
+ fi
+ fileFound=0
+ done
+}
+
+#
+# Call the perl script that creates resources.h
+#
+generateResourceHeader() {
+ perl "$RECIPE_DIR/resources_header.pl" ${SOURCE_ARRAY[*]} > "$RES_FILE"
+}
+
+#######################################################################################################################
+
+#
+# Clean files from previous run that aren't in the current list
+#
+cleanStale $RESOURCE_FILE
+
+#
+# Process all the resources in the cyrsc file
+#
+processResources $RESOURCE_FILE
+
+#
+# Create the resource header
+#
+generateResourceHeader
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/memcalc.bash b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/memcalc.bash
new file mode 100644
index 0000000000000000000000000000000000000000..47dac7b5554782904b3ccd39d544f49d50c29f88
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/memcalc.bash
@@ -0,0 +1,78 @@
+#!/bin/bash
+(set -o igncr) 2>/dev/null && set -o igncr; # this comment is required
+set -$-ue${DEBUG+xv}
+
+#######################################################################################################################
+# This script processes the memory consumption of an application and prints it out to the console.
+#
+# usage:
+# memcalc.bash
+#
+#######################################################################################################################
+
+READELFFILE=$1 # file location of readelf output
+AVAILABLEFLASH=$2 # Max available internal flash
+AVAILABLESRAM=$3 # Max available internal SRAM
+STARTFLASH=$4 # Start of internal flash
+STARTSRAM=$5 # Start of internal SRAM
+
+ENDFLASH=$((STARTFLASH + AVAILABLEFLASH))
+ENDSRAM=$((STARTSRAM + AVAILABLESRAM))
+
+# Gather the numbers
+memcalc() {
+ local internalFlash=0
+ local internalSram=0
+
+ printf " -------------------------------------------------- \n"
+ printf " | %-20s | %-10s | %-8s | \n" 'Section Name' 'Address' 'Size'
+ printf " -------------------------------------------------- \n"
+
+ while IFS=$' \t\n\r' read -r line; do
+ local lineArray=($line)
+ local numElem=${#lineArray[@]}
+
+ # Only look at potentially valid lines
+ if [[ $numElem -ge 6 ]]; then
+ # Section headers
+ if [[ ${lineArray[0]} == "["* ]]; then
+ local sectionElement=NULL
+ local addrElement=00000000
+ local sizeElement=000000
+ for (( idx = 0 ; idx <= $numElem-4 ; idx = $idx+1 ));
+ do
+ if [[ ${lineArray[$idx]} == *"]" ]]; then
+ sectionElement=${lineArray[$idx+1]}
+ fi
+ # Look for regions with SHF_ALLOC = A
+ if [[ ${#lineArray[idx]} -eq 8 ]] && [[ ${#lineArray[idx+1]} -eq 6 ]] && [[ ${#lineArray[idx+2]} -eq 6 ]] \
+ && [[ ${lineArray[$idx+4]} == *"A"* ]] ; then
+ addrElement=${lineArray[$idx]}
+ sizeElement=${lineArray[$idx+2]}
+ fi
+ done
+ # Only consider non-zero size sections
+ if [[ $addrElement != "00000000" ]]; then
+ printf " | %-20s | 0x%-10s | %-8s | \n" $sectionElement $addrElement $((16#$sizeElement))
+ # Use the section headers for SRAM tally
+ if [[ "0x$addrElement" -ge "$STARTSRAM" ]] && [[ "0x$addrElement" -lt "$ENDSRAM" ]]; then
+ internalSram=$((internalSram+$((16#$sizeElement))))
+ fi
+ fi
+ # Program headers
+ elif [[ ${lineArray[1]} == "0x"* ]] && [[ ${lineArray[2]} == "0x"* ]] && [[ ${lineArray[3]} == "0x"* ]] && [[ ${lineArray[4]} == "0x"* ]]\
+ && [[ ${lineArray[3]} -ge "$STARTFLASH" ]] && [[ ${lineArray[3]} -lt "$ENDFLASH" ]]; then
+ # Use the program headers for Flash tally
+ internalFlash=$((internalFlash+${lineArray[4]}))
+ fi
+ fi
+ done < "$READELFFILE"
+
+ printf " -------------------------------------------------- \n\n"
+ printf " %-41s %-8s \n" 'Total Internal Flash (Available)' $AVAILABLEFLASH
+ printf " %-41s %-8s \n\n" 'Total Internal Flash (Utilized)' $internalFlash
+ printf " %-41s %-8s \n" 'Total Internal SRAM (Available)' $AVAILABLESRAM
+ printf " %-41s %-8s \n" 'Total Internal SRAM (Utilized)' $internalSram
+}
+
+memcalc
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/resources_header.pl b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/resources_header.pl
new file mode 100644
index 0000000000000000000000000000000000000000..85794778901621e26cea4a5538ed9c7b31f8ff82
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/resources_header.pl
@@ -0,0 +1,83 @@
+#!/usr/bin/perl
+
+#
+# Copyright 2019, Cypress Semiconductor Corporation or a subsidiary of
+# Cypress Semiconductor Corporation. All Rights Reserved.
+#
+# This software, including source code, documentation and related
+# materials ("Software"), is owned by Cypress Semiconductor Corporation
+# or one of its subsidiaries ("Cypress") and is protected by and subject to
+# worldwide patent protection (United States and foreign),
+# United States copyright laws and international treaty provisions.
+# Therefore, you may use this Software only as provided in the license
+# agreement accompanying the software package from which you
+# obtained this Software ("EULA").
+# If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+# non-transferable license to copy, modify, and compile the Software
+# source code solely for use in connection with Cypress's
+# integrated circuit products. Any reproduction, modification, translation,
+# compilation, or representation of this Software except as specified
+# above is prohibited without the express written permission of Cypress.
+#
+# Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+# reserves the right to make changes to the Software without notice. Cypress
+# does not assume any liability arising out of the application or use of the
+# Software or any product or circuit described in the Software. Cypress does
+# not authorize its products for use in any products where a malfunction or
+# failure of the Cypress product may reasonably be expected to result in
+# significant property damage, injury or death ("High Risk Product"). By
+# including Cypress's product in a High Risk Product, the manufacturer
+# of such system or application assumes all risk of such use and in doing
+# so agrees to indemnify Cypress against all liability.
+#
+
+if (! $ARGV[0] )
+{
+ print "Usage ./resources_header.pl ...";
+ exit;
+}
+
+print "/* Auto-generated header file. Do not edit */\n";
+print "\n";
+print "#pragma once\n";
+print "\n";
+print "#include \n";
+print "#include \"cy_abs_resource.h\"\n";
+print "\n";
+print "#ifdef __cplusplus\n";
+print "extern \"C\" {\n";
+print "#endif\n";
+print "\n";
+
+
+my $mem_resources = "";
+my $filesystem_resources = "";
+
+foreach $file (@ARGV)
+{
+ #open the file
+ open INFILE, $file or die "cant open " . $file;
+
+ @file_cont_array = ;
+ close INFILE;
+ $file_cont = join('',@file_cont_array);
+
+ while ( $file_cont =~ m/(const cy_resource_handle_t \S+)/sgi )
+ {
+ $resources .= "extern $1;\n";
+ }
+ while ( $file_cont =~ m/(const uint8_t \S+\[\d+\])/sgi )
+ {
+ $resources .= "extern $1;\n";
+ }
+}
+
+print "\n";
+print "$resources";
+print "\n";
+print "/* @} */\n";
+print "#ifdef __cplusplus\n";
+print "} /*extern \"C\" */\n";
+print "#endif\n";
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/text_to_resource_c.pl b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/text_to_resource_c.pl
new file mode 100644
index 0000000000000000000000000000000000000000..a9115aff83f106a266238a85d53ea5334e38acf2
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/text_to_resource_c.pl
@@ -0,0 +1,132 @@
+#!/usr/bin/perl
+
+#
+# Copyright 2019, Cypress Semiconductor Corporation or a subsidiary of
+# Cypress Semiconductor Corporation. All Rights Reserved.
+#
+# This software, including source code, documentation and related
+# materials ("Software"), is owned by Cypress Semiconductor Corporation
+# or one of its subsidiaries ("Cypress") and is protected by and subject to
+# worldwide patent protection (United States and foreign),
+# United States copyright laws and international treaty provisions.
+# Therefore, you may use this Software only as provided in the license
+# agreement accompanying the software package from which you
+# obtained this Software ("EULA").
+# If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+# non-transferable license to copy, modify, and compile the Software
+# source code solely for use in connection with Cypress's
+# integrated circuit products. Any reproduction, modification, translation,
+# compilation, or representation of this Software except as specified
+# above is prohibited without the express written permission of Cypress.
+#
+# Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+# reserves the right to make changes to the Software without notice. Cypress
+# does not assume any liability arising out of the application or use of the
+# Software or any product or circuit described in the Software. Cypress does
+# not authorize its products for use in any products where a malfunction or
+# failure of the Cypress product may reasonably be expected to result in
+# significant property damage, injury or death ("High Risk Product"). By
+# including Cypress's product in a High Risk Product, the manufacturer
+# of such system or application assumes all risk of such use and in doing
+# so agrees to indemnify Cypress against all liability.
+#
+
+if (! $ARGV[0] )
+{
+ print "Usage ./text_to_resource__c.pl ";
+ exit;
+}
+
+# Print start of output
+my $location = shift @ARGV;
+my $variable_name = shift @ARGV;
+my $original_variable_name = $variable_name;
+my $file = shift @ARGV;
+
+#open the file
+open INFILE, "<:raw", $file or die "cant open " . $file;
+@file_cont_array = ;
+close INFILE;
+$file_cont = join('',@file_cont_array);
+
+
+print "#include \"cy_abs_resource.h\"\n";
+print "\n";
+
+my $pos = 0;
+
+if ( ( $file =~ m/\.html$/sgi ) ||
+ ( $file =~ m/\.txt$/sgi ) )
+{
+ while ( $file_cont =~ s/^(.*?)\r?\n?\\r?\n?(.*)$/$3/sgi )
+ {
+ my $substr = $1;
+ my $variable_suffix = $2;
+ my $nextpos = $-[3];
+
+ print "\n";
+ if ( $location ne "MEM" )
+ {
+ $name = $file;
+ $name=~s/^.+\/(.*?)/$1/;
+ print "const cy_resource_handle_t ${variable_name} = { CY_RESOURCE_IN_FILESYSTEM, " . (length( $substr )) . ", { .fs = { $pos, \"$name\" }}};\n";
+ print "\n";
+ }
+ else
+ {
+ print "const uint8_t ${variable_name}_data[" . (length( $substr )+1) . "] = ";
+ my $section_length = length( $substr );
+ while ( $substr =~ s/^(.*?\n)(.*)$/$2/sgi )
+ {
+ print "\"" . escape_string( $1 ) . "\" \\\n";
+ }
+ print "\"" . escape_string( $substr ) . "\";\n";
+
+ print "const cy_resource_handle_t ${variable_name} = { CY_RESOURCE_IN_MEMORY, $section_length, { .mem_data = ${variable_name}_data}};";
+ print "\n";
+ }
+
+ $variable_name = $original_variable_name . $variable_suffix;
+ $pos += $nextpos;
+ }
+}
+
+if ( $location ne "MEM" )
+{
+ print "\n";
+ $name = $file;
+ $name=~s/^.+\/(.*?)/$1/;
+ print "const cy_resource_handle_t ${variable_name} = { CY_RESOURCE_IN_FILESYSTEM, " . (length( $file_cont )) . ", { .fs = { $pos, \"$name\" }}};\n";
+ print "\n";
+}
+else
+{
+ print "const uint8_t ${variable_name}_data[" . (length( $file_cont ) + 1) . "] = ";
+ my $section_length = length( $file_cont );
+ while ( $file_cont =~ s/^(.*?\n)(.*)$/$2/sgi )
+ {
+ print "\"" . escape_string( $1 ) . "\" \\\n";
+ }
+ print "\"" . escape_string( $file_cont ) . "\";\n";
+ print "const cy_resource_handle_t ${variable_name} = { CY_RESOURCE_IN_MEMORY, $section_length, { .mem_data = ${variable_name}_data }};";
+ print "\n";
+}
+
+sub escape_string( $escstring )
+{
+ my $escstring = shift;
+ # Escape characters for C string
+ $escstring =~ s/\\/\\\\/sgi; # backslash
+ $escstring =~ s/\a/\\a/sgi; # bell
+ $escstring =~ s/\x8/\\b/sgi; # backspace
+ $escstring =~ s/\f/\\f/sgi; # formfeed
+ $escstring =~ s/\n/\\n/sgi; # linefeed
+ $escstring =~ s/\r/\\r/sgi; # carriage return
+ $escstring =~ s/\t/\\t/sgi; # tab
+ $escstring =~ s/\xB/\\v/sgi; # vertical tab
+ $escstring =~ s/\'/\\'/sgi; # single quote
+ $escstring =~ s/\"/\\"/sgi; # double quote
+ return $escstring;
+}
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/c_cpp_properties_GCC_ARM.json b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/c_cpp_properties_GCC_ARM.json
new file mode 100644
index 0000000000000000000000000000000000000000..3d2d96fd937e31bca4be837fa692028d93b252d5
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/c_cpp_properties_GCC_ARM.json
@@ -0,0 +1,71 @@
+{
+ "configurations": [
+ {
+ "name": "Win32",
+ "includePath": [
+ &&JSONINCLUDELIST&&
+ "&&MODUSTOOLCHAIN&&/lib/gcc/arm-none-eabi/&&MODUSTOOLCHAINVERSION&&/include",
+ "&&MODUSTOOLCHAIN&&/lib/gcc/arm-none-eabi/&&MODUSTOOLCHAINVERSION&&/include-fixed",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&/arm-none-eabi/thumb/v7e-m/fpv4-sp/hard",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&/backward"
+ ],
+ "browse": {
+ "path": [
+ &&JSONINCLUDELIST&&
+ "&&MODUSTOOLCHAIN&&/lib/gcc/arm-none-eabi/&&MODUSTOOLCHAINVERSION&&/include",
+ "&&MODUSTOOLCHAIN&&/lib/gcc/arm-none-eabi/&&MODUSTOOLCHAINVERSION&&/include-fixed",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&/arm-none-eabi/thumb/v7e-m/fpv4-sp/hard",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&/backward"
+ ],
+ "limitSymbolsToIncludedHeaders": true,
+ "databaseFilename": ""
+ },
+ "defines": [
+ &&JSONDEFINELIST&&
+ "EMPTY_ENTRY"
+ ],
+ "intelliSenseMode": "clang-x64",
+ "compilerPath": "&&MODUSTOOLCHAIN&&/bin/arm-none-eabi-gcc.exe -mcpu=cortex-m4 -mthumb -mfloat-abi=soft",
+ "cStandard": "c99",
+ "cppStandard": "c++11"
+ },
+ {
+ "name": "macOS",
+ "includePath": [
+ &&JSONINCLUDELIST&&
+ "&&MODUSTOOLCHAIN&&/lib/gcc/arm-none-eabi/&&MODUSTOOLCHAINVERSION&&/include",
+ "&&MODUSTOOLCHAIN&&/lib/gcc/arm-none-eabi/&&MODUSTOOLCHAINVERSION&&/include-fixed",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&/arm-none-eabi/thumb/v7e-m/fpv4-sp/hard",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&/backward"
+ ],
+ "browse": {
+ "path": [
+ &&JSONINCLUDELIST&&
+ "&&MODUSTOOLCHAIN&&/lib/gcc/arm-none-eabi/&&MODUSTOOLCHAINVERSION&&/include",
+ "&&MODUSTOOLCHAIN&&/lib/gcc/arm-none-eabi/&&MODUSTOOLCHAINVERSION&&/include-fixed",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&/arm-none-eabi/thumb/v7e-m/fpv4-sp/hard",
+ "&&MODUSTOOLCHAIN&&/arm-none-eabi/include/c++/&&MODUSTOOLCHAINVERSION&&/backward"
+ ],
+ "limitSymbolsToIncludedHeaders": true,
+ "databaseFilename": ""
+ },
+ "defines": [
+ &&JSONDEFINELIST&&
+ "EMPTY_ENTRY"
+ ],
+ "intelliSenseMode": "clang-x64",
+ "compilerPath": "&&MODUSTOOLCHAIN&&/bin/arm-none-eabi-gcc.exe -mcpu=cortex-m4 -mthumb -mfloat-abi=soft",
+ "cStandard": "c99",
+ "cppStandard": "c++11"
+ }
+ ],
+ "version": 4
+}
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/launch.json b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/launch.json
new file mode 100644
index 0000000000000000000000000000000000000000..4ad1e853d71a3c69ca2ee31b9505df1ad5bff29b
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/launch.json
@@ -0,0 +1,138 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Launch PSoC6 CM4 (OpenOCD)",
+ "type": "cortex-debug",
+ "request": "launch",
+ "cwd": "${workspaceRoot}",
+ "executable": "&&DEBUGTARGET&&",
+ "servertype": "openocd",
+ "searchDir": [
+ "${workspaceRoot}",
+ "&&MODUSOPENCOD&&/scripts/"
+ ],
+ "configFiles": [
+ "openocd.tcl"
+ ],
+ "overrideLaunchCommands": [
+ "set mem inaccessible-by-default off",
+ "-enable-pretty-printing",
+ "monitor reset init",
+ "-target-download", // Comment this out if you don't want to reload program
+ "monitor reset run",
+ "monitor sleep 200",
+ "monitor psoc6 reset_halt sysresetreq"
+ ],
+ "postStartSessionCommands": [ // Needed if runToMain is false
+ /*
+ // Following two commands are needed to get gdb and openocd and HW all in sync.
+ // Or, execution context (PC, stack, registers, etc.) look like they are from before reset.
+ // The stepi, is a pretend instruction that does not actually do a stepi, but MUST be done
+ // Its a documented workaround in openocd. Do a 'monitor help' to see more info
+ //
+ // An alternative command to use is "continue" instead of the following two
+ */
+ "monitor gdb_sync",
+ "stepi"
+ ],
+ "overrideRestartCommands": [
+ "monitor reset init",
+ "monitor reset run",
+ "monitor sleep 200",
+ "monitor psoc6 reset_halt sysresetreq"
+ ],
+ "postRestartSessionCommands": [
+ "monitor gdb_sync",
+ "stepi"
+ ],
+ // svdFile is optional, it can be very large.
+ "svdFile": "&&SVDFILENAME&&",
+ "runToMain": true, // if true, program will halt at main. Not used for a restart
+ "preLaunchTask": "", // Set this to run a task from tasks.json before starting a debug session
+ "showDevDebugOutput": false,// Shows output of GDB, helpful when something is not working right
+ },
+ // When using 'attach', make sure your program is running on the board and that your executable matches
+ // the image in the chip exactly, or else strange things can happen with breakpoint, variables, etc.
+ {
+ "name": "Attach PSoC6 CM4 (OpenOCD)",
+ "type": "cortex-debug",
+ "request": "attach",
+ "cwd": "${workspaceRoot}",
+ "executable": "&&DEBUGTARGET&&",
+ "servertype": "openocd",
+ "searchDir": [
+ "${workspaceRoot}",
+ "&&MODUSOPENCOD&&/scripts/"
+ ],
+ "openOCDPreConfigLaunchCommands": [
+ "set ENABLE_ACQUIRE 0"
+ ],
+ "configFiles": [
+ "openocd.tcl"
+ ],
+ "overrideAttachCommands": [
+ "set mem inaccessible-by-default off",
+ "-enable-pretty-printing",
+ "monitor halt"
+ ],
+ "overrideRestartCommands": [
+ "monitor reset init",
+ "monitor reset run",
+ "monitor sleep 200",
+ "monitor psoc6 reset_halt sysresetreq"
+ ],
+ "postRestartSessionCommands": [
+ "monitor gdb_sync",
+ "stepi"
+ ],
+ // svdFile is optional, it can be very large.
+ "svdFile": "&&SVDFILENAME&&",
+ "showDevDebugOutput": false,// Shows output of GDB, helpful when something is not working right
+ },
+ {
+ "name": "Erase (OpenOCD)",
+ "type": "cortex-debug",
+ "request": "launch",
+ "cwd": "${workspaceRoot}",
+ "executable": "&&DEBUGTARGET&&",
+ "servertype": "openocd",
+ "searchDir": [
+ "${workspaceRoot}",
+ "&&MODUSOPENCOD&&/scripts/"
+ ],
+ "configFiles": [
+ "openocd.tcl"
+ ],
+ "overrideLaunchCommands": [
+ "monitor reset init",
+ "monitor psoc6 sflash_restrictions 1",
+ "monitor erase_all",
+ "-gdb-exit"
+ ]
+ },
+ {
+ "name": "Program (OpenOCD)",
+ "type": "cortex-debug",
+ "request": "launch",
+ "cwd": "${workspaceRoot}",
+ "executable": "&&DEBUGTARGET&&",
+ "servertype": "openocd",
+ "searchDir": [
+ "${workspaceRoot}",
+ "&&MODUSOPENCOD&&/scripts/"
+ ],
+ "configFiles": [
+ "openocd.tcl"
+ ],
+ "overrideLaunchCommands": [
+ "monitor psoc6 sflash_restrictions 1",
+ "monitor program {&&DEBUGTARGET&&}",
+ "monitor reset_config srst_only",
+ "monitor reset run",
+ "monitor psoc6.dap dpreg 0x04 0x00",
+ "-gdb-exit"
+ ],
+ }
+ ]
+}
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/openocd.tcl b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/openocd.tcl
new file mode 100644
index 0000000000000000000000000000000000000000..142b1bbd35fdcdcb8322a9ea09c1d671f4b73d60
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/openocd.tcl
@@ -0,0 +1,4 @@
+source [find interface/kitprog3.cfg]
+source [find target/&&OPENOCDFILE&&]
+${TARGET}.cm0 configure -gdb-port disabled
+${TARGET}.cm4 configure -rtos auto -rtos-wipe-on-reset-halt 1
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/settings.json b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/settings.json
new file mode 100644
index 0000000000000000000000000000000000000000..d612b0c4c3197aea61489fef9fa219dbedadbd56
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "cortex-debug.armToolchainPath": "&&MODUSTOOLCHAIN&&/bin",
+ "cortex-debug.openocdPath": "&&MODUSOPENCOD&&/bin/openocd",
+ "cortex-debug.JLinkGDBServerPath": "",
+}
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/tasks.json b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/tasks.json
new file mode 100644
index 0000000000000000000000000000000000000000..034adfefc03dd5e2ae3edb5b001f4dedfe6b6274
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/scripts/vscode/tasks.json
@@ -0,0 +1,325 @@
+{
+ // See https://go.microsoft.com/fwlink/?LinkId=733558
+ // for the documentation about the tasks.json format
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "GetLibs",
+ "type": "shell",
+ "windows" : {
+ "command": "&&MODUSSHELL&&/bin/bash.exe" ,
+ "args": [
+ "--norc",
+ "-c",
+ "export PATH=/bin:/usr/bin ; &&MODUSSHELL&&/bin/make.exe getlibs"
+ ]
+ },
+ "linux" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make getlibs"
+ ]
+ },
+ "osx" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make getlibs"
+ ]
+ },
+ "problemMatcher": []
+ },
+ {
+ "label": "Refresh",
+ "type": "shell",
+ "windows" : {
+ "command": "&&MODUSSHELL&&/bin/bash.exe" ,
+ "args": [
+ "--norc",
+ "-c",
+ "export PATH=/bin:/usr/bin ; &&MODUSSHELL&&/bin/make.exe vscode"
+ ]
+ },
+ "linux" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make vscode"
+ ]
+ },
+ "osx" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make vscode"
+ ]
+ },
+ "problemMatcher": []
+ },
+ {
+ "label": "Build Debug",
+ "type": "shell",
+
+ "windows" : {
+ "command": "&&MODUSSHELL&&/bin/bash.exe" ,
+ "args": [
+ "--norc",
+ "-c",
+ "export PATH=/bin:/usr/bin ; &&MODUSSHELL&&/bin/make.exe -j CONFIG=Debug build"
+ ]
+ },
+ "linux" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Debug build"
+ ]
+ },
+ "osx" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Debug build"
+ ]
+ },
+ "problemMatcher": "$gcc",
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ },
+ {
+ "label": "Rebuild Debug",
+ "type": "shell",
+
+ "windows" : {
+ "command": "&&MODUSSHELL&&/bin/bash.exe" ,
+ "args": [
+ "--norc",
+ "-c",
+ "export PATH=/bin:/usr/bin ; &&MODUSSHELL&&/bin/make.exe -j CONFIG=Debug clean ; &&MODUSSHELL&&/bin/make.exe -j CONFIG=Debug build"
+ ]
+ },
+ "linux" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Debug clean ; make -j CONFIG=Debug build"
+ ]
+ },
+ "osx" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Debug clean ; make -j CONFIG=Debug build"
+ ]
+ },
+ "problemMatcher": "$gcc",
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ },
+ {
+ "label": "Clean Debug",
+ "type": "shell",
+
+ "windows" : {
+ "command": "&&MODUSSHELL&&/bin/bash.exe" ,
+ "args": [
+ "--norc",
+ "-c",
+ "export PATH=/bin:/usr/bin ; &&MODUSSHELL&&/bin/make.exe -j CONFIG=Debug clean"
+ ]
+ },
+ "linux" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Debug clean"
+ ]
+ },
+ "osx" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Debug clean"
+ ]
+ },
+ "problemMatcher": "$gcc",
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ },
+ {
+ "label": "Build Release",
+ "type": "shell",
+ "windows" : {
+ "command": "&&MODUSSHELL&&/bin/bash.exe" ,
+ "args": [
+ "--norc",
+ "-c",
+ "export PATH=/bin:/usr/bin ; &&MODUSSHELL&&/bin/make.exe -j CONFIG=Release build"
+ ]
+ },
+ "linux" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Release build"
+ ]
+ },
+ "osx" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Release build"
+ ]
+ },
+ "problemMatcher": "$gcc",
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ },
+ {
+ "label": "Rebuild Release",
+ "type": "shell",
+ "windows" : {
+ "command": "&&MODUSSHELL&&/bin/bash.exe" ,
+ "args": [
+ "--norc",
+ "-c",
+ "export PATH=/bin:/usr/bin ; &&MODUSSHELL&&/bin/make.exe -j CONFIG=Release clean ; &&MODUSSHELL&&/bin/make.exe -j CONFIG=Release build"
+ ]
+ },
+ "linux" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Release clean ; make -j CONFIG=Release build"
+ ]
+ },
+ "osx" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Release clean ; make -j CONFIG=Release build"
+ ]
+ },
+ "problemMatcher": "$gcc",
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ },
+ {
+ "label": "Clean Release",
+ "type": "shell",
+ "windows" : {
+ "command": "&&MODUSSHELL&&/bin/bash.exe" ,
+ "args": [
+ "--norc",
+ "-c",
+ "export PATH=/bin:/usr/bin ; &&MODUSSHELL&&/bin/make.exe -j CONFIG=Release clean"
+ ]
+ },
+ "linux" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Release clean"
+ ]
+ },
+ "osx" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make -j CONFIG=Release clean"
+ ]
+ },
+ "problemMatcher": "$gcc",
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ },
+ {
+ "label": "Base Configurator",
+ "type": "shell",
+ "windows" : {
+ "command": "&&MODUSSHELL&&/bin/bash.exe" ,
+ "args": [
+ "--norc",
+ "-c",
+ "export PATH=/bin:/usr/bin ; &&MODUSSHELL&&/bin/make.exe config"
+ ]
+ },
+ "linux" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make config"
+ ]
+ },
+ "osx" : {
+ "command": "bash",
+ "args": [
+ "--norc",
+ "-c",
+ "make config"
+ ]
+ },
+ "problemMatcher": "$gcc"
+ },
+ {
+ "label": "Library Manager",
+ "type": "shell",
+ "windows" : {
+ "command": "&&MODUSLIBMANAGER&&/library-manager.exe",
+ "args" : [
+ "-d",
+ "${workspaceRoot}"
+ ]
+ },
+ "linux" : {
+ "command": "&&MODUSLIBMANAGER&&/library-manager",
+ "args" : [
+ "-d",
+ "${workspaceRoot}"
+ ]
+ },
+ "osx" : {
+ "command": "&&MODUSLIBMANAGER&&/library-manager -d ${workspaceRoot}",
+ "args" : [
+ "-d",
+ "${workspaceRoot}"
+ ]
+ },
+ "problemMatcher": "$gcc",
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ }
+ ]
+}
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/ARM.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/ARM.mk
new file mode 100644
index 0000000000000000000000000000000000000000..7a2e9c2981f6123d16497cded0b9b9dd8a4caf97
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/ARM.mk
@@ -0,0 +1,168 @@
+###############################################################################
+# \file ARM.mk
+# \version 1.0
+#
+# \brief
+# ARM Compiler (Clang) toolchain configuration.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+#
+# The base path to the ARM Compiler (Clang) cross compilation executables
+#
+ifeq ($(CY_COMPILER_PATH),)
+CY_CROSSPATH=$(CY_COMPILER_ARM_DIR)/bin
+else
+CY_CROSSPATH=$(CY_COMPILER_PATH)/bin
+endif
+
+#
+# Build tools
+#
+CC=$(CY_CROSSPATH)/armclang
+CXX=$(CC)
+AS=$(CY_CROSSPATH)/armasm
+AR=$(CY_CROSSPATH)/armar
+LD=$(CY_CROSSPATH)/armlink
+
+#
+# DEBUG/NDEBUG selection
+#
+ifeq ($(CONFIG),Debug)
+CY_TOOLCHAIN_DEBUG_FLAG=-DDEBUG
+CY_TOOLCHAIN_OPTIMIZATION=-O1
+else
+ifeq ($(CONFIG),Release)
+CY_TOOLCHAIN_DEBUG_FLAG=-DNDEBUG
+CY_TOOLCHAIN_OPTIMIZATION=-Oz
+else
+CY_TOOLCHAIN_DEBUG_FLAG=
+CY_TOOLCHAIN_OPTIMIZATION=
+endif
+endif
+
+#
+# Flags common to compile and link
+#
+CY_TOOLCHAIN_COMMON_FLAGS=--target=arm-arm-none-eabi
+
+#
+# CPU core specifics
+#
+ifeq ($(CORE),CM0P)
+CY_TOOLCHAIN_CFLAGS_CORE=-mcpu=cortex-m0plus
+CY_TOOLCHAIN_FLAGS_CORE=--cpu=Cortex-M0plus
+CY_TOOLCHAIN_VFP_FLAGS=
+else
+CY_TOOLCHAIN_CFLAGS_CORE=-mcpu=cortex-m4
+CY_TOOLCHAIN_FLAGS_CORE=--cpu=Cortex-M4
+ifeq ($(VFP_SELECT),hardfp)
+CY_TOOLCHAIN_VFP_CFLAGS=-mfloat-abi=hard -mfpu=fpv4-sp-d16
+CY_TOOLCHAIN_VFP_FLAGS=--fpu=FPv4-SP
+else
+CY_TOOLCHAIN_VFP_CFLAGS=-mfloat-abi=softfp -mfpu=fpv4-sp-d16
+CY_TOOLCHAIN_VFP_FLAGS=--fpu=SoftVFP+FPv4-SP
+endif
+endif
+
+#
+# Command line flags for c-files
+#
+CY_TOOLCHAIN_CFLAGS=\
+ -c\
+ $(CY_TOOLCHAIN_CFLAGS_CORE)\
+ $(CY_TOOLCHAIN_OPTIMIZATION)\
+ $(CY_TOOLCHAIN_VFP_CFLAGS)\
+ $(CY_TOOLCHAIN_COMMON_FLAGS)\
+ -g\
+ -fshort-enums\
+ -fshort-wchar
+
+#
+# Command line flags for cpp-files
+#
+CY_TOOLCHAIN_CXXFLAGS=$(CY_TOOLCHAIN_CFLAGS)
+
+#
+# Command line flags for s-files
+#
+CY_TOOLCHAIN_ASFLAGS=\
+ $(CY_TOOLCHAIN_FLAGS_CORE)\
+ $(CY_TOOLCHAIN_VFP_FLAGS)
+
+#
+# Command line flags for linking
+#
+CY_TOOLCHAIN_LDFLAGS=\
+ $(CY_TOOLCHAIN_FLAGS_CORE)\
+ $(CY_TOOLCHAIN_VFP_FLAGS)\
+ --info=totals\
+ --stdlib=libc++
+
+#
+# Command line flags for archiving
+#
+CY_TOOLCHAIN_ARFLAGS=-rvs
+
+#
+# Toolchain-specific suffixes
+#
+CY_TOOLCHAIN_SUFFIX_S=S
+CY_TOOLCHAIN_SUFFIX_s=s
+CY_TOOLCHAIN_SUFFIX_C=c
+CY_TOOLCHAIN_SUFFIX_H=h
+CY_TOOLCHAIN_SUFFIX_CPP=cpp
+CY_TOOLCHAIN_SUFFIX_HPP=hpp
+CY_TOOLCHAIN_SUFFIX_O=o
+CY_TOOLCHAIN_SUFFIX_A=ar
+CY_TOOLCHAIN_SUFFIX_D=d
+CY_TOOLCHAIN_SUFFIX_LS=sct
+CY_TOOLCHAIN_SUFFIX_MAP=map
+CY_TOOLCHAIN_SUFFIX_TARGET=elf
+CY_TOOLCHAIN_SUFFIX_ARCHIVE=ar
+
+#
+# Toolchain specific flags
+#
+CY_TOOLCHAIN_OUTPUT_OPTION=-o
+CY_TOOLCHAIN_MAPFILE=--map --list
+CY_TOOLCHAIN_LSFLAGS=--scatter
+CY_TOOLCHAIN_INCRSPFILE=@
+CY_TOOLCHAIN_INCRSPFILE_ASM=--via
+CY_TOOLCHAIN_OBJRSPFILE=--via
+
+#
+# Produce a makefile dependency rule for each input file
+#
+CY_TOOLCHAIN_DEPENDENCIES=-MMD -MP -MF "$(subst .$(CY_TOOLCHAIN_SUFFIX_O),.$(CY_TOOLCHAIN_SUFFIX_D),$@)" -MT "$@"
+
+#
+# Additional includes in the compilation process based on this
+# toolchain
+#
+CY_TOOLCHAIN_INCLUDES=
+
+#
+# Additional libraries in the link process based on this toolchain
+#
+CY_TOOLCHAIN_DEFINES=
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/A_Clang.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/A_Clang.mk
new file mode 100644
index 0000000000000000000000000000000000000000..45bd0cc294f76549599f507c3c755d19bd3dc38d
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/A_Clang.mk
@@ -0,0 +1,218 @@
+################################################################################
+# \file AppleClang.mk
+# \version 1.0
+#
+# \brief
+# Apple Clang toolchain configuration
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+#
+# The base path to the Clang cross compilation executables
+#
+ifeq ($(CY_COMPILER_PATH),)
+CY_CROSSPATH=$(CY_COMPILER_A_Clang_DIR)
+else
+CY_CROSSPATH=$(CY_COMPILER_PATH)
+endif
+
+#
+# Build tools
+#
+CC=clang
+CXX=$(CC)
+AS=$(CC)
+AR=libtool
+LD=ld
+
+#
+# DEBUG/NDEBUG selection
+#
+ifeq ($(CONFIG),Debug)
+CY_TOOLCHAIN_DEBUG_FLAG=-DDEBUG
+CY_TOOLCHAIN_OPTIMIZATION=-Og
+else ifeq ($(CONFIG),Release)
+CY_TOOLCHAIN_DEBUG_FLAG=-DNDEBUG
+CY_TOOLCHAIN_OPTIMIZATION=-Os
+else
+CY_TOOLCHAIN_DEBUG_FLAG=
+CY_TOOLCHAIN_OPTIMIZATION=
+endif
+
+#
+# Flags common to compile and link
+#
+CY_TOOLCHAIN_COMMON_FLAGS=\
+ -mthumb\
+ -ffunction-sections\
+ -fdata-sections\
+ -g\
+ -Wall
+
+#
+# CPU core specifics
+#
+ifeq ($(CORE),CM0P)
+CY_TOOLCHAIN_FLAGS_CORE=\
+ -arch armv6m\
+ -mcpu=cortex-m0plus\
+ --target=arm-none-macho
+CY_TOOLCHAIN_LDFLAGS_CORE=\
+ -arch armv6m\
+ -lclang_rt.soft_static
+CY_TOOLCHAIN_VFP_FLAGS=
+else
+ifeq ($(VFP_SELECT),hardfp)
+CY_TOOLCHAIN_LD_VFP_FLAGS=-lclang_rt.hard_static
+CY_TOOLCHAIN_VFP_FLAGS=-mfloat-abi=hard -mfpu=fpv4-sp-d16
+else
+CY_TOOLCHAIN_LD_VFP_FLAGS=-lclang_rt.soft_static
+CY_TOOLCHAIN_VFP_FLAGS=-mfloat-abi=softfp -mfpu=fpv4-sp-d16
+endif # ($(VFP_SELECT),hardfp)
+CY_TOOLCHAIN_FLAGS_CORE=\
+ -arch armv7em\
+ -mcpu=cortex-m4\
+ --target=armv7m-none-macho
+CY_TOOLCHAIN_LDFLAGS_CORE=\
+ -arch armv7em\
+ $(CY_TOOLCHAIN_LD_VFP_FLAGS)
+endif # ($(CORE),CM0P)
+
+#
+# Command line flags for c-files
+#
+CY_TOOLCHAIN_CFLAGS=\
+ -c\
+ $(CY_TOOLCHAIN_FLAGS_CORE)\
+ $(CY_TOOLCHAIN_OPTIMIZATION)\
+ $(CY_TOOLCHAIN_VFP_FLAGS)\
+ $(CY_TOOLCHAIN_COMMON_FLAGS)\
+ --no-standard-includes\
+ -fasm-blocks\
+ -integrated-as\
+ -Wall\
+ -Wno-int-to-pointer-cast\
+ -static\
+ -fno-stack-protector\
+ -fno-common\
+ -ffreestanding\
+ -mlong-calls
+
+#
+# Command line flags for cpp-files
+#
+CY_TOOLCHAIN_CXXFLAGS=$(CY_TOOLCHAIN_CFLAGS)
+
+#
+# Command line flags for s-files
+#
+CY_TOOLCHAIN_ASFLAGS=\
+ -c\
+ $(CY_TOOLCHAIN_FLAGS_CORE)\
+ $(CY_TOOLCHAIN_COMMON_FLAGS)\
+ -fasm-blocks\
+ -integrated-as\
+ -Wall\
+ -Wno-int-to-pointer-cast\
+ -static\
+ -fno-stack-protector\
+ -fno-common\
+ -ffreestanding\
+ -mlong-calls
+
+#
+# Command line flags for linking
+#
+CY_TOOLCHAIN_LDFLAGS=\
+ $(CY_TOOLCHAIN_LDFLAGS_CORE)\
+ $(CY_TOOLCHAIN_LD_VFP_FLAGS)\
+ -static\
+ -segalign 4\
+ -e Reset_Handler\
+ -merge_zero_fill_sections\
+ -pagezero_size 0\
+ -ios_version_min 4.3\
+ -preload\
+ -v\
+ -read_only_relocs suppress\
+ -dead_strip\
+ -dead_strip_dylibs\
+ -no_branch_islands\
+ -no_zero_fill_sections\
+ -L$(CY_CROSSPATH)/lib/macho_embedded
+
+#
+# Command line flags for archiving
+#
+CY_TOOLCHAIN_ARFLAGS=rvs
+
+#
+# Toolchain-specific suffixes
+#
+CY_TOOLCHAIN_SUFFIX_S=S
+CY_TOOLCHAIN_SUFFIX_s=s
+CY_TOOLCHAIN_SUFFIX_C=c
+CY_TOOLCHAIN_SUFFIX_H=h
+CY_TOOLCHAIN_SUFFIX_CPP=cpp
+CY_TOOLCHAIN_SUFFIX_HPP=hpp
+CY_TOOLCHAIN_SUFFIX_O=o
+CY_TOOLCHAIN_SUFFIX_A=a
+CY_TOOLCHAIN_SUFFIX_D=d
+CY_TOOLCHAIN_SUFFIX_LS=mk
+CY_TOOLCHAIN_SUFFIX_MAP=map
+CY_TOOLCHAIN_SUFFIX_TARGET=mach_o
+CY_TOOLCHAIN_SUFFIX_ARCHIVE=a
+
+#
+# Toolchain specific flags
+#
+CY_TOOLCHAIN_OUTPUT_OPTION=-o
+CY_TOOLCHAIN_MAPFILE=-map
+CY_TOOLCHAIN_LSFLAGS=
+CY_TOOLCHAIN_INCRSPFILE=@
+CY_TOOLCHAIN_INCRSPFILE_ASM=@
+CY_TOOLCHAIN_OBJRSPFILE=-filelist
+
+#
+# Produce a makefile dependency rule for each input file
+#
+CY_TOOLCHAIN_DEPENDENCIES=-MMD -MP -MF "$(subst .$(CY_TOOLCHAIN_SUFFIX_O),.$(CY_TOOLCHAIN_SUFFIX_D),$@)" -MT "$@"
+
+#
+# Additional includes in the compilation process based on this
+# toolchain
+#
+CY_TOOLCHAIN_INCLUDES=\
+ $(CY_COMPILER_GCC_ARM_DIR)/arm-none-eabi/include\
+ $(CY_COMPILER_GCC_ARM_DIR)/lib/gcc/arm-none-eabi/7.2.1/include\
+ $(CY_COMPILER_GCC_ARM_DIR)/lib/gcc/arm-none-eabi/7.2.1/include-fixed
+
+#
+# Additional libraries in the link process based on this toolchain
+#
+CY_TOOLCHAIN_DEFINES=
+
+#
+# M2BIN tool is used to convert Mach-O to binary
+#
+CY_TOOLCHAIN_M2BIN=$(CY_BASELIB_PATH)/make/scripts/m2bin
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/GCC_ARM.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/GCC_ARM.mk
new file mode 100644
index 0000000000000000000000000000000000000000..52ec8bcaa57562ee02348623a50646b8c292d54b
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/GCC_ARM.mk
@@ -0,0 +1,174 @@
+################################################################################
+# \file GCC_ARM.mk
+# \version 1.0
+#
+# \brief
+# GCC ARM toolchain configuration.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+#
+# The base path to the GCC cross compilation executables
+#
+ifeq ($(CY_COMPILER_PATH),)
+CY_CROSSPATH=$(CY_COMPILER_GCC_ARM_DIR)/bin
+else
+CY_CROSSPATH=$(CY_COMPILER_PATH)/bin
+endif
+
+#
+# Build tools
+#
+CC=$(CY_CROSSPATH)/arm-none-eabi-gcc
+CXX=$(CY_CROSSPATH)/arm-none-eabi-g++
+AS=$(CC)
+AR=$(CY_CROSSPATH)/arm-none-eabi-ar
+LD=$(CXX)
+
+#
+# DEBUG/NDEBUG selection
+#
+ifeq ($(CONFIG),Debug)
+CY_TOOLCHAIN_DEBUG_FLAG=-DDEBUG
+CY_TOOLCHAIN_OPTIMIZATION=-Og
+else ifeq ($(CONFIG),Release)
+CY_TOOLCHAIN_DEBUG_FLAG=-DNDEBUG
+CY_TOOLCHAIN_OPTIMIZATION=-Os
+else
+CY_TOOLCHAIN_DEBUG_FLAG=
+CY_TOOLCHAIN_OPTIMIZATION=
+endif
+
+#
+# Flags common to compile and link
+#
+CY_TOOLCHAIN_COMMON_FLAGS=\
+ -mthumb\
+ -ffunction-sections\
+ -fdata-sections\
+ -ffat-lto-objects\
+ -g\
+ -Wall
+
+#
+# CPU core specifics
+#
+ifeq ($(CORE),CM0P)
+CY_TOOLCHAIN_FLAGS_CORE=-mcpu=cortex-m0plus
+CY_TOOLCHAIN_VFP_FLAGS=
+else
+CY_TOOLCHAIN_FLAGS_CORE=-mcpu=cortex-m4
+ifeq ($(VFP_SELECT),hardfp)
+CY_TOOLCHAIN_VFP_FLAGS=-mfloat-abi=hard -mfpu=fpv4-sp-d16
+else
+CY_TOOLCHAIN_VFP_FLAGS=-mfloat-abi=softfp -mfpu=fpv4-sp-d16
+endif
+endif
+
+#
+# Command line flags for c-files
+#
+CY_TOOLCHAIN_CFLAGS=\
+ -c\
+ $(CY_TOOLCHAIN_FLAGS_CORE)\
+ $(CY_TOOLCHAIN_OPTIMIZATION)\
+ $(CY_TOOLCHAIN_VFP_FLAGS)\
+ $(CY_TOOLCHAIN_COMMON_FLAGS)
+
+#
+# Command line flags for cpp-files
+#
+CY_TOOLCHAIN_CXXFLAGS=\
+ $(CY_TOOLCHAIN_CFLAGS)\
+ -fno-rtti\
+ -fno-exceptions
+
+#
+# Command line flags for s-files
+#
+CY_TOOLCHAIN_ASFLAGS=\
+ -c\
+ $(CY_TOOLCHAIN_FLAGS_CORE)\
+ $(CY_TOOLCHAIN_COMMON_FLAGS)
+
+#
+# Command line flags for linking
+#
+CY_TOOLCHAIN_LDFLAGS=\
+ $(CY_TOOLCHAIN_FLAGS_CORE)\
+ $(CY_TOOLCHAIN_VFP_FLAGS)\
+ $(CY_TOOLCHAIN_COMMON_FLAGS)\
+ --enable-objc-gc\
+ --specs=nano.specs\
+ -Wl,--gc-sections
+
+#
+# Command line flags for archiving
+#
+CY_TOOLCHAIN_ARFLAGS=rvs
+
+#
+# Toolchain-specific suffixes
+#
+CY_TOOLCHAIN_SUFFIX_S=S
+CY_TOOLCHAIN_SUFFIX_s=s
+CY_TOOLCHAIN_SUFFIX_C=c
+CY_TOOLCHAIN_SUFFIX_H=h
+CY_TOOLCHAIN_SUFFIX_CPP=cpp
+CY_TOOLCHAIN_SUFFIX_HPP=hpp
+CY_TOOLCHAIN_SUFFIX_O=o
+CY_TOOLCHAIN_SUFFIX_A=a
+CY_TOOLCHAIN_SUFFIX_D=d
+CY_TOOLCHAIN_SUFFIX_LS=ld
+CY_TOOLCHAIN_SUFFIX_MAP=map
+CY_TOOLCHAIN_SUFFIX_TARGET=elf
+CY_TOOLCHAIN_SUFFIX_ARCHIVE=a
+
+#
+# Toolchain specific flags
+#
+CY_TOOLCHAIN_OUTPUT_OPTION=-o
+CY_TOOLCHAIN_MAPFILE=-Wl,-Map,
+CY_TOOLCHAIN_STARTGROUP=-Wl,--start-group
+CY_TOOLCHAIN_ENDGROUP=-Wl,--end-group
+CY_TOOLCHAIN_LSFLAGS=-T
+CY_TOOLCHAIN_INCRSPFILE=@
+CY_TOOLCHAIN_INCRSPFILE_ASM=@
+CY_TOOLCHAIN_OBJRSPFILE=@
+
+#
+# Produce a makefile dependency rule for each input file
+#
+CY_TOOLCHAIN_DEPENDENCIES=-MMD -MP -MF "$(subst .$(CY_TOOLCHAIN_SUFFIX_O),.$(CY_TOOLCHAIN_SUFFIX_D),$@)" -MT "$@"
+
+#
+# Additional includes in the compilation process based on this
+# toolchain
+#
+CY_TOOLCHAIN_INCLUDES=
+
+#
+# Additional libraries in the link process based on this toolchain
+#
+CY_TOOLCHAIN_DEFINES=
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/IAR.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/IAR.mk
new file mode 100644
index 0000000000000000000000000000000000000000..64c5155ee5c83e1c121a51b3ebd2f4ab462b06dd
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/toolchains/IAR.mk
@@ -0,0 +1,187 @@
+################################################################################
+# \file IAR.mk
+# \version 1.0
+#
+# \brief
+# IAR toolchain configuration.
+#
+################################################################################
+# \copyright
+# Copyright 2018-2019 Cypress Semiconductor Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed 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.
+################################################################################
+
+ifeq ($(WHICHFILE),true)
+$(info Processing $(lastword $(MAKEFILE_LIST)))
+endif
+
+#
+# The base path to the IAR cross compilation executables
+#
+ifeq ($(CY_COMPILER_PATH),)
+CY_CROSSPATH=$(CY_COMPILER_IAR_DIR)/bin
+else
+CY_CROSSPATH=$(CY_COMPILER_PATH)/bin
+endif
+
+#
+# Build tools
+#
+CC=$(CY_CROSSPATH)/iccarm.exe
+CXX=$(CC)
+AS=$(CY_CROSSPATH)/iasmarm.exe
+AR=$(CY_CROSSPATH)/iarchive.exe
+LD=$(CY_CROSSPATH)/ilinkarm.exe
+
+#
+# DEBUG/NDEBUG selection
+#
+ifeq ($(CONFIG),Debug)
+CY_TOOLCHAIN_DEBUG_FLAG=-DDEBUG
+CY_TOOLCHAIN_OPTIMIZATION=-Ol
+else
+ifeq ($(CONFIG),Release)
+CY_TOOLCHAIN_DEBUG_FLAG=-DNDEBUG
+CY_TOOLCHAIN_OPTIMIZATION=-Ohs
+else
+CY_TOOLCHAIN_DEBUG_FLAG=
+CY_TOOLCHAIN_OPTIMIZATION=
+endif
+endif
+
+#
+# Flags common to compile and link
+#
+ifneq ($(VERBOSE),)
+CY_TOOLCHAIN_SILENT_CFLAGS=
+CY_TOOLCHAIN_SILENT_SFLAGS=
+else
+CY_TOOLCHAIN_SILENT_CFLAGS=--silent
+CY_TOOLCHAIN_SILENT_SFLAGS=-S
+endif
+
+#
+# CPU core specifics
+#
+ifeq ($(CORE),CM0P)
+CY_TOOLCHAIN_FLAGS_CORE=--cpu Cortex-M0+
+CY_TOOLCHAIN_VFP_FLAGS=
+else
+CY_TOOLCHAIN_FLAGS_CORE=--cpu Cortex-M4
+CY_TOOLCHAIN_VFP_FLAGS=--fpu FPv4-SP
+ifeq ($(VFP_SELECT),hardfp)
+CY_TOOLCHAIN_VFP_CFLAGS=$(CY_TOOLCHAIN_VFP_FLAGS) --aapcs vfp
+else
+CY_TOOLCHAIN_VFP_CFLAGS=$(CY_TOOLCHAIN_VFP_FLAGS) --aapcs std
+endif
+endif
+
+#
+# Command line flags for c-files
+#
+CY_TOOLCHAIN_CFLAGS=\
+ -c\
+ $(CY_TOOLCHAIN_FLAGS_CORE)\
+ $(CY_TOOLCHAIN_OPTIMIZATION)\
+ $(CY_TOOLCHAIN_VFP_CFLAGS)\
+ $(CY_TOOLCHAIN_SILENT_CFLAGS)\
+ --endian=little\
+ -e\
+ --enable_restrict\
+ --no_wrap_diagnostics
+
+ifeq ($(CONFIG),Debug)
+CY_TOOLCHAIN_CFLAGS+=--debug
+endif
+
+#
+# Command line flags for cpp-files
+#
+CY_TOOLCHAIN_CXXFLAGS=\
+ $(CY_TOOLCHAIN_CFLAGS)\
+ --c++\
+ --no_rtti\
+ --no_exceptions
+
+#
+# Command line flags for s-files
+#
+CY_TOOLCHAIN_ASFLAGS=\
+ -c\
+ $(CY_TOOLCHAIN_FLAGS_CORE)\
+ $(CY_TOOLCHAIN_VFP_FLAGS)\
+ $(CY_TOOLCHAIN_SILENT_SFLAGS)\
+ -s+\
+ -w+\
+ -r
+
+#
+# Command line flags for linking
+#
+CY_TOOLCHAIN_LDFLAGS=\
+ $(CY_TOOLCHAIN_FLAGS_CORE)\
+ $(CY_TOOLCHAIN_VFP_FLAGS)\
+ $(CY_TOOLCHAIN_SILENT_CFLAGS)\
+
+#
+# Command line flags for archiving
+#
+CY_TOOLCHAIN_ARFLAGS=\
+ --create\
+ --verbose
+
+#
+# Toolchain-specific suffixes
+#
+CY_TOOLCHAIN_SUFFIX_S=S
+CY_TOOLCHAIN_SUFFIX_s=s
+CY_TOOLCHAIN_SUFFIX_C=c
+CY_TOOLCHAIN_SUFFIX_H=h
+CY_TOOLCHAIN_SUFFIX_CPP=cpp
+CY_TOOLCHAIN_SUFFIX_HPP=hpp
+CY_TOOLCHAIN_SUFFIX_O=o
+CY_TOOLCHAIN_SUFFIX_A=a
+CY_TOOLCHAIN_SUFFIX_D=d
+CY_TOOLCHAIN_SUFFIX_LS=icf
+CY_TOOLCHAIN_SUFFIX_MAP=map
+CY_TOOLCHAIN_SUFFIX_TARGET=elf
+CY_TOOLCHAIN_SUFFIX_ARCHIVE=a
+
+#
+# Toolchain specific flags
+#
+CY_TOOLCHAIN_OUTPUT_OPTION=-o
+CY_TOOLCHAIN_MAPFILE=--map=
+CY_TOOLCHAIN_LSFLAGS=--config=
+CY_TOOLCHAIN_INCRSPFILE=-f
+CY_TOOLCHAIN_INCRSPFILE_ASM=-f
+CY_TOOLCHAIN_OBJRSPFILE=-f
+
+#
+# Produce a makefile dependency rule for each input file
+#
+CY_TOOLCHAIN_DEPENDENCIES=--dependencies=m "$(subst .$(CY_TOOLCHAIN_SUFFIX_O),.$(CY_TOOLCHAIN_SUFFIX_D),$@)"
+
+#
+# Additional includes in the compilation process based on this
+# toolchain
+#
+CY_TOOLCHAIN_INCLUDES=
+
+#
+# Additional libraries in the link process based on this toolchain
+#
+CY_TOOLCHAIN_DEFINES=
+
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/udd/features.mk b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/udd/features.mk
new file mode 100644
index 0000000000000000000000000000000000000000..d5e95c02870a1a248d8166450aba50235a31b866
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/make/udd/features.mk
@@ -0,0 +1,45 @@
+# This file defines variables for various sets of devices. Each variable is a
+# list of the MPNs that have that capability or feature.
+
+# Major device capabilities.
+CY_DEVICES_WITH_M0P=CY8C6246BZI-D04 CY8C6247BZI-D44 CY8C6247BZI-D34 CY8C6247BZI-D54 CY8C6336BZI-BLD13 CY8C6347BZI-BLD43 CY8C6347BZI-BLD33 CY8C6347BZI-BLD53 CY8C6347FMI-BLD13 CY8C6347FMI-BLD43 CY8C6347FMI-BLD33 CY8C6347FMI-BLD53 CY8C637BZI-MD76 CY8C637BZI-BLD74 CY8C637FMI-BLD73 CY8C68237BZ-BLE CY8C68237FM-BLE CY8C6247FDI-D02 CY8C6247FDI-D32 CY8C6336BZI-BUD13 CY8C6347BZI-BUD43 CY8C6347BZI-BUD33 CY8C6347BZI-BUD53 CY8C6247FDI-D52 CY8C6247FTI-D52 CY8C6247BZI-AUD54 CY8C6336BZI-BLD14 CY8C6347BZI-BLD44 CY8C6347BZI-BLD34 CY8C6347BZI-BLD54 CY8C6247BFI-D54 CYBLE-416045-02 CY8C6347FMI-BUD53 CY8C6347FMI-BUD13 CY8C6347FMI-BUD43 CY8C6347FMI-BUD33 CY8C6247WI-D54 CYB06447BZI-BLD54 CYB06447BZI-BLD53 CYB06447BZI-D54 CY8C6347LQI-BLD52 CY8C624ABZI-D44 CY8C624AAZI-D44 CY8C624AFNI-D43 CY8C624ABZI-D04 CY8C624ABZI-D14 CY8C624AAZI-D14 CY8C6248AZI-D14 CY8C6248BZI-D44 CY8C6248AZI-D44 CY8C6248FNI-D43 CY8C624ALQI-D42 CYB0644ABZI-S2D44 CY8C624ABZI-S2D44A0 CY8C624ABZI-S2D44 CY8C624AAZI-S2D44 CY8C624AFNI-S2D43 CY8C624ABZI-S2D04 CY8C624ABZI-S2D14 CY8C624AAZI-S2D14 CY8C6248AZI-S2D14 CY8C6248BZI-S2D44 CY8C6248AZI-S2D44 CY8C6248FNI-S2D43 CY8C6245AZI-S3D72 CY8C6245LQI-S3D72 CY8C6245FNI-S3D71 CY8C6245AZI-S3D62 CY8C6245LQI-S3D62 CY8C6245AZI-S3D42 CY8C6245LQI-S3D42 CYB06445LQI-S3D42 CY8C6245FNI-S3D41 CY8C6245AZI-S3D12 CY8C6245LQI-S3D12 CY8C6245FNI-S3D11 CY8C6245AZI-S3D02 CY8C6245LQI-S3D02 CY8C6245W-S3D72
+CY_DEVICES_WITH_BLE=CY8C6336BZI-BLF03 CY8C6316BZI-BLF03 CY8C6316BZI-BLF53 CY8C6336BZI-BLD13 CY8C6347BZI-BLD43 CY8C6347BZI-BLD33 CY8C6347BZI-BLD53 CY8C6347FMI-BLD13 CY8C6347FMI-BLD43 CY8C6347FMI-BLD33 CY8C6347FMI-BLD53 CY8C637BZI-BLD74 CY8C637FMI-BLD73 CY8C68237BZ-BLE CY8C68237FM-BLE CY8C6336BZI-BUD13 CY8C6347BZI-BUD43 CY8C6347BZI-BUD33 CY8C6347BZI-BUD53 CY8C6337BZI-BLF13 CY8C6336BZI-BLF04 CY8C6316BZI-BLF04 CY8C6316BZI-BLF54 CY8C6336BZI-BLD14 CY8C6347BZI-BLD44 CY8C6347BZI-BLD34 CY8C6347BZI-BLD54 CYBLE-416045-02 CY8C6347FMI-BUD53 CY8C6347FMI-BUD13 CY8C6347FMI-BUD43 CY8C6347FMI-BUD33 CYB06447BZI-BLD54 CYB06447BZI-BLD53 CY8C6336LQI-BLF02 CY8C6336LQI-BLF42 CY8C6347LQI-BLD52
+CY_DEVICES_WITH_UDBS=CY8C6116BZI-F54 CY8C6136BZI-F34 CY8C6137BZI-F34 CY8C6137BZI-F54 CY8C6117BZI-F34 CY8C6247BZI-D34 CY8C6247BZI-D54 CY8C6316BZI-BLF53 CY8C6347BZI-BLD33 CY8C6347BZI-BLD53 CY8C6347FMI-BLD33 CY8C6347FMI-BLD53 CY8C637BZI-MD76 CY8C637BZI-BLD74 CY8C637FMI-BLD73 CY8C6247FDI-D32 CY8C6347BZI-BUD33 CY8C6347BZI-BUD53 CY8C6247FDI-D52 CY8C6247FTI-D52 CY8C6247BZI-AUD54 CY8C6316BZI-BLF54 CY8C6347BZI-BLD34 CY8C6347BZI-BLD54 CY8C6247BFI-D54 CYBLE-416045-02 CY8C6347FMI-BUD53 CY8C6347FMI-BUD33 CY8C6137WI-F54 CY8C6117WI-F34 CY8C6247WI-D54 CYB06447BZI-BLD54 CYB06447BZI-BLD53 CYB06447BZI-D54 CY8C6347LQI-BLD52
+CY_DEVICES_WITH_FS_USB=CY8C6036BZI-F04 CY8C6016BZI-F04 CY8C6116BZI-F54 CY8C6136BZI-F14 CY8C6136BZI-F34 CY8C6137BZI-F14 CY8C6137BZI-F34 CY8C6137BZI-F54 CY8C6117BZI-F34 CY8C6246BZI-D04 CY8C6247BZI-D44 CY8C6247BZI-D34 CY8C6247BZI-D54 CY8C637BZI-MD76 CY8C6137FDI-F02 CY8C6117FDI-F02 CY8C6247FDI-D02 CY8C6247FDI-D32 CY8C6336BZI-BUD13 CY8C6347BZI-BUD43 CY8C6347BZI-BUD33 CY8C6347BZI-BUD53 CY8C6136FDI-F42 CY8C6247FDI-D52 CY8C6136FTI-F42 CY8C6247FTI-D52 CY8C6247BZI-AUD54 CY8C6336BZI-BLF04 CY8C6316BZI-BLF04 CY8C6316BZI-BLF54 CY8C6336BZI-BLD14 CY8C6347BZI-BLD44 CY8C6347BZI-BLD34 CY8C6347BZI-BLD54 CY8C6247BFI-D54 CY8C6347FMI-BUD53 CY8C6347FMI-BUD13 CY8C6347FMI-BUD43 CY8C6347FMI-BUD33 CY8C6137WI-F54 CY8C6117WI-F34 CY8C6247WI-D54 CYB06447BZI-BLD54 CYB06447BZI-D54 CY8C624ABZI-D44 CY8C624AAZI-D44 CY8C624AFNI-D43 CY8C624ABZI-D04 CY8C624ABZI-D14 CY8C624AAZI-D14 CY8C6248AZI-D14 CY8C6248BZI-D44 CY8C6248AZI-D44 CY8C6248FNI-D43 CY8C624ALQI-D42 CYB0644ABZI-S2D44 CY8C624ABZI-S2D44A0 CY8C624ABZI-S2D44 CY8C624AAZI-S2D44 CY8C624AFNI-S2D43 CY8C624ABZI-S2D04 CY8C624ABZI-S2D14 CY8C624AAZI-S2D14 CY8C6248AZI-S2D14 CY8C6248BZI-S2D44 CY8C6248AZI-S2D44 CY8C6248FNI-S2D43 CY8C6245AZI-S3D72 CY8C6245LQI-S3D72 CY8C6245FNI-S3D71 CY8C6245AZI-S3D62 CY8C6245LQI-S3D62 CY8C6245AZI-S3D42 CY8C6245LQI-S3D42 CYB06445LQI-S3D42 CY8C6245FNI-S3D41 CY8C6245AZI-S3D12 CY8C6245LQI-S3D12 CY8C6245FNI-S3D11 CY8C6245AZI-S3D02 CY8C6245LQI-S3D02 CY8C6245W-S3D72
+CY_DEVICES_WITH_CAPSENSE=CY8C6116BZI-F54 CY8C6136BZI-F14 CY8C6136BZI-F34 CY8C6137BZI-F14 CY8C6137BZI-F34 CY8C6137BZI-F54 CY8C6117BZI-F34 CY8C6247BZI-D44 CY8C6247BZI-D34 CY8C6247BZI-D54 CY8C6316BZI-BLF53 CY8C6336BZI-BLD13 CY8C6347BZI-BLD43 CY8C6347BZI-BLD33 CY8C6347BZI-BLD53 CY8C6347FMI-BLD13 CY8C6347FMI-BLD43 CY8C6347FMI-BLD33 CY8C6347FMI-BLD53 CY8C637BZI-MD76 CY8C637BZI-BLD74 CY8C637FMI-BLD73 CY8C68237BZ-BLE CY8C68237FM-BLE CY8C6247FDI-D32 CY8C6336BZI-BUD13 CY8C6347BZI-BUD43 CY8C6347BZI-BUD33 CY8C6347BZI-BUD53 CY8C6337BZI-BLF13 CY8C6136FDI-F42 CY8C6247FDI-D52 CY8C6136FTI-F42 CY8C6247FTI-D52 CY8C6247BZI-AUD54 CY8C6316BZI-BLF54 CY8C6336BZI-BLD14 CY8C6347BZI-BLD44 CY8C6347BZI-BLD34 CY8C6347BZI-BLD54 CY8C6247BFI-D54 CYBLE-416045-02 CY8C6347FMI-BUD53 CY8C6347FMI-BUD13 CY8C6347FMI-BUD43 CY8C6347FMI-BUD33 CY8C6137WI-F54 CY8C6117WI-F34 CY8C6247WI-D54 CYB06447BZI-BLD54 CYB06447BZI-BLD53 CYB06447BZI-D54 CY8C6336LQI-BLF42 CY8C6347LQI-BLD52 CY8C624ABZI-D44 CY8C624AAZI-D44 CY8C624AFNI-D43 CY8C624ABZI-D14 CY8C624AAZI-D14 CY8C6248AZI-D14 CY8C6248BZI-D44 CY8C6248AZI-D44 CY8C6248FNI-D43 CY8C624ALQI-D42 CYB0644ABZI-S2D44 CY8C624ABZI-S2D44A0 CY8C624ABZI-S2D44 CY8C624AAZI-S2D44 CY8C624AFNI-S2D43 CY8C624ABZI-S2D14 CY8C624AAZI-S2D14 CY8C6248AZI-S2D14 CY8C6248BZI-S2D44 CY8C6248AZI-S2D44 CY8C6248FNI-S2D43 CY8C6245AZI-S3D72 CY8C6245LQI-S3D72 CY8C6245FNI-S3D71 CY8C6245AZI-S3D42 CY8C6245LQI-S3D42 CYB06445LQI-S3D42 CY8C6245FNI-S3D41 CY8C6245AZI-S3D12 CY8C6245LQI-S3D12 CY8C6245FNI-S3D11 CY8C6245W-S3D72
+CY_DEVICES_WITH_CRYPTO=CY8C6116BZI-F54 CY8C6137BZI-F54 CY8C6247BZI-D44 CY8C6247BZI-D54 CY8C6316BZI-BLF53 CY8C6347BZI-BLD43 CY8C6347BZI-BLD53 CY8C6347FMI-BLD43 CY8C6347FMI-BLD53 CY8C637BZI-MD76 CY8C637BZI-BLD74 CY8C637FMI-BLD73 CY8C68237BZ-BLE CY8C68237FM-BLE CY8C6347BZI-BUD43 CY8C6347BZI-BUD53 CY8C6136FDI-F42 CY8C6247FDI-D52 CY8C6136FTI-F42 CY8C6247FTI-D52 CY8C6247BZI-AUD54 CY8C6316BZI-BLF54 CY8C6347BZI-BLD44 CY8C6347BZI-BLD54 CY8C6247BFI-D54 CYBLE-416045-02 CY8C6347FMI-BUD53 CY8C6347FMI-BUD43 CY8C6137WI-F54 CY8C6247WI-D54 CYB06447BZI-BLD54 CYB06447BZI-BLD53 CYB06447BZI-D54 CY8C6336LQI-BLF42 CY8C6347LQI-BLD52 CY8C624ABZI-D44 CY8C624AAZI-D44 CY8C624AFNI-D43 CY8C6248BZI-D44 CY8C6248AZI-D44 CY8C6248FNI-D43 CY8C624ALQI-D42 CYB0644ABZI-S2D44 CY8C624ABZI-S2D44A0 CY8C624ABZI-S2D44 CY8C624AAZI-S2D44 CY8C624AFNI-S2D43 CY8C6248BZI-S2D44 CY8C6248AZI-S2D44 CY8C6248FNI-S2D43 CY8C6245AZI-S3D72 CY8C6245LQI-S3D72 CY8C6245FNI-S3D71 CY8C6245AZI-S3D42 CY8C6245LQI-S3D42 CYB06445LQI-S3D42 CY8C6245FNI-S3D41 CY8C6245W-S3D72
+
+# Different classifications of devices.
+CY_DEVICES_WITH_DIE_PSOC6ABLE2=CY8C6036BZI-F04 CY8C6016BZI-F04 CY8C6116BZI-F54 CY8C6136BZI-F14 CY8C6136BZI-F34 CY8C6137BZI-F14 CY8C6137BZI-F34 CY8C6137BZI-F54 CY8C6117BZI-F34 CY8C6246BZI-D04 CY8C6247BZI-D44 CY8C6247BZI-D34 CY8C6247BZI-D54 CY8C6336BZI-BLF03 CY8C6316BZI-BLF03 CY8C6316BZI-BLF53 CY8C6336BZI-BLD13 CY8C6347BZI-BLD43 CY8C6347BZI-BLD33 CY8C6347BZI-BLD53 CY8C6347FMI-BLD13 CY8C6347FMI-BLD43 CY8C6347FMI-BLD33 CY8C6347FMI-BLD53 CY8C637BZI-MD76 CY8C637BZI-BLD74 CY8C637FMI-BLD73 CY8C68237BZ-BLE CY8C68237FM-BLE CY8C6137FDI-F02 CY8C6117FDI-F02 CY8C6247FDI-D02 CY8C6247FDI-D32 CY8C6336BZI-BUD13 CY8C6347BZI-BUD43 CY8C6347BZI-BUD33 CY8C6347BZI-BUD53 CY8C6337BZI-BLF13 CY8C6136FDI-F42 CY8C6247FDI-D52 CY8C6136FTI-F42 CY8C6247FTI-D52 CY8C6247BZI-AUD54 CY8C6336BZI-BLF04 CY8C6316BZI-BLF04 CY8C6316BZI-BLF54 CY8C6336BZI-BLD14 CY8C6347BZI-BLD44 CY8C6347BZI-BLD34 CY8C6347BZI-BLD54 CY8C6247BFI-D54 CYBLE-416045-02 CY8C6347FMI-BUD53 CY8C6347FMI-BUD13 CY8C6347FMI-BUD43 CY8C6347FMI-BUD33 CY8C6137WI-F54 CY8C6117WI-F34 CY8C6247WI-D54 CYB06447BZI-BLD54 CYB06447BZI-BLD53 CYB06447BZI-D54 CY8C6336LQI-BLF02 CY8C6336LQI-BLF42 CY8C6347LQI-BLD52
+CY_DEVICES_WITH_DIE_PSOC6A2M=CY8C624ABZI-D44 CY8C624AAZI-D44 CY8C624AFNI-D43 CY8C624ABZI-D04 CY8C624ABZI-D14 CY8C624AAZI-D14 CY8C6248AZI-D14 CY8C6248BZI-D44 CY8C6248AZI-D44 CY8C6248FNI-D43 CY8C624ALQI-D42 CYB0644ABZI-S2D44 CY8C624ABZI-S2D44A0 CY8C624ABZI-S2D44 CY8C624AAZI-S2D44 CY8C624AFNI-S2D43 CY8C624ABZI-S2D04 CY8C624ABZI-S2D14 CY8C624AAZI-S2D14 CY8C6248AZI-S2D14 CY8C6248BZI-S2D44 CY8C6248AZI-S2D44 CY8C6248FNI-S2D43
+CY_DEVICES_WITH_DIE_PSOC6A512K=CY8C6245AZI-S3D72 CY8C6245LQI-S3D72 CY8C6245FNI-S3D71 CY8C6245AZI-S3D62 CY8C6245LQI-S3D62 CY8C6245AZI-S3D42 CY8C6245LQI-S3D42 CYB06445LQI-S3D42 CY8C6245FNI-S3D41 CY8C6245AZI-S3D12 CY8C6245LQI-S3D12 CY8C6245FNI-S3D11 CY8C6245AZI-S3D02 CY8C6245LQI-S3D02 CY8C6245W-S3D72
+
+CY_DEVICES_WITH_FLASH_KB_512=CY8C6036BZI-F04 CY8C6016BZI-F04 CY8C6116BZI-F54 CY8C6136BZI-F14 CY8C6136BZI-F34 CY8C6246BZI-D04 CY8C6336BZI-BLF03 CY8C6316BZI-BLF03 CY8C6316BZI-BLF53 CY8C6336BZI-BLD13 CY8C6336BZI-BUD13 CY8C6136FDI-F42 CY8C6136FTI-F42 CY8C6336BZI-BLF04 CY8C6316BZI-BLF04 CY8C6316BZI-BLF54 CY8C6336BZI-BLD14 CY8C6336LQI-BLF02 CY8C6336LQI-BLF42 CY8C6245AZI-S3D72 CY8C6245LQI-S3D72 CY8C6245FNI-S3D71 CY8C6245AZI-S3D62 CY8C6245LQI-S3D62 CY8C6245AZI-S3D42 CY8C6245LQI-S3D42 CYB06445LQI-S3D42 CY8C6245FNI-S3D41 CY8C6245AZI-S3D12 CY8C6245LQI-S3D12 CY8C6245FNI-S3D11 CY8C6245AZI-S3D02 CY8C6245LQI-S3D02 CY8C6245W-S3D72
+CY_DEVICES_WITH_FLASH_KB_1024=CY8C6137BZI-F14 CY8C6137BZI-F34 CY8C6137BZI-F54 CY8C6117BZI-F34 CY8C6247BZI-D44 CY8C6247BZI-D34 CY8C6247BZI-D54 CY8C6347BZI-BLD43 CY8C6347BZI-BLD33 CY8C6347BZI-BLD53 CY8C6347FMI-BLD13 CY8C6347FMI-BLD43 CY8C6347FMI-BLD33 CY8C6347FMI-BLD53 CY8C637BZI-MD76 CY8C637BZI-BLD74 CY8C637FMI-BLD73 CY8C68237BZ-BLE CY8C68237FM-BLE CY8C6137FDI-F02 CY8C6117FDI-F02 CY8C6247FDI-D02 CY8C6247FDI-D32 CY8C6347BZI-BUD43 CY8C6347BZI-BUD33 CY8C6347BZI-BUD53 CY8C6337BZI-BLF13 CY8C6247FDI-D52 CY8C6247FTI-D52 CY8C6247BZI-AUD54 CY8C6347BZI-BLD44 CY8C6347BZI-BLD34 CY8C6347BZI-BLD54 CY8C6247BFI-D54 CYBLE-416045-02 CY8C6347FMI-BUD53 CY8C6347FMI-BUD13 CY8C6347FMI-BUD43 CY8C6347FMI-BUD33 CY8C6137WI-F54 CY8C6117WI-F34 CY8C6247WI-D54 CY8C6347LQI-BLD52 CY8C6248BZI-D44 CY8C6248AZI-D44 CY8C6248FNI-D43 CY8C6248BZI-S2D44 CY8C6248AZI-S2D44 CY8C6248FNI-S2D43
+CY_DEVICES_WITH_FLASH_KB_832=CYB06447BZI-BLD54 CYB06447BZI-BLD53 CYB06447BZI-D54
+CY_DEVICES_WITH_FLASH_KB_2048=CY8C624ABZI-D44 CY8C624AAZI-D44 CY8C624AFNI-D43 CY8C624ABZI-D04 CY8C624ABZI-D14 CY8C624AAZI-D14 CY8C6248AZI-D14 CY8C624ALQI-D42 CY8C624ABZI-S2D44A0 CY8C624ABZI-S2D44 CY8C624AAZI-S2D44 CY8C624AFNI-S2D43 CY8C624ABZI-S2D04 CY8C624ABZI-S2D14 CY8C624AAZI-S2D14 CY8C6248AZI-S2D14
+CY_DEVICES_WITH_FLASH_KB_1856=CYB0644ABZI-S2D44
+
+CY_DEVICES_WITH_SRAM_KB_128=CY8C6036BZI-F04 CY8C6016BZI-F04 CY8C6116BZI-F54 CY8C6136BZI-F14 CY8C6136BZI-F34 CY8C6246BZI-D04 CY8C6336BZI-BLF03 CY8C6316BZI-BLF03 CY8C6316BZI-BLF53 CY8C6336BZI-BLD13 CY8C6336BZI-BUD13 CY8C6136FDI-F42 CY8C6136FTI-F42 CY8C6336BZI-BLF04 CY8C6316BZI-BLF04 CY8C6316BZI-BLF54 CY8C6336BZI-BLD14 CY8C6336LQI-BLF02 CY8C6336LQI-BLF42
+CY_DEVICES_WITH_SRAM_KB_288=CY8C6137BZI-F14 CY8C6137BZI-F34 CY8C6137BZI-F54 CY8C6117BZI-F34 CY8C6247BZI-D44 CY8C6247BZI-D34 CY8C6247BZI-D54 CY8C6347BZI-BLD43 CY8C6347BZI-BLD33 CY8C6347BZI-BLD53 CY8C6347FMI-BLD13 CY8C6347FMI-BLD43 CY8C6347FMI-BLD33 CY8C6347FMI-BLD53 CY8C637BZI-MD76 CY8C637BZI-BLD74 CY8C637FMI-BLD73 CY8C68237BZ-BLE CY8C68237FM-BLE CY8C6137FDI-F02 CY8C6117FDI-F02 CY8C6247FDI-D02 CY8C6247FDI-D32 CY8C6347BZI-BUD43 CY8C6347BZI-BUD33 CY8C6347BZI-BUD53 CY8C6337BZI-BLF13 CY8C6247FDI-D52 CY8C6247FTI-D52 CY8C6247BZI-AUD54 CY8C6347BZI-BLD44 CY8C6347BZI-BLD34 CY8C6347BZI-BLD54 CY8C6247BFI-D54 CYBLE-416045-02 CY8C6347FMI-BUD53 CY8C6347FMI-BUD13 CY8C6347FMI-BUD43 CY8C6347FMI-BUD33 CY8C6137WI-F54 CY8C6117WI-F34 CY8C6247WI-D54 CYB06447BZI-BLD54 CYB06447BZI-BLD53 CYB06447BZI-D54 CY8C6347LQI-BLD52
+CY_DEVICES_WITH_SRAM_KB_1024=CY8C624ABZI-D44 CY8C624AAZI-D44 CY8C624AFNI-D43 CY8C624ABZI-D04 CY8C624ABZI-D14 CY8C624AAZI-D14 CY8C6248AZI-D14 CY8C624ALQI-D42 CYB0644ABZI-S2D44 CY8C624ABZI-S2D44A0 CY8C624ABZI-S2D44 CY8C624AAZI-S2D44 CY8C624AFNI-S2D43 CY8C624ABZI-S2D04 CY8C624ABZI-S2D14 CY8C624AAZI-S2D14 CY8C6248AZI-S2D14
+CY_DEVICES_WITH_SRAM_KB_512=CY8C6248BZI-D44 CY8C6248AZI-D44 CY8C6248FNI-D43 CY8C6248BZI-S2D44 CY8C6248AZI-S2D44 CY8C6248FNI-S2D43
+CY_DEVICES_WITH_SRAM_KB_256=CY8C6245AZI-S3D72 CY8C6245LQI-S3D72 CY8C6245FNI-S3D71 CY8C6245AZI-S3D62 CY8C6245LQI-S3D62 CY8C6245AZI-S3D42 CY8C6245LQI-S3D42 CYB06445LQI-S3D42 CY8C6245FNI-S3D41 CY8C6245AZI-S3D12 CY8C6245LQI-S3D12 CY8C6245FNI-S3D11 CY8C6245AZI-S3D02 CY8C6245LQI-S3D02 CY8C6245W-S3D72
+
+CY_DEVICES_WITH_MAX_SPEED_MHZ_150=CY8C6036BZI-F04 CY8C6136BZI-F14 CY8C6136BZI-F34 CY8C6137BZI-F14 CY8C6137BZI-F34 CY8C6137BZI-F54 CY8C6246BZI-D04 CY8C6247BZI-D44 CY8C6247BZI-D34 CY8C6247BZI-D54 CY8C6336BZI-BLF03 CY8C6336BZI-BLD13 CY8C6347BZI-BLD43 CY8C6347BZI-BLD33 CY8C6347BZI-BLD53 CY8C6347FMI-BLD13 CY8C6347FMI-BLD43 CY8C6347FMI-BLD33 CY8C6347FMI-BLD53 CY8C637BZI-MD76 CY8C637BZI-BLD74 CY8C637FMI-BLD73 CY8C68237BZ-BLE CY8C68237FM-BLE CY8C6137FDI-F02 CY8C6247FDI-D02 CY8C6247FDI-D32 CY8C6336BZI-BUD13 CY8C6347BZI-BUD43 CY8C6347BZI-BUD33 CY8C6347BZI-BUD53 CY8C6337BZI-BLF13 CY8C6136FDI-F42 CY8C6247FDI-D52 CY8C6136FTI-F42 CY8C6247FTI-D52 CY8C6247BZI-AUD54 CY8C6336BZI-BLF04 CY8C6336BZI-BLD14 CY8C6347BZI-BLD44 CY8C6347BZI-BLD34 CY8C6347BZI-BLD54 CY8C6247BFI-D54 CYBLE-416045-02 CY8C6347FMI-BUD53 CY8C6347FMI-BUD13 CY8C6347FMI-BUD43 CY8C6347FMI-BUD33 CY8C6137WI-F54 CY8C6247WI-D54 CYB06447BZI-BLD54 CYB06447BZI-BLD53 CYB06447BZI-D54 CY8C6336LQI-BLF02 CY8C6336LQI-BLF42 CY8C6347LQI-BLD52 CY8C624ABZI-D44 CY8C624AAZI-D44 CY8C624AFNI-D43 CY8C624ABZI-D04 CY8C624ABZI-D14 CY8C624AAZI-D14 CY8C6248AZI-D14 CY8C6248BZI-D44 CY8C6248AZI-D44 CY8C6248FNI-D43 CY8C624ALQI-D42 CYB0644ABZI-S2D44 CY8C624ABZI-S2D44A0 CY8C624ABZI-S2D44 CY8C624AAZI-S2D44 CY8C624AFNI-S2D43 CY8C624ABZI-S2D04 CY8C624ABZI-S2D14 CY8C624AAZI-S2D14 CY8C6248AZI-S2D14 CY8C6248BZI-S2D44 CY8C6248AZI-S2D44 CY8C6248FNI-S2D43 CY8C6245AZI-S3D72 CY8C6245LQI-S3D72 CY8C6245FNI-S3D71 CY8C6245AZI-S3D62 CY8C6245LQI-S3D62 CY8C6245AZI-S3D42 CY8C6245LQI-S3D42 CYB06445LQI-S3D42 CY8C6245FNI-S3D41 CY8C6245AZI-S3D12 CY8C6245LQI-S3D12 CY8C6245FNI-S3D11 CY8C6245AZI-S3D02 CY8C6245LQI-S3D02 CY8C6245W-S3D72
+CY_DEVICES_WITH_MAX_SPEED_MHZ_50=CY8C6016BZI-F04 CY8C6116BZI-F54 CY8C6117BZI-F34 CY8C6316BZI-BLF03 CY8C6316BZI-BLF53 CY8C6117FDI-F02 CY8C6316BZI-BLF04 CY8C6316BZI-BLF54 CY8C6117WI-F34
+
+CY_DEVICES_WITH_PACKAGE_124-BGA=CY8C6036BZI-F04 CY8C6016BZI-F04 CY8C6116BZI-F54 CY8C6136BZI-F14 CY8C6136BZI-F34 CY8C6137BZI-F14 CY8C6137BZI-F34 CY8C6137BZI-F54 CY8C6117BZI-F34 CY8C6246BZI-D04 CY8C6247BZI-D44 CY8C6247BZI-D34 CY8C6247BZI-D54 CY8C637BZI-MD76 CY8C6247BZI-AUD54 CY8C6247BFI-D54 CY8C6137WI-F54 CY8C6117WI-F34 CY8C6247WI-D54 CYB06447BZI-D54 CY8C624ABZI-D44 CY8C624ABZI-D04 CY8C624ABZI-D14 CY8C6248BZI-D44 CYB0644ABZI-S2D44 CY8C624ABZI-S2D44A0 CY8C624ABZI-S2D44 CY8C624ABZI-S2D04 CY8C624ABZI-S2D14 CY8C6248BZI-S2D44
+CY_DEVICES_WITH_PACKAGE_116-BGA-BLE=CY8C6336BZI-BLF03 CY8C6316BZI-BLF03 CY8C6316BZI-BLF53 CY8C6336BZI-BLD13 CY8C6347BZI-BLD43 CY8C6347BZI-BLD33 CY8C6347BZI-BLD53 CY8C637BZI-BLD74 CY8C68237BZ-BLE CY8C6337BZI-BLF13 CYB06447BZI-BLD53
+CY_DEVICES_WITH_PACKAGE_104-M-CSP-BLE=CY8C6347FMI-BLD13 CY8C6347FMI-BLD43 CY8C6347FMI-BLD33 CY8C6347FMI-BLD53 CY8C637FMI-BLD73 CY8C68237FM-BLE
+CY_DEVICES_WITH_PACKAGE_80-WLCSP=CY8C6137FDI-F02 CY8C6117FDI-F02 CY8C6247FDI-D02 CY8C6247FDI-D32 CY8C6136FDI-F42 CY8C6247FDI-D52 CY8C6136FTI-F42 CY8C6247FTI-D52
+CY_DEVICES_WITH_PACKAGE_116-BGA-USB=CY8C6336BZI-BUD13 CY8C6347BZI-BUD43 CY8C6347BZI-BUD33 CY8C6347BZI-BUD53
+CY_DEVICES_WITH_PACKAGE_124-BGA-SIP=CY8C6336BZI-BLF04 CY8C6316BZI-BLF04 CY8C6316BZI-BLF54 CY8C6336BZI-BLD14 CY8C6347BZI-BLD44 CY8C6347BZI-BLD34 CY8C6347BZI-BLD54 CYB06447BZI-BLD54
+CY_DEVICES_WITH_PACKAGE_43-SMT=CYBLE-416045-02
+CY_DEVICES_WITH_PACKAGE_104-M-CSP-BLE-USB=CY8C6347FMI-BUD53 CY8C6347FMI-BUD13 CY8C6347FMI-BUD43 CY8C6347FMI-BUD33
+CY_DEVICES_WITH_PACKAGE_68-QFN-BLE=CY8C6336LQI-BLF02 CY8C6336LQI-BLF42 CY8C6347LQI-BLD52
+CY_DEVICES_WITH_PACKAGE_128-TQFP=CY8C624AAZI-D44 CY8C624AAZI-D14 CY8C6248AZI-D14 CY8C6248AZI-D44 CY8C624AAZI-S2D44 CY8C624AAZI-S2D14 CY8C6248AZI-S2D14 CY8C6248AZI-S2D44
+CY_DEVICES_WITH_PACKAGE_100-WLCSP=CY8C624AFNI-D43 CY8C6248FNI-D43 CY8C624AFNI-S2D43 CY8C6248FNI-S2D43
+CY_DEVICES_WITH_PACKAGE_68-QFN=CY8C624ALQI-D42 CY8C6245LQI-S3D72 CY8C6245LQI-S3D62 CY8C6245LQI-S3D42 CYB06445LQI-S3D42 CY8C6245LQI-S3D12 CY8C6245LQI-S3D02
+CY_DEVICES_WITH_PACKAGE_100-TQFP=CY8C6245AZI-S3D72 CY8C6245AZI-S3D62 CY8C6245AZI-S3D42 CY8C6245AZI-S3D12 CY8C6245AZI-S3D02 CY8C6245W-S3D72
+CY_DEVICES_WITH_PACKAGE_49-WLCSP=CY8C6245FNI-S3D71 CY8C6245FNI-S3D41 CY8C6245FNI-S3D11
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/version.xml b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/version.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0c4180cb3d29e2661db19ba50e457d46a696547d
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/libs/psoc6make/version.xml
@@ -0,0 +1 @@
+1.0.1.8025
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/makefile.init b/bsp/cypress/psoc6-pioneerkit_modus/makefile.init
new file mode 100644
index 0000000000000000000000000000000000000000..6721bdc2e2c0c40e01e674209f49168f6597d7e1
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/makefile.init
@@ -0,0 +1,2 @@
+export MAKE=make
+export PATH:=/usr/bin:$(PATH)
diff --git a/bsp/cypress/psoc6-pioneerkit_modus/rtconfig.h b/bsp/cypress/psoc6-pioneerkit_modus/rtconfig.h
new file mode 100644
index 0000000000000000000000000000000000000000..def5a08afffaf873727cefad90540f037e9fb6b4
--- /dev/null
+++ b/bsp/cypress/psoc6-pioneerkit_modus/rtconfig.h
@@ -0,0 +1,156 @@
+#ifndef RT_CONFIG_H__
+#define RT_CONFIG_H__
+
+/* Automatically generated file; DO NOT EDIT. */
+/* RT-Thread Project Configuration */
+
+/* RT-Thread Kernel */
+
+#define RT_NAME_MAX 16
+#define RT_ALIGN_SIZE 4
+#define RT_THREAD_PRIORITY_32
+#define RT_THREAD_PRIORITY_MAX 32
+#define RT_TICK_PER_SECOND 100
+#define RT_USING_OVERFLOW_CHECK
+#define RT_USING_HOOK
+#define RT_USING_IDLE_HOOK
+#define RT_IDEL_HOOK_LIST_SIZE 4
+#define IDLE_THREAD_STACK_SIZE 1024
+#define RT_USING_TIMER_SOFT
+#define RT_TIMER_THREAD_PRIO 4
+#define RT_TIMER_THREAD_STACK_SIZE 512
+#define RT_DEBUG
+
+/* Inter-Thread communication */
+
+#define RT_USING_SEMAPHORE
+#define RT_USING_MUTEX
+#define RT_USING_EVENT
+#define RT_USING_MAILBOX
+#define RT_USING_MESSAGEQUEUE
+#define RT_USING_SIGNALS
+
+/* Memory Management */
+
+#define RT_USING_MEMPOOL
+#define RT_USING_MEMHEAP
+#define RT_USING_SMALL_MEM
+#define RT_USING_MEMTRACE
+#define RT_USING_HEAP
+
+/* Kernel Device Object */
+
+#define RT_USING_DEVICE
+#define RT_USING_CONSOLE
+#define RT_CONSOLEBUF_SIZE 256
+#define RT_CONSOLE_DEVICE_NAME "uart0"
+#define RT_VER_NUM 0x40000
+
+/* RT-Thread Components */
+
+#define RT_USING_COMPONENTS_INIT
+#define RT_USING_USER_MAIN
+#define RT_MAIN_THREAD_STACK_SIZE 2048
+#define RT_MAIN_THREAD_PRIORITY 10
+
+/* C++ features */
+
+
+/* Command shell */
+
+#define RT_USING_FINSH
+#define FINSH_THREAD_NAME "tshell"
+#define FINSH_USING_HISTORY
+#define FINSH_HISTORY_LINES 5
+#define FINSH_USING_SYMTAB
+#define FINSH_USING_DESCRIPTION
+#define FINSH_THREAD_PRIORITY 20
+#define FINSH_THREAD_STACK_SIZE 4096
+#define FINSH_CMD_SIZE 80
+#define FINSH_USING_MSH
+#define FINSH_USING_MSH_DEFAULT
+#define FINSH_ARG_MAX 10
+
+/* Device virtual file system */
+
+
+/* Device Drivers */
+
+#define RT_USING_DEVICE_IPC
+#define RT_PIPE_BUFSZ 512
+#define RT_USING_SERIAL
+#define RT_SERIAL_USING_DMA
+#define RT_USING_PIN
+
+/* Using WiFi */
+
+
+/* Using USB */
+
+
+/* POSIX layer and C standard library */
+
+#define RT_USING_LIBC
+
+/* Network */
+
+/* Socket abstraction layer */
+
+
+/* light weight TCP/IP stack */
+
+
+/* Modbus master and slave stack */
+
+
+/* AT commands */
+
+
+/* VBUS(Virtual Software BUS) */
+
+
+/* Utilities */
+
+
+/* RT-Thread online packages */
+
+/* IoT - internet of things */
+
+
+/* Wi-Fi */
+
+/* Marvell WiFi */
+
+
+/* Wiced WiFi */
+
+
+/* IoT Cloud */
+
+
+/* security packages */
+
+
+/* language packages */
+
+
+/* multimedia packages */
+
+
+/* tools packages */
+
+
+/* system packages */
+
+
+/* peripheral libraries and drivers */
+
+
+/* miscellaneous packages */
+
+
+/* samples: kernel and components samples */
+
+#define RT_USING_UART0
+
+#endif
diff --git a/bsp/es32f0654/drivers/drv_pm.c b/bsp/es32f0654/drivers/drv_pm.c
deleted file mode 100644
index aa2f07ec68a101a94d15ecec51908d4c9ffbe2ad..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/drivers/drv_pm.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2019-04-01 wangyq the first version
- * 2019-05-06 Zero-Free adapt to the new power management interface
- */
-
-#include
-#include
-#include "board.h"
-#include "drv_pm.h"
-#include
-
-#ifdef RT_USING_PM
-
-static void _drv_pm_enter(struct rt_pm *pm, uint8_t mode)
-{
- switch (mode)
- {
- case PM_SLEEP_MODE_NONE:
- break;
-
- case PM_SLEEP_MODE_IDLE:
- __WFI();
- break;
-
- case PM_SLEEP_MODE_LIGHT:
- break;
-
- case PM_SLEEP_MODE_DEEP:
- pmu_stop2_enter();
- break;
-
- case PM_SLEEP_MODE_STANDBY:
- pmu_standby_enter(PMU_STANDBY_PORT_NONE);
- break;
-
- case PM_SLEEP_MODE_SHUTDOWN:
- break;
-
- default:
- RT_ASSERT(0);
- break;
- }
-}
-
-static int drv_hw_pm_init(void)
-{
- static const struct rt_pm_ops _ops =
- {
- _drv_pm_enter,
- RT_NULL,
- RT_NULL,
- RT_NULL,
- RT_NULL
- };
-
- rt_uint8_t timer_mask = 0;
-
- /* initialize timer mask(no need tickless) */
- timer_mask = 1UL << PM_SLEEP_MODE_DEEP;
-
- /* initialize system pm module */
- rt_system_pm_init(&_ops, timer_mask, RT_NULL);
-
- return 0;
-}
-INIT_BOARD_EXPORT(drv_hw_pm_init);
-
-#endif
diff --git a/bsp/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Include/es32f065x.h b/bsp/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Include/es32f065x.h
deleted file mode 100644
index 07ca77b338dcb29fe2f2ca80840169db4d92bfe3..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Include/es32f065x.h
+++ /dev/null
@@ -1,6665 +0,0 @@
-/**
- *********************************************************************************
- *
- * @file es32f065x.h
- * @brief ES32F065x Device Head File
- *
- * @version V1.0
- * @date 07 Nov 2017
- * @author AE Team
- * @note
- *
- * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
- *
- *********************************************************************************
- */
-
-#ifndef __ES32F0XX_H__
-#define __ES32F0XX_H__
-
-
-#define __I volatile const /* defines 'read only' permissions */
-#define __O volatile /* defines 'write only' permissions */
-#define __IO volatile /* defines 'read / write' permissions */
-
-#define __NVIC_PRIO_BITS 2
-
-typedef enum IRQn {
- /* Cortex-M0 processor cxceptions index */
- Reset_IRQn = -15,
- NMI_IRQn = -14,
- HardFault_IRQn = -13,
- SVCall_IRQn = -5,
- DebugMonitor_IRQn = -4,
- PendSV_IRQn = -2,
- SysTick_IRQn = -1,
-
- /* es32f0xx specific interrupt index */
- WWDG_IWDG_IRQn = 0,
- LVD_IRQn = 1,
- RTC_TEMP_IRQn = 2,
- CRYPT_TRNG_IRQn = 3,
- CMU_IRQn = 4,
- EXTI0_3_IRQn = 5,
- EXTI4_7_IRQn = 6,
- EXTI8_11_IRQn = 7,
- EXTI12_15_IRQn = 8,
- DMA_IRQn = 9,
- CAN0_IRQn = 10,
- LPTIM0_SPI2_IRQn = 11,
- ADC_ACMP_IRQn = 12,
- AD16C4T0_BRK_UP_TRIG_COM_IRQn = 13,
- AD16C4T0_CC_IRQn = 14,
- BS16T0_IRQn = 15,
- GP16C2T0_IRQn = 17,
- GP16C2T1_IRQn = 18,
- BS16T1_UART2_IRQn = 19,
- BS16T2_UART3_IRQn = 20,
- GP16C4T0_LCD_IRQn = 21,
- BS16T3_DAC0_IRQn = 22,
- I2C0_IRQn = 23,
- I2C1_IRQn = 24,
- SPI0_IRQn = 25,
- SPI1_IRQn = 26,
- UART0_IRQn = 27,
- UART1_IRQn = 28,
- USART0_IRQn = 29,
- USART1_IRQn = 30,
- LPUART0_IRQn = 31,
-} IRQn_Type;
-
-
-#include
-#include "core_cm0.h"
-
-#if defined (__CC_ARM)
-#pragma anon_unions
-#endif
-
-/* Peripheral register define */
-
-/****************** Bit definition for SYSCFG_PROT register ************************/
-
-#define SYSCFG_PROT_KEY_POSS 1U
-#define SYSCFG_PROT_KEY_POSE 31U
-#define SYSCFG_PROT_KEY_MSK BITS(SYSCFG_PROT_KEY_POSS,SYSCFG_PROT_KEY_POSE)
-
-#define SYSCFG_PROT_PROT_POS 0U
-#define SYSCFG_PROT_PROT_MSK BIT(SYSCFG_PROT_PROT_POS)
-
-/****************** Bit definition for SYSCFG_MEMRMP register ************************/
-
-#define SYSCFG_MEMRMP_VTOEN_POS 16U
-#define SYSCFG_MEMRMP_VTOEN_MSK BIT(SYSCFG_MEMRMP_VTOEN_POS)
-
-#define SYSCFG_MEMRMP_BFRMPEN_POS 8U
-#define SYSCFG_MEMRMP_BFRMPEN_MSK BIT(SYSCFG_MEMRMP_BFRMPEN_POS)
-
-#define SYSCFG_MEMRMP_BRRMPEN_POS 0U
-#define SYSCFG_MEMRMP_BRRMPEN_MSK BIT(SYSCFG_MEMRMP_BRRMPEN_POS)
-
-/****************** Bit definition for SYSCFG_VTOR register ************************/
-
-#define SYSCFG_VTOR_VTO_POSS 0U
-#define SYSCFG_VTOR_VTO_POSE 29U
-#define SYSCFG_VTOR_VTO_MSK BITS(SYSCFG_VTOR_VTO_POSS,SYSCFG_VTOR_VTO_POSE)
-
-typedef struct
-{
- __IO uint32_t PROT;
- __IO uint32_t MEMRMP;
- __IO uint32_t VTOR;
-} SYSCFG_TypeDef;
-
-/****************** Bit definition for MSC_FLASHKEY register ************************/
-
-#define MSC_FLASHKEY_STATUS_POSS 0U
-#define MSC_FLASHKEY_STATUS_POSE 1U
-#define MSC_FLASHKEY_STATUS_MSK BITS(MSC_FLASHKEY_STATUS_POSS,MSC_FLASHKEY_STATUS_POSE)
-
-/****************** Bit definition for MSC_INFOKEY register ************************/
-
-#define MSC_INFOKEY_STATUS_POSS 0U
-#define MSC_INFOKEY_STATUS_POSE 1U
-#define MSC_INFOKEY_STATUS_MSK BITS(MSC_INFOKEY_STATUS_POSS,MSC_INFOKEY_STATUS_POSE)
-
-/****************** Bit definition for MSC_FLASHADDR register ************************/
-
-#define MSC_FLASHADDR_IFREN_POS 18U
-#define MSC_FLASHADDR_IFREN_MSK BIT(MSC_FLASHADDR_IFREN_POS)
-
-#define MSC_FLASHADDR_ADDR_POSS 0U
-#define MSC_FLASHADDR_ADDR_POSE 17U
-#define MSC_FLASHADDR_ADDR_MSK BITS(MSC_FLASHADDR_ADDR_POSS,MSC_FLASHADDR_ADDR_POSE)
-
-/****************** Bit definition for MSC_FLASHFIFO register ************************/
-
-#define MSC_FLASHFIFO_FIFO_POSS 0U
-#define MSC_FLASHFIFO_FIFO_POSE 31U
-#define MSC_FLASHFIFO_FIFO_MSK BITS(MSC_FLASHFIFO_FIFO_POSS,MSC_FLASHFIFO_FIFO_POSE)
-
-/****************** Bit definition for MSC_FLASHDL register ************************/
-
-#define MSC_FLASHDL_DATAL_POSS 0U
-#define MSC_FLASHDL_DATAL_POSE 31U
-#define MSC_FLASHDL_DATAL_MSK BITS(MSC_FLASHDL_DATAL_POSS,MSC_FLASHDL_DATAL_POSE)
-
-/****************** Bit definition for MSC_FLASHDH register ************************/
-
-#define MSC_FLASHDH_DATAH_POSS 0U
-#define MSC_FLASHDH_DATAH_POSE 31U
-#define MSC_FLASHDH_DATAH_MSK BITS(MSC_FLASHDH_DATAH_POSS,MSC_FLASHDH_DATAH_POSE)
-
-/****************** Bit definition for MSC_FLASHCMD register ************************/
-
-#define MSC_FLASHCMD_CMD_POSS 0U
-#define MSC_FLASHCMD_CMD_POSE 31U
-#define MSC_FLASHCMD_CMD_MSK BITS(MSC_FLASHCMD_CMD_POSS,MSC_FLASHCMD_CMD_POSE)
-
-/****************** Bit definition for MSC_FLASHCR register ************************/
-
-#define MSC_FLASHCR_FIFOEN_POS 5U
-#define MSC_FLASHCR_FIFOEN_MSK BIT(MSC_FLASHCR_FIFOEN_POS)
-
-#define MSC_FLASHCR_FLASHREQ_POS 4U
-#define MSC_FLASHCR_FLASHREQ_MSK BIT(MSC_FLASHCR_FLASHREQ_POS)
-
-#define MSC_FLASHCR_IAPRST_POS 1U
-#define MSC_FLASHCR_IAPRST_MSK BIT(MSC_FLASHCR_IAPRST_POS)
-
-#define MSC_FLASHCR_IAPEN_POS 0U
-#define MSC_FLASHCR_IAPEN_MSK BIT(MSC_FLASHCR_IAPEN_POS)
-
-/****************** Bit definition for MSC_FLASHSR register ************************/
-
-#define MSC_FLASHSR_TIMEOUT_POS 7U
-#define MSC_FLASHSR_TIMEOUT_MSK BIT(MSC_FLASHSR_TIMEOUT_POS)
-
-#define MSC_FLASHSR_PROG_POS 6U
-#define MSC_FLASHSR_PROG_MSK BIT(MSC_FLASHSR_PROG_POS)
-
-#define MSC_FLASHSR_SERA_POS 5U
-#define MSC_FLASHSR_SERA_MSK BIT(MSC_FLASHSR_SERA_POS)
-
-#define MSC_FLASHSR_MASE_POS 4U
-#define MSC_FLASHSR_MASE_MSK BIT(MSC_FLASHSR_MASE_POS)
-
-#define MSC_FLASHSR_ADDR_OV_POS 3U
-#define MSC_FLASHSR_ADDR_OV_MSK BIT(MSC_FLASHSR_ADDR_OV_POS)
-
-#define MSC_FLASHSR_WRP_FLAG_POS 2U
-#define MSC_FLASHSR_WRP_FLAG_MSK BIT(MSC_FLASHSR_WRP_FLAG_POS)
-
-#define MSC_FLASHSR_BUSY_POS 1U
-#define MSC_FLASHSR_BUSY_MSK BIT(MSC_FLASHSR_BUSY_POS)
-
-#define MSC_FLASHSR_FLASHACK_POS 0U
-#define MSC_FLASHSR_FLASHACK_MSK BIT(MSC_FLASHSR_FLASHACK_POS)
-
-/****************** Bit definition for MSC_FLASHPL register ************************/
-
-#define MSC_FLASHPL_PROG_LEN_POSS 0U
-#define MSC_FLASHPL_PROG_LEN_POSE 15U
-#define MSC_FLASHPL_PROG_LEN_MSK BITS(MSC_FLASHPL_PROG_LEN_POSS,MSC_FLASHPL_PROG_LEN_POSE)
-
-/****************** Bit definition for MSC_MEMWAIT register ************************/
-
-#define MSC_MEMWAIT_SRAM_W_POSS 8U
-#define MSC_MEMWAIT_SRAM_W_POSE 9U
-#define MSC_MEMWAIT_SRAM_W_MSK BITS(MSC_MEMWAIT_SRAM_W_POSS,MSC_MEMWAIT_SRAM_W_POSE)
-
-#define MSC_MEMWAIT_FLASH_W_POSS 0U
-#define MSC_MEMWAIT_FLASH_W_POSE 3U
-#define MSC_MEMWAIT_FLASH_W_MSK BITS(MSC_MEMWAIT_FLASH_W_POSS,MSC_MEMWAIT_FLASH_W_POSE)
-
-typedef struct
-{
- __IO uint32_t FLASHKEY;
- __IO uint32_t INFOKEY;
- __IO uint32_t FLASHADDR;
- __O uint32_t FLASHFIFO;
- __IO uint32_t FLASHDL;
- __IO uint32_t FLASHDH;
- __O uint32_t FLASHCMD;
- __IO uint32_t FLASHCR;
- __I uint32_t FLASHSR;
- __IO uint32_t FLASHPL;
- __IO uint32_t MEMWAIT;
-} MSC_TypeDef;
-
-/****************** Bit definition for BKPC_PROT register ************************/
-
-#define BKPC_PROT_KEY_POSS 1U
-#define BKPC_PROT_KEY_POSE 31U
-#define BKPC_PROT_KEY_MSK BITS(BKPC_PROT_KEY_POSS,BKPC_PROT_KEY_POSE)
-
-#define BKPC_PROT_PROT_POS 0U
-#define BKPC_PROT_PROT_MSK BIT(BKPC_PROT_PROT_POS)
-
-/****************** Bit definition for BKPC_CR register ************************/
-
-#define BKPC_CR_LDO_VSEL_POSS 24U
-#define BKPC_CR_LDO_VSEL_POSE 26U
-#define BKPC_CR_LDO_VSEL_MSK BITS(BKPC_CR_LDO_VSEL_POSS,BKPC_CR_LDO_VSEL_POSE)
-
-#define BKPC_CR_MT_STDB_POS 19U
-#define BKPC_CR_MT_STDB_MSK BIT(BKPC_CR_MT_STDB_POS)
-
-#define BKPC_CR_VR1P5_VSEL_POSS 16U
-#define BKPC_CR_VR1P5_VSEL_POSE 18U
-#define BKPC_CR_VR1P5_VSEL_MSK BITS(BKPC_CR_VR1P5_VSEL_POSS,BKPC_CR_VR1P5_VSEL_POSE)
-
-#define BKPC_CR_TC_PWRDWN_POS 13U
-#define BKPC_CR_TC_PWRDWN_MSK BIT(BKPC_CR_TC_PWRDWN_POS)
-
-#define BKPC_CR_WKPOL_POS 12U
-#define BKPC_CR_WKPOL_MSK BIT(BKPC_CR_WKPOL_POS)
-
-#define BKPC_CR_WKPS_POSS 9U
-#define BKPC_CR_WKPS_POSE 11U
-#define BKPC_CR_WKPS_MSK BITS(BKPC_CR_WKPS_POSS,BKPC_CR_WKPS_POSE)
-
-#define BKPC_CR_WKPEN_POS 8U
-#define BKPC_CR_WKPEN_MSK BIT(BKPC_CR_WKPEN_POS)
-
-#define BKPC_CR_LRCEN_POS 2U
-#define BKPC_CR_LRCEN_MSK BIT(BKPC_CR_LRCEN_POS)
-
-#define BKPC_CR_LOSMEN_POS 1U
-#define BKPC_CR_LOSMEN_MSK BIT(BKPC_CR_LOSMEN_POS)
-
-#define BKPC_CR_LOSCEN_POS 0U
-#define BKPC_CR_LOSCEN_MSK BIT(BKPC_CR_LOSCEN_POS)
-
-/****************** Bit definition for BKPC_PCCR register ************************/
-
-#define BKPC_PCCR_TEMPCS_POSS 4U
-#define BKPC_PCCR_TEMPCS_POSE 5U
-#define BKPC_PCCR_TEMPCS_MSK BITS(BKPC_PCCR_TEMPCS_POSS,BKPC_PCCR_TEMPCS_POSE)
-
-#define BKPC_PCCR_RTCCS_POSS 0U
-#define BKPC_PCCR_RTCCS_POSE 1U
-#define BKPC_PCCR_RTCCS_MSK BITS(BKPC_PCCR_RTCCS_POSS,BKPC_PCCR_RTCCS_POSE)
-
-/****************** Bit definition for BKPC_PCR register ************************/
-
-#define BKPC_PCR_BORS_POSS 1U
-#define BKPC_PCR_BORS_POSE 4U
-#define BKPC_PCR_BORS_MSK BITS(BKPC_PCR_BORS_POSS,BKPC_PCR_BORS_POSE)
-
-#define BKPC_PCR_BOREN_POS 0U
-#define BKPC_PCR_BOREN_MSK BIT(BKPC_PCR_BOREN_POS)
-
-typedef struct
-{
- __IO uint32_t PROT;
- __IO uint32_t CR;
- __IO uint32_t PCCR;
- __IO uint32_t PCR;
-} BKPC_TypeDef;
-
-/****************** Bit definition for PMU_CR register ************************/
-
-#define PMU_CR_MTSTOP_POS 21U
-#define PMU_CR_MTSTOP_MSK BIT(PMU_CR_MTSTOP_POS)
-
-#define PMU_CR_LPSTOP_POS 20U
-#define PMU_CR_LPSTOP_MSK BIT(PMU_CR_LPSTOP_POS)
-
-#define PMU_CR_LPRUN_POS 19U
-#define PMU_CR_LPRUN_MSK BIT(PMU_CR_LPRUN_POS)
-
-#define PMU_CR_LPVS_POSS 16U
-#define PMU_CR_LPVS_POSE 18U
-#define PMU_CR_LPVS_MSK BITS(PMU_CR_LPVS_POSS,PMU_CR_LPVS_POSE)
-
-#define PMU_CR_WKPS_POSS 9U
-#define PMU_CR_WKPS_POSE 11U
-#define PMU_CR_WKPS_MSK BITS(PMU_CR_WKPS_POSS,PMU_CR_WKPS_POSE)
-
-#define PMU_CR_WKPEN_POS 8U
-#define PMU_CR_WKPEN_MSK BIT(PMU_CR_WKPEN_POS)
-
-#define PMU_CR_CSTANDBYF_POS 3U
-#define PMU_CR_CSTANDBYF_MSK BIT(PMU_CR_CSTANDBYF_POS)
-
-#define PMU_CR_CWUF_POS 2U
-#define PMU_CR_CWUF_MSK BIT(PMU_CR_CWUF_POS)
-
-#define PMU_CR_LPM_POSS 0U
-#define PMU_CR_LPM_POSE 1U
-#define PMU_CR_LPM_MSK BITS(PMU_CR_LPM_POSS,PMU_CR_LPM_POSE)
-
-/****************** Bit definition for PMU_SR register ************************/
-
-#define PMU_SR_STANDBYF_POS 1U
-#define PMU_SR_STANDBYF_MSK BIT(PMU_SR_STANDBYF_POS)
-
-#define PMU_SR_WUF_POS 0U
-#define PMU_SR_WUF_MSK BIT(PMU_SR_WUF_POS)
-
-/****************** Bit definition for PMU_LVDCR register ************************/
-
-#define PMU_LVDCR_LVDO_POS 15U
-#define PMU_LVDCR_LVDO_MSK BIT(PMU_LVDCR_LVDO_POS)
-
-#define PMU_LVDCR_LVDFLT_POS 11U
-#define PMU_LVDCR_LVDFLT_MSK BIT(PMU_LVDCR_LVDFLT_POS)
-
-#define PMU_LVDCR_LVIFS_POSS 8U
-#define PMU_LVDCR_LVIFS_POSE 10U
-#define PMU_LVDCR_LVIFS_MSK BITS(PMU_LVDCR_LVIFS_POSS,PMU_LVDCR_LVIFS_POSE)
-
-#define PMU_LVDCR_LVDS_POSS 4U
-#define PMU_LVDCR_LVDS_POSE 7U
-#define PMU_LVDCR_LVDS_MSK BITS(PMU_LVDCR_LVDS_POSS,PMU_LVDCR_LVDS_POSE)
-
-#define PMU_LVDCR_LVDCIF_POS 3U
-#define PMU_LVDCR_LVDCIF_MSK BIT(PMU_LVDCR_LVDCIF_POS)
-
-#define PMU_LVDCR_LVDIF_POS 2U
-#define PMU_LVDCR_LVDIF_MSK BIT(PMU_LVDCR_LVDIF_POS)
-
-#define PMU_LVDCR_LVDIE_POS 1U
-#define PMU_LVDCR_LVDIE_MSK BIT(PMU_LVDCR_LVDIE_POS)
-
-#define PMU_LVDCR_LVDEN_POS 0U
-#define PMU_LVDCR_LVDEN_MSK BIT(PMU_LVDCR_LVDEN_POS)
-
-/****************** Bit definition for PMU_PWRCR register ************************/
-
-#define PMU_PWRCR_BXCAN_POS 4U
-#define PMU_PWRCR_BXCAN_MSK BIT(PMU_PWRCR_BXCAN_POS)
-
-#define PMU_PWRCR_SRAM_POSS 0U
-#define PMU_PWRCR_SRAM_POSE 1U
-#define PMU_PWRCR_SRAM_MSK BITS(PMU_PWRCR_SRAM_POSS,PMU_PWRCR_SRAM_POSE)
-
-/****************** Bit definition for PMU_TWUR register ************************/
-
-#define PMU_TWUR_TWU_POSS 0U
-#define PMU_TWUR_TWU_POSE 11U
-#define PMU_TWUR_TWU_MSK BITS(PMU_TWUR_TWU_POSS,PMU_TWUR_TWU_POSE)
-
-/****************** Bit definition for PMU_VREFCR register ************************/
-
-#define PMU_VREFCR_FLTS_POSS 13U
-#define PMU_VREFCR_FLTS_POSE 14U
-#define PMU_VREFCR_FLTS_MSK BITS(PMU_VREFCR_FLTS_POSS,PMU_VREFCR_FLTS_POSE)
-
-#define PMU_VREFCR_CHOPCS_POSS 10U
-#define PMU_VREFCR_CHOPCS_POSE 12U
-#define PMU_VREFCR_CHOPCS_MSK BITS(PMU_VREFCR_CHOPCS_POSS,PMU_VREFCR_CHOPCS_POSE)
-
-#define PMU_VREFCR_CHOP1EN_POS 9U
-#define PMU_VREFCR_CHOP1EN_MSK BIT(PMU_VREFCR_CHOP1EN_POS)
-
-#define PMU_VREFCR_CHOPEN_POS 8U
-#define PMU_VREFCR_CHOPEN_MSK BIT(PMU_VREFCR_CHOPEN_POS)
-
-#define PMU_VREFCR_VREFEN_POS 0U
-#define PMU_VREFCR_VREFEN_MSK BIT(PMU_VREFCR_VREFEN_POS)
-
-typedef struct
-{
- __IO uint32_t CR;
- __I uint32_t SR;
- __IO uint32_t LVDCR;
- __IO uint32_t PWRCR;
- __IO uint32_t TWUR;
- __IO uint32_t VREFCR;
-} PMU_TypeDef;
-
-/****************** Bit definition for RMU_CR register ************************/
-
-#define RMU_CR_BORVS_POSS 4U
-#define RMU_CR_BORVS_POSE 7U
-#define RMU_CR_BORVS_MSK BITS(RMU_CR_BORVS_POSS,RMU_CR_BORVS_POSE)
-
-#define RMU_CR_BORFLT_POSS 1U
-#define RMU_CR_BORFLT_POSE 3U
-#define RMU_CR_BORFLT_MSK BITS(RMU_CR_BORFLT_POSS,RMU_CR_BORFLT_POSE)
-
-#define RMU_CR_BOREN_POS 0U
-#define RMU_CR_BOREN_MSK BIT(RMU_CR_BOREN_POS)
-
-/****************** Bit definition for RMU_RSTSR register ************************/
-
-#define RMU_RSTSR_CFGERR_POS 16U
-#define RMU_RSTSR_CFGERR_MSK BIT(RMU_RSTSR_CFGERR_POS)
-
-#define RMU_RSTSR_CFG_POS 10U
-#define RMU_RSTSR_CFG_MSK BIT(RMU_RSTSR_CFG_POS)
-
-#define RMU_RSTSR_CPU_POS 9U
-#define RMU_RSTSR_CPU_MSK BIT(RMU_RSTSR_CPU_POS)
-
-#define RMU_RSTSR_MCU_POS 8U
-#define RMU_RSTSR_MCU_MSK BIT(RMU_RSTSR_MCU_POS)
-
-#define RMU_RSTSR_CHIP_POS 7U
-#define RMU_RSTSR_CHIP_MSK BIT(RMU_RSTSR_CHIP_POS)
-
-#define RMU_RSTSR_LOCKUP_POS 6U
-#define RMU_RSTSR_LOCKUP_MSK BIT(RMU_RSTSR_LOCKUP_POS)
-
-#define RMU_RSTSR_WWDT_POS 5U
-#define RMU_RSTSR_WWDT_MSK BIT(RMU_RSTSR_WWDT_POS)
-
-#define RMU_RSTSR_IWDT_POS 4U
-#define RMU_RSTSR_IWDT_MSK BIT(RMU_RSTSR_IWDT_POS)
-
-#define RMU_RSTSR_NMRST_POS 3U
-#define RMU_RSTSR_NMRST_MSK BIT(RMU_RSTSR_NMRST_POS)
-
-#define RMU_RSTSR_BOR_POS 2U
-#define RMU_RSTSR_BOR_MSK BIT(RMU_RSTSR_BOR_POS)
-
-#define RMU_RSTSR_WAKEUP_POS 1U
-#define RMU_RSTSR_WAKEUP_MSK BIT(RMU_RSTSR_WAKEUP_POS)
-
-#define RMU_RSTSR_POR_POS 0U
-#define RMU_RSTSR_POR_MSK BIT(RMU_RSTSR_POR_POS)
-
-/****************** Bit definition for RMU_CRSTSR register ************************/
-
-#define RMU_CRSTSR_CFG_POS 10U
-#define RMU_CRSTSR_CFG_MSK BIT(RMU_CRSTSR_CFG_POS)
-
-#define RMU_CRSTSR_CPU_POS 9U
-#define RMU_CRSTSR_CPU_MSK BIT(RMU_CRSTSR_CPU_POS)
-
-#define RMU_CRSTSR_MCU_POS 8U
-#define RMU_CRSTSR_MCU_MSK BIT(RMU_CRSTSR_MCU_POS)
-
-#define RMU_CRSTSR_CHIP_POS 7U
-#define RMU_CRSTSR_CHIP_MSK BIT(RMU_CRSTSR_CHIP_POS)
-
-#define RMU_CRSTSR_LOCKUP_POS 6U
-#define RMU_CRSTSR_LOCKUP_MSK BIT(RMU_CRSTSR_LOCKUP_POS)
-
-#define RMU_CRSTSR_WWDT_POS 5U
-#define RMU_CRSTSR_WWDT_MSK BIT(RMU_CRSTSR_WWDT_POS)
-
-#define RMU_CRSTSR_IWDT_POS 4U
-#define RMU_CRSTSR_IWDT_MSK BIT(RMU_CRSTSR_IWDT_POS)
-
-#define RMU_CRSTSR_NMRST_POS 3U
-#define RMU_CRSTSR_NMRST_MSK BIT(RMU_CRSTSR_NMRST_POS)
-
-#define RMU_CRSTSR_BOR_POS 2U
-#define RMU_CRSTSR_BOR_MSK BIT(RMU_CRSTSR_BOR_POS)
-
-#define RMU_CRSTSR_WAKEUP_POS 1U
-#define RMU_CRSTSR_WAKEUP_MSK BIT(RMU_CRSTSR_WAKEUP_POS)
-
-#define RMU_CRSTSR_POR_POS 0U
-#define RMU_CRSTSR_POR_MSK BIT(RMU_CRSTSR_POR_POS)
-
-/****************** Bit definition for RMU_AHB1RSTR register ************************/
-
-#define RMU_AHB1RSTR_PISRST_POS 5U
-#define RMU_AHB1RSTR_PISRST_MSK BIT(RMU_AHB1RSTR_PISRST_POS)
-
-#define RMU_AHB1RSTR_TRNGRST_POS 4U
-#define RMU_AHB1RSTR_TRNGRST_MSK BIT(RMU_AHB1RSTR_TRNGRST_POS)
-
-#define RMU_AHB1RSTR_CRYPTRST_POS 3U
-#define RMU_AHB1RSTR_CRYPTRST_MSK BIT(RMU_AHB1RSTR_CRYPTRST_POS)
-
-#define RMU_AHB1RSTR_CALCRST_POS 2U
-#define RMU_AHB1RSTR_CALCRST_MSK BIT(RMU_AHB1RSTR_CALCRST_POS)
-
-#define RMU_AHB1RSTR_CRCRST_POS 1U
-#define RMU_AHB1RSTR_CRCRST_MSK BIT(RMU_AHB1RSTR_CRCRST_POS)
-
-#define RMU_AHB1RSTR_GPIORST_POS 0U
-#define RMU_AHB1RSTR_GPIORST_MSK BIT(RMU_AHB1RSTR_GPIORST_POS)
-
-/****************** Bit definition for RMU_AHB2RSTR register ************************/
-
-#define RMU_AHB2RSTR_CPURST_POS 1U
-#define RMU_AHB2RSTR_CPURST_MSK BIT(RMU_AHB2RSTR_CPURST_POS)
-
-#define RMU_AHB2RSTR_CHIPRST_POS 0U
-#define RMU_AHB2RSTR_CHIPRST_MSK BIT(RMU_AHB2RSTR_CHIPRST_POS)
-
-/****************** Bit definition for RMU_APB1RSTR register ************************/
-
-#define RMU_APB1RSTR_CAN0RST_POS 24U
-#define RMU_APB1RSTR_CAN0RST_MSK BIT(RMU_APB1RSTR_CAN0RST_POS)
-
-#define RMU_APB1RSTR_I2C1RST_POS 21U
-#define RMU_APB1RSTR_I2C1RST_MSK BIT(RMU_APB1RSTR_I2C1RST_POS)
-
-#define RMU_APB1RSTR_I2C0RST_POS 20U
-#define RMU_APB1RSTR_I2C0RST_MSK BIT(RMU_APB1RSTR_I2C0RST_POS)
-
-#define RMU_APB1RSTR_SPI2RST_POS 18U
-#define RMU_APB1RSTR_SPI2RST_MSK BIT(RMU_APB1RSTR_SPI2RST_POS)
-
-#define RMU_APB1RSTR_SPI1RST_POS 17U
-#define RMU_APB1RSTR_SPI1RST_MSK BIT(RMU_APB1RSTR_SPI1RST_POS)
-
-#define RMU_APB1RSTR_SPI0RST_POS 16U
-#define RMU_APB1RSTR_SPI0RST_MSK BIT(RMU_APB1RSTR_SPI0RST_POS)
-
-#define RMU_APB1RSTR_USART1RST_POS 13U
-#define RMU_APB1RSTR_USART1RST_MSK BIT(RMU_APB1RSTR_USART1RST_POS)
-
-#define RMU_APB1RSTR_USART0RST_POS 12U
-#define RMU_APB1RSTR_USART0RST_MSK BIT(RMU_APB1RSTR_USART0RST_POS)
-
-#define RMU_APB1RSTR_UART3RST_POS 11U
-#define RMU_APB1RSTR_UART3RST_MSK BIT(RMU_APB1RSTR_UART3RST_POS)
-
-#define RMU_APB1RSTR_UART2RST_POS 10U
-#define RMU_APB1RSTR_UART2RST_MSK BIT(RMU_APB1RSTR_UART2RST_POS)
-
-#define RMU_APB1RSTR_UART1RST_POS 9U
-#define RMU_APB1RSTR_UART1RST_MSK BIT(RMU_APB1RSTR_UART1RST_POS)
-
-#define RMU_APB1RSTR_UART0RST_POS 8U
-#define RMU_APB1RSTR_UART0RST_MSK BIT(RMU_APB1RSTR_UART0RST_POS)
-
-#define RMU_APB1RSTR_TIM7RST_POS 7U
-#define RMU_APB1RSTR_TIM7RST_MSK BIT(RMU_APB1RSTR_TIM7RST_POS)
-
-#define RMU_APB1RSTR_TIM6RST_POS 6U
-#define RMU_APB1RSTR_TIM6RST_MSK BIT(RMU_APB1RSTR_TIM6RST_POS)
-
-#define RMU_APB1RSTR_TIM5RST_POS 5U
-#define RMU_APB1RSTR_TIM5RST_MSK BIT(RMU_APB1RSTR_TIM5RST_POS)
-
-#define RMU_APB1RSTR_TIM4RST_POS 4U
-#define RMU_APB1RSTR_TIM4RST_MSK BIT(RMU_APB1RSTR_TIM4RST_POS)
-
-#define RMU_APB1RSTR_TIM3RST_POS 3U
-#define RMU_APB1RSTR_TIM3RST_MSK BIT(RMU_APB1RSTR_TIM3RST_POS)
-
-#define RMU_APB1RSTR_TIM2RST_POS 2U
-#define RMU_APB1RSTR_TIM2RST_MSK BIT(RMU_APB1RSTR_TIM2RST_POS)
-
-#define RMU_APB1RSTR_TIM1RST_POS 1U
-#define RMU_APB1RSTR_TIM1RST_MSK BIT(RMU_APB1RSTR_TIM1RST_POS)
-
-#define RMU_APB1RSTR_TIM0RST_POS 0U
-#define RMU_APB1RSTR_TIM0RST_MSK BIT(RMU_APB1RSTR_TIM0RST_POS)
-
-/****************** Bit definition for RMU_APB2RSTR register ************************/
-
-#define RMU_APB2RSTR_BKPRAMRST_POS 18U
-#define RMU_APB2RSTR_BKPRAMRST_MSK BIT(RMU_APB2RSTR_BKPRAMRST_POS)
-
-#define RMU_APB2RSTR_BKPCRST_POS 17U
-#define RMU_APB2RSTR_BKPCRST_MSK BIT(RMU_APB2RSTR_BKPCRST_POS)
-
-#define RMU_APB2RSTR_TEMPRST_POS 16U
-#define RMU_APB2RSTR_TEMPRST_MSK BIT(RMU_APB2RSTR_TEMPRST_POS)
-
-#define RMU_APB2RSTR_RTCRST_POS 15U
-#define RMU_APB2RSTR_RTCRST_MSK BIT(RMU_APB2RSTR_RTCRST_POS)
-
-#define RMU_APB2RSTR_IWDTRST_POS 14U
-#define RMU_APB2RSTR_IWDTRST_MSK BIT(RMU_APB2RSTR_IWDTRST_POS)
-
-#define RMU_APB2RSTR_LCDRST_POS 13U
-#define RMU_APB2RSTR_LCDRST_MSK BIT(RMU_APB2RSTR_LCDRST_POS)
-
-#define RMU_APB2RSTR_WWDTRST_POS 12U
-#define RMU_APB2RSTR_WWDTRST_MSK BIT(RMU_APB2RSTR_WWDTRST_POS)
-
-#define RMU_APB2RSTR_OPAMPRST_POS 8U
-#define RMU_APB2RSTR_OPAMPRST_MSK BIT(RMU_APB2RSTR_OPAMPRST_POS)
-
-#define RMU_APB2RSTR_ACMP1RST_POS 7U
-#define RMU_APB2RSTR_ACMP1RST_MSK BIT(RMU_APB2RSTR_ACMP1RST_POS)
-
-#define RMU_APB2RSTR_ACMP0RST_POS 6U
-#define RMU_APB2RSTR_ACMP0RST_MSK BIT(RMU_APB2RSTR_ACMP0RST_POS)
-
-#define RMU_APB2RSTR_ADC0RST_POS 4U
-#define RMU_APB2RSTR_ADC0RST_MSK BIT(RMU_APB2RSTR_ADC0RST_POS)
-
-#define RMU_APB2RSTR_LPUART0RST_POS 2U
-#define RMU_APB2RSTR_LPUART0RST_MSK BIT(RMU_APB2RSTR_LPUART0RST_POS)
-
-#define RMU_APB2RSTR_LPTIM0RST_POS 0U
-#define RMU_APB2RSTR_LPTIM0RST_MSK BIT(RMU_APB2RSTR_LPTIM0RST_POS)
-
-typedef struct
-{
- __IO uint32_t CR;
- uint32_t RESERVED0[3] ;
- __I uint32_t RSTSR;
- __O uint32_t CRSTSR;
- uint32_t RESERVED1[2] ;
- __O uint32_t AHB1RSTR;
- __O uint32_t AHB2RSTR;
- uint32_t RESERVED2[2] ;
- __O uint32_t APB1RSTR;
- __O uint32_t APB2RSTR;
-} RMU_TypeDef;
-
-/****************** Bit definition for CMU_CSR register ************************/
-
-#define CMU_CSR_CFT_RDYN_POS 25U
-#define CMU_CSR_CFT_RDYN_MSK BIT(CMU_CSR_CFT_RDYN_POS)
-
-#define CMU_CSR_CFT_STU_POS 24U
-#define CMU_CSR_CFT_STU_MSK BIT(CMU_CSR_CFT_STU_POS)
-
-#define CMU_CSR_CFT_CMD_POSS 16U
-#define CMU_CSR_CFT_CMD_POSE 23U
-#define CMU_CSR_CFT_CMD_MSK BITS(CMU_CSR_CFT_CMD_POSS,CMU_CSR_CFT_CMD_POSE)
-
-#define CMU_CSR_SYS_RDYN_POS 12U
-#define CMU_CSR_SYS_RDYN_MSK BIT(CMU_CSR_SYS_RDYN_POS)
-
-#define CMU_CSR_SYS_STU_POSS 8U
-#define CMU_CSR_SYS_STU_POSE 10U
-#define CMU_CSR_SYS_STU_MSK BITS(CMU_CSR_SYS_STU_POSS,CMU_CSR_SYS_STU_POSE)
-
-#define CMU_CSR_SYS_CMD_POSS 0U
-#define CMU_CSR_SYS_CMD_POSE 2U
-#define CMU_CSR_SYS_CMD_MSK BITS(CMU_CSR_SYS_CMD_POSS,CMU_CSR_SYS_CMD_POSE)
-
-/****************** Bit definition for CMU_CFGR register ************************/
-
-#define CMU_CFGR_HRCFST_POS 25U
-#define CMU_CFGR_HRCFST_MSK BIT(CMU_CFGR_HRCFST_POS)
-
-#define CMU_CFGR_HRCFSW_POS 24U
-#define CMU_CFGR_HRCFSW_MSK BIT(CMU_CFGR_HRCFSW_POS)
-
-#define CMU_CFGR_PCLK2DIV_POSS 20U
-#define CMU_CFGR_PCLK2DIV_POSE 23U
-#define CMU_CFGR_PCLK2DIV_MSK BITS(CMU_CFGR_PCLK2DIV_POSS,CMU_CFGR_PCLK2DIV_POSE)
-
-#define CMU_CFGR_PCLK1DIV_POSS 16U
-#define CMU_CFGR_PCLK1DIV_POSE 19U
-#define CMU_CFGR_PCLK1DIV_MSK BITS(CMU_CFGR_PCLK1DIV_POSS,CMU_CFGR_PCLK1DIV_POSE)
-
-#define CMU_CFGR_SYSDIV_POSS 12U
-#define CMU_CFGR_SYSDIV_POSE 15U
-#define CMU_CFGR_SYSDIV_MSK BITS(CMU_CFGR_SYSDIV_POSS,CMU_CFGR_SYSDIV_POSE)
-
-#define CMU_CFGR_HCLK1DIV_POSS 0U
-#define CMU_CFGR_HCLK1DIV_POSE 3U
-#define CMU_CFGR_HCLK1DIV_MSK BITS(CMU_CFGR_HCLK1DIV_POSS,CMU_CFGR_HCLK1DIV_POSE)
-
-/****************** Bit definition for CMU_CLKENR register ************************/
-
-#define CMU_CLKENR_PLL2EN_POS 9U
-#define CMU_CLKENR_PLL2EN_MSK BIT(CMU_CLKENR_PLL2EN_POS)
-
-#define CMU_CLKENR_PLL1EN_POS 8U
-#define CMU_CLKENR_PLL1EN_MSK BIT(CMU_CLKENR_PLL1EN_POS)
-
-#define CMU_CLKENR_ULRCEN_POS 4U
-#define CMU_CLKENR_ULRCEN_MSK BIT(CMU_CLKENR_ULRCEN_POS)
-
-#define CMU_CLKENR_LRCEN_POS 3U
-#define CMU_CLKENR_LRCEN_MSK BIT(CMU_CLKENR_LRCEN_POS)
-
-#define CMU_CLKENR_HRCEN_POS 2U
-#define CMU_CLKENR_HRCEN_MSK BIT(CMU_CLKENR_HRCEN_POS)
-
-#define CMU_CLKENR_LOSCEN_POS 1U
-#define CMU_CLKENR_LOSCEN_MSK BIT(CMU_CLKENR_LOSCEN_POS)
-
-#define CMU_CLKENR_HOSCEN_POS 0U
-#define CMU_CLKENR_HOSCEN_MSK BIT(CMU_CLKENR_HOSCEN_POS)
-
-/****************** Bit definition for CMU_CLKSR register ************************/
-
-#define CMU_CLKSR_PLL2RDY_POS 25U
-#define CMU_CLKSR_PLL2RDY_MSK BIT(CMU_CLKSR_PLL2RDY_POS)
-
-#define CMU_CLKSR_PLL1RDY_POS 24U
-#define CMU_CLKSR_PLL1RDY_MSK BIT(CMU_CLKSR_PLL1RDY_POS)
-
-#define CMU_CLKSR_LRCRDY_POS 19U
-#define CMU_CLKSR_LRCRDY_MSK BIT(CMU_CLKSR_LRCRDY_POS)
-
-#define CMU_CLKSR_HRCRDY_POS 18U
-#define CMU_CLKSR_HRCRDY_MSK BIT(CMU_CLKSR_HRCRDY_POS)
-
-#define CMU_CLKSR_LOSCRDY_POS 17U
-#define CMU_CLKSR_LOSCRDY_MSK BIT(CMU_CLKSR_LOSCRDY_POS)
-
-#define CMU_CLKSR_HOSCRDY_POS 16U
-#define CMU_CLKSR_HOSCRDY_MSK BIT(CMU_CLKSR_HOSCRDY_POS)
-
-#define CMU_CLKSR_PLL2ACT_POS 9U
-#define CMU_CLKSR_PLL2ACT_MSK BIT(CMU_CLKSR_PLL2ACT_POS)
-
-#define CMU_CLKSR_PLL1ACT_POS 8U
-#define CMU_CLKSR_PLL1ACT_MSK BIT(CMU_CLKSR_PLL1ACT_POS)
-
-#define CMU_CLKSR_ULRCACT_POS 4U
-#define CMU_CLKSR_ULRCACT_MSK BIT(CMU_CLKSR_ULRCACT_POS)
-
-#define CMU_CLKSR_LRCACT_POS 3U
-#define CMU_CLKSR_LRCACT_MSK BIT(CMU_CLKSR_LRCACT_POS)
-
-#define CMU_CLKSR_HRCACT_POS 2U
-#define CMU_CLKSR_HRCACT_MSK BIT(CMU_CLKSR_HRCACT_POS)
-
-#define CMU_CLKSR_LOSCACT_POS 1U
-#define CMU_CLKSR_LOSCACT_MSK BIT(CMU_CLKSR_LOSCACT_POS)
-
-#define CMU_CLKSR_HOSCACT_POS 0U
-#define CMU_CLKSR_HOSCACT_MSK BIT(CMU_CLKSR_HOSCACT_POS)
-
-/****************** Bit definition for CMU_PLLCFG register ************************/
-
-#define CMU_PLLCFG_PLL2LCKN_POS 17U
-#define CMU_PLLCFG_PLL2LCKN_MSK BIT(CMU_PLLCFG_PLL2LCKN_POS)
-
-#define CMU_PLLCFG_PLL1LCKN_POS 16U
-#define CMU_PLLCFG_PLL1LCKN_MSK BIT(CMU_PLLCFG_PLL1LCKN_POS)
-
-#define CMU_PLLCFG_PLL2RFS_POSS 8U
-#define CMU_PLLCFG_PLL2RFS_POSE 9U
-#define CMU_PLLCFG_PLL2RFS_MSK BITS(CMU_PLLCFG_PLL2RFS_POSS,CMU_PLLCFG_PLL2RFS_POSE)
-
-#define CMU_PLLCFG_PLL1OS_POS 4U
-#define CMU_PLLCFG_PLL1OS_MSK BIT(CMU_PLLCFG_PLL1OS_POS)
-
-#define CMU_PLLCFG_PLL1RFS_POSS 0U
-#define CMU_PLLCFG_PLL1RFS_POSE 2U
-#define CMU_PLLCFG_PLL1RFS_MSK BITS(CMU_PLLCFG_PLL1RFS_POSS,CMU_PLLCFG_PLL1RFS_POSE)
-
-/****************** Bit definition for CMU_HOSCCFG register ************************/
-
-#define CMU_HOSCCFG_FREQ_POSS 0U
-#define CMU_HOSCCFG_FREQ_POSE 4U
-#define CMU_HOSCCFG_FREQ_MSK BITS(CMU_HOSCCFG_FREQ_POSS,CMU_HOSCCFG_FREQ_POSE)
-
-/****************** Bit definition for CMU_HOSMCR register ************************/
-
-#define CMU_HOSMCR_NMIE_POS 20U
-#define CMU_HOSMCR_NMIE_MSK BIT(CMU_HOSMCR_NMIE_POS)
-
-#define CMU_HOSMCR_STPIF_POS 19U
-#define CMU_HOSMCR_STPIF_MSK BIT(CMU_HOSMCR_STPIF_POS)
-
-#define CMU_HOSMCR_STRIF_POS 18U
-#define CMU_HOSMCR_STRIF_MSK BIT(CMU_HOSMCR_STRIF_POS)
-
-#define CMU_HOSMCR_STPIE_POS 17U
-#define CMU_HOSMCR_STPIE_MSK BIT(CMU_HOSMCR_STPIE_POS)
-
-#define CMU_HOSMCR_STRIE_POS 16U
-#define CMU_HOSMCR_STRIE_MSK BIT(CMU_HOSMCR_STRIE_POS)
-
-#define CMU_HOSMCR_FRQS_POSS 8U
-#define CMU_HOSMCR_FRQS_POSE 10U
-#define CMU_HOSMCR_FRQS_MSK BITS(CMU_HOSMCR_FRQS_POSS,CMU_HOSMCR_FRQS_POSE)
-
-#define CMU_HOSMCR_CLKS_POS 1U
-#define CMU_HOSMCR_CLKS_MSK BIT(CMU_HOSMCR_CLKS_POS)
-
-#define CMU_HOSMCR_EN_POS 0U
-#define CMU_HOSMCR_EN_MSK BIT(CMU_HOSMCR_EN_POS)
-
-/****************** Bit definition for CMU_LOSMCR register ************************/
-
-#define CMU_LOSMCR_NMIE_POS 20U
-#define CMU_LOSMCR_NMIE_MSK BIT(CMU_LOSMCR_NMIE_POS)
-
-#define CMU_LOSMCR_STPIF_POS 19U
-#define CMU_LOSMCR_STPIF_MSK BIT(CMU_LOSMCR_STPIF_POS)
-
-#define CMU_LOSMCR_STRIF_POS 18U
-#define CMU_LOSMCR_STRIF_MSK BIT(CMU_LOSMCR_STRIF_POS)
-
-#define CMU_LOSMCR_STPIE_POS 17U
-#define CMU_LOSMCR_STPIE_MSK BIT(CMU_LOSMCR_STPIE_POS)
-
-#define CMU_LOSMCR_STRIE_POS 16U
-#define CMU_LOSMCR_STRIE_MSK BIT(CMU_LOSMCR_STRIE_POS)
-
-#define CMU_LOSMCR_CLKS_POS 1U
-#define CMU_LOSMCR_CLKS_MSK BIT(CMU_LOSMCR_CLKS_POS)
-
-#define CMU_LOSMCR_EN_POS 0U
-#define CMU_LOSMCR_EN_MSK BIT(CMU_LOSMCR_EN_POS)
-
-/****************** Bit definition for CMU_PULMCR register ************************/
-
-#define CMU_PULMCR_NMIE_POS 20U
-#define CMU_PULMCR_NMIE_MSK BIT(CMU_PULMCR_NMIE_POS)
-
-#define CMU_PULMCR_ULKIF_POS 19U
-#define CMU_PULMCR_ULKIF_MSK BIT(CMU_PULMCR_ULKIF_POS)
-
-#define CMU_PULMCR_LCKIF_POS 18U
-#define CMU_PULMCR_LCKIF_MSK BIT(CMU_PULMCR_LCKIF_POS)
-
-#define CMU_PULMCR_ULKIE_POS 17U
-#define CMU_PULMCR_ULKIE_MSK BIT(CMU_PULMCR_ULKIE_POS)
-
-#define CMU_PULMCR_LCKIE_POS 16U
-#define CMU_PULMCR_LCKIE_MSK BIT(CMU_PULMCR_LCKIE_POS)
-
-#define CMU_PULMCR_MODE_POSS 8U
-#define CMU_PULMCR_MODE_POSE 9U
-#define CMU_PULMCR_MODE_MSK BITS(CMU_PULMCR_MODE_POSS,CMU_PULMCR_MODE_POSE)
-
-#define CMU_PULMCR_CLKS_POS 1U
-#define CMU_PULMCR_CLKS_MSK BIT(CMU_PULMCR_CLKS_POS)
-
-#define CMU_PULMCR_EN_POS 0U
-#define CMU_PULMCR_EN_MSK BIT(CMU_PULMCR_EN_POS)
-
-/****************** Bit definition for CMU_CLKOCR register ************************/
-
-#define CMU_CLKOCR_LSCOS_POSS 24U
-#define CMU_CLKOCR_LSCOS_POSE 26U
-#define CMU_CLKOCR_LSCOS_MSK BITS(CMU_CLKOCR_LSCOS_POSS,CMU_CLKOCR_LSCOS_POSE)
-
-#define CMU_CLKOCR_LSCOEN_POS 16U
-#define CMU_CLKOCR_LSCOEN_MSK BIT(CMU_CLKOCR_LSCOEN_POS)
-
-#define CMU_CLKOCR_HSCODIV_POSS 12U
-#define CMU_CLKOCR_HSCODIV_POSE 14U
-#define CMU_CLKOCR_HSCODIV_MSK BITS(CMU_CLKOCR_HSCODIV_POSS,CMU_CLKOCR_HSCODIV_POSE)
-
-#define CMU_CLKOCR_HSCOS_POSS 8U
-#define CMU_CLKOCR_HSCOS_POSE 10U
-#define CMU_CLKOCR_HSCOS_MSK BITS(CMU_CLKOCR_HSCOS_POSS,CMU_CLKOCR_HSCOS_POSE)
-
-#define CMU_CLKOCR_HSCOEN_POS 0U
-#define CMU_CLKOCR_HSCOEN_MSK BIT(CMU_CLKOCR_HSCOEN_POS)
-
-/****************** Bit definition for CMU_BUZZCR register ************************/
-
-#define CMU_BUZZCR_DAT_POSS 16U
-#define CMU_BUZZCR_DAT_POSE 31U
-#define CMU_BUZZCR_DAT_MSK BITS(CMU_BUZZCR_DAT_POSS,CMU_BUZZCR_DAT_POSE)
-
-#define CMU_BUZZCR_DIV_POSS 8U
-#define CMU_BUZZCR_DIV_POSE 10U
-#define CMU_BUZZCR_DIV_MSK BITS(CMU_BUZZCR_DIV_POSS,CMU_BUZZCR_DIV_POSE)
-
-#define CMU_BUZZCR_EN_POS 0U
-#define CMU_BUZZCR_EN_MSK BIT(CMU_BUZZCR_EN_POS)
-
-/****************** Bit definition for CMU_AHB1ENR register ************************/
-
-#define CMU_AHB1ENR_PISEN_POS 5U
-#define CMU_AHB1ENR_PISEN_MSK BIT(CMU_AHB1ENR_PISEN_POS)
-
-#define CMU_AHB1ENR_TRNGEN_POS 4U
-#define CMU_AHB1ENR_TRNGEN_MSK BIT(CMU_AHB1ENR_TRNGEN_POS)
-
-#define CMU_AHB1ENR_CRYPTEN_POS 3U
-#define CMU_AHB1ENR_CRYPTEN_MSK BIT(CMU_AHB1ENR_CRYPTEN_POS)
-
-#define CMU_AHB1ENR_CALCEN_POS 2U
-#define CMU_AHB1ENR_CALCEN_MSK BIT(CMU_AHB1ENR_CALCEN_POS)
-
-#define CMU_AHB1ENR_CRCEN_POS 1U
-#define CMU_AHB1ENR_CRCEN_MSK BIT(CMU_AHB1ENR_CRCEN_POS)
-
-#define CMU_AHB1ENR_GPIOEN_POS 0U
-#define CMU_AHB1ENR_GPIOEN_MSK BIT(CMU_AHB1ENR_GPIOEN_POS)
-
-/****************** Bit definition for CMU_APB1ENR register ************************/
-
-#define CMU_APB1ENR_CAN0EN_POS 24U
-#define CMU_APB1ENR_CAN0EN_MSK BIT(CMU_APB1ENR_CAN0EN_POS)
-
-#define CMU_APB1ENR_I2C1EN_POS 21U
-#define CMU_APB1ENR_I2C1EN_MSK BIT(CMU_APB1ENR_I2C1EN_POS)
-
-#define CMU_APB1ENR_I2C0EN_POS 20U
-#define CMU_APB1ENR_I2C0EN_MSK BIT(CMU_APB1ENR_I2C0EN_POS)
-
-#define CMU_APB1ENR_SPI2EN_POS 18U
-#define CMU_APB1ENR_SPI2EN_MSK BIT(CMU_APB1ENR_SPI2EN_POS)
-
-#define CMU_APB1ENR_SPI1EN_POS 17U
-#define CMU_APB1ENR_SPI1EN_MSK BIT(CMU_APB1ENR_SPI1EN_POS)
-
-#define CMU_APB1ENR_SPI0EN_POS 16U
-#define CMU_APB1ENR_SPI0EN_MSK BIT(CMU_APB1ENR_SPI0EN_POS)
-
-#define CMU_APB1ENR_USART1EN_POS 13U
-#define CMU_APB1ENR_USART1EN_MSK BIT(CMU_APB1ENR_USART1EN_POS)
-
-#define CMU_APB1ENR_USART0EN_POS 12U
-#define CMU_APB1ENR_USART0EN_MSK BIT(CMU_APB1ENR_USART0EN_POS)
-
-#define CMU_APB1ENR_UART3EN_POS 11U
-#define CMU_APB1ENR_UART3EN_MSK BIT(CMU_APB1ENR_UART3EN_POS)
-
-#define CMU_APB1ENR_UART2EN_POS 10U
-#define CMU_APB1ENR_UART2EN_MSK BIT(CMU_APB1ENR_UART2EN_POS)
-
-#define CMU_APB1ENR_UART1EN_POS 9U
-#define CMU_APB1ENR_UART1EN_MSK BIT(CMU_APB1ENR_UART1EN_POS)
-
-#define CMU_APB1ENR_UART0EN_POS 8U
-#define CMU_APB1ENR_UART0EN_MSK BIT(CMU_APB1ENR_UART0EN_POS)
-
-#define CMU_APB1ENR_TIM7EN_POS 7U
-#define CMU_APB1ENR_TIM7EN_MSK BIT(CMU_APB1ENR_TIM7EN_POS)
-
-#define CMU_APB1ENR_TIM6EN_POS 6U
-#define CMU_APB1ENR_TIM6EN_MSK BIT(CMU_APB1ENR_TIM6EN_POS)
-
-#define CMU_APB1ENR_TIM5EN_POS 5U
-#define CMU_APB1ENR_TIM5EN_MSK BIT(CMU_APB1ENR_TIM5EN_POS)
-
-#define CMU_APB1ENR_TIM4EN_POS 4U
-#define CMU_APB1ENR_TIM4EN_MSK BIT(CMU_APB1ENR_TIM4EN_POS)
-
-#define CMU_APB1ENR_TIM3EN_POS 3U
-#define CMU_APB1ENR_TIM3EN_MSK BIT(CMU_APB1ENR_TIM3EN_POS)
-
-#define CMU_APB1ENR_TIM2EN_POS 2U
-#define CMU_APB1ENR_TIM2EN_MSK BIT(CMU_APB1ENR_TIM2EN_POS)
-
-#define CMU_APB1ENR_TIM1EN_POS 1U
-#define CMU_APB1ENR_TIM1EN_MSK BIT(CMU_APB1ENR_TIM1EN_POS)
-
-#define CMU_APB1ENR_TIM0EN_POS 0U
-#define CMU_APB1ENR_TIM0EN_MSK BIT(CMU_APB1ENR_TIM0EN_POS)
-
-/****************** Bit definition for CMU_APB2ENR register ************************/
-
-#define CMU_APB2ENR_DBGCEN_POS 19U
-#define CMU_APB2ENR_DBGCEN_MSK BIT(CMU_APB2ENR_DBGCEN_POS)
-
-#define CMU_APB2ENR_BKPCEN_POS 17U
-#define CMU_APB2ENR_BKPCEN_MSK BIT(CMU_APB2ENR_BKPCEN_POS)
-
-#define CMU_APB2ENR_TEMPEN_POS 16U
-#define CMU_APB2ENR_TEMPEN_MSK BIT(CMU_APB2ENR_TEMPEN_POS)
-
-#define CMU_APB2ENR_RTCEN_POS 15U
-#define CMU_APB2ENR_RTCEN_MSK BIT(CMU_APB2ENR_RTCEN_POS)
-
-#define CMU_APB2ENR_IWDTEN_POS 14U
-#define CMU_APB2ENR_IWDTEN_MSK BIT(CMU_APB2ENR_IWDTEN_POS)
-
-#define CMU_APB2ENR_LCDEN_POS 13U
-#define CMU_APB2ENR_LCDEN_MSK BIT(CMU_APB2ENR_LCDEN_POS)
-
-#define CMU_APB2ENR_WWDTEN_POS 12U
-#define CMU_APB2ENR_WWDTEN_MSK BIT(CMU_APB2ENR_WWDTEN_POS)
-
-#define CMU_APB2ENR_OPAMPEN_POS 8U
-#define CMU_APB2ENR_OPAMPEN_MSK BIT(CMU_APB2ENR_OPAMPEN_POS)
-
-#define CMU_APB2ENR_ACMP1EN_POS 7U
-#define CMU_APB2ENR_ACMP1EN_MSK BIT(CMU_APB2ENR_ACMP1EN_POS)
-
-#define CMU_APB2ENR_ACMP0EN_POS 6U
-#define CMU_APB2ENR_ACMP0EN_MSK BIT(CMU_APB2ENR_ACMP0EN_POS)
-
-#define CMU_APB2ENR_ADC0EN_POS 4U
-#define CMU_APB2ENR_ADC0EN_MSK BIT(CMU_APB2ENR_ADC0EN_POS)
-
-#define CMU_APB2ENR_LPUART0EN_POS 2U
-#define CMU_APB2ENR_LPUART0EN_MSK BIT(CMU_APB2ENR_LPUART0EN_POS)
-
-#define CMU_APB2ENR_LPTIM0EN_POS 0U
-#define CMU_APB2ENR_LPTIM0EN_MSK BIT(CMU_APB2ENR_LPTIM0EN_POS)
-
-/****************** Bit definition for CMU_LPENR register ************************/
-
-#define CMU_LPENR_HOSCEN_POS 3U
-#define CMU_LPENR_HOSCEN_MSK BIT(CMU_LPENR_HOSCEN_POS)
-
-#define CMU_LPENR_HRCEN_POS 2U
-#define CMU_LPENR_HRCEN_MSK BIT(CMU_LPENR_HRCEN_POS)
-
-#define CMU_LPENR_LOSCEN_POS 1U
-#define CMU_LPENR_LOSCEN_MSK BIT(CMU_LPENR_LOSCEN_POS)
-
-#define CMU_LPENR_LRCEN_POS 0U
-#define CMU_LPENR_LRCEN_MSK BIT(CMU_LPENR_LRCEN_POS)
-
-/****************** Bit definition for CMU_PERICR register ************************/
-
-#define CMU_PERICR_LCD_POSS 16U
-#define CMU_PERICR_LCD_POSE 18U
-#define CMU_PERICR_LCD_MSK BITS(CMU_PERICR_LCD_POSS,CMU_PERICR_LCD_POSE)
-
-#define CMU_PERICR_LPUART0_POSS 8U
-#define CMU_PERICR_LPUART0_POSE 11U
-#define CMU_PERICR_LPUART0_MSK BITS(CMU_PERICR_LPUART0_POSS,CMU_PERICR_LPUART0_POSE)
-
-#define CMU_PERICR_LPTIM0_POSS 0U
-#define CMU_PERICR_LPTIM0_POSE 3U
-#define CMU_PERICR_LPTIM0_MSK BITS(CMU_PERICR_LPTIM0_POSS,CMU_PERICR_LPTIM0_POSE)
-
-/****************** Bit definition for CMU_HRCACR register ************************/
-
-#define CMU_HRCACR_IB_POSS 28U
-#define CMU_HRCACR_IB_POSE 29U
-#define CMU_HRCACR_IB_MSK BITS(CMU_HRCACR_IB_POSS,CMU_HRCACR_IB_POSE)
-
-#define CMU_HRCACR_CAP_POSS 26U
-#define CMU_HRCACR_CAP_POSE 27U
-#define CMU_HRCACR_CAP_MSK BITS(CMU_HRCACR_CAP_POSS,CMU_HRCACR_CAP_POSE)
-
-#define CMU_HRCACR_CAL_POSS 16U
-#define CMU_HRCACR_CAL_POSE 25U
-#define CMU_HRCACR_CAL_MSK BITS(CMU_HRCACR_CAL_POSS,CMU_HRCACR_CAL_POSE)
-
-#define CMU_HRCACR_IBSET_POSS 14U
-#define CMU_HRCACR_IBSET_POSE 15U
-#define CMU_HRCACR_IBSET_MSK BITS(CMU_HRCACR_IBSET_POSS,CMU_HRCACR_IBSET_POSE)
-
-#define CMU_HRCACR_CAPSET_POSS 12U
-#define CMU_HRCACR_CAPSET_POSE 13U
-#define CMU_HRCACR_CAPSET_MSK BITS(CMU_HRCACR_CAPSET_POSS,CMU_HRCACR_CAPSET_POSE)
-
-#define CMU_HRCACR_STA_POSS 9U
-#define CMU_HRCACR_STA_POSE 10U
-#define CMU_HRCACR_STA_MSK BITS(CMU_HRCACR_STA_POSS,CMU_HRCACR_STA_POSE)
-
-#define CMU_HRCACR_BUSY_POS 8U
-#define CMU_HRCACR_BUSY_MSK BIT(CMU_HRCACR_BUSY_POS)
-
-#define CMU_HRCACR_WRTRG_POS 7U
-#define CMU_HRCACR_WRTRG_MSK BIT(CMU_HRCACR_WRTRG_POS)
-
-#define CMU_HRCACR_AC_POSS 4U
-#define CMU_HRCACR_AC_POSE 6U
-#define CMU_HRCACR_AC_MSK BITS(CMU_HRCACR_AC_POSS,CMU_HRCACR_AC_POSE)
-
-#define CMU_HRCACR_IBS_POS 3U
-#define CMU_HRCACR_IBS_MSK BIT(CMU_HRCACR_IBS_POS)
-
-#define CMU_HRCACR_RFSEL_POS 2U
-#define CMU_HRCACR_RFSEL_MSK BIT(CMU_HRCACR_RFSEL_POS)
-
-#define CMU_HRCACR_FREQ_POS 1U
-#define CMU_HRCACR_FREQ_MSK BIT(CMU_HRCACR_FREQ_POS)
-
-#define CMU_HRCACR_EN_POS 0U
-#define CMU_HRCACR_EN_MSK BIT(CMU_HRCACR_EN_POS)
-
-typedef struct
-{
- __O uint32_t CSR;
- __IO uint32_t CFGR;
- uint32_t RESERVED0[2] ;
- __IO uint32_t CLKENR;
- __I uint32_t CLKSR;
- __IO uint32_t PLLCFG;
- __IO uint32_t HOSCCFG;
- __IO uint32_t HOSMCR;
- __IO uint32_t LOSMCR;
- __IO uint32_t PULMCR;
- uint32_t RESERVED1 ;
- __IO uint32_t CLKOCR;
- __IO uint32_t BUZZCR;
- uint32_t RESERVED2[2] ;
- __IO uint32_t AHB1ENR;
- uint32_t RESERVED3[3] ;
- __IO uint32_t APB1ENR;
- __IO uint32_t APB2ENR;
- uint32_t RESERVED4[2] ;
- __IO uint32_t LPENR;
- uint32_t RESERVED5[7] ;
- __IO uint32_t PERICR;
- uint32_t RESERVED6[3] ;
- __IO uint32_t HRCACR;
-} CMU_TypeDef;
-
-/****************** Bit definition for DMA_STATUS register ************************/
-
-#define DMA_STATUS_STATUS_POSS 4U
-#define DMA_STATUS_STATUS_POSE 7U
-#define DMA_STATUS_STATUS_MSK BITS(DMA_STATUS_STATUS_POSS,DMA_STATUS_STATUS_POSE)
-
-#define DMA_STATUS_MASTER_ENABLE_POS 0U
-#define DMA_STATUS_MASTER_ENABLE_MSK BIT(DMA_STATUS_MASTER_ENABLE_POS)
-
-/****************** Bit definition for DMA_CFG register ************************/
-
-#define DMA_CFG_CHNL_PROT_CTRL_POSS 5U
-#define DMA_CFG_CHNL_PROT_CTRL_POSE 7U
-#define DMA_CFG_CHNL_PROT_CTRL_MSK BITS(DMA_CFG_CHNL_PROT_CTRL_POSS,DMA_CFG_CHNL_PROT_CTRL_POSE)
-
-#define DMA_CFG_MASTER_ENABLE_POS 0U
-#define DMA_CFG_MASTER_ENABLE_MSK BIT(DMA_CFG_MASTER_ENABLE_POS)
-
-/****************** Bit definition for DMA_CTRLBASE register ************************/
-
-#define DMA_CTRLBASE_CTRL_BASE_PTR_POSS 9U
-#define DMA_CTRLBASE_CTRL_BASE_PTR_POSE 31U
-#define DMA_CTRLBASE_CTRL_BASE_PTR_MSK BITS(DMA_CTRLBASE_CTRL_BASE_PTR_POSS,DMA_CTRLBASE_CTRL_BASE_PTR_POSE)
-
-/****************** Bit definition for DMA_ALTCTRLBASE register ************************/
-
-#define DMA_ALTCTRLBASE_ALT_CTRL_BASE_PTR_POSS 0U
-#define DMA_ALTCTRLBASE_ALT_CTRL_BASE_PTR_POSE 31U
-#define DMA_ALTCTRLBASE_ALT_CTRL_BASE_PTR_MSK BITS(DMA_ALTCTRLBASE_ALT_CTRL_BASE_PTR_POSS,DMA_ALTCTRLBASE_ALT_CTRL_BASE_PTR_POSE)
-
-/****************** Bit definition for DMA_CHWAITSTATUS register ************************/
-
-#define DMA_CHWAITSTATUS_DMA_WAITONREQ_STATUS_POSS 0U
-#define DMA_CHWAITSTATUS_DMA_WAITONREQ_STATUS_POSE 31U
-#define DMA_CHWAITSTATUS_DMA_WAITONREQ_STATUS_MSK BITS(DMA_CHWAITSTATUS_DMA_WAITONREQ_STATUS_POSS,DMA_CHWAITSTATUS_DMA_WAITONREQ_STATUS_POSE)
-
-/****************** Bit definition for DMA_CHSWREQ register ************************/
-
-#define DMA_CHSWREQ_CHSWREQ_POSS 0U
-#define DMA_CHSWREQ_CHSWREQ_POSE 31U
-#define DMA_CHSWREQ_CHSWREQ_MSK BITS(DMA_CHSWREQ_CHSWREQ_POSS,DMA_CHSWREQ_CHSWREQ_POSE)
-
-/****************** Bit definition for DMA_CHUSEBURSTSET register ************************/
-
-#define DMA_CHUSEBURSTSET_CHNL_USEBURST_SET_POSS 0U
-#define DMA_CHUSEBURSTSET_CHNL_USEBURST_SET_POSE 31U
-#define DMA_CHUSEBURSTSET_CHNL_USEBURST_SET_MSK BITS(DMA_CHUSEBURSTSET_CHNL_USEBURST_SET_POSS,DMA_CHUSEBURSTSET_CHNL_USEBURST_SET_POSE)
-
-/****************** Bit definition for DMA_CHUSEBURSTCLR register ************************/
-
-#define DMA_CHUSEBURSTCLR_CHNL_USEBURST_CLR_POSS 0U
-#define DMA_CHUSEBURSTCLR_CHNL_USEBURST_CLR_POSE 31U
-#define DMA_CHUSEBURSTCLR_CHNL_USEBURST_CLR_MSK BITS(DMA_CHUSEBURSTCLR_CHNL_USEBURST_CLR_POSS,DMA_CHUSEBURSTCLR_CHNL_USEBURST_CLR_POSE)
-
-/****************** Bit definition for DMA_CHREQMASKSET register ************************/
-
-#define DMA_CHREQMASKSET_CHNL_REQ_MASK_SET_POSS 0U
-#define DMA_CHREQMASKSET_CHNL_REQ_MASK_SET_POSE 31U
-#define DMA_CHREQMASKSET_CHNL_REQ_MASK_SET_MSK BITS(DMA_CHREQMASKSET_CHNL_REQ_MASK_SET_POSS,DMA_CHREQMASKSET_CHNL_REQ_MASK_SET_POSE)
-
-/****************** Bit definition for DMA_CHREQMASKCLR register ************************/
-
-#define DMA_CHREQMASKCLR_CHNL_REQ_MASK_CLR_POSS 0U
-#define DMA_CHREQMASKCLR_CHNL_REQ_MASK_CLR_POSE 31U
-#define DMA_CHREQMASKCLR_CHNL_REQ_MASK_CLR_MSK BITS(DMA_CHREQMASKCLR_CHNL_REQ_MASK_CLR_POSS,DMA_CHREQMASKCLR_CHNL_REQ_MASK_CLR_POSE)
-
-/****************** Bit definition for DMA_CHENSET register ************************/
-
-#define DMA_CHENSET_CHNL_ENABLE_SET_POSS 0U
-#define DMA_CHENSET_CHNL_ENABLE_SET_POSE 31U
-#define DMA_CHENSET_CHNL_ENABLE_SET_MSK BITS(DMA_CHENSET_CHNL_ENABLE_SET_POSS,DMA_CHENSET_CHNL_ENABLE_SET_POSE)
-
-/****************** Bit definition for DMA_CHENCLR register ************************/
-
-#define DMA_CHENCLR_CHNL_ENABLE_CLR_POSS 0U
-#define DMA_CHENCLR_CHNL_ENABLE_CLR_POSE 31U
-#define DMA_CHENCLR_CHNL_ENABLE_CLR_MSK BITS(DMA_CHENCLR_CHNL_ENABLE_CLR_POSS,DMA_CHENCLR_CHNL_ENABLE_CLR_POSE)
-
-/****************** Bit definition for DMA_CHPRIALTSET register ************************/
-
-#define DMA_CHPRIALTSET_CHNL_PRI_ALT_SET_POSS 0U
-#define DMA_CHPRIALTSET_CHNL_PRI_ALT_SET_POSE 31U
-#define DMA_CHPRIALTSET_CHNL_PRI_ALT_SET_MSK BITS(DMA_CHPRIALTSET_CHNL_PRI_ALT_SET_POSS,DMA_CHPRIALTSET_CHNL_PRI_ALT_SET_POSE)
-
-/****************** Bit definition for DMA_CHPRIALTCLR register ************************/
-
-#define DMA_CHPRIALTCLR_CHNL_PRI_ALT_CLR_POSS 0U
-#define DMA_CHPRIALTCLR_CHNL_PRI_ALT_CLR_POSE 31U
-#define DMA_CHPRIALTCLR_CHNL_PRI_ALT_CLR_MSK BITS(DMA_CHPRIALTCLR_CHNL_PRI_ALT_CLR_POSS,DMA_CHPRIALTCLR_CHNL_PRI_ALT_CLR_POSE)
-
-/****************** Bit definition for DMA_CHPRSET register ************************/
-
-#define DMA_CHPRSET_CHNL_PRIORITY_SET_POSS 0U
-#define DMA_CHPRSET_CHNL_PRIORITY_SET_POSE 31U
-#define DMA_CHPRSET_CHNL_PRIORITY_SET_MSK BITS(DMA_CHPRSET_CHNL_PRIORITY_SET_POSS,DMA_CHPRSET_CHNL_PRIORITY_SET_POSE)
-
-/****************** Bit definition for DMA_CHPRCLR register ************************/
-
-#define DMA_CHPRCLR_CHNL_PRIORITY_CLR_POSS 0U
-#define DMA_CHPRCLR_CHNL_PRIORITY_CLR_POSE 31U
-#define DMA_CHPRCLR_CHNL_PRIORITY_CLR_MSK BITS(DMA_CHPRCLR_CHNL_PRIORITY_CLR_POSS,DMA_CHPRCLR_CHNL_PRIORITY_CLR_POSE)
-
-/****************** Bit definition for DMA_ERRCLR register ************************/
-
-#define DMA_ERRCLR_ERR_CLR_POS 0U
-#define DMA_ERRCLR_ERR_CLR_MSK BIT(DMA_ERRCLR_ERR_CLR_POS)
-
-/****************** Bit definition for DMA_IFLAG register ************************/
-
-#define DMA_IFLAG_DMAERRIF_POS 31U
-#define DMA_IFLAG_DMAERRIF_MSK BIT(DMA_IFLAG_DMAERRIF_POS)
-
-#define DMA_IFLAG_CH5DONEIF_POS 5U
-#define DMA_IFLAG_CH5DONEIF_MSK BIT(DMA_IFLAG_CH5DONEIF_POS)
-
-#define DMA_IFLAG_CH4DONEIF_POS 4U
-#define DMA_IFLAG_CH4DONEIF_MSK BIT(DMA_IFLAG_CH4DONEIF_POS)
-
-#define DMA_IFLAG_CH3DONEIF_POS 3U
-#define DMA_IFLAG_CH3DONEIF_MSK BIT(DMA_IFLAG_CH3DONEIF_POS)
-
-#define DMA_IFLAG_CH2DONEIF_POS 2U
-#define DMA_IFLAG_CH2DONEIF_MSK BIT(DMA_IFLAG_CH2DONEIF_POS)
-
-#define DMA_IFLAG_CH1DONEIF_POS 1U
-#define DMA_IFLAG_CH1DONEIF_MSK BIT(DMA_IFLAG_CH1DONEIF_POS)
-
-#define DMA_IFLAG_CH0DONEIF_POS 0U
-#define DMA_IFLAG_CH0DONEIF_MSK BIT(DMA_IFLAG_CH0DONEIF_POS)
-
-/****************** Bit definition for DMA_ICFR register ************************/
-
-#define DMA_ICFR_DMAERRC_POS 31U
-#define DMA_ICFR_DMAERRC_MSK BIT(DMA_ICFR_DMAERRC_POS)
-
-#define DMA_ICFR_CH5DONEC_POS 5U
-#define DMA_ICFR_CH5DONEC_MSK BIT(DMA_ICFR_CH5DONEC_POS)
-
-#define DMA_ICFR_CH4DONEC_POS 4U
-#define DMA_ICFR_CH4DONEC_MSK BIT(DMA_ICFR_CH4DONEC_POS)
-
-#define DMA_ICFR_CH3DONEC_POS 3U
-#define DMA_ICFR_CH3DONEC_MSK BIT(DMA_ICFR_CH3DONEC_POS)
-
-#define DMA_ICFR_CH2DONEC_POS 2U
-#define DMA_ICFR_CH2DONEC_MSK BIT(DMA_ICFR_CH2DONEC_POS)
-
-#define DMA_ICFR_CH1DONEC_POS 1U
-#define DMA_ICFR_CH1DONEC_MSK BIT(DMA_ICFR_CH1DONEC_POS)
-
-#define DMA_ICFR_CH0DONEC_POS 0U
-#define DMA_ICFR_CH0DONEC_MSK BIT(DMA_ICFR_CH0DONEC_POS)
-
-/****************** Bit definition for DMA_IER register ************************/
-
-#define DMA_IER_DMAERRIE_POS 31U
-#define DMA_IER_DMAERRIE_MSK BIT(DMA_IER_DMAERRIE_POS)
-
-#define DMA_IER_CH5DONEIE_POS 5U
-#define DMA_IER_CH5DONEIE_MSK BIT(DMA_IER_CH5DONEIE_POS)
-
-#define DMA_IER_CH4DONEIE_POS 4U
-#define DMA_IER_CH4DONEIE_MSK BIT(DMA_IER_CH4DONEIE_POS)
-
-#define DMA_IER_CH3DONEIE_POS 3U
-#define DMA_IER_CH3DONEIE_MSK BIT(DMA_IER_CH3DONEIE_POS)
-
-#define DMA_IER_CH2DONEIE_POS 2U
-#define DMA_IER_CH2DONEIE_MSK BIT(DMA_IER_CH2DONEIE_POS)
-
-#define DMA_IER_CH1DONEIE_POS 1U
-#define DMA_IER_CH1DONEIE_MSK BIT(DMA_IER_CH1DONEIE_POS)
-
-#define DMA_IER_CH0DONEIE_POS 0U
-#define DMA_IER_CH0DONEIE_MSK BIT(DMA_IER_CH0DONEIE_POS)
-
-/****************** Bit definition for DMA_CH0_SELCON register ************************/
-
-#define DMA_CH0_SELCON_MSEL_POSS 8U
-#define DMA_CH0_SELCON_MSEL_POSE 13U
-#define DMA_CH0_SELCON_MSEL_MSK BITS(DMA_CH0_SELCON_MSEL_POSS,DMA_CH0_SELCON_MSEL_POSE)
-
-#define DMA_CH0_SELCON_MSIGSEL_POSS 0U
-#define DMA_CH0_SELCON_MSIGSEL_POSE 3U
-#define DMA_CH0_SELCON_MSIGSEL_MSK BITS(DMA_CH0_SELCON_MSIGSEL_POSS,DMA_CH0_SELCON_MSIGSEL_POSE)
-
-typedef struct
-{
- __I uint32_t STATUS;
- __IO uint32_t CFG;
- __IO uint32_t CTRLBASE;
- __I uint32_t ALTCTRLBASE;
- __I uint32_t CHWAITSTATUS;
- __IO uint32_t CHSWREQ;
- __IO uint32_t CHUSEBURSTSET;
- __O uint32_t CHUSEBURSTCLR;
- __IO uint32_t CHREQMASKSET;
- __O uint32_t CHREQMASKCLR;
- __IO uint32_t CHENSET;
- __O uint32_t CHENCLR;
- __IO uint32_t CHPRIALTSET;
- __O uint32_t CHPRIALTCLR;
- __IO uint32_t CHPRSET;
- __O uint32_t CHPRCLR;
- uint32_t RESERVED0[3] ;
- __IO uint32_t ERRCLR;
- uint32_t RESERVED1[1004] ;
- __I uint32_t IFLAG;
- uint32_t RESERVED2 ;
- __O uint32_t ICFR;
- __IO uint32_t IER;
- uint32_t RESERVED3[60] ;
- __IO uint32_t CH_SELCON[6];
-} DMA_TypeDef;
-
-/****************** Bit definition for PIS_CH0_CON register ************************/
-
-#define PIS_CH0_CON_SYNCSEL_POSS 24U
-#define PIS_CH0_CON_SYNCSEL_POSE 26U
-#define PIS_CH0_CON_SYNCSEL_MSK BITS(PIS_CH0_CON_SYNCSEL_POSS,PIS_CH0_CON_SYNCSEL_POSE)
-
-#define PIS_CH0_CON_PULCK_POSS 18U
-#define PIS_CH0_CON_PULCK_POSE 19U
-#define PIS_CH0_CON_PULCK_MSK BITS(PIS_CH0_CON_PULCK_POSS,PIS_CH0_CON_PULCK_POSE)
-
-#define PIS_CH0_CON_EDGS_POSS 16U
-#define PIS_CH0_CON_EDGS_POSE 17U
-#define PIS_CH0_CON_EDGS_MSK BITS(PIS_CH0_CON_EDGS_POSS,PIS_CH0_CON_EDGS_POSE)
-
-#define PIS_CH0_CON_SRCS_POSS 8U
-#define PIS_CH0_CON_SRCS_POSE 13U
-#define PIS_CH0_CON_SRCS_MSK BITS(PIS_CH0_CON_SRCS_POSS,PIS_CH0_CON_SRCS_POSE)
-
-#define PIS_CH0_CON_MSIGS_POSS 0U
-#define PIS_CH0_CON_MSIGS_POSE 3U
-#define PIS_CH0_CON_MSIGS_MSK BITS(PIS_CH0_CON_MSIGS_POSS,PIS_CH0_CON_MSIGS_POSE)
-
-/****************** Bit definition for PIS_CH_OER register ************************/
-
-#define PIS_CH_OER_CH3OE_POS 3U
-#define PIS_CH_OER_CH3OE_MSK BIT(PIS_CH_OER_CH3OE_POS)
-
-#define PIS_CH_OER_CH2OE_POS 2U
-#define PIS_CH_OER_CH2OE_MSK BIT(PIS_CH_OER_CH2OE_POS)
-
-#define PIS_CH_OER_CH1OE_POS 1U
-#define PIS_CH_OER_CH1OE_MSK BIT(PIS_CH_OER_CH1OE_POS)
-
-#define PIS_CH_OER_CH0OE_POS 0U
-#define PIS_CH_OER_CH0OE_MSK BIT(PIS_CH_OER_CH0OE_POS)
-
-/****************** Bit definition for PIS_TAR_CON0 register ************************/
-
-#define PIS_TAR_CON0_TIM3_CH2IN_SEL_POS 25U
-#define PIS_TAR_CON0_TIM3_CH2IN_SEL_MSK BIT(PIS_TAR_CON0_TIM3_CH2IN_SEL_POS)
-
-#define PIS_TAR_CON0_TIM3_CH1IN_SEL_POS 24U
-#define PIS_TAR_CON0_TIM3_CH1IN_SEL_MSK BIT(PIS_TAR_CON0_TIM3_CH1IN_SEL_POS)
-
-#define PIS_TAR_CON0_TIM2_CH2IN_SEL_POS 17U
-#define PIS_TAR_CON0_TIM2_CH2IN_SEL_MSK BIT(PIS_TAR_CON0_TIM2_CH2IN_SEL_POS)
-
-#define PIS_TAR_CON0_TIM2_CH1IN_SEL_POS 16U
-#define PIS_TAR_CON0_TIM2_CH1IN_SEL_MSK BIT(PIS_TAR_CON0_TIM2_CH1IN_SEL_POS)
-
-#define PIS_TAR_CON0_TIM0_BRKIN_SEL_POS 4U
-#define PIS_TAR_CON0_TIM0_BRKIN_SEL_MSK BIT(PIS_TAR_CON0_TIM0_BRKIN_SEL_POS)
-
-#define PIS_TAR_CON0_TIM0_CH4IN_SEL_POS 3U
-#define PIS_TAR_CON0_TIM0_CH4IN_SEL_MSK BIT(PIS_TAR_CON0_TIM0_CH4IN_SEL_POS)
-
-#define PIS_TAR_CON0_TIM0_CH3IN_SEL_POS 2U
-#define PIS_TAR_CON0_TIM0_CH3IN_SEL_MSK BIT(PIS_TAR_CON0_TIM0_CH3IN_SEL_POS)
-
-#define PIS_TAR_CON0_TIM0_CH2IN_SEL_POS 1U
-#define PIS_TAR_CON0_TIM0_CH2IN_SEL_MSK BIT(PIS_TAR_CON0_TIM0_CH2IN_SEL_POS)
-
-#define PIS_TAR_CON0_TIM0_CH1IN_SEL_POS 0U
-#define PIS_TAR_CON0_TIM0_CH1IN_SEL_MSK BIT(PIS_TAR_CON0_TIM0_CH1IN_SEL_POS)
-
-/****************** Bit definition for PIS_TAR_CON1 register ************************/
-
-#define PIS_TAR_CON1_SPI1_CLK_SEL_POS 15U
-#define PIS_TAR_CON1_SPI1_CLK_SEL_MSK BIT(PIS_TAR_CON1_SPI1_CLK_SEL_POS)
-
-#define PIS_TAR_CON1_SPI1_RX_SEL_POS 14U
-#define PIS_TAR_CON1_SPI1_RX_SEL_MSK BIT(PIS_TAR_CON1_SPI1_RX_SEL_POS)
-
-#define PIS_TAR_CON1_SPI0_CLK_SEL_POS 13U
-#define PIS_TAR_CON1_SPI0_CLK_SEL_MSK BIT(PIS_TAR_CON1_SPI0_CLK_SEL_POS)
-
-#define PIS_TAR_CON1_SPI0_RX_SEL_POS 12U
-#define PIS_TAR_CON1_SPI0_RX_SEL_MSK BIT(PIS_TAR_CON1_SPI0_RX_SEL_POS)
-
-#define PIS_TAR_CON1_LPUART0_RXD_SEL_POS 8U
-#define PIS_TAR_CON1_LPUART0_RXD_SEL_MSK BIT(PIS_TAR_CON1_LPUART0_RXD_SEL_POS)
-
-#define PIS_TAR_CON1_USART1_RXD_SEL_POS 7U
-#define PIS_TAR_CON1_USART1_RXD_SEL_MSK BIT(PIS_TAR_CON1_USART1_RXD_SEL_POS)
-
-#define PIS_TAR_CON1_USART0_RXD_SEL_POS 6U
-#define PIS_TAR_CON1_USART0_RXD_SEL_MSK BIT(PIS_TAR_CON1_USART0_RXD_SEL_POS)
-
-#define PIS_TAR_CON1_UART3_RXD_SEL_POS 3U
-#define PIS_TAR_CON1_UART3_RXD_SEL_MSK BIT(PIS_TAR_CON1_UART3_RXD_SEL_POS)
-
-#define PIS_TAR_CON1_UART2_RXD_SEL_POS 2U
-#define PIS_TAR_CON1_UART2_RXD_SEL_MSK BIT(PIS_TAR_CON1_UART2_RXD_SEL_POS)
-
-#define PIS_TAR_CON1_UART1_RXD_SEL_POS 1U
-#define PIS_TAR_CON1_UART1_RXD_SEL_MSK BIT(PIS_TAR_CON1_UART1_RXD_SEL_POS)
-
-#define PIS_TAR_CON1_UART0_RXD_SEL_POS 0U
-#define PIS_TAR_CON1_UART0_RXD_SEL_MSK BIT(PIS_TAR_CON1_UART0_RXD_SEL_POS)
-
-/****************** Bit definition for PIS_TXMCR register ************************/
-
-#define PIS_TXMCR_TXMLVLS_POS 8U
-#define PIS_TXMCR_TXMLVLS_MSK BIT(PIS_TXMCR_TXMLVLS_POS)
-
-#define PIS_TXMCR_TXMSS_POSS 4U
-#define PIS_TXMCR_TXMSS_POSE 7U
-#define PIS_TXMCR_TXMSS_MSK BITS(PIS_TXMCR_TXMSS_POSS,PIS_TXMCR_TXMSS_POSE)
-
-#define PIS_TXMCR_TXSIGS_POSS 0U
-#define PIS_TXMCR_TXSIGS_POSE 3U
-#define PIS_TXMCR_TXSIGS_MSK BITS(PIS_TXMCR_TXSIGS_POSS,PIS_TXMCR_TXSIGS_POSE)
-
-typedef struct
-{
- __IO uint32_t CH_CON[8];
- uint32_t RESERVED0[8] ;
- __IO uint32_t CH_OER;
- __IO uint32_t TAR_CON0;
- __IO uint32_t TAR_CON1;
- uint32_t RESERVED1[5] ;
- __IO uint32_t UART0_TXMCR;
- __IO uint32_t UART1_TXMCR;
- __IO uint32_t UART2_TXMCR;
- __IO uint32_t UART3_TXMCR;
- __IO uint32_t LPUART0_TXMCR;
-} PIS_TypeDef;
-
-/****************** Bit definition for GPIO_DIN register ************************/
-
-#define GPIO_DIN_DIN_POSS 0U
-#define GPIO_DIN_DIN_POSE 15U
-#define GPIO_DIN_DIN_MSK BITS(GPIO_DIN_DIN_POSS,GPIO_DIN_DIN_POSE)
-
-/****************** Bit definition for GPIO_DOUT register ************************/
-
-#define GPIO_DOUT_DOUT_POSS 0U
-#define GPIO_DOUT_DOUT_POSE 15U
-#define GPIO_DOUT_DOUT_MSK BITS(GPIO_DOUT_DOUT_POSS,GPIO_DOUT_DOUT_POSE)
-
-/****************** Bit definition for GPIO_BSRR register ************************/
-
-#define GPIO_BSRR_BRR_POSS 16U
-#define GPIO_BSRR_BRR_POSE 31U
-#define GPIO_BSRR_BRR_MSK BITS(GPIO_BSRR_BRR_POSS,GPIO_BSRR_BRR_POSE)
-
-#define GPIO_BSRR_BSR_POSS 0U
-#define GPIO_BSRR_BSR_POSE 15U
-#define GPIO_BSRR_BSR_MSK BITS(GPIO_BSRR_BSR_POSS,GPIO_BSRR_BSR_POSE)
-
-/****************** Bit definition for GPIO_BIR register ************************/
-
-#define GPIO_BIR_BIR_POSS 0U
-#define GPIO_BIR_BIR_POSE 15U
-#define GPIO_BIR_BIR_MSK BITS(GPIO_BIR_BIR_POSS,GPIO_BIR_BIR_POSE)
-
-/****************** Bit definition for GPIO_MODE register ************************/
-
-#define GPIO_MODE_MODE_POSS 0U
-#define GPIO_MODE_MODE_POSE 31U
-#define GPIO_MODE_MODE_MSK BITS(GPIO_MODE_MODE_POSS,GPIO_MODE_MODE_POSE)
-
-/****************** Bit definition for GPIO_ODOS register ************************/
-
-#define GPIO_ODOS_ODOS_POSS 0U
-#define GPIO_ODOS_ODOS_POSE 31U
-#define GPIO_ODOS_ODOS_MSK BITS(GPIO_ODOS_ODOS_POSS,GPIO_ODOS_ODOS_POSE)
-
-/****************** Bit definition for GPIO_PUPD register ************************/
-
-#define GPIO_PUPD_PUPD_POSS 0U
-#define GPIO_PUPD_PUPD_POSE 31U
-#define GPIO_PUPD_PUPD_MSK BITS(GPIO_PUPD_PUPD_POSS,GPIO_PUPD_PUPD_POSE)
-
-/****************** Bit definition for GPIO_ODRV register ************************/
-
-#define GPIO_ODRV_ODRV_POSS 0U
-#define GPIO_ODRV_ODRV_POSE 31U
-#define GPIO_ODRV_ODRV_MSK BITS(GPIO_ODRV_ODRV_POSS,GPIO_ODRV_ODRV_POSE)
-
-/****************** Bit definition for GPIO_FLT register ************************/
-
-#define GPIO_FLT_FLT_POSS 0U
-#define GPIO_FLT_FLT_POSE 15U
-#define GPIO_FLT_FLT_MSK BITS(GPIO_FLT_FLT_POSS,GPIO_FLT_FLT_POSE)
-
-/****************** Bit definition for GPIO_TYPE register ************************/
-
-#define GPIO_TYPE_TYPE_POSS 0U
-#define GPIO_TYPE_TYPE_POSE 15U
-#define GPIO_TYPE_TYPE_MSK BITS(GPIO_TYPE_TYPE_POSS,GPIO_TYPE_TYPE_POSE)
-
-/****************** Bit definition for GPIO_FUNC0 register ************************/
-
-#define GPIO_FUNC0_FSEL_IO7_POSS 28U
-#define GPIO_FUNC0_FSEL_IO7_POSE 31U
-#define GPIO_FUNC0_FSEL_IO7_MSK BITS(GPIO_FUNC0_FSEL_IO7_POSS,GPIO_FUNC0_FSEL_IO7_POSE)
-
-#define GPIO_FUNC0_FSEL_IO6_POSS 24U
-#define GPIO_FUNC0_FSEL_IO6_POSE 27U
-#define GPIO_FUNC0_FSEL_IO6_MSK BITS(GPIO_FUNC0_FSEL_IO6_POSS,GPIO_FUNC0_FSEL_IO6_POSE)
-
-#define GPIO_FUNC0_FSEL_IO5_POSS 20U
-#define GPIO_FUNC0_FSEL_IO5_POSE 23U
-#define GPIO_FUNC0_FSEL_IO5_MSK BITS(GPIO_FUNC0_FSEL_IO5_POSS,GPIO_FUNC0_FSEL_IO5_POSE)
-
-#define GPIO_FUNC0_FSEL_IO4_POSS 16U
-#define GPIO_FUNC0_FSEL_IO4_POSE 19U
-#define GPIO_FUNC0_FSEL_IO4_MSK BITS(GPIO_FUNC0_FSEL_IO4_POSS,GPIO_FUNC0_FSEL_IO4_POSE)
-
-#define GPIO_FUNC0_FSEL_IO3_POSS 12U
-#define GPIO_FUNC0_FSEL_IO3_POSE 15U
-#define GPIO_FUNC0_FSEL_IO3_MSK BITS(GPIO_FUNC0_FSEL_IO3_POSS,GPIO_FUNC0_FSEL_IO3_POSE)
-
-#define GPIO_FUNC0_FSEL_IO2_POSS 8U
-#define GPIO_FUNC0_FSEL_IO2_POSE 11U
-#define GPIO_FUNC0_FSEL_IO2_MSK BITS(GPIO_FUNC0_FSEL_IO2_POSS,GPIO_FUNC0_FSEL_IO2_POSE)
-
-#define GPIO_FUNC0_FSEL_IO1_POSS 4U
-#define GPIO_FUNC0_FSEL_IO1_POSE 7U
-#define GPIO_FUNC0_FSEL_IO1_MSK BITS(GPIO_FUNC0_FSEL_IO1_POSS,GPIO_FUNC0_FSEL_IO1_POSE)
-
-#define GPIO_FUNC0_FSEL_IO0_POSS 0U
-#define GPIO_FUNC0_FSEL_IO0_POSE 3U
-#define GPIO_FUNC0_FSEL_IO0_MSK BITS(GPIO_FUNC0_FSEL_IO0_POSS,GPIO_FUNC0_FSEL_IO0_POSE)
-
-/****************** Bit definition for GPIO_FUNC1 register ************************/
-
-#define GPIO_FUNC1_FSEL_IO15_POSS 28U
-#define GPIO_FUNC1_FSEL_IO15_POSE 31U
-#define GPIO_FUNC1_FSEL_IO15_MSK BITS(GPIO_FUNC1_FSEL_IO15_POSS,GPIO_FUNC1_FSEL_IO15_POSE)
-
-#define GPIO_FUNC1_FSEL_IO14_POSS 24U
-#define GPIO_FUNC1_FSEL_IO14_POSE 27U
-#define GPIO_FUNC1_FSEL_IO14_MSK BITS(GPIO_FUNC1_FSEL_IO14_POSS,GPIO_FUNC1_FSEL_IO14_POSE)
-
-#define GPIO_FUNC1_FSEL_IO13_POSS 20U
-#define GPIO_FUNC1_FSEL_IO13_POSE 23U
-#define GPIO_FUNC1_FSEL_IO13_MSK BITS(GPIO_FUNC1_FSEL_IO13_POSS,GPIO_FUNC1_FSEL_IO13_POSE)
-
-#define GPIO_FUNC1_FSEL_IO12_POSS 16U
-#define GPIO_FUNC1_FSEL_IO12_POSE 19U
-#define GPIO_FUNC1_FSEL_IO12_MSK BITS(GPIO_FUNC1_FSEL_IO12_POSS,GPIO_FUNC1_FSEL_IO12_POSE)
-
-#define GPIO_FUNC1_FSEL_IO11_POSS 12U
-#define GPIO_FUNC1_FSEL_IO11_POSE 15U
-#define GPIO_FUNC1_FSEL_IO11_MSK BITS(GPIO_FUNC1_FSEL_IO11_POSS,GPIO_FUNC1_FSEL_IO11_POSE)
-
-#define GPIO_FUNC1_FSEL_IO10_POSS 8U
-#define GPIO_FUNC1_FSEL_IO10_POSE 11U
-#define GPIO_FUNC1_FSEL_IO10_MSK BITS(GPIO_FUNC1_FSEL_IO10_POSS,GPIO_FUNC1_FSEL_IO10_POSE)
-
-#define GPIO_FUNC1_FSEL_IO9_POSS 4U
-#define GPIO_FUNC1_FSEL_IO9_POSE 7U
-#define GPIO_FUNC1_FSEL_IO9_MSK BITS(GPIO_FUNC1_FSEL_IO9_POSS,GPIO_FUNC1_FSEL_IO9_POSE)
-
-#define GPIO_FUNC1_FSEL_IO8_POSS 0U
-#define GPIO_FUNC1_FSEL_IO8_POSE 3U
-#define GPIO_FUNC1_FSEL_IO8_MSK BITS(GPIO_FUNC1_FSEL_IO8_POSS,GPIO_FUNC1_FSEL_IO8_POSE)
-
-/****************** Bit definition for GPIO_LOCK register ************************/
-
-#define GPIO_LOCK_KEY_POSS 16U
-#define GPIO_LOCK_KEY_POSE 31U
-#define GPIO_LOCK_KEY_MSK BITS(GPIO_LOCK_KEY_POSS,GPIO_LOCK_KEY_POSE)
-
-#define GPIO_LOCK_LOCK_POSS 0U
-#define GPIO_LOCK_LOCK_POSE 15U
-#define GPIO_LOCK_LOCK_MSK BITS(GPIO_LOCK_LOCK_POSS,GPIO_LOCK_LOCK_POSE)
-
-typedef struct
-{
- __I uint32_t DIN;
- __IO uint32_t DOUT;
- __O uint32_t BSRR;
- __O uint32_t BIR;
- __IO uint32_t MODE;
- __IO uint32_t ODOS;
- __IO uint32_t PUPD;
- __IO uint32_t ODRV;
- __IO uint32_t FLT;
- __IO uint32_t TYPE;
- __IO uint32_t FUNC0;
- __IO uint32_t FUNC1;
- __IO uint32_t LOCK;
-} GPIO_TypeDef;
-
-/****************** Bit definition for GPIO_EXTIRER register ************************/
-
-#define GPIO_EXTIRER_EXTIRER_POSS 0U
-#define GPIO_EXTIRER_EXTIRER_POSE 15U
-#define GPIO_EXTIRER_EXTIRER_MSK BITS(GPIO_EXTIRER_EXTIRER_POSS,GPIO_EXTIRER_EXTIRER_POSE)
-
-/****************** Bit definition for GPIO_EXTIFER register ************************/
-
-#define GPIO_EXTIFER_EXTIFER_POSS 0U
-#define GPIO_EXTIFER_EXTIFER_POSE 15U
-#define GPIO_EXTIFER_EXTIFER_MSK BITS(GPIO_EXTIFER_EXTIFER_POSS,GPIO_EXTIFER_EXTIFER_POSE)
-
-/****************** Bit definition for GPIO_EXTIEN register ************************/
-
-#define GPIO_EXTIEN_EXTIEN_POSS 0U
-#define GPIO_EXTIEN_EXTIEN_POSE 15U
-#define GPIO_EXTIEN_EXTIEN_MSK BITS(GPIO_EXTIEN_EXTIEN_POSS,GPIO_EXTIEN_EXTIEN_POSE)
-
-/****************** Bit definition for GPIO_EXTIFLAG register ************************/
-
-#define GPIO_EXTIFLAG_EXTIFLAG_POSS 0U
-#define GPIO_EXTIFLAG_EXTIFLAG_POSE 15U
-#define GPIO_EXTIFLAG_EXTIFLAG_MSK BITS(GPIO_EXTIFLAG_EXTIFLAG_POSS,GPIO_EXTIFLAG_EXTIFLAG_POSE)
-
-/****************** Bit definition for GPIO_EXTISFR register ************************/
-
-#define GPIO_EXTISFR_EXTISFR_POSS 0U
-#define GPIO_EXTISFR_EXTISFR_POSE 15U
-#define GPIO_EXTISFR_EXTISFR_MSK BITS(GPIO_EXTISFR_EXTISFR_POSS,GPIO_EXTISFR_EXTISFR_POSE)
-
-/****************** Bit definition for GPIO_EXTICFR register ************************/
-
-#define GPIO_EXTICFR_EXTICFR_POSS 0U
-#define GPIO_EXTICFR_EXTICFR_POSE 15U
-#define GPIO_EXTICFR_EXTICFR_MSK BITS(GPIO_EXTICFR_EXTICFR_POSS,GPIO_EXTICFR_EXTICFR_POSE)
-
-/****************** Bit definition for GPIO_EXTIPSR0 register ************************/
-
-#define GPIO_EXTIPSR0_EXTIS7_POSS 28U
-#define GPIO_EXTIPSR0_EXTIS7_POSE 30U
-#define GPIO_EXTIPSR0_EXTIS7_MSK BITS(GPIO_EXTIPSR0_EXTIS7_POSS,GPIO_EXTIPSR0_EXTIS7_POSE)
-
-#define GPIO_EXTIPSR0_EXTIS6_POSS 24U
-#define GPIO_EXTIPSR0_EXTIS6_POSE 26U
-#define GPIO_EXTIPSR0_EXTIS6_MSK BITS(GPIO_EXTIPSR0_EXTIS6_POSS,GPIO_EXTIPSR0_EXTIS6_POSE)
-
-#define GPIO_EXTIPSR0_EXTIS5_POSS 20U
-#define GPIO_EXTIPSR0_EXTIS5_POSE 22U
-#define GPIO_EXTIPSR0_EXTIS5_MSK BITS(GPIO_EXTIPSR0_EXTIS5_POSS,GPIO_EXTIPSR0_EXTIS5_POSE)
-
-#define GPIO_EXTIPSR0_EXTIS4_POSS 16U
-#define GPIO_EXTIPSR0_EXTIS4_POSE 18U
-#define GPIO_EXTIPSR0_EXTIS4_MSK BITS(GPIO_EXTIPSR0_EXTIS4_POSS,GPIO_EXTIPSR0_EXTIS4_POSE)
-
-#define GPIO_EXTIPSR0_EXTIS3_POSS 12U
-#define GPIO_EXTIPSR0_EXTIS3_POSE 14U
-#define GPIO_EXTIPSR0_EXTIS3_MSK BITS(GPIO_EXTIPSR0_EXTIS3_POSS,GPIO_EXTIPSR0_EXTIS3_POSE)
-
-#define GPIO_EXTIPSR0_EXTIS2_POSS 8U
-#define GPIO_EXTIPSR0_EXTIS2_POSE 10U
-#define GPIO_EXTIPSR0_EXTIS2_MSK BITS(GPIO_EXTIPSR0_EXTIS2_POSS,GPIO_EXTIPSR0_EXTIS2_POSE)
-
-#define GPIO_EXTIPSR0_EXTIS1_POSS 4U
-#define GPIO_EXTIPSR0_EXTIS1_POSE 6U
-#define GPIO_EXTIPSR0_EXTIS1_MSK BITS(GPIO_EXTIPSR0_EXTIS1_POSS,GPIO_EXTIPSR0_EXTIS1_POSE)
-
-#define GPIO_EXTIPSR0_EXTIS0_POSS 0U
-#define GPIO_EXTIPSR0_EXTIS0_POSE 2U
-#define GPIO_EXTIPSR0_EXTIS0_MSK BITS(GPIO_EXTIPSR0_EXTIS0_POSS,GPIO_EXTIPSR0_EXTIS0_POSE)
-
-/****************** Bit definition for GPIO_EXTIPSR1 register ************************/
-
-#define GPIO_EXTIPSR1_EXTIS15_POSS 28U
-#define GPIO_EXTIPSR1_EXTIS15_POSE 30U
-#define GPIO_EXTIPSR1_EXTIS15_MSK BITS(GPIO_EXTIPSR1_EXTIS15_POSS,GPIO_EXTIPSR1_EXTIS15_POSE)
-
-#define GPIO_EXTIPSR1_EXTIS14_POSS 24U
-#define GPIO_EXTIPSR1_EXTIS14_POSE 26U
-#define GPIO_EXTIPSR1_EXTIS14_MSK BITS(GPIO_EXTIPSR1_EXTIS14_POSS,GPIO_EXTIPSR1_EXTIS14_POSE)
-
-#define GPIO_EXTIPSR1_EXTIS13_POSS 20U
-#define GPIO_EXTIPSR1_EXTIS13_POSE 22U
-#define GPIO_EXTIPSR1_EXTIS13_MSK BITS(GPIO_EXTIPSR1_EXTIS13_POSS,GPIO_EXTIPSR1_EXTIS13_POSE)
-
-#define GPIO_EXTIPSR1_EXTIS12_POSS 16U
-#define GPIO_EXTIPSR1_EXTIS12_POSE 18U
-#define GPIO_EXTIPSR1_EXTIS12_MSK BITS(GPIO_EXTIPSR1_EXTIS12_POSS,GPIO_EXTIPSR1_EXTIS12_POSE)
-
-#define GPIO_EXTIPSR1_EXTIS11_POSS 12U
-#define GPIO_EXTIPSR1_EXTIS11_POSE 14U
-#define GPIO_EXTIPSR1_EXTIS11_MSK BITS(GPIO_EXTIPSR1_EXTIS11_POSS,GPIO_EXTIPSR1_EXTIS11_POSE)
-
-#define GPIO_EXTIPSR1_EXTIS10_POSS 8U
-#define GPIO_EXTIPSR1_EXTIS10_POSE 10U
-#define GPIO_EXTIPSR1_EXTIS10_MSK BITS(GPIO_EXTIPSR1_EXTIS10_POSS,GPIO_EXTIPSR1_EXTIS10_POSE)
-
-#define GPIO_EXTIPSR1_EXTIS9_POSS 4U
-#define GPIO_EXTIPSR1_EXTIS9_POSE 6U
-#define GPIO_EXTIPSR1_EXTIS9_MSK BITS(GPIO_EXTIPSR1_EXTIS9_POSS,GPIO_EXTIPSR1_EXTIS9_POSE)
-
-#define GPIO_EXTIPSR1_EXTIS8_POSS 0U
-#define GPIO_EXTIPSR1_EXTIS8_POSE 2U
-#define GPIO_EXTIPSR1_EXTIS8_MSK BITS(GPIO_EXTIPSR1_EXTIS8_POSS,GPIO_EXTIPSR1_EXTIS8_POSE)
-
-/****************** Bit definition for GPIO_EXTIFLTCR register ************************/
-
-#define GPIO_EXTIFLTCR_FLTCKS_POSS 24U
-#define GPIO_EXTIFLTCR_FLTCKS_POSE 25U
-#define GPIO_EXTIFLTCR_FLTCKS_MSK BITS(GPIO_EXTIFLTCR_FLTCKS_POSS,GPIO_EXTIFLTCR_FLTCKS_POSE)
-
-#define GPIO_EXTIFLTCR_FLTSEL_POSS 16U
-#define GPIO_EXTIFLTCR_FLTSEL_POSE 23U
-#define GPIO_EXTIFLTCR_FLTSEL_MSK BITS(GPIO_EXTIFLTCR_FLTSEL_POSS,GPIO_EXTIFLTCR_FLTSEL_POSE)
-
-#define GPIO_EXTIFLTCR_FLTEN_POSS 0U
-#define GPIO_EXTIFLTCR_FLTEN_POSE 15U
-#define GPIO_EXTIFLTCR_FLTEN_MSK BITS(GPIO_EXTIFLTCR_FLTEN_POSS,GPIO_EXTIFLTCR_FLTEN_POSE)
-
-typedef struct
-{
- __IO uint32_t EXTIRER;
- uint32_t RESERVED0 ;
- __IO uint32_t EXTIFER;
- uint32_t RESERVED1 ;
- __IO uint32_t EXTIEN;
- uint32_t RESERVED2 ;
- __I uint32_t EXTIFLAG;
- uint32_t RESERVED3 ;
- __O uint32_t EXTISFR;
- uint32_t RESERVED4 ;
- __O uint32_t EXTICFR;
- uint32_t RESERVED5 ;
- __IO uint32_t EXTIPSR0;
- __IO uint32_t EXTIPSR1;
- uint32_t RESERVED6[2] ;
- __IO uint32_t EXTIFLTCR;
-} EXTI_TypeDef;
-
-/****************** Bit definition for RTC_WPR register ************************/
-
-#define RTC_WPR_WP_POS 0U
-#define RTC_WPR_WP_MSK BIT(RTC_WPR_WP_POS)
-
-/****************** Bit definition for RTC_CON register ************************/
-
-#define RTC_CON_SSEC_POS 25U
-#define RTC_CON_SSEC_MSK BIT(RTC_CON_SSEC_POS)
-
-#define RTC_CON_BUSY_POS 24U
-#define RTC_CON_BUSY_MSK BIT(RTC_CON_BUSY_POS)
-
-#define RTC_CON_POL_POS 22U
-#define RTC_CON_POL_MSK BIT(RTC_CON_POL_POS)
-
-#define RTC_CON_EOS_POSS 20U
-#define RTC_CON_EOS_POSE 21U
-#define RTC_CON_EOS_MSK BITS(RTC_CON_EOS_POSS,RTC_CON_EOS_POSE)
-
-#define RTC_CON_CKOS_POSS 17U
-#define RTC_CON_CKOS_POSE 19U
-#define RTC_CON_CKOS_MSK BITS(RTC_CON_CKOS_POSS,RTC_CON_CKOS_POSE)
-
-#define RTC_CON_CKOE_POS 16U
-#define RTC_CON_CKOE_MSK BIT(RTC_CON_CKOE_POS)
-
-#define RTC_CON_WUCKS_POSS 13U
-#define RTC_CON_WUCKS_POSE 15U
-#define RTC_CON_WUCKS_MSK BITS(RTC_CON_WUCKS_POSS,RTC_CON_WUCKS_POSE)
-
-#define RTC_CON_WUTE_POS 12U
-#define RTC_CON_WUTE_MSK BIT(RTC_CON_WUTE_POS)
-
-#define RTC_CON_DSTS_POS 10U
-#define RTC_CON_DSTS_MSK BIT(RTC_CON_DSTS_POS)
-
-#define RTC_CON_SUB1H_POS 9U
-#define RTC_CON_SUB1H_MSK BIT(RTC_CON_SUB1H_POS)
-
-#define RTC_CON_ADD1H_POS 8U
-#define RTC_CON_ADD1H_MSK BIT(RTC_CON_ADD1H_POS)
-
-#define RTC_CON_TSPIN_POS 7U
-#define RTC_CON_TSPIN_MSK BIT(RTC_CON_TSPIN_POS)
-
-#define RTC_CON_TSSEL_POS 6U
-#define RTC_CON_TSSEL_MSK BIT(RTC_CON_TSSEL_POS)
-
-#define RTC_CON_TSEN_POS 5U
-#define RTC_CON_TSEN_MSK BIT(RTC_CON_TSEN_POS)
-
-#define RTC_CON_SHDBP_POS 4U
-#define RTC_CON_SHDBP_MSK BIT(RTC_CON_SHDBP_POS)
-
-#define RTC_CON_HFM_POS 3U
-#define RTC_CON_HFM_MSK BIT(RTC_CON_HFM_POS)
-
-#define RTC_CON_ALMBEN_POS 2U
-#define RTC_CON_ALMBEN_MSK BIT(RTC_CON_ALMBEN_POS)
-
-#define RTC_CON_ALMAEN_POS 1U
-#define RTC_CON_ALMAEN_MSK BIT(RTC_CON_ALMAEN_POS)
-
-#define RTC_CON_GO_POS 0U
-#define RTC_CON_GO_MSK BIT(RTC_CON_GO_POS)
-
-/****************** Bit definition for RTC_PSR register ************************/
-
-#define RTC_PSR_APRS_POSS 16U
-#define RTC_PSR_APRS_POSE 22U
-#define RTC_PSR_APRS_MSK BITS(RTC_PSR_APRS_POSS,RTC_PSR_APRS_POSE)
-
-#define RTC_PSR_SPRS_POSS 0U
-#define RTC_PSR_SPRS_POSE 14U
-#define RTC_PSR_SPRS_MSK BITS(RTC_PSR_SPRS_POSS,RTC_PSR_SPRS_POSE)
-
-/****************** Bit definition for RTC_TAMPCON register ************************/
-
-#define RTC_TAMPCON_TAMPFLT_POSS 20U
-#define RTC_TAMPCON_TAMPFLT_POSE 21U
-#define RTC_TAMPCON_TAMPFLT_MSK BITS(RTC_TAMPCON_TAMPFLT_POSS,RTC_TAMPCON_TAMPFLT_POSE)
-
-#define RTC_TAMPCON_TAMPCKS_POSS 17U
-#define RTC_TAMPCON_TAMPCKS_POSE 19U
-#define RTC_TAMPCON_TAMPCKS_MSK BITS(RTC_TAMPCON_TAMPCKS_POSS,RTC_TAMPCON_TAMPCKS_POSE)
-
-#define RTC_TAMPCON_TAMPTS_POS 16U
-#define RTC_TAMPCON_TAMPTS_MSK BIT(RTC_TAMPCON_TAMPTS_POS)
-
-#define RTC_TAMPCON_TAMP2LV_POS 9U
-#define RTC_TAMPCON_TAMP2LV_MSK BIT(RTC_TAMPCON_TAMP2LV_POS)
-
-#define RTC_TAMPCON_TAMP2EN_POS 8U
-#define RTC_TAMPCON_TAMP2EN_MSK BIT(RTC_TAMPCON_TAMP2EN_POS)
-
-#define RTC_TAMPCON_TAMP1LV_POS 1U
-#define RTC_TAMPCON_TAMP1LV_MSK BIT(RTC_TAMPCON_TAMP1LV_POS)
-
-#define RTC_TAMPCON_TAMP1EN_POS 0U
-#define RTC_TAMPCON_TAMP1EN_MSK BIT(RTC_TAMPCON_TAMP1EN_POS)
-
-/****************** Bit definition for RTC_TIME register ************************/
-
-#define RTC_TIME_PM_POS 22U
-#define RTC_TIME_PM_MSK BIT(RTC_TIME_PM_POS)
-
-#define RTC_TIME_HRT_POSS 20U
-#define RTC_TIME_HRT_POSE 21U
-#define RTC_TIME_HRT_MSK BITS(RTC_TIME_HRT_POSS,RTC_TIME_HRT_POSE)
-
-#define RTC_TIME_HRU_POSS 16U
-#define RTC_TIME_HRU_POSE 19U
-#define RTC_TIME_HRU_MSK BITS(RTC_TIME_HRU_POSS,RTC_TIME_HRU_POSE)
-
-#define RTC_TIME_MINT_POSS 12U
-#define RTC_TIME_MINT_POSE 14U
-#define RTC_TIME_MINT_MSK BITS(RTC_TIME_MINT_POSS,RTC_TIME_MINT_POSE)
-
-#define RTC_TIME_MINU_POSS 8U
-#define RTC_TIME_MINU_POSE 11U
-#define RTC_TIME_MINU_MSK BITS(RTC_TIME_MINU_POSS,RTC_TIME_MINU_POSE)
-
-#define RTC_TIME_SECT_POSS 4U
-#define RTC_TIME_SECT_POSE 6U
-#define RTC_TIME_SECT_MSK BITS(RTC_TIME_SECT_POSS,RTC_TIME_SECT_POSE)
-
-#define RTC_TIME_SECU_POSS 0U
-#define RTC_TIME_SECU_POSE 3U
-#define RTC_TIME_SECU_MSK BITS(RTC_TIME_SECU_POSS,RTC_TIME_SECU_POSE)
-
-/****************** Bit definition for RTC_DATE register ************************/
-
-#define RTC_DATE_WD_POSS 24U
-#define RTC_DATE_WD_POSE 26U
-#define RTC_DATE_WD_MSK BITS(RTC_DATE_WD_POSS,RTC_DATE_WD_POSE)
-
-#define RTC_DATE_YRT_POSS 20U
-#define RTC_DATE_YRT_POSE 23U
-#define RTC_DATE_YRT_MSK BITS(RTC_DATE_YRT_POSS,RTC_DATE_YRT_POSE)
-
-#define RTC_DATE_YRU_POSS 16U
-#define RTC_DATE_YRU_POSE 19U
-#define RTC_DATE_YRU_MSK BITS(RTC_DATE_YRU_POSS,RTC_DATE_YRU_POSE)
-
-#define RTC_DATE_MONT_POS 12U
-#define RTC_DATE_MONT_MSK BIT(RTC_DATE_MONT_POS)
-
-#define RTC_DATE_MONU_POSS 8U
-#define RTC_DATE_MONU_POSE 11U
-#define RTC_DATE_MONU_MSK BITS(RTC_DATE_MONU_POSS,RTC_DATE_MONU_POSE)
-
-#define RTC_DATE_DAYT_POSS 4U
-#define RTC_DATE_DAYT_POSE 5U
-#define RTC_DATE_DAYT_MSK BITS(RTC_DATE_DAYT_POSS,RTC_DATE_DAYT_POSE)
-
-#define RTC_DATE_DAYU_POSS 0U
-#define RTC_DATE_DAYU_POSE 3U
-#define RTC_DATE_DAYU_MSK BITS(RTC_DATE_DAYU_POSS,RTC_DATE_DAYU_POSE)
-
-/****************** Bit definition for RTC_SSEC register ************************/
-
-#define RTC_SSEC_VAL_POSS 0U
-#define RTC_SSEC_VAL_POSE 15U
-#define RTC_SSEC_VAL_MSK BITS(RTC_SSEC_VAL_POSS,RTC_SSEC_VAL_POSE)
-
-/****************** Bit definition for RTC_WUMAT register ************************/
-
-#define RTC_WUMAT_VAL_POSS 0U
-#define RTC_WUMAT_VAL_POSE 15U
-#define RTC_WUMAT_VAL_MSK BITS(RTC_WUMAT_VAL_POSS,RTC_WUMAT_VAL_POSE)
-
-/****************** Bit definition for RTC_ALMA register ************************/
-
-#define RTC_ALMA_WDS_POS 31U
-#define RTC_ALMA_WDS_MSK BIT(RTC_ALMA_WDS_POS)
-
-#define RTC_ALMA_DAWD_POSS 24U
-#define RTC_ALMA_DAWD_POSE 30U
-#define RTC_ALMA_DAWD_MSK BITS(RTC_ALMA_DAWD_POSS,RTC_ALMA_DAWD_POSE)
-
-#define RTC_ALMA_DAYMSK_POS 30U
-#define RTC_ALMA_DAYMSK_MSK BIT(RTC_ALMA_DAYMSK_POS)
-
-#define RTC_ALMA_DAWD_DAYT_POSS 28U
-#define RTC_ALMA_DAWD_DAYT_POSE 29U
-#define RTC_ALMA_DAWD_DAYT_MSK BITS(RTC_ALMA_DAWD_DAYT_POSS, RTC_ALMA_DAWD_DAYT_POSE)
-
-#define RTC_ALMA_DAWD_DAYU_POSS 24U
-#define RTC_ALMA_DAWD_DAYU_POSE 27U
-#define RTC_ALMA_DAWD_DAYU_MSK BITS(RTC_ALMA_DAWD_DAYU_POSS, RTC_ALMA_DAWD_DAYU_POSE)
-
-#define RTC_ALMA_HRMSK_POS 23U
-#define RTC_ALMA_HRMSK_MSK BIT(RTC_ALMA_HRMSK_POS)
-
-#define RTC_ALMA_PM_POS 22U
-#define RTC_ALMA_PM_MSK BIT(RTC_ALMA_PM_POS)
-
-#define RTC_ALMA_HRT_POSS 20U
-#define RTC_ALMA_HRT_POSE 21U
-#define RTC_ALMA_HRT_MSK BITS(RTC_ALMA_HRT_POSS,RTC_ALMA_HRT_POSE)
-
-#define RTC_ALMA_HRU_POSS 16U
-#define RTC_ALMA_HRU_POSE 19U
-#define RTC_ALMA_HRU_MSK BITS(RTC_ALMA_HRU_POSS,RTC_ALMA_HRU_POSE)
-
-#define RTC_ALMA_MINMSK_POS 15U
-#define RTC_ALMA_MINMSK_MSK BIT(RTC_ALMA_MINMSK_POS)
-
-#define RTC_ALMA_MINT_POSS 12U
-#define RTC_ALMA_MINT_POSE 14U
-#define RTC_ALMA_MINT_MSK BITS(RTC_ALMA_MINT_POSS,RTC_ALMA_MINT_POSE)
-
-#define RTC_ALMA_MINU_POSS 8U
-#define RTC_ALMA_MINU_POSE 11U
-#define RTC_ALMA_MINU_MSK BITS(RTC_ALMA_MINU_POSS,RTC_ALMA_MINU_POSE)
-
-#define RTC_ALMA_SECMSK_POS 7U
-#define RTC_ALMA_SECMSK_MSK BIT(RTC_ALMA_SECMSK_POS)
-
-#define RTC_ALMA_SECT_POSS 4U
-#define RTC_ALMA_SECT_POSE 6U
-#define RTC_ALMA_SECT_MSK BITS(RTC_ALMA_SECT_POSS,RTC_ALMA_SECT_POSE)
-
-#define RTC_ALMA_SECU_POSS 0U
-#define RTC_ALMA_SECU_POSE 3U
-#define RTC_ALMA_SECU_MSK BITS(RTC_ALMA_SECU_POSS,RTC_ALMA_SECU_POSE)
-
-/****************** Bit definition for RTC_ALMB register ************************/
-
-#define RTC_ALMB_WDS_POS 31U
-#define RTC_ALMB_WDS_MSK BIT(RTC_ALMB_WDS_POS)
-
-#define RTC_ALMB_DAWD_POSS 24U
-#define RTC_ALMB_DAWD_POSE 30U
-#define RTC_ALMB_DAWD_MSK BITS(RTC_ALMB_DAWD_POSS,RTC_ALMB_DAWD_POSE)
-
-#define RTC_ALMB_DAYMSK_POS 30U
-#define RTC_ALMB_DAYMSK_MSK BIT(RTC_ALMB_DAYMSK_POS)
-
-#define RTC_ALMB_DAWD_DAYT_POSS 28U
-#define RTC_ALMB_DAWD_DAYT_POSE 29U
-#define RTC_ALMB_DAWD_DAYT_MSK BITS(RTC_ALMB_DAWD_DAYT_POSS, RTC_ALMB_DAWD_DAYT_POSE)
-
-#define RTC_ALMB_DAWD_DAYU_POSS 24U
-#define RTC_ALMB_DAWD_DAYU_POSE 27U
-#define RTC_ALMB_DAWD_DAYU_MSK BITS(RTC_ALMB_DAWD_DAYU_POSS, RTC_ALMB_DAWD_DAYU_POSE)
-
-#define RTC_ALMB_HRMSK_POS 23U
-#define RTC_ALMB_HRMSK_MSK BIT(RTC_ALMB_HRMSK_POS)
-
-#define RTC_ALMB_PM_POS 22U
-#define RTC_ALMB_PM_MSK BIT(RTC_ALMB_PM_POS)
-
-#define RTC_ALMB_HRT_POSS 20U
-#define RTC_ALMB_HRT_POSE 21U
-#define RTC_ALMB_HRT_MSK BITS(RTC_ALMB_HRT_POSS,RTC_ALMB_HRT_POSE)
-
-#define RTC_ALMB_HRU_POSS 16U
-#define RTC_ALMB_HRU_POSE 19U
-#define RTC_ALMB_HRU_MSK BITS(RTC_ALMB_HRU_POSS,RTC_ALMB_HRU_POSE)
-
-#define RTC_ALMB_MINMSK_POS 15U
-#define RTC_ALMB_MINMSK_MSK BIT(RTC_ALMB_MINMSK_POS)
-
-#define RTC_ALMB_MINT_POSS 12U
-#define RTC_ALMB_MINT_POSE 14U
-#define RTC_ALMB_MINT_MSK BITS(RTC_ALMB_MINT_POSS,RTC_ALMB_MINT_POSE)
-
-#define RTC_ALMB_MINU_POSS 8U
-#define RTC_ALMB_MINU_POSE 11U
-#define RTC_ALMB_MINU_MSK BITS(RTC_ALMB_MINU_POSS,RTC_ALMB_MINU_POSE)
-
-#define RTC_ALMB_SECMSK_POS 7U
-#define RTC_ALMB_SECMSK_MSK BIT(RTC_ALMB_SECMSK_POS)
-
-#define RTC_ALMB_SECT_POSS 4U
-#define RTC_ALMB_SECT_POSE 6U
-#define RTC_ALMB_SECT_MSK BITS(RTC_ALMB_SECT_POSS,RTC_ALMB_SECT_POSE)
-
-#define RTC_ALMB_SECU_POSS 0U
-#define RTC_ALMB_SECU_POSE 3U
-#define RTC_ALMB_SECU_MSK BITS(RTC_ALMB_SECU_POSS,RTC_ALMB_SECU_POSE)
-
-/****************** Bit definition for RTC_ALMASSEC register ************************/
-
-#define RTC_ALMASSEC_SSECM_POSS 24U
-#define RTC_ALMASSEC_SSECM_POSE 27U
-#define RTC_ALMASSEC_SSECM_MSK BITS(RTC_ALMASSEC_SSECM_POSS,RTC_ALMASSEC_SSECM_POSE)
-
-#define RTC_ALMASSEC_SSEC_POSS 0U
-#define RTC_ALMASSEC_SSEC_POSE 14U
-#define RTC_ALMASSEC_SSEC_MSK BITS(RTC_ALMASSEC_SSEC_POSS,RTC_ALMASSEC_SSEC_POSE)
-
-/****************** Bit definition for RTC_ALMBSSEC register ************************/
-
-#define RTC_ALMBSSEC_SSECM_POSS 24U
-#define RTC_ALMBSSEC_SSECM_POSE 27U
-#define RTC_ALMBSSEC_SSECM_MSK BITS(RTC_ALMBSSEC_SSECM_POSS,RTC_ALMBSSEC_SSECM_POSE)
-
-#define RTC_ALMBSSEC_SSEC_POSS 0U
-#define RTC_ALMBSSEC_SSEC_POSE 14U
-#define RTC_ALMBSSEC_SSEC_MSK BITS(RTC_ALMBSSEC_SSEC_POSS,RTC_ALMBSSEC_SSEC_POSE)
-
-/****************** Bit definition for RTC_TSTIME register ************************/
-
-#define RTC_TSTIME_PM_POS 22U
-#define RTC_TSTIME_PM_MSK BIT(RTC_TSTIME_PM_POS)
-
-#define RTC_TSTIME_HRT_POSS 20U
-#define RTC_TSTIME_HRT_POSE 21U
-#define RTC_TSTIME_HRT_MSK BITS(RTC_TSTIME_HRT_POSS,RTC_TSTIME_HRT_POSE)
-
-#define RTC_TSTIME_HRU_POSS 16U
-#define RTC_TSTIME_HRU_POSE 19U
-#define RTC_TSTIME_HRU_MSK BITS(RTC_TSTIME_HRU_POSS,RTC_TSTIME_HRU_POSE)
-
-#define RTC_TSTIME_MINT_POSS 12U
-#define RTC_TSTIME_MINT_POSE 14U
-#define RTC_TSTIME_MINT_MSK BITS(RTC_TSTIME_MINT_POSS,RTC_TSTIME_MINT_POSE)
-
-#define RTC_TSTIME_MINU_POSS 8U
-#define RTC_TSTIME_MINU_POSE 11U
-#define RTC_TSTIME_MINU_MSK BITS(RTC_TSTIME_MINU_POSS,RTC_TSTIME_MINU_POSE)
-
-#define RTC_TSTIME_SECT_POSS 4U
-#define RTC_TSTIME_SECT_POSE 6U
-#define RTC_TSTIME_SECT_MSK BITS(RTC_TSTIME_SECT_POSS,RTC_TSTIME_SECT_POSE)
-
-#define RTC_TSTIME_SECU_POSS 0U
-#define RTC_TSTIME_SECU_POSE 3U
-#define RTC_TSTIME_SECU_MSK BITS(RTC_TSTIME_SECU_POSS,RTC_TSTIME_SECU_POSE)
-
-/****************** Bit definition for RTC_TSDATE register ************************/
-
-#define RTC_TSDATE_WD_POSS 24U
-#define RTC_TSDATE_WD_POSE 26U
-#define RTC_TSDATE_WD_MSK BITS(RTC_TSDATE_WD_POSS,RTC_TSDATE_WD_POSE)
-
-#define RTC_TSDATE_YRT_POSS 20U
-#define RTC_TSDATE_YRT_POSE 23U
-#define RTC_TSDATE_YRT_MSK BITS(RTC_TSDATE_YRT_POSS,RTC_TSDATE_YRT_POSE)
-
-#define RTC_TSDATE_YRU_POSS 16U
-#define RTC_TSDATE_YRU_POSE 19U
-#define RTC_TSDATE_YRU_MSK BITS(RTC_TSDATE_YRU_POSS,RTC_TSDATE_YRU_POSE)
-
-#define RTC_TSDATE_MONT_POS 12U
-#define RTC_TSDATE_MONT_MSK BIT(RTC_TSDATE_MONT_POS)
-
-#define RTC_TSDATE_MONU_POSS 8U
-#define RTC_TSDATE_MONU_POSE 11U
-#define RTC_TSDATE_MONU_MSK BITS(RTC_TSDATE_MONU_POSS,RTC_TSDATE_MONU_POSE)
-
-#define RTC_TSDATE_DAYT_POSS 4U
-#define RTC_TSDATE_DAYT_POSE 5U
-#define RTC_TSDATE_DAYT_MSK BITS(RTC_TSDATE_DAYT_POSS,RTC_TSDATE_DAYT_POSE)
-
-#define RTC_TSDATE_DAYU_POSS 0U
-#define RTC_TSDATE_DAYU_POSE 3U
-#define RTC_TSDATE_DAYU_MSK BITS(RTC_TSDATE_DAYU_POSS,RTC_TSDATE_DAYU_POSE)
-
-/****************** Bit definition for RTC_TSSSEC register ************************/
-
-#define RTC_TSSSEC_SSEC_POSS 0U
-#define RTC_TSSSEC_SSEC_POSE 15U
-#define RTC_TSSSEC_SSEC_MSK BITS(RTC_TSSSEC_SSEC_POSS,RTC_TSSSEC_SSEC_POSE)
-
-/****************** Bit definition for RTC_SSECTR register ************************/
-
-#define RTC_SSECTR_INC_POS 31U
-#define RTC_SSECTR_INC_MSK BIT(RTC_SSECTR_INC_POS)
-
-#define RTC_SSECTR_TRIM_POSS 0U
-#define RTC_SSECTR_TRIM_POSE 14U
-#define RTC_SSECTR_TRIM_MSK BITS(RTC_SSECTR_TRIM_POSS,RTC_SSECTR_TRIM_POSE)
-
-/****************** Bit definition for RTC_IER register ************************/
-
-#define RTC_IER_TCE_POS 25U
-#define RTC_IER_TCE_MSK BIT(RTC_IER_TCE_POS)
-
-#define RTC_IER_TCC_POS 24U
-#define RTC_IER_TCC_MSK BIT(RTC_IER_TCC_POS)
-
-#define RTC_IER_WU_POS 18U
-#define RTC_IER_WU_MSK BIT(RTC_IER_WU_POS)
-
-#define RTC_IER_SSTC_POS 17U
-#define RTC_IER_SSTC_MSK BIT(RTC_IER_SSTC_POS)
-
-#define RTC_IER_RSC_POS 16U
-#define RTC_IER_RSC_MSK BIT(RTC_IER_RSC_POS)
-
-#define RTC_IER_TAMP2_POS 13U
-#define RTC_IER_TAMP2_MSK BIT(RTC_IER_TAMP2_POS)
-
-#define RTC_IER_TAMP1_POS 12U
-#define RTC_IER_TAMP1_MSK BIT(RTC_IER_TAMP1_POS)
-
-#define RTC_IER_TSOV_POS 11U
-#define RTC_IER_TSOV_MSK BIT(RTC_IER_TSOV_POS)
-
-#define RTC_IER_TS_POS 10U
-#define RTC_IER_TS_MSK BIT(RTC_IER_TS_POS)
-
-#define RTC_IER_ALMB_POS 9U
-#define RTC_IER_ALMB_MSK BIT(RTC_IER_ALMB_POS)
-
-#define RTC_IER_ALMA_POS 8U
-#define RTC_IER_ALMA_MSK BIT(RTC_IER_ALMA_POS)
-
-#define RTC_IER_YR_POS 5U
-#define RTC_IER_YR_MSK BIT(RTC_IER_YR_POS)
-
-#define RTC_IER_MON_POS 4U
-#define RTC_IER_MON_MSK BIT(RTC_IER_MON_POS)
-
-#define RTC_IER_DAY_POS 3U
-#define RTC_IER_DAY_MSK BIT(RTC_IER_DAY_POS)
-
-#define RTC_IER_HR_POS 2U
-#define RTC_IER_HR_MSK BIT(RTC_IER_HR_POS)
-
-#define RTC_IER_MIN_POS 1U
-#define RTC_IER_MIN_MSK BIT(RTC_IER_MIN_POS)
-
-#define RTC_IER_SEC_POS 0U
-#define RTC_IER_SEC_MSK BIT(RTC_IER_SEC_POS)
-
-/****************** Bit definition for RTC_IFR register ************************/
-
-#define RTC_IFR_TCEF_POS 25U
-#define RTC_IFR_TCEF_MSK BIT(RTC_IFR_TCEF_POS)
-
-#define RTC_IFR_TCCF_POS 24U
-#define RTC_IFR_TCCF_MSK BIT(RTC_IFR_TCCF_POS)
-
-#define RTC_IFR_WUF_POS 18U
-#define RTC_IFR_WUF_MSK BIT(RTC_IFR_WUF_POS)
-
-#define RTC_IFR_SSTCF_POS 17U
-#define RTC_IFR_SSTCF_MSK BIT(RTC_IFR_SSTCF_POS)
-
-#define RTC_IFR_RSCF_POS 16U
-#define RTC_IFR_RSCF_MSK BIT(RTC_IFR_RSCF_POS)
-
-#define RTC_IFR_TAMP2F_POS 13U
-#define RTC_IFR_TAMP2F_MSK BIT(RTC_IFR_TAMP2F_POS)
-
-#define RTC_IFR_TAMP1F_POS 12U
-#define RTC_IFR_TAMP1F_MSK BIT(RTC_IFR_TAMP1F_POS)
-
-#define RTC_IFR_TSOVF_POS 11U
-#define RTC_IFR_TSOVF_MSK BIT(RTC_IFR_TSOVF_POS)
-
-#define RTC_IFR_TSF_POS 10U
-#define RTC_IFR_TSF_MSK BIT(RTC_IFR_TSF_POS)
-
-#define RTC_IFR_ALMBF_POS 9U
-#define RTC_IFR_ALMBF_MSK BIT(RTC_IFR_ALMBF_POS)
-
-#define RTC_IFR_ALMAF_POS 8U
-#define RTC_IFR_ALMAF_MSK BIT(RTC_IFR_ALMAF_POS)
-
-#define RTC_IFR_YRF_POS 5U
-#define RTC_IFR_YRF_MSK BIT(RTC_IFR_YRF_POS)
-
-#define RTC_IFR_MONF_POS 4U
-#define RTC_IFR_MONF_MSK BIT(RTC_IFR_MONF_POS)
-
-#define RTC_IFR_DAYF_POS 3U
-#define RTC_IFR_DAYF_MSK BIT(RTC_IFR_DAYF_POS)
-
-#define RTC_IFR_HRF_POS 2U
-#define RTC_IFR_HRF_MSK BIT(RTC_IFR_HRF_POS)
-
-#define RTC_IFR_MINF_POS 1U
-#define RTC_IFR_MINF_MSK BIT(RTC_IFR_MINF_POS)
-
-#define RTC_IFR_SECF_POS 0U
-#define RTC_IFR_SECF_MSK BIT(RTC_IFR_SECF_POS)
-
-/****************** Bit definition for RTC_IFCR register ************************/
-
-#define RTC_IFCR_TCEFC_POS 25U
-#define RTC_IFCR_TCEFC_MSK BIT(RTC_IFCR_TCEFC_POS)
-
-#define RTC_IFCR_TCCFC_POS 24U
-#define RTC_IFCR_TCCFC_MSK BIT(RTC_IFCR_TCCFC_POS)
-
-#define RTC_IFCR_WUFC_POS 18U
-#define RTC_IFCR_WUFC_MSK BIT(RTC_IFCR_WUFC_POS)
-
-#define RTC_IFCR_SSTCFC_POS 17U
-#define RTC_IFCR_SSTCFC_MSK BIT(RTC_IFCR_SSTCFC_POS)
-
-#define RTC_IFCR_RSCFC_POS 16U
-#define RTC_IFCR_RSCFC_MSK BIT(RTC_IFCR_RSCFC_POS)
-
-#define RTC_IFCR_TAMP2FC_POS 13U
-#define RTC_IFCR_TAMP2FC_MSK BIT(RTC_IFCR_TAMP2FC_POS)
-
-#define RTC_IFCR_TAMP1FC_POS 12U
-#define RTC_IFCR_TAMP1FC_MSK BIT(RTC_IFCR_TAMP1FC_POS)
-
-#define RTC_IFCR_TSOVFC_POS 11U
-#define RTC_IFCR_TSOVFC_MSK BIT(RTC_IFCR_TSOVFC_POS)
-
-#define RTC_IFCR_TSSTC_POS 10U
-#define RTC_IFCR_TSSTC_MSK BIT(RTC_IFCR_TSSTC_POS)
-
-#define RTC_IFCR_ALMBFC_POS 9U
-#define RTC_IFCR_ALMBFC_MSK BIT(RTC_IFCR_ALMBFC_POS)
-
-#define RTC_IFCR_ALMAFC_POS 8U
-#define RTC_IFCR_ALMAFC_MSK BIT(RTC_IFCR_ALMAFC_POS)
-
-#define RTC_IFCR_YRFC_POS 5U
-#define RTC_IFCR_YRFC_MSK BIT(RTC_IFCR_YRFC_POS)
-
-#define RTC_IFCR_MONFC_POS 4U
-#define RTC_IFCR_MONFC_MSK BIT(RTC_IFCR_MONFC_POS)
-
-#define RTC_IFCR_DAYFC_POS 3U
-#define RTC_IFCR_DAYFC_MSK BIT(RTC_IFCR_DAYFC_POS)
-
-#define RTC_IFCR_HRFC_POS 2U
-#define RTC_IFCR_HRFC_MSK BIT(RTC_IFCR_HRFC_POS)
-
-#define RTC_IFCR_MINFC_POS 1U
-#define RTC_IFCR_MINFC_MSK BIT(RTC_IFCR_MINFC_POS)
-
-#define RTC_IFCR_SECFC_POS 0U
-#define RTC_IFCR_SECFC_MSK BIT(RTC_IFCR_SECFC_POS)
-
-/****************** Bit definition for RTC_ISR register ************************/
-
-#define RTC_ISR_TCEF_POS 25U
-#define RTC_ISR_TCEF_MSK BIT(RTC_ISR_TCEF_POS)
-
-#define RTC_ISR_TCCF_POS 24U
-#define RTC_ISR_TCCF_MSK BIT(RTC_ISR_TCCF_POS)
-
-#define RTC_ISR_WUF_POS 18U
-#define RTC_ISR_WUF_MSK BIT(RTC_ISR_WUF_POS)
-
-#define RTC_ISR_SSTCF_POS 17U
-#define RTC_ISR_SSTCF_MSK BIT(RTC_ISR_SSTCF_POS)
-
-#define RTC_ISR_RSCF_POS 16U
-#define RTC_ISR_RSCF_MSK BIT(RTC_ISR_RSCF_POS)
-
-#define RTC_ISR_TAMP2F_POS 13U
-#define RTC_ISR_TAMP2F_MSK BIT(RTC_ISR_TAMP2F_POS)
-
-#define RTC_ISR_TAMP1F_POS 12U
-#define RTC_ISR_TAMP1F_MSK BIT(RTC_ISR_TAMP1F_POS)
-
-#define RTC_ISR_TSOVF_POS 11U
-#define RTC_ISR_TSOVF_MSK BIT(RTC_ISR_TSOVF_POS)
-
-#define RTC_ISR_TSF_POS 10U
-#define RTC_ISR_TSF_MSK BIT(RTC_ISR_TSF_POS)
-
-#define RTC_ISR_ALMBF_POS 9U
-#define RTC_ISR_ALMBF_MSK BIT(RTC_ISR_ALMBF_POS)
-
-#define RTC_ISR_ALMAF_POS 8U
-#define RTC_ISR_ALMAF_MSK BIT(RTC_ISR_ALMAF_POS)
-
-#define RTC_ISR_YRF_POS 5U
-#define RTC_ISR_YRF_MSK BIT(RTC_ISR_YRF_POS)
-
-#define RTC_ISR_MONF_POS 4U
-#define RTC_ISR_MONF_MSK BIT(RTC_ISR_MONF_POS)
-
-#define RTC_ISR_DAYF_POS 3U
-#define RTC_ISR_DAYF_MSK BIT(RTC_ISR_DAYF_POS)
-
-#define RTC_ISR_HRF_POS 2U
-#define RTC_ISR_HRF_MSK BIT(RTC_ISR_HRF_POS)
-
-#define RTC_ISR_MINF_POS 1U
-#define RTC_ISR_MINF_MSK BIT(RTC_ISR_MINF_POS)
-
-#define RTC_ISR_SECF_POS 0U
-#define RTC_ISR_SECF_MSK BIT(RTC_ISR_SECF_POS)
-
-/****************** Bit definition for RTC_CALWPR register ************************/
-
-#define RTC_CALWPR_WP_POS 0U
-#define RTC_CALWPR_WP_MSK BIT(RTC_CALWPR_WP_POS)
-
-/****************** Bit definition for RTC_CALCON register ************************/
-
-#define RTC_CALCON_DCMACC_POS 24U
-#define RTC_CALCON_DCMACC_MSK BIT(RTC_CALCON_DCMACC_POS)
-
-#define RTC_CALCON_ALG_POS 23U
-#define RTC_CALCON_ALG_MSK BIT(RTC_CALCON_ALG_POS)
-
-#define RTC_CALCON_TCP_POSS 20U
-#define RTC_CALCON_TCP_POSE 22U
-#define RTC_CALCON_TCP_MSK BITS(RTC_CALCON_TCP_POSS,RTC_CALCON_TCP_POSE)
-
-#define RTC_CALCON_ERR_POS 19U
-#define RTC_CALCON_ERR_MSK BIT(RTC_CALCON_ERR_POS)
-
-#define RTC_CALCON_BUSY_POS 18U
-#define RTC_CALCON_BUSY_MSK BIT(RTC_CALCON_BUSY_POS)
-
-#define RTC_CALCON_TCM_POSS 16U
-#define RTC_CALCON_TCM_POSE 17U
-#define RTC_CALCON_TCM_MSK BITS(RTC_CALCON_TCM_POSS,RTC_CALCON_TCM_POSE)
-
-#define RTC_CALCON_CALP_POSS 1U
-#define RTC_CALCON_CALP_POSE 3U
-#define RTC_CALCON_CALP_MSK BITS(RTC_CALCON_CALP_POSS,RTC_CALCON_CALP_POSE)
-
-#define RTC_CALCON_CALEN_POS 0U
-#define RTC_CALCON_CALEN_MSK BIT(RTC_CALCON_CALEN_POS)
-
-/****************** Bit definition for RTC_CALDR register ************************/
-
-#define RTC_CALDR_DATA_POSS 16U
-#define RTC_CALDR_DATA_POSE 31U
-#define RTC_CALDR_DATA_MSK BITS(RTC_CALDR_DATA_POSS,RTC_CALDR_DATA_POSE)
-
-#define RTC_CALDR_VAL_POSS 0U
-#define RTC_CALDR_VAL_POSE 15U
-#define RTC_CALDR_VAL_MSK BITS(RTC_CALDR_VAL_POSS,RTC_CALDR_VAL_POSE)
-
-/****************** Bit definition for RTC_TEMPR register ************************/
-
-#define RTC_TEMPR_DATA_POSS 16U
-#define RTC_TEMPR_DATA_POSE 31U
-#define RTC_TEMPR_DATA_MSK BITS(RTC_TEMPR_DATA_POSS,RTC_TEMPR_DATA_POSE)
-
-#define RTC_TEMPR_VAL_POSS 0U
-#define RTC_TEMPR_VAL_POSE 15U
-#define RTC_TEMPR_VAL_MSK BITS(RTC_TEMPR_VAL_POSS,RTC_TEMPR_VAL_POSE)
-
-/****************** Bit definition for RTC_TEMPBDR register ************************/
-
-#define RTC_TEMPBDR_VAL_POSS 0U
-#define RTC_TEMPBDR_VAL_POSE 15U
-#define RTC_TEMPBDR_VAL_MSK BITS(RTC_TEMPBDR_VAL_POSS,RTC_TEMPBDR_VAL_POSE)
-
-/****************** Bit definition for RTC_BKP register ************************/
-
-#define RTC_BKP_BKP_POSS 0U
-#define RTC_BKP_BKP_POSE 31U
-#define RTC_BKP_BKP_MSK BITS(RTC_BKP_BKP_POSS,RTC_BKP_BKP_POSE)
-
-typedef struct
-{
- __IO uint32_t WPR;
- __IO uint32_t CON;
- __IO uint32_t PSR;
- __IO uint32_t TAMPCON;
- __IO uint32_t TIME;
- __IO uint32_t DATE;
- __IO uint32_t SSEC;
- __IO uint32_t WUMAT;
- __IO uint32_t ALMA;
- __IO uint32_t ALMB;
- __IO uint32_t ALMASSEC;
- __IO uint32_t ALMBSSEC;
- __I uint32_t TSTIME;
- __I uint32_t TSDATE;
- __I uint32_t TSSSEC;
- __O uint32_t SSECTR;
- __IO uint32_t IER;
- __I uint32_t IFR;
- __O uint32_t IFCR;
- __I uint32_t ISR;
- __IO uint32_t CALWPR;
- __IO uint32_t CALCON;
- __IO uint32_t CALDR;
- __IO uint32_t TEMPR;
- __IO uint32_t LTCAR;
- __IO uint32_t LTCBR;
- __IO uint32_t LTCCR;
- __IO uint32_t LTCDR;
- __IO uint32_t LTCER;
- __IO uint32_t HTCAR;
- __IO uint32_t HTCBR;
- __IO uint32_t HTCCR;
- __IO uint32_t HTCDR;
- __IO uint32_t HTCER;
- __IO uint32_t TEMPBDR;
- uint32_t RESERVED0[29] ;
- __IO uint32_t BKPR[32];
-} RTC_TypeDef;
-
-/****************** Bit definition for TIMER_CON1 register ************************/
-
-#define TIMER_CON1_DFCKSEL_POSS 8U
-#define TIMER_CON1_DFCKSEL_POSE 9U
-#define TIMER_CON1_DFCKSEL_MSK BITS(TIMER_CON1_DFCKSEL_POSS,TIMER_CON1_DFCKSEL_POSE)
-
-#define TIMER_CON1_ARPEN_POS 7U
-#define TIMER_CON1_ARPEN_MSK BIT(TIMER_CON1_ARPEN_POS)
-
-#define TIMER_CON1_CMSEL_POSS 5U
-#define TIMER_CON1_CMSEL_POSE 6U
-#define TIMER_CON1_CMSEL_MSK BITS(TIMER_CON1_CMSEL_POSS,TIMER_CON1_CMSEL_POSE)
-
-#define TIMER_CON1_DIRSEL_POS 4U
-#define TIMER_CON1_DIRSEL_MSK BIT(TIMER_CON1_DIRSEL_POS)
-
-#define TIMER_CON1_SPMEN_POS 3U
-#define TIMER_CON1_SPMEN_MSK BIT(TIMER_CON1_SPMEN_POS)
-
-#define TIMER_CON1_UERSEL_POS 2U
-#define TIMER_CON1_UERSEL_MSK BIT(TIMER_CON1_UERSEL_POS)
-
-#define TIMER_CON1_DISUE_POS 1U
-#define TIMER_CON1_DISUE_MSK BIT(TIMER_CON1_DISUE_POS)
-
-#define TIMER_CON1_CNTEN_POS 0U
-#define TIMER_CON1_CNTEN_MSK BIT(TIMER_CON1_CNTEN_POS)
-
-/****************** Bit definition for TIMER_CON2 register ************************/
-
-#define TIMER_CON2_OISS4_POS 14U
-#define TIMER_CON2_OISS4_MSK BIT(TIMER_CON2_OISS4_POS)
-
-#define TIMER_CON2_OISS3N_POS 13U
-#define TIMER_CON2_OISS3N_MSK BIT(TIMER_CON2_OISS3N_POS)
-
-#define TIMER_CON2_OISS3_POS 12U
-#define TIMER_CON2_OISS3_MSK BIT(TIMER_CON2_OISS3_POS)
-
-#define TIMER_CON2_OISS2N_POS 11U
-#define TIMER_CON2_OISS2N_MSK BIT(TIMER_CON2_OISS2N_POS)
-
-#define TIMER_CON2_OISS2_POS 10U
-#define TIMER_CON2_OISS2_MSK BIT(TIMER_CON2_OISS2_POS)
-
-#define TIMER_CON2_OISS1N_POS 9U
-#define TIMER_CON2_OISS1N_MSK BIT(TIMER_CON2_OISS1N_POS)
-
-#define TIMER_CON2_OISS1_POS 8U
-#define TIMER_CON2_OISS1_MSK BIT(TIMER_CON2_OISS1_POS)
-
-#define TIMER_CON2_I1FSEL_POS 7U
-#define TIMER_CON2_I1FSEL_MSK BIT(TIMER_CON2_I1FSEL_POS)
-
-#define TIMER_CON2_TRGOSEL_POSS 4U
-#define TIMER_CON2_TRGOSEL_POSE 6U
-#define TIMER_CON2_TRGOSEL_MSK BITS(TIMER_CON2_TRGOSEL_POSS,TIMER_CON2_TRGOSEL_POSE)
-
-#define TIMER_CON2_CCDMASEL_POS 3U
-#define TIMER_CON2_CCDMASEL_MSK BIT(TIMER_CON2_CCDMASEL_POS)
-
-#define TIMER_CON2_CCUSEL_POS 2U
-#define TIMER_CON2_CCUSEL_MSK BIT(TIMER_CON2_CCUSEL_POS)
-
-#define TIMER_CON2_CCPCEN_POS 0U
-#define TIMER_CON2_CCPCEN_MSK BIT(TIMER_CON2_CCPCEN_POS)
-
-/****************** Bit definition for TIMER_SMCON register ************************/
-
-#define TIMER_SMCON_ETPOL_POS 15U
-#define TIMER_SMCON_ETPOL_MSK BIT(TIMER_SMCON_ETPOL_POS)
-
-#define TIMER_SMCON_ECM2EN_POS 14U
-#define TIMER_SMCON_ECM2EN_MSK BIT(TIMER_SMCON_ECM2EN_POS)
-
-#define TIMER_SMCON_ETPSEL_POSS 12U
-#define TIMER_SMCON_ETPSEL_POSE 13U
-#define TIMER_SMCON_ETPSEL_MSK BITS(TIMER_SMCON_ETPSEL_POSS,TIMER_SMCON_ETPSEL_POSE)
-
-#define TIMER_SMCON_ETFLT_POSS 8U
-#define TIMER_SMCON_ETFLT_POSE 11U
-#define TIMER_SMCON_ETFLT_MSK BITS(TIMER_SMCON_ETFLT_POSS,TIMER_SMCON_ETFLT_POSE)
-
-#define TIMER_SMCON_MSCFG_POS 7U
-#define TIMER_SMCON_MSCFG_MSK BIT(TIMER_SMCON_MSCFG_POS)
-
-#define TIMER_SMCON_TSSEL_POSS 4U
-#define TIMER_SMCON_TSSEL_POSE 6U
-#define TIMER_SMCON_TSSEL_MSK BITS(TIMER_SMCON_TSSEL_POSS,TIMER_SMCON_TSSEL_POSE)
-
-#define TIMER_SMCON_SMODS_POSS 0U
-#define TIMER_SMCON_SMODS_POSE 2U
-#define TIMER_SMCON_SMODS_MSK BITS(TIMER_SMCON_SMODS_POSS,TIMER_SMCON_SMODS_POSE)
-
-/****************** Bit definition for TIMER_DIER register ************************/
-
-#define TIMER_DIER_TRGDMA_POS 14U
-#define TIMER_DIER_TRGDMA_MSK BIT(TIMER_DIER_TRGDMA_POS)
-
-#define TIMER_DIER_COMDMA_POS 13U
-#define TIMER_DIER_COMDMA_MSK BIT(TIMER_DIER_COMDMA_POS)
-
-#define TIMER_DIER_CC4DMA_POS 12U
-#define TIMER_DIER_CC4DMA_MSK BIT(TIMER_DIER_CC4DMA_POS)
-
-#define TIMER_DIER_CC3DMA_POS 11U
-#define TIMER_DIER_CC3DMA_MSK BIT(TIMER_DIER_CC3DMA_POS)
-
-#define TIMER_DIER_CC2DMA_POS 10U
-#define TIMER_DIER_CC2DMA_MSK BIT(TIMER_DIER_CC2DMA_POS)
-
-#define TIMER_DIER_CC1DMA_POS 9U
-#define TIMER_DIER_CC1DMA_MSK BIT(TIMER_DIER_CC1DMA_POS)
-
-#define TIMER_DIER_UDMA_POS 8U
-#define TIMER_DIER_UDMA_MSK BIT(TIMER_DIER_UDMA_POS)
-
-#define TIMER_DIER_BRKIT_POS 7U
-#define TIMER_DIER_BRKIT_MSK BIT(TIMER_DIER_BRKIT_POS)
-
-#define TIMER_DIER_TRGIT_POS 6U
-#define TIMER_DIER_TRGIT_MSK BIT(TIMER_DIER_TRGIT_POS)
-
-#define TIMER_DIER_COMIT_POS 5U
-#define TIMER_DIER_COMIT_MSK BIT(TIMER_DIER_COMIT_POS)
-
-#define TIMER_DIER_CC4IT_POS 4U
-#define TIMER_DIER_CC4IT_MSK BIT(TIMER_DIER_CC4IT_POS)
-
-#define TIMER_DIER_CC3IT_POS 3U
-#define TIMER_DIER_CC3IT_MSK BIT(TIMER_DIER_CC3IT_POS)
-
-#define TIMER_DIER_CC2IT_POS 2U
-#define TIMER_DIER_CC2IT_MSK BIT(TIMER_DIER_CC2IT_POS)
-
-#define TIMER_DIER_CC1IT_POS 1U
-#define TIMER_DIER_CC1IT_MSK BIT(TIMER_DIER_CC1IT_POS)
-
-#define TIMER_DIER_UIT_POS 0U
-#define TIMER_DIER_UIT_MSK BIT(TIMER_DIER_UIT_POS)
-
-/****************** Bit definition for TIMER_DIDR register ************************/
-
-#define TIMER_DIDR_TRGDMA_POS 14U
-#define TIMER_DIDR_TRGDMA_MSK BIT(TIMER_DIDR_TRGDMA_POS)
-
-#define TIMER_DIDR_COMD_POS 13U
-#define TIMER_DIDR_COMD_MSK BIT(TIMER_DIDR_COMD_POS)
-
-#define TIMER_DIDR_CC4D_POS 12U
-#define TIMER_DIDR_CC4D_MSK BIT(TIMER_DIDR_CC4D_POS)
-
-#define TIMER_DIDR_CC3D_POS 11U
-#define TIMER_DIDR_CC3D_MSK BIT(TIMER_DIDR_CC3D_POS)
-
-#define TIMER_DIDR_CC2D_POS 10U
-#define TIMER_DIDR_CC2D_MSK BIT(TIMER_DIDR_CC2D_POS)
-
-#define TIMER_DIDR_CC1D_POS 9U
-#define TIMER_DIDR_CC1D_MSK BIT(TIMER_DIDR_CC1D_POS)
-
-#define TIMER_DIDR_UD_POS 8U
-#define TIMER_DIDR_UD_MSK BIT(TIMER_DIDR_UD_POS)
-
-#define TIMER_DIDR_BRKI_POS 7U
-#define TIMER_DIDR_BRKI_MSK BIT(TIMER_DIDR_BRKI_POS)
-
-#define TIMER_DIDR_TRGI_POS 6U
-#define TIMER_DIDR_TRGI_MSK BIT(TIMER_DIDR_TRGI_POS)
-
-#define TIMER_DIDR_COMI_POS 5U
-#define TIMER_DIDR_COMI_MSK BIT(TIMER_DIDR_COMI_POS)
-
-#define TIMER_DIDR_CC4I_POS 4U
-#define TIMER_DIDR_CC4I_MSK BIT(TIMER_DIDR_CC4I_POS)
-
-#define TIMER_DIDR_CC3I_POS 3U
-#define TIMER_DIDR_CC3I_MSK BIT(TIMER_DIDR_CC3I_POS)
-
-#define TIMER_DIDR_CC2I_POS 2U
-#define TIMER_DIDR_CC2I_MSK BIT(TIMER_DIDR_CC2I_POS)
-
-#define TIMER_DIDR_CC1I_POS 1U
-#define TIMER_DIDR_CC1I_MSK BIT(TIMER_DIDR_CC1I_POS)
-
-#define TIMER_DIDR_UI_POS 0U
-#define TIMER_DIDR_UI_MSK BIT(TIMER_DIDR_UI_POS)
-
-/****************** Bit definition for TIMER_DIVS register ************************/
-
-#define TIMER_DIVS_TRGDMA_POS 14U
-#define TIMER_DIVS_TRGDMA_MSK BIT(TIMER_DIVS_TRGDMA_POS)
-
-#define TIMER_DIVS_COMDMA_POS 13U
-#define TIMER_DIVS_COMDMA_MSK BIT(TIMER_DIVS_COMDMA_POS)
-
-#define TIMER_DIVS_CC4DMA_POS 12U
-#define TIMER_DIVS_CC4DMA_MSK BIT(TIMER_DIVS_CC4DMA_POS)
-
-#define TIMER_DIVS_CC3DMA_POS 11U
-#define TIMER_DIVS_CC3DMA_MSK BIT(TIMER_DIVS_CC3DMA_POS)
-
-#define TIMER_DIVS_CC2DMA_POS 10U
-#define TIMER_DIVS_CC2DMA_MSK BIT(TIMER_DIVS_CC2DMA_POS)
-
-#define TIMER_DIVS_CC1DMA_POS 9U
-#define TIMER_DIVS_CC1DMA_MSK BIT(TIMER_DIVS_CC1DMA_POS)
-
-#define TIMER_DIVS_UEDTR_POS 8U
-#define TIMER_DIVS_UEDTR_MSK BIT(TIMER_DIVS_UEDTR_POS)
-
-#define TIMER_DIVS_BKI_POS 7U
-#define TIMER_DIVS_BKI_MSK BIT(TIMER_DIVS_BKI_POS)
-
-#define TIMER_DIVS_TRGI_POS 6U
-#define TIMER_DIVS_TRGI_MSK BIT(TIMER_DIVS_TRGI_POS)
-
-#define TIMER_DIVS_COMI_POS 5U
-#define TIMER_DIVS_COMI_MSK BIT(TIMER_DIVS_COMI_POS)
-
-#define TIMER_DIVS_CC4I_POS 4U
-#define TIMER_DIVS_CC4I_MSK BIT(TIMER_DIVS_CC4I_POS)
-
-#define TIMER_DIVS_CC3I_POS 3U
-#define TIMER_DIVS_CC3I_MSK BIT(TIMER_DIVS_CC3I_POS)
-
-#define TIMER_DIVS_CC2I_POS 2U
-#define TIMER_DIVS_CC2I_MSK BIT(TIMER_DIVS_CC2I_POS)
-
-#define TIMER_DIVS_CC1I_POS 1U
-#define TIMER_DIVS_CC1I_MSK BIT(TIMER_DIVS_CC1I_POS)
-
-#define TIMER_DIVS_UEI_POS 0U
-#define TIMER_DIVS_UEI_MSK BIT(TIMER_DIVS_UEI_POS)
-
-/****************** Bit definition for TIMER_RIF register ************************/
-
-#define TIMER_RIF_CH4OVIF_POS 12U
-#define TIMER_RIF_CH4OVIF_MSK BIT(TIMER_RIF_CH4OVIF_POS)
-
-#define TIMER_RIF_CH3OVIF_POS 11U
-#define TIMER_RIF_CH3OVIF_MSK BIT(TIMER_RIF_CH3OVIF_POS)
-
-#define TIMER_RIF_CH2OVIF_POS 10U
-#define TIMER_RIF_CH2OVIF_MSK BIT(TIMER_RIF_CH2OVIF_POS)
-
-#define TIMER_RIF_CH1OVIF_POS 9U
-#define TIMER_RIF_CH1OVIF_MSK BIT(TIMER_RIF_CH1OVIF_POS)
-
-#define TIMER_RIF_BRKIF_POS 7U
-#define TIMER_RIF_BRKIF_MSK BIT(TIMER_RIF_BRKIF_POS)
-
-#define TIMER_RIF_TRGIF_POS 6U
-#define TIMER_RIF_TRGIF_MSK BIT(TIMER_RIF_TRGIF_POS)
-
-#define TIMER_RIF_COMIF_POS 5U
-#define TIMER_RIF_COMIF_MSK BIT(TIMER_RIF_COMIF_POS)
-
-#define TIMER_RIF_CH4IF_POS 4U
-#define TIMER_RIF_CH4IF_MSK BIT(TIMER_RIF_CH4IF_POS)
-
-#define TIMER_RIF_CH3IF_POS 3U
-#define TIMER_RIF_CH3IF_MSK BIT(TIMER_RIF_CH3IF_POS)
-
-#define TIMER_RIF_CH2IF_POS 2U
-#define TIMER_RIF_CH2IF_MSK BIT(TIMER_RIF_CH2IF_POS)
-
-#define TIMER_RIF_CH1IF_POS 1U
-#define TIMER_RIF_CH1IF_MSK BIT(TIMER_RIF_CH1IF_POS)
-
-#define TIMER_RIF_UEVTIF_POS 0U
-#define TIMER_RIF_UEVTIF_MSK BIT(TIMER_RIF_UEVTIF_POS)
-
-/****************** Bit definition for TIMER_IFM register ************************/
-
-#define TIMER_IFM_BRKIM_POS 7U
-#define TIMER_IFM_BRKIM_MSK BIT(TIMER_IFM_BRKIM_POS)
-
-#define TIMER_IFM_TRGI_POS 6U
-#define TIMER_IFM_TRGI_MSK BIT(TIMER_IFM_TRGI_POS)
-
-#define TIMER_IFM_COMI_POS 5U
-#define TIMER_IFM_COMI_MSK BIT(TIMER_IFM_COMI_POS)
-
-#define TIMER_IFM_CH4CCI_POS 4U
-#define TIMER_IFM_CH4CCI_MSK BIT(TIMER_IFM_CH4CCI_POS)
-
-#define TIMER_IFM_CH3CCI_POS 3U
-#define TIMER_IFM_CH3CCI_MSK BIT(TIMER_IFM_CH3CCI_POS)
-
-#define TIMER_IFM_CH2CCI_POS 2U
-#define TIMER_IFM_CH2CCI_MSK BIT(TIMER_IFM_CH2CCI_POS)
-
-#define TIMER_IFM_CH1CCI_POS 1U
-#define TIMER_IFM_CH1CCI_MSK BIT(TIMER_IFM_CH1CCI_POS)
-
-#define TIMER_IFM_UEI_POS 0U
-#define TIMER_IFM_UEI_MSK BIT(TIMER_IFM_UEI_POS)
-
-/****************** Bit definition for TIMER_ICR register ************************/
-
-#define TIMER_ICR_BRKIC_POS 7U
-#define TIMER_ICR_BRKIC_MSK BIT(TIMER_ICR_BRKIC_POS)
-
-#define TIMER_ICR_TRGIC_POS 6U
-#define TIMER_ICR_TRGIC_MSK BIT(TIMER_ICR_TRGIC_POS)
-
-#define TIMER_ICR_COMIC_POS 5U
-#define TIMER_ICR_COMIC_MSK BIT(TIMER_ICR_COMIC_POS)
-
-#define TIMER_ICR_CH4CCIC_POS 4U
-#define TIMER_ICR_CH4CCIC_MSK BIT(TIMER_ICR_CH4CCIC_POS)
-
-#define TIMER_ICR_CH3CCIC_POS 3U
-#define TIMER_ICR_CH3CCIC_MSK BIT(TIMER_ICR_CH3CCIC_POS)
-
-#define TIMER_ICR_CH2CCIC_POS 2U
-#define TIMER_ICR_CH2CCIC_MSK BIT(TIMER_ICR_CH2CCIC_POS)
-
-#define TIMER_ICR_CH1CCIC_POS 1U
-#define TIMER_ICR_CH1CCIC_MSK BIT(TIMER_ICR_CH1CCIC_POS)
-
-#define TIMER_ICR_UEIC_POS 0U
-#define TIMER_ICR_UEIC_MSK BIT(TIMER_ICR_UEIC_POS)
-
-/****************** Bit definition for TIMER_SGE register ************************/
-
-#define TIMER_SGE_SGBRK_POS 7U
-#define TIMER_SGE_SGBRK_MSK BIT(TIMER_SGE_SGBRK_POS)
-
-#define TIMER_SGE_SGTRG_POS 6U
-#define TIMER_SGE_SGTRG_MSK BIT(TIMER_SGE_SGTRG_POS)
-
-#define TIMER_SGE_SGCOM_POS 5U
-#define TIMER_SGE_SGCOM_MSK BIT(TIMER_SGE_SGCOM_POS)
-
-#define TIMER_SGE_SGCC4E_POS 4U
-#define TIMER_SGE_SGCC4E_MSK BIT(TIMER_SGE_SGCC4E_POS)
-
-#define TIMER_SGE_SGCC3E_POS 3U
-#define TIMER_SGE_SGCC3E_MSK BIT(TIMER_SGE_SGCC3E_POS)
-
-#define TIMER_SGE_SGCC2E_POS 2U
-#define TIMER_SGE_SGCC2E_MSK BIT(TIMER_SGE_SGCC2E_POS)
-
-#define TIMER_SGE_SGCC1E_POS 1U
-#define TIMER_SGE_SGCC1E_MSK BIT(TIMER_SGE_SGCC1E_POS)
-
-#define TIMER_SGE_SGU_POS 0U
-#define TIMER_SGE_SGU_MSK BIT(TIMER_SGE_SGU_POS)
-
-/****************** Bit definition for TIMER_CHMR1 register ************************/
-/* Output */
-#define TIMER_CHMR1_CH2OCLREN_POS 15U
-#define TIMER_CHMR1_CH2OCLREN_MSK BIT(TIMER_CHMR1_CH2OCLREN_POS)
-
-#define TIMER_CHMR1_CH2OMOD_POSS 12U
-#define TIMER_CHMR1_CH2OMOD_POSE 14U
-#define TIMER_CHMR1_CH2OMOD_MSK BITS(TIMER_CHMR1_CH2OMOD_POSS,TIMER_CHMR1_CH2OMOD_POSE)
-
-#define TIMER_CHMR1_CH2OPEN_POS 11U
-#define TIMER_CHMR1_CH2OPEN_MSK BIT(TIMER_CHMR1_CH2OPEN_POS)
-
-#define TIMER_CHMR1_CH2OFEN_POS 10U
-#define TIMER_CHMR1_CH2OFEN_MSK BIT(TIMER_CHMR1_CH2OFEN_POS)
-
-#define TIMER_CHMR1_CC2SSEL_POSS 8U
-#define TIMER_CHMR1_CC2SSEL_POSE 9U
-#define TIMER_CHMR1_CC2SSEL_MSK BITS(TIMER_CHMR1_CC2SSEL_POSS,TIMER_CHMR1_CC2SSEL_POSE)
-
-#define TIMER_CHMR1_CH1OCLREN_POS 7U
-#define TIMER_CHMR1_CH1OCLREN_MSK BIT(TIMER_CHMR1_CH1OCLREN_POS)
-
-#define TIMER_CHMR1_CH1OMOD_POSS 4U
-#define TIMER_CHMR1_CH1OMOD_POSE 6U
-#define TIMER_CHMR1_CH1OMOD_MSK BITS(TIMER_CHMR1_CH1OMOD_POSS,TIMER_CHMR1_CH1OMOD_POSE)
-
-#define TIMER_CHMR1_CH1OPREN_POS 3U
-#define TIMER_CHMR1_CH1OPREN_MSK BIT(TIMER_CHMR1_CH1OPREN_POS)
-
-#define TIMER_CHMR1_CH1OHSEN_POS 2U
-#define TIMER_CHMR1_CH1OHSEN_MSK BIT(TIMER_CHMR1_CH1OHSEN_POS)
-
-#define TIMER_CHMR1_CC1SSEL_POSS 0U
-#define TIMER_CHMR1_CC1SSEL_POSE 1U
-#define TIMER_CHMR1_CC1SSEL_MSK BITS(TIMER_CHMR1_CC1SSEL_POSS,TIMER_CHMR1_CC1SSEL_POSE)
-
-/* Input */
-#define TIMER_CHMR1_I2FLT_POSS 12U
-#define TIMER_CHMR1_I2FLT_POSE 15U
-#define TIMER_CHMR1_I2FLT_MSK BITS(TIMER_CHMR1_I2FLT_POSS,TIMER_CHMR1_I2FLT_POSE)
-
-#define TIMER_CHMR1_IC2PRES_POSS 10U
-#define TIMER_CHMR1_IC2PRES_POSE 11U
-#define TIMER_CHMR1_IC2PRES_MSK BITS(TIMER_CHMR1_IC2PRES_POSS,TIMER_CHMR1_IC2PRES_POSE)
-
-#define TIMER_CHMR1_CC2SSEL_POSS 8U
-#define TIMER_CHMR1_CC2SSEL_POSE 9U
-#define TIMER_CHMR1_CC2SSEL_MSK BITS(TIMER_CHMR1_CC2SSEL_POSS,TIMER_CHMR1_CC2SSEL_POSE)
-
-#define TIMER_CHMR1_I1FLT_POSS 4U
-#define TIMER_CHMR1_I1FLT_POSE 7U
-#define TIMER_CHMR1_I1FLT_MSK BITS(TIMER_CHMR1_I1FLT_POSS,TIMER_CHMR1_I1FLT_POSE)
-
-#define TIMER_CHMR1_IC1PRES_POSS 2U
-#define TIMER_CHMR1_IC1PRES_POSE 3U
-#define TIMER_CHMR1_IC1PRES_MSK BITS(TIMER_CHMR1_IC1PRES_POSS,TIMER_CHMR1_IC1PRES_POSE)
-
-#define TIMER_CHMR1_CC1SSEL_POSS 0U
-#define TIMER_CHMR1_CC1SSEL_POSE 1U
-#define TIMER_CHMR1_CC1SSEL_MSK BITS(TIMER_CHMR1_CC1SSEL_POSS,TIMER_CHMR1_CC1SSEL_POSE)
-
-/****************** Bit definition for TIMER_CHMR2 register ************************/
-/* Output */
-#define TIMER_CHMR2_CH4OCLREN_POS 15U
-#define TIMER_CHMR2_CH4OCLREN_MSK BIT(TIMER_CHMR2_CH4OCLREN_POS)
-
-#define TIMER_CHMR2_CH4OMOD_POSS 12U
-#define TIMER_CHMR2_CH4OMOD_POSE 14U
-#define TIMER_CHMR2_CH4OMOD_MSK BITS(TIMER_CHMR2_CH4OMOD_POSS,TIMER_CHMR2_CH4OMOD_POSE)
-
-#define TIMER_CHMR2_CH4OPEN_POS 11U
-#define TIMER_CHMR2_CH4OPEN_MSK BIT(TIMER_CHMR2_CH4OPEN_POS)
-
-#define TIMER_CHMR2_CH4OHSEN_POS 10U
-#define TIMER_CHMR2_CH4OHSEN_MSK BIT(TIMER_CHMR2_CH4OHSEN_POS)
-
-#define TIMER_CHMR2_CC4SSEL_POSS 8U
-#define TIMER_CHMR2_CC4SSEL_POSE 9U
-#define TIMER_CHMR2_CC4SSEL_MSK BITS(TIMER_CHMR2_CC4SSEL_POSS,TIMER_CHMR2_CC4SSEL_POSE)
-
-#define TIMER_CHMR2_CH3OCLREN_POS 7U
-#define TIMER_CHMR2_CH3OCLREN_MSK BIT(TIMER_CHMR2_CH3OCLREN_POS)
-
-#define TIMER_CHMR2_CH3OMOD_POSS 4U
-#define TIMER_CHMR2_CH3OMOD_POSE 6U
-#define TIMER_CHMR2_CH3OMOD_MSK BITS(TIMER_CHMR2_CH3OMOD_POSS,TIMER_CHMR2_CH3OMOD_POSE)
-
-#define TIMER_CHMR2_CH3OPEN_POS 3U
-#define TIMER_CHMR2_CH3OPEN_MSK BIT(TIMER_CHMR2_CH3OPEN_POS)
-
-#define TIMER_CHMR2_CH3OFEN_POS 2U
-#define TIMER_CHMR2_CH3OFEN_MSK BIT(TIMER_CHMR2_CH3OFEN_POS)
-
-#define TIMER_CHMR2_CC3SSEL_POSS 0U
-#define TIMER_CHMR2_CC3SSEL_POSE 1U
-#define TIMER_CHMR2_CC3SSEL_MSK BITS(TIMER_CHMR2_CC3SSEL_POSS,TIMER_CHMR2_CC3SSEL_POSE)
-
-/* Input */
-#define TIMER_CHMR2_I4FLT_POSS 12U
-#define TIMER_CHMR2_I4FLT_POSE 15U
-#define TIMER_CHMR2_I4FLT_MSK BITS(TIMER_CHMR2_I4FLT_POSS,TIMER_CHMR2_I4FLT_POSE)
-
-#define TIMER_CHMR2_IC4PRES_POSS 10U
-#define TIMER_CHMR2_IC4PRES_POSE 11U
-#define TIMER_CHMR2_IC4PRES_MSK BITS(TIMER_CHMR2_IC4PRES_POSS,TIMER_CHMR2_IC4PRES_POSE)
-
-#define TIMER_CHMR2_CC4SSEL_POSS 8U
-#define TIMER_CHMR2_CC4SSEL_POSE 9U
-#define TIMER_CHMR2_CC4SSEL_MSK BITS(TIMER_CHMR2_CC4SSEL_POSS,TIMER_CHMR2_CC4SSEL_POSE)
-
-#define TIMER_CHMR2_I3FLT_POSS 4U
-#define TIMER_CHMR2_I3FLT_POSE 7U
-#define TIMER_CHMR2_I3FLT_MSK BITS(TIMER_CHMR2_I3FLT_POSS,TIMER_CHMR2_I3FLT_POSE)
-
-#define TIMER_CHMR2_IC3PRES_POSS 2U
-#define TIMER_CHMR2_IC3PRES_POSE 3U
-#define TIMER_CHMR2_IC3PRES_MSK BITS(TIMER_CHMR2_IC3PRES_POSS,TIMER_CHMR2_IC3PRES_POSE)
-
-#define TIMER_CHMR2_CC3SSEL_POSS 0U
-#define TIMER_CHMR2_CC3SSEL_POSE 1U
-#define TIMER_CHMR2_CC3SSEL_MSK BITS(TIMER_CHMR2_CC3SSEL_POSS,TIMER_CHMR2_CC3SSEL_POSE)
-
-/****************** Bit definition for TIMER_CCEP register ************************/
-
-#define TIMER_CCEP_CC4POL_POS 13U
-#define TIMER_CCEP_CC4POL_MSK BIT(TIMER_CCEP_CC4POL_POS)
-
-#define TIMER_CCEP_CC4EN_POS 12U
-#define TIMER_CCEP_CC4EN_MSK BIT(TIMER_CCEP_CC4EN_POS)
-
-#define TIMER_CCEP_CC3NPOL_POS 11U
-#define TIMER_CCEP_CC3NPOL_MSK BIT(TIMER_CCEP_CC3NPOL_POS)
-
-#define TIMER_CCEP_CC3NEN_POS 10U
-#define TIMER_CCEP_CC3NEN_MSK BIT(TIMER_CCEP_CC3NEN_POS)
-
-#define TIMER_CCEP_CC3POL_POS 9U
-#define TIMER_CCEP_CC3POL_MSK BIT(TIMER_CCEP_CC3POL_POS)
-
-#define TIMER_CCEP_CC3EN_POS 8U
-#define TIMER_CCEP_CC3EN_MSK BIT(TIMER_CCEP_CC3EN_POS)
-
-#define TIMER_CCEP_CC2NPOL_POS 7U
-#define TIMER_CCEP_CC2NPOL_MSK BIT(TIMER_CCEP_CC2NPOL_POS)
-
-#define TIMER_CCEP_CC2NEN_POS 6U
-#define TIMER_CCEP_CC2NEN_MSK BIT(TIMER_CCEP_CC2NEN_POS)
-
-#define TIMER_CCEP_CC2POL_POS 5U
-#define TIMER_CCEP_CC2POL_MSK BIT(TIMER_CCEP_CC2POL_POS)
-
-#define TIMER_CCEP_CC2EN_POS 4U
-#define TIMER_CCEP_CC2EN_MSK BIT(TIMER_CCEP_CC2EN_POS)
-
-#define TIMER_CCEP_CC1NPOL_POS 3U
-#define TIMER_CCEP_CC1NPOL_MSK BIT(TIMER_CCEP_CC1NPOL_POS)
-
-#define TIMER_CCEP_CC1NEN_POS 2U
-#define TIMER_CCEP_CC1NEN_MSK BIT(TIMER_CCEP_CC1NEN_POS)
-
-#define TIMER_CCEP_CC1POL_POS 1U
-#define TIMER_CCEP_CC1POL_MSK BIT(TIMER_CCEP_CC1POL_POS)
-
-#define TIMER_CCEP_CC1EN_POS 0U
-#define TIMER_CCEP_CC1EN_MSK BIT(TIMER_CCEP_CC1EN_POS)
-
-/****************** Bit definition for TIMER_COUNT register ************************/
-
-#define TIMER_COUNT_CNTV_POSS 0U
-#define TIMER_COUNT_CNTV_POSE 15U
-#define TIMER_COUNT_CNTV_MSK BITS(TIMER_COUNT_CNTV_POSS,TIMER_COUNT_CNTV_POSE)
-
-/****************** Bit definition for TIMER_PRES register ************************/
-
-#define TIMER_PRES_PSCV_POSS 0U
-#define TIMER_PRES_PSCV_POSE 15U
-#define TIMER_PRES_PSCV_MSK BITS(TIMER_PRES_PSCV_POSS,TIMER_PRES_PSCV_POSE)
-
-/****************** Bit definition for TIMER_AR register ************************/
-
-#define TIMER_AR_ARRV_POSS 0U
-#define TIMER_AR_ARRV_POSE 15U
-#define TIMER_AR_ARRV_MSK BITS(TIMER_AR_ARRV_POSS,TIMER_AR_ARRV_POSE)
-
-/****************** Bit definition for TIMER_REPAR register ************************/
-
-#define TIMER_REPAR_REPV_POSS 0U
-#define TIMER_REPAR_REPV_POSE 7U
-#define TIMER_REPAR_REPV_MSK BITS(TIMER_REPAR_REPV_POSS,TIMER_REPAR_REPV_POSE)
-
-/****************** Bit definition for TIMER_CCVAL1 register ************************/
-
-#define TIMER_CCVAL1_CCRV1_POSS 0U
-#define TIMER_CCVAL1_CCRV1_POSE 15U
-#define TIMER_CCVAL1_CCRV1_MSK BITS(TIMER_CCVAL1_CCRV1_POSS,TIMER_CCVAL1_CCRV1_POSE)
-
-/****************** Bit definition for TIMER_CCVAL2 register ************************/
-
-#define TIMER_CCVAL2_CCRV2_POSS 0U
-#define TIMER_CCVAL2_CCRV2_POSE 15U
-#define TIMER_CCVAL2_CCRV2_MSK BITS(TIMER_CCVAL2_CCRV2_POSS,TIMER_CCVAL2_CCRV2_POSE)
-
-/****************** Bit definition for TIMER_CCVAL3 register ************************/
-
-#define TIMER_CCVAL3_CCRV3_POSS 0U
-#define TIMER_CCVAL3_CCRV3_POSE 15U
-#define TIMER_CCVAL3_CCRV3_MSK BITS(TIMER_CCVAL3_CCRV3_POSS,TIMER_CCVAL3_CCRV3_POSE)
-
-/****************** Bit definition for TIMER_CCVAL4 register ************************/
-
-#define TIMER_CCVAL4_CCRV4_POSS 0U
-#define TIMER_CCVAL4_CCRV4_POSE 15U
-#define TIMER_CCVAL4_CCRV4_MSK BITS(TIMER_CCVAL4_CCRV4_POSS,TIMER_CCVAL4_CCRV4_POSE)
-
-/****************** Bit definition for TIMER_BDCFG register ************************/
-
-#define TIMER_BDCFG_GOEN_POS 15U
-#define TIMER_BDCFG_GOEN_MSK BIT(TIMER_BDCFG_GOEN_POS)
-
-#define TIMER_BDCFG_AOEN_POS 14U
-#define TIMER_BDCFG_AOEN_MSK BIT(TIMER_BDCFG_AOEN_POS)
-
-#define TIMER_BDCFG_BRKP_POS 13U
-#define TIMER_BDCFG_BRKP_MSK BIT(TIMER_BDCFG_BRKP_POS)
-
-#define TIMER_BDCFG_BRKEN_POS 12U
-#define TIMER_BDCFG_BRKEN_MSK BIT(TIMER_BDCFG_BRKEN_POS)
-
-#define TIMER_BDCFG_OFFSSR_POS 11U
-#define TIMER_BDCFG_OFFSSR_MSK BIT(TIMER_BDCFG_OFFSSR_POS)
-
-#define TIMER_BDCFG_OFFSSI_POS 10U
-#define TIMER_BDCFG_OFFSSI_MSK BIT(TIMER_BDCFG_OFFSSI_POS)
-
-#define TIMER_BDCFG_LOCKLVL_POSS 8U
-#define TIMER_BDCFG_LOCKLVL_POSE 9U
-#define TIMER_BDCFG_LOCKLVL_MSK BITS(TIMER_BDCFG_LOCKLVL_POSS,TIMER_BDCFG_LOCKLVL_POSE)
-
-#define TIMER_BDCFG_DT_POSS 0U
-#define TIMER_BDCFG_DT_POSE 7U
-#define TIMER_BDCFG_DT_MSK BITS(TIMER_BDCFG_DT_POSS,TIMER_BDCFG_DT_POSE)
-
-typedef struct
-{
- __IO uint32_t CON1;
- __IO uint32_t CON2;
- __IO uint32_t SMCON;
- __O uint32_t DIER;
- __O uint32_t DIDR;
- __I uint32_t DIVS;
- __I uint32_t RIF;
- __I uint32_t IFM;
- __O uint32_t ICR;
- __O uint32_t SGE;
- __IO uint32_t CHMR1;
- __IO uint32_t CHMR2;
- __IO uint32_t CCEP;
- __IO uint32_t COUNT;
- __IO uint32_t PRES;
- __IO uint32_t AR;
- __IO uint32_t REPAR;
- __IO uint32_t CCVAL1;
- __IO uint32_t CCVAL2;
- __IO uint32_t CCVAL3;
- __IO uint32_t CCVAL4;
- __IO uint32_t BDCFG;
-} TIMER_TypeDef;
-
-/****************** Bit definition for USART_STAT register ************************/
-
-#define USART_STAT_CTSIF_POS 9U
-#define USART_STAT_CTSIF_MSK BIT(USART_STAT_CTSIF_POS)
-
-#define USART_STAT_TXEMPIF_POS 7U
-#define USART_STAT_TXEMPIF_MSK BIT(USART_STAT_TXEMPIF_POS)
-
-#define USART_STAT_TXCIF_POS 6U
-#define USART_STAT_TXCIF_MSK BIT(USART_STAT_TXCIF_POS)
-
-#define USART_STAT_RXNEIF_POS 5U
-#define USART_STAT_RXNEIF_MSK BIT(USART_STAT_RXNEIF_POS)
-
-#define USART_STAT_IDLEIF_POS 4U
-#define USART_STAT_IDLEIF_MSK BIT(USART_STAT_IDLEIF_POS)
-
-#define USART_STAT_OVRIF_POS 3U
-#define USART_STAT_OVRIF_MSK BIT(USART_STAT_OVRIF_POS)
-
-#define USART_STAT_NDETIF_POS 2U
-#define USART_STAT_NDETIF_MSK BIT(USART_STAT_NDETIF_POS)
-
-#define USART_STAT_FERRIF_POS 1U
-#define USART_STAT_FERRIF_MSK BIT(USART_STAT_FERRIF_POS)
-
-#define USART_STAT_PERRIF_POS 0U
-#define USART_STAT_PERRIF_MSK BIT(USART_STAT_PERRIF_POS)
-
-/****************** Bit definition for USART_DATA register ************************/
-
-#define USART_DATA_VAL_POSS 0U
-#define USART_DATA_VAL_POSE 8U
-#define USART_DATA_VAL_MSK BITS(USART_DATA_VAL_POSS,USART_DATA_VAL_POSE)
-
-/****************** Bit definition for USART_BAUDCON register ************************/
-
-#define USART_BAUDCON_DIV_M_POSS 4U
-#define USART_BAUDCON_DIV_M_POSE 15U
-#define USART_BAUDCON_DIV_M_MSK BITS(USART_BAUDCON_DIV_M_POSS,USART_BAUDCON_DIV_M_POSE)
-
-#define USART_BAUDCON_DIV_F_POSS 0U
-#define USART_BAUDCON_DIV_F_POSE 3U
-#define USART_BAUDCON_DIV_F_MSK BITS(USART_BAUDCON_DIV_F_POSS,USART_BAUDCON_DIV_F_POSE)
-
-/****************** Bit definition for USART_CON0 register ************************/
-
-#define USART_CON0_EN_POS 13U
-#define USART_CON0_EN_MSK BIT(USART_CON0_EN_POS)
-
-#define USART_CON0_DLEN_POS 12U
-#define USART_CON0_DLEN_MSK BIT(USART_CON0_DLEN_POS)
-
-#define USART_CON0_WKMOD_POS 11U
-#define USART_CON0_WKMOD_MSK BIT(USART_CON0_WKMOD_POS)
-
-#define USART_CON0_PEN_POS 10U
-#define USART_CON0_PEN_MSK BIT(USART_CON0_PEN_POS)
-
-#define USART_CON0_PSEL_POS 9U
-#define USART_CON0_PSEL_MSK BIT(USART_CON0_PSEL_POS)
-
-#define USART_CON0_PERRIE_POS 8U
-#define USART_CON0_PERRIE_MSK BIT(USART_CON0_PERRIE_POS)
-
-#define USART_CON0_TXEMPIE_POS 7U
-#define USART_CON0_TXEMPIE_MSK BIT(USART_CON0_TXEMPIE_POS)
-
-#define USART_CON0_TXCIE_POS 6U
-#define USART_CON0_TXCIE_MSK BIT(USART_CON0_TXCIE_POS)
-
-#define USART_CON0_RXNEIE_POS 5U
-#define USART_CON0_RXNEIE_MSK BIT(USART_CON0_RXNEIE_POS)
-
-#define USART_CON0_IDLEIE_POS 4U
-#define USART_CON0_IDLEIE_MSK BIT(USART_CON0_IDLEIE_POS)
-
-#define USART_CON0_TXEN_POS 3U
-#define USART_CON0_TXEN_MSK BIT(USART_CON0_TXEN_POS)
-
-#define USART_CON0_RXEN_POS 2U
-#define USART_CON0_RXEN_MSK BIT(USART_CON0_RXEN_POS)
-
-#define USART_CON0_RXWK_POS 1U
-#define USART_CON0_RXWK_MSK BIT(USART_CON0_RXWK_POS)
-
-/****************** Bit definition for USART_CON1 register ************************/
-
-#define USART_CON1_STPLEN_POSS 12U
-#define USART_CON1_STPLEN_POSE 13U
-#define USART_CON1_STPLEN_MSK BITS(USART_CON1_STPLEN_POSS,USART_CON1_STPLEN_POSE)
-
-#define USART_CON1_SCKEN_POS 11U
-#define USART_CON1_SCKEN_MSK BIT(USART_CON1_SCKEN_POS)
-
-#define USART_CON1_SCKPOL_POS 10U
-#define USART_CON1_SCKPOL_MSK BIT(USART_CON1_SCKPOL_POS)
-
-#define USART_CON1_SCKPHA_POS 9U
-#define USART_CON1_SCKPHA_MSK BIT(USART_CON1_SCKPHA_POS)
-
-#define USART_CON1_LBCP_POS 8U
-#define USART_CON1_LBCP_MSK BIT(USART_CON1_LBCP_POS)
-
-#define USART_CON1_ADDR_POSS 0U
-#define USART_CON1_ADDR_POSE 3U
-#define USART_CON1_ADDR_MSK BITS(USART_CON1_ADDR_POSS,USART_CON1_ADDR_POSE)
-
-/****************** Bit definition for USART_CON2 register ************************/
-
-#define USART_CON2_CTSIE_POS 10U
-#define USART_CON2_CTSIE_MSK BIT(USART_CON2_CTSIE_POS)
-
-#define USART_CON2_CTSEN_POS 9U
-#define USART_CON2_CTSEN_MSK BIT(USART_CON2_CTSEN_POS)
-
-#define USART_CON2_RTSEN_POS 8U
-#define USART_CON2_RTSEN_MSK BIT(USART_CON2_RTSEN_POS)
-
-#define USART_CON2_TXDMAEN_POS 7U
-#define USART_CON2_TXDMAEN_MSK BIT(USART_CON2_TXDMAEN_POS)
-
-#define USART_CON2_RXDMAEN_POS 6U
-#define USART_CON2_RXDMAEN_MSK BIT(USART_CON2_RXDMAEN_POS)
-
-#define USART_CON2_SMARTEN_POS 5U
-#define USART_CON2_SMARTEN_MSK BIT(USART_CON2_SMARTEN_POS)
-
-#define USART_CON2_NACK_POS 4U
-#define USART_CON2_NACK_MSK BIT(USART_CON2_NACK_POS)
-
-#define USART_CON2_HDPSEL_POS 3U
-#define USART_CON2_HDPSEL_MSK BIT(USART_CON2_HDPSEL_POS)
-
-#define USART_CON2_IREN_POS 1U
-#define USART_CON2_IREN_MSK BIT(USART_CON2_IREN_POS)
-
-#define USART_CON2_ERRIE_POS 0U
-#define USART_CON2_ERRIE_MSK BIT(USART_CON2_ERRIE_POS)
-
-/****************** Bit definition for USART_GP register ************************/
-
-#define USART_GP_GTVAL_POSS 8U
-#define USART_GP_GTVAL_POSE 15U
-#define USART_GP_GTVAL_MSK BITS(USART_GP_GTVAL_POSS,USART_GP_GTVAL_POSE)
-
-#define USART_GP_PSC_POSS 0U
-#define USART_GP_PSC_POSE 7U
-#define USART_GP_PSC_MSK BITS(USART_GP_PSC_POSS,USART_GP_PSC_POSE)
-
-typedef struct
-{
- __IO uint32_t STAT;
- __IO uint32_t DATA;
- __IO uint32_t BAUDCON;
- __IO uint32_t CON0;
- __IO uint32_t CON1;
- __IO uint32_t CON2;
- __IO uint32_t GP;
-} USART_TypeDef;
-
-/****************** Bit definition for UART_RBR register ************************/
-
-#define UART_RBR_RBR_POSS 0U
-#define UART_RBR_RBR_POSE 8U
-#define UART_RBR_RBR_MSK BITS(UART_RBR_RBR_POSS,UART_RBR_RBR_POSE)
-
-/****************** Bit definition for UART_TBR register ************************/
-
-#define UART_TBR_TBR_POSS 0U
-#define UART_TBR_TBR_POSE 8U
-#define UART_TBR_TBR_MSK BITS(UART_TBR_TBR_POSS,UART_TBR_TBR_POSE)
-
-/****************** Bit definition for UART_BRR register ************************/
-
-#define UART_BRR_BRR_POSS 0U
-#define UART_BRR_BRR_POSE 15U
-#define UART_BRR_BRR_MSK BITS(UART_BRR_BRR_POSS,UART_BRR_BRR_POSE)
-
-/****************** Bit definition for UART_LCR register ************************/
-
-#define UART_LCR_SWAP_POS 13U
-#define UART_LCR_SWAP_MSK BIT(UART_LCR_SWAP_POS)
-
-#define UART_LCR_TXINV_POS 12U
-#define UART_LCR_TXINV_MSK BIT(UART_LCR_TXINV_POS)
-
-#define UART_LCR_RXINV_POS 11U
-#define UART_LCR_RXINV_MSK BIT(UART_LCR_RXINV_POS)
-
-#define UART_LCR_DATAINV_POS 10U
-#define UART_LCR_DATAINV_MSK BIT(UART_LCR_DATAINV_POS)
-
-#define UART_LCR_MSBFIRST_POS 9U
-#define UART_LCR_MSBFIRST_MSK BIT(UART_LCR_MSBFIRST_POS)
-
-#define UART_LCR_RTOEN_POS 8U
-#define UART_LCR_RTOEN_MSK BIT(UART_LCR_RTOEN_POS)
-
-#define UART_LCR_BRWEN_POS 7U
-#define UART_LCR_BRWEN_MSK BIT(UART_LCR_BRWEN_POS)
-
-#define UART_LCR_BC_POS 6U
-#define UART_LCR_BC_MSK BIT(UART_LCR_BC_POS)
-
-#define UART_LCR_RXEN_POS 5U
-#define UART_LCR_RXEN_MSK BIT(UART_LCR_RXEN_POS)
-
-#define UART_LCR_PS_POS 4U
-#define UART_LCR_PS_MSK BIT(UART_LCR_PS_POS)
-
-#define UART_LCR_PEN_POS 3U
-#define UART_LCR_PEN_MSK BIT(UART_LCR_PEN_POS)
-
-#define UART_LCR_STOP_POS 2U
-#define UART_LCR_STOP_MSK BIT(UART_LCR_STOP_POS)
-
-#define UART_LCR_DLS_POSS 0U
-#define UART_LCR_DLS_POSE 1U
-#define UART_LCR_DLS_MSK BITS(UART_LCR_DLS_POSS,UART_LCR_DLS_POSE)
-
-/****************** Bit definition for UART_MCR register ************************/
-
-#define UART_MCR_HDSEL_POS 22U
-#define UART_MCR_HDSEL_MSK BIT(UART_MCR_HDSEL_POS)
-
-#define UART_MCR_ABRRS_POS 15U
-#define UART_MCR_ABRRS_MSK BIT(UART_MCR_ABRRS_POS)
-
-#define UART_MCR_ABRMOD_POSS 13U
-#define UART_MCR_ABRMOD_POSE 14U
-#define UART_MCR_ABRMOD_MSK BITS(UART_MCR_ABRMOD_POSS,UART_MCR_ABRMOD_POSE)
-
-#define UART_MCR_ABREN_POS 12U
-#define UART_MCR_ABREN_MSK BIT(UART_MCR_ABREN_POS)
-
-#define UART_MCR_DMAEN_POS 11U
-#define UART_MCR_DMAEN_MSK BIT(UART_MCR_DMAEN_POS)
-
-#define UART_MCR_LINBDL_POS 10U
-#define UART_MCR_LINBDL_MSK BIT(UART_MCR_LINBDL_POS)
-
-#define UART_MCR_BKREQ_POS 9U
-#define UART_MCR_BKREQ_MSK BIT(UART_MCR_BKREQ_POS)
-
-#define UART_MCR_LINEN_POS 8U
-#define UART_MCR_LINEN_MSK BIT(UART_MCR_LINEN_POS)
-
-#define UART_MCR_AADINV_POS 7U
-#define UART_MCR_AADINV_MSK BIT(UART_MCR_AADINV_POS)
-
-#define UART_MCR_AADDIR_POS 6U
-#define UART_MCR_AADDIR_MSK BIT(UART_MCR_AADDIR_POS)
-
-#define UART_MCR_AADNOR_POS 5U
-#define UART_MCR_AADNOR_MSK BIT(UART_MCR_AADNOR_POS)
-
-#define UART_MCR_AADEN_POS 4U
-#define UART_MCR_AADEN_MSK BIT(UART_MCR_AADEN_POS)
-
-#define UART_MCR_RTSCTRL_POS 3U
-#define UART_MCR_RTSCTRL_MSK BIT(UART_MCR_RTSCTRL_POS)
-
-#define UART_MCR_AFCEN_POS 2U
-#define UART_MCR_AFCEN_MSK BIT(UART_MCR_AFCEN_POS)
-
-#define UART_MCR_LBEN_POS 1U
-#define UART_MCR_LBEN_MSK BIT(UART_MCR_LBEN_POS)
-
-#define UART_MCR_IREN_POS 0U
-#define UART_MCR_IREN_MSK BIT(UART_MCR_IREN_POS)
-
-/****************** Bit definition for UART_CR register ************************/
-
-#define UART_CR_PSC_POSS 16U
-#define UART_CR_PSC_POSE 23U
-#define UART_CR_PSC_MSK BITS(UART_CR_PSC_POSS,UART_CR_PSC_POSE)
-
-#define UART_CR_DLY_POSS 8U
-#define UART_CR_DLY_POSE 15U
-#define UART_CR_DLY_MSK BITS(UART_CR_DLY_POSS,UART_CR_DLY_POSE)
-
-#define UART_CR_ADDR_POSS 0U
-#define UART_CR_ADDR_POSE 7U
-#define UART_CR_ADDR_MSK BITS(UART_CR_ADDR_POSS,UART_CR_ADDR_POSE)
-
-/****************** Bit definition for UART_RTOR register ************************/
-
-#define UART_RTOR_BLEN_POSS 24U
-#define UART_RTOR_BLEN_POSE 31U
-#define UART_RTOR_BLEN_MSK BITS(UART_RTOR_BLEN_POSS,UART_RTOR_BLEN_POSE)
-
-#define UART_RTOR_RTO_POSS 0U
-#define UART_RTOR_RTO_POSE 23U
-#define UART_RTOR_RTO_MSK BITS(UART_RTOR_RTO_POSS,UART_RTOR_RTO_POSE)
-
-/****************** Bit definition for UART_FCR register ************************/
-
-#define UART_FCR_TXFL_POSS 12U
-#define UART_FCR_TXFL_POSE 15U
-#define UART_FCR_TXFL_MSK BITS(UART_FCR_TXFL_POSS,UART_FCR_TXFL_POSE)
-
-#define UART_FCR_RXFL_POSS 8U
-#define UART_FCR_RXFL_POSE 11U
-#define UART_FCR_RXFL_MSK BITS(UART_FCR_RXFL_POSS,UART_FCR_RXFL_POSE)
-
-#define UART_FCR_TXTL_POSS 6U
-#define UART_FCR_TXTL_POSE 7U
-#define UART_FCR_TXTL_MSK BITS(UART_FCR_TXTL_POSS,UART_FCR_TXTL_POSE)
-
-#define UART_FCR_RXTL_POSS 4U
-#define UART_FCR_RXTL_POSE 5U
-#define UART_FCR_RXTL_MSK BITS(UART_FCR_RXTL_POSS,UART_FCR_RXTL_POSE)
-
-#define UART_FCR_TFRST_POS 2U
-#define UART_FCR_TFRST_MSK BIT(UART_FCR_TFRST_POS)
-
-#define UART_FCR_RFRST_POS 1U
-#define UART_FCR_RFRST_MSK BIT(UART_FCR_RFRST_POS)
-
-#define UART_FCR_FIFOEN_POS 0U
-#define UART_FCR_FIFOEN_MSK BIT(UART_FCR_FIFOEN_POS)
-
-/****************** Bit definition for UART_SR register ************************/
-
-#define UART_SR_CTS_POS 14U
-#define UART_SR_CTS_MSK BIT(UART_SR_CTS_POS)
-
-#define UART_SR_DCTS_POS 13U
-#define UART_SR_DCTS_MSK BIT(UART_SR_DCTS_POS)
-
-#define UART_SR_RFF_POS 12U
-#define UART_SR_RFF_MSK BIT(UART_SR_RFF_POS)
-
-#define UART_SR_RFNE_POS 11U
-#define UART_SR_RFNE_MSK BIT(UART_SR_RFNE_POS)
-
-#define UART_SR_TFEM_POS 10U
-#define UART_SR_TFEM_MSK BIT(UART_SR_TFEM_POS)
-
-#define UART_SR_TFNF_POS 9U
-#define UART_SR_TFNF_MSK BIT(UART_SR_TFNF_POS)
-
-#define UART_SR_BUSY_POS 8U
-#define UART_SR_BUSY_MSK BIT(UART_SR_BUSY_POS)
-
-#define UART_SR_RFE_POS 7U
-#define UART_SR_RFE_MSK BIT(UART_SR_RFE_POS)
-
-#define UART_SR_TEM_POS 6U
-#define UART_SR_TEM_MSK BIT(UART_SR_TEM_POS)
-
-#define UART_SR_TBEM_POS 5U
-#define UART_SR_TBEM_MSK BIT(UART_SR_TBEM_POS)
-
-#define UART_SR_BF_POS 4U
-#define UART_SR_BF_MSK BIT(UART_SR_BF_POS)
-
-#define UART_SR_FE_POS 3U
-#define UART_SR_FE_MSK BIT(UART_SR_FE_POS)
-
-#define UART_SR_PE_POS 2U
-#define UART_SR_PE_MSK BIT(UART_SR_PE_POS)
-
-#define UART_SR_OE_POS 1U
-#define UART_SR_OE_MSK BIT(UART_SR_OE_POS)
-
-#define UART_SR_DR_POS 0U
-#define UART_SR_DR_MSK BIT(UART_SR_DR_POS)
-
-/****************** Bit definition for UART_IER register ************************/
-
-#define UART_IER_CMIE_POS 11U
-#define UART_IER_CMIE_MSK BIT(UART_IER_CMIE_POS)
-
-#define UART_IER_EOBIE_POS 10U
-#define UART_IER_EOBIE_MSK BIT(UART_IER_EOBIE_POS)
-
-#define UART_IER_TCIE_POS 9U
-#define UART_IER_TCIE_MSK BIT(UART_IER_TCIE_POS)
-
-#define UART_IER_LINBKIE_POS 8U
-#define UART_IER_LINBKIE_MSK BIT(UART_IER_LINBKIE_POS)
-
-#define UART_IER_ABTOIE_POS 7U
-#define UART_IER_ABTOIE_MSK BIT(UART_IER_ABTOIE_POS)
-
-#define UART_IER_ABEIE_POS 6U
-#define UART_IER_ABEIE_MSK BIT(UART_IER_ABEIE_POS)
-
-#define UART_IER_BZIE_POS 5U
-#define UART_IER_BZIE_MSK BIT(UART_IER_BZIE_POS)
-
-#define UART_IER_RTOIE_POS 4U
-#define UART_IER_RTOIE_MSK BIT(UART_IER_RTOIE_POS)
-
-#define UART_IER_MDSIE_POS 3U
-#define UART_IER_MDSIE_MSK BIT(UART_IER_MDSIE_POS)
-
-#define UART_IER_RXSIE_POS 2U
-#define UART_IER_RXSIE_MSK BIT(UART_IER_RXSIE_POS)
-
-#define UART_IER_TXSIE_POS 1U
-#define UART_IER_TXSIE_MSK BIT(UART_IER_TXSIE_POS)
-
-#define UART_IER_RXRDIE_POS 0U
-#define UART_IER_RXRDIE_MSK BIT(UART_IER_RXRDIE_POS)
-
-/****************** Bit definition for UART_IDR register ************************/
-
-#define UART_IDR_CMID_POS 11U
-#define UART_IDR_CMID_MSK BIT(UART_IDR_CMID_POS)
-
-#define UART_IDR_EOBID_POS 10U
-#define UART_IDR_EOBID_MSK BIT(UART_IDR_EOBID_POS)
-
-#define UART_IDR_TCID_POS 9U
-#define UART_IDR_TCID_MSK BIT(UART_IDR_TCID_POS)
-
-#define UART_IDR_LINBKID_POS 8U
-#define UART_IDR_LINBKID_MSK BIT(UART_IDR_LINBKID_POS)
-
-#define UART_IDR_ABTOID_POS 7U
-#define UART_IDR_ABTOID_MSK BIT(UART_IDR_ABTOID_POS)
-
-#define UART_IDR_ABEID_POS 6U
-#define UART_IDR_ABEID_MSK BIT(UART_IDR_ABEID_POS)
-
-#define UART_IDR_BZID_POS 5U
-#define UART_IDR_BZID_MSK BIT(UART_IDR_BZID_POS)
-
-#define UART_IDR_RTOID_POS 4U
-#define UART_IDR_RTOID_MSK BIT(UART_IDR_RTOID_POS)
-
-#define UART_IDR_MDSID_POS 3U
-#define UART_IDR_MDSID_MSK BIT(UART_IDR_MDSID_POS)
-
-#define UART_IDR_RXSID_POS 2U
-#define UART_IDR_RXSID_MSK BIT(UART_IDR_RXSID_POS)
-
-#define UART_IDR_TXSID_POS 1U
-#define UART_IDR_TXSID_MSK BIT(UART_IDR_TXSID_POS)
-
-#define UART_IDR_RXRDID_POS 0U
-#define UART_IDR_RXRDID_MSK BIT(UART_IDR_RXRDID_POS)
-
-/****************** Bit definition for UART_IVS register ************************/
-
-#define UART_IVS_CMIS_POS 11U
-#define UART_IVS_CMIS_MSK BIT(UART_IVS_CMIS_POS)
-
-#define UART_IVS_EOBIS_POS 10U
-#define UART_IVS_EOBIS_MSK BIT(UART_IVS_EOBIS_POS)
-
-#define UART_IVS_TCIS_POS 9U
-#define UART_IVS_TCIS_MSK BIT(UART_IVS_TCIS_POS)
-
-#define UART_IVS_LINBKIS_POS 8U
-#define UART_IVS_LINBKIS_MSK BIT(UART_IVS_LINBKIS_POS)
-
-#define UART_IVS_ABTOIS_POS 7U
-#define UART_IVS_ABTOIS_MSK BIT(UART_IVS_ABTOIS_POS)
-
-#define UART_IVS_ABEIS_POS 6U
-#define UART_IVS_ABEIS_MSK BIT(UART_IVS_ABEIS_POS)
-
-#define UART_IVS_BZIS_POS 5U
-#define UART_IVS_BZIS_MSK BIT(UART_IVS_BZIS_POS)
-
-#define UART_IVS_RTOIS_POS 4U
-#define UART_IVS_RTOIS_MSK BIT(UART_IVS_RTOIS_POS)
-
-#define UART_IVS_MDSIS_POS 3U
-#define UART_IVS_MDSIS_MSK BIT(UART_IVS_MDSIS_POS)
-
-#define UART_IVS_RXSIS_POS 2U
-#define UART_IVS_RXSIS_MSK BIT(UART_IVS_RXSIS_POS)
-
-#define UART_IVS_TXSIS_POS 1U
-#define UART_IVS_TXSIS_MSK BIT(UART_IVS_TXSIS_POS)
-
-#define UART_IVS_RXRDIS_POS 0U
-#define UART_IVS_RXRDIS_MSK BIT(UART_IVS_RXRDIS_POS)
-
-/****************** Bit definition for UART_RIF register ************************/
-
-#define UART_RIF_CMIF_POS 11U
-#define UART_RIF_CMIF_MSK BIT(UART_RIF_CMIF_POS)
-
-#define UART_RIF_EOBIF_POS 10U
-#define UART_RIF_EOBIF_MSK BIT(UART_RIF_EOBIF_POS)
-
-#define UART_RIF_TCIF_POS 9U
-#define UART_RIF_TCIF_MSK BIT(UART_RIF_TCIF_POS)
-
-#define UART_RIF_LINBKIF_POS 8U
-#define UART_RIF_LINBKIF_MSK BIT(UART_RIF_LINBKIF_POS)
-
-#define UART_RIF_ABTOIF_POS 7U
-#define UART_RIF_ABTOIF_MSK BIT(UART_RIF_ABTOIF_POS)
-
-#define UART_RIF_ABEIF_POS 6U
-#define UART_RIF_ABEIF_MSK BIT(UART_RIF_ABEIF_POS)
-
-#define UART_RIF_BZIF_POS 5U
-#define UART_RIF_BZIF_MSK BIT(UART_RIF_BZIF_POS)
-
-#define UART_RIF_RTOIF_POS 4U
-#define UART_RIF_RTOIF_MSK BIT(UART_RIF_RTOIF_POS)
-
-#define UART_RIF_MDSIF_POS 3U
-#define UART_RIF_MDSIF_MSK BIT(UART_RIF_MDSIF_POS)
-
-#define UART_RIF_RXSIF_POS 2U
-#define UART_RIF_RXSIF_MSK BIT(UART_RIF_RXSIF_POS)
-
-#define UART_RIF_TXSIF_POS 1U
-#define UART_RIF_TXSIF_MSK BIT(UART_RIF_TXSIF_POS)
-
-#define UART_RIF_RXRDIF_POS 0U
-#define UART_RIF_RXRDIF_MSK BIT(UART_RIF_RXRDIF_POS)
-
-/****************** Bit definition for UART_IFM register ************************/
-
-#define UART_IFM_CMIM_POS 11U
-#define UART_IFM_CMIM_MSK BIT(UART_IFM_CMIM_POS)
-
-#define UART_IFM_EOBIM_POS 10U
-#define UART_IFM_EOBIM_MSK BIT(UART_IFM_EOBIM_POS)
-
-#define UART_IFM_TCIM_POS 9U
-#define UART_IFM_TCIM_MSK BIT(UART_IFM_TCIM_POS)
-
-#define UART_IFM_LINBKIM_POS 8U
-#define UART_IFM_LINBKIM_MSK BIT(UART_IFM_LINBKIM_POS)
-
-#define UART_IFM_ABTOIM_POS 7U
-#define UART_IFM_ABTOIM_MSK BIT(UART_IFM_ABTOIM_POS)
-
-#define UART_IFM_ABEIM_POS 6U
-#define UART_IFM_ABEIM_MSK BIT(UART_IFM_ABEIM_POS)
-
-#define UART_IFM_BZIM_POS 5U
-#define UART_IFM_BZIM_MSK BIT(UART_IFM_BZIM_POS)
-
-#define UART_IFM_RTOIM_POS 4U
-#define UART_IFM_RTOIM_MSK BIT(UART_IFM_RTOIM_POS)
-
-#define UART_IFM_MDSIM_POS 3U
-#define UART_IFM_MDSIM_MSK BIT(UART_IFM_MDSIM_POS)
-
-#define UART_IFM_RXSIM_POS 2U
-#define UART_IFM_RXSIM_MSK BIT(UART_IFM_RXSIM_POS)
-
-#define UART_IFM_TXSIM_POS 1U
-#define UART_IFM_TXSIM_MSK BIT(UART_IFM_TXSIM_POS)
-
-#define UART_IFM_RXRDIM_POS 0U
-#define UART_IFM_RXRDIM_MSK BIT(UART_IFM_RXRDIM_POS)
-
-/****************** Bit definition for UART_ICR register ************************/
-
-#define UART_ICR_CMIC_POS 11U
-#define UART_ICR_CMIC_MSK BIT(UART_ICR_CMIC_POS)
-
-#define UART_ICR_EOBIC_POS 10U
-#define UART_ICR_EOBIC_MSK BIT(UART_ICR_EOBIC_POS)
-
-#define UART_ICR_TCIC_POS 9U
-#define UART_ICR_TCIC_MSK BIT(UART_ICR_TCIC_POS)
-
-#define UART_ICR_LINBKIC_POS 8U
-#define UART_ICR_LINBKIC_MSK BIT(UART_ICR_LINBKIC_POS)
-
-#define UART_ICR_ABTOIC_POS 7U
-#define UART_ICR_ABTOIC_MSK BIT(UART_ICR_ABTOIC_POS)
-
-#define UART_ICR_ABEIC_POS 6U
-#define UART_ICR_ABEIC_MSK BIT(UART_ICR_ABEIC_POS)
-
-#define UART_ICR_BZIC_POS 5U
-#define UART_ICR_BZIC_MSK BIT(UART_ICR_BZIC_POS)
-
-#define UART_ICR_CHTOIC_POS 4U
-#define UART_ICR_CHTOIC_MSK BIT(UART_ICR_CHTOIC_POS)
-
-#define UART_ICR_MDSIC_POS 3U
-#define UART_ICR_MDSIC_MSK BIT(UART_ICR_MDSIC_POS)
-
-#define UART_ICR_RXSIC_POS 2U
-#define UART_ICR_RXSIC_MSK BIT(UART_ICR_RXSIC_POS)
-
-#define UART_ICR_TXSIC_POS 1U
-#define UART_ICR_TXSIC_MSK BIT(UART_ICR_TXSIC_POS)
-
-#define UART_ICR_RXRDIC_POS 0U
-#define UART_ICR_RXRDIC_MSK BIT(UART_ICR_RXRDIC_POS)
-
-typedef struct
-{
- __I uint32_t RBR;
- __IO uint32_t TBR;
- __IO uint32_t BRR;
- __IO uint32_t LCR;
- __IO uint32_t MCR;
- __IO uint32_t CR;
- __IO uint32_t RTOR;
- __IO uint32_t FCR;
- __I uint32_t SR;
- __O uint32_t IER;
- __O uint32_t IDR;
- __I uint32_t IVS;
- __I uint32_t RIF;
- __I uint32_t IFM;
- __O uint32_t ICR;
-} UART_TypeDef;
-
-/****************** Bit definition for LPUART_CON0 register ************************/
-
-#define LPUART_CON0_MODESEL_POSS 30U
-#define LPUART_CON0_MODESEL_POSE 31U
-#define LPUART_CON0_MODESEL_MSK BITS(LPUART_CON0_MODESEL_POSS,LPUART_CON0_MODESEL_POSE)
-
-#define LPUART_CON0_TXDMAE_POS 29U
-#define LPUART_CON0_TXDMAE_MSK BIT(LPUART_CON0_TXDMAE_POS)
-
-#define LPUART_CON0_RXDMAE_POS 28U
-#define LPUART_CON0_RXDMAE_MSK BIT(LPUART_CON0_RXDMAE_POS)
-
-#define LPUART_CON0_INTERVAL_POSS 16U
-#define LPUART_CON0_INTERVAL_POSE 23U
-#define LPUART_CON0_INTERVAL_MSK BITS(LPUART_CON0_INTERVAL_POSS,LPUART_CON0_INTERVAL_POSE)
-
-#define LPUART_CON0_SYNCBP_POS 15U
-#define LPUART_CON0_SYNCBP_MSK BIT(LPUART_CON0_SYNCBP_POS)
-
-#define LPUART_CON0_CTSPOL_POS 13U
-#define LPUART_CON0_CTSPOL_MSK BIT(LPUART_CON0_CTSPOL_POS)
-
-#define LPUART_CON0_RTSPOL_POS 12U
-#define LPUART_CON0_RTSPOL_MSK BIT(LPUART_CON0_RTSPOL_POS)
-
-#define LPUART_CON0_ATCTSE_POS 11U
-#define LPUART_CON0_ATCTSE_MSK BIT(LPUART_CON0_ATCTSE_POS)
-
-#define LPUART_CON0_ATRTSE_POS 10U
-#define LPUART_CON0_ATRTSE_MSK BIT(LPUART_CON0_ATRTSE_POS)
-
-#define LPUART_CON0_BRKCE_POS 8U
-#define LPUART_CON0_BRKCE_MSK BIT(LPUART_CON0_BRKCE_POS)
-
-#define LPUART_CON0_LPBMOD_POS 7U
-#define LPUART_CON0_LPBMOD_MSK BIT(LPUART_CON0_LPBMOD_POS)
-
-#define LPUART_CON0_STICKPARSEL_POS 6U
-#define LPUART_CON0_STICKPARSEL_MSK BIT(LPUART_CON0_STICKPARSEL_POS)
-
-#define LPUART_CON0_EVENPARSEL_POS 5U
-#define LPUART_CON0_EVENPARSEL_MSK BIT(LPUART_CON0_EVENPARSEL_POS)
-
-#define LPUART_CON0_PARCHKE_POS 4U
-#define LPUART_CON0_PARCHKE_MSK BIT(LPUART_CON0_PARCHKE_POS)
-
-#define LPUART_CON0_STPLENTH_POS 3U
-#define LPUART_CON0_STPLENTH_MSK BIT(LPUART_CON0_STPLENTH_POS)
-
-#define LPUART_CON0_DATLENTH_POSS 0U
-#define LPUART_CON0_DATLENTH_POSE 2U
-#define LPUART_CON0_DATLENTH_MSK BITS(LPUART_CON0_DATLENTH_POSS,LPUART_CON0_DATLENTH_POSE)
-
-/****************** Bit definition for LPUART_CON1 register ************************/
-
-#define LPUART_CON1_ADDCMP_POSS 24U
-#define LPUART_CON1_ADDCMP_POSE 31U
-#define LPUART_CON1_ADDCMP_MSK BITS(LPUART_CON1_ADDCMP_POSS,LPUART_CON1_ADDCMP_POSE)
-
-#define LPUART_CON1_ADETE_POS 23U
-#define LPUART_CON1_ADETE_MSK BIT(LPUART_CON1_ADETE_POS)
-
-#define LPUART_CON1_ATDIRM_POS 22U
-#define LPUART_CON1_ATDIRM_MSK BIT(LPUART_CON1_ATDIRM_POS)
-
-#define LPUART_CON1_ATADETE_POS 21U
-#define LPUART_CON1_ATADETE_MSK BIT(LPUART_CON1_ATADETE_POS)
-
-#define LPUART_CON1_NMPMOD_POS 20U
-#define LPUART_CON1_NMPMOD_MSK BIT(LPUART_CON1_NMPMOD_POS)
-
-#define LPUART_CON1_IRWIDTH_POS 16U
-#define LPUART_CON1_IRWIDTH_MSK BIT(LPUART_CON1_IRWIDTH_POS)
-
-#define LPUART_CON1_TOICMP_POSS 8U
-#define LPUART_CON1_TOICMP_POSE 15U
-#define LPUART_CON1_TOICMP_MSK BITS(LPUART_CON1_TOICMP_POSS,LPUART_CON1_TOICMP_POSE)
-
-#define LPUART_CON1_TOCNTE_POS 7U
-#define LPUART_CON1_TOCNTE_MSK BIT(LPUART_CON1_TOCNTE_POS)
-
-#define LPUART_CON1_IRTXINV_POS 3U
-#define LPUART_CON1_IRTXINV_MSK BIT(LPUART_CON1_IRTXINV_POS)
-
-#define LPUART_CON1_IRRXINV_POS 2U
-#define LPUART_CON1_IRRXINV_MSK BIT(LPUART_CON1_IRRXINV_POS)
-
-#define LPUART_CON1_IRTXE_POS 1U
-#define LPUART_CON1_IRTXE_MSK BIT(LPUART_CON1_IRTXE_POS)
-
-#define LPUART_CON1_RTS_POS 0U
-#define LPUART_CON1_RTS_MSK BIT(LPUART_CON1_RTS_POS)
-
-/****************** Bit definition for LPUART_CLKDIV register ************************/
-
-#define LPUART_CLKDIV_CLKDIV_POSS 0U
-#define LPUART_CLKDIV_CLKDIV_POSE 19U
-#define LPUART_CLKDIV_CLKDIV_MSK BITS(LPUART_CLKDIV_CLKDIV_POSS,LPUART_CLKDIV_CLKDIV_POSE)
-
-/****************** Bit definition for LPUART_FIFOCON register ************************/
-
-#define LPUART_FIFOCON_RTSTRGLVL_POSS 12U
-#define LPUART_FIFOCON_RTSTRGLVL_POSE 15U
-#define LPUART_FIFOCON_RTSTRGLVL_MSK BITS(LPUART_FIFOCON_RTSTRGLVL_POSS,LPUART_FIFOCON_RTSTRGLVL_POSE)
-
-#define LPUART_FIFOCON_RXTRGLVL_POSS 8U
-#define LPUART_FIFOCON_RXTRGLVL_POSE 11U
-#define LPUART_FIFOCON_RXTRGLVL_MSK BITS(LPUART_FIFOCON_RXTRGLVL_POSS,LPUART_FIFOCON_RXTRGLVL_POSE)
-
-#define LPUART_FIFOCON_NMPMRXDIS_POS 2U
-#define LPUART_FIFOCON_NMPMRXDIS_MSK BIT(LPUART_FIFOCON_NMPMRXDIS_POS)
-
-#define LPUART_FIFOCON_TXRESET_POS 1U
-#define LPUART_FIFOCON_TXRESET_MSK BIT(LPUART_FIFOCON_TXRESET_POS)
-
-#define LPUART_FIFOCON_RXRESET_POS 0U
-#define LPUART_FIFOCON_RXRESET_MSK BIT(LPUART_FIFOCON_RXRESET_POS)
-
-/****************** Bit definition for LPUART_RXDR register ************************/
-
-#define LPUART_RXDR_FERR_POS 15U
-#define LPUART_RXDR_FERR_MSK BIT(LPUART_RXDR_FERR_POS)
-
-#define LPUART_RXDR_PERR_POS 14U
-#define LPUART_RXDR_PERR_MSK BIT(LPUART_RXDR_PERR_POS)
-
-#define LPUART_RXDR_RXDR_POSS 0U
-#define LPUART_RXDR_RXDR_POSE 8U
-#define LPUART_RXDR_RXDR_MSK BITS(LPUART_RXDR_RXDR_POSS,LPUART_RXDR_RXDR_POSE)
-
-/****************** Bit definition for LPUART_TXDR register ************************/
-
-#define LPUART_TXDR_TXDR_POSS 0U
-#define LPUART_TXDR_TXDR_POSE 8U
-#define LPUART_TXDR_TXDR_MSK BITS(LPUART_TXDR_TXDR_POSS,LPUART_TXDR_TXDR_POSE)
-
-/****************** Bit definition for LPUART_STAT register ************************/
-
-#define LPUART_STAT_RTSSTAT_POS 18U
-#define LPUART_STAT_RTSSTAT_MSK BIT(LPUART_STAT_RTSSTAT_POS)
-
-#define LPUART_STAT_CTSSTAT_POS 17U
-#define LPUART_STAT_CTSSTAT_MSK BIT(LPUART_STAT_CTSSTAT_POS)
-
-#define LPUART_STAT_TXIDLE_POS 16U
-#define LPUART_STAT_TXIDLE_MSK BIT(LPUART_STAT_TXIDLE_POS)
-
-#define LPUART_STAT_TXFULL_POS 15U
-#define LPUART_STAT_TXFULL_MSK BIT(LPUART_STAT_TXFULL_POS)
-
-#define LPUART_STAT_TXEMP_POS 14U
-#define LPUART_STAT_TXEMP_MSK BIT(LPUART_STAT_TXEMP_POS)
-
-#define LPUART_STAT_TXPTR_POSS 8U
-#define LPUART_STAT_TXPTR_POSE 13U
-#define LPUART_STAT_TXPTR_MSK BITS(LPUART_STAT_TXPTR_POSS,LPUART_STAT_TXPTR_POSE)
-
-#define LPUART_STAT_RXFULL_POS 7U
-#define LPUART_STAT_RXFULL_MSK BIT(LPUART_STAT_RXFULL_POS)
-
-#define LPUART_STAT_RXEMP_POS 6U
-#define LPUART_STAT_RXEMP_MSK BIT(LPUART_STAT_RXEMP_POS)
-
-#define LPUART_STAT_RXPTR_POSS 0U
-#define LPUART_STAT_RXPTR_POSE 5U
-#define LPUART_STAT_RXPTR_MSK BITS(LPUART_STAT_RXPTR_POSS,LPUART_STAT_RXPTR_POSE)
-
-/****************** Bit definition for LPUART_IER register ************************/
-
-#define LPUART_IER_TCIE_POS 15U
-#define LPUART_IER_TCIE_MSK BIT(LPUART_IER_TCIE_POS)
-
-#define LPUART_IER_ADETIE_POS 12U
-#define LPUART_IER_ADETIE_MSK BIT(LPUART_IER_ADETIE_POS)
-
-#define LPUART_IER_BRKERRIE_POS 11U
-#define LPUART_IER_BRKERRIE_MSK BIT(LPUART_IER_BRKERRIE_POS)
-
-#define LPUART_IER_FERRIE_POS 10U
-#define LPUART_IER_FERRIE_MSK BIT(LPUART_IER_FERRIE_POS)
-
-#define LPUART_IER_PERRIE_POS 9U
-#define LPUART_IER_PERRIE_MSK BIT(LPUART_IER_PERRIE_POS)
-
-#define LPUART_IER_DATWKIE_POS 8U
-#define LPUART_IER_DATWKIE_MSK BIT(LPUART_IER_DATWKIE_POS)
-
-#define LPUART_IER_CTSWKIE_POS 7U
-#define LPUART_IER_CTSWKIE_MSK BIT(LPUART_IER_CTSWKIE_POS)
-
-#define LPUART_IER_TXOVIE_POS 5U
-#define LPUART_IER_TXOVIE_MSK BIT(LPUART_IER_TXOVIE_POS)
-
-#define LPUART_IER_RXOVIE_POS 4U
-#define LPUART_IER_RXOVIE_MSK BIT(LPUART_IER_RXOVIE_POS)
-
-#define LPUART_IER_RXTOIE_POS 3U
-#define LPUART_IER_RXTOIE_MSK BIT(LPUART_IER_RXTOIE_POS)
-
-#define LPUART_IER_CTSDETIE_POS 2U
-#define LPUART_IER_CTSDETIE_MSK BIT(LPUART_IER_CTSDETIE_POS)
-
-#define LPUART_IER_TBEMPIE_POS 1U
-#define LPUART_IER_TBEMPIE_MSK BIT(LPUART_IER_TBEMPIE_POS)
-
-#define LPUART_IER_RBRIE_POS 0U
-#define LPUART_IER_RBRIE_MSK BIT(LPUART_IER_RBRIE_POS)
-
-/****************** Bit definition for LPUART_IFLAG register ************************/
-
-#define LPUART_IFLAG_TCIF_POS 15U
-#define LPUART_IFLAG_TCIF_MSK BIT(LPUART_IFLAG_TCIF_POS)
-
-#define LPUART_IFLAG_ADETIF_POS 12U
-#define LPUART_IFLAG_ADETIF_MSK BIT(LPUART_IFLAG_ADETIF_POS)
-
-#define LPUART_IFLAG_BRKERRIF_POS 11U
-#define LPUART_IFLAG_BRKERRIF_MSK BIT(LPUART_IFLAG_BRKERRIF_POS)
-
-#define LPUART_IFLAG_FERRIF_POS 10U
-#define LPUART_IFLAG_FERRIF_MSK BIT(LPUART_IFLAG_FERRIF_POS)
-
-#define LPUART_IFLAG_PERRIF_POS 9U
-#define LPUART_IFLAG_PERRIF_MSK BIT(LPUART_IFLAG_PERRIF_POS)
-
-#define LPUART_IFLAG_DATWKIF_POS 8U
-#define LPUART_IFLAG_DATWKIF_MSK BIT(LPUART_IFLAG_DATWKIF_POS)
-
-#define LPUART_IFLAG_CTSWKIF_POS 7U
-#define LPUART_IFLAG_CTSWKIF_MSK BIT(LPUART_IFLAG_CTSWKIF_POS)
-
-#define LPUART_IFLAG_TXOVIF_POS 5U
-#define LPUART_IFLAG_TXOVIF_MSK BIT(LPUART_IFLAG_TXOVIF_POS)
-
-#define LPUART_IFLAG_RXOVIF_POS 4U
-#define LPUART_IFLAG_RXOVIF_MSK BIT(LPUART_IFLAG_RXOVIF_POS)
-
-#define LPUART_IFLAG_RXTOIF_POS 3U
-#define LPUART_IFLAG_RXTOIF_MSK BIT(LPUART_IFLAG_RXTOIF_POS)
-
-#define LPUART_IFLAG_CTSDETIF_POS 2U
-#define LPUART_IFLAG_CTSDETIF_MSK BIT(LPUART_IFLAG_CTSDETIF_POS)
-
-#define LPUART_IFLAG_TBEMPIF_POS 1U
-#define LPUART_IFLAG_TBEMPIF_MSK BIT(LPUART_IFLAG_TBEMPIF_POS)
-
-#define LPUART_IFLAG_RBRIF_POS 0U
-#define LPUART_IFLAG_RBRIF_MSK BIT(LPUART_IFLAG_RBRIF_POS)
-
-/****************** Bit definition for LPUART_IFC register ************************/
-
-#define LPUART_IFC_TCIFC_POS 15U
-#define LPUART_IFC_TCIFC_MSK BIT(LPUART_IFC_TCIFC_POS)
-
-#define LPUART_IFC_ADETIFC_POS 12U
-#define LPUART_IFC_ADETIFC_MSK BIT(LPUART_IFC_ADETIFC_POS)
-
-#define LPUART_IFC_BRKERRIFC_POS 11U
-#define LPUART_IFC_BRKERRIFC_MSK BIT(LPUART_IFC_BRKERRIFC_POS)
-
-#define LPUART_IFC_FERRIFC_POS 10U
-#define LPUART_IFC_FERRIFC_MSK BIT(LPUART_IFC_FERRIFC_POS)
-
-#define LPUART_IFC_PERRIFC_POS 9U
-#define LPUART_IFC_PERRIFC_MSK BIT(LPUART_IFC_PERRIFC_POS)
-
-#define LPUART_IFC_DATWKIFC_POS 8U
-#define LPUART_IFC_DATWKIFC_MSK BIT(LPUART_IFC_DATWKIFC_POS)
-
-#define LPUART_IFC_CTSWKIFC_POS 7U
-#define LPUART_IFC_CTSWKIFC_MSK BIT(LPUART_IFC_CTSWKIFC_POS)
-
-#define LPUART_IFC_TXOVIFC_POS 5U
-#define LPUART_IFC_TXOVIFC_MSK BIT(LPUART_IFC_TXOVIFC_POS)
-
-#define LPUART_IFC_RXOVIFC_POS 4U
-#define LPUART_IFC_RXOVIFC_MSK BIT(LPUART_IFC_RXOVIFC_POS)
-
-#define LPUART_IFC_CTSDETIFC_POS 2U
-#define LPUART_IFC_CTSDETIFC_MSK BIT(LPUART_IFC_CTSDETIFC_POS)
-
-#define LPUART_IFC_TBEMPIFC_POS 1U
-#define LPUART_IFC_TBEMPIFC_MSK BIT(LPUART_IFC_TBEMPIFC_POS)
-
-#define LPUART_IFC_RBRIFC_POS 0U
-#define LPUART_IFC_RBRIFC_MSK BIT(LPUART_IFC_RBRIFC_POS)
-
-/****************** Bit definition for LPUART_ISTAT register ************************/
-
-#define LPUART_ISTAT_TCINT_POS 15U
-#define LPUART_ISTAT_TCINT_MSK BIT(LPUART_ISTAT_TCINT_POS)
-
-#define LPUART_ISTAT_RXSTATINT_POS 9U
-#define LPUART_ISTAT_RXSTATINT_MSK BIT(LPUART_ISTAT_RXSTATINT_POS)
-
-#define LPUART_ISTAT_DATWKINT_POS 8U
-#define LPUART_ISTAT_DATWKINT_MSK BIT(LPUART_ISTAT_DATWKINT_POS)
-
-#define LPUART_ISTAT_CTSWKINT_POS 7U
-#define LPUART_ISTAT_CTSWKINT_MSK BIT(LPUART_ISTAT_CTSWKINT_POS)
-
-#define LPUART_ISTAT_BUFERRINT_POS 4U
-#define LPUART_ISTAT_BUFERRINT_MSK BIT(LPUART_ISTAT_BUFERRINT_POS)
-
-#define LPUART_ISTAT_RXTOINT_POS 3U
-#define LPUART_ISTAT_RXTOINT_MSK BIT(LPUART_ISTAT_RXTOINT_POS)
-
-#define LPUART_ISTAT_CTSDETINT_POS 2U
-#define LPUART_ISTAT_CTSDETINT_MSK BIT(LPUART_ISTAT_CTSDETINT_POS)
-
-#define LPUART_ISTAT_TBEMPINT_POS 1U
-#define LPUART_ISTAT_TBEMPINT_MSK BIT(LPUART_ISTAT_TBEMPINT_POS)
-
-#define LPUART_ISTAT_RBRINT_POS 0U
-#define LPUART_ISTAT_RBRINT_MSK BIT(LPUART_ISTAT_RBRINT_POS)
-
-/****************** Bit definition for LPUART_UPDATE register ************************/
-
-#define LPUART_UPDATE_UDIS_POS 0U
-#define LPUART_UPDATE_UDIS_MSK BIT(LPUART_UPDATE_UDIS_POS)
-
-/****************** Bit definition for LPUART_SYNCSTAT register ************************/
-
-#define LPUART_SYNCSTAT_FIFOCONWBSY_POS 3U
-#define LPUART_SYNCSTAT_FIFOCONWBSY_MSK BIT(LPUART_SYNCSTAT_FIFOCONWBSY_POS)
-
-#define LPUART_SYNCSTAT_CLKDIVWBSY_POS 2U
-#define LPUART_SYNCSTAT_CLKDIVWBSY_MSK BIT(LPUART_SYNCSTAT_CLKDIVWBSY_POS)
-
-#define LPUART_SYNCSTAT_CON1WBSY_POS 1U
-#define LPUART_SYNCSTAT_CON1WBSY_MSK BIT(LPUART_SYNCSTAT_CON1WBSY_POS)
-
-#define LPUART_SYNCSTAT_CON0WBSY_POS 0U
-#define LPUART_SYNCSTAT_CON0WBSY_MSK BIT(LPUART_SYNCSTAT_CON0WBSY_POS)
-
-typedef struct
-{
- __IO uint32_t CON0;
- __IO uint32_t CON1;
- __IO uint32_t CLKDIV;
- __IO uint32_t FIFOCON;
- uint32_t RESERVED0 ;
- __I uint32_t RXDR;
- __O uint32_t TXDR;
- __I uint32_t STAT;
- __IO uint32_t IER;
- __I uint32_t IFLAG;
- __O uint32_t IFC;
- __I uint32_t ISTAT;
- uint32_t RESERVED1[2] ;
- __IO uint32_t UPDATE;
- __I uint32_t SYNCSTAT;
-} LPUART_TypeDef;
-
-/****************** Bit definition for SPI_CON1 register ************************/
-
-#define SPI_CON1_BIDEN_POS 15U
-#define SPI_CON1_BIDEN_MSK BIT(SPI_CON1_BIDEN_POS)
-
-#define SPI_CON1_BIDOEN_POS 14U
-#define SPI_CON1_BIDOEN_MSK BIT(SPI_CON1_BIDOEN_POS)
-
-#define SPI_CON1_CRCEN_POS 13U
-#define SPI_CON1_CRCEN_MSK BIT(SPI_CON1_CRCEN_POS)
-
-#define SPI_CON1_NXTCRC_POS 12U
-#define SPI_CON1_NXTCRC_MSK BIT(SPI_CON1_NXTCRC_POS)
-
-#define SPI_CON1_FLEN_POS 11U
-#define SPI_CON1_FLEN_MSK BIT(SPI_CON1_FLEN_POS)
-
-#define SPI_CON1_RXO_POS 10U
-#define SPI_CON1_RXO_MSK BIT(SPI_CON1_RXO_POS)
-
-#define SPI_CON1_SSEN_POS 9U
-#define SPI_CON1_SSEN_MSK BIT(SPI_CON1_SSEN_POS)
-
-#define SPI_CON1_SSOUT_POS 8U
-#define SPI_CON1_SSOUT_MSK BIT(SPI_CON1_SSOUT_POS)
-
-#define SPI_CON1_LSBFST_POS 7U
-#define SPI_CON1_LSBFST_MSK BIT(SPI_CON1_LSBFST_POS)
-
-#define SPI_CON1_SPIEN_POS 6U
-#define SPI_CON1_SPIEN_MSK BIT(SPI_CON1_SPIEN_POS)
-
-#define SPI_CON1_BAUD_POSS 3U
-#define SPI_CON1_BAUD_POSE 5U
-#define SPI_CON1_BAUD_MSK BITS(SPI_CON1_BAUD_POSS,SPI_CON1_BAUD_POSE)
-
-#define SPI_CON1_MSTREN_POS 2U
-#define SPI_CON1_MSTREN_MSK BIT(SPI_CON1_MSTREN_POS)
-
-#define SPI_CON1_CPOL_POS 1U
-#define SPI_CON1_CPOL_MSK BIT(SPI_CON1_CPOL_POS)
-
-#define SPI_CON1_CPHA_POS 0U
-#define SPI_CON1_CPHA_MSK BIT(SPI_CON1_CPHA_POS)
-
-/****************** Bit definition for SPI_CON2 register ************************/
-
-#define SPI_CON2_TXBEIE_POS 7U
-#define SPI_CON2_TXBEIE_MSK BIT(SPI_CON2_TXBEIE_POS)
-
-#define SPI_CON2_RXBNEIE_POS 6U
-#define SPI_CON2_RXBNEIE_MSK BIT(SPI_CON2_RXBNEIE_POS)
-
-#define SPI_CON2_ERRIE_POS 5U
-#define SPI_CON2_ERRIE_MSK BIT(SPI_CON2_ERRIE_POS)
-
-#define SPI_CON2_NSSOE_POS 2U
-#define SPI_CON2_NSSOE_MSK BIT(SPI_CON2_NSSOE_POS)
-
-#define SPI_CON2_TXDMA_POS 1U
-#define SPI_CON2_TXDMA_MSK BIT(SPI_CON2_TXDMA_POS)
-
-#define SPI_CON2_RXDMA_POS 0U
-#define SPI_CON2_RXDMA_MSK BIT(SPI_CON2_RXDMA_POS)
-
-/****************** Bit definition for SPI_STAT register ************************/
-
-#define SPI_STAT_BUSY_POS 7U
-#define SPI_STAT_BUSY_MSK BIT(SPI_STAT_BUSY_POS)
-
-#define SPI_STAT_OVERR_POS 6U
-#define SPI_STAT_OVERR_MSK BIT(SPI_STAT_OVERR_POS)
-
-#define SPI_STAT_MODERR_POS 5U
-#define SPI_STAT_MODERR_MSK BIT(SPI_STAT_MODERR_POS)
-
-#define SPI_STAT_CRCERR_POS 4U
-#define SPI_STAT_CRCERR_MSK BIT(SPI_STAT_CRCERR_POS)
-
-#define SPI_STAT_TXBE_POS 1U
-#define SPI_STAT_TXBE_MSK BIT(SPI_STAT_TXBE_POS)
-
-#define SPI_STAT_RXBNE_POS 0U
-#define SPI_STAT_RXBNE_MSK BIT(SPI_STAT_RXBNE_POS)
-
-/****************** Bit definition for SPI_DATA register ************************/
-
-#define SPI_DATA_VALUE_POSS 0U
-#define SPI_DATA_VALUE_POSE 15U
-#define SPI_DATA_VALUE_MSK BITS(SPI_DATA_VALUE_POSS,SPI_DATA_VALUE_POSE)
-
-/****************** Bit definition for SPI_CRCPOLY register ************************/
-
-#define SPI_CRCPOLY_VALUE_POSS 0U
-#define SPI_CRCPOLY_VALUE_POSE 15U
-#define SPI_CRCPOLY_VALUE_MSK BITS(SPI_CRCPOLY_VALUE_POSS,SPI_CRCPOLY_VALUE_POSE)
-
-/****************** Bit definition for SPI_RXCRC register ************************/
-
-#define SPI_RXCRC_CRCVAL_POSS 0U
-#define SPI_RXCRC_CRCVAL_POSE 15U
-#define SPI_RXCRC_CRCVAL_MSK BITS(SPI_RXCRC_CRCVAL_POSS,SPI_RXCRC_CRCVAL_POSE)
-
-/****************** Bit definition for SPI_TXCRC register ************************/
-
-#define SPI_TXCRC_CRCVAL_POSS 0U
-#define SPI_TXCRC_CRCVAL_POSE 15U
-#define SPI_TXCRC_CRCVAL_MSK BITS(SPI_TXCRC_CRCVAL_POSS,SPI_TXCRC_CRCVAL_POSE)
-
-typedef struct
-{
- __IO uint32_t CON1;
- __IO uint32_t CON2;
- __IO uint32_t STAT;
- __IO uint32_t DATA;
- __IO uint32_t CRCPOLY;
- __I uint32_t RXCRC;
- __I uint32_t TXCRC;
-} SPI_TypeDef;
-
-/****************** Bit definition for I2C_CON1 register ************************/
-
-#define I2C_CON1_SRST_POS 15U
-#define I2C_CON1_SRST_MSK BIT(I2C_CON1_SRST_POS)
-
-#define I2C_CON1_ALARM_POS 13U
-#define I2C_CON1_ALARM_MSK BIT(I2C_CON1_ALARM_POS)
-
-#define I2C_CON1_TRPEC_POS 12U
-#define I2C_CON1_TRPEC_MSK BIT(I2C_CON1_TRPEC_POS)
-
-#define I2C_CON1_POSAP_POS 11U
-#define I2C_CON1_POSAP_MSK BIT(I2C_CON1_POSAP_POS)
-
-#define I2C_CON1_ACKEN_POS 10U
-#define I2C_CON1_ACKEN_MSK BIT(I2C_CON1_ACKEN_POS)
-
-#define I2C_CON1_STOP_POS 9U
-#define I2C_CON1_STOP_MSK BIT(I2C_CON1_STOP_POS)
-
-#define I2C_CON1_START_POS 8U
-#define I2C_CON1_START_MSK BIT(I2C_CON1_START_POS)
-
-#define I2C_CON1_DISCS_POS 7U
-#define I2C_CON1_DISCS_MSK BIT(I2C_CON1_DISCS_POS)
-
-#define I2C_CON1_GCEN_POS 6U
-#define I2C_CON1_GCEN_MSK BIT(I2C_CON1_GCEN_POS)
-
-#define I2C_CON1_PECEN_POS 5U
-#define I2C_CON1_PECEN_MSK BIT(I2C_CON1_PECEN_POS)
-
-#define I2C_CON1_ARPEN_POS 4U
-#define I2C_CON1_ARPEN_MSK BIT(I2C_CON1_ARPEN_POS)
-
-#define I2C_CON1_SMBMOD_POS 3U
-#define I2C_CON1_SMBMOD_MSK BIT(I2C_CON1_SMBMOD_POS)
-
-#define I2C_CON1_PMOD_POS 1U
-#define I2C_CON1_PMOD_MSK BIT(I2C_CON1_PMOD_POS)
-
-#define I2C_CON1_PEN_POS 0U
-#define I2C_CON1_PEN_MSK BIT(I2C_CON1_PEN_POS)
-
-/****************** Bit definition for I2C_CON2 register ************************/
-
-#define I2C_CON2_LDMA_POS 12U
-#define I2C_CON2_LDMA_MSK BIT(I2C_CON2_LDMA_POS)
-
-#define I2C_CON2_DMAEN_POS 11U
-#define I2C_CON2_DMAEN_MSK BIT(I2C_CON2_DMAEN_POS)
-
-#define I2C_CON2_BUFIE_POS 10U
-#define I2C_CON2_BUFIE_MSK BIT(I2C_CON2_BUFIE_POS)
-
-#define I2C_CON2_EVTIE_POS 9U
-#define I2C_CON2_EVTIE_MSK BIT(I2C_CON2_EVTIE_POS)
-
-#define I2C_CON2_ERRIE_POS 8U
-#define I2C_CON2_ERRIE_MSK BIT(I2C_CON2_ERRIE_POS)
-
-#define I2C_CON2_CLKF_POSS 0U
-#define I2C_CON2_CLKF_POSE 5U
-#define I2C_CON2_CLKF_MSK BITS(I2C_CON2_CLKF_POSS,I2C_CON2_CLKF_POSE)
-
-/****************** Bit definition for I2C_ADDR1 register ************************/
-
-#define I2C_ADDR1_ADDTYPE_POS 15U
-#define I2C_ADDR1_ADDTYPE_MSK BIT(I2C_ADDR1_ADDTYPE_POS)
-
-#define I2C_ADDR1_ADDH_POSS 8U
-#define I2C_ADDR1_ADDH_POSE 9U
-#define I2C_ADDR1_ADDH_MSK BITS(I2C_ADDR1_ADDH_POSS,I2C_ADDR1_ADDH_POSE)
-
-#define I2C_ADDR1_ADD_POSS 1U
-#define I2C_ADDR1_ADD_POSE 7U
-#define I2C_ADDR1_ADD_MSK BITS(I2C_ADDR1_ADD_POSS,I2C_ADDR1_ADD_POSE)
-
-#define I2C_ADDR1_ADDLSB_POS 0U
-#define I2C_ADDR1_ADDLSB_MSK BIT(I2C_ADDR1_ADDLSB_POS)
-
-/****************** Bit definition for I2C_ADDR2 register ************************/
-
-#define I2C_ADDR2_ADD_POSS 1U
-#define I2C_ADDR2_ADD_POSE 7U
-#define I2C_ADDR2_ADD_MSK BITS(I2C_ADDR2_ADD_POSS,I2C_ADDR2_ADD_POSE)
-
-#define I2C_ADDR2_DUALEN_POS 0U
-#define I2C_ADDR2_DUALEN_MSK BIT(I2C_ADDR2_DUALEN_POS)
-
-/****************** Bit definition for I2C_DATA register ************************/
-
-#define I2C_DATA_TRBUF_POSS 0U
-#define I2C_DATA_TRBUF_POSE 7U
-#define I2C_DATA_TRBUF_MSK BITS(I2C_DATA_TRBUF_POSS,I2C_DATA_TRBUF_POSE)
-
-/****************** Bit definition for I2C_STAT1 register ************************/
-
-#define I2C_STAT1_SMBALARM_POS 15U
-#define I2C_STAT1_SMBALARM_MSK BIT(I2C_STAT1_SMBALARM_POS)
-
-#define I2C_STAT1_SMBTO_POS 14U
-#define I2C_STAT1_SMBTO_MSK BIT(I2C_STAT1_SMBTO_POS)
-
-#define I2C_STAT1_PECERR_POS 12U
-#define I2C_STAT1_PECERR_MSK BIT(I2C_STAT1_PECERR_POS)
-
-#define I2C_STAT1_ROUERR_POS 11U
-#define I2C_STAT1_ROUERR_MSK BIT(I2C_STAT1_ROUERR_POS)
-
-#define I2C_STAT1_ACKERR_POS 10U
-#define I2C_STAT1_ACKERR_MSK BIT(I2C_STAT1_ACKERR_POS)
-
-#define I2C_STAT1_LARB_POS 9U
-#define I2C_STAT1_LARB_MSK BIT(I2C_STAT1_LARB_POS)
-
-#define I2C_STAT1_BUSERR_POS 8U
-#define I2C_STAT1_BUSERR_MSK BIT(I2C_STAT1_BUSERR_POS)
-
-#define I2C_STAT1_TXBE_POS 7U
-#define I2C_STAT1_TXBE_MSK BIT(I2C_STAT1_TXBE_POS)
-
-#define I2C_STAT1_RXBNE_POS 6U
-#define I2C_STAT1_RXBNE_MSK BIT(I2C_STAT1_RXBNE_POS)
-
-#define I2C_STAT1_DETSTP_POS 4U
-#define I2C_STAT1_DETSTP_MSK BIT(I2C_STAT1_DETSTP_POS)
-
-#define I2C_STAT1_SENDADD10_POS 3U
-#define I2C_STAT1_SENDADD10_MSK BIT(I2C_STAT1_SENDADD10_POS)
-
-#define I2C_STAT1_BTC_POS 2U
-#define I2C_STAT1_BTC_MSK BIT(I2C_STAT1_BTC_POS)
-
-#define I2C_STAT1_ADDR_POS 1U
-#define I2C_STAT1_ADDR_MSK BIT(I2C_STAT1_ADDR_POS)
-
-#define I2C_STAT1_SENDSTR_POS 0U
-#define I2C_STAT1_SENDSTR_MSK BIT(I2C_STAT1_SENDSTR_POS)
-
-/****************** Bit definition for I2C_STAT2 register ************************/
-
-#define I2C_STAT2_PECV_POSS 8U
-#define I2C_STAT2_PECV_POSE 15U
-#define I2C_STAT2_PECV_MSK BITS(I2C_STAT2_PECV_POSS,I2C_STAT2_PECV_POSE)
-
-#define I2C_STAT2_DMF_POS 7U
-#define I2C_STAT2_DMF_MSK BIT(I2C_STAT2_DMF_POS)
-
-#define I2C_STAT2_SMBHH_POS 6U
-#define I2C_STAT2_SMBHH_MSK BIT(I2C_STAT2_SMBHH_POS)
-
-#define I2C_STAT2_SMBDEF_POS 5U
-#define I2C_STAT2_SMBDEF_MSK BIT(I2C_STAT2_SMBDEF_POS)
-
-#define I2C_STAT2_RXGCF_POS 4U
-#define I2C_STAT2_RXGCF_MSK BIT(I2C_STAT2_RXGCF_POS)
-
-#define I2C_STAT2_TRF_POS 2U
-#define I2C_STAT2_TRF_MSK BIT(I2C_STAT2_TRF_POS)
-
-#define I2C_STAT2_BSYF_POS 1U
-#define I2C_STAT2_BSYF_MSK BIT(I2C_STAT2_BSYF_POS)
-
-#define I2C_STAT2_MASTER_POS 0U
-#define I2C_STAT2_MASTER_MSK BIT(I2C_STAT2_MASTER_POS)
-
-/****************** Bit definition for I2C_CKCFG register ************************/
-
-#define I2C_CKCFG_CLKMOD_POS 15U
-#define I2C_CKCFG_CLKMOD_MSK BIT(I2C_CKCFG_CLKMOD_POS)
-
-#define I2C_CKCFG_DUTY_POS 14U
-#define I2C_CKCFG_DUTY_MSK BIT(I2C_CKCFG_DUTY_POS)
-
-#define I2C_CKCFG_CLKSET_POSS 0U
-#define I2C_CKCFG_CLKSET_POSE 11U
-#define I2C_CKCFG_CLKSET_MSK BITS(I2C_CKCFG_CLKSET_POSS,I2C_CKCFG_CLKSET_POSE)
-
-/****************** Bit definition for I2C_RT register ************************/
-
-#define I2C_RT_RISET_POSS 0U
-#define I2C_RT_RISET_POSE 5U
-#define I2C_RT_RISET_MSK BITS(I2C_RT_RISET_POSS,I2C_RT_RISET_POSE)
-
-typedef struct
-{
- __IO uint32_t CON1;
- __IO uint32_t CON2;
- __IO uint32_t ADDR1;
- __IO uint32_t ADDR2;
- __IO uint32_t DATA;
- __IO uint32_t STAT1;
- __I uint32_t STAT2;
- __IO uint32_t CKCFG;
- __IO uint32_t RT;
-} I2C_TypeDef;
-
-/****************** Bit definition for CAN_CON register ************************/
-
-#define CAN_CON_DBGSTP_POS 16U
-#define CAN_CON_DBGSTP_MSK BIT(CAN_CON_DBGSTP_POS)
-
-#define CAN_CON_RST_POS 15U
-#define CAN_CON_RST_MSK BIT(CAN_CON_RST_POS)
-
-#define CAN_CON_TTCEN_POS 7U
-#define CAN_CON_TTCEN_MSK BIT(CAN_CON_TTCEN_POS)
-
-#define CAN_CON_ABOFFEN_POS 6U
-#define CAN_CON_ABOFFEN_MSK BIT(CAN_CON_ABOFFEN_POS)
-
-#define CAN_CON_AWKEN_POS 5U
-#define CAN_CON_AWKEN_MSK BIT(CAN_CON_AWKEN_POS)
-
-#define CAN_CON_ARTXDIS_POS 4U
-#define CAN_CON_ARTXDIS_MSK BIT(CAN_CON_ARTXDIS_POS)
-
-#define CAN_CON_RXFOPM_POS 3U
-#define CAN_CON_RXFOPM_MSK BIT(CAN_CON_RXFOPM_POS)
-
-#define CAN_CON_TXMP_POS 2U
-#define CAN_CON_TXMP_MSK BIT(CAN_CON_TXMP_POS)
-
-#define CAN_CON_SLPREQ_POS 1U
-#define CAN_CON_SLPREQ_MSK BIT(CAN_CON_SLPREQ_POS)
-
-#define CAN_CON_INIREQ_POS 0U
-#define CAN_CON_INIREQ_MSK BIT(CAN_CON_INIREQ_POS)
-
-/****************** Bit definition for CAN_STAT register ************************/
-
-#define CAN_STAT_RX_POS 11U
-#define CAN_STAT_RX_MSK BIT(CAN_STAT_RX_POS)
-
-#define CAN_STAT_PRESMP_POS 10U
-#define CAN_STAT_PRESMP_MSK BIT(CAN_STAT_PRESMP_POS)
-
-#define CAN_STAT_RXSTAT_POS 9U
-#define CAN_STAT_RXSTAT_MSK BIT(CAN_STAT_RXSTAT_POS)
-
-#define CAN_STAT_TXSTAT_POS 8U
-#define CAN_STAT_TXSTAT_MSK BIT(CAN_STAT_TXSTAT_POS)
-
-#define CAN_STAT_SLPIF_POS 4U
-#define CAN_STAT_SLPIF_MSK BIT(CAN_STAT_SLPIF_POS)
-
-#define CAN_STAT_WKIF_POS 3U
-#define CAN_STAT_WKIF_MSK BIT(CAN_STAT_WKIF_POS)
-
-#define CAN_STAT_ERRIF_POS 2U
-#define CAN_STAT_ERRIF_MSK BIT(CAN_STAT_ERRIF_POS)
-
-#define CAN_STAT_SLPSTAT_POS 1U
-#define CAN_STAT_SLPSTAT_MSK BIT(CAN_STAT_SLPSTAT_POS)
-
-#define CAN_STAT_INISTAT_POS 0U
-#define CAN_STAT_INISTAT_MSK BIT(CAN_STAT_INISTAT_POS)
-
-/****************** Bit definition for CAN_IFC register ************************/
-
-#define CAN_IFC_SLPIFC_POS 4U
-#define CAN_IFC_SLPIFC_MSK BIT(CAN_IFC_SLPIFC_POS)
-
-#define CAN_IFC_WKIFC_POS 3U
-#define CAN_IFC_WKIFC_MSK BIT(CAN_IFC_WKIFC_POS)
-
-#define CAN_IFC_ERRIFC_POS 2U
-#define CAN_IFC_ERRIFC_MSK BIT(CAN_IFC_ERRIFC_POS)
-
-/****************** Bit definition for CAN_TXSTAT register ************************/
-
-#define CAN_TXSTAT_TXM2LPF_POS 31U
-#define CAN_TXSTAT_TXM2LPF_MSK BIT(CAN_TXSTAT_TXM2LPF_POS)
-
-#define CAN_TXSTAT_TXM1LPF_POS 30U
-#define CAN_TXSTAT_TXM1LPF_MSK BIT(CAN_TXSTAT_TXM1LPF_POS)
-
-#define CAN_TXSTAT_TXM0LPF_POS 29U
-#define CAN_TXSTAT_TXM0LPF_MSK BIT(CAN_TXSTAT_TXM0LPF_POS)
-
-#define CAN_TXSTAT_TXM2EF_POS 28U
-#define CAN_TXSTAT_TXM2EF_MSK BIT(CAN_TXSTAT_TXM2EF_POS)
-
-#define CAN_TXSTAT_TXM1EF_POS 27U
-#define CAN_TXSTAT_TXM1EF_MSK BIT(CAN_TXSTAT_TXM1EF_POS)
-
-#define CAN_TXSTAT_TXM0EF_POS 26U
-#define CAN_TXSTAT_TXM0EF_MSK BIT(CAN_TXSTAT_TXM0EF_POS)
-
-#define CAN_TXSTAT_CODE_POSS 24U
-#define CAN_TXSTAT_CODE_POSE 25U
-#define CAN_TXSTAT_CODE_MSK BITS(CAN_TXSTAT_CODE_POSS,CAN_TXSTAT_CODE_POSE)
-
-#define CAN_TXSTAT_M2STPREQ_POS 23U
-#define CAN_TXSTAT_M2STPREQ_MSK BIT(CAN_TXSTAT_M2STPREQ_POS)
-
-#define CAN_TXSTAT_M2TXERR_POS 19U
-#define CAN_TXSTAT_M2TXERR_MSK BIT(CAN_TXSTAT_M2TXERR_POS)
-
-#define CAN_TXSTAT_M2ARBLST_POS 18U
-#define CAN_TXSTAT_M2ARBLST_MSK BIT(CAN_TXSTAT_M2ARBLST_POS)
-
-#define CAN_TXSTAT_M2TXC_POS 17U
-#define CAN_TXSTAT_M2TXC_MSK BIT(CAN_TXSTAT_M2TXC_POS)
-
-#define CAN_TXSTAT_M2REQC_POS 16U
-#define CAN_TXSTAT_M2REQC_MSK BIT(CAN_TXSTAT_M2REQC_POS)
-
-#define CAN_TXSTAT_M1STPREQ_POS 15U
-#define CAN_TXSTAT_M1STPREQ_MSK BIT(CAN_TXSTAT_M1STPREQ_POS)
-
-#define CAN_TXSTAT_M1TXERR_POS 11U
-#define CAN_TXSTAT_M1TXERR_MSK BIT(CAN_TXSTAT_M1TXERR_POS)
-
-#define CAN_TXSTAT_M1ARBLST_POS 10U
-#define CAN_TXSTAT_M1ARBLST_MSK BIT(CAN_TXSTAT_M1ARBLST_POS)
-
-#define CAN_TXSTAT_M1TXC_POS 9U
-#define CAN_TXSTAT_M1TXC_MSK BIT(CAN_TXSTAT_M1TXC_POS)
-
-#define CAN_TXSTAT_M1REQC_POS 8U
-#define CAN_TXSTAT_M1REQC_MSK BIT(CAN_TXSTAT_M1REQC_POS)
-
-#define CAN_TXSTAT_M0STPREQ_POS 7U
-#define CAN_TXSTAT_M0STPREQ_MSK BIT(CAN_TXSTAT_M0STPREQ_POS)
-
-#define CAN_TXSTAT_M0TXERR_POS 3U
-#define CAN_TXSTAT_M0TXERR_MSK BIT(CAN_TXSTAT_M0TXERR_POS)
-
-#define CAN_TXSTAT_M0ARBLST_POS 2U
-#define CAN_TXSTAT_M0ARBLST_MSK BIT(CAN_TXSTAT_M0ARBLST_POS)
-
-#define CAN_TXSTAT_M0TXC_POS 1U
-#define CAN_TXSTAT_M0TXC_MSK BIT(CAN_TXSTAT_M0TXC_POS)
-
-#define CAN_TXSTAT_M0REQC_POS 0U
-#define CAN_TXSTAT_M0REQC_MSK BIT(CAN_TXSTAT_M0REQC_POS)
-
-/****************** Bit definition for CAN_TXSTATC register ************************/
-
-#define CAN_TXSTATC_M2TXERR_POS 19U
-#define CAN_TXSTATC_M2TXERR_MSK BIT(CAN_TXSTATC_M2TXERR_POS)
-
-#define CAN_TXSTATC_M2ARBLST_POS 18U
-#define CAN_TXSTATC_M2ARBLST_MSK BIT(CAN_TXSTATC_M2ARBLST_POS)
-
-#define CAN_TXSTATC_M2TXC_POS 17U
-#define CAN_TXSTATC_M2TXC_MSK BIT(CAN_TXSTATC_M2TXC_POS)
-
-#define CAN_TXSTATC_M2REQC_POS 16U
-#define CAN_TXSTATC_M2REQC_MSK BIT(CAN_TXSTATC_M2REQC_POS)
-
-#define CAN_TXSTATC_M1TXERR_POS 11U
-#define CAN_TXSTATC_M1TXERR_MSK BIT(CAN_TXSTATC_M1TXERR_POS)
-
-#define CAN_TXSTATC_M1ARBLST_POS 10U
-#define CAN_TXSTATC_M1ARBLST_MSK BIT(CAN_TXSTATC_M1ARBLST_POS)
-
-#define CAN_TXSTATC_M1TXC_POS 9U
-#define CAN_TXSTATC_M1TXC_MSK BIT(CAN_TXSTATC_M1TXC_POS)
-
-#define CAN_TXSTATC_M1REQC_POS 8U
-#define CAN_TXSTATC_M1REQC_MSK BIT(CAN_TXSTATC_M1REQC_POS)
-
-#define CAN_TXSTATC_M0TXERR_POS 3U
-#define CAN_TXSTATC_M0TXERR_MSK BIT(CAN_TXSTATC_M0TXERR_POS)
-
-#define CAN_TXSTATC_M0ARBLST_POS 2U
-#define CAN_TXSTATC_M0ARBLST_MSK BIT(CAN_TXSTATC_M0ARBLST_POS)
-
-#define CAN_TXSTATC_M0TXC_POS 1U
-#define CAN_TXSTATC_M0TXC_MSK BIT(CAN_TXSTATC_M0TXC_POS)
-
-#define CAN_TXSTATC_M0REQC_POS 0U
-#define CAN_TXSTATC_M0REQC_MSK BIT(CAN_TXSTATC_M0REQC_POS)
-
-/****************** Bit definition for CAN_RXF0 register ************************/
-
-#define CAN_RXF0_FREE_POS 5U
-#define CAN_RXF0_FREE_MSK BIT(CAN_RXF0_FREE_POS)
-
-#define CAN_RXF0_OVR_POS 4U
-#define CAN_RXF0_OVR_MSK BIT(CAN_RXF0_OVR_POS)
-
-#define CAN_RXF0_FULL_POS 3U
-#define CAN_RXF0_FULL_MSK BIT(CAN_RXF0_FULL_POS)
-
-#define CAN_RXF0_PEND_POSS 0U
-#define CAN_RXF0_PEND_POSE 1U
-#define CAN_RXF0_PEND_MSK BITS(CAN_RXF0_PEND_POSS,CAN_RXF0_PEND_POSE)
-
-/****************** Bit definition for CAN_RXF0C register ************************/
-
-#define CAN_RXF0C_OVRC_POS 4U
-#define CAN_RXF0C_OVRC_MSK BIT(CAN_RXF0C_OVRC_POS)
-
-#define CAN_RXF0C_FULLC_POS 3U
-#define CAN_RXF0C_FULLC_MSK BIT(CAN_RXF0C_FULLC_POS)
-
-/****************** Bit definition for CAN_RXF1 register ************************/
-
-#define CAN_RXF1_FREE_POS 5U
-#define CAN_RXF1_FREE_MSK BIT(CAN_RXF1_FREE_POS)
-
-#define CAN_RXF1_OVR_POS 4U
-#define CAN_RXF1_OVR_MSK BIT(CAN_RXF1_OVR_POS)
-
-#define CAN_RXF1_FULL_POS 3U
-#define CAN_RXF1_FULL_MSK BIT(CAN_RXF1_FULL_POS)
-
-#define CAN_RXF1_PEND_POSS 0U
-#define CAN_RXF1_PEND_POSE 1U
-#define CAN_RXF1_PEND_MSK BITS(CAN_RXF1_PEND_POSS,CAN_RXF1_PEND_POSE)
-
-/****************** Bit definition for CAN_RXF1C register ************************/
-
-#define CAN_RXF1C_OVRC_POS 4U
-#define CAN_RXF1C_OVRC_MSK BIT(CAN_RXF1C_OVRC_POS)
-
-#define CAN_RXF1C_FULLC_POS 3U
-#define CAN_RXF1C_FULLC_MSK BIT(CAN_RXF1C_FULLC_POS)
-
-/****************** Bit definition for CAN_IE register ************************/
-
-#define CAN_IE_SLPIE_POS 17U
-#define CAN_IE_SLPIE_MSK BIT(CAN_IE_SLPIE_POS)
-
-#define CAN_IE_WKIE_POS 16U
-#define CAN_IE_WKIE_MSK BIT(CAN_IE_WKIE_POS)
-
-#define CAN_IE_ERRIE_POS 15U
-#define CAN_IE_ERRIE_MSK BIT(CAN_IE_ERRIE_POS)
-
-#define CAN_IE_PRERRIE_POS 11U
-#define CAN_IE_PRERRIE_MSK BIT(CAN_IE_PRERRIE_POS)
-
-#define CAN_IE_BOFFIE_POS 10U
-#define CAN_IE_BOFFIE_MSK BIT(CAN_IE_BOFFIE_POS)
-
-#define CAN_IE_PERRIE_POS 9U
-#define CAN_IE_PERRIE_MSK BIT(CAN_IE_PERRIE_POS)
-
-#define CAN_IE_WARNIE_POS 8U
-#define CAN_IE_WARNIE_MSK BIT(CAN_IE_WARNIE_POS)
-
-#define CAN_IE_F1OVRIE_POS 6U
-#define CAN_IE_F1OVRIE_MSK BIT(CAN_IE_F1OVRIE_POS)
-
-#define CAN_IE_F1FULIE_POS 5U
-#define CAN_IE_F1FULIE_MSK BIT(CAN_IE_F1FULIE_POS)
-
-#define CAN_IE_F1PIE_POS 4U
-#define CAN_IE_F1PIE_MSK BIT(CAN_IE_F1PIE_POS)
-
-#define CAN_IE_F0OVRIE_POS 3U
-#define CAN_IE_F0OVRIE_MSK BIT(CAN_IE_F0OVRIE_POS)
-
-#define CAN_IE_F0FULIE_POS 2U
-#define CAN_IE_F0FULIE_MSK BIT(CAN_IE_F0FULIE_POS)
-
-#define CAN_IE_F0PIE_POS 1U
-#define CAN_IE_F0PIE_MSK BIT(CAN_IE_F0PIE_POS)
-
-#define CAN_IE_TXMEIE_POS 0U
-#define CAN_IE_TXMEIE_MSK BIT(CAN_IE_TXMEIE_POS)
-
-/****************** Bit definition for CAN_ERRSTAT register ************************/
-
-#define CAN_ERRSTAT_RXERRC_POSS 24U
-#define CAN_ERRSTAT_RXERRC_POSE 31U
-#define CAN_ERRSTAT_RXERRC_MSK BITS(CAN_ERRSTAT_RXERRC_POSS,CAN_ERRSTAT_RXERRC_POSE)
-
-#define CAN_ERRSTAT_TXERRC_POSS 16U
-#define CAN_ERRSTAT_TXERRC_POSE 23U
-#define CAN_ERRSTAT_TXERRC_MSK BITS(CAN_ERRSTAT_TXERRC_POSS,CAN_ERRSTAT_TXERRC_POSE)
-
-#define CAN_ERRSTAT_PRERRF_POSS 4U
-#define CAN_ERRSTAT_PRERRF_POSE 6U
-#define CAN_ERRSTAT_PRERRF_MSK BITS(CAN_ERRSTAT_PRERRF_POSS,CAN_ERRSTAT_PRERRF_POSE)
-
-#define CAN_ERRSTAT_BOFF_POS 2U
-#define CAN_ERRSTAT_BOFF_MSK BIT(CAN_ERRSTAT_BOFF_POS)
-
-#define CAN_ERRSTAT_PERRF_POS 1U
-#define CAN_ERRSTAT_PERRF_MSK BIT(CAN_ERRSTAT_PERRF_POS)
-
-#define CAN_ERRSTAT_WARNF_POS 0U
-#define CAN_ERRSTAT_WARNF_MSK BIT(CAN_ERRSTAT_WARNF_POS)
-
-/****************** Bit definition for CAN_BTIME register ************************/
-
-#define CAN_BTIME_SILENT_POS 31U
-#define CAN_BTIME_SILENT_MSK BIT(CAN_BTIME_SILENT_POS)
-
-#define CAN_BTIME_LOOP_POS 30U
-#define CAN_BTIME_LOOP_MSK BIT(CAN_BTIME_LOOP_POS)
-
-#define CAN_BTIME_RESJW_POSS 24U
-#define CAN_BTIME_RESJW_POSE 25U
-#define CAN_BTIME_RESJW_MSK BITS(CAN_BTIME_RESJW_POSS,CAN_BTIME_RESJW_POSE)
-
-#define CAN_BTIME_SEG2_POSS 20U
-#define CAN_BTIME_SEG2_POSE 22U
-#define CAN_BTIME_SEG2_MSK BITS(CAN_BTIME_SEG2_POSS,CAN_BTIME_SEG2_POSE)
-
-#define CAN_BTIME_SEG1_POSS 16U
-#define CAN_BTIME_SEG1_POSE 19U
-#define CAN_BTIME_SEG1_MSK BITS(CAN_BTIME_SEG1_POSS,CAN_BTIME_SEG1_POSE)
-
-#define CAN_BTIME_BPSC_POSS 0U
-#define CAN_BTIME_BPSC_POSE 9U
-#define CAN_BTIME_BPSC_MSK BITS(CAN_BTIME_BPSC_POSS,CAN_BTIME_BPSC_POSE)
-
-/****************** Bit definition for CAN_TXID0 register ************************/
-
-#define CAN_TXID0_STDID_POSS 21U
-#define CAN_TXID0_STDID_POSE 31U
-#define CAN_TXID0_STDID_MSK BITS(CAN_TXID0_STDID_POSS,CAN_TXID0_STDID_POSE)
-
-#define CAN_TXID0_EXID_POSS 3U
-#define CAN_TXID0_EXID_POSE 20U
-#define CAN_TXID0_EXID_MSK BITS(CAN_TXID0_EXID_POSS,CAN_TXID0_EXID_POSE)
-
-#define CAN_TXID0_IDE_POS 2U
-#define CAN_TXID0_IDE_MSK BIT(CAN_TXID0_IDE_POS)
-
-#define CAN_TXID0_RTR_POS 1U
-#define CAN_TXID0_RTR_MSK BIT(CAN_TXID0_RTR_POS)
-
-#define CAN_TXID0_TXMREQ_POS 0U
-#define CAN_TXID0_TXMREQ_MSK BIT(CAN_TXID0_TXMREQ_POS)
-
-/****************** Bit definition for CAN_TXFCON0 register ************************/
-
-#define CAN_TXFCON0_STAMP_POSS 16U
-#define CAN_TXFCON0_STAMP_POSE 31U
-#define CAN_TXFCON0_STAMP_MSK BITS(CAN_TXFCON0_STAMP_POSS,CAN_TXFCON0_STAMP_POSE)
-
-#define CAN_TXFCON0_TXGT_POS 8U
-#define CAN_TXFCON0_TXGT_MSK BIT(CAN_TXFCON0_TXGT_POS)
-
-#define CAN_TXFCON0_DLEN_POSS 0U
-#define CAN_TXFCON0_DLEN_POSE 3U
-#define CAN_TXFCON0_DLEN_MSK BITS(CAN_TXFCON0_DLEN_POSS,CAN_TXFCON0_DLEN_POSE)
-
-/****************** Bit definition for CAN_TXDL0 register ************************/
-
-#define CAN_TXDL0_BYTE3_POSS 24U
-#define CAN_TXDL0_BYTE3_POSE 31U
-#define CAN_TXDL0_BYTE3_MSK BITS(CAN_TXDL0_BYTE3_POSS,CAN_TXDL0_BYTE3_POSE)
-
-#define CAN_TXDL0_BYTE2_POSS 16U
-#define CAN_TXDL0_BYTE2_POSE 23U
-#define CAN_TXDL0_BYTE2_MSK BITS(CAN_TXDL0_BYTE2_POSS,CAN_TXDL0_BYTE2_POSE)
-
-#define CAN_TXDL0_BYTE1_POSS 8U
-#define CAN_TXDL0_BYTE1_POSE 15U
-#define CAN_TXDL0_BYTE1_MSK BITS(CAN_TXDL0_BYTE1_POSS,CAN_TXDL0_BYTE1_POSE)
-
-#define CAN_TXDL0_BYTE0_POSS 0U
-#define CAN_TXDL0_BYTE0_POSE 7U
-#define CAN_TXDL0_BYTE0_MSK BITS(CAN_TXDL0_BYTE0_POSS,CAN_TXDL0_BYTE0_POSE)
-
-/****************** Bit definition for CAN_TXDH0 register ************************/
-
-#define CAN_TXDH0_BYTE7_POSS 24U
-#define CAN_TXDH0_BYTE7_POSE 31U
-#define CAN_TXDH0_BYTE7_MSK BITS(CAN_TXDH0_BYTE7_POSS,CAN_TXDH0_BYTE7_POSE)
-
-#define CAN_TXDH0_BYTE6_POSS 16U
-#define CAN_TXDH0_BYTE6_POSE 23U
-#define CAN_TXDH0_BYTE6_MSK BITS(CAN_TXDH0_BYTE6_POSS,CAN_TXDH0_BYTE6_POSE)
-
-#define CAN_TXDH0_BYTE5_POSS 8U
-#define CAN_TXDH0_BYTE5_POSE 15U
-#define CAN_TXDH0_BYTE5_MSK BITS(CAN_TXDH0_BYTE5_POSS,CAN_TXDH0_BYTE5_POSE)
-
-#define CAN_TXDH0_BYTE4_POSS 0U
-#define CAN_TXDH0_BYTE4_POSE 7U
-#define CAN_TXDH0_BYTE4_MSK BITS(CAN_TXDH0_BYTE4_POSS,CAN_TXDH0_BYTE4_POSE)
-
-/****************** Bit definition for CAN_TXID1 register ************************/
-
-#define CAN_TXID1_STDID_POSS 21U
-#define CAN_TXID1_STDID_POSE 31U
-#define CAN_TXID1_STDID_MSK BITS(CAN_TXID1_STDID_POSS,CAN_TXID1_STDID_POSE)
-
-#define CAN_TXID1_EXID_POSS 3U
-#define CAN_TXID1_EXID_POSE 20U
-#define CAN_TXID1_EXID_MSK BITS(CAN_TXID1_EXID_POSS,CAN_TXID1_EXID_POSE)
-
-#define CAN_TXID1_IDE_POS 2U
-#define CAN_TXID1_IDE_MSK BIT(CAN_TXID1_IDE_POS)
-
-#define CAN_TXID1_RTR_POS 1U
-#define CAN_TXID1_RTR_MSK BIT(CAN_TXID1_RTR_POS)
-
-#define CAN_TXID1_TXMREQ_POS 0U
-#define CAN_TXID1_TXMREQ_MSK BIT(CAN_TXID1_TXMREQ_POS)
-
-/****************** Bit definition for CAN_TXFCON1 register ************************/
-
-#define CAN_TXFCON1_STAMP_POSS 16U
-#define CAN_TXFCON1_STAMP_POSE 31U
-#define CAN_TXFCON1_STAMP_MSK BITS(CAN_TXFCON1_STAMP_POSS,CAN_TXFCON1_STAMP_POSE)
-
-#define CAN_TXFCON1_TXGT_POS 8U
-#define CAN_TXFCON1_TXGT_MSK BIT(CAN_TXFCON1_TXGT_POS)
-
-#define CAN_TXFCON1_DLEN_POSS 0U
-#define CAN_TXFCON1_DLEN_POSE 3U
-#define CAN_TXFCON1_DLEN_MSK BITS(CAN_TXFCON1_DLEN_POSS,CAN_TXFCON1_DLEN_POSE)
-
-/****************** Bit definition for CAN_TXDL1 register ************************/
-
-#define CAN_TXDL1_BYTE3_POSS 24U
-#define CAN_TXDL1_BYTE3_POSE 31U
-#define CAN_TXDL1_BYTE3_MSK BITS(CAN_TXDL1_BYTE3_POSS,CAN_TXDL1_BYTE3_POSE)
-
-#define CAN_TXDL1_BYTE2_POSS 16U
-#define CAN_TXDL1_BYTE2_POSE 23U
-#define CAN_TXDL1_BYTE2_MSK BITS(CAN_TXDL1_BYTE2_POSS,CAN_TXDL1_BYTE2_POSE)
-
-#define CAN_TXDL1_BYTE1_POSS 8U
-#define CAN_TXDL1_BYTE1_POSE 15U
-#define CAN_TXDL1_BYTE1_MSK BITS(CAN_TXDL1_BYTE1_POSS,CAN_TXDL1_BYTE1_POSE)
-
-#define CAN_TXDL1_BYTE0_POSS 0U
-#define CAN_TXDL1_BYTE0_POSE 7U
-#define CAN_TXDL1_BYTE0_MSK BITS(CAN_TXDL1_BYTE0_POSS,CAN_TXDL1_BYTE0_POSE)
-
-/****************** Bit definition for CAN_TXDH1 register ************************/
-
-#define CAN_TXDH1_BYTE7_POSS 24U
-#define CAN_TXDH1_BYTE7_POSE 31U
-#define CAN_TXDH1_BYTE7_MSK BITS(CAN_TXDH1_BYTE7_POSS,CAN_TXDH1_BYTE7_POSE)
-
-#define CAN_TXDH1_BYTE6_POSS 16U
-#define CAN_TXDH1_BYTE6_POSE 23U
-#define CAN_TXDH1_BYTE6_MSK BITS(CAN_TXDH1_BYTE6_POSS,CAN_TXDH1_BYTE6_POSE)
-
-#define CAN_TXDH1_BYTE5_POSS 8U
-#define CAN_TXDH1_BYTE5_POSE 15U
-#define CAN_TXDH1_BYTE5_MSK BITS(CAN_TXDH1_BYTE5_POSS,CAN_TXDH1_BYTE5_POSE)
-
-#define CAN_TXDH1_BYTE4_POSS 0U
-#define CAN_TXDH1_BYTE4_POSE 7U
-#define CAN_TXDH1_BYTE4_MSK BITS(CAN_TXDH1_BYTE4_POSS,CAN_TXDH1_BYTE4_POSE)
-
-/****************** Bit definition for CAN_TXID2 register ************************/
-
-#define CAN_TXID2_STDID_POSS 21U
-#define CAN_TXID2_STDID_POSE 31U
-#define CAN_TXID2_STDID_MSK BITS(CAN_TXID2_STDID_POSS,CAN_TXID2_STDID_POSE)
-
-#define CAN_TXID2_EXID_POSS 3U
-#define CAN_TXID2_EXID_POSE 20U
-#define CAN_TXID2_EXID_MSK BITS(CAN_TXID2_EXID_POSS,CAN_TXID2_EXID_POSE)
-
-#define CAN_TXID2_IDE_POS 2U
-#define CAN_TXID2_IDE_MSK BIT(CAN_TXID2_IDE_POS)
-
-#define CAN_TXID2_RTR_POS 1U
-#define CAN_TXID2_RTR_MSK BIT(CAN_TXID2_RTR_POS)
-
-#define CAN_TXID2_TXMREQ_POS 0U
-#define CAN_TXID2_TXMREQ_MSK BIT(CAN_TXID2_TXMREQ_POS)
-
-/****************** Bit definition for CAN_TXFCON2 register ************************/
-
-#define CAN_TXFCON2_STAMP_POSS 16U
-#define CAN_TXFCON2_STAMP_POSE 31U
-#define CAN_TXFCON2_STAMP_MSK BITS(CAN_TXFCON2_STAMP_POSS,CAN_TXFCON2_STAMP_POSE)
-
-#define CAN_TXFCON2_TXGT_POS 8U
-#define CAN_TXFCON2_TXGT_MSK BIT(CAN_TXFCON2_TXGT_POS)
-
-#define CAN_TXFCON2_DLEN_POSS 0U
-#define CAN_TXFCON2_DLEN_POSE 3U
-#define CAN_TXFCON2_DLEN_MSK BITS(CAN_TXFCON2_DLEN_POSS,CAN_TXFCON2_DLEN_POSE)
-
-/****************** Bit definition for CAN_TXDL2 register ************************/
-
-#define CAN_TXDL2_BYTE3_POSS 24U
-#define CAN_TXDL2_BYTE3_POSE 31U
-#define CAN_TXDL2_BYTE3_MSK BITS(CAN_TXDL2_BYTE3_POSS,CAN_TXDL2_BYTE3_POSE)
-
-#define CAN_TXDL2_BYTE2_POSS 16U
-#define CAN_TXDL2_BYTE2_POSE 23U
-#define CAN_TXDL2_BYTE2_MSK BITS(CAN_TXDL2_BYTE2_POSS,CAN_TXDL2_BYTE2_POSE)
-
-#define CAN_TXDL2_BYTE1_POSS 8U
-#define CAN_TXDL2_BYTE1_POSE 15U
-#define CAN_TXDL2_BYTE1_MSK BITS(CAN_TXDL2_BYTE1_POSS,CAN_TXDL2_BYTE1_POSE)
-
-#define CAN_TXDL2_BYTE0_POSS 0U
-#define CAN_TXDL2_BYTE0_POSE 7U
-#define CAN_TXDL2_BYTE0_MSK BITS(CAN_TXDL2_BYTE0_POSS,CAN_TXDL2_BYTE0_POSE)
-
-/****************** Bit definition for CAN_TXDH2 register ************************/
-
-#define CAN_TXDH2_BYTE7_POSS 24U
-#define CAN_TXDH2_BYTE7_POSE 31U
-#define CAN_TXDH2_BYTE7_MSK BITS(CAN_TXDH2_BYTE7_POSS,CAN_TXDH2_BYTE7_POSE)
-
-#define CAN_TXDH2_BYTE6_POSS 16U
-#define CAN_TXDH2_BYTE6_POSE 23U
-#define CAN_TXDH2_BYTE6_MSK BITS(CAN_TXDH2_BYTE6_POSS,CAN_TXDH2_BYTE6_POSE)
-
-#define CAN_TXDH2_BYTE5_POSS 8U
-#define CAN_TXDH2_BYTE5_POSE 15U
-#define CAN_TXDH2_BYTE5_MSK BITS(CAN_TXDH2_BYTE5_POSS,CAN_TXDH2_BYTE5_POSE)
-
-#define CAN_TXDH2_BYTE4_POSS 0U
-#define CAN_TXDH2_BYTE4_POSE 7U
-#define CAN_TXDH2_BYTE4_MSK BITS(CAN_TXDH2_BYTE4_POSS,CAN_TXDH2_BYTE4_POSE)
-
-/****************** Bit definition for CAN_RXF0ID register ************************/
-
-#define CAN_RXF0ID_STDID_POSS 21U
-#define CAN_RXF0ID_STDID_POSE 31U
-#define CAN_RXF0ID_STDID_MSK BITS(CAN_RXF0ID_STDID_POSS,CAN_RXF0ID_STDID_POSE)
-
-#define CAN_RXF0ID_EXID_POSS 3U
-#define CAN_RXF0ID_EXID_POSE 20U
-#define CAN_RXF0ID_EXID_MSK BITS(CAN_RXF0ID_EXID_POSS,CAN_RXF0ID_EXID_POSE)
-
-#define CAN_RXF0ID_IDE_POS 2U
-#define CAN_RXF0ID_IDE_MSK BIT(CAN_RXF0ID_IDE_POS)
-
-#define CAN_RXF0ID_RTR_POS 1U
-#define CAN_RXF0ID_RTR_MSK BIT(CAN_RXF0ID_RTR_POS)
-
-/****************** Bit definition for CAN_RXF0INF register ************************/
-
-#define CAN_RXF0INF_STAMP_POSS 16U
-#define CAN_RXF0INF_STAMP_POSE 31U
-#define CAN_RXF0INF_STAMP_MSK BITS(CAN_RXF0INF_STAMP_POSS,CAN_RXF0INF_STAMP_POSE)
-
-#define CAN_RXF0INF_FLTIDX_POSS 8U
-#define CAN_RXF0INF_FLTIDX_POSE 15U
-#define CAN_RXF0INF_FLTIDX_MSK BITS(CAN_RXF0INF_FLTIDX_POSS,CAN_RXF0INF_FLTIDX_POSE)
-
-#define CAN_RXF0INF_DLEN_POSS 0U
-#define CAN_RXF0INF_DLEN_POSE 3U
-#define CAN_RXF0INF_DLEN_MSK BITS(CAN_RXF0INF_DLEN_POSS,CAN_RXF0INF_DLEN_POSE)
-
-/****************** Bit definition for CAN_RXF0DL register ************************/
-
-#define CAN_RXF0DL_BYTE3_POSS 24U
-#define CAN_RXF0DL_BYTE3_POSE 31U
-#define CAN_RXF0DL_BYTE3_MSK BITS(CAN_RXF0DL_BYTE3_POSS,CAN_RXF0DL_BYTE3_POSE)
-
-#define CAN_RXF0DL_BYTE2_POSS 16U
-#define CAN_RXF0DL_BYTE2_POSE 23U
-#define CAN_RXF0DL_BYTE2_MSK BITS(CAN_RXF0DL_BYTE2_POSS,CAN_RXF0DL_BYTE2_POSE)
-
-#define CAN_RXF0DL_BYTE1_POSS 8U
-#define CAN_RXF0DL_BYTE1_POSE 15U
-#define CAN_RXF0DL_BYTE1_MSK BITS(CAN_RXF0DL_BYTE1_POSS,CAN_RXF0DL_BYTE1_POSE)
-
-#define CAN_RXF0DL_BYTE0_POSS 0U
-#define CAN_RXF0DL_BYTE0_POSE 7U
-#define CAN_RXF0DL_BYTE0_MSK BITS(CAN_RXF0DL_BYTE0_POSS,CAN_RXF0DL_BYTE0_POSE)
-
-/****************** Bit definition for CAN_RXF0DH register ************************/
-
-#define CAN_RXF0DH_BYTE7_POSS 24U
-#define CAN_RXF0DH_BYTE7_POSE 31U
-#define CAN_RXF0DH_BYTE7_MSK BITS(CAN_RXF0DH_BYTE7_POSS,CAN_RXF0DH_BYTE7_POSE)
-
-#define CAN_RXF0DH_BYTE6_POSS 16U
-#define CAN_RXF0DH_BYTE6_POSE 23U
-#define CAN_RXF0DH_BYTE6_MSK BITS(CAN_RXF0DH_BYTE6_POSS,CAN_RXF0DH_BYTE6_POSE)
-
-#define CAN_RXF0DH_BYTE5_POSS 8U
-#define CAN_RXF0DH_BYTE5_POSE 15U
-#define CAN_RXF0DH_BYTE5_MSK BITS(CAN_RXF0DH_BYTE5_POSS,CAN_RXF0DH_BYTE5_POSE)
-
-#define CAN_RXF0DH_BYTE4_POSS 0U
-#define CAN_RXF0DH_BYTE4_POSE 7U
-#define CAN_RXF0DH_BYTE4_MSK BITS(CAN_RXF0DH_BYTE4_POSS,CAN_RXF0DH_BYTE4_POSE)
-
-/****************** Bit definition for CAN_RXF1ID register ************************/
-
-#define CAN_RXF1ID_STDID_POSS 21U
-#define CAN_RXF1ID_STDID_POSE 31U
-#define CAN_RXF1ID_STDID_MSK BITS(CAN_RXF1ID_STDID_POSS,CAN_RXF1ID_STDID_POSE)
-
-#define CAN_RXF1ID_EXID_POSS 3U
-#define CAN_RXF1ID_EXID_POSE 20U
-#define CAN_RXF1ID_EXID_MSK BITS(CAN_RXF1ID_EXID_POSS,CAN_RXF1ID_EXID_POSE)
-
-#define CAN_RXF1ID_IDE_POS 2U
-#define CAN_RXF1ID_IDE_MSK BIT(CAN_RXF1ID_IDE_POS)
-
-#define CAN_RXF1ID_RTR_POS 1U
-#define CAN_RXF1ID_RTR_MSK BIT(CAN_RXF1ID_RTR_POS)
-
-/****************** Bit definition for CAN_RXF1INF register ************************/
-
-#define CAN_RXF1INF_STAMP_POSS 16U
-#define CAN_RXF1INF_STAMP_POSE 31U
-#define CAN_RXF1INF_STAMP_MSK BITS(CAN_RXF1INF_STAMP_POSS,CAN_RXF1INF_STAMP_POSE)
-
-#define CAN_RXF1INF_FLTIDX_POSS 8U
-#define CAN_RXF1INF_FLTIDX_POSE 15U
-#define CAN_RXF1INF_FLTIDX_MSK BITS(CAN_RXF1INF_FLTIDX_POSS,CAN_RXF1INF_FLTIDX_POSE)
-
-#define CAN_RXF1INF_DLEN_POSS 0U
-#define CAN_RXF1INF_DLEN_POSE 3U
-#define CAN_RXF1INF_DLEN_MSK BITS(CAN_RXF1INF_DLEN_POSS,CAN_RXF1INF_DLEN_POSE)
-
-/****************** Bit definition for CAN_RXF1DL register ************************/
-
-#define CAN_RXF1DL_BYTE3_POSS 24U
-#define CAN_RXF1DL_BYTE3_POSE 31U
-#define CAN_RXF1DL_BYTE3_MSK BITS(CAN_RXF1DL_BYTE3_POSS,CAN_RXF1DL_BYTE3_POSE)
-
-#define CAN_RXF1DL_BYTE2_POSS 16U
-#define CAN_RXF1DL_BYTE2_POSE 23U
-#define CAN_RXF1DL_BYTE2_MSK BITS(CAN_RXF1DL_BYTE2_POSS,CAN_RXF1DL_BYTE2_POSE)
-
-#define CAN_RXF1DL_BYTE1_POSS 8U
-#define CAN_RXF1DL_BYTE1_POSE 15U
-#define CAN_RXF1DL_BYTE1_MSK BITS(CAN_RXF1DL_BYTE1_POSS,CAN_RXF1DL_BYTE1_POSE)
-
-#define CAN_RXF1DL_BYTE0_POSS 0U
-#define CAN_RXF1DL_BYTE0_POSE 7U
-#define CAN_RXF1DL_BYTE0_MSK BITS(CAN_RXF1DL_BYTE0_POSS,CAN_RXF1DL_BYTE0_POSE)
-
-/****************** Bit definition for CAN_RXF1DH register ************************/
-
-#define CAN_RXF1DH_BYTE7_POSS 24U
-#define CAN_RXF1DH_BYTE7_POSE 31U
-#define CAN_RXF1DH_BYTE7_MSK BITS(CAN_RXF1DH_BYTE7_POSS,CAN_RXF1DH_BYTE7_POSE)
-
-#define CAN_RXF1DH_BYTE6_POSS 16U
-#define CAN_RXF1DH_BYTE6_POSE 23U
-#define CAN_RXF1DH_BYTE6_MSK BITS(CAN_RXF1DH_BYTE6_POSS,CAN_RXF1DH_BYTE6_POSE)
-
-#define CAN_RXF1DH_BYTE5_POSS 8U
-#define CAN_RXF1DH_BYTE5_POSE 15U
-#define CAN_RXF1DH_BYTE5_MSK BITS(CAN_RXF1DH_BYTE5_POSS,CAN_RXF1DH_BYTE5_POSE)
-
-#define CAN_RXF1DH_BYTE4_POSS 0U
-#define CAN_RXF1DH_BYTE4_POSE 7U
-#define CAN_RXF1DH_BYTE4_MSK BITS(CAN_RXF1DH_BYTE4_POSS,CAN_RXF1DH_BYTE4_POSE)
-
-/****************** Bit definition for CAN_FLTCON register ************************/
-
-#define CAN_FLTCON_FLTINI_POS 0U
-#define CAN_FLTCON_FLTINI_MSK BIT(CAN_FLTCON_FLTINI_POS)
-
-/****************** Bit definition for CAN_FLTM register ************************/
-
-#define CAN_FLTM_MOD_POSS 0U
-#define CAN_FLTM_MOD_POSE 13U
-#define CAN_FLTM_MOD_MSK BITS(CAN_FLTM_MOD_POSS,CAN_FLTM_MOD_POSE)
-
-/****************** Bit definition for CAN_FLTWS register ************************/
-
-#define CAN_FLTWS_SEL_POSS 0U
-#define CAN_FLTWS_SEL_POSE 13U
-#define CAN_FLTWS_SEL_MSK BITS(CAN_FLTWS_SEL_POSS,CAN_FLTWS_SEL_POSE)
-
-/****************** Bit definition for CAN_FLTAS register ************************/
-
-#define CAN_FLTAS_ASSIGN_POSS 0U
-#define CAN_FLTAS_ASSIGN_POSE 13U
-#define CAN_FLTAS_ASSIGN_MSK BITS(CAN_FLTAS_ASSIGN_POSS,CAN_FLTAS_ASSIGN_POSE)
-
-/****************** Bit definition for CAN_FLTGO register ************************/
-
-#define CAN_FLTGO_GO_POSS 0U
-#define CAN_FLTGO_GO_POSE 13U
-#define CAN_FLTGO_GO_MSK BITS(CAN_FLTGO_GO_POSS,CAN_FLTGO_GO_POSE)
-
-typedef struct {
- __IO uint32_t TXID;
- __IO uint32_t TXFCON;
- __IO uint32_t TXDL;
- __IO uint32_t TXDH;
-} CAN_TxMailBox_Typedef;
-
-typedef struct {
- __IO uint32_t RXFID;
- __IO uint32_t RXFINF;
- __IO uint32_t RXFDL;
- __IO uint32_t RXFDH;
-} CAN_RxFIFO_Typedef;
-
-typedef struct {
- __IO uint32_t FLT1;
- __IO uint32_t FLT2;
-} CAN_Filter_Typedef;
-
-typedef struct
-{
- __IO uint32_t CON;
- __I uint32_t STAT;
- __O uint32_t IFC;
- __IO uint32_t TXSTAT;
- __O uint32_t TXSTATC;
- __IO uint32_t RXF0;
- __O uint32_t RXF0C;
- __IO uint32_t RXF1;
- __O uint32_t RXF1C;
- __IO uint32_t IE;
- __IO uint32_t ERRSTAT;
- __IO uint32_t BTIME;
- uint32_t RESERVED0[84] ;
- CAN_TxMailBox_Typedef TxMailBox[3];
- CAN_RxFIFO_Typedef RxFIFO[2];
- uint32_t RESERVED1[12] ;
- __IO uint32_t FLTCON;
- __IO uint32_t FLTM;
- uint32_t RESERVED2 ;
- __IO uint32_t FLTWS;
- uint32_t RESERVED3 ;
- __IO uint32_t FLTAS;
- uint32_t RESERVED4 ;
- __IO uint32_t FLTGO;
- uint32_t RESERVED5[8] ;
- CAN_Filter_Typedef Filter[14];
-} CAN_TypeDef;
-
-/****************** Bit definition for CRC_CR register ************************/
-#define CRC_CR_BYTORD_POS 24U
-#define CRC_CR_BYTORD_MSK BIT(CRC_CR_BYTORD_POS)
-
-#define CRC_CR_DATLEN_POSS 22U
-#define CRC_CR_DATLEN_POSE 23U
-#define CRC_CR_DATLEN_MSK BITS(CRC_CR_DATLEN_POSS,CRC_CR_DATLEN_POSE)
-
-#define CRC_CR_MODE_POSS 20U
-#define CRC_CR_MODE_POSE 21U
-#define CRC_CR_MODE_MSK BITS(CRC_CR_MODE_POSS,CRC_CR_MODE_POSE)
-
-#define CRC_CR_CHSINV_POS 19U
-#define CRC_CR_CHSINV_MSK BIT(CRC_CR_CHSINV_POS)
-
-#define CRC_CR_DATINV_POS 18U
-#define CRC_CR_DATINV_MSK BIT(CRC_CR_DATINV_POS)
-
-#define CRC_CR_CHSREV_POS 17U
-#define CRC_CR_CHSREV_MSK BIT(CRC_CR_CHSREV_POS)
-
-#define CRC_CR_DATREV_POS 16U
-#define CRC_CR_DATREV_MSK BIT(CRC_CR_DATREV_POS)
-
-#define CRC_CR_DMAEN_POS 4U
-#define CRC_CR_DMAEN_MSK BIT(CRC_CR_DMAEN_POS)
-
-#define CRC_CR_CWERR_POS 3U
-#define CRC_CR_CWERR_MSK BIT(CRC_CR_CWERR_POS)
-
-#define CRC_CR_WERR_POS 2U
-#define CRC_CR_WERR_MSK BIT(CRC_CR_WERR_POS)
-
-#define CRC_CR_RST_POS 1U
-#define CRC_CR_RST_MSK BIT(CRC_CR_RST_POS)
-
-#define CRC_CR_EN_POS 0U
-#define CRC_CR_EN_MSK BIT(CRC_CR_EN_POS)
-
-/****************** Bit definition for CRC_DATA register ************************/
-
-#define CRC_DATA_DATA_POSS 0U
-#define CRC_DATA_DATA_POSE 31U
-#define CRC_DATA_DATA_MSK BITS(CRC_DATA_DATA_POSS,CRC_DATA_DATA_POSE)
-
-/****************** Bit definition for CRC_SEED register ************************/
-
-#define CRC_SEED_SEED_POSS 0U
-#define CRC_SEED_SEED_POSE 31U
-#define CRC_SEED_SEED_MSK BITS(CRC_SEED_SEED_POSS,CRC_SEED_SEED_POSE)
-
-/****************** Bit definition for CRC_CHECKSUM register ************************/
-
-#define CRC_CHECKSUM_CHECKSUM_POSS 0U
-#define CRC_CHECKSUM_CHECKSUM_POSE 31U
-#define CRC_CHECKSUM_CHECKSUM_MSK BITS(CRC_CHECKSUM_CHECKSUM_POSS,CRC_CHECKSUM_CHECKSUM_POSE)
-
-typedef struct
-{
- __IO uint32_t CR;
- __IO uint32_t DATA;
- __IO uint32_t SEED;
- __I uint32_t CHECKSUM;
-} CRC_TypeDef;
-
-/****************** Bit definition for CRYPT_CON register ************************/
-
-#define CRYPT_CON_CRYSEL_POS 31U
-#define CRYPT_CON_CRYSEL_MSK BIT(CRYPT_CON_CRYSEL_POS)
-
-#define CRYPT_CON_RESCLR_POS 15U
-#define CRYPT_CON_RESCLR_MSK BIT(CRYPT_CON_RESCLR_POS)
-
-#define CRYPT_CON_DMAEN_POS 14U
-#define CRYPT_CON_DMAEN_MSK BIT(CRYPT_CON_DMAEN_POS)
-
-#define CRYPT_CON_FIFOODR_POS 13U
-#define CRYPT_CON_FIFOODR_MSK BIT(CRYPT_CON_FIFOODR_POS)
-
-#define CRYPT_CON_FIFOEN_POS 12U
-#define CRYPT_CON_FIFOEN_MSK BIT(CRYPT_CON_FIFOEN_POS)
-
-#define CRYPT_CON_DESKS_POS 11U
-#define CRYPT_CON_DESKS_MSK BIT(CRYPT_CON_DESKS_POS)
-
-#define CRYPT_CON_TDES_POS 10U
-#define CRYPT_CON_TDES_MSK BIT(CRYPT_CON_TDES_POS)
-
-#define CRYPT_CON_TYPE_POSS 8U
-#define CRYPT_CON_TYPE_POSE 9U
-#define CRYPT_CON_TYPE_MSK BITS(CRYPT_CON_TYPE_POSS,CRYPT_CON_TYPE_POSE)
-
-#define CRYPT_CON_IE_POS 7U
-#define CRYPT_CON_IE_MSK BIT(CRYPT_CON_IE_POS)
-
-#define CRYPT_CON_IVEN_POS 6U
-#define CRYPT_CON_IVEN_MSK BIT(CRYPT_CON_IVEN_POS)
-
-#define CRYPT_CON_MODE_POSS 4U
-#define CRYPT_CON_MODE_POSE 5U
-#define CRYPT_CON_MODE_MSK BITS(CRYPT_CON_MODE_POSS,CRYPT_CON_MODE_POSE)
-
-#define CRYPT_CON_AESKS_POSS 2U
-#define CRYPT_CON_AESKS_POSE 3U
-#define CRYPT_CON_AESKS_MSK BITS(CRYPT_CON_AESKS_POSS,CRYPT_CON_AESKS_POSE)
-
-#define CRYPT_CON_ENCS_POS 1U
-#define CRYPT_CON_ENCS_MSK BIT(CRYPT_CON_ENCS_POS)
-
-#define CRYPT_CON_GO_POS 0U
-#define CRYPT_CON_GO_MSK BIT(CRYPT_CON_GO_POS)
-
-/****************** Bit definition for CRYPT_IF register ************************/
-
-#define CRYPT_IF_DONE_POS 8U
-#define CRYPT_IF_DONE_MSK BIT(CRYPT_IF_DONE_POS)
-
-#define CRYPT_IF_MULTHIF_POS 2U
-#define CRYPT_IF_MULTHIF_MSK BIT(CRYPT_IF_MULTHIF_POS)
-
-#define CRYPT_IF_DESIF_POS 1U
-#define CRYPT_IF_DESIF_MSK BIT(CRYPT_IF_DESIF_POS)
-
-#define CRYPT_IF_AESIF_POS 0U
-#define CRYPT_IF_AESIF_MSK BIT(CRYPT_IF_AESIF_POS)
-
-/****************** Bit definition for CRYPT_IFC register ************************/
-
-#define CRYPT_IFC_MULTHIFC_POS 2U
-#define CRYPT_IFC_MULTHIFC_MSK BIT(CRYPT_IFC_MULTHIFC_POS)
-
-#define CRYPT_IFC_DESIFC_POS 1U
-#define CRYPT_IFC_DESIFC_MSK BIT(CRYPT_IFC_DESIFC_POS)
-
-#define CRYPT_IFC_AESIFC_POS 0U
-#define CRYPT_IFC_AESIFC_MSK BIT(CRYPT_IFC_AESIFC_POS)
-
-/****************** Bit definition for CRYPT_FIFO register ************************/
-
-#define CRYPT_FIFO_FIFO_POSS 0U
-#define CRYPT_FIFO_FIFO_POSE 31U
-#define CRYPT_FIFO_FIFO_MSK BITS(CRYPT_FIFO_FIFO_POSS,CRYPT_FIFO_FIFO_POSE)
-
-typedef struct
-{
- __IO uint32_t DATA[4];
- __IO uint32_t KEY[8];
- __IO uint32_t IV[4];
- __I uint32_t RES[4];
- __IO uint32_t CON;
- __I uint32_t IF;
- __O uint32_t IFC;
- __IO uint32_t FIFO;
-} CRYPT_TypeDef;
-
-/****************** Bit definition for LCD_CR register ************************/
-
-#define LCD_CR_VCHPS_POSS 24U
-#define LCD_CR_VCHPS_POSE 25U
-#define LCD_CR_VCHPS_MSK BITS(LCD_CR_VCHPS_POSS,LCD_CR_VCHPS_POSE)
-
-#define LCD_CR_DSLD_POSS 20U
-#define LCD_CR_DSLD_POSE 23U
-#define LCD_CR_DSLD_MSK BITS(LCD_CR_DSLD_POSS,LCD_CR_DSLD_POSE)
-
-#define LCD_CR_DSHD_POSS 16U
-#define LCD_CR_DSHD_POSE 19U
-#define LCD_CR_DSHD_MSK BITS(LCD_CR_DSHD_POSS,LCD_CR_DSHD_POSE)
-
-#define LCD_CR_VBUFLD_POS 15U
-#define LCD_CR_VBUFLD_MSK BIT(LCD_CR_VBUFLD_POS)
-
-#define LCD_CR_VBUFHD_POS 14U
-#define LCD_CR_VBUFHD_MSK BIT(LCD_CR_VBUFHD_POS)
-
-#define LCD_CR_RESLD_POSS 12U
-#define LCD_CR_RESLD_POSE 13U
-#define LCD_CR_RESLD_MSK BITS(LCD_CR_RESLD_POSS,LCD_CR_RESLD_POSE)
-
-#define LCD_CR_RESHD_POSS 10U
-#define LCD_CR_RESHD_POSE 11U
-#define LCD_CR_RESHD_MSK BITS(LCD_CR_RESHD_POSS,LCD_CR_RESHD_POSE)
-
-#define LCD_CR_BIAS_POSS 8U
-#define LCD_CR_BIAS_POSE 9U
-#define LCD_CR_BIAS_MSK BITS(LCD_CR_BIAS_POSS,LCD_CR_BIAS_POSE)
-
-#define LCD_CR_DUTY_POSS 4U
-#define LCD_CR_DUTY_POSE 6U
-#define LCD_CR_DUTY_MSK BITS(LCD_CR_DUTY_POSS,LCD_CR_DUTY_POSE)
-
-#define LCD_CR_OE_POS 3U
-#define LCD_CR_OE_MSK BIT(LCD_CR_OE_POS)
-
-#define LCD_CR_VSEL_POSS 1U
-#define LCD_CR_VSEL_POSE 2U
-#define LCD_CR_VSEL_MSK BITS(LCD_CR_VSEL_POSS,LCD_CR_VSEL_POSE)
-
-#define LCD_CR_EN_POS 0U
-#define LCD_CR_EN_MSK BIT(LCD_CR_EN_POS)
-
-/****************** Bit definition for LCD_FCR register ************************/
-
-#define LCD_FCR_WFS_POS 31U
-#define LCD_FCR_WFS_MSK BIT(LCD_FCR_WFS_POS)
-
-#define LCD_FCR_PRS_POSS 24U
-#define LCD_FCR_PRS_POSE 27U
-#define LCD_FCR_PRS_MSK BITS(LCD_FCR_PRS_POSS,LCD_FCR_PRS_POSE)
-
-#define LCD_FCR_DIV_POSS 20U
-#define LCD_FCR_DIV_POSE 23U
-#define LCD_FCR_DIV_MSK BITS(LCD_FCR_DIV_POSS,LCD_FCR_DIV_POSE)
-
-#define LCD_FCR_BLMOD_POSS 16U
-#define LCD_FCR_BLMOD_POSE 17U
-#define LCD_FCR_BLMOD_MSK BITS(LCD_FCR_BLMOD_POSS,LCD_FCR_BLMOD_POSE)
-
-#define LCD_FCR_BLFRQ_POSS 12U
-#define LCD_FCR_BLFRQ_POSE 14U
-#define LCD_FCR_BLFRQ_MSK BITS(LCD_FCR_BLFRQ_POSS,LCD_FCR_BLFRQ_POSE)
-
-#define LCD_FCR_DEAD_POSS 8U
-#define LCD_FCR_DEAD_POSE 10U
-#define LCD_FCR_DEAD_MSK BITS(LCD_FCR_DEAD_POSS,LCD_FCR_DEAD_POSE)
-
-#define LCD_FCR_HD_POS 7U
-#define LCD_FCR_HD_MSK BIT(LCD_FCR_HD_POS)
-
-#define LCD_FCR_PON_POSS 4U
-#define LCD_FCR_PON_POSE 6U
-#define LCD_FCR_PON_MSK BITS(LCD_FCR_PON_POSS,LCD_FCR_PON_POSE)
-
-#define LCD_FCR_VGS_POSS 0U
-#define LCD_FCR_VGS_POSE 3U
-#define LCD_FCR_VGS_MSK BITS(LCD_FCR_VGS_POSS,LCD_FCR_VGS_POSE)
-
-/****************** Bit definition for LCD_SEGCR0 register ************************/
-
-#define LCD_SEGCR0_SEG_OE_POSS 0U
-#define LCD_SEGCR0_SEG_OE_POSE 31U
-#define LCD_SEGCR0_SEG_OE_MSK BITS(LCD_SEGCR0_SEG_OE_POSS,LCD_SEGCR0_SEG_OE_POSE)
-
-/****************** Bit definition for LCD_SEGCR1 register ************************/
-
-#define LCD_SEGCR1_SEG_OE_POSS 0U
-#define LCD_SEGCR1_SEG_OE_POSE 11U
-#define LCD_SEGCR1_SEG_OE_MSK BITS(LCD_SEGCR1_SEG_OE_POSS,LCD_SEGCR1_SEG_OE_POSE)
-
-/****************** Bit definition for LCD_IE register ************************/
-
-#define LCD_IE_UDDIE_POS 1U
-#define LCD_IE_UDDIE_MSK BIT(LCD_IE_UDDIE_POS)
-
-#define LCD_IE_SOFIE_POS 0U
-#define LCD_IE_SOFIE_MSK BIT(LCD_IE_SOFIE_POS)
-
-/****************** Bit definition for LCD_IF register ************************/
-
-#define LCD_IF_UDDIF_POS 1U
-#define LCD_IF_UDDIF_MSK BIT(LCD_IF_UDDIF_POS)
-
-#define LCD_IF_SOFIF_POS 0U
-#define LCD_IF_SOFIF_MSK BIT(LCD_IF_SOFIF_POS)
-
-/****************** Bit definition for LCD_IFCR register ************************/
-
-#define LCD_IFCR_UDDIFC_POS 1U
-#define LCD_IFCR_UDDIFC_MSK BIT(LCD_IFCR_UDDIFC_POS)
-
-#define LCD_IFCR_SOFIFC_POS 0U
-#define LCD_IFCR_SOFIFC_MSK BIT(LCD_IFCR_SOFIFC_POS)
-
-/****************** Bit definition for LCD_SR register ************************/
-
-#define LCD_SR_FCRSF_POS 3U
-#define LCD_SR_FCRSF_MSK BIT(LCD_SR_FCRSF_POS)
-
-#define LCD_SR_UDR_POS 2U
-#define LCD_SR_UDR_MSK BIT(LCD_SR_UDR_POS)
-
-#define LCD_SR_ENS_POS 1U
-#define LCD_SR_ENS_MSK BIT(LCD_SR_ENS_POS)
-
-#define LCD_SR_RDY_POS 0U
-#define LCD_SR_RDY_MSK BIT(LCD_SR_RDY_POS)
-
-/****************** Bit definition for LCD_BUF register ************************/
-
-#define LCD_BUF_SEG_DATA_POSS 0U
-#define LCD_BUF_SEG_DATA_POSE 31U
-#define LCD_BUF_SEG_DATA_MSK BITS(LCD_BUF_SEG_DATA_POSS,LCD_BUF_SEG_DATA_POSE)
-
-typedef struct
-{
- __IO uint32_t CR;
- __IO uint32_t FCR;
- __IO uint32_t SEGCR0;
- __IO uint32_t SEGCR1;
- __IO uint32_t IE;
- __I uint32_t IF;
- __O uint32_t IFCR;
- __I uint32_t SR;
- uint32_t RESERVED0[8] ;
- __IO uint32_t BUF[16];
-} LCD_TypeDef;
-
-/****************** Bit definition for ADC_STAT register ************************/
-
-#define ADC_STAT_ICHS_POS 9U
-#define ADC_STAT_ICHS_MSK BIT(ADC_STAT_ICHS_POS)
-
-#define ADC_STAT_NCHS_POS 8U
-#define ADC_STAT_NCHS_MSK BIT(ADC_STAT_NCHS_POS)
-
-#define ADC_STAT_OVR_POS 3U
-#define ADC_STAT_OVR_MSK BIT(ADC_STAT_OVR_POS)
-
-#define ADC_STAT_ICHE_POS 2U
-#define ADC_STAT_ICHE_MSK BIT(ADC_STAT_ICHE_POS)
-
-#define ADC_STAT_NCHE_POS 1U
-#define ADC_STAT_NCHE_MSK BIT(ADC_STAT_NCHE_POS)
-
-#define ADC_STAT_AWDF_POS 0U
-#define ADC_STAT_AWDF_MSK BIT(ADC_STAT_AWDF_POS)
-
-/****************** Bit definition for ADC_CLR register ************************/
-
-#define ADC_CLR_ICHS_POS 9U
-#define ADC_CLR_ICHS_MSK BIT(ADC_CLR_ICHS_POS)
-
-#define ADC_CLR_NCHS_POS 8U
-#define ADC_CLR_NCHS_MSK BIT(ADC_CLR_NCHS_POS)
-
-#define ADC_CLR_OVR_POS 3U
-#define ADC_CLR_OVR_MSK BIT(ADC_CLR_OVR_POS)
-
-#define ADC_CLR_ICHE_POS 2U
-#define ADC_CLR_ICHE_MSK BIT(ADC_CLR_ICHE_POS)
-
-#define ADC_CLR_NCHE_POS 1U
-#define ADC_CLR_NCHE_MSK BIT(ADC_CLR_NCHE_POS)
-
-#define ADC_CLR_AWDF_POS 0U
-#define ADC_CLR_AWDF_MSK BIT(ADC_CLR_AWDF_POS)
-
-/****************** Bit definition for ADC_CON0 register ************************/
-
-#define ADC_CON0_OVRIE_POS 26U
-#define ADC_CON0_OVRIE_MSK BIT(ADC_CON0_OVRIE_POS)
-
-#define ADC_CON0_RSEL_POSS 24U
-#define ADC_CON0_RSEL_POSE 25U
-#define ADC_CON0_RSEL_MSK BITS(ADC_CON0_RSEL_POSS,ADC_CON0_RSEL_POSE)
-
-#define ADC_CON0_NCHWDEN_POS 23U
-#define ADC_CON0_NCHWDEN_MSK BIT(ADC_CON0_NCHWDEN_POS)
-
-#define ADC_CON0_ICHWDTEN_POS 22U
-#define ADC_CON0_ICHWDTEN_MSK BIT(ADC_CON0_ICHWDTEN_POS)
-
-#define ADC_CON0_ETRGN_POSS 13U
-#define ADC_CON0_ETRGN_POSE 15U
-#define ADC_CON0_ETRGN_MSK BITS(ADC_CON0_ETRGN_POSS,ADC_CON0_ETRGN_POSE)
-
-#define ADC_CON0_ICHDCEN_POS 12U
-#define ADC_CON0_ICHDCEN_MSK BIT(ADC_CON0_ICHDCEN_POS)
-
-#define ADC_CON0_NCHDCEN_POS 11U
-#define ADC_CON0_NCHDCEN_MSK BIT(ADC_CON0_NCHDCEN_POS)
-
-#define ADC_CON0_IAUTO_POS 10U
-#define ADC_CON0_IAUTO_MSK BIT(ADC_CON0_IAUTO_POS)
-
-#define ADC_CON0_AWDSGL_POS 9U
-#define ADC_CON0_AWDSGL_MSK BIT(ADC_CON0_AWDSGL_POS)
-
-#define ADC_CON0_SCANEN_POS 8U
-#define ADC_CON0_SCANEN_MSK BIT(ADC_CON0_SCANEN_POS)
-
-#define ADC_CON0_ICHEIE_POS 7U
-#define ADC_CON0_ICHEIE_MSK BIT(ADC_CON0_ICHEIE_POS)
-
-#define ADC_CON0_AWDIE_POS 6U
-#define ADC_CON0_AWDIE_MSK BIT(ADC_CON0_AWDIE_POS)
-
-#define ADC_CON0_NCHEIE_POS 5U
-#define ADC_CON0_NCHEIE_MSK BIT(ADC_CON0_NCHEIE_POS)
-
-#define ADC_CON0_AWDCH_POSS 0U
-#define ADC_CON0_AWDCH_POSE 4U
-#define ADC_CON0_AWDCH_MSK BITS(ADC_CON0_AWDCH_POSS,ADC_CON0_AWDCH_POSE)
-
-/****************** Bit definition for ADC_CON1 register ************************/
-
-#define ADC_CON1_NCHTRG_POS 30U
-#define ADC_CON1_NCHTRG_MSK BIT(ADC_CON1_NCHTRG_POS)
-
-#define ADC_CON1_ICHTRG_POS 22U
-#define ADC_CON1_ICHTRG_MSK BIT(ADC_CON1_ICHTRG_POS)
-
-#define ADC_CON1_ALIGN_POS 11U
-#define ADC_CON1_ALIGN_MSK BIT(ADC_CON1_ALIGN_POS)
-
-#define ADC_CON1_NCHESEL_POS 10U
-#define ADC_CON1_NCHESEL_MSK BIT(ADC_CON1_NCHESEL_POS)
-
-#define ADC_CON1_OVRDIS_POS 8U
-#define ADC_CON1_OVRDIS_MSK BIT(ADC_CON1_OVRDIS_POS)
-
-#define ADC_CON1_CM_POS 1U
-#define ADC_CON1_CM_MSK BIT(ADC_CON1_CM_POS)
-
-#define ADC_CON1_ADCEN_POS 0U
-#define ADC_CON1_ADCEN_MSK BIT(ADC_CON1_ADCEN_POS)
-
-/****************** Bit definition for ADC_SMPT1 register ************************/
-
-#define ADC_SMPT1_CHT_POSS 0U
-#define ADC_SMPT1_CHT_POSE 31U
-#define ADC_SMPT1_CHT_MSK BITS(ADC_SMPT1_CHT_POSS,ADC_SMPT1_CHT_POSE)
-
-/****************** Bit definition for ADC_SMPT2 register ************************/
-
-#define ADC_SMPT2_CHT_POSS 0U
-#define ADC_SMPT2_CHT_POSE 7U
-#define ADC_SMPT2_CHT_MSK BITS(ADC_SMPT2_CHT_POSS,ADC_SMPT2_CHT_POSE)
-
-/****************** Bit definition for ADC_ICHOFF1 register ************************/
-
-#define ADC_ICHOFF1_IOFF_POSS 0U
-#define ADC_ICHOFF1_IOFF_POSE 11U
-#define ADC_ICHOFF1_IOFF_MSK BITS(ADC_ICHOFF1_IOFF_POSS,ADC_ICHOFF1_IOFF_POSE)
-
-/****************** Bit definition for ADC_ICHOFF2 register ************************/
-
-#define ADC_ICHOFF2_IOFF_POSS 0U
-#define ADC_ICHOFF2_IOFF_POSE 11U
-#define ADC_ICHOFF2_IOFF_MSK BITS(ADC_ICHOFF2_IOFF_POSS,ADC_ICHOFF2_IOFF_POSE)
-
-/****************** Bit definition for ADC_ICHOFF3 register ************************/
-
-#define ADC_ICHOFF3_IOFF_POSS 0U
-#define ADC_ICHOFF3_IOFF_POSE 11U
-#define ADC_ICHOFF3_IOFF_MSK BITS(ADC_ICHOFF3_IOFF_POSS,ADC_ICHOFF3_IOFF_POSE)
-
-/****************** Bit definition for ADC_ICHOFF4 register ************************/
-
-#define ADC_ICHOFF4_IOFF_POSS 0U
-#define ADC_ICHOFF4_IOFF_POSE 11U
-#define ADC_ICHOFF4_IOFF_MSK BITS(ADC_ICHOFF4_IOFF_POSS,ADC_ICHOFF4_IOFF_POSE)
-
-/****************** Bit definition for ADC_WDTH register ************************/
-
-#define ADC_WDTH_HT_POSS 0U
-#define ADC_WDTH_HT_POSE 11U
-#define ADC_WDTH_HT_MSK BITS(ADC_WDTH_HT_POSS,ADC_WDTH_HT_POSE)
-
-/****************** Bit definition for ADC_WDTL register ************************/
-
-#define ADC_WDTL_LT_POSS 0U
-#define ADC_WDTL_LT_POSE 11U
-#define ADC_WDTL_LT_MSK BITS(ADC_WDTL_LT_POSS,ADC_WDTL_LT_POSE)
-
-/****************** Bit definition for ADC_NCHS1 register ************************/
-
-#define ADC_NCHS1_NS4_POSS 24U
-#define ADC_NCHS1_NS4_POSE 28U
-#define ADC_NCHS1_NS4_MSK BITS(ADC_NCHS1_NS4_POSS,ADC_NCHS1_NS4_POSE)
-
-#define ADC_NCHS1_NS3_POSS 16U
-#define ADC_NCHS1_NS3_POSE 20U
-#define ADC_NCHS1_NS3_MSK BITS(ADC_NCHS1_NS3_POSS,ADC_NCHS1_NS3_POSE)
-
-#define ADC_NCHS1_NS2_POSS 8U
-#define ADC_NCHS1_NS2_POSE 12U
-#define ADC_NCHS1_NS2_MSK BITS(ADC_NCHS1_NS2_POSS,ADC_NCHS1_NS2_POSE)
-
-#define ADC_NCHS1_NS1_POSS 0U
-#define ADC_NCHS1_NS1_POSE 4U
-#define ADC_NCHS1_NS1_MSK BITS(ADC_NCHS1_NS1_POSS,ADC_NCHS1_NS1_POSE)
-
-/****************** Bit definition for ADC_NCHS2 register ************************/
-
-#define ADC_NCHS2_NS8_POSS 24U
-#define ADC_NCHS2_NS8_POSE 28U
-#define ADC_NCHS2_NS8_MSK BITS(ADC_NCHS2_NS8_POSS,ADC_NCHS2_NS8_POSE)
-
-#define ADC_NCHS2_NS7_POSS 16U
-#define ADC_NCHS2_NS7_POSE 20U
-#define ADC_NCHS2_NS7_MSK BITS(ADC_NCHS2_NS7_POSS,ADC_NCHS2_NS7_POSE)
-
-#define ADC_NCHS2_NS6_POSS 8U
-#define ADC_NCHS2_NS6_POSE 12U
-#define ADC_NCHS2_NS6_MSK BITS(ADC_NCHS2_NS6_POSS,ADC_NCHS2_NS6_POSE)
-
-#define ADC_NCHS2_NS5_POSS 0U
-#define ADC_NCHS2_NS5_POSE 4U
-#define ADC_NCHS2_NS5_MSK BITS(ADC_NCHS2_NS5_POSS,ADC_NCHS2_NS5_POSE)
-
-/****************** Bit definition for ADC_NCHS3 register ************************/
-
-#define ADC_NCHS3_NS12_POSS 24U
-#define ADC_NCHS3_NS12_POSE 28U
-#define ADC_NCHS3_NS12_MSK BITS(ADC_NCHS3_NS12_POSS,ADC_NCHS3_NS12_POSE)
-
-#define ADC_NCHS3_NS11_POSS 16U
-#define ADC_NCHS3_NS11_POSE 20U
-#define ADC_NCHS3_NS11_MSK BITS(ADC_NCHS3_NS11_POSS,ADC_NCHS3_NS11_POSE)
-
-#define ADC_NCHS3_NS10_POSS 8U
-#define ADC_NCHS3_NS10_POSE 12U
-#define ADC_NCHS3_NS10_MSK BITS(ADC_NCHS3_NS10_POSS,ADC_NCHS3_NS10_POSE)
-
-#define ADC_NCHS3_NS9_POSS 0U
-#define ADC_NCHS3_NS9_POSE 4U
-#define ADC_NCHS3_NS9_MSK BITS(ADC_NCHS3_NS9_POSS,ADC_NCHS3_NS9_POSE)
-
-/****************** Bit definition for ADC_NCHS4 register ************************/
-
-#define ADC_NCHS4_NS16_POSS 24U
-#define ADC_NCHS4_NS16_POSE 28U
-#define ADC_NCHS4_NS16_MSK BITS(ADC_NCHS4_NS16_POSS,ADC_NCHS4_NS16_POSE)
-
-#define ADC_NCHS4_NS15_POSS 16U
-#define ADC_NCHS4_NS15_POSE 20U
-#define ADC_NCHS4_NS15_MSK BITS(ADC_NCHS4_NS15_POSS,ADC_NCHS4_NS15_POSE)
-
-#define ADC_NCHS4_NS14_POSS 8U
-#define ADC_NCHS4_NS14_POSE 12U
-#define ADC_NCHS4_NS14_MSK BITS(ADC_NCHS4_NS14_POSS,ADC_NCHS4_NS14_POSE)
-
-#define ADC_NCHS4_NS13_POSS 0U
-#define ADC_NCHS4_NS13_POSE 4U
-#define ADC_NCHS4_NS13_MSK BITS(ADC_NCHS4_NS13_POSS,ADC_NCHS4_NS13_POSE)
-
-/****************** Bit definition for ADC_ICHS register ************************/
-
-#define ADC_ICHS_IS4_POSS 24U
-#define ADC_ICHS_IS4_POSE 28U
-#define ADC_ICHS_IS4_MSK BITS(ADC_ICHS_IS4_POSS,ADC_ICHS_IS4_POSE)
-
-#define ADC_ICHS_IS3_POSS 16U
-#define ADC_ICHS_IS3_POSE 20U
-#define ADC_ICHS_IS3_MSK BITS(ADC_ICHS_IS3_POSS,ADC_ICHS_IS3_POSE)
-
-#define ADC_ICHS_IS2_POSS 8U
-#define ADC_ICHS_IS2_POSE 12U
-#define ADC_ICHS_IS2_MSK BITS(ADC_ICHS_IS2_POSS,ADC_ICHS_IS2_POSE)
-
-#define ADC_ICHS_IS1_POSS 0U
-#define ADC_ICHS_IS1_POSE 4U
-#define ADC_ICHS_IS1_MSK BITS(ADC_ICHS_IS1_POSS,ADC_ICHS_IS1_POSE)
-
-/****************** Bit definition for ADC_CHSL register ************************/
-
-#define ADC_CHSL_ISL_POSS 8U
-#define ADC_CHSL_ISL_POSE 9U
-#define ADC_CHSL_ISL_MSK BITS(ADC_CHSL_ISL_POSS,ADC_CHSL_ISL_POSE)
-
-#define ADC_CHSL_NSL_POSS 0U
-#define ADC_CHSL_NSL_POSE 3U
-#define ADC_CHSL_NSL_MSK BITS(ADC_CHSL_NSL_POSS,ADC_CHSL_NSL_POSE)
-
-/****************** Bit definition for ADC_ICHDR1 register ************************/
-
-#define ADC_ICHDR1_VAL_POSS 0U
-#define ADC_ICHDR1_VAL_POSE 15U
-#define ADC_ICHDR1_VAL_MSK BITS(ADC_ICHDR1_VAL_POSS,ADC_ICHDR1_VAL_POSE)
-
-/****************** Bit definition for ADC_ICHDR2 register ************************/
-
-#define ADC_ICHDR2_VAL_POSS 0U
-#define ADC_ICHDR2_VAL_POSE 15U
-#define ADC_ICHDR2_VAL_MSK BITS(ADC_ICHDR2_VAL_POSS,ADC_ICHDR2_VAL_POSE)
-
-/****************** Bit definition for ADC_ICHDR3 register ************************/
-
-#define ADC_ICHDR3_VAL_POSS 0U
-#define ADC_ICHDR3_VAL_POSE 15U
-#define ADC_ICHDR3_VAL_MSK BITS(ADC_ICHDR3_VAL_POSS,ADC_ICHDR3_VAL_POSE)
-
-/****************** Bit definition for ADC_ICHDR4 register ************************/
-
-#define ADC_ICHDR4_VAL_POSS 0U
-#define ADC_ICHDR4_VAL_POSE 15U
-#define ADC_ICHDR4_VAL_MSK BITS(ADC_ICHDR4_VAL_POSS,ADC_ICHDR4_VAL_POSE)
-
-/****************** Bit definition for ADC_NCHDR register ************************/
-
-#define ADC_NCHDR_VAL_POSS 0U
-#define ADC_NCHDR_VAL_POSE 15U
-#define ADC_NCHDR_VAL_MSK BITS(ADC_NCHDR_VAL_POSS,ADC_NCHDR_VAL_POSE)
-
-/****************** Bit definition for ADC_CCR register ************************/
-
-#define ADC_CCR_TRMEN_POS 28U
-#define ADC_CCR_TRMEN_MSK BIT(ADC_CCR_TRMEN_POS)
-
-#define ADC_CCR_GAINCALEN_POS 25U
-#define ADC_CCR_GAINCALEN_MSK BIT(ADC_CCR_GAINCALEN_POS)
-
-#define ADC_CCR_OFFCALEN_POS 24U
-#define ADC_CCR_OFFCALEN_MSK BIT(ADC_CCR_OFFCALEN_POS)
-
-#define ADC_CCR_VREFOEN_POS 19U
-#define ADC_CCR_VREFOEN_MSK BIT(ADC_CCR_VREFOEN_POS)
-
-#define ADC_CCR_VRNSEL_POS 18U
-#define ADC_CCR_VRNSEL_MSK BIT(ADC_CCR_VRNSEL_POS)
-
-#define ADC_CCR_VRPSEL_POSS 16U
-#define ADC_CCR_VRPSEL_POSE 17U
-#define ADC_CCR_VRPSEL_MSK BITS(ADC_CCR_VRPSEL_POSS,ADC_CCR_VRPSEL_POSE)
-
-#define ADC_CCR_PWRMODSEL_POS 15U
-#define ADC_CCR_PWRMODSEL_MSK BIT(ADC_CCR_PWRMODSEL_POS)
-
-#define ADC_CCR_DIFFEN_POS 12U
-#define ADC_CCR_DIFFEN_MSK BIT(ADC_CCR_DIFFEN_POS)
-
-#define ADC_CCR_IREFEN_POS 11U
-#define ADC_CCR_IREFEN_MSK BIT(ADC_CCR_IREFEN_POS)
-
-#define ADC_CCR_VRBUFEN_POS 10U
-#define ADC_CCR_VRBUFEN_MSK BIT(ADC_CCR_VRBUFEN_POS)
-
-#define ADC_CCR_VCMBUFEN_POS 9U
-#define ADC_CCR_VCMBUFEN_MSK BIT(ADC_CCR_VCMBUFEN_POS)
-
-#define ADC_CCR_VREFEN_POS 8U
-#define ADC_CCR_VREFEN_MSK BIT(ADC_CCR_VREFEN_POS)
-
-#define ADC_CCR_CKDIV_POSS 0U
-#define ADC_CCR_CKDIV_POSE 2U
-#define ADC_CCR_CKDIV_MSK BITS(ADC_CCR_CKDIV_POSS,ADC_CCR_CKDIV_POSE)
-
-typedef struct
-{
- __I uint32_t STAT;
- __O uint32_t CLR;
- __IO uint32_t CON0;
- __IO uint32_t CON1;
- __IO uint32_t SMPT1;
- __IO uint32_t SMPT2;
- __IO uint32_t ICHOFF[4];
- __IO uint32_t WDTH;
- __IO uint32_t WDTL;
- __IO uint32_t NCHS1;
- __IO uint32_t NCHS2;
- __IO uint32_t NCHS3;
- __IO uint32_t NCHS4;
- __IO uint32_t ICHS;
- __IO uint32_t CHSL;
- __I uint32_t ICHDR[4];
- __I uint32_t NCHDR;
- __IO uint32_t CCR;
-} ADC_TypeDef;
-
-/****************** Bit definition for ACMP_CON register ************************/
-
-#define ACMP_CON_FALLEN_POS 17U
-#define ACMP_CON_FALLEN_MSK BIT(ACMP_CON_FALLEN_POS)
-
-#define ACMP_CON_RISEEN_POS 16U
-#define ACMP_CON_RISEEN_MSK BIT(ACMP_CON_RISEEN_POS)
-
-#define ACMP_CON_MODSEL_POSS 14U
-#define ACMP_CON_MODSEL_POSE 15U
-#define ACMP_CON_MODSEL_MSK BITS(ACMP_CON_MODSEL_POSS,ACMP_CON_MODSEL_POSE)
-
-#define ACMP_CON_WARMUPT_POSS 8U
-#define ACMP_CON_WARMUPT_POSE 10U
-#define ACMP_CON_WARMUPT_MSK BITS(ACMP_CON_WARMUPT_POSS,ACMP_CON_WARMUPT_POSE)
-
-#define ACMP_CON_HYSTSEL_POSS 4U
-#define ACMP_CON_HYSTSEL_POSE 6U
-#define ACMP_CON_HYSTSEL_MSK BITS(ACMP_CON_HYSTSEL_POSS,ACMP_CON_HYSTSEL_POSE)
-
-#define ACMP_CON_OUTINV_POS 3U
-#define ACMP_CON_OUTINV_MSK BIT(ACMP_CON_OUTINV_POS)
-
-#define ACMP_CON_INACTV_POS 2U
-#define ACMP_CON_INACTV_MSK BIT(ACMP_CON_INACTV_POS)
-
-#define ACMP_CON_EN_POS 0U
-#define ACMP_CON_EN_MSK BIT(ACMP_CON_EN_POS)
-
-/****************** Bit definition for ACMP_INPUTSEL register ************************/
-
-#define ACMP_INPUTSEL_VDDLVL_POSS 8U
-#define ACMP_INPUTSEL_VDDLVL_POSE 13U
-#define ACMP_INPUTSEL_VDDLVL_MSK BITS(ACMP_INPUTSEL_VDDLVL_POSS,ACMP_INPUTSEL_VDDLVL_POSE)
-
-#define ACMP_INPUTSEL_NSEL_POSS 4U
-#define ACMP_INPUTSEL_NSEL_POSE 7U
-#define ACMP_INPUTSEL_NSEL_MSK BITS(ACMP_INPUTSEL_NSEL_POSS,ACMP_INPUTSEL_NSEL_POSE)
-
-#define ACMP_INPUTSEL_PSEL_POSS 0U
-#define ACMP_INPUTSEL_PSEL_POSE 2U
-#define ACMP_INPUTSEL_PSEL_MSK BITS(ACMP_INPUTSEL_PSEL_POSS,ACMP_INPUTSEL_PSEL_POSE)
-
-/****************** Bit definition for ACMP_STAT register ************************/
-
-#define ACMP_STAT_OUT_POS 1U
-#define ACMP_STAT_OUT_MSK BIT(ACMP_STAT_OUT_POS)
-
-#define ACMP_STAT_ACT_POS 0U
-#define ACMP_STAT_ACT_MSK BIT(ACMP_STAT_ACT_POS)
-
-/****************** Bit definition for ACMP_IES register ************************/
-
-#define ACMP_IES_WARMUP_POS 1U
-#define ACMP_IES_WARMUP_MSK BIT(ACMP_IES_WARMUP_POS)
-
-#define ACMP_IES_EDGE_POS 0U
-#define ACMP_IES_EDGE_MSK BIT(ACMP_IES_EDGE_POS)
-
-/****************** Bit definition for ACMP_IEV register ************************/
-
-#define ACMP_IEV_WARMUP_POS 1U
-#define ACMP_IEV_WARMUP_MSK BIT(ACMP_IEV_WARMUP_POS)
-
-#define ACMP_IEV_EDGE_POS 0U
-#define ACMP_IEV_EDGE_MSK BIT(ACMP_IEV_EDGE_POS)
-
-/****************** Bit definition for ACMP_IEC register ************************/
-
-#define ACMP_IEC_WARMUP_POS 1U
-#define ACMP_IEC_WARMUP_MSK BIT(ACMP_IEC_WARMUP_POS)
-
-#define ACMP_IEC_EDGE_POS 0U
-#define ACMP_IEC_EDGE_MSK BIT(ACMP_IEC_EDGE_POS)
-
-/****************** Bit definition for ACMP_RIF register ************************/
-
-#define ACMP_RIF_WARMUP_POS 1U
-#define ACMP_RIF_WARMUP_MSK BIT(ACMP_RIF_WARMUP_POS)
-
-#define ACMP_RIF_EDGE_POS 0U
-#define ACMP_RIF_EDGE_MSK BIT(ACMP_RIF_EDGE_POS)
-
-/****************** Bit definition for ACMP_IFM register ************************/
-
-#define ACMP_IFM_WARMUP_POS 1U
-#define ACMP_IFM_WARMUP_MSK BIT(ACMP_IFM_WARMUP_POS)
-
-#define ACMP_IFM_EDGE_POS 0U
-#define ACMP_IFM_EDGE_MSK BIT(ACMP_IFM_EDGE_POS)
-
-/****************** Bit definition for ACMP_IFC register ************************/
-
-#define ACMP_IFC_WARMUP_POS 1U
-#define ACMP_IFC_WARMUP_MSK BIT(ACMP_IFC_WARMUP_POS)
-
-#define ACMP_IFC_EDGE_POS 0U
-#define ACMP_IFC_EDGE_MSK BIT(ACMP_IFC_EDGE_POS)
-
-/****************** Bit definition for ACMP_PORT register ************************/
-
-#define ACMP_PORT_PEN_POS 0U
-#define ACMP_PORT_PEN_MSK BIT(ACMP_PORT_PEN_POS)
-
-typedef struct
-{
- __IO uint32_t CON;
- __IO uint32_t INPUTSEL;
- __I uint32_t STAT;
- __O uint32_t IES;
- __I uint32_t IEV;
- __O uint32_t IEC;
- __I uint32_t RIF;
- __O uint32_t IFM;
- __O uint32_t IFC;
- __IO uint32_t PORT;
-} ACMP_TypeDef;
-
-/****************** Bit definition for CALC_SQRTSR register ************************/
-
-#define CALC_SQRTSR_BUSY_POS 0U
-#define CALC_SQRTSR_BUSY_MSK BIT(CALC_SQRTSR_BUSY_POS)
-
-/****************** Bit definition for CALC_RDCND register ************************/
-
-#define CALC_RDCND_RADICAND_POSS 0U
-#define CALC_RDCND_RADICAND_POSE 31U
-#define CALC_RDCND_RADICAND_MSK BITS(CALC_RDCND_RADICAND_POSS,CALC_RDCND_RADICAND_POSE)
-
-/****************** Bit definition for CALC_SQRTRES register ************************/
-
-#define CALC_SQRTRES_RESULT_POSS 0U
-#define CALC_SQRTRES_RESULT_POSE 15U
-#define CALC_SQRTRES_RESULT_MSK BITS(CALC_SQRTRES_RESULT_POSS,CALC_SQRTRES_RESULT_POSE)
-
-/****************** Bit definition for CALC_DIVDR register ************************/
-
-#define CALC_DIVDR_DIVD_POSS 0U
-#define CALC_DIVDR_DIVD_POSE 31U
-#define CALC_DIVDR_DIVD_MSK BITS(CALC_DIVDR_DIVD_POSS,CALC_DIVDR_DIVD_POSE)
-
-/****************** Bit definition for CALC_DIVSR register ************************/
-
-#define CALC_DIVSR_DIVS_POSS 0U
-#define CALC_DIVSR_DIVS_POSE 31U
-#define CALC_DIVSR_DIVS_MSK BITS(CALC_DIVSR_DIVS_POSS,CALC_DIVSR_DIVS_POSE)
-
-/****************** Bit definition for CALC_DIVQR register ************************/
-
-#define CALC_DIVQR_DIVQ_POSS 0U
-#define CALC_DIVQR_DIVQ_POSE 31U
-#define CALC_DIVQR_DIVQ_MSK BITS(CALC_DIVQR_DIVQ_POSS,CALC_DIVQR_DIVQ_POSE)
-
-/****************** Bit definition for CALC_DIVRR register ************************/
-
-#define CALC_DIVRR_DIVS_POSS 0U
-#define CALC_DIVRR_DIVS_POSE 31U
-#define CALC_DIVRR_DIVS_MSK BITS(CALC_DIVRR_DIVS_POSS,CALC_DIVRR_DIVS_POSE)
-
-/****************** Bit definition for CALC_DIVCSR register ************************/
-
-#define CALC_DIVCSR_TRM_POS 9U
-#define CALC_DIVCSR_TRM_MSK BIT(CALC_DIVCSR_TRM_POS)
-
-#define CALC_DIVCSR_SIGN_POS 8U
-#define CALC_DIVCSR_SIGN_MSK BIT(CALC_DIVCSR_SIGN_POS)
-
-#define CALC_DIVCSR_DZ_POS 1U
-#define CALC_DIVCSR_DZ_MSK BIT(CALC_DIVCSR_DZ_POS)
-
-#define CALC_DIVCSR_BUSY_POS 0U
-#define CALC_DIVCSR_BUSY_MSK BIT(CALC_DIVCSR_BUSY_POS)
-
-typedef struct
-{
- __I uint32_t SQRTSR;
- __IO uint32_t RDCND;
- __I uint32_t SQRTRES;
- uint32_t RESERVED0[5] ;
- __IO uint32_t DIVDR;
- __IO uint32_t DIVSR;
- __I uint32_t DIVQR;
- __I uint32_t DIVRR;
- __IO uint32_t DIVCSR;
-} CALC_TypeDef;
-
-/****************** Bit definition for TRNG_CR register ************************/
-
-#define TRNG_CR_ADJC_POSS 16U
-#define TRNG_CR_ADJC_POSE 17U
-#define TRNG_CR_ADJC_MSK BITS(TRNG_CR_ADJC_POSS,TRNG_CR_ADJC_POSE)
-
-#define TRNG_CR_SDSEL_POSS 10U
-#define TRNG_CR_SDSEL_POSE 11U
-#define TRNG_CR_SDSEL_MSK BITS(TRNG_CR_SDSEL_POSS,TRNG_CR_SDSEL_POSE)
-
-#define TRNG_CR_DSEL_POSS 8U
-#define TRNG_CR_DSEL_POSE 9U
-#define TRNG_CR_DSEL_MSK BITS(TRNG_CR_DSEL_POSS,TRNG_CR_DSEL_POSE)
-
-#define TRNG_CR_POSTEN_POS 3U
-#define TRNG_CR_POSTEN_MSK BIT(TRNG_CR_POSTEN_POS)
-
-#define TRNG_CR_TRNGSEL_POS 2U
-#define TRNG_CR_TRNGSEL_MSK BIT(TRNG_CR_TRNGSEL_POS)
-
-#define TRNG_CR_ADJM_POS 1U
-#define TRNG_CR_ADJM_MSK BIT(TRNG_CR_ADJM_POS)
-
-#define TRNG_CR_TRNGEN_POS 0U
-#define TRNG_CR_TRNGEN_MSK BIT(TRNG_CR_TRNGEN_POS)
-
-/****************** Bit definition for TRNG_SR register ************************/
-
-#define TRNG_SR_OVER_POS 3U
-#define TRNG_SR_OVER_MSK BIT(TRNG_SR_OVER_POS)
-
-#define TRNG_SR_SERR_POS 2U
-#define TRNG_SR_SERR_MSK BIT(TRNG_SR_SERR_POS)
-
-#define TRNG_SR_DAVLD_POS 1U
-#define TRNG_SR_DAVLD_MSK BIT(TRNG_SR_DAVLD_POS)
-
-#define TRNG_SR_START_POS 0U
-#define TRNG_SR_START_MSK BIT(TRNG_SR_START_POS)
-
-/****************** Bit definition for TRNG_DR register ************************/
-
-#define TRNG_DR_DATA_POSS 0U
-#define TRNG_DR_DATA_POSE 31U
-#define TRNG_DR_DATA_MSK BITS(TRNG_DR_DATA_POSS,TRNG_DR_DATA_POSE)
-
-/****************** Bit definition for TRNG_SEED register ************************/
-
-#define TRNG_SEED_SEED_POSS 0U
-#define TRNG_SEED_SEED_POSE 31U
-#define TRNG_SEED_SEED_MSK BITS(TRNG_SEED_SEED_POSS,TRNG_SEED_SEED_POSE)
-
-/****************** Bit definition for TRNG_CFGR register ************************/
-
-#define TRNG_CFGR_TOPLMT_POSS 16U
-#define TRNG_CFGR_TOPLMT_POSE 24U
-#define TRNG_CFGR_TOPLMT_MSK BITS(TRNG_CFGR_TOPLMT_POSS,TRNG_CFGR_TOPLMT_POSE)
-
-#define TRNG_CFGR_CKDIV_POSS 8U
-#define TRNG_CFGR_CKDIV_POSE 11U
-#define TRNG_CFGR_CKDIV_MSK BITS(TRNG_CFGR_CKDIV_POSS,TRNG_CFGR_CKDIV_POSE)
-
-#define TRNG_CFGR_TSTART_POSS 0U
-#define TRNG_CFGR_TSTART_POSE 2U
-#define TRNG_CFGR_TSTART_MSK BITS(TRNG_CFGR_TSTART_POSS,TRNG_CFGR_TSTART_POSE)
-
-/****************** Bit definition for TRNG_IER register ************************/
-
-#define TRNG_IER_SERR_POS 2U
-#define TRNG_IER_SERR_MSK BIT(TRNG_IER_SERR_POS)
-
-#define TRNG_IER_DAVLD_POS 1U
-#define TRNG_IER_DAVLD_MSK BIT(TRNG_IER_DAVLD_POS)
-
-#define TRNG_IER_START_POS 0U
-#define TRNG_IER_START_MSK BIT(TRNG_IER_START_POS)
-
-/****************** Bit definition for TRNG_IFR register ************************/
-
-#define TRNG_IFR_SERR_POS 2U
-#define TRNG_IFR_SERR_MSK BIT(TRNG_IFR_SERR_POS)
-
-#define TRNG_IFR_DAVLD_POS 1U
-#define TRNG_IFR_DAVLD_MSK BIT(TRNG_IFR_DAVLD_POS)
-
-#define TRNG_IFR_START_POS 0U
-#define TRNG_IFR_START_MSK BIT(TRNG_IFR_START_POS)
-
-/****************** Bit definition for TRNG_IFCR register ************************/
-
-#define TRNG_IFCR_SERRC_POS 2U
-#define TRNG_IFCR_SERRC_MSK BIT(TRNG_IFCR_SERRC_POS)
-
-#define TRNG_IFCR_DAVLDC_POS 1U
-#define TRNG_IFCR_DAVLDC_MSK BIT(TRNG_IFCR_DAVLDC_POS)
-
-#define TRNG_IFCR_STARTC_POS 0U
-#define TRNG_IFCR_STARTC_MSK BIT(TRNG_IFCR_STARTC_POS)
-
-/****************** Bit definition for TRNG_ISR register ************************/
-
-#define TRNG_ISR_SERR_POS 2U
-#define TRNG_ISR_SERR_MSK BIT(TRNG_ISR_SERR_POS)
-
-#define TRNG_ISR_DAVLD_POS 1U
-#define TRNG_ISR_DAVLD_MSK BIT(TRNG_ISR_DAVLD_POS)
-
-#define TRNG_ISR_START_POS 0U
-#define TRNG_ISR_START_MSK BIT(TRNG_ISR_START_POS)
-
-typedef struct
-{
- __IO uint32_t CR;
- __I uint32_t SR;
- __I uint32_t DR;
- __IO uint32_t SEED;
- __IO uint32_t CFGR;
- __IO uint32_t IER;
- __I uint32_t IFR;
- __O uint32_t IFCR;
- __I uint32_t ISR;
-} TRNG_TypeDef;
-
-/****************** Bit definition for TEMP_WPR register ************************/
-
-#define TEMP_WPR_WP_POS 0U
-#define TEMP_WPR_WP_MSK BIT(TEMP_WPR_WP_POS)
-
-/****************** Bit definition for TEMP_CR register ************************/
-
-#define TEMP_CR_TSU_POSS 12U
-#define TEMP_CR_TSU_POSE 14U
-#define TEMP_CR_TSU_MSK BITS(TEMP_CR_TSU_POSS,TEMP_CR_TSU_POSE)
-
-#define TEMP_CR_TOM_POSS 8U
-#define TEMP_CR_TOM_POSE 10U
-#define TEMP_CR_TOM_MSK BITS(TEMP_CR_TOM_POSS,TEMP_CR_TOM_POSE)
-
-#define TEMP_CR_CTN_POS 4U
-#define TEMP_CR_CTN_MSK BIT(TEMP_CR_CTN_POS)
-
-#define TEMP_CR_RST_POS 3U
-#define TEMP_CR_RST_MSK BIT(TEMP_CR_RST_POS)
-
-#define TEMP_CR_ENS_POS 2U
-#define TEMP_CR_ENS_MSK BIT(TEMP_CR_ENS_POS)
-
-#define TEMP_CR_REQEN_POS 1U
-#define TEMP_CR_REQEN_MSK BIT(TEMP_CR_REQEN_POS)
-
-#define TEMP_CR_EN_POS 0U
-#define TEMP_CR_EN_MSK BIT(TEMP_CR_EN_POS)
-
-/****************** Bit definition for TEMP_DR register ************************/
-
-#define TEMP_DR_ERR_POS 31U
-#define TEMP_DR_ERR_MSK BIT(TEMP_DR_ERR_POS)
-
-#define TEMP_DR_DATA_POSS 0U
-#define TEMP_DR_DATA_POSE 15U
-#define TEMP_DR_DATA_MSK BITS(TEMP_DR_DATA_POSS,TEMP_DR_DATA_POSE)
-
-/****************** Bit definition for TEMP_PSR register ************************/
-
-#define TEMP_PSR_PRS_POSS 0U
-#define TEMP_PSR_PRS_POSE 7U
-#define TEMP_PSR_PRS_MSK BITS(TEMP_PSR_PRS_POSS,TEMP_PSR_PRS_POSE)
-
-/****************** Bit definition for TEMP_IE register ************************/
-
-#define TEMP_IE_TEMP_POS 0U
-#define TEMP_IE_TEMP_MSK BIT(TEMP_IE_TEMP_POS)
-
-/****************** Bit definition for TEMP_IF register ************************/
-
-#define TEMP_IF_TEMP_POS 0U
-#define TEMP_IF_TEMP_MSK BIT(TEMP_IF_TEMP_POS)
-
-/****************** Bit definition for TEMP_IFCR register ************************/
-
-#define TEMP_IFCR_TEMP_POS 0U
-#define TEMP_IFCR_TEMP_MSK BIT(TEMP_IFCR_TEMP_POS)
-
-/****************** Bit definition for TEMP_LTGR register ************************/
-
-#define TEMP_LTGR_LTG_POSS 0U
-#define TEMP_LTGR_LTG_POSE 20U
-#define TEMP_LTGR_LTG_MSK BITS(TEMP_LTGR_LTG_POSS,TEMP_LTGR_LTG_POSE)
-
-/****************** Bit definition for TEMP_HTGR register ************************/
-
-#define TEMP_HTGR_HTG_POSS 0U
-#define TEMP_HTGR_HTG_POSE 20U
-#define TEMP_HTGR_HTG_MSK BITS(TEMP_HTGR_HTG_POSS,TEMP_HTGR_HTG_POSE)
-
-/****************** Bit definition for TEMP_TBDR register ************************/
-
-#define TEMP_TBDR_TBD_POSS 0U
-#define TEMP_TBDR_TBD_POSE 15U
-#define TEMP_TBDR_TBD_MSK BITS(TEMP_TBDR_TBD_POSS,TEMP_TBDR_TBD_POSE)
-
-/****************** Bit definition for TEMP_TCALBDR register ************************/
-
-#define TEMP_TCALBDR_TCAL_POSS 0U
-#define TEMP_TCALBDR_TCAL_POSE 16U
-#define TEMP_TCALBDR_TCAL_MSK BITS(TEMP_TCALBDR_TCAL_POSS,TEMP_TCALBDR_TCAL_POSE)
-
-/****************** Bit definition for TEMP_SR register ************************/
-
-#define TEMP_SR_TSOUT_POS 31U
-#define TEMP_SR_TSOUT_MSK BIT(TEMP_SR_TSOUT_POS)
-
-#define TEMP_SR_NVLD_POS 25U
-#define TEMP_SR_NVLD_MSK BIT(TEMP_SR_NVLD_POS)
-
-#define TEMP_SR_TCAL_POSS 0U
-#define TEMP_SR_TCAL_POSE 24U
-#define TEMP_SR_TCAL_MSK BITS(TEMP_SR_TCAL_POSS,TEMP_SR_TCAL_POSE)
-
-typedef struct
-{
- __IO uint32_t WPR;
- __IO uint32_t CR;
- __I uint32_t DR;
- __IO uint32_t PSR;
- __IO uint32_t IE;
- __I uint32_t IF;
- __IO uint32_t IFCR;
- __IO uint32_t LTGR;
- __IO uint32_t HTGR;
- __IO uint32_t TBDR;
- __IO uint32_t TCALBDR;
- __I uint32_t SR;
-} TEMP_TypeDef;
-
-/****************** Bit definition for IWDT_LOAD register ************************/
-
-#define IWDT_LOAD_LOAD_POSS 0U
-#define IWDT_LOAD_LOAD_POSE 31U
-#define IWDT_LOAD_LOAD_MSK BITS(IWDT_LOAD_LOAD_POSS,IWDT_LOAD_LOAD_POSE)
-
-/****************** Bit definition for IWDT_VALUE register ************************/
-
-#define IWDT_VALUE_VALUE_POSS 0U
-#define IWDT_VALUE_VALUE_POSE 31U
-#define IWDT_VALUE_VALUE_MSK BITS(IWDT_VALUE_VALUE_POSS,IWDT_VALUE_VALUE_POSE)
-
-/****************** Bit definition for IWDT_CON register ************************/
-
-#define IWDT_CON_CLKS_POS 3U
-#define IWDT_CON_CLKS_MSK BIT(IWDT_CON_CLKS_POS)
-
-#define IWDT_CON_RSTEN_POS 2U
-#define IWDT_CON_RSTEN_MSK BIT(IWDT_CON_RSTEN_POS)
-
-#define IWDT_CON_IE_POS 1U
-#define IWDT_CON_IE_MSK BIT(IWDT_CON_IE_POS)
-
-#define IWDT_CON_EN_POS 0U
-#define IWDT_CON_EN_MSK BIT(IWDT_CON_EN_POS)
-
-/****************** Bit definition for IWDT_INTCLR register ************************/
-
-#define IWDT_INTCLR_INTCLR_POSS 0U
-#define IWDT_INTCLR_INTCLR_POSE 31U
-#define IWDT_INTCLR_INTCLR_MSK BITS(IWDT_INTCLR_INTCLR_POSS,IWDT_INTCLR_INTCLR_POSE)
-
-/****************** Bit definition for IWDT_RIS register ************************/
-
-#define IWDT_RIS_WDTIF_POS 0U
-#define IWDT_RIS_WDTIF_MSK BIT(IWDT_RIS_WDTIF_POS)
-
-/****************** Bit definition for IWDT_LOCK register ************************/
-
-#define IWDT_LOCK_LOCK_POS 0U
-#define IWDT_LOCK_LOCK_MSK BIT(IWDT_LOCK_LOCK_POS)
-
-typedef struct
-{
- __O uint32_t LOAD;
- __I uint32_t VALUE;
- __IO uint32_t CON;
- __O uint32_t INTCLR;
- __I uint32_t RIS;
- uint32_t RESERVED0[59] ;
- __IO uint32_t LOCK;
-} IWDT_TypeDef;
-
-/****************** Bit definition for WWDT_LOAD register ************************/
-
-#define WWDT_LOAD_LOAD_POSS 0U
-#define WWDT_LOAD_LOAD_POSE 31U
-#define WWDT_LOAD_LOAD_MSK BITS(WWDT_LOAD_LOAD_POSS,WWDT_LOAD_LOAD_POSE)
-
-/****************** Bit definition for WWDT_VALUE register ************************/
-
-#define WWDT_VALUE_VALUE_POSS 0U
-#define WWDT_VALUE_VALUE_POSE 31U
-#define WWDT_VALUE_VALUE_MSK BITS(WWDT_VALUE_VALUE_POSS,WWDT_VALUE_VALUE_POSE)
-
-/****************** Bit definition for WWDT_CON register ************************/
-
-#define WWDT_CON_WWDTWIN_POSS 4U
-#define WWDT_CON_WWDTWIN_POSE 5U
-#define WWDT_CON_WWDTWIN_MSK BITS(WWDT_CON_WWDTWIN_POSS,WWDT_CON_WWDTWIN_POSE)
-
-#define WWDT_CON_CLKS_POS 3U
-#define WWDT_CON_CLKS_MSK BIT(WWDT_CON_CLKS_POS)
-
-#define WWDT_CON_RSTEN_POS 2U
-#define WWDT_CON_RSTEN_MSK BIT(WWDT_CON_RSTEN_POS)
-
-#define WWDT_CON_IE_POS 1U
-#define WWDT_CON_IE_MSK BIT(WWDT_CON_IE_POS)
-
-#define WWDT_CON_EN_POS 0U
-#define WWDT_CON_EN_MSK BIT(WWDT_CON_EN_POS)
-
-/****************** Bit definition for WWDT_INTCLR register ************************/
-
-#define WWDT_INTCLR_INTCLR_POSS 0U
-#define WWDT_INTCLR_INTCLR_POSE 31U
-#define WWDT_INTCLR_INTCLR_MSK BITS(WWDT_INTCLR_INTCLR_POSS,WWDT_INTCLR_INTCLR_POSE)
-
-/****************** Bit definition for WWDT_RIS register ************************/
-
-#define WWDT_RIS_WWDTIF_POS 0U
-#define WWDT_RIS_WWDTIF_MSK BIT(WWDT_RIS_WWDTIF_POS)
-
-/****************** Bit definition for WWDT_LOCK register ************************/
-
-#define WWDT_LOCK_LOCK_POS 0U
-#define WWDT_LOCK_LOCK_MSK BIT(WWDT_LOCK_LOCK_POS)
-
-typedef struct
-{
- __O uint32_t LOAD;
- __I uint32_t VALUE;
- __IO uint32_t CON;
- __O uint32_t INTCLR;
- __I uint32_t RIS;
- uint32_t RESERVED0[59];
- __IO uint32_t LOCK;
-} WWDT_TypeDef;
-
-/****************** Bit definition for LP16T_CON0 register ************************/
-
-#define LP16T_CON0_PRELOAD_POS 22U
-#define LP16T_CON0_PRELOAD_MSK BIT(LP16T_CON0_PRELOAD_POS)
-
-#define LP16T_CON0_WAVEPOL_POS 21U
-#define LP16T_CON0_WAVEPOL_MSK BIT(LP16T_CON0_WAVEPOL_POS)
-
-#define LP16T_CON0_WAVE_POSS 19U
-#define LP16T_CON0_WAVE_POSE 20U
-#define LP16T_CON0_WAVE_MSK BITS(LP16T_CON0_WAVE_POSS,LP16T_CON0_WAVE_POSE)
-
-#define LP16T_CON0_TRIGEN_POSS 17U
-#define LP16T_CON0_TRIGEN_POSE 18U
-#define LP16T_CON0_TRIGEN_MSK BITS(LP16T_CON0_TRIGEN_POSS,LP16T_CON0_TRIGEN_POSE)
-
-#define LP16T_CON0_TRIGSEL_POSS 13U
-#define LP16T_CON0_TRIGSEL_POSE 15U
-#define LP16T_CON0_TRIGSEL_MSK BITS(LP16T_CON0_TRIGSEL_POSS,LP16T_CON0_TRIGSEL_POSE)
-
-#define LP16T_CON0_PRESC_POSS 9U
-#define LP16T_CON0_PRESC_POSE 11U
-#define LP16T_CON0_PRESC_MSK BITS(LP16T_CON0_PRESC_POSS,LP16T_CON0_PRESC_POSE)
-
-#define LP16T_CON0_TRGFLT_POSS 6U
-#define LP16T_CON0_TRGFLT_POSE 7U
-#define LP16T_CON0_TRGFLT_MSK BITS(LP16T_CON0_TRGFLT_POSS,LP16T_CON0_TRGFLT_POSE)
-
-#define LP16T_CON0_CKFLT_POSS 3U
-#define LP16T_CON0_CKFLT_POSE 4U
-#define LP16T_CON0_CKFLT_MSK BITS(LP16T_CON0_CKFLT_POSS,LP16T_CON0_CKFLT_POSE)
-
-#define LP16T_CON0_CKPOL_POS 1U
-#define LP16T_CON0_CKPOL_MSK BIT(LP16T_CON0_CKPOL_POS)
-
-#define LP16T_CON0_CKSEL_POS 0U
-#define LP16T_CON0_CKSEL_MSK BIT(LP16T_CON0_CKSEL_POS)
-
-/****************** Bit definition for LP16T_CON1 register ************************/
-
-#define LP16T_CON1_CNTSTRT_POS 2U
-#define LP16T_CON1_CNTSTRT_MSK BIT(LP16T_CON1_CNTSTRT_POS)
-
-#define LP16T_CON1_SNGSTRT_POS 1U
-#define LP16T_CON1_SNGSTRT_MSK BIT(LP16T_CON1_SNGSTRT_POS)
-
-#define LP16T_CON1_ENABLE_POS 0U
-#define LP16T_CON1_ENABLE_MSK BIT(LP16T_CON1_ENABLE_POS)
-
-/****************** Bit definition for LP16T_ARR register ************************/
-
-#define LP16T_ARR_ARR_POSS 0U
-#define LP16T_ARR_ARR_POSE 15U
-#define LP16T_ARR_ARR_MSK BITS(LP16T_ARR_ARR_POSS,LP16T_ARR_ARR_POSE)
-
-/****************** Bit definition for LP16T_CNT register ************************/
-
-#define LP16T_CNT_CNT_POSS 0U
-#define LP16T_CNT_CNT_POSE 15U
-#define LP16T_CNT_CNT_MSK BITS(LP16T_CNT_CNT_POSS,LP16T_CNT_CNT_POSE)
-
-/****************** Bit definition for LP16T_CMP register ************************/
-
-#define LP16T_CMP_CMP_POSS 0U
-#define LP16T_CMP_CMP_POSE 15U
-#define LP16T_CMP_CMP_MSK BITS(LP16T_CMP_CMP_POSS,LP16T_CMP_CMP_POSE)
-
-/****************** Bit definition for LP16T_IER register ************************/
-
-#define LP16T_IER_EXTTRIGIE_POS 2U
-#define LP16T_IER_EXTTRIGIE_MSK BIT(LP16T_IER_EXTTRIGIE_POS)
-
-#define LP16T_IER_ARRMIE_POS 1U
-#define LP16T_IER_ARRMIE_MSK BIT(LP16T_IER_ARRMIE_POS)
-
-#define LP16T_IER_CMPMIE_POS 0U
-#define LP16T_IER_CMPMIE_MSK BIT(LP16T_IER_CMPMIE_POS)
-
-/****************** Bit definition for LP16T_ISR register ************************/
-
-#define LP16T_ISR_EXTTRIG_POS 2U
-#define LP16T_ISR_EXTTRIG_MSK BIT(LP16T_ISR_EXTTRIG_POS)
-
-#define LP16T_ISR_ARRM_POS 1U
-#define LP16T_ISR_ARRM_MSK BIT(LP16T_ISR_ARRM_POS)
-
-#define LP16T_ISR_CMPM_POS 0U
-#define LP16T_ISR_CMPM_MSK BIT(LP16T_ISR_CMPM_POS)
-
-/****************** Bit definition for LP16T_IFC register ************************/
-
-#define LP16T_IFC_EXTTRIG_POS 2U
-#define LP16T_IFC_EXTTRIG_MSK BIT(LP16T_IFC_EXTTRIG_POS)
-
-#define LP16T_IFC_ARRM_POS 1U
-#define LP16T_IFC_ARRM_MSK BIT(LP16T_IFC_ARRM_POS)
-
-#define LP16T_IFC_CMPM_POS 0U
-#define LP16T_IFC_CMPM_MSK BIT(LP16T_IFC_CMPM_POS)
-
-/****************** Bit definition for LP16T_UPDATE register ************************/
-
-#define LP16T_UPDATE_UDIS_POS 0U
-#define LP16T_UPDATE_UDIS_MSK BIT(LP16T_UPDATE_UDIS_POS)
-
-/****************** Bit definition for LP16T_SYNCSTAT register ************************/
-
-#define LP16T_SYNCSTAT_CMPWBSY_POS 3U
-#define LP16T_SYNCSTAT_CMPWBSY_MSK BIT(LP16T_SYNCSTAT_CMPWBSY_POS)
-
-#define LP16T_SYNCSTAT_ARRWBSY_POS 2U
-#define LP16T_SYNCSTAT_ARRWBSY_MSK BIT(LP16T_SYNCSTAT_ARRWBSY_POS)
-
-#define LP16T_SYNCSTAT_CON1WBSY_POS 1U
-#define LP16T_SYNCSTAT_CON1WBSY_MSK BIT(LP16T_SYNCSTAT_CON1WBSY_POS)
-
-typedef struct
-{
- __IO uint32_t CON0;
- __IO uint32_t CON1;
- __IO uint32_t ARR;
- __I uint32_t CNT;
- __IO uint32_t CMP;
- uint32_t RESERVED0 ;
- __IO uint32_t IER;
- __I uint32_t ISR;
- __O uint32_t IFC;
- uint32_t RESERVED1[3] ;
- __IO uint32_t UPDATE;
- __I uint32_t SYNCSTAT;
-} LPTIM_TypeDef;
-
-/****************** Bit definition for DBGC_IDCODE register ************************/
-
-#define DBGC_IDCODE_REV_ID_POSS 16U
-#define DBGC_IDCODE_REV_ID_POSE 31U
-#define DBGC_IDCODE_REV_ID_MSK BITS(DBGC_IDCODE_REV_ID_POSS,DBGC_IDCODE_REV_ID_POSE)
-
-#define DBGC_IDCODE_CORE_ID_POSS 12U
-#define DBGC_IDCODE_CORE_ID_POSE 15U
-#define DBGC_IDCODE_CORE_ID_MSK BITS(DBGC_IDCODE_CORE_ID_POSS,DBGC_IDCODE_CORE_ID_POSE)
-
-#define DBGC_IDCODE_DEV_ID_POSS 0U
-#define DBGC_IDCODE_DEV_ID_POSE 11U
-#define DBGC_IDCODE_DEV_ID_MSK BITS(DBGC_IDCODE_DEV_ID_POSS,DBGC_IDCODE_DEV_ID_POSE)
-
-/****************** Bit definition for DBGC_CR register ************************/
-
-#define DBGC_CR_DBG_STANDBY_POS 3U
-#define DBGC_CR_DBG_STANDBY_MSK BIT(DBGC_CR_DBG_STANDBY_POS)
-
-#define DBGC_CR_DBG_STOP2_POS 2U
-#define DBGC_CR_DBG_STOP2_MSK BIT(DBGC_CR_DBG_STOP2_POS)
-
-#define DBGC_CR_DBG_STOP1_POS 1U
-#define DBGC_CR_DBG_STOP1_MSK BIT(DBGC_CR_DBG_STOP1_POS)
-
-#define DBGC_CR_DBG_SLEEP_POS 0U
-#define DBGC_CR_DBG_SLEEP_MSK BIT(DBGC_CR_DBG_SLEEP_POS)
-
-/****************** Bit definition for DBGC_APB1FZ register ************************/
-
-#define DBGC_APB1FZ_CAN_STOP_POS 12U
-#define DBGC_APB1FZ_CAN_STOP_MSK BIT(DBGC_APB1FZ_CAN_STOP_POS)
-
-#define DBGC_APB1FZ_I2C1_SMBUS_TO_POS 9U
-#define DBGC_APB1FZ_I2C1_SMBUS_TO_MSK BIT(DBGC_APB1FZ_I2C1_SMBUS_TO_POS)
-
-#define DBGC_APB1FZ_I2C0_SMBUS_TO_POS 8U
-#define DBGC_APB1FZ_I2C0_SMBUS_TO_MSK BIT(DBGC_APB1FZ_I2C0_SMBUS_TO_POS)
-
-#define DBGC_APB1FZ_TIM7_STOP_POS 7U
-#define DBGC_APB1FZ_TIM7_STOP_MSK BIT(DBGC_APB1FZ_TIM7_STOP_POS)
-
-#define DBGC_APB1FZ_TIM6_STOP_POS 6U
-#define DBGC_APB1FZ_TIM6_STOP_MSK BIT(DBGC_APB1FZ_TIM6_STOP_POS)
-
-#define DBGC_APB1FZ_TIM5_STOP_POS 5U
-#define DBGC_APB1FZ_TIM5_STOP_MSK BIT(DBGC_APB1FZ_TIM5_STOP_POS)
-
-#define DBGC_APB1FZ_TIM4_STOP_POS 4U
-#define DBGC_APB1FZ_TIM4_STOP_MSK BIT(DBGC_APB1FZ_TIM4_STOP_POS)
-
-#define DBGC_APB1FZ_TIM3_STOP_POS 3U
-#define DBGC_APB1FZ_TIM3_STOP_MSK BIT(DBGC_APB1FZ_TIM3_STOP_POS)
-
-#define DBGC_APB1FZ_TIM2_STOP_POS 2U
-#define DBGC_APB1FZ_TIM2_STOP_MSK BIT(DBGC_APB1FZ_TIM2_STOP_POS)
-
-#define DBGC_APB1FZ_TIM1_STOP_POS 1U
-#define DBGC_APB1FZ_TIM1_STOP_MSK BIT(DBGC_APB1FZ_TIM1_STOP_POS)
-
-#define DBGC_APB1FZ_TIM0_STOP_POS 0U
-#define DBGC_APB1FZ_TIM0_STOP_MSK BIT(DBGC_APB1FZ_TIM0_STOP_POS)
-
-/****************** Bit definition for DBGC_APB2FZ register ************************/
-
-#define DBGC_APB2FZ_RTC_STOP_POS 10U
-#define DBGC_APB2FZ_RTC_STOP_MSK BIT(DBGC_APB2FZ_RTC_STOP_POS)
-
-#define DBGC_APB2FZ_WWDT_STOP_POS 9U
-#define DBGC_APB2FZ_WWDT_STOP_MSK BIT(DBGC_APB2FZ_WWDT_STOP_POS)
-
-#define DBGC_APB2FZ_IWDT_STOP_POS 8U
-#define DBGC_APB2FZ_IWDT_STOP_MSK BIT(DBGC_APB2FZ_IWDT_STOP_POS)
-
-#define DBGC_APB2FZ_LPTIM0_STOP_POS 0U
-#define DBGC_APB2FZ_LPTIM0_STOP_MSK BIT(DBGC_APB2FZ_LPTIM0_STOP_POS)
-
-typedef struct
-{
- __I uint32_t IDCODE;
- __IO uint32_t CR;
- __IO uint32_t APB1FZ;
- __IO uint32_t APB2FZ;
-} DBGC_TypeDef;
-
-
-/* Base addresses */
-#define SRAM_BASE (0x20000000UL)
-#define APB1_BASE (0x40000000UL)
-#define APB2_BASE (0x40040000UL)
-#define AHB_BASE (0x40080000UL)
-
-/* Timer memory map */
-#define TIMER0_BASE (APB1_BASE + 0x0000)
-#define TIMER1_BASE (APB1_BASE + 0x0400)
-#define TIMER2_BASE (APB1_BASE + 0x0800)
-#define TIMER3_BASE (APB1_BASE + 0x0C00)
-#define TIMER4_BASE (APB1_BASE + 0x1000)
-#define TIMER5_BASE (APB1_BASE + 0x1400)
-#define TIMER6_BASE (APB1_BASE + 0x1800)
-#define TIMER7_BASE (APB1_BASE + 0x1C00)
-
-/* SPI memory map */
-#define SPI0_BASE (APB1_BASE + 0x6000)
-#define SPI1_BASE (APB1_BASE + 0x6400)
-#define SPI2_BASE (APB1_BASE + 0x6800)
-
-/* I2C memory map */
-#define I2C0_BASE (APB1_BASE + 0x8000)
-#define I2C1_BASE (APB1_BASE + 0x8400)
-
-/* AHB peripherals */
-#define SYSTEM_BASE (AHB_BASE + 0x0000)
-#define GPIOA_BASE (AHB_BASE + 0x4000)
-#define GPIOB_BASE (AHB_BASE + 0x4040)
-#define GPIOC_BASE (AHB_BASE + 0x4080)
-#define GPIOD_BASE (AHB_BASE + 0x40C0)
-#define GPIOE_BASE (AHB_BASE + 0x4100)
-#define GPIOF_BASE (AHB_BASE + 0x4140)
-#define GPIOG_BASE (AHB_BASE + 0x4180)
-#define GPIOH_BASE (AHB_BASE + 0x41C0)
-#define EXTI_BASE (AHB_BASE + 0x4300)
-#define CRC_BASE (AHB_BASE + 0x5000)
-#define CALC_BASE (AHB_BASE + 0x5400)
-#define TRNG_BASE (AHB_BASE + 0x5C00)
-#define CRYPT_BASE (AHB_BASE + 0x5800)
-
-#define SYSCFG_BASE (SYSTEM_BASE + 0x0000)
-#define CMU_BASE (SYSTEM_BASE + 0x0400)
-#define RMU_BASE (SYSTEM_BASE + 0x0800)
-#define PMU_BASE (SYSTEM_BASE + 0x0C00)
-#define MSC_BASE (SYSTEM_BASE + 0x1000)
-#define PIS_BASE (SYSTEM_BASE + 0x6000)
-
-/* APB1 peripherals */
-#define CAN0_BASE (APB1_BASE + 0xB000)
-#define USART0_BASE (APB1_BASE + 0x5000)
-#define USART1_BASE (APB1_BASE + 0x5400)
-#define UART0_BASE (APB1_BASE + 0x4000)
-#define UART1_BASE (APB1_BASE + 0x4400)
-#define UART2_BASE (APB1_BASE + 0x4800)
-#define UART3_BASE (APB1_BASE + 0x4C00)
-#define DMA0_BASE (APB1_BASE + 0xC000)
-
-/* APB2 peripherals */
-#define LPTIM0_BASE (APB2_BASE + 0x0000)
-#define LPUART0_BASE (APB2_BASE + 0x1000)
-#define DBGC_BASE (APB2_BASE + 0xA000)
-#define WWDT_BASE (APB2_BASE + 0x6000)
-#define IWDT_BASE (APB2_BASE + 0x6400)
-#define RTC_BASE (APB2_BASE + 0x8400)
-#define LCD_BASE (APB2_BASE + 0x7000)
-#define ADC0_BASE (APB2_BASE + 0x2000)
-#define ADC1_BASE (APB2_BASE + 0x2400)
-#define ACMP0_BASE (APB2_BASE + 0x3000)
-#define ACMP1_BASE (APB2_BASE + 0x3400)
-#define OPAMP_BASE (APB2_BASE + 0x4000)
-#define DAC0_BASE (APB2_BASE + 0x5000)
-#define BKPC_BASE (APB2_BASE + 0x8000)
-#define TEMP_BASE (APB2_BASE + 0x8800)
-
-/* RTC Peripheral declaration */
-#define RTC ((RTC_TypeDef *)RTC_BASE)
-
-/* GPIO Peripheral_declaration */
-#define GPIOA ((GPIO_TypeDef *)GPIOA_BASE)
-#define GPIOB ((GPIO_TypeDef *)GPIOB_BASE)
-#define GPIOC ((GPIO_TypeDef *)GPIOC_BASE)
-#define GPIOD ((GPIO_TypeDef *)GPIOD_BASE)
-#define GPIOE ((GPIO_TypeDef *)GPIOE_BASE)
-#define GPIOF ((GPIO_TypeDef *)GPIOF_BASE)
-#define GPIOG ((GPIO_TypeDef *)GPIOG_BASE)
-#define GPIOH ((GPIO_TypeDef *)GPIOH_BASE)
-#define EXTI ((EXTI_TypeDef *)EXTI_BASE)
-
-#define CRC ((CRC_TypeDef *)CRC_BASE)
-#define TRNG ((TRNG_TypeDef *)TRNG_BASE)
-#define CALC ((CALC_TypeDef *)CALC_BASE)
-#define CRYPT ((CRYPT_TypeDef *)CRYPT_BASE)
-#define PIS ((PIS_TypeDef *)PIS_BASE)
-
-/* LCD Peripheral declaration */
-#define LCD ((LCD_TypeDef *)LCD_BASE)
-/* ADC Peripheral declaration */
-#define ADC0 ((ADC_TypeDef *)ADC0_BASE)
-#define ADC1 ((ADC_TypeDef *)ADC1_BASE)
-/* ACMP Peripheral declaration */
-#define ACMP0 ((ACMP_TypeDef *)ACMP0_BASE)
-#define ACMP1 ((ACMP_TypeDef *)ACMP1_BASE)
-/* OPAMP Peripheral declaration */
-#define OPAMP ((OPAMP_TypeDef *)OPAMP_BASE)
-/* DAC Peripheral declaration */
-#define DAC0 ((DAC_TypeDef *)DAC0_BASE)
-/* TEMP Peripheral declaration */
-#define TEMP ((TEMP_TypeDef *)TEMP_BASE)
-/* BKPC Peripheral declaration */
-#define BKPC ((BKPC_TypeDef *)BKPC_BASE)
-
-/* Timer Peripheral_declaration */
-#define TIMER0 ((TIMER_TypeDef *)TIMER0_BASE)
-#define TIMER1 ((TIMER_TypeDef *)TIMER1_BASE)
-#define TIMER2 ((TIMER_TypeDef *)TIMER2_BASE)
-#define TIMER3 ((TIMER_TypeDef *)TIMER3_BASE)
-#define TIMER4 ((TIMER_TypeDef *)TIMER4_BASE)
-#define TIMER5 ((TIMER_TypeDef *)TIMER5_BASE)
-#define TIMER6 ((TIMER_TypeDef *)TIMER6_BASE)
-#define TIMER7 ((TIMER_TypeDef *)TIMER7_BASE)
-
-#define AD16C4T0 TIMER0
-#define GP16C4T0 TIMER6
-#define GP16C2T0 TIMER2
-#define GP16C2T1 TIMER3
-#define BS16T0 TIMER1
-#define BS16T1 TIMER4
-#define BS16T2 TIMER5
-#define BS16T3 TIMER7
-
-/* SPI Peripheral_declaration */
-#define SPI0 ((SPI_TypeDef *)SPI0_BASE)
-#define SPI1 ((SPI_TypeDef *)SPI1_BASE)
-#define SPI2 ((SPI_TypeDef *)SPI2_BASE)
-
-/* I2C Peripheral_declaration */
-#define I2C0 ((I2C_TypeDef *)I2C0_BASE)
-#define I2C1 ((I2C_TypeDef *)I2C1_BASE)
-
-/* CAN Peripheral_declaration */
-#define CAN0 ((CAN_TypeDef *)CAN0_BASE)
-
-/* DMA Peripheral_declaration */
-#define DMA0 ((DMA_TypeDef *)DMA0_BASE)
-
-/* UART Peripheral_declaration */
-#define USART0 ((USART_TypeDef *)USART0_BASE)
-#define USART1 ((USART_TypeDef *)USART1_BASE)
-#define UART0 ((UART_TypeDef *)UART0_BASE)
-#define UART1 ((UART_TypeDef *)UART1_BASE)
-#define UART2 ((UART_TypeDef *)UART2_BASE)
-#define UART3 ((UART_TypeDef *)UART3_BASE)
-#define LPTIM0 ((LPTIM_TypeDef *)LPTIM0_BASE)
-#define LPUART0 ((LPUART_TypeDef *)LPUART0_BASE)
-#define DBGC ((DBGC_TypeDef *)DBGC_BASE)
-#define WWDT ((WWDT_TypeDef *)WWDT_BASE)
-#define IWDT ((IWDT_TypeDef *)IWDT_BASE)
-
-#define SYSCFG ((SYSCFG_TypeDef *)SYSCFG_BASE)
-#define CMU ((CMU_TypeDef *)CMU_BASE)
-#define RMU ((RMU_TypeDef *)RMU_BASE)
-#define PMU ((PMU_TypeDef *)PMU_BASE)
-#define MSC ((MSC_TypeDef *)MSC_BASE)
-
-#endif
diff --git a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_acmp.h b/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_acmp.h
deleted file mode 100644
index 8c39f28af2e318c32c2f04789b94e86565fc83eb..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_acmp.h
+++ /dev/null
@@ -1,374 +0,0 @@
-/**
- *********************************************************************************
- *
- * @file ald_acmp.h
- * @brief Header file of ACMP module driver.
- *
- * @version V1.0
- * @date 13 Dec 2017
- * @author AE Team
- * @note
- *
- * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
- *
- *********************************************************************************
- */
-
-#ifndef __ALD_ACMP_H__
-#define __ALD_ACMP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "utils.h"
-
-/** @addtogroup ES32FXXX_ALD
- * @{
- */
-
-/** @addtogroup ACMP
- * @{
- */
-
-/** @defgroup ACMP_Public_Types ACMP Public Types
- * @{
- */
-
-/**
- * @brief Acmp interrupt
- */
-typedef enum
-{
- ACMP_IT_EDGE = (1U << 0), /**< Edge interrupt bit */
- ACMP_IT_WARMUP = (1U << 1), /**< Warm up interrupt bit */
-} acmp_it_t;
-
-/**
- * @brief Acmp interrupt
- */
-typedef enum
-{
- ACMP_FLAG_EDGE = (1U << 0), /**< Edge interrupt flag */
- ACMP_FLAG_WARMUP = (1U << 1), /**< Warm up interrupt flag */
-} acmp_flag_t;
-
-/**
- * @brief Acmp interrupt flag
- */
-typedef enum
-{
- ACMP_STATUS_EDGE = (1U << 0), /**< Edge interrupt flag */
- ACMP_STATUS_WARMUP = (1U << 1), /**< Warm up interrupt flag */
-} acmp_status_t;
-
-/**
- * @brief Acmp positive input
- */
-typedef enum
-{
- ACMP_POS_CH0 = 0, /**< Channel 0 as positive input */
- ACMP_POS_CH1 = 1, /**< Channel 1 as positive input */
- ACMP_POS_CH2 = 2, /**< Channel 2 as positive input */
- ACMP_POS_CH3 = 3, /**< Channel 3 as positive input */
- ACMP_POS_CH4 = 4, /**< Channel 4 as positive input */
- ACMP_POS_CH5 = 5, /**< Channel 5 as positive input */
- ACMP_POS_CH6 = 6, /**< Channel 6 as positive input */
- ACMP_POS_CH7 = 7, /**< Channel 7 as positive input */
-} acmp_pos_input_t;
-
-/**
- * @brief Acmp negative input
- */
-typedef enum
-{
- ACMP_NEG_CH0 = 0, /**< Channel 0 as negative input */
- ACMP_NEG_CH1 = 1, /**< Channel 1 as negative input */
- ACMP_NEG_CH2 = 2, /**< Channel 2 as negative input */
- ACMP_NEG_CH3 = 3, /**< Channel 3 as negative input */
- ACMP_NEG_CH4 = 4, /**< Channel 4 as negative input */
- ACMP_NEG_CH5 = 5, /**< Channel 5 as negative input */
- ACMP_NEG_CH6 = 6, /**< Channel 6 as negative input */
- ACMP_NEG_CH7 = 7, /**< Channel 7 as negative input */
- ACMP_NEG_1V25 = 8, /**< 1.25v as negative input */
- ACMP_NEG_2V5 = 9, /**< 2.5v as negative input */
- ACMP_NEG_VDD = 10, /**< VDD as negative input */
- ACMP_NEG_CAP = 11, /**< Capacitive as negative input */
- ACMP_NEG_DAC0_CH0 = 12, /**< DAC0 channel 0 as negative input */
- ACMP_NEG_DAC0_CH1 = 13, /**< DAC0 channel 1 as negative input */
-} acmp_neg_input_t;
-
-/**
- * @brief Acmp mode
- */
-typedef enum
-{
- ACMP_ULTRA_LOW_POWER = 0, /**< Ultra low power mode */
- ACMP_LOW_POWER = 1, /**< Low power mode */
- ACMP_MIDDLE_POWER = 2, /**< Middle power mode */
- ACMP_HIGH_POWER = 3, /**< High power mode */
-} acmp_mode_t;
-
-/**
- * @brief Acmp warm-up time
- */
-typedef enum
-{
- ACMP_4_PCLK = 0, /**< 4 hfperclk cycles */
- ACMP_8_PCLK = 1, /**< 4 hfperclk cycles */
- ACMP_16_PCLK = 2, /**< 4 hfperclk cycles */
- ACMP_32_PCLK = 3, /**< 4 hfperclk cycles */
- ACMP_64_PCLK = 4, /**< 4 hfperclk cycles */
- ACMP_128_PCLK = 5, /**< 4 hfperclk cycles */
- ACMP_256_PCLK = 6, /**< 4 hfperclk cycles */
- ACMP_512_PCLK = 7, /**< 4 hfperclk cycles */
-} acmp_warm_time_t;
-
-/**
- * @brief Acmp hysteresis level
- */
-typedef enum
-{
- ACMP_HYST_0 = 0, /**< No hysteresis */
- ACMP_HYST_15 = 1, /**< 15mV hysteresis */
- ACMP_HYST_22 = 2, /**< 22mV hysteresis */
- ACMP_HYST_29 = 3, /**< 29mV hysteresis */
- ACMP_HYST_36 = 4, /**< 36mV hysteresis */
- ACMP_HYST_43 = 5, /**< 43mV hysteresis */
- ACMP_HYST_50 = 6, /**< 50mV hysteresis */
- ACMP_HYST_57 = 7, /**< 57mV hysteresis */
-} acmp_hystsel_t;
-
-/**
- * @brief Acmp inactive state
- */
-typedef enum
-{
- ACMP_INACTVAL_LOW = 0, /**< The inactive value is 0 */
- ACMP_INACTVAL_HIGH = 1, /**< The inactive value is 1 */
-} acmp_inactval_t;
-
-/**
- * @brief which edges set up interrupt
- */
-typedef enum
-{
- ACMP_EDGE_NONE = 0, /**< Disable EDGE interrupt */
- ACMP_EDGE_FALL = 1, /**< Falling edges set EDGE interrupt */
- ACMP_EDGE_RISE = 2, /**< rise edges set EDGE interrupt */
- ACMP_EDGE_ALL = 3, /**< Falling edges and rise edges set EDGE interrupt */
-} acmp_edge_t;
-
-/**
- * @brief Acmp output function
- */
-typedef enum
-{
- ACMP_OUT_DISABLE = 0, /**< Disable acmp output */
- ACMP_OUT_ENABLE = 1, /**< Enable acmp output */
-} acmp_out_func_t;
-
-/**
- * @brief Acmp warm-up interrupt function
- */
-typedef enum
-{
- ACMP_WARM_DISABLE = 0, /**< Disable acmp warm-up interrupt */
- ACMP_WARM_ENABLE = 1, /**< Enable acmp warm-up interrupt */
-} acmp_warm_it_func;
-
-/**
- * @brief Acmp gpio output invert
- */
-typedef enum
-{
- ACMP_GPIO_NO_INV = 0, /**< Acmp output to gpio is not inverted */
- ACMP_GPIO_INV = 1, /**< Acmp output to gpio is inverted */
-} acmp_invert_t;
-
-/**
- * @brief The location of the acmp i/o pin
- */
-typedef enum
-{
- ACMP_LOCATION_O = 0, /**< Location 0 */
- ACMP_LOCATION_1 = 1, /**< Location 1 */
- ACMP_LOCATION_2 = 2, /**< Location 2 */
-} acmp_location_t;
-
-/**
- * @brief Acmp output config structure definition
- */
-typedef struct
-{
- acmp_out_func_t out_func; /**< Acmp output function */
- acmp_invert_t gpio_inv; /**< If invert gpio output */
- acmp_location_t location; /**< The location of acmp I/0 pin */
-} acmp_output_config_t;
-
-/**
- * @brief Acmp init structure definition
- */
-typedef struct
-{
- acmp_mode_t mode; /**< Acmp operation mode */
- acmp_warm_time_t warm_time; /**< Acmp warm up time */
- acmp_hystsel_t hystsel; /**< Acmp hysteresis level */
- acmp_warm_it_func warm_func; /**< Acmp warm-up interrupt enable/disable */
- acmp_pos_input_t pos_port; /**< Acmp positive port select */
- acmp_neg_input_t neg_port; /**< Acmp negative port select */
- acmp_inactval_t inactval; /**< Acmp inavtive output value */
- acmp_edge_t edge; /** Select edges to set interrupt flag */
- uint8_t vdd_level; /** Select scaling factor for CDD reference level, MAX is 63 */
-} acmp_init_t;
-
-/**
- * @brief ACMP Handle Structure definition
- */
-typedef struct acmp_handle_s
-{
- ACMP_TypeDef *perh; /**< Register base address */
- acmp_init_t init; /**< ACMP required parameters */
- lock_state_t lock; /**< Locking object */
-
- void (*acmp_warmup_cplt_cbk)(struct acmp_handle_s *arg); /**< Acmp warm-up complete callback */
- void (*acmp_edge_cplt_cbk)(struct acmp_handle_s *arg); /**< Acmp edge trigger callback */
-} acmp_handle_t;
-/**
- * @}
- */
-
-/** @defgroup ACMP_Public_Macros ACMP Public Macros
- * @{
- */
-#define ACMP_ENABLE(handle) (SET_BIT((handle)->perh->CON, ACMP_CON_EN_MSK))
-#define ACMP_DISABLE(handle) (CLEAR_BIT((handle)->perh->CON, ACMP_CON_EN_MSK))
-/**
- * @}
- */
-
-/** @defgroup ACMP_Private_Macros ACMP Private Macros
- * @{
- */
-#define IS_ACMP_TYPE(x) (((x) == ACMP0) || \
- ((x) == ACMP1))
-#define IS_ACMP_MODE_TYPE(x) (((x) == ACMP_ULTRA_LOW_POWER) || \
- ((x) == ACMP_LOW_POWER) || \
- ((x) == ACMP_MIDDLE_POWER) || \
- ((x) == ACMP_HIGH_POWER))
-#define IS_ACMP_IT_TYPE(x) (((x) == ACMP_IT_EDGE) || \
- ((x) == ACMP_IT_WARMUP))
-#define IS_ACMP_FLAG_TYPE(x) (((x) == ACMP_FLAG_EDGE) || \
- ((x) == ACMP_FLAG_WARMUP))
-#define IS_ACMP_STATUS_TYPE(x) (((x) == ACMP_STATUS_EDGE) || \
- ((x) == ACMP_STATUS_WARMUP))
-#define IS_ACMP_POS_INPUT_TYPE(x) (((x) == ACMP_POS_CH0) || \
- ((x) == ACMP_POS_CH1) || \
- ((x) == ACMP_POS_CH2) || \
- ((x) == ACMP_POS_CH3) || \
- ((x) == ACMP_POS_CH4) || \
- ((x) == ACMP_POS_CH5) || \
- ((x) == ACMP_POS_CH6) || \
- ((x) == ACMP_POS_CH7))
-#define IS_ACMP_NEG_INPUT_TYPE(x) (((x) == ACMP_NEG_CH0) || \
- ((x) == ACMP_NEG_CH1) || \
- ((x) == ACMP_NEG_CH2) || \
- ((x) == ACMP_NEG_CH3) || \
- ((x) == ACMP_NEG_CH4) || \
- ((x) == ACMP_NEG_CH5) || \
- ((x) == ACMP_NEG_CH6) || \
- ((x) == ACMP_NEG_CH7) || \
- ((x) == ACMP_NEG_1V25) || \
- ((x) == ACMP_NEG_2V5) || \
- ((x) == ACMP_NEG_VDD) || \
- ((x) == ACMP_NEG_CAP) || \
- ((x) == ACMP_NEG_DAC0_CH0) || \
- ((x) == ACMP_NEG_DAC0_CH1))
-#define IS_ACMP_WARM_UP_TIME_TYPE(x) (((x) == ACMP_4_PCLK) || \
- ((x) == ACMP_8_PCLK) || \
- ((x) == ACMP_16_PCLK) || \
- ((x) == ACMP_32_PCLK) || \
- ((x) == ACMP_64_PCLK) || \
- ((x) == ACMP_128_PCLK) || \
- ((x) == ACMP_256_PCLK) || \
- ((x) == ACMP_512_PCLK))
-#define IS_ACMP_HYSTSEL_TYPE(x) (((x) == ACMP_HYST_0) || \
- ((x) == ACMP_HYST_15) || \
- ((x) == ACMP_HYST_22) || \
- ((x) == ACMP_HYST_29) || \
- ((x) == ACMP_HYST_36) || \
- ((x) == ACMP_HYST_43) || \
- ((x) == ACMP_HYST_50) || \
- ((x) == ACMP_HYST_57))
-#define IS_ACMP_INACTVAL_TYPE(x) (((x) == ACMP_INACTVAL_LOW) || \
- ((x) == ACMP_INACTVAL_HIGH))
-#define IS_ACMP_EDGE_TYPE(x) (((x) == ACMP_EDGE_NONE) || \
- ((x) == ACMP_EDGE_FALL) || \
- ((x) == ACMP_EDGE_RISE) || \
- ((x) == ACMP_EDGE_ALL))
-#define IS_ACMP_OUT_FUNC_TYPE(x) (((x) == ACMP_OUT_DISABLE) || \
- ((x) == ACMP_OUT_ENABLE))
-#define IS_ACMP_INVERT_TYPE(x) (((x) == ACMP_GPIO_NO_INV) || \
- ((x) == ACMP_GPIO_INV))
-#define IS_ACMP_LOCATION_TYPE(x) (((x) == ACMP_LOCATION_O) || \
- ((x) == ACMP_LOCATION_1) || \
- ((x) == ACMP_LOCATION_2))
-#define IS_ACMP_WARM_FUNC_TYPE(x) (((x) == ACMP_WARM_DISABLE) || \
- ((x) == ACMP_WARM_ENABLE))
-/**
- * @}
- */
-
-/** @addtogroup ACMP_Public_Functions
- * @{
- */
-
-/** @addtogroup ACMP_Public_Functions_Group1
- * @{
- */
-ald_status_t acmp_init(acmp_handle_t *hperh);
-
-/**
- * @}
- */
-
-/** @addtogroup ACMP_Public_Functions_Group2
- * @{
- */
-ald_status_t acmp_interrupt_config(acmp_handle_t *hperh, acmp_it_t it, type_func_t state);
-ald_status_t acmp_set_interrupt_mask(acmp_handle_t *hperh, acmp_it_t it);
-it_status_t acmp_get_flag_status(acmp_handle_t *hperh, acmp_flag_t it);
-ald_status_t acmp_clear_flag_status(acmp_handle_t *hperh, acmp_flag_t it);
-flag_status_t acmp_get_status(acmp_handle_t *hperh, acmp_status_t flag);
-
-/**
- * @}
- */
-
-/** @addtogroup ACMP_Public_Functions_Group3
- * @{
- */
-void acmp_irq_handle(acmp_handle_t *hperh);
-ald_status_t acmp_out_config(acmp_handle_t *hperh, acmp_output_config_t *config);
-uint8_t acmp_out_result(acmp_handle_t *hperh);
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#ifdef __cplusplus
-extern "C"
-}
-#endif
-
-#endif
diff --git a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_adc.h b/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_adc.h
deleted file mode 100644
index b4f4f029d13e737bc324e90837a3d1b42d197697..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_adc.h
+++ /dev/null
@@ -1,585 +0,0 @@
-/**
- ******************************************************************************
- * @file ald_adc.h
- * @brief Header file of ADC Module library.
- *
- * @version V1.0
- * @date 15 Dec 2017
- * @author AE Team
- * @note
- *
- * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
- *
- ******************************************************************************
- */
-
-#ifndef __ALD_ADC_H__
-#define __ALD_ADC_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "utils.h"
-#include "ald_dma.h"
-#include "ald_pis.h"
-#include "ald_timer.h"
-
-/** @addtogroup ES32FXXX_ALD
- * @{
- */
-
-/** @addtogroup ADC
- * @{
- */
-
-/** @defgroup ADC_Pubulic_Types ADC Pubulic Types
- * @{
- */
-
-/**
- * @brief ADC State structures definition
- */
-typedef enum
-{
- ADC_STATE_RESET = 0x0, /**< ADC not yet initialized or disabled */
- ADC_STATE_READY = 0x1, /**< ADC peripheral ready for use */
- ADC_STATE_BUSY_INTERNAL = 0x2, /**< ADC is busy to internal process */
- ADC_STATE_TIMEOUT = 0x4, /**< TimeOut occurrence */
- ADC_STATE_ERROR = 0x10, /**< Internal error occurrence */
- ADC_STATE_NM_BUSY = 0x100, /**< Conversion on group normal is ongoing or can occur */
- ADC_STATE_NM_EOC = 0x200, /**< Conversion data available on group normal */
- ADC_STATE_IST_BUSY = 0x1000, /**< Conversion on group insert is ongoing or can occur */
- ADC_STATE_IST_EOC = 0x2000, /**< Conversion data available on group insert */
- ADC_STATE_AWD = 0x10000, /**< Out-of-window occurrence of analog watchdog */
-} adc_state_t;
-
-/**
- *@brief ADC Error Code
- */
-typedef enum
-{
- ADC_ERROR_NONE = 0x0, /**< No error */
- ADC_ERROR_INTERNAL = 0x1, /**< ADC IP internal error*/
- ADC_ERROR_OVR = 0x2, /**< Overrun error */
- ADC_ERROR_DMA = 0x4, /**< DMA transfer error */
-} adc_error_t;
-
-/**
- *@brief ADC data alignment
- */
-typedef enum
-{
- ADC_DATAALIGN_RIGHT = 0x0, /**< ADC data alignment right */
- ADC_DATAALIGN_LEFT = 0x1, /**< ADC data alignment left */
-} adc_align_t;
-
-/**
- *@brief ADC scan mode
- */
-typedef enum
-{
- ADC_SCAN_DISABLE = 0x0, /**< ADC scan disable */
- ADC_SCAN_ENABLE = 0x1, /**< ADC scan enable */
-} adc_scan_t;
-
-/**
- *@brief ADC config hannal trigger the EOC IT mode
- */
-typedef enum
-{
- ADC_NCHESEL_MODE_ALL = 0x0, /**< ADC set RCHE after convert sequence finish */
- ADC_NCHESEL_MODE_ONE = 0x1, /**< ADC set RCHE after one convert finish */
-} adc_nchesel_t;
-
-/**
- *@brief ADC channels
- */
-typedef enum
-{
- ADC_CHANNEL_0 = 0x0, /**< ADC channel 0 */
- ADC_CHANNEL_1 = 0x1, /**< ADC channel 1 */
- ADC_CHANNEL_2 = 0x2, /**< ADC channel 2 */
- ADC_CHANNEL_3 = 0x3, /**< ADC channel 3 */
- ADC_CHANNEL_4 = 0x4, /**< ADC channel 4 */
- ADC_CHANNEL_5 = 0x5, /**< ADC channel 5 */
- ADC_CHANNEL_6 = 0x6, /**< ADC channel 6 */
- ADC_CHANNEL_7 = 0x7, /**< ADC channel 7 */
- ADC_CHANNEL_8 = 0x8, /**< ADC channel 8 */
- ADC_CHANNEL_9 = 0x9, /**< ADC channel 9 */
- ADC_CHANNEL_10 = 0xA, /**< ADC channel 10 */
- ADC_CHANNEL_11 = 0xB, /**< ADC channel 11 */
- ADC_CHANNEL_12 = 0xC, /**< ADC channel 12 */
- ADC_CHANNEL_13 = 0xD, /**< ADC channel 13 */
- ADC_CHANNEL_14 = 0xE, /**< ADC channel 14 */
- ADC_CHANNEL_15 = 0xF, /**< ADC channel 15 */
- ADC_CHANNEL_16 = 0x10, /**< ADC channel 16 */
- ADC_CHANNEL_17 = 0x11, /**< ADC channel 17 */
- ADC_CHANNEL_18 = 0x12, /**< ADC channel 18 */
- ADC_CHANNEL_19 = 0x13, /**< ADC channel 19 */
-} adc_channel_t;
-
-/**
- *@brief ADC sampling times
- */
-typedef enum
-{
- ADC_SAMPLETIME_1 = 0x0, /**< ADC sampling times 1 clk */
- ADC_SAMPLETIME_2 = 0x1, /**< ADC sampling times 2 clk */
- ADC_SAMPLETIME_4 = 0x2, /**< ADC sampling times 4 clk */
- ADC_SAMPLETIME_15 = 0x3, /**< ADC sampling times 15 clk */
-} adc_samp_t;
-
-/**
- *@brief ADC rank into normal group
- */
-typedef enum
-{
- ADC_NC_RANK_1 = 0x1, /**< ADC normal channel rank 1 */
- ADC_NC_RANK_2 = 0x2, /**< ADC normal channel rank 2 */
- ADC_NC_RANK_3 = 0x3, /**< ADC normal channel rank 3 */
- ADC_NC_RANK_4 = 0x4, /**< ADC normal channel rank 4 */
- ADC_NC_RANK_5 = 0x5, /**< ADC normal channel rank 5 */
- ADC_NC_RANK_6 = 0x6, /**< ADC normal channel rank 6 */
- ADC_NC_RANK_7 = 0x7, /**< ADC normal channel rank 7 */
- ADC_NC_RANK_8 = 0x8, /**< ADC normal channel rank 8 */
- ADC_NC_RANK_9 = 0x9, /**< ADC normal channel rank 9 */
- ADC_NC_RANK_10 = 0xA, /**< ADC normal channel rank 10 */
- ADC_NC_RANK_11 = 0xB, /**< ADC normal channel rank 11 */
- ADC_NC_RANK_12 = 0xC, /**< ADC normal channel rank 12 */
- ADC_NC_RANK_13 = 0xD, /**< ADC normal channel rank 13 */
- ADC_NC_RANK_14 = 0xE, /**< ADC normal channel rank 14 */
- ADC_NC_RANK_15 = 0xF, /**< ADC normal channel rank 15 */
- ADC_NC_RANK_16 = 0x10, /**< ADC normal channel rank 16 */
-} adc_nc_rank_t;
-
-/**
- * @brief ADC rank into insert group
- */
-typedef enum
-{
- ADC_IH_RANK_1 = 0x1, /**< ADC insert channel rank 1 */
- ADC_IH_RANK_2 = 0x2, /**< ADC insert channel rank 2 */
- ADC_IH_RANK_3 = 0x3, /**< ADC insert channel rank 3 */
- ADC_IH_RANK_4 = 0x4, /**< ADC insert channel rank 4 */
-} adc_ih_rank_t;
-
-/**
- * @brief ADC analog watchdog mode
- */
-typedef enum
-{
- ADC_ANAWTD_NONE = 0x0, /**< No watch dog */
- ADC_ANAWTD_SING_NM = 0x800200, /**< One normal channel watch dog */
- ADC_ANAWTD_SING_IST = 0x400200, /**< One inset channel Injec watch dog */
- ADC_ANAWTD_SING_NMIST = 0xC00200, /**< One normal and inset channel watch dog */
- ADC_ANAWTD_ALL_NM = 0x800000, /**< All normal channel watch dog */
- ADC_ANAWTD_ALL_IST = 0x400000, /**< All inset channel watch dog */
- ADC_ANAWTD_ALL_NMIST = 0xC00000, /**< All normal and inset channel watch dog */
-} adc_ana_wtd_t;
-
-/**
- * @brief ADC Event type
- */
-typedef enum
-{
- ADC_AWD_EVENT = (1U << 0), /**< ADC analog watch dog event */
-} adc_event_type_t;
-
-/**
- * @brief ADC interrupts definition
- */
-typedef enum
-{
- ADC_IT_NH = (1U << 5), /**< ADC it normal */
- ADC_IT_AWD = (1U << 6), /**< ADC it awd */
- ADC_IT_IH = (1U << 7), /**< ADC it insert */
- ADC_IT_OVR = (1U << 26), /**< ADC it overring */
-} adc_it_t;
-
-/**
- * @brief ADC flags definition
- */
-typedef enum
-{
- ADC_FLAG_AWD = (1U << 0), /**perh->CON1, ADC_CON1_ADCEN_MSK))
-#define ADC_DISABLE(handle) (CLEAR_BIT((handle)->perh->CON1, ADC_CON1_ADCEN_MSK))
-#define ADC_NH_TRIG_BY_SOFT(handle) (SET_BIT((handle)->perh->CON1, ADC_CON1_NCHTRG_MSK))
-#define ADC_IH_TRIG_BY_SOFT(handle) (SET_BIT((handle)->perh->CON1, ADC_CON1_ICHTRG_MSK))
-#define ADC_RESET_HANDLE_STATE(handle) ((handle)->state = ADC_STATE_RESET)
-#define ADC_VREF_OUT_ENABLE(handle) (SET_BIT((handle)->perh->CCR, ADC_CCR_VREFOEN_MSK))
-#define ADC_VREF_OUT_DISABLE(handle) (CLEAR_BIT((handle)->perh->CCR, ADC_CCR_VREFOEN_MSK))
-/**
- * @}
- */
-
-/** @defgroup ADC_Private_Macros ADC Private Macros
- * @{
- */
-#define IS_ADC_IH_RANK_TYPE(x) ((x) <= ADC_IH_RANK_4)
-#define IS_ADC_NC_RANK_TYPE(x) ((x) <= ADC_NC_RANK_16)
-#define IS_ADC_SAMPLING_TIMES_TYPE(x) (((x) == ADC_SAMPLETIME_1) || \
- ((x) == ADC_SAMPLETIME_2) || \
- ((x) == ADC_SAMPLETIME_4) || \
- ((x) == ADC_SAMPLETIME_15))
-#define IS_ADC_CHANNELS_TYPE(x) ((x) <= ADC_CHANNEL_19)
-#define IS_ADC_SCAN_MODE_TYPE(x) (((x) == ADC_SCAN_DISABLE) || \
- ((x) == ADC_SCAN_ENABLE) )
-#define IS_ADC_DATA_ALIGN_TYPE(x) (((x) == ADC_DATAALIGN_RIGHT) || \
- ((x) == ADC_DATAALIGN_LEFT))
-#define IS_ADC_ANALOG_WTD_MODE_TYPE(x) (((x) == ADC_ANAWTD_NONE) || \
- ((x) == ADC_ANAWTD_SING_NM) || \
- ((x) == ADC_ANAWTD_SING_IST) || \
- ((x) == ADC_ANAWTD_SING_NMIST) || \
- ((x) == ADC_ANAWTD_ALL_NM) || \
- ((x) == ADC_ANAWTD_ALL_IST) || \
- ((x) == ADC_ANAWTD_ALL_NMIST))
-#define IS_ADC_IT_TYPE(x) (((x) == ADC_IT_NH) || \
- ((x) == ADC_IT_AWD) || \
- ((x) == ADC_IT_IH) || \
- ((x) == ADC_IT_OVR ))
-#define IS_ADC_FLAGS_TYPE(x) (((x) == ADC_FLAG_AWD) || \
- ((x) == ADC_FLAG_NH) || \
- ((x) == ADC_FLAG_IH) || \
- ((x) == ADC_FLAG_OVR) || \
- ((x) == ADC_FLAG_NHS) || \
- ((x) == ADC_FLAG_IHS))
-#define IS_ADC_CLK_DIV_TYPE(x) (((x) == ADC_CKDIV_1) || \
- ((x) == ADC_CKDIV_2) || \
- ((x) == ADC_CKDIV_4) || \
- ((x) == ADC_CKDIV_8) || \
- ((x) == ADC_CKDIV_16) || \
- ((x) == ADC_CKDIV_32) || \
- ((x) == ADC_CKDIV_64) || \
- ((x) == ADC_CKDIV_128))
-#define IS_ADC_NEG_REF_VOLTAGE_TYPE(x) (((x) == ADC_NEG_REF_VSS ) || \
- ((x) == ADC_NEG_REF_VREFN ))
-#define IS_POS_REF_VOLTAGE_TYPE(x) (((x) == ADC_POS_REF_VDD) || \
- ((x) == ADC_POS_REF_2V) || \
- ((x) == ADC_POS_REF_VREEFP) || \
- ((x) == ADC_POS_REF_VREEFP_BUF))
-#define IS_ADC_NBR_OF_NM_TYPE(x) ((x) <= ADC_NM_NBR_16)
-#define IS_ADC_NBR_OF_IST_TYPE(x) ((x) <= ADC_IST_NBR_4)
-#define IS_ADC_DISC_NBR_TYPE(x) ((x) <= ADC_DISC_NBR_8)
-#define IS_ADC_CONV_RES_TYPE(x) (((x) == ADC_CONV_RES_12) || \
- ((x) == ADC_CONV_RES_6) || \
- ((x) == ADC_CONV_RES_8) || \
- ((x) == ADC_CONV_RES_10))
-#define IS_ADC_TRIG_MODE_TYPE(x) (((x) == ADC_TRIG_SOFT) || \
- ((x) == ADC_TRIG_PIS) || \
- ((x) == ADC_TRIG_PIS_SOFT))
-#define IS_ADC_TYPE(x) (((x) == ADC0) || \
- ((x) == ADC1))
-#define IS_ADC_NCHESEL_MODE_TYPE(x) (((x) == ADC_NCHESEL_MODE_ALL) || \
- ((x) == ADC_NCHESEL_MODE_ONE))
-#define IS_ADC_EVENT_TYPE(x) ((x) == ADC_AWD_EVENT)
-#define IS_ADC_IST_OFFSET_TYPE(x) ((x) <= 0xfff)
-#define IS_HTR_TYPE(x) ((x) <= 0xfff)
-#define IS_LTR_TYPE(x) ((x) <= 0xfff)
-/**
- * @}
- */
-
-/** @addtogroup ADC_Public_Functions
- * @{
- */
-
-/** @addtogroup ADC_Public_Functions_Group1
- * @{
- */
-ald_status_t adc_init(adc_handle_t *hperh);
-ald_status_t adc_reset(adc_handle_t *hperh);
-/**
- * @}
- */
-
-/** @addtogroup ADC_Public_Functions_Group2
- * @{
- */
-ald_status_t adc_normal_start(adc_handle_t *hperh);
-ald_status_t adc_normal_stop(adc_handle_t *hperh);
-ald_status_t adc_normal_poll_for_conversion(adc_handle_t *hperh, uint32_t timeout);
-ald_status_t adc_poll_for_event(adc_handle_t *hperh, adc_event_type_t event_type, uint32_t timeout);
-ald_status_t adc_normal_start_by_it(adc_handle_t *hperh);
-ald_status_t adc_normal_stop_by_it(adc_handle_t *hperh);
-#ifdef ALD_DMA
-ald_status_t adc_start_by_dma(adc_handle_t *hperh, uint16_t *buf, uint16_t size, uint8_t channel);
-ald_status_t adc_stop_by_dma(adc_handle_t *hperh);
-ald_status_t adc_timer_trigger_adc_by_dma(adc_timer_config_t *config);
-#endif
-uint32_t adc_normal_get_value(adc_handle_t *hperh);
-ald_status_t adc_insert_start(adc_handle_t *hperh);
-ald_status_t adc_insert_stop(adc_handle_t *hperh);
-ald_status_t adc_insert_poll_for_conversion(adc_handle_t *hperh, uint32_t timeout);
-ald_status_t adc_insert_start_by_it(adc_handle_t *hperh);
-ald_status_t adc_insert_stop_by_it(adc_handle_t *hperh);
-uint32_t adc_insert_get_value(adc_handle_t *hperh, adc_ih_rank_t ih_rank);
-void adc_irq_handler(adc_handle_t *hperh);
-/**
- * @}
- */
-
-/** @addtogroup ADC_Public_Functions_Group3
- * @{
- */
-ald_status_t adc_normal_channel_config(adc_handle_t *hperh, adc_channel_conf_t *config);
-ald_status_t adc_insert_channel_config(adc_handle_t *hperh, adc_ih_conf_t *config);
-ald_status_t adc_analog_wdg_config(adc_handle_t *hperh, adc_analog_wdg_conf_t *config);
-void adc_interrupt_config(adc_handle_t *hperh, adc_it_t it, type_func_t state);
-it_status_t adc_get_it_status(adc_handle_t *hperh, adc_it_t it);
-flag_status_t adc_get_flag_status(adc_handle_t *hperh, adc_flag_t flag);
-void adc_clear_flag_status(adc_handle_t *hperh, adc_flag_t flag);
-/**
- * @}
- */
-
-/** @addtogroup ADC_Public_Functions_Group4
- * @{
- */
-uint32_t adc_get_state(adc_handle_t *hperh);
-uint32_t adc_get_error(adc_handle_t *hperh);
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#ifdef __cplusplus
-extern "C"
-}
-#endif
-
-#endif /* __ALD_ADC_H */
diff --git a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_can.h b/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_can.h
deleted file mode 100644
index ebe2e2a479e6c5b0ad29bf96dea38c45cd3e6b27..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_can.h
+++ /dev/null
@@ -1,485 +0,0 @@
-/**
- ******************************************************************************
- * @file ald_can.h
- * @brief Header file of CAN Module driver.
- *
- * @version V1.0
- * @date 16 Apr 2017
- * @author AE Team
- * @note
- *
- * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
- *
- ******************************************************************************
- */
-
-#ifndef __ALD_CAN_H
-#define __ALD_CAN_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "utils.h"
-
-/** @addtogroup ES32FXXX_ALD
- * @{
- */
-
-/** @addtogroup CAN
- * @{
- */
-
-/** @defgroup CAN_Public_Types CAN Public Types
- * @{
- */
-/**
- * @brief ALD State structures definition
- */
-typedef enum
-{
- CAN_STATE_RESET = 0x00, /**< CAN not yet initialized or disabled */
- CAN_STATE_READY = 0x01, /**< CAN initialized and ready for use */
- CAN_STATE_BUSY = 0x02, /**< CAN process is ongoing */
- CAN_STATE_BUSY_TX = 0x11, /**< CAN process is ongoing */
- CAN_STATE_BUSY_RX = 0x21, /**< CAN process is ongoing */
- CAN_STATE_BUSY_TX_RX = 0x31, /**< CAN process is ongoing */
- CAN_STATE_TIMEOUT = 0x03, /**< CAN in Timeout state */
- CAN_STATE_ERROR = 0x04, /**< CAN error state */
-} can_state_t;
-
-/**
- * @brief CAN Error Code
- */
-typedef enum
-{
- CAN_ERROR_NONE = 0x00, /**< No error */
- CAN_ERROR_EWG = 0x01, /**< EWG error */
- CAN_ERROR_EPV = 0x02, /**< EPV error */
- CAN_ERROR_BOF = 0x04, /**< BOF error */
- CAN_ERROR_STF = 0x08, /**< Stuff error */
- CAN_ERROR_FOR = 0x10, /**< Form error */
- CAN_ERROR_ACK = 0x20, /**< Acknowledgment error */
- CAN_ERROR_BR = 0x40, /**< Bit recessive */
- CAN_ERROR_BD = 0x80, /**< LEC dominant */
- CAN_ERROR_CRC = 0x100, /**< LEC transfer error */
-} can_error_t;
-
-/**
- * @brief CAN Operating Mode
- */
-typedef enum
-{
- CAN_MODE_NORMAL = 0x00, /**< Normal mode */
- CAN_MODE_LOOPBACK = 0x01, /**< Loopback mode */
- CAN_MODE_SILENT = 0x02, /**< Silent mode */
- CAN_MODE_SILENT_LOOPBACK = 0x03, /**< Loopback combined with silent mode */
-} can_operate_mode_t;
-
-/**
- * @brief CAN Synchronization Jump Width
- */
-typedef enum
-{
- CAN_SJW_1 = 0x0, /**< 1 time quantum */
- CAN_SJW_2 = 0x1, /**< 2 time quantum */
- CAN_SJW_3 = 0x2, /**< 3 time quantum */
- CAN_SJW_4 = 0x3, /**< 4 time quantum */
-} can_sjw_t;
-
-/**
- * @brief CAN Time Quantum in Bit Segment 1
- */
-typedef enum
-{
- CAN_SEG1_1 = 0x0, /**< 1 time quantum */
- CAN_SEG1_2 = 0x1, /**< 2 time quantum */
- CAN_SEG1_3 = 0x2, /**< 3 time quantum */
- CAN_SEG1_4 = 0x3, /**< 4 time quantum */
- CAN_SEG1_5 = 0x4, /**< 5 time quantum */
- CAN_SEG1_6 = 0x5, /**< 6 time quantum */
- CAN_SEG1_7 = 0x6, /**< 7 time quantum */
- CAN_SEG1_8 = 0x7, /**< 8 time quantum */
- CAN_SEG1_9 = 0x8, /**< 9 time quantum */
- CAN_SEG1_10 = 0x9, /**< 10 time quantum */
- CAN_SEG1_11 = 0xA, /**< 11 time quantum */
- CAN_SEG1_12 = 0xB, /**< 12 time quantum */
- CAN_SEG1_13 = 0xC, /**< 13 time quantum */
- CAN_SEG1_14 = 0xD, /**< 14 time quantum */
- CAN_SEG1_15 = 0xE, /**< 15 time quantum */
- CAN_SEG1_16 = 0xF, /**< 16 time quantum */
-} can_seg1_t;
-
-/**
- * @brief CAN Time Quantum in Bit Segment 2
- */
-typedef enum
-{
- CAN_SEG2_1 = 0x0, /**< 1 time quantum */
- CAN_SEG2_2 = 0x1, /**< 2 time quantum */
- CAN_SEG2_3 = 0x2, /**< 3 time quantum */
- CAN_SEG2_4 = 0x3, /**< 4 time quantum */
- CAN_SEG2_5 = 0x4, /**< 5 time quantum */
- CAN_SEG2_6 = 0x5, /**< 6 time quantum */
- CAN_SEG2_7 = 0x6, /**< 7 time quantum */
- CAN_SEG2_8 = 0x7, /**< 8 time quantum */
-} can_seg2_t;
-
-/**
- * @brief CAN Filter Mode
- */
-typedef enum
-{
- CAN_FILTER_MODE_MASK = 0x0, /**< Identifier mask mode */
- CAN_FILTER_MODE_LIST = 0x1, /**< Identifier list mode */
-} can_filter_mode_t;
-
-/**
- * @brief CAN Filter Scale
- */
-typedef enum
-{
- CAN_FILTER_SCALE_16 = 0x0, /**< Two 16-bit filters */
- CAN_FILTER_SCALE_32 = 0x1, /**< One 32-bit filter */
-} can_filter_scale_t;
-
-/**
- * @brief CAN Filter fifo
- */
-typedef enum
-{
- CAN_FILTER_FIFO0 = 0x0, /**< FIFO 0 assignment for filter */
- CAN_FILTER_FIFO1 = 0x1, /**< FIFO 1 assignment for filter */
-} can_filter_fifo_t;
-
-/**
- * @brief CAN Identifier Type
- */
-typedef enum
-{
- CAN_ID_STD = 0x0, /**< Standard Id */
- CAN_ID_EXT = 0x1, /**< Extended Id */
-} can_id_type_t;
-
-/**
- * @brief CAN Remote Transmission Request
- */
-typedef enum
-{
- CAN_RTR_DATA = 0x0, /**< Data frame */
- CAN_RTR_REMOTE = 0x1, /**< Remote frame */
-} can_remote_req_t;
-
-/**
- * @brief CAN Transmit Constants
- */
-typedef enum
-{
- CAN_TX_MAILBOX_0 = 0x0, /**< TX mailbox index 0 */
- CAN_TX_MAILBOX_1 = 0x1, /**< TX mailbox index 1 */
- CAN_TX_MAILBOX_2 = 0x2, /**< TX mailbox index 2 */
- CAN_TX_MAILBOX_NONE = 0x3, /**< MailBox can't be used */
-} can_tx_mailbox_t;
-
-/**
- * @brief CAN Receive fifo Number
- */
-typedef enum
-{
- CAN_RX_FIFO0 = 0x0, /**< CAN fifo 0 used to receive */
- CAN_RX_FIFO1 = 0x1, /**< CAN fifo 1 used to receive */
-} can_rx_fifo_t;
-
-/**
- * @brief CAN Flags
- */
-typedef enum
-{
- CAN_FLAG_SLAK = (1U << 1), /**< Sleep acknowledge flag */
- CAN_FLAG_WKU = (1U << 3), /**< Wake up flag */
- CAN_FLAG_SLAKI = (1U << 4), /**< Sleep acknowledge flag */
- CAN_FLAG_RQCP0 = (1U << 20) | (1U << 0), /**< Request MailBox0 flag */
- CAN_FLAG_TXOK0 = (1U << 20) | (1U << 1), /**< Transmission OK MailBox0 flag */
- CAN_FLAG_RQCP1 = (1U << 20) | (1U << 8), /**< Request MailBox1 flag */
- CAN_FLAG_TXOK1 = (1U << 20) | (1U << 9), /**< Transmission OK MailBox1 flag */
- CAN_FLAG_RQCP2 = (1U << 20) | (1U << 16), /**< Request MailBox2 flag */
- CAN_FLAG_TXOK2 = (1U << 20) | (1U << 17), /**< Transmission OK MailBox2 flag */
- CAN_FLAG_TME0 = (1U << 20) | (1U << 26), /**< Transmit mailbox 0 empty flag */
- CAN_FLAG_TME1 = (1U << 20) | (1U << 27), /**< Transmit mailbox 1 empty flag */
- CAN_FLAG_TME2 = (1U << 20) | (1U << 28), /**< Transmit mailbox 2 empty flag */
- CAN_FLAG_FF0 = (2U << 20) | (1U << 3), /**< FIFO 0 Full flag */
- CAN_FLAG_FOV0 = (2U << 20) | (1U << 4), /**< FIFO 0 Overrun flag */
- CAN_FLAG_FF1 = (3U << 20) | (1U << 3), /**< FIFO 1 Full flag */
- CAN_FLAG_FOV1 = (3U << 20) | (1U << 4), /**< FIFO 1 Overrun flag */
- CAN_FLAG_EWG = (4U << 20) | (1U << 0), /**< Error warning flag */
- CAN_FLAG_EPV = (4U << 20) | (1U << 1), /**< Error passive flag */
- CAN_FLAG_BOF = (4U << 20) | (1U << 2), /**< Bus-Off flag */
-} can_flag_t;
-
-/**
- * @brief CAN Interrupts
- */
-typedef enum
-{
- CAN_IT_TME = (1U << 0), /**< Transmit mailbox empty interrupt bit */
- CAN_IT_FMP0 = (1U << 1), /**< FIFO0 message pending interrupt bit */
- CAN_IT_FF0 = (1U << 2), /**< FIFO0 full interrupt bit */
- CAN_IT_FOV0 = (1U << 3), /**< FIFO0 overrun interrupt bit */
- CAN_IT_FMP1 = (1U << 4), /**< FIFO1 message pending interrupt bit */
- CAN_IT_FF1 = (1U << 5), /**< FIFO1 full interrupt bit */
- CAN_IT_FOV1 = (1U << 6), /**< FIFO1 overrun interrupt bit */
- CAN_IT_EWG = (1U << 8), /**< Error warning interrupt bit */
- CAN_IT_EPV = (1U << 9), /**< Error passive interrupt bit */
- CAN_IT_BOF = (1U << 10), /**< Bus-off interrupt bit */
- CAN_IT_LEC = (1U << 11), /**< Last error code interrupt bit */
- CAN_IT_ERR = (1U << 15), /**< Error interrupt bit */
- CAN_IT_WKU = (1U << 16), /**< wake-up interrupt bit */
- CAN_IT_SLK = (1U << 17), /**< sleep interrupt bit */
-} can_it_t;
-
-/**
- * @brief CAN filter configuration structure definition
- */
-typedef struct
-{
- uint32_t id_high; /**< Specifies the filter identification number */
- uint32_t id_low; /**< Specifies the filter identification number */
- uint32_t mask_id_high; /**< Specifies the filter mask number or identification number */
- uint32_t mask_id_low; /**< Specifies the filter mask number or identification number */
- can_filter_fifo_t fifo; /**< Specifies the fifo (0 or 1) which will be assigned to the filter. */
- uint32_t number; /**< Specifies the filter which will be initialized. */
- can_filter_mode_t mode; /**< Specifies the filter mode to be initialized. */
- can_filter_scale_t scale; /**< Specifies the filter scale. */
- type_func_t active; /**< Enable or disable the filter. */
- uint32_t bank_number; /**< Select the start slave bank filter. */
-} can_filter_t;
-
-/**
- * @brief CAN init structure definition
- */
-typedef struct
-{
- uint32_t psc; /**< Specifies the length of a time quantum. */
- can_operate_mode_t mode; /**< Specifies the CAN operating mode. */
- can_sjw_t sjw; /**< Specifies the maximum number of time quanta the CAN hardware is
- allowed to lengthen or shorten a bit to perform resynchronization. */
- can_seg1_t seg1; /**< Specifies the number of time quanta in Bit Segment 1. */
- can_seg2_t seg2; /**< Specifies the number of time quanta in Bit Segment 2. */
- type_func_t ttcm; /**< Enable or disable the time triggered communication mode. */
- type_func_t abom; /**< Enable or disable the automatic bus-off management. */
- type_func_t awk; /**< Enable or disable the automatic wake-up mode. */
- type_func_t artx; /**< Enable or disable the non-automatic retransmission mode. */
- type_func_t rfom; /**< Enable or disable the Receive fifo Locked mode. */
- type_func_t txmp; /**< Enable or disable the transmit fifo priority. */
-} can_init_t;
-
-/**
- * @brief CAN Tx message structure definition
- */
-typedef struct
-{
- uint32_t std; /**< Specifies the standard identifier. */
- uint32_t ext; /**< Specifies the extended identifier. */
- can_id_type_t type; /**< Specifies the type of identifier for the message that will be transmitted. */
- can_remote_req_t rtr; /**< Specifies the type of frame for the message that will be transmitted. */
- uint32_t len; /**< Specifies the length of the frame that will be transmitted. */
- uint8_t data[8]; /**< Contains the data to be transmitted. */
-} can_tx_msg_t;
-
-/**
- * @brief CAN Rx message structure definition
- */
-typedef struct
-{
- uint32_t std; /**< Specifies the standard identifier. */
- uint32_t ext; /**< Specifies the extended identifier. */
- can_id_type_t type; /**< Specifies the type of identifier for the message that will be received. */
- can_remote_req_t rtr; /**< Specifies the type of frame for the received message. */
- uint32_t len; /**< Specifies the length of the frame that will be received. */
- uint8_t data[8]; /**< Contains the data to be received. */
- uint32_t fmi; /**< Specifies the index of the filter the message stored in the mailbox passes through. */
- can_rx_fifo_t num; /**< Specifies the receive fifo number. */
-} can_rx_msg_t;
-
-/**
- * @brief CAN handle Structure definition
- */
-typedef struct can_handle_s
-{
- CAN_TypeDef *perh; /**< Register base address */
- can_init_t init; /**< CAN required parameters */
- can_rx_msg_t *rx_msg; /**< Pointer to receive message */
- lock_state_t lock; /**< CAN locking object */
- can_state_t state; /**< CAN communication state */
- can_error_t err; /**< CAN Error code */
-
- void (*tx_cplt_cbk)(struct can_handle_s *arg); /**< Tx completed callback */
- void (*rx_cplt_cbk)(struct can_handle_s *arg); /**< Rx completed callback */
- void (*error_cbk)(struct can_handle_s *arg); /**< error callback */
-} can_handle_t;
-/**
- * @}
- */
-
-/** @defgroup CAN_Public_Macro CAN Public Macros
- * @{
- */
-#define CAN_RESET_HANDLE_STATE(x) ((x)->state = CAN_STATE_RESET)
-#define CAN_RX_MSG_PENDING(x, y) (((y) == CAN_RX_FIFO0) ? \
- (READ_BIT((x)->perh->RXF0, CAN_RXF0_PEND_MSK)) : (READ_BIT((x)->perh->RXF1, CAN_RXF1_PEND_MSK)))
-#define CAN_DBG_FREEZE(x, y) (MODIFY_REG((x)->perh->CON, CAN_CON_DBGSTP_MSK, (y) << CAN_CON_DBGSTP_POS))
-/**
- * @}
- */
-
-/** @defgroup CAN_Private_Macros CAN Private Macros
- * @{
- */
-#define IS_CAN_ALL(x) ((x) == CAN0)
-#define IS_CAN_FILTER_NUMBER(x) ((x) <= 13)
-#define IS_CAN_MODE(x) (((x) == CAN_MODE_NORMAL) || \
- ((x) == CAN_MODE_LOOPBACK) || \
- ((x) == CAN_MODE_SILENT) || \
- ((x) == CAN_MODE_SILENT_LOOPBACK))
-#define IS_CAN_SJW(x) (((x) == CAN_SJW_1) || \
- ((x) == CAN_SJW_2) || \
- ((x) == CAN_SJW_3) || \
- ((x) == CAN_SJW_4))
-#define IS_CAN_BS1(x) ((x) <= CAN_SEG1_16)
-#define IS_CAN_BS2(x) ((x) <= CAN_SEG2_8)
-#define IS_CAN_FILTER_MODE(x) (((x) == CAN_FILTER_MODE_MASK) || \
- ((x) == CAN_FILTER_MODE_LIST))
-#define IS_CAN_FILTER_SCALE(x) (((x) == CAN_FILTER_SCALE_16) || \
- ((x) == CAN_FILTER_SCALE_32))
-#define IS_CAN_FILTER_FIFO(x) (((x) == CAN_FILTER_FIFO0) || \
- ((x) == CAN_FILTER_FIFO1))
-#define IS_CAN_IDTYPE(x) (((x) == CAN_ID_STD) || \
- ((x) == CAN_ID_EXT))
-#define IS_CAN_RTR(x) (((x) == CAN_RTR_DATA) || ((x) == CAN_RTR_REMOTE))
-#define IS_CAN_FIFO(x) (((x) == CAN_RX_FIFO0) || ((x) == CAN_RX_FIFO1))
-#define IS_CAN_BANKNUMBER(x) ((x) <= 28)
-#define IS_CAN_TX_MAILBOX(x) ((x) <= CAN_TX_MAILBOX_NONE)
-#define IS_CAN_STDID(x) ((x) <= ((uint32_t)0x7FF))
-#define IS_CAN_EXTID(x) ((x) <= ((uint32_t)0x1FFFFFFF))
-#define IS_CAN_DATA_LEN(x) ((x) <= ((uint8_t)0x08))
-#define IS_CAN_PRESCALER(x) (((x) >= 1) && ((x) <= 1024))
-#define IS_CAN_GET_FLAG(x) (((x) == CAN_FLAG_SLAK) || \
- ((x) == CAN_FLAG_WKU) || \
- ((x) == CAN_FLAG_SLAKI) || \
- ((x) == CAN_FLAG_RQCP0) || \
- ((x) == CAN_FLAG_TXOK0) || \
- ((x) == CAN_FLAG_RQCP1) || \
- ((x) == CAN_FLAG_TXOK1) || \
- ((x) == CAN_FLAG_RQCP2) || \
- ((x) == CAN_FLAG_TXOK2) || \
- ((x) == CAN_FLAG_TME0) || \
- ((x) == CAN_FLAG_TME1) || \
- ((x) == CAN_FLAG_TME2) || \
- ((x) == CAN_FLAG_FF0) || \
- ((x) == CAN_FLAG_FOV0) || \
- ((x) == CAN_FLAG_FF1) || \
- ((x) == CAN_FLAG_FOV1) || \
- ((x) == CAN_FLAG_EWG) || \
- ((x) == CAN_FLAG_EPV) || \
- ((x) == CAN_FLAG_BOF))
-#define IS_CAN_CLEAR_FLAG(x) (((x) == CAN_FLAG_WKU) || \
- ((x) == CAN_FLAG_SLAKI) || \
- ((x) == CAN_FLAG_RQCP0) || \
- ((x) == CAN_FLAG_RQCP1) || \
- ((x) == CAN_FLAG_RQCP2) || \
- ((x) == CAN_FLAG_FF0) || \
- ((x) == CAN_FLAG_FOV0) || \
- ((x) == CAN_FLAG_FF1) || \
- ((x) == CAN_FLAG_FOV1))
-#define IS_CAN_IT(x) (((x) == CAN_IT_TME) || \
- ((x) == CAN_IT_FMP0) || \
- ((x) == CAN_IT_FF0) || \
- ((x) == CAN_IT_FOV0) || \
- ((x) == CAN_IT_FMP1) || \
- ((x) == CAN_IT_FF1) || \
- ((x) == CAN_IT_FOV1) || \
- ((x) == CAN_IT_EWG) || \
- ((x) == CAN_IT_EPV) || \
- ((x) == CAN_IT_BOF) || \
- ((x) == CAN_IT_LEC) || \
- ((x) == CAN_IT_ERR) || \
- ((x) == CAN_IT_WKU) || \
- ((x) == CAN_IT_SLK))
-#define CAN_TIMEOUT_VALUE 100
-#define CAN_STATE_TX_MASK (1U << 4)
-#define CAN_STATE_RX_MASK (1U << 5)
-/**
- * @}
- */
-
-/** @addtogroup CAN_Public_Functions
- * @{
- */
-
-/** @addtogroup CAN_Public_Functions_Group1
- * @{
- */
-/* Initialization functions */
-void can_reset(can_handle_t *hperh);
-ald_status_t can_init(can_handle_t *hperh);
-ald_status_t can_filter_config(can_handle_t *hperh, can_filter_t *config);
-/**
- * @}
- */
-
-/** @addtogroup CAN_Public_Functions_Group2
- * @{
- */
-/* IO operation functions */
-ald_status_t can_send(can_handle_t *hperh, can_tx_msg_t *msg, uint32_t timeout);
-ald_status_t can_send_by_it(can_handle_t *hperh, can_tx_msg_t *msg);
-ald_status_t can_recv(can_handle_t *hperh, can_rx_fifo_t num, can_rx_msg_t *msg, uint32_t timeout);
-ald_status_t can_recv_by_it(can_handle_t *hperh, can_rx_fifo_t num, can_rx_msg_t *msg);
-/**
- * @}
- */
-
-/** @addtogroup CAN_Public_Functions_Group3
- * @{
- */
-/* Control function */
-ald_status_t can_sleep(can_handle_t *hperh);
-ald_status_t can_wake_up(can_handle_t *hperh);
-void can_cancel_send(can_handle_t *hperh, can_tx_mailbox_t box);
-void can_irq_handler(can_handle_t *hperh);
-type_bool_t can_get_tx_status(can_handle_t *hperh, can_tx_mailbox_t box);
-void can_interrupt_config(can_handle_t *hperh, can_it_t it, type_func_t state);
-it_status_t can_get_it_status(can_handle_t *hperh, can_it_t it);
-flag_status_t can_get_flag_status(can_handle_t *hperh, can_flag_t flag);
-void can_clear_flag_status(can_handle_t *hperh, can_flag_t flag);
-/**
- * @}
- */
-
-/** @addtogroup CAN_Public_Functions_Group4
- * @{
- */
-/* State and Error functions */
-can_state_t can_get_state(can_handle_t *hperh);
-can_error_t can_get_error(can_handle_t *hperh);
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __ALD_CAN_H */
diff --git a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_dma.h b/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_dma.h
deleted file mode 100644
index 646ae02a67a21be1f3361f1ab35c924625fed973..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_dma.h
+++ /dev/null
@@ -1,389 +0,0 @@
-/**
- *********************************************************************************
- *
- * @file ald_dma.h
- * @brief DMA module Library.
- *
- * @version V1.0
- * @date 09 Nov 2017
- * @author AE Team
- * @note
- *
- * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
- *
- *********************************************************************************
- */
-
-#ifndef __ALD_DMA_H__
-#define __ALD_DMA_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "utils.h"
-
-
-/** @addtogroup ES32FXXX_ALD
- * @{
- */
-
-/** @addtogroup DMA
- * @{
- */
-
-/**
- * @defgroup DMA_Public_Macros DMA Public Macros
- * @{
- */
-#define DMA_CH_COUNT 6
-#define DMA_ERR 31
-/**
- * @}
- */
-
-/**
- * @defgroup DMA_Public_Types DMA Public Types
- * @{
- */
-
-/**
- * @brief Input source to DMA channel
- */
-typedef enum
-{
- DMA_MSEL_NONE = 0x0, /**< NONE */
- DMA_MSEL_GPIO = 0x1, /**< GPIO */
- DMA_MSEL_CRYPT = 0x2, /**< CRYPT */
- DMA_MSEL_ACMP = 0x3, /**< ACMP */
- DMA_MSEL_DAC0 = 0x4, /**< DAC0 */
- DMA_MSEL_ADC0 = 0x6, /**< ADC0 */
- DMA_MSEL_CRC = 0x7, /**< CRC */
- DMA_MSEL_UART0 = 0x8, /**< UART0 */
- DMA_MSEL_UART1 = 0x9, /**< UART1 */
- DMA_MSEL_UART2 = 0xA, /**< UART2 */
- DMA_MSEL_UART3 = 0xB, /**< UART3 */
- DMA_MSEL_USART0 = 0xC, /**< USART0 */
- DMA_MSEL_USART1 = 0xD, /**< USART1 */
- DMA_MSEL_SPI0 = 0xE, /**< SPI0 */
- DMA_MSEL_SPI1 = 0xF, /**< SPI1 */
- DMA_MSEL_I2C0 = 0x10, /**< I2C0 */
- DMA_MSEL_I2C1 = 0x11, /**< I2C1 */
- DMA_MSEL_TIMER0 = 0x12, /**< TIMER0 */
- DMA_MSEL_TIMER1 = 0x13, /**< TIMER1 */
- DMA_MSEL_TIMER2 = 0x14, /**< TIMER2 */
- DMA_MSEL_TIMER3 = 0x15, /**< TIMER3 */
- DMA_MSEL_RTC = 0x16, /**< RTC */
- DMA_MSEL_LPTIM0 = 0x17, /**< LPTIM0 */
- DMA_MSEL_LPUART0 = 0x18, /**< LPUART0 */
- DMA_MSEL_DMA = 0x19, /**< DMA */
- DMA_MSEL_SPI2 = 0x1A, /**< SPI2 */
- DMA_MSEL_TIMER4 = 0x1B, /**< TIMER4 */
- DMA_MSEL_TIMER5 = 0x1C, /**< TIMER5 */
- DMA_MSEL_TIMER6 = 0x1D, /**< TIMER6 */
- DMA_MSEL_TIMER7 = 0x1E, /**< TIMER7 */
- DMA_MSEL_ADC1 = 0x1F, /**< ADC1 */
- DMA_MSEL_PIS = 0x20, /**< PIS */
- DMA_MSEL_TRNG = 0x21, /**< TRNG */
-} dma_msel_t;
-
-/**
- * @brief Input signal to DMA channel
- */
-typedef enum
-{
- DMA_MSIGSEL_NONE = 0x0, /**< NONE */
- DMA_MSIGSEL_EXTI_0 = 0x0, /**< External interrupt 0 */
- DMA_MSIGSEL_EXTI_1 = 0x1, /**< External interrupt 1 */
- DMA_MSIGSEL_EXTI_2 = 0x2, /**< External interrupt 2 */
- DMA_MSIGSEL_EXTI_3 = 0x3, /**< External interrupt 3 */
- DMA_MSIGSEL_EXTI_4 = 0x4, /**< External interrupt 4 */
- DMA_MSIGSEL_EXTI_5 = 0x5, /**< External interrupt 5 */
- DMA_MSIGSEL_EXTI_6 = 0x6, /**< External interrupt 6 */
- DMA_MSIGSEL_EXTI_7 = 0x7, /**< External interrupt 7 */
- DMA_MSIGSEL_EXTI_8 = 0x8, /**< External interrupt 8 */
- DMA_MSIGSEL_EXTI_9 = 0x9, /**< External interrupt 9 */
- DMA_MSIGSEL_EXTI_10 = 0xA, /**< External interrupt 10 */
- DMA_MSIGSEL_EXTI_11 = 0xB, /**< External interrupt 11 */
- DMA_MSIGSEL_EXTI_12 = 0xC, /**< External interrupt 12 */
- DMA_MSIGSEL_EXTI_13 = 0xD, /**< External interrupt 13 */
- DMA_MSIGSEL_EXTI_14 = 0xE, /**< External interrupt 14 */
- DMA_MSIGSEL_EXTI_15 = 0xF, /**< External interrupt 15 */
- DMA_MSIGSEL_CRYPT_WRITE = 0x0, /**< CRYPT write mode */
- DMA_MSIGSEL_CRYPT_READ = 0x1, /**< CRYPT read mode */
- DMA_MSIGSEL_CALC_WRITE = 0x0, /**< CALC write mode */
- DMA_MSIGSEL_CALC_READ = 0x1, /**< CALC read mode */
- DMA_MSIGSEL_DAC0_CH0 = 0x0, /**< DAC0 channel 0 complete */
- DMA_MSIGSEL_DAC0_CH1 = 0x1, /**< DAC0 channel 1 complete */
- DMA_MSIGSEL_ADC = 0x0, /**< ADC mode */
- DMA_MSIGSEL_UART_TXEMPTY = 0x0, /**< UART transmit */
- DMA_MSIGSEL_UART_RNR = 0x1, /**< UART receive */
- DMA_MSIGSEL_USART_RNR = 0x0, /**< USART reveive */
- DMA_MSIGSEL_USART_TXEMPTY = 0x1, /**< USART transmit */
- DMA_MSIGSEL_SPI_RNR = 0x0, /**< SPI receive */
- DMA_MSIGSEL_SPI_TXEMPTY = 0x1, /**< SPI transmit */
- DMA_MSIGSEL_I2C_RNR = 0x0, /**< I2C receive */
- DMA_MSIGSEL_I2C_TXEMPTY = 0x1, /**< I2C transmit */
- DMA_MSIGSEL_TIMER_CH1 = 0x0, /**< TIM channal 1 */
- DMA_MSIGSEL_TIMER_CH2 = 0x1, /**< TIM channal 2 */
- DMA_MSIGSEL_TIMER_CH3 = 0x2, /**< TIM channal 3 */
- DMA_MSIGSEL_TIMER_CH4 = 0x3, /**< TIM channal 4 */
- DMA_MSIGSEL_TIMER_TRI = 0x4, /**< TIM trigger */
- DMA_MSIGSEL_TIMER_COMP = 0x5, /**< TIM compare */
- DMA_MSIGSEL_TIMER_UPDATE = 0x6, /**< TIM update */
- DMA_MSIGSEL_LPUART_RNR = 0x0, /**< LPUART receive */
- DMA_MSIGSEL_LPUART_TXEMPTY = 0x1, /**< LPUART transmit */
- DMA_MSIGSEL_PIS_CH0 = 0x0, /**< PIS channal 0 */
- DMA_MSIGSEL_PIS_CH1 = 0x1, /**< PIS channal 1 */
- DMA_MSIGSEL_PIS_CH2 = 0x2, /**< PIS channal 2 */
- DMA_MSIGSEL_PIS_CH3 = 0x3, /**< PIS channal 3 */
- DMA_MSIGSEL_PIS_CH4 = 0x4, /**< PIS channal 4 */
- DMA_MSIGSEL_PIS_CH5 = 0x5, /**< PIS channal 5 */
- DMA_MSIGSEL_PIS_CH6 = 0x6, /**< PIS channal 6 */
- DMA_MSIGSEL_PIS_CH7 = 0x7, /**< PIS channal 7 */
- DMA_MSIGSEL_PIS_CH8 = 0x8, /**< PIS channal 8 */
- DMA_MSIGSEL_PIS_CH9 = 0x9, /**< PIS channal 9 */
- DMA_MSIGSEL_PIS_CH10 = 0xA, /**< PIS channal 10 */
- DMA_MSIGSEL_PIS_CH11 = 0xB, /**< PIS channal 11 */
- DMA_MSIGSEL_PIS_CH12 = 0xC, /**< PIS channal 12 */
- DMA_MSIGSEL_PIS_CH13 = 0xD, /**< PIS channal 13 */
- DMA_MSIGSEL_PIS_CH14 = 0xE, /**< PIS channal 14 */
- DMA_MSIGSEL_PIS_CH15 = 0xF, /**< PIS channal 15 */
-} dma_msigsel_t;
-
-/**
- * @brief DMA Descriptor control type
- */
-typedef union
-{
- struct
- {
- uint32_t cycle_ctrl : 3; /**< DMA operating mode @ref dma_cycle_ctrl_t */
- uint32_t next_useburst : 1; /**< Uses the alternate data structure when complete a DMA cycle */
- uint32_t n_minus_1 : 10; /**< Represent the total number of DMA transfers that DMA cycle contains. */
- uint32_t R_power : 4; /**< Control how many DMA transfers can occur before re-arbitrates. @ref dma_arbiter_config_t */
- uint32_t src_prot_ctrl : 3; /**< Control the state of HPROT when reads the source data. */
- uint32_t dst_prot_ctrl : 3; /**< Control the state of HPROT when writes the destination data */
- uint32_t src_size : 2; /**< Source data size @ref dma_data_size_t */
- uint32_t src_inc : 2; /**< Control the source address increment. @ref dma_data_inc_t */
- uint32_t dst_size : 2; /**< Destination data size. @ref dma_data_size_t */
- uint32_t dst_inc : 2; /**< Destination address increment. @ref dma_data_inc_t */
- };
- uint32_t word;
-} dma_ctrl_t;
-
-/**
- * @brief Channel control data structure
- */
-typedef struct
-{
- void *src; /**< Source data end pointer */
- void *dst; /**< Destination data end pointer */
- dma_ctrl_t ctrl; /**< Control data configuration @ref dma_ctrl_t */
- uint32_t use; /**< Reserve for user */
-} dma_descriptor_t;
-
-/**
- * @brief data increment
- */
-typedef enum
-{
- DMA_DATA_INC_BYTE = 0x0, /**< Address increment by byte */
- DMA_DATA_INC_HALFWORD = 0x1, /**< Address increment by halfword */
- DMA_DATA_INC_WORD = 0x2, /**< Address increment by word */
- DMA_DATA_INC_NONE = 0x3, /**< No increment */
-} dma_data_inc_t;
-
-/**
- * @brief Data size
- */
-typedef enum
-{
- DMA_DATA_SIZE_BYTE = 0x0, /**< Byte */
- DMA_DATA_SIZE_HALFWORD = 0x1, /**< Halfword */
- DMA_DATA_SIZE_WORD = 0x2, /**< Word */
-} dma_data_size_t;
-
-/**
- * @brief The operating mode of the DMA cycle
- */
-typedef enum
-{
- DMA_CYCLE_CTRL_NONE = 0x0, /**< Stop */
- DMA_CYCLE_CTRL_BASIC = 0x1, /**< Basic */
- DMA_CYCLE_CTRL_AUTO = 0x2, /**< Auto-request */
- DMA_CYCLE_CTRL_PINGPONG = 0x3, /**< Ping-pong */
- DMA_CYCLE_CTRL_MEM_SCATTER_GATHER = 0x4, /**< Memory scatter/gather */
- DMA_CYCLE_CTRL_PER_SCATTER_GATHER = 0x6, /**< Peripheral scatter/gather */
-} dma_cycle_ctrl_t;
-
-/**
- * @brief Control how many DMA transfers can occur
- * before the controller re-arbitrates
- */
-typedef enum
-{
- DMA_R_POWER_1 = 0x0, /**< Arbitrates after each DMA transfer */
- DMA_R_POWER_2 = 0x1, /**< Arbitrates after 2 DMA transfer */
- DMA_R_POWER_4 = 0x2, /**< Arbitrates after 4 DMA transfer */
- DMA_R_POWER_8 = 0x3, /**< Arbitrates after 8 DMA transfer */
- DMA_R_POWER_16 = 0x4, /**< Arbitrates after 16 DMA transfer */
- DMA_R_POWER_32 = 0x5, /**< Arbitrates after 32 DMA transfer */
- DMA_R_POWER_64 = 0x6, /**< Arbitrates after 64 DMA transfer */
- DMA_R_POWER_128 = 0x7, /**< Arbitrates after 128 DMA transfer */
- DMA_R_POWER_256 = 0x8, /**< Arbitrates after 256 DMA transfer */
- DMA_R_POWER_512 = 0x9, /**< Arbitrates after 512 DMA transfer */
- DMA_R_POWER_1024 = 0xA, /**< Arbitrates after 1024 DMA transfer */
-} dma_arbiter_config_t;
-
-/**
- * @brief Callback function pointer and param
- */
-typedef struct
-{
- void (*cplt_cbk)(void *arg); /**< DMA transfers complete callback */
- void (*err_cbk)(void *arg); /**< DMA occurs error callback */
- void *cplt_arg; /**< The parameter of cplt_cbk() */
- void *err_arg; /**< The parameter of err_cbk() */
-} dma_call_back_t;
-
-/**
- * @brief DMA channal configure structure
- */
-typedef struct
-{
- void *src; /**< Source data begin pointer */
- void *dst; /**< Destination data begin pointer */
- uint16_t size; /**< The total number of DMA transfers that DMA cycle contains */
- dma_data_size_t data_width; /**< Data width, @ref dma_data_size_t */
- dma_data_inc_t src_inc; /**< Source increment type. @ref dma_data_inc_t */
- dma_data_inc_t dst_inc; /**< Destination increment type. @ref dma_data_inc_t */
- dma_arbiter_config_t R_power; /**< Control how many DMA transfers can occur before re-arbitrates. @ref dma_arbiter_config_t */
- type_func_t primary; /**< Use primary descriptor or alternate descriptor */
- type_func_t burst; /**< Uses the alternate data structure when complete a DMA cycle */
- type_func_t high_prio; /**< High priority or default priority */
- type_func_t iterrupt; /**< Enable/disable interrupt */
- dma_msel_t msel; /**< Input source to DMA channel @ref dma_msel_t */
- dma_msigsel_t msigsel; /**< Input signal to DMA channel @ref dma_msigsel_t */
- uint8_t channel; /**< Channel index */
-} dma_config_t;
-
-/**
- * @brief DMA handle structure definition
- */
-typedef struct
-{
- DMA_TypeDef *perh; /**< DMA registers base address */
- dma_config_t config; /**< Channel configure structure. @ref dma_config_t */
- void (*cplt_cbk)(void *arg); /**< DMA transfers complete callback */
- void (*err_cbk)(void *arg); /**< DMA bus occurs error callback */
- void *cplt_arg; /**< The parameter of cplt_cbk() */
- void *err_arg; /**< The parameter of err_cbk() */
-} dma_handle_t;
-/**
- * @}
- */
-
-/**
- * @defgroup DMA_Private_Macros DMA Private Macros
- * @{
- */
-#define IS_DMA_MSEL_TYPE(x) ((x) <= DMA_MSEL_TRNG)
-#define IS_DMA_MSIGSEL_TYPE(x) ((x) <= 0xF)
-#define IS_DMA_DATAINC_TYPE(x) (((x) == DMA_DATA_INC_BYTE) || \
- ((x) == DMA_DATA_INC_HALFWORD) || \
- ((x) == DMA_DATA_INC_WORD) || \
- ((x) == DMA_DATA_INC_NONE))
-#define IS_DMA_DATASIZE_TYPE(x) (((x) == DMA_DATA_SIZE_BYTE) || \
- ((x) == DMA_DATA_SIZE_HALFWORD) || \
- ((x) == DMA_DATA_SIZE_WORD))
-#define IS_CYCLECTRL_TYPE(x) (((x) == DMA_CYCLE_CTRL_NONE) || \
- ((x) == DMA_CYCLE_CTRL_BASIC) || \
- ((x) == DMA_CYCLE_CTRL_AUTO) || \
- ((x) == DMA_CYCLE_CTRL_PINGPONG) || \
- ((x) == DMA_CYCLE_CTRL_MEM_SCATTER_GATHER) || \
- ((x) == DMA_CYCLE_CTRL_PER_SCATTER_GATHER))
-#define IS_DMA_ARBITERCONFIG_TYPE(x) (((x) == DMA_R_POWER_1) || \
- ((x) == DMA_R_POWER_2) || \
- ((x) == DMA_R_POWER_4) || \
- ((x) == DMA_R_POWER_8) || \
- ((x) == DMA_R_POWER_16) || \
- ((x) == DMA_R_POWER_32) || \
- ((x) == DMA_R_POWER_64) || \
- ((x) == DMA_R_POWER_128) || \
- ((x) == DMA_R_POWER_256) || \
- ((x) == DMA_R_POWER_512) || \
- ((x) == DMA_R_POWER_1024))
-#define IS_DMA(x) ((x) == DMA0)
-#define IS_DMA_CHANNEL(x) ((x) <= 5)
-#define IS_DMA_DATA_SIZE(x) ((x) <= 1024)
-#define IS_DMA_IT_TYPE(x) (((x) <= 5) || ((x) == 31))
-/**
- * @}
- */
-
-/**
- * @addtogroup DMA_Public_Functions
- * @{
- */
-
-/** @addtogroup DMA_Public_Functions_Group1
- * @{
- */
-/* Initialization functions */
-extern void dma_reset(DMA_TypeDef *DMAx);
-extern void dma_init(DMA_TypeDef *DMAx);
-extern void dma_config_struct(dma_config_t *p);
-/**
- * @}
- */
-
-
-/** @addtogroup DMA_Public_Functions_Group2
- * @{
- */
-/* Configure DMA channel functions */
-extern void dma_config_auto(dma_handle_t *hperh);
-extern void dma_restart_auto(dma_handle_t *hperh, void *src, void *dst, uint16_t size);
-extern void dma_config_auto_easy(DMA_TypeDef *DMAx, void *src, void *dst,
- uint16_t size, uint8_t channel, void (*cbk)(void *arg));
-extern void dma_config_basic(dma_handle_t *hperh);
-extern void dma_restart_basic(dma_handle_t *hperh, void *src, void *dst, uint16_t size);
-extern void dma_config_basic_easy(DMA_TypeDef *DMAx, void *src, void *dst, uint16_t size, dma_msel_t msel,
- dma_msigsel_t msigsel, uint8_t channel, void (*cbk)(void *arg));
-/**
- * @}
- */
-
-/** @addtogroup DMA_Public_Functions_Group3
- * @{
- */
-/* DMA control functions */
-extern void dma_channel_config(DMA_TypeDef *DMAx, uint8_t channel, type_func_t state);
-extern void dma_interrupt_config(DMA_TypeDef *DMAx, uint8_t channel, type_func_t state);
-extern it_status_t dma_get_it_status(DMA_TypeDef *DMAx, uint8_t channel);
-extern flag_status_t dma_get_flag_status(DMA_TypeDef *DMAx, uint8_t channel);
-extern void dma_clear_flag_status(DMA_TypeDef *DMAx, uint8_t channel);
-void dma0_irq_cbk(void);
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*__ALD_DMA_H__ */
diff --git a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_i2c.h b/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_i2c.h
deleted file mode 100644
index f20384d7e194684a56a110b97ed5834af6776d46..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_i2c.h
+++ /dev/null
@@ -1,534 +0,0 @@
-/**
- *********************************************************************************
- *
- * @file ald_i2c.h
- * @brief Header file of I2C driver
- *
- * @version V1.0
- * @date 15 Nov 2017
- * @author AE Team
- * @note
- *
- * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
- *
- ********************************************************************************
- */
-
-#ifndef __ALD_I2C_H__
-#define __ALD_I2C_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "utils.h"
-#include "ald_dma.h"
-#include "ald_cmu.h"
-
-/** @addtogroup ES32FXXX_ALD
- * @{
- */
-
-/** @addtogroup I2C
- * @{
- */
-
-/** @defgroup I2C_Public_Types I2C Public Types
- * @{
- */
-/**
- * @brief I2C Error Code
- */
-typedef enum
-{
- I2C_ERROR_NONE = 0x0, /**< No error */
- I2C_ERROR_BERR = 0x1, /**< Berr error */
- I2C_ERROR_ARLO = 0x2, /**< Arlo error */
- I2C_ERROR_AF = 0x4, /**< Af error */
- I2C_ERROR_OVR = 0x8, /**< Ovr error */
- I2C_ERROR_DMA = 0x10, /**< Dma error */
- I2C_ERROR_TIMEOUT = 0x20, /**< Timeout error */
-} i2c_error_t;
-
-/**
- * @brief I2C state structure definition
- */
-typedef enum
-{
- I2C_STATE_RESET = 0x0, /**< Peripheral is not yet Initialized */
- I2C_STATE_READY = 0x1, /**< Peripheral Initialized and ready for use */
- I2C_STATE_BUSY = 0x2, /**< An internal process is ongoing */
- I2C_STATE_BUSY_TX = 0x3, /**< Data Transmission process is ongoing */
- I2C_STATE_BUSY_RX = 0x4, /**< Data Reception process is ongoing */
- I2C_STATE_TIMEOUT = 0x5, /**< timeout state */
- I2C_STATE_ERROR = 0x6, /**< Error */
-} i2c_state_t;
-
-/**
- * @brief I2C Duty Cycle
- */
-typedef enum
-{
- I2C_DUTYCYCLE_2 = 0x0, /**< duty cycle is 2 */
- I2C_DUTYCYCLE_16_9 = 0x4000, /**< duty cycle is 16/9 */
-} i2c_duty_t;
-
-/**
- * @brief I2C Addressing Mode
- */
-typedef enum
-{
- I2C_ADDR_7BIT = 0x1, /**< 7 bit address */
- I2C_ADDR_10BIT = 0x2, /**< 10 bit address */
-} i2c_addr_t;
-
-/**
- * @brief I2C Dual Addressing Mode
- */
-typedef enum
-{
- I2C_DUALADDR_DISABLE = 0x0, /**< dual address is disable */
- I2C_DUALADDR_ENABLE = 0x1, /**< dual address is enable */
-} i2c_dual_addr_t;
-
-/**
- * @brief I2C General Call Addressing mode
- */
-typedef enum
-{
- I2C_GENERALCALL_DISABLE = 0x0, /**< feneral call address is disable */
- I2C_GENERALCALL_ENABLE = 0x40, /**< feneral call address is enable */
-} i2c_general_addr_t;
-
-/**
- * @brief I2C Nostretch Mode
- */
-typedef enum
-{
- I2C_NOSTRETCH_DISABLE = 0x0, /**< Nostretch disable */
- I2C_NOSTRETCH_ENABLE = 0x80, /**< Nostretch enable */
-} i2c_nostretch_t;
-
-/**
- * @brief I2C Memory Address Size
- */
-typedef enum
-{
- I2C_MEMADD_SIZE_8BIT = 0x1, /**< 8 bit memory address size */
- I2C_MEMADD_SIZE_16BIT = 0x10 /**< 10 bit memory address size */
-} i2c_addr_size_t;
-
-/**
- * @brief I2C Flag Definition
- */
-typedef enum
-{
- I2C_FLAG_SB = (1U << 0),
- I2C_FLAG_ADDR = (1U << 1),
- I2C_FLAG_BTF = (1U << 2),
- I2C_FLAG_ADD10 = (1U << 3),
- I2C_FLAG_STOPF = (1U << 4),
- I2C_FLAG_RXNE = (1U << 6),
- I2C_FLAG_TXE = (1U << 7),
- I2C_FLAG_BERR = (1U << 8),
- I2C_FLAG_ARLO = (1U << 9),
- I2C_FLAG_AF = (1U << 10),
- I2C_FLAG_OVR = (1U << 11),
- I2C_FLAG_PECERR = (1U << 12),
- I2C_FLAG_TIMEOUT = (1U << 14),
- I2C_FLAG_SMBALERT = (1U << 15),
- I2C_FLAG_MSL = (1U << 16),
- I2C_FLAG_BUSY = (1U << 17),
- I2C_FLAG_TRA = (1U << 18),
- I2C_FLAG_GENCALL = (1U << 20),
- I2C_FLAG_SMBDEFAULT = (1U << 21),
- I2C_FLAG_SMBHOST = (1U << 22),
- I2C_FLAG_DUALF = (1U << 23),
-} i2c_flag_t;
-
-/**
- * @brief I2C mode structure definition
- */
-typedef enum
-{
- I2C_MODE_NONE = 0x0, /**< No I2C communication on going */
- I2C_MODE_MASTER = 0x10, /**< I2C communication is in Master mode */
- I2C_MODE_SLAVE = 0x20, /**< I2C communication is in Slave mode */
- I2C_MODE_MEM = 0x40, /**< I2C communication is in Memory mode */
-} i2c_mode_t;
-
-/**
- * @brief I2C Clock
- */
-typedef enum
-{
- I2C_STANDARD_MODE_MAX_CLK = 100000, /**< Standard mode clock */
- I2C_FAST_MODE_MAX_CLK = 400000, /**< Fast mode clock */
-} i2c_clock_t;
-
-/**
- * @brief Interrupt Configuration Definition
- */
-typedef enum
-{
- I2C_IT_BUF = (1U << 10), /**< Buffer interrupt */
- I2C_IT_EVT = (1U << 9), /**< Event interrupt */
- I2C_IT_ERR = (1U << 8), /**< Error interrupt */
-} i2c_interrupt_t;
-
-/**
- * @brief I2C CON1 Register
- */
-typedef enum
-{
- I2C_CON1_PEN = (1U << 0), /**< PEN BIT */
- I2C_CON1_PMOD = (1U << 1), /**< PMOD BIT */
- I2C_CON1_SMBMOD = (1U << 3), /**< SMBMOD BIT */
- I2C_CON1_ARPEN = (1U << 4), /**< ARPEN BIT */
- I2C_CON1_PECEN = (1U << 5), /**< PECEN BIT */
- I2C_CON1_GCEN = (1U << 6), /**< GCEN BIT */
- I2C_CON1_DISCS = (1U << 7), /**< DISCS BIT */
- I2C_CON1_START = (1U << 8), /**< START BIT */
- I2C_CON1_STOP = (1U << 9), /**< STOP BIT */
- I2C_CON1_ACKEN = (1U << 10), /**< ACKEN BIT */
- I2C_CON1_POSAP = (1U << 11), /**< POSAP BIT */
- I2C_CON1_TRPEC = (1U << 12), /**< TRPEC BIT */
- I2C_CON1_ALARM = (1U << 13), /**< ALARM BIT */
- I2C_CON1_SRST = (1U << 15), /**< SRST BIT */
-} i2c_con1_t;
-
-/**
- * @brief I2C CON2 Register
- */
-typedef enum
-{
- I2C_CON2_CLKF = 0x3F, /**< CLKF BITS */
- I2C_CON2_CLKF_0 = (1U << 0), /**< CLKF_0 BIT */
- I2C_CON2_CLKF_1 = (1U << 1), /**< CLKF_1 BIT */
- I2C_CON2_CLKF_2 = (1U << 2), /**< CLKF_2 BIT */
- I2C_CON2_CLKF_3 = (1U << 3), /**< CLKF_3 BIT */
- I2C_CON2_CLKF_4 = (1U << 4), /**< CLKF_4 BIT */
- I2C_CON2_CLKF_5 = (1U << 5), /**< CLKF_5 BIT */
- I2C_CON2_ERRIE = (1U << 8), /**< ERRIE BIT */
- I2C_CON2_EVTIE = (1U << 9), /**< EVTIE BIT */
- I2C_CON2_BUFIE = (1U << 10), /**< BUFIE BIT */
- I2C_CON2_DMAEN = (1U << 11), /**< DMAEN BIT */
- I2C_CON2_LDMA = (1U << 12), /**< LDMA BIT */
-} i2c_con2_t;
-
-/**
- * @brief I2C ADDR1 Register
- */
-typedef enum
-{
- I2C_ADDR1_ADDH0 = (1U << 0), /**< ADDH0 BIT */
- I2C_ADDR1_ADDH1 = (1U << 1), /**< ADDH1 BIT */
- I2C_ADDR1_ADDH2 = (1U << 2), /**< ADDH2 BIT */
- I2C_ADDR1_ADDH3 = (1U << 3), /**< ADDH3 BIT */
- I2C_ADDR1_ADDH4 = (1U << 4), /**< ADDH4 BIT */
- I2C_ADDR1_ADDH5 = (1U << 5), /**< ADDH5 BIT */
- I2C_ADDR1_ADDH6 = (1U << 6), /**< ADDH6 BIT */
- I2C_ADDR1_ADDH7 = (1U << 7), /**< ADDH7 BIT */
- I2C_ADDR1_ADDH8 = (1U << 8), /**< ADDH8 BIT */
- I2C_ADDR1_ADDH9 = (1U << 9), /**< ADDH9 BIT */
- I2C_ADDR1_ADDTYPE = (1U << 15), /**< ADDTYPE BIT */
-} i2c_addr1_t;
-
-/**
- * @brief I2C ADDR2 Register
- */
-typedef enum
-{
- I2C_ADDR2_DUALEN = (1U << 0), /**< DUALEN BIT */
- I2C_ADDR2_ADD = (1U << 1), /**< ADD BIT */
-} i2c_addr2_t;
-
-/**
- * @brief I2C STAT1 Register
- */
-typedef enum
-{
- I2C_STAT1_SB = (1U << 0), /**< SB BIT */
- I2C_STAT1_ADDR = (1U << 1), /**< ADDR BIT */
- I2C_STAT1_BTC = (1U << 2), /**< BTC BIT */
- I2C_STAT1_SENDADD10 = (1U << 3), /**< SENDADD10 BIT */
- I2C_STAT1_DETSTP = (1U << 4), /**< DETSTP BIT */
- I2C_STAT1_RXBNE = (1U << 6), /**< RXBNE BIT */
- I2C_STAT1_TXBE = (1U << 7), /**< TXBE BIT */
- I2C_STAT1_BUSERR = (1U << 8), /**< BUSERR BIT */
- I2C_STAT1_LARB = (1U << 9), /**< LARB BIT */
- I2C_STAT1_ACKERR = (1U << 10), /**< ACKERR BIT */
- I2C_STAT1_ROUERR = (1U << 11), /**< ROUERR BIT */
- I2C_STAT1_PECERR = (1U << 12), /**< PECERR BIT */
- I2C_STAT1_SMBTO = (1U << 14), /**< SMBTO BIT */
- I2C_STAT1_SMBALARM = (1U << 15), /**< SMBALARM BIT */
-} i2c_stat1_t;
-
-/**
- * @brief I2C STAT2 Register
- */
-typedef enum
-{
- I2C_STAT2_MASTER = (1U << 0), /**< MASTER BIT */
- I2C_STAT2_BSYF = (1U << 1), /**< BSYF BIT */
- I2C_STAT2_TRF = (1U << 2), /**< TRF BIT */
- I2C_STAT2_RXGCF = (1U << 4), /**< RXGCF BIT */
- I2C_STAT2_SMBDEF = (1U << 5), /**< SMBDEF BIT */
- I2C_STAT2_SMBHH = (1U << 6), /**< SMBHH BIT */
- I2C_STAT2_DUALF = (1U << 7), /**< DMF BIT */
- I2C_STAT2_PECV = (1U << 8), /**< PECV BIT */
-} i2c_stat2_t;
-
-/**
- * @brief I2C CKCFG Register
- */
-typedef enum
-{
- I2C_CKCFG_CLKSET = 0xFFF, /**< CLKSET BITS */
- I2C_CKCFG_DUTY = (1U << 14), /**< DUTY BIT */
- I2C_CKCFG_CLKMOD = (1U << 15), /**< CLKMOD BIT */
-} i2c_ckcfg_t;
-
-/**
- * @brief I2C RT Register
- */
-typedef enum
-{
- I2C_RT_RISET = 0x3F, /**< RISET BITS */
-} i2c_trise_t;
-
-/**
- * @brief I2C Configuration Structure definition
- */
-typedef struct
-{
- uint32_t clk_speed; /**< Specifies the clock frequency */
- i2c_duty_t duty; /**< Specifies the I2C fast mode duty cycle */
- uint32_t own_addr1; /**< Specifies the first device own address */
- i2c_addr_t addr_mode; /**< Specifies addressing mode */
- i2c_dual_addr_t dual_addr; /**< Specifies if dual addressing mode is selected */
- uint32_t own_addr2; /**< Specifies the second device own address */
- i2c_general_addr_t general_call; /**< Specifies if general call mode is selected */
- i2c_nostretch_t no_stretch; /**< Specifies if nostretch mode is selected */
-} i2c_init_t;
-
-/**
- * @brief I2C handle Structure definition
- */
-typedef struct i2c_handle_s
-{
- I2C_TypeDef *perh; /**< I2C registers base address */
- i2c_init_t init; /**< I2C communication parameters */
- uint8_t *p_buff; /**< Pointer to I2C transfer buffer */
- uint16_t xfer_size; /**< I2C transfer size */
- __IO uint16_t xfer_count; /**< I2C transfer counter */
-#ifdef ALD_DMA
- dma_handle_t hdmatx; /**< I2C Tx DMA handle parameters */
- dma_handle_t hdmarx; /**< I2C Rx DMA handle parameters */
-#endif
- lock_state_t lock; /**< I2C locking object */
- __IO i2c_state_t state; /**< I2C communication state */
- __IO i2c_mode_t mode; /**< I2C communication mode */
- __IO uint32_t error_code; /**< I2C Error code */
-
- void (*master_tx_cplt_cbk)(struct i2c_handle_s *arg); /**< Master Tx completed callback */
- void (*master_rx_cplt_cbk)(struct i2c_handle_s *arg); /**< Master Rx completed callback */
- void (*slave_tx_cplt_cbk)(struct i2c_handle_s *arg); /**< Slave Tx completed callback */
- void (*slave_rx_cplt_cbk)(struct i2c_handle_s *arg); /**< Slave Rx completed callback */
- void (*mem_tx_cplt_cbk)(struct i2c_handle_s *arg); /**< Tx to Memory completed callback */
- void (*mem_rx_cplt_cbk)(struct i2c_handle_s *arg); /**< Rx from Memory completed callback */
- void (*error_callback)(struct i2c_handle_s *arg); /**< Error callback */
-} i2c_handle_t;
-
-/**
- * @}
- */
-
-/** @defgroup I2C_Public_Macro I2C Public Macros
- * @{
- */
-#define I2C_RESET_HANDLE_STATE(x) ((x)->state = I2C_STATE_RESET)
-#define I2C_CLEAR_ADDRFLAG(x) \
-do { \
- __IO uint32_t tmpreg; \
- tmpreg = (x)->perh->STAT1; \
- tmpreg = (x)->perh->STAT2; \
- UNUSED(tmpreg); \
-} while (0)
-#define __I2C_CLEAR_STOPFLAG(x) \
-do { \
- __IO uint32_t tmpreg; \
- tmpreg = (x)->perh->STAT1; \
- tmpreg = SET_BIT((x)->perh->CON1, I2C_CON1_PEN); \
- UNUSED(tmpreg); \
-} while (0)
-#define I2C_ENABLE(x) (SET_BIT((x)->perh->CON1, I2C_CON1_PEN_MSK))
-#define I2C_DISABLE(x) (CLEAR_BIT((x)->perh->CON1, I2C_CON1_PEN_MSK))
-/**
- * @}
- */
-
-/** @defgroup I2C_Private_Macro I2C Private Macros
- * @{
- */
-#define IS_I2C_TYPE(x) (((x) == I2C0) || \
- ((x) == I2C1))
-#define IS_I2C_ADDRESSING_MODE(x) (((x) == I2C_ADDR_7BIT) || \
- ((x) == I2C_ADDR_10BIT))
-#define IS_I2C_DUAL_ADDRESS(x) (((x) == I2C_DUALADDR_DISABLE) || \
- ((x) == I2C_DUALADDR_ENABLE))
-#define IS_I2C_GENERAL_CALL(x) (((x) == I2C_GENERALCALL_DISABLE) || \
- ((x) == I2C_GENERALCALL_ENABLE))
-#define IS_I2C_MEMADD_size(x) (((x) == I2C_MEMADD_SIZE_8BIT) || \
- ((x) == I2C_MEMADD_SIZE_16BIT))
-#define IS_I2C_NO_STRETCH(x) (((x) == I2C_NOSTRETCH_DISABLE) || \
- ((x) == I2C_NOSTRETCH_ENABLE))
-#define IS_I2C_OWN_ADDRESS1(x) (((x) & (uint32_t)(0xFFFFFC00)) == 0)
-#define IS_I2C_OWN_ADDRESS2(x) (((x) & (uint32_t)(0xFFFFFF01)) == 0)
-#define IS_I2C_CLOCK_SPEED(x) (((x) > 0) && ((x) <= I2C_FAST_MODE_MAX_CLK))
-#define IS_I2C_DUTY_CYCLE(x) (((x) == I2C_DUTYCYCLE_2) || \
- ((x) == I2C_DUTYCYCLE_16_9))
-#define IS_I2C_IT_TYPE(x) (((x) == I2C_IT_BUF) || \
- ((x) == I2C_IT_EVT) || \
- ((x) == I2C_IT_ERR))
-#define IS_I2C_FLAG(x) (((x) == I2C_FLAG_SB) || \
- ((x) == I2C_FLAG_ADDR) || \
- ((x) == I2C_FLAG_BTF) || \
- ((x) == I2C_FLAG_ADD10) || \
- ((x) == I2C_FLAG_STOPF) || \
- ((x) == I2C_FLAG_RXNE) || \
- ((x) == I2C_FLAG_TXE) || \
- ((x) == I2C_FLAG_BERR) || \
- ((x) == I2C_FLAG_ARLO) || \
- ((x) == I2C_FLAG_AF) || \
- ((x) == I2C_FLAG_OVR) || \
- ((x) == I2C_FLAG_PECERR) || \
- ((x) == I2C_FLAG_TIMEOUT) || \
- ((x) == I2C_FLAG_SMBALERT) || \
- ((x) == I2C_FLAG_MSL) || \
- ((x) == I2C_FLAG_BUSY) || \
- ((x) == I2C_FLAG_TRA) || \
- ((x) == I2C_FLAG_GENCALL) || \
- ((x) == I2C_FLAG_SMBDEFAULT) || \
- ((x) == I2C_FLAG_SMBHOST) || \
- ((x) == I2C_FLAG_DUALF))
-
-#define I2C_FREQ_RANGE(x) ((x) / 1000000)
-#define I2C_RISE_TIME(x, u) (((u) <= I2C_STANDARD_MODE_MAX_CLK) ? ((x) + 1) :\
- ((((x) * 300) / 1000) + 1))
-#define I2C_SPEED_STANDARD(x, y) (((((x) / ((y) << 1)) & I2C_CKCFG_CLKSET) < 4) ? 4:\
- ((x) / ((y) << 1)))
-#define I2C_SPEED_FAST(x, y, z) (((z) == I2C_DUTYCYCLE_2) ? ((x) / ((y) * 3)) :\
- (((x) / ((y) * 25)) | I2C_DUTYCYCLE_16_9))
-#define I2C_SPEED(x, y, z) (((y) <= 100000) ? (I2C_SPEED_STANDARD((x), (y))) :\
- ((I2C_SPEED_FAST((x), (y), (z)) & I2C_CKCFG_CLKSET) == 0) ? 1 : \
- ((I2C_SPEED_FAST((x), (y), (z))) | I2C_CKCFG_CLKMOD))
-#define I2C_MEM_ADD_MSB(x) ((uint8_t)((uint16_t)(((uint16_t)((x) &\
- (uint16_t)(0xFF00))) >> 8)))
-#define I2C_MEM_ADD_LSB(x) ((uint8_t)((uint16_t)((x) & (uint16_t)(0x00FF))))
-#define I2C_7BIT_ADD_WRITE(x) ((uint8_t)((x) & (~I2C_ADDR1_ADDH0)))
-#define I2C_7BIT_ADD_READ(x) ((uint8_t)((x) | I2C_ADDR1_ADDH0))
-#define I2C_10BIT_ADDRESS(x) ((uint8_t)((uint16_t)((x) & (uint16_t)(0x00FF))))
-#define I2C_10BIT_HEADER_WRITE(x) ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((x) &\
- (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF0))))
-#define I2C_10BIT_HEADER_READ(x) ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((x) &\
- (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF1))))
-/**
- * @}
- */
-
-/** @addtogroup I2C_Public_Functions
- * @{
- */
-
-/** @addtogroup I2C_Public_Functions_Group1
- * @{
- */
-ald_status_t i2c_init(i2c_handle_t *hperh);
-ald_status_t i2c_reset(i2c_handle_t *hperh);
-
-/**
- * @}
- */
-
-/** @addtogroup I2C_Public_Functions_Group2
- * @{
- */
-/** Blocking mode: Polling */
-ald_status_t i2c_master_send(i2c_handle_t *hperh, uint16_t dev_addr,
- uint8_t *buf, uint16_t size, uint32_t timeout);
-ald_status_t i2c_master_recv(i2c_handle_t *hperh, uint16_t dev_addr,
- uint8_t *buf, uint16_t size, uint32_t timeout);
-ald_status_t i2c_slave_send(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout);
-ald_status_t i2c_slave_recv(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout);
-ald_status_t i2c_mem_write(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr,
- i2c_addr_size_t add_size, uint8_t *buf, uint16_t size, uint32_t timeout);
-ald_status_t i2c_mem_read(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr,
- i2c_addr_size_t add_size, uint8_t *buf, uint16_t size, uint32_t timeout);
-ald_status_t i2c_is_device_ready(i2c_handle_t *hperh, uint16_t dev_addr, uint32_t trials, uint32_t timeout);
-
-/** Non-Blocking mode: Interrupt */
-ald_status_t i2c_master_send_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t *buf, uint16_t size);
-ald_status_t i2c_master_recv_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t *buf, uint16_t size);
-ald_status_t i2c_slave_send_by_it(i2c_handle_t *hperh, uint8_t *buf, uint16_t size);
-ald_status_t i2c_slave_recv_by_it(i2c_handle_t *hperh, uint8_t *buf, uint16_t size);
-ald_status_t i2c_mem_write_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr,
- i2c_addr_size_t add_size, uint8_t *buf, uint16_t size);
-ald_status_t i2c_mem_read_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr,
- i2c_addr_size_t add_size, uint8_t *buf, uint16_t size);
-
-#ifdef ALD_DMA
-/** Non-Blocking mode: DMA */
-ald_status_t i2c_master_send_by_dma(i2c_handle_t *hperh, uint16_t dev_addr,
- uint8_t *buf, uint16_t size, uint8_t channel);
-ald_status_t i2c_master_recv_by_dma(i2c_handle_t *hperh, uint16_t dev_addr,
- uint8_t *buf, uint16_t size, uint8_t channel);
-ald_status_t i2c_slave_send_by_dma(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel);
-ald_status_t i2c_slave_recv_by_dma(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel);
-ald_status_t i2c_mem_write_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, i2c_addr_size_t add_size,
- uint8_t *buf, uint16_t size, uint8_t channel);
-ald_status_t i2c_mem_read_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr,
- i2c_addr_size_t add_size, uint8_t *buf, uint16_t size, uint8_t channel);
-#endif
-/**
- * @}
- */
-
-/** @addtogroup I2C_Public_Functions_Group3
- * @{
- */
-i2c_state_t i2c_get_state(i2c_handle_t *hperh);
-uint32_t i2c_get_error(i2c_handle_t *hperh);
-flag_status_t i2c_get_flag_status(i2c_handle_t *hperh, i2c_flag_t flag);
-flag_status_t i2c_get_it_status(i2c_handle_t *hperh, i2c_interrupt_t it);
-void i2c_clear_flag_status(i2c_handle_t *hperh, i2c_flag_t flag);
-/**
- * @}
- */
-
-/** @addtogroup I2C_Public_Functions_Group4
- * @{
- */
-void i2c_interrupt_config(i2c_handle_t *hperh, i2c_interrupt_t it, type_func_t state);
-void i2c_ev_irq_handler(i2c_handle_t *hperh);
-void i2c_er_irq_handler(i2c_handle_t *hperh);
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __ALD_I2C_H__ */
diff --git a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_pis.h b/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_pis.h
deleted file mode 100644
index 3b7c12cf0f9fe75de5a6703d335d4fd32ab77f66..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_pis.h
+++ /dev/null
@@ -1,633 +0,0 @@
-/**
- *********************************************************************************
- *
- * @file ald_pis.h
- * @brief Header file of PIS driver.
- *
- * @version V1.0
- * @date 27 Nov 2017
- * @author AE Team
- * @note
- *
- * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
- *
- *********************************************************************************
- */
-
-#ifndef __ALD_PIS_H__
-#define __ALD_PIS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "utils.h"
-
-
-/** @addtogroup ES32FXXX_ALD
- * @{
- */
-
-/** @addtogroup PIS
- * @{
- */
-
-/** @defgroup PIS_Public_Types PIS Public Types
- * @{
- */
-
-/**
- * @brief Producer entry
- */
-typedef enum
-{
- PIS_NON = 0x0, /**< No async */
- PIS_GPIO_PIN0 = 0x10, /**< Pin0, level,support async */
- PIS_GPIO_PIN1 = 0x11, /**< Pin1, level,support async */
- PIS_GPIO_PIN2 = 0x12, /**< Pin2, level,support async */
- PIS_GPIO_PIN3 = 0x13, /**< Pin3, level,support async */
- PIS_GPIO_PIN4 = 0x14, /**< Pin4, level,support async */
- PIS_GPIO_PIN5 = 0x15, /**< Pin5, level,support async */
- PIS_GPIO_PIN6 = 0x16, /**< Pin6, level,support async */
- PIS_GPIO_PIN7 = 0x17, /**< Pin7, level,support async */
- PIS_GPIO_PIN8 = 0x18, /**< Pin8, level,support async */
- PIS_GPIO_PIN9 = 0x19, /**< Pin9, level,support async */
- PIS_GPIO_PIN10 = 0x1a, /**< Pin10, level,support async */
- PIS_GPIO_PIN11 = 0x1b, /**< Pin11, level,support async */
- PIS_GPIO_PIN12 = 0x1c, /**< Pin12, level,support async */
- PIS_GPIO_PIN13 = 0x1d, /**< Pin13, level,support async */
- PIS_GPIO_PIN14 = 0x1e, /**< Pin14, level,support async */
- PIS_GPIO_PIN15 = 0x1f, /**< Pin15, level,support async */
- PIS_ACMP_OUT0 = 0x30, /**< Acmp0 output, level,support async */
- PIS_ACMP_OUT1 = 0x31, /**< Acmp1 output, level,support async */
- PIS_DAC0_CH0 = 0x40, /**< Dac0 channel 0, pclk2 pulse,support async */
- PIS_DAC0_CH1 = 0x41, /**< Dac0 channel 1, pclk2 pulse,support async */
- PIS_ADC0_INJECT = 0x60, /**< Adc0 inject, pclk2 pulse,support async */
- PIS_ADC0_REGULAT = 0x61, /**< Adc0 regulat, pclk2 pulse,support async */
- PIS_ADC0_WINDOW = 0x62, /**< Adc0 window, no have */
- PIS_LVD = 0x70, /**< Lvd, level,support async */
- PIS_UART0_ASY_SEND = 0x80, /**< Uart0 asy send, pulse,support async */
- PIS_UART0_ASY_RECV = 0x81, /**< Uart0 asy recv, pulse,support async */
- PIS_UART0_IRDAOUT = 0x82, /**< Uart0 irdaout, level,support async */
- PIS_UART0_RTSOUT = 0x83, /**< Uart0 rtsout, level,support async */
- PIS_UART0_TXOUT = 0x84, /**< Uart0 txout, level,support async */
- PIS_UART0_SYN_SEND = 0x85, /**< Uart0 syn send, pulse,support async */
- PIS_UART0_SYN_RECV = 0x86, /**< Uart0 syn recv, pulse,support async */
- PIS_UART1_ASY_SEND = 0x90, /**< Uart1 asy send, pulse,support async */
- PIS_UART1_ASY_RECV = 0x91, /**< Uart1 asy recv, pulse,support async */
- PIS_UART1_IRDA = 0x92, /**< Uart1 irdaout, level,support async */
- PIS_UART1_RTS = 0x93, /**< Uart1 rtsout, level,support async */
- PIS_UART1_TXOUT = 0x94, /**< Uart1 txout, level,support async */
- PIS_UART1_SYN_SEND = 0x95, /**< Uart1 syn send, pulse,support async */
- PIS_UART1_SYN_RECV = 0x96, /**< Uart1 syn recv, pulse,support async */
- PIS_UART2_ASY_SEND = 0xa0, /**< Uart2 asy send, pulse,support async */
- PIS_UART2_ASY_RECV = 0xa1, /**< Uart2 asy recv, pulse,support async */
- PIS_UART2_IRDA = 0xa2, /**< Uart2 irdaout, level,support async */
- PIS_UART2_RTS = 0xa3, /**< Uart2 rtsout, level,support async */
- PIS_UART2_TXOUT = 0xa4, /**< Uart2 txout, level,support async */
- PIS_UART2_SYN_SEND = 0xa5, /**< Uart2 syn send, pulse,support async */
- PIS_UART2_SYN_RECV = 0xa6, /**< Uart2 syn recv, pulse,support async */
- PIS_UART3_ASY_SEND = 0xb1, /**< Uart3 asy send, pulse,support async */
- PIS_UART3_ASY_RECV = 0xb2, /**< Uart3 asy recv, pulse,support async */
- PIS_UART3_IRDA = 0xb3, /**< Uart3 irdaout, level,support async */
- PIS_UART3_RTS = 0xb4, /**< Uart3 rtsout, level,support async */
- PIS_UART3_TXOUT = 0xb5, /**< Uart3 txout, level,support async */
- PIS_UART3_SYN_SEND = 0xb6, /**< Uart3 syn send, pulse,support async */
- PIS_UART3_SYN_RECV = 0xb7, /**< Uart3 syn recv, pulse,support async */
- PIS_EUART0_RECV = 0xc0, /**< Euart0 recv, plck1 pulse */
- PIS_EUART0_SEND = 0xc1, /**< Euart0 send, plck1 pulse */
- PIS_EUART0_TXOUT = 0xc2, /**< Euart0 txout, plck1 level */
- PIS_EUART1_RECV = 0xd0, /**< Euart1 recv, plck1 pulse */
- PIS_EUART1_SEND = 0xd1, /**< Euart1 send, plck1 pulse */
- PIS_EUART1_TXOUT = 0xd2, /**< Euart1 txout, plck1 level */
- PIS_SPI0_RECV = 0xe0, /**< Spi0 recv, plck1 pulse */
- PIS_SPI0_SEND = 0xe1, /**< Spi0 send, plck1 pulse */
- PIS_SPI0_NE = 0xe2, /**< Spi0 ne, plck1 level */
- PIS_SPI1_RECV = 0xf0, /**< Spi1 recv, plck1 pulse */
- PIS_SPI1_SEND = 0xf1, /**< Spi1 send, plck1 pulse */
- PIS_SPI1_NE = 0xf2, /**< Spi1 ne, plck1 level */
- PIS_I2C0_RECV = 0x100, /**< I2c0 recv, plck1 level */
- PIS_I2C0_SEND = 0x101, /**< I2c0 send, plck1 level */
- PIS_I2C1_RECV = 0x110, /**< I2c1 recv, plck1 level */
- PIS_I2C1_SEND = 0x111, /**< I2c1 send, plck1 level */
- PIS_TIMER0_UPDATA = 0x120, /**< Timer0 updata, plck1 pulse */
- PIS_TIMER0_TRIG = 0x121, /**< Timer0 trig, plck1 pulse */
- PIS_TIMER0_INPUT = 0x122, /**< Timer0 input, plck1 pulse */
- PIS_TIMER0_OUTPUT = 0x123, /**< Timer0 output, plck1 pulse */
- PIS_TIMER1_UPDATA = 0x130, /**< Timer1 updata, plck1 pulse */
- PIS_TIMER1_TRIG = 0x131, /**< Timer1 trig, plck1 pulse */
- PIS_TIMER1_INPUT = 0x132, /**< Timer1 input, plck1 pulse */
- PIS_TIMER1_OUTPUT = 0x133, /**< Timer1 output, plck1 pulse */
- PIS_TIMER2_UPDATA = 0x140, /**< Timer2 updata, plck1 pulse */
- PIS_TIMER2_TRIG = 0x141, /**< Timer2 trig, plck1 pulse */
- PIS_TIMER2_INPUT = 0x142, /**< Timer2 input, plck1 pulse */
- PIS_TIMER2_OUTPUT = 0x143, /**< Timer2 output, plck1 pulse */
- PIS_TIMER3_UPDATA = 0x150, /**< Timer0 updata, plck1 pulse */
- PIS_TIMER3_TRIG = 0x151, /**< Timer0 trig, plck1 pulse */
- PIS_TIMER3_INPUT = 0x152, /**< Timer0 input, plck1 pulse */
- PIS_TIMER3_OUTPUT = 0x153, /**< Timer0 output, plck1 pulse */
- PIS_RTC_CLOCK = 0x160, /**< Rtc clock, pulse,support async */
- PIS_RTC_ALARM = 0x161, /**< Rtc alarm, pulse,support async */
- PIS_LPTIM0_SYN_UPDATA = 0x170, /**< Lptimer0 syn updata, pulse,support async */
- PIS_LPTIM0_ASY_UPDATA = 0x171, /**< Lptimer0 asy updata, pulse,support async */
- PIS_LPUART0_ASY_RECV = 0x180, /**< Lpuart0 asy recv, pulse,support async */
- PIS_LPUART0_ASY_SEND = 0x181, /**< Lpuart0 asy send, pulse,support async */
- PIS_LPUART0_SYN_RECV = 0x182, /**< Lpuart0 syn recv, pulse,support async */
- PIS_LPUART0_SYN_SEND = 0x183, /**< Lpuart0 syn recv, pulse,support async */
- PIS_DMA = 0x190, /**< Dma, pulse,support async */
- PIS_ADC1_INJECT = 0x1a0, /**< Adc1 inject, pclk2 pulse,support async */
- PIS_ADC1_REGULAT = 0x1a1, /**< Adc1 regulat, pclk2 pulse,support async */
- PIS_ADC1_WINDOW = 0x1a2, /**< Adc1 window, no have */
-} pis_src_t;
-
-/**
- * @brief Consumer entry
- */
-typedef enum
-{
- PIS_CH0_TIMER0_BRKIN = 0x4000, /**< Timer0 brkin */
- PIS_CH0_SPI1_CLK = 0xF010, /**< Spi1 clk */
- PIS_CH0_LPTIM0_EXT0 = 0x0030, /**< Lptimer0 ext0 */
- PIS_CH0_ADC1_NORMAL = 0x0030, /**< Adc1 normal */
- PIS_CH1_TIMER0_CH1IN = 0x0001, /**< Timer0 ch1in */
- PIS_CH1_TIMER2_CH1IN = 0x0101, /**< Timer2 ch1in */
- PIS_CH1_TIMER3_CH1IN = 0x8101, /**< Timer3 ch1in */
- PIS_CH1_LPTIM0_EXT1 = 0x0031, /**< Lptime0 ext1 */
- PIS_CH1_UART0_RX_IRDA = 0x0011, /**< Uart0 rx irda */
- PIS_CH1_ADC1_INSERT = 0x0031, /**< Adc1 insert */
- PIS_CH2_TIMER0_CH2IN = 0x1002, /**< Timer0 ch2in */
- PIS_CH2_TIMER2_CH2IN = 0x1102, /**< Timer2 ch2in */
- PIS_CH2_TIMER3_CH2IN = 0x9102, /**< Timer3 ch2in */
- PIS_CH2_LPTIM0_EXT2 = 0x0032, /**< Lptime0 ext2 */
- PIS_CH2_UART1_RX_IRDA = 0x1012, /**< Uart1 rx irda */
- PIS_CH3_TIMER0_CH3IN = 0x2003, /**< Timer0 ch3in */
- PIS_CH3_LPTIM0_EXT3 = 0x0033, /**< Lptime0 ext3 */
- PIS_CH3_UART2_RX_IRDA = 0x2013, /**< Uart2 rx irda */
- PIS_CH4_TIMER0_CH4IN = 0x0004, /**< Timer0 ch4in */
- PIS_CH4_TIMER0_ITR0 = 0x0034, /**< Timer0 itr0 */
- PIS_CH4_TIMER2_ITR0 = 0x0034, /**< Timer2 itr0 */
- PIS_CH4_TIMER3_ITR0 = 0x0034, /**< Timer3 itr0 */
- PIS_CH4_LPTIM0_EXT4 = 0x4034, /**< Lptime0 ext4 */
- PIS_CH4_UART3_RX_IRDA = 0x3014, /**< Uart3 rx irda */
- PIS_CH5_SPI0_RX = 0xC015, /**< Spi0 rx */
- PIS_CH5_LPTIM0_EXT5 = 0x0035, /**< Lptime0 ext5 */
- PIS_CH5_EUART0_RX = 0x6015, /**< Euart0 rx */
- PIS_CH5_TIMER0_ITR1 = 0x0035, /**< Timer0 itr1 */
- PIS_CH5_TIMER2_ITR1 = 0x0035, /**< Timer2 itr1 */
- PIS_CH5_TIMER3_ITR1 = 0x0035, /**< Timer3 itr1 */
- PIS_CH6_SPI0_CLK = 0xD016, /**< Spi0 clk */
- PIS_CH6_ADC0_NORMAL = 0x0036, /**< Adc0 normal */
- PIS_CH6_LPTIM0_EXT6 = 0x0036, /**< Lptime0 ext6 */
- PIS_CH6_EUART1_RX = 0x7016, /**< Euart1 rx */
- PIS_CH6_TIMER0_ITR2 = 0x0036, /**< Timer0 itr2 */
- PIS_CH6_TIMER2_ITR2 = 0x0036, /**< Timer2 itr2 */
- PIS_CH6_TIMER3_ITR2 = 0x0036, /**< Timer3 itr2 */
- PIS_CH6_DAC_CH1 = 0x0036, /**< Dac channel 1 */
- PIS_CH7_SPI1_RX = 0xE017, /**< Spi1 rx */
- PIS_CH7_ADC0_INSERT = 0x0037, /**< Adc0 insert */
- PIS_CH7_LPTIM0_EXT7 = 0x0037, /**< Lptime0 ext7 */
- PIS_CH7_DMA = 0x0037, /**< Dma */
- PIS_CH7_TIMER0_ITR3 = 0x0037, /**< Timer0 itr3 */
- PIS_CH7_TIMER2_ITR3 = 0x0037, /**< Timer2 itr3 */
- PIS_CH7_TIMER3_ITR3 = 0x0037, /**< Timer3 itr3 */
- PIS_CH7_LPUART_RX = 0x8017, /**< Lpuart rx */
- PIS_CH7_DAC_CH0 = 0x0037, /**< Dac channel 0 */
-} pis_trig_t;
-
-/**
- * @brief Clock select
- */
-typedef enum
-{
- PIS_CLK_PCLK1 = 0, /**< Pclock1 */
- PIS_CLK_PCLK2 = 1, /**< Pclock2 */
- PIS_CLK_SYS = 2, /**< Sys clock */
- PIS_CLK_LP = 3, /**< Low power clock */
-} pis_clock_t;
-
-/**
- * @brief Level select
- */
-typedef enum
-{
- PIS_EDGE_NONE = 0, /**< None edge */
- PIS_EDGE_UP = 1, /**< Up edge */
- PIS_EDGE_DOWN = 2, /**< Down edge */
- PIS_EDGE_UP_DOWN = 3, /**< Up and down edge */
-} pis_edge_t;
-
-/**
- * @brief Output style
- */
-typedef enum
-{
- PIS_OUT_LEVEL = 0, /**< Level */
- PIS_OUT_PULSE = 1, /**< Pulse */
-} pis_output_t;
-/**
- * @brief Sync select
- */
-typedef enum
-{
- PIS_SYN_DIRECT = 0, /**< Direct */
- PIS_SYN_ASY_PCLK1 = 1, /**< Asy pclk1 */
- PIS_SYN_ASY_PCLK2 = 2, /**< Asy pclk2 */
- PIS_SYN_ASY_PCLK = 3, /**< Asy pclk */
- PIS_SYN_PCLK2_PCLK1 = 4, /**< Pclk2 to pclk1 */
- PIS_SYN_PCLK1_PCLK2 = 5, /**< Pclk1 to pclk2 */
- PIS_SYN_PCLK12_SYS = 6, /**< Pclk1 or pclk2 to sysclk */
-} pis_syncsel_t;
-
-/**
- * @brief Pis channel
- */
-typedef enum
-{
- PIS_CH_0 = 0, /**< Channel 0 */
- PIS_CH_1 = 1, /**< Channel 1 */
- PIS_CH_2 = 2, /**< Channel 2 */
- PIS_CH_3 = 3, /**< Channel 3 */
- PIS_CH_4 = 4, /**< Channel 4 */
- PIS_CH_5 = 5, /**< Channel 5 */
- PIS_CH_6 = 6, /**< Channel 6 */
- PIS_CH_7 = 7, /**< Channel 7 */
-} pis_ch_t;
-
-/**
- * @brief Pis output channel
- */
-typedef enum
-{
- PIS_OUT_CH_0 = 0, /**< Channel 0 */
- PIS_OUT_CH_1 = 1, /**< Channel 1 */
- PIS_OUT_CH_2 = 2, /**< Channel 2 */
- PIS_OUT_CH_3 = 3, /**< Channel 3 */
-} pis_out_ch_t;
-
-/**
- * @brief Indirect value,no care of it.
- */
-typedef enum
-{
- PIS_CON_0 = 0, /**< Con 0 */
- PIS_CON_1 = 1, /**< Con 1 */
- PIS_CON_NONE = 2, /**< None */
-} pis_con_t;
-
-/**
- * @brief Indirect value,no care of it.
- */
-typedef union
-{
- struct
- {
- uint8_t ch : 4; /**< Channel */
- uint8_t con : 4; /**< Contorl */
- uint8_t shift : 8; /**< Shift */
- };
- uint16_t HalfWord;
-} pis_divide_t;
-
-/**
- * @brief PIS state structures definition
- */
-typedef enum
-{
- PIS_STATE_RESET = 0x00, /**< Peripheral is not initialized */
- PIS_STATE_READY = 0x01, /**< Peripheral Initialized and ready for use */
- PIS_STATE_BUSY = 0x02, /**< An internal process is ongoing */
- PIS_STATE_TIMEOUT = 0x03, /**< Timeout state */
- PIS_STATE_ERROR = 0x04, /**< Error */
-} pis_state_t;
-
-/**
- * @brief PIS modulate target
- */
-typedef enum
-{
- PIS_UART0_TX = 0, /**< Modulate uart0 tx */
- PIS_UART1_TX = 1, /**< Modulate uart1 tx */
- PIS_UART2_TX = 2, /**< Modulate uart2 tx */
- PIS_UART3_TX = 3, /**< Modulate uart3 tx */
- PIS_LPUART0_TX = 4, /**< Modulate lpuart0 tx */
-} pis_modu_targ_t;
-
-/**
- * @brief PIS modulate level
- */
-typedef enum
-{
- PIS_LOW_LEVEL = 0, /**< Modulate low level */
- PIS_HIGH_LEVEL = 1, /**< Modulate high level */
-} pis_modu_level_t;
-
-/**
- * @brief PIS modulate source
- */
-typedef enum
-{
- PIS_SRC_NONE = 0, /**< Stop modulate */
- PIS_SRC_TIMER0 = 1, /**< Modulate source is TIMER0 */
- PIS_SRC_TIMER1 = 2, /**< Modulate source is TIMER1 */
- PIS_SRC_TIMER2 = 3, /**< Modulate source is TIMER2 */
- PIS_SRC_TIMER3 = 4, /**< Modulate source is TIMER3 */
- PIS_SRC_TIMER6 = 5, /**< Modulate source is TIMER6 */
- PIS_SRC_TIMER7 = 6, /**< Modulate source is TIMER7 */
- PIS_SRC_LPTIM0 = 7, /**< Modulate source is LPTIM0 */
- PIS_SRC_BUZ = 8, /**< Modulate source is buz */
-} pis_modu_src_t;
-
-/**
- * @brief PIS modulate channel
- */
-typedef enum
-{
- PIS_TIMER_CH1 = 0, /**< Src is TIMERx and choose channel 1 */
- PIS_TIMER_CH2 = 1, /**< Src is TIMERx and choose channel 2 */
- PIS_TIMER_CH3 = 2, /**< Src is TIMERx and choose channel 3 */
- PIS_TIMER_CH4 = 3, /**< Src is TIMERx and choose channel 4 */
-} pis_modu_channel_t;
-
-/**
- * @brief PIS init structure definition
- */
-typedef struct
-{
- pis_src_t producer_src; /**< Producer entry */
- pis_clock_t producer_clk; /**< Producer module clock */
- pis_edge_t producer_edge; /**< Producer module pin output edge */
- pis_trig_t consumer_trig; /**< Consumer entry */
- pis_clock_t consumer_clk; /**< Consumer clock */
-} pis_init_t;
-
-/**
- * @brief PIS modulate config structure definition
- */
-typedef struct
-{
- pis_modu_targ_t target; /**< Modulate target */
- pis_modu_level_t level; /**< Modulate level */
- pis_modu_src_t src; /**< Modulate src */
- pis_modu_channel_t channel; /**< Modulate channel */
-} pis_modulate_config_t;
-
-/**
- * @brief PIS Handle Structure definition
- */
-typedef struct pis_handle_s
-{
- PIS_TypeDef *perh; /**< Register base address */
- pis_init_t init; /**< PIS required parameters */
- pis_ch_t consumer_ch; /**< Indirect value, no care of it */
- pis_con_t consumer_con; /**< Indirect value, no care of it */
- uint8_t consumer_pos; /**< Indirect value, no care of it */
- uint32_t check_info; /**< When destroy a handle ,user need check whether is right that ready to destroy */
- lock_state_t lock; /**< Locking object */
- pis_state_t state; /**< PIS operation state */
-} pis_handle_t;
-/**
- * @}
- */
-
-
-/** @defgroup PIS_Private_Macros PIS Private Macros
- * @{
- */
-#define IS_PIS(x) (((x) == PIS))
-#define IS_PIS_SRC(x) (((x) == PIS_NON) || \
- ((x) == PIS_GPIO_PIN0) || \
- ((x) == PIS_GPIO_PIN1) || \
- ((x) == PIS_GPIO_PIN2) || \
- ((x) == PIS_GPIO_PIN3) || \
- ((x) == PIS_GPIO_PIN4) || \
- ((x) == PIS_GPIO_PIN5) || \
- ((x) == PIS_GPIO_PIN6) || \
- ((x) == PIS_GPIO_PIN7) || \
- ((x) == PIS_GPIO_PIN8) || \
- ((x) == PIS_GPIO_PIN9) || \
- ((x) == PIS_GPIO_PIN10) || \
- ((x) == PIS_GPIO_PIN11) || \
- ((x) == PIS_GPIO_PIN12) || \
- ((x) == PIS_GPIO_PIN13) || \
- ((x) == PIS_GPIO_PIN14) || \
- ((x) == PIS_GPIO_PIN15) || \
- ((x) == PIS_ACMP_OUT0) || \
- ((x) == PIS_ACMP_OUT1) || \
- ((x) == PIS_DAC0_CH1) || \
- ((x) == PIS_ACMP_OUT1) || \
- ((x) == PIS_ADC0_INJECT) || \
- ((x) == PIS_ADC0_REGULAT) || \
- ((x) == PIS_ADC0_WINDOW) || \
- ((x) == PIS_LVD) || \
- ((x) == PIS_UART0_ASY_SEND) || \
- ((x) == PIS_UART0_ASY_RECV) || \
- ((x) == PIS_UART0_IRDAOUT) || \
- ((x) == PIS_UART0_RTSOUT) || \
- ((x) == PIS_UART0_TXOUT) || \
- ((x) == PIS_UART0_SYN_SEND) || \
- ((x) == PIS_UART0_SYN_RECV) || \
- ((x) == PIS_UART1_ASY_SEND) || \
- ((x) == PIS_UART1_ASY_RECV) || \
- ((x) == PIS_UART1_IRDA) || \
- ((x) == PIS_UART1_RTS) || \
- ((x) == PIS_UART1_TXOUT) || \
- ((x) == PIS_UART1_SYN_SEND) || \
- ((x) == PIS_UART1_SYN_RECV) || \
- ((x) == PIS_UART2_ASY_SEND) || \
- ((x) == PIS_UART2_ASY_RECV) || \
- ((x) == PIS_UART2_IRDA) || \
- ((x) == PIS_UART2_RTS) || \
- ((x) == PIS_UART2_TXOUT) || \
- ((x) == PIS_UART2_SYN_SEND) || \
- ((x) == PIS_UART2_SYN_RECV) || \
- ((x) == PIS_UART3_ASY_SEND) || \
- ((x) == PIS_UART3_ASY_RECV) || \
- ((x) == PIS_UART3_IRDA) || \
- ((x) == PIS_UART3_RTS) || \
- ((x) == PIS_UART3_TXOUT) || \
- ((x) == PIS_UART3_SYN_SEND) || \
- ((x) == PIS_UART3_SYN_RECV) || \
- ((x) == PIS_EUART0_RECV) || \
- ((x) == PIS_EUART0_SEND) || \
- ((x) == PIS_EUART0_TXOUT) || \
- ((x) == PIS_EUART1_RECV) || \
- ((x) == PIS_EUART1_SEND) || \
- ((x) == PIS_EUART1_TXOUT) || \
- ((x) == PIS_SPI0_RECV) || \
- ((x) == PIS_SPI0_SEND) || \
- ((x) == PIS_SPI0_NE) || \
- ((x) == PIS_SPI1_RECV) || \
- ((x) == PIS_SPI1_SEND) || \
- ((x) == PIS_SPI1_NE) || \
- ((x) == PIS_I2C0_RECV) || \
- ((x) == PIS_I2C0_SEND) || \
- ((x) == PIS_I2C1_RECV) || \
- ((x) == PIS_I2C1_SEND) || \
- ((x) == PIS_TIMER0_UPDATA) || \
- ((x) == PIS_TIMER0_TRIG) || \
- ((x) == PIS_TIMER0_INPUT) || \
- ((x) == PIS_TIMER0_OUTPUT) || \
- ((x) == PIS_TIMER1_UPDATA) || \
- ((x) == PIS_TIMER1_TRIG) || \
- ((x) == PIS_TIMER1_INPUT) || \
- ((x) == PIS_TIMER1_OUTPUT) || \
- ((x) == PIS_TIMER2_UPDATA) || \
- ((x) == PIS_TIMER2_TRIG) || \
- ((x) == PIS_TIMER2_INPUT) || \
- ((x) == PIS_TIMER2_OUTPUT) || \
- ((x) == PIS_TIMER3_UPDATA) || \
- ((x) == PIS_TIMER3_TRIG) || \
- ((x) == PIS_TIMER3_INPUT) || \
- ((x) == PIS_TIMER3_OUTPUT) || \
- ((x) == PIS_RTC_CLOCK) || \
- ((x) == PIS_RTC_ALARM) || \
- ((x) == PIS_LPTIM0_SYN_UPDATA) || \
- ((x) == PIS_LPTIM0_ASY_UPDATA) || \
- ((x) == PIS_LPUART0_ASY_RECV) || \
- ((x) == PIS_LPUART0_ASY_SEND) || \
- ((x) == PIS_LPUART0_SYN_RECV) || \
- ((x) == PIS_LPUART0_SYN_SEND) || \
- ((x) == PIS_DMA) || \
- ((x) == PIS_ADC1_INJECT) || \
- ((x) == PIS_ADC1_REGULAT) || \
- ((x) == PIS_ADC1_WINDOW))
-#define IS_PIS_TRIG(x) (((x) == PIS_CH0_TIMER0_BRKIN) || \
- ((x) == PIS_CH0_SPI1_CLK) || \
- ((x) == PIS_CH0_LPTIM0_EXT0) || \
- ((x) == PIS_CH0_ADC1_NORMAL) || \
- ((x) == PIS_CH1_TIMER0_CH1IN) || \
- ((x) == PIS_CH1_TIMER2_CH1IN) || \
- ((x) == PIS_CH1_TIMER3_CH1IN) || \
- ((x) == PIS_CH1_UART0_RX_IRDA) || \
- ((x) == PIS_CH1_LPTIM0_EXT1) || \
- ((x) == PIS_CH1_ADC1_INSERT) || \
- ((x) == PIS_CH2_TIMER0_CH2IN) || \
- ((x) == PIS_CH2_TIMER2_CH2IN) || \
- ((x) == PIS_CH2_TIMER3_CH2IN) || \
- ((x) == PIS_CH2_LPTIM0_EXT2) || \
- ((x) == PIS_CH2_UART1_RX_IRDA) || \
- ((x) == PIS_CH3_TIMER0_CH3IN) || \
- ((x) == PIS_CH3_LPTIM0_EXT3) || \
- ((x) == PIS_CH3_UART2_RX_IRDA) || \
- ((x) == PIS_CH4_TIMER0_CH4IN) || \
- ((x) == PIS_CH4_TIMER0_ITR0) || \
- ((x) == PIS_CH4_TIMER2_ITR0) || \
- ((x) == PIS_CH4_TIMER3_ITR0) || \
- ((x) == PIS_CH4_LPTIM0_EXT4) || \
- ((x) == PIS_CH4_UART3_RX_IRDA) || \
- ((x) == PIS_CH5_SPI0_RX) || \
- ((x) == PIS_CH5_LPTIM0_EXT5) || \
- ((x) == PIS_CH5_EUART0_RX) || \
- ((x) == PIS_CH5_TIMER0_ITR1) || \
- ((x) == PIS_CH5_TIMER2_ITR1) || \
- ((x) == PIS_CH5_TIMER3_ITR1) || \
- ((x) == PIS_CH6_SPI0_CLK) || \
- ((x) == PIS_CH6_ADC0_NORMAL) || \
- ((x) == PIS_CH6_LPTIM0_EXT6) || \
- ((x) == PIS_CH6_EUART1_RX) || \
- ((x) == PIS_CH6_TIMER0_ITR2) || \
- ((x) == PIS_CH6_TIMER2_ITR2) || \
- ((x) == PIS_CH6_TIMER3_ITR2) || \
- ((x) == PIS_CH6_DAC_CH1) || \
- ((x) == PIS_CH7_SPI1_RX) || \
- ((x) == PIS_CH7_ADC0_INSERT) || \
- ((x) == PIS_CH7_LPTIM0_EXT7) || \
- ((x) == PIS_CH7_DMA) || \
- ((x) == PIS_CH7_TIMER0_ITR3) || \
- ((x) == PIS_CH7_TIMER2_ITR3) || \
- ((x) == PIS_CH7_TIMER3_ITR3) || \
- ((x) == PIS_CH7_DAC_CH0) || \
- ((x) == PIS_CH7_LPUART_RX))
-#define IS_PIS_CLOCK(x) (((x) == PIS_CLK_PCLK1) || \
- ((x) == PIS_CLK_PCLK2) || \
- ((x) == PIS_CLK_SYS) || \
- ((x) == PIS_CLK_LP))
-#define IS_PIS_EDGE(x) (((x) == PIS_EDGE_NONE) || \
- ((x) == PIS_EDGE_UP) || \
- ((x) == PIS_EDGE_DOWN) || \
- ((x) == PIS_EDGE_UP_DOWN))
-#define IS_PIS_OUTPUT(x) (((x) == PIS_OUT_LEVEL) || \
- ((x) == PIS_OUT_PULSE))
-#define IS_PIS_OUPUT_CH(x) (((x) == PIS_OUT_CH_0) || \
- ((x) == PIS_OUT_CH_1) || \
- ((x) == PIS_OUT_CH_2) || \
- ((x) == PIS_OUT_CH_3))
-#define IS_PIS_MODU_TARGET(x) (((x) == PIS_UART0_TX) || \
- ((x) == PIS_UART1_TX) || \
- ((x) == PIS_UART2_TX) || \
- ((x) == PIS_UART3_TX) || \
- ((x) == PIS_LPUART0_TX))
-#define IS_PIS_MODU_LEVEL(x) (((x) == PIS_LOW_LEVEL) || \
- ((x) == PIS_HIGH_LEVEL))
-#define IS_PIS_MODU_SRC(x) (((x) == PIS_SRC_NONE) || \
- ((x) == PIS_SRC_TIMER0) || \
- ((x) == PIS_SRC_TIMER1) || \
- ((x) == PIS_SRC_TIMER2) || \
- ((x) == PIS_SRC_TIMER3) || \
- ((x) == PIS_SRC_TIMER6) || \
- ((x) == PIS_SRC_TIMER7) || \
- ((x) == PIS_SRC_LPTIM0) || \
- ((x) == PIS_SRC_BUZ))
-#define IS_PIS_MODU_CHANNEL(x) (((x) == PIS_TIMER_CH1) || \
- ((x) == PIS_TIMER_CH2) || \
- ((x) == PIS_TIMER_CH3) || \
- ((x) == PIS_TIMER_CH4))
-/**
- * @}
- */
-
-/** @addtogroup PIS_Public_Functions
- * @{
- */
-
-/** @addtogroup PIS_Public_Functions_Group1
- * @{
- */
-ald_status_t pis_create(pis_handle_t *hperh);
-ald_status_t pis_destroy(pis_handle_t *hperh);
-/**
- * @}
- */
-
-/** @addtogroup PIS_Public_Functions_Group2
- * @{
- */
-ald_status_t pis_output_start(pis_handle_t *hperh, pis_out_ch_t ch);
-ald_status_t pis_output_stop(pis_handle_t *hperh, pis_out_ch_t ch);
-/**
- * @}
- */
-
-/** @addtogroup PIS_Public_Functions_Group3
- * @{
- */
-pis_state_t pis_get_state(pis_handle_t *hperh);
-/**
- * @}
- */
-
-/** @addtogroup PIS_Public_Functions_Group4
- * @{
- */
-ald_status_t pis_modu_config(pis_handle_t *hperh, pis_modulate_config_t *config);
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __ALD_PIS_H__ */
diff --git a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_spi.h b/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_spi.h
deleted file mode 100644
index 467e92b07fc8b94673ca111179b7ebb7757772e3..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_spi.h
+++ /dev/null
@@ -1,377 +0,0 @@
-/**
- *********************************************************************************
- *
- * @file ald_spi.c
- * @brief Header file of SPI module driver.
- *
- * @version V1.0
- * @date 13 Nov 2017
- * @author AE Team
- * @note
- *
- * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
- *
- *********************************************************************************
- */
-
-#ifndef __ALD_SPI_H__
-#define __ALD_SPI_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "utils.h"
-#include "ald_dma.h"
-
-/** @addtogroup ES32FXXX_ALD
- * @{
- */
-
-/** @addtogroup SPI
- * @{
- */
-
-/** @defgroup SPI_Public_Types SPI Public Types
- * @{
- */
-
-/**
- * @brief clock phase
- */
-typedef enum
-{
- SPI_CPHA_FIRST = 0, /**< Transiting data in the first edge */
- SPI_CPHA_SECOND = 1, /**< Transiting data in the seconde edge */
-} spi_cpha_t;
-
-/**
- * @brief clock polarity
- */
-typedef enum
-{
- SPI_CPOL_LOW = 0, /**< Polarity hold low when spi-bus is idle */
- SPI_CPOL_HIGH = 1, /**< Polarity hold high when spi-bus is idle */
-} spi_cpol_t;
-
-/**
- * @brief master selection
- */
-typedef enum
-{
- SPI_MODE_SLAVER = 0, /**< Slave mode */
- SPI_MODE_MASTER = 1, /**< Master mode */
-} spi_mode_t;
-
-/**
- * @brief baud rate control
- */
-typedef enum
-{
- SPI_BAUD_2 = 0, /**< fpclk/2 */
- SPI_BAUD_4 = 1, /**< fpclk/4 */
- SPI_BAUD_8 = 2, /**< fpclk/8 */
- SPI_BAUD_16 = 3, /**< fpclk/16 */
- SPI_BAUD_32 = 4, /**< fpclk/32 */
- SPI_BAUD_64 = 5, /**< fpclk/64 */
- SPI_BAUD_128 = 6, /**< fpclk/128 */
- SPI_BAUD_256 = 7, /**< fpclk/256 */
-} spi_baud_t;
-
-/**
- * @brief frame format
- */
-typedef enum
-{
- SPI_FIRSTBIT_MSB = 0, /**< MSB transmitted first */
- SPI_FIRSTBIT_LSB = 1, /**< LSB transmitted first */
-} spi_firstbit_t;
-
-/**
- * @brief data frame format
- */
-typedef enum
-{
- SPI_DATA_SIZE_8 = 0, /**< 8-bit data frame format is selected for transmission/reception */
- SPI_DATA_SIZE_16 = 1, /**< 16-bit data frame format is selected for transmission/reception */
-} spi_datasize_t;
-
-/**
- * @brief interrupt control
- */
-typedef enum
-{
- SPI_IT_ERR = (1U << 5), /**< error interrupt */
- SPI_IT_RXBNE = (1U << 6), /**< rx buffer not empty interrupt */
- SPI_IT_TXBE = (1U << 7), /**< tx buffer empty interrupt */
-} spi_it_t;
-
-/**
- * @brief interrupt flag
- */
-typedef enum
-{
- SPI_IF_RXBNE = (1U << 0), /**< receive buffer not empty */
- SPI_IF_TXBE = (1U << 1), /**< transmit buffer empty */
- SPI_IF_CRCERR = (1U << 4), /**< crc error flag */
- SPI_IF_MODF = (1U << 5), /**< mode fault */
- SPI_IF_OVE = (1U << 6), /**< overrun flag */
- SPI_IF_BUSY = (1U << 7), /**< busy flag */
-} spi_flag_t;
-
-/**
- * @brief SPI error status
- */
-typedef enum
-{
- SPI_ERROR_NONE = 0, /**< none */
- SPI_ERROR_MODF = 1, /**< mode fault */
- SPI_ERROR_CRC = 2, /**< crc error */
- SPI_ERROR_OVE = 4, /**< overrun error */
- SPI_ERROR_DMA = 8, /**< dma error */
- SPI_ERROR_FLAG = 0x10, /**< interrupt flag error */
-} spi_error_t;
-
-
-
-/**
- * @brief SPI state structures definition
- */
-typedef enum
-{
- SPI_STATE_RESET = 0x00, /**< Peripheral is not initialized */
- SPI_STATE_READY = 0x01, /**< Peripheral Initialized and ready for use */
- SPI_STATE_BUSY = 0x02, /**< an internal process is ongoing */
- SPI_STATE_BUSY_TX = 0x11, /**< transmit is ongoing */
- SPI_STATE_BUSY_RX = 0x21, /**< receive is ongoing */
- SPI_STATE_BUSY_TX_RX = 0x31, /**< transmit and receive are ongoing */
- SPI_STATE_TIMEOUT = 0x03, /**< Timeout state */
- SPI_STATE_ERROR = 0x04, /**< Error */
-} spi_state_t;
-
-
-/**
- * @brief SPI direction definition
- */
-typedef enum
-{
- SPI_DIRECTION_2LINES = 0, /**< 2 lines */
- SPI_DIRECTION_2LINES_RXONLY = 1, /**< 2 lines only rx */
- SPI_DIRECTION_1LINE = 2, /**< 1 line */
- SPI_DIRECTION_1LINE_RX = 3, /**< 1 line only rx */
-} spi_direction_t;
-
-/**
- * @brief SPI dma request definition
- */
-typedef enum
-{
- SPI_DMA_REQ_TX = 0, /**< TX dma request */
- SPI_DMA_REQ_RX = 1, /**< RX dma request */
-} spi_dma_req_t;
-
-/**
- * @brief SPI TXE/RXNE status definition
- */
-typedef enum
-{
- SPI_SR_TXBE = 0, /**< SR.TXE set */
- SPI_SR_RXBNE = 1, /**< SR.RXNE set */
- SPI_SR_TXBE_RXBNE = 2, /**< SR.TXE and SR.RXNE set */
-} spi_sr_status_t;
-
-/**
- * @brief SPI init structure definition
- */
-typedef struct
-{
- spi_mode_t mode; /**< SPI mode */
- spi_direction_t dir; /**< SPI direction */
- spi_datasize_t data_size; /**< SPI data size */
- spi_baud_t baud; /**< SPI baudrate prescaler */
- spi_cpha_t phase; /**< SPI clock phase */
- spi_cpol_t polarity; /**< SPI clock polarity */
- spi_firstbit_t first_bit; /**< SPI first bit */
- type_func_t ss_en; /**< SPI ssm enable or disable */
- type_func_t crc_calc; /**< SPI crc calculation */
- uint16_t crc_poly; /**< SPI crc polynomial */
-} spi_init_t;
-
-/**
- * @brief SPI handle structure definition
- */
-typedef struct spi_handle_s
-{
- SPI_TypeDef *perh; /**< SPI registers base address */
- spi_init_t init; /**< SPI communication parameters */
- uint8_t *tx_buf; /**< Pointer to SPI Tx transfer buffer */
- uint16_t tx_size; /**< SPI Tx transfer size */
- uint16_t tx_count; /**< SPI Tx transfer counter */
- uint8_t *rx_buf; /**< Pointer to SPI Rx transfer buffer */
- uint16_t rx_size; /**< SPI Rx Transfer size */
- uint16_t rx_count; /**< SPI Rx Transfer Counter */
-#ifdef ALD_DMA
- dma_handle_t hdmatx; /**< SPI Tx DMA handle parameters */
- dma_handle_t hdmarx; /**< SPI Rx DMA handle parameters */
-#endif
- lock_state_t lock; /**< Locking object */
- spi_state_t state; /**< SPI communication state */
- uint32_t err_code; /**< SPI error code */
-
- void (*tx_cplt_cbk)(struct spi_handle_s *arg); /**< Tx completed callback */
- void (*rx_cplt_cbk)(struct spi_handle_s *arg); /**< Rx completed callback */
- void (*tx_rx_cplt_cbk)(struct spi_handle_s *arg); /**< Tx & Rx completed callback */
- void (*err_cbk)(struct spi_handle_s *arg); /**< error callback */
-} spi_handle_t;
-/**
- * @}
- */
-
-/** @defgroup SPI_Public_Macros SPI Public Macros
- * @{
- */
-#define SPI_RESET_HANDLE_STATE(x) ((x)->state = SPI_STATE_RESET)
-#define SPI_ENABLE(x) ((x)->perh->CON1 |= (1 << SPI_CON1_SPIEN_POS))
-#define SPI_DISABLE(x) ((x)->perh->CON1 &= ~(1 << SPI_CON1_SPIEN_POS))
-#define SPI_CRC_RESET(x) \
-do { \
- CLEAR_BIT((x)->perh->CON1, SPI_CON1_CRCEN_MSK); \
- SET_BIT((x)->perh->CON1, SPI_CON1_CRCEN_MSK); \
-} while (0)
-#define SPI_CRCNEXT_ENABLE(x) (SET_BIT((x)->perh->CON1, SPI_CON1_NXTCRC_MSK))
-#define SPI_CRCNEXT_DISABLE(x) (CLEAR_BIT((x)->perh->CON1, SPI_CON1_NXTCRC_MSK))
-#define SPI_RXONLY_ENABLE(x) (SET_BIT((x)->perh->CON1, SPI_CON1_RXO_MSK))
-#define SPI_RXONLY_DISABLE(x) (CLEAR_BIT((x)->perh->CON1, SPI_CON1_RXO_MSK))
-#define SPI_1LINE_TX(x) (SET_BIT((x)->perh->CON1, SPI_CON1_BIDOEN_MSK))
-#define SPI_1LINE_RX(x) (CLEAR_BIT((x)->perh->CON1, SPI_CON1_BIDOEN_MSK))
-#define SPI_SSI_HIGH(x) (SET_BIT((x)->perh->CON1, SPI_CON1_SSOUT_MSK))
-#define SPI_SSI_LOW(x) (CLEAR_BIT((x)->perh->CON1, SPI_CON1_SSOUT_MSK))
-#define SPI_SSOE_ENABLE(x) (SET_BIT((x)->perh->CON2, SPI_CON2_NSSOE_MSK))
-#define SPI_SSOE_DISABLE(x) (CLEAR_BIT((x)->perh->CON2, SPI_CON2_NSSOE_MSK))
-/**
- * @}
- */
-
-/** @defgroup SPI_Private_Macros SPI Private Macros
- * @{
- */
-#define IS_SPI(x) (((x) == SPI0) || \
- ((x) == SPI1) || \
- ((x) == SPI2))
-#define IS_SPI_CPHA(x) (((x) == SPI_CPHA_FIRST) || \
- ((x) == SPI_CPHA_SECOND))
-#define IS_SPI_CPOL(x) (((x) == SPI_CPOL_LOW) || \
- ((x) == SPI_CPOL_HIGH))
-#define IS_SPI_MODE(x) (((x) == SPI_MODE_SLAVER) || \
- ((x) == SPI_MODE_MASTER))
-#define IS_SPI_BAUD(x) (((x) == SPI_BAUD_2) || \
- ((x) == SPI_BAUD_4) || \
- ((x) == SPI_BAUD_8) || \
- ((x) == SPI_BAUD_16) || \
- ((x) == SPI_BAUD_32) || \
- ((x) == SPI_BAUD_64) || \
- ((x) == SPI_BAUD_128) || \
- ((x) == SPI_BAUD_256))
-#define IS_SPI_DATASIZE(x) (((x) == SPI_DATA_SIZE_8) || \
- ((x) == SPI_DATA_SIZE_16))
-#define IS_SPI_BIDOE(x) (((x) == SPI_BID_RX) || \
- ((x) == SPI_BID_TX))
-#define IS_SPI_BIDMODE(x) (((x) == SPI_BIDMODE_DUAL) || \
- ((x) == SPI_BIDMODE_SOLE))
-#define IS_SPI_DIRECTION(x) (((x) == SPI_DIRECTION_2LINES) || \
- ((x) == SPI_DIRECTION_2LINES_RXONLY) || \
- ((x) == SPI_DIRECTION_1LINE) || \
- ((x) == SPI_DIRECTION_1LINE_RX))
-#define IS_SPI_DMA_REQ(x) (((x) == SPI_DMA_REQ_TX) || \
- ((x) == SPI_DMA_REQ_RX))
-#define IS_SPI_SR_STATUS(x) (((x) == SPI_SR_TXBE) || \
- ((x) == SPI_SR_RXBNE) || \
- ((x) == SPI_SR_TXBE_RXBNE))
-#define IS_SPI_IT(x) (((x) == SPI_IT_ERR) || \
- ((x) == SPI_IT_RXBNE) || \
- ((x) == SPI_IT_TXBE))
-#define IS_SPI_IF(x) (((x) == SPI_IF_RXBNE) || \
- ((x) == SPI_IF_TXBE) || \
- ((x) == SPI_IF_CRCERR) || \
- ((x) == SPI_IF_MODF) || \
- ((x) == SPI_IF_OVE) || \
- ((x) == SPI_IF_BUSY))
-/**
- * @}
- */
-
-/** @addtogroup SPI_Public_Functions
- * @{
- */
-
-/** @addtogroup SPI_Public_Functions_Group1
- * @{
- */
-
-ald_status_t spi_init(spi_handle_t *hperh);
-void spi_reset(spi_handle_t *hperh);
-/**
- * @}
- */
-
-/** @addtogroup SPI_Public_Functions_Group2
- * @{
- */
-int32_t spi_send_byte_fast(spi_handle_t *hperh, uint8_t data);
-uint8_t spi_recv_byte_fast(spi_handle_t *hperh);
-ald_status_t spi_send(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout);
-ald_status_t spi_recv(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout);
-ald_status_t spi_send_recv(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size, uint32_t timeout);
-ald_status_t spi_send_by_it(spi_handle_t *hperh, uint8_t *buf, uint16_t size);
-ald_status_t spi_recv_by_it(spi_handle_t *hperh, uint8_t *buf, uint16_t size);
-ald_status_t spi_send_recv_by_it(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size);
-#ifdef ALD_DMA
-ald_status_t spi_send_by_dma(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel);
-ald_status_t spi_recv_by_dma(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel);
-ald_status_t spi_send_recv_by_dma(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size, uint8_t tx_channel, uint8_t rx_channel);
-ald_status_t spi_dma_pause(spi_handle_t *hperh);
-ald_status_t spi_dma_resume(spi_handle_t *hperh);
-ald_status_t spi_dma_stop(spi_handle_t *hperh);
-#endif
-/**
- * @}
- */
-
-/** @addtogroup SPI_Public_Functions_Group3
- * @{
- */
-void spi_irq_handle(spi_handle_t *hperh);
-void spi_interrupt_config(spi_handle_t *hperh, spi_it_t it, type_func_t state);
-void spi_speed_config(spi_handle_t *hperh, spi_baud_t speed);
-void spi_dma_req_config(spi_handle_t *hperh, spi_dma_req_t req, type_func_t state);
-it_status_t spi_get_it_status(spi_handle_t *hperh, spi_it_t it);
-flag_status_t spi_get_flag_status(spi_handle_t *hperh, spi_flag_t flag);
-void spi_clear_flag_status(spi_handle_t *hperh, spi_flag_t flag);
-/**
- * @}
- */
-
-/** @addtogroup SPI_Public_Functions_Group4
- * @{
- */
-spi_state_t spi_get_state(spi_handle_t *hperh);
-uint32_t spi_get_error(spi_handle_t *hperh);
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_temp.h b/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_temp.h
deleted file mode 100644
index b9d5c15d15141e54860ea79a606d82e06eca64fb..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_temp.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/**
- *********************************************************************************
- *
- * @file ald_temp.h
- * @brief Header file of TEMP module driver.
- *
- * @version V1.0
- * @date 15 Dec 2017
- * @author AE Team
- * @note
- *
- * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
- *
- ********************************************************************************
- */
-
-#ifndef __ALD_TEMP_H__
-#define __ALD_TEMP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "utils.h"
-
-
-/** @addtogroup ES32FXXX_ALD
- * @{
- */
-
-/** @addtogroup TEMP
- * @{
- */
-
-/** @defgroup TEMP_Public_Macros TEMP Public Macros
- * @{
- */
-#define TEMP_LOCK() (WRITE_REG(TEMP->WPR, 0x0))
-#define TEMP_UNLOCK() (WRITE_REG(TEMP->WPR, 0xA55A9669))
-#define TEMP_ENABLE() \
-do { \
- TEMP_UNLOCK(); \
- SET_BIT(TEMP->CR, TEMP_CR_EN_MSK); \
- TEMP_LOCK(); \
-} while (0)
-#define TEMP_DISABLE() \
-do { \
- TEMP_UNLOCK(); \
- CLEAR_BIT(TEMP->CR, TEMP_CR_EN_MSK); \
- TEMP_LOCK(); \
-} while (0)
-#define TEMP_REQ_ENABLE() \
-do { \
- TEMP_UNLOCK(); \
- SET_BIT(TEMP->CR, TEMP_CR_REQEN_MSK); \
- TEMP_LOCK(); \
-} while (0)
-#define TEMP_REQ_DISABLE() \
-do { \
- TEMP_UNLOCK(); \
- CLEAR_BIT(TEMP->CR, TEMP_CR_REQEN_MSK); \
- TEMP_LOCK(); \
-} while (0)
-#define TEMP_CTN_ENABLE() \
-do { \
- TEMP_UNLOCK(); \
- SET_BIT(TEMP->CR, TEMP_CR_CTN_MSK); \
- TEMP_LOCK(); \
-} while (0)
-#define TEMP_CTN_DISABLE() \
-do { \
- TEMP_UNLOCK(); \
- CLEAR_BIT(TEMP->CR, TEMP_CR_CTN_MSK); \
- TEMP_LOCK(); \
-} while (0)
-#define TEMP_RESET() \
-do { \
- TEMP_UNLOCK(); \
- SET_BIT(TEMP->CR, TEMP_CR_RST_MSK); \
- TEMP_LOCK(); \
-} while (0)
-/**
- * @}
- */
-
-/** @defgroup TEMP_Public_Types TEMP Public Types
- * @{
- */
-/**
- * @brief Temperature update time
- */
-typedef enum
-{
- TEMP_UPDATE_CYCLE_3 = 0x3, /**< 3 Cycles */
- TEMP_UPDATE_CYCLE_4 = 0x4, /**< 4 Cycles */
- TEMP_UPDATE_CYCLE_5 = 0x5, /**< 5 Cycles */
- TEMP_UPDATE_CYCLE_6 = 0x6, /**< 6 Cycles */
- TEMP_UPDATE_CYCLE_7 = 0x7, /**< 7 Cycles */
-} temp_update_cycle_t;
-
-/**
- * @brief Temperature output mode
- */
-typedef enum
-{
- TEMP_OUTPUT_MODE_200 = 0x0, /**< 200 cycles update one temperature */
- TEMP_OUTPUT_MODE_400 = 0x1, /**< 400 cycles update one temperature */
- TEMP_OUTPUT_MODE_800 = 0x2, /**< 800 cycles update one temperature */
- TEMP_OUTPUT_MODE_1600 = 0x3, /**< 1600 cycles update one temperature */
- TEMP_OUTPUT_MODE_3200 = 0x4, /**< 3200 cycles update one temperature */
-} temp_output_mode_t;
-
-/**
- * @brief Source select
- */
-typedef enum
-{
- TEMP_SOURCE_LOSC = 0x0, /**< LOSC */
- TEMP_SOURCE_LRC = 0x1, /**< LRC */
- TEMP_SOURCE_HRC_DIV_1M = 0x2, /**< HRC divide to 1MHz */
- TEMP_SOURCE_HOSC_DIV_1M = 0x3, /**< HOSC divide to 1MHz */
-} temp_source_sel_t;
-
-
-/**
- * @brief TEMP init structure definition
- */
-typedef struct
-{
- temp_update_cycle_t cycle; /**< Temperature update time */
- temp_output_mode_t mode; /**< Temperature output mode */
- uint8_t ctn; /**< Continue mode */
- uint8_t psc; /**< Perscaler */
-} temp_init_t;
-
-/**
- * @brief Define callback function type
- */
-typedef void (*temp_cbk)(uint16_t value, ald_status_t status);
-/**
- * @}
- */
-
-/**
- * @defgroup TEMP_Private_Macros TEMP Private Macros
- * @{
- */
-#define IS_TEMP_UPDATE_CYCLE(x) (((x) == TEMP_UPDATE_CYCLE_3) || \
- ((x) == TEMP_UPDATE_CYCLE_4) || \
- ((x) == TEMP_UPDATE_CYCLE_5) || \
- ((x) == TEMP_UPDATE_CYCLE_6) || \
- ((x) == TEMP_UPDATE_CYCLE_7))
-#define IS_TEMP_OUTPUT_MODE(x) (((x) == TEMP_OUTPUT_MODE_200) || \
- ((x) == TEMP_OUTPUT_MODE_400) || \
- ((x) == TEMP_OUTPUT_MODE_800) || \
- ((x) == TEMP_OUTPUT_MODE_1600) || \
- ((x) == TEMP_OUTPUT_MODE_3200))
-#define IS_TEMP_SOURCE_SEL(x) (((x) == TEMP_SOURCE_LOSC) || \
- ((x) == TEMP_SOURCE_LRC) || \
- ((x) == TEMP_SOURCE_HRC_DIV_1M ) || \
- ((x) == TEMP_SOURCE_HOSC_DIV_1M))
-/**
- * @}
- */
-
-/** @addtogroup TEMP_Public_Functions
- * @{
- */
-/** @addtogroup TEMP_Public_Functions_Group1
- * @{
- */
-/* Initialization functions */
-extern void temp_init(temp_init_t *init);
-extern void temp_source_selcet(temp_source_sel_t sel);
-/**
- * @}
- */
-/** @addtogroup TEMP_Public_Functions_Group2
- * @{
- */
-/* Control functions */
-extern ald_status_t temp_get_value(uint16_t *temp);
-extern void temp_get_value_by_it(temp_cbk cbk);
-void temp_irq_handle(void);
-/**
- * @}
- */
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __ALD_TEMP_H__ */
diff --git a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_uart.h b/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_uart.h
deleted file mode 100644
index 0d8b1899318a382fdfaf77b7bbeebce63a5a094e..0000000000000000000000000000000000000000
--- a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/Include/ald_uart.h
+++ /dev/null
@@ -1,478 +0,0 @@
-/**
- *********************************************************************************
- *
- * @file ald_uart.h
- * @brief Header file of UART module library.
- *
- * @version V1.0
- * @date 21 Nov 2017
- * @author AE Team
- * @note
- *
- * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
- *
- *********************************************************************************
- */
-
-#ifndef __ALD_UART_H__
-#define __ALD_UART_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "utils.h"
-#include "ald_dma.h"
-
-
-/** @addtogroup ES32FXXX_ALD
- * @{
- */
-
-/** @addtogroup UART
- * @{
- */
-
-/**
- * @defgroup UART_Public_Macros UART Public Macros
- * @{
- */
-#define UART_RX_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_RXEN_MSK))
-#define UART_RX_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_RXEN_MSK))
-#define UART_BRR_WRITE_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_BRWEN_MSK))
-#define UART_BRR_WRITE_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_BRWEN_MSK))
-#define UART_RX_TIMEOUT_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_RTOEN_MSK))
-#define UART_RX_TIMEOUT_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_RTOEN_MSK))
-#define UART_MSB_FIRST_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_MSBFIRST_MSK))
-#define UART_MSB_FIRST_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_MSBFIRST_MSK))
-#define UART_DATA_INV_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_DATAINV_MSK))
-#define UART_DATA_INV_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_DATAINV_MSK))
-#define UART_RX_INV_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_RXINV_MSK))
-#define UART_RX_INV_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_RXINV_MSK))
-#define UART_TX_INV_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_TXINV_MSK))
-#define UART_TX_INV_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_TXINV_MSK))
-#define UART_TX_RX_SWAP_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_SWAP_MSK))
-#define UART_TX_RX_SWAP_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_SWAP_MSK))
-#define UART_HDSEL_ENABLE(hperh) (SET_BIT((hperh)->perh->MCR, UART_MCR_HDSEL_MSK))
-#define UART_HDSEL_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->MCR, UART_MCR_HDSEL_MSK))
-#define UART_FIFO_TX_RESET(hperh) (SET_BIT((hperh)->perh->FCR, UART_FCR_TFRST_MSK))
-#define UART_FIFO_RX_RESET(hperh) (SET_BIT((hperh)->perh->FCR, UART_FCR_RFRST_MSK))
-#define UART_LPBMOD_ENABLE(hperh) (SET_BIT((hperh)->perh->MCR, UART_MCR_LBEN_MSK))
-#define UART_LPBMOD_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->MCR, UART_MCR_LBEN_MSK))
-#define UART_AUTOBR_ENABLE(hperh) (SET_BIT((hperh)->perh->MCR, UART_MCR_ABREN_MSK))
-#define UART_AUTOBR_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->MCR, UART_MCR_ABREN_MSK))
-#define UART_AUTOBR_RESTART(hperh) (SET_BIT((hperh)->perh->MCR, UART_MCR_ABRRS_MSK))
-#define UART_GET_BRR_VALUE(hperh) (READ_REG((hperh)->perh->BRR))
-#define UART_SET_TIMEOUT_VALUE(x, y) (MODIFY_REG((x)->perh->RTOR, UART_RTOR_RTO_MSK, (y) << UART_RTOR_RTO_POSS))
-/**
- * @}
- */
-
-/** @defgroup UART_Public_Types UART Public Types
- * @{
- */
-/**
- * @brief UART word length
- */
-typedef enum
-{
- UART_WORD_LENGTH_5B = 0x0, /**< 5-bits */
- UART_WORD_LENGTH_6B = 0x1, /**< 6-bits */
- UART_WORD_LENGTH_7B = 0x2, /**< 7-bits */
- UART_WORD_LENGTH_8B = 0x3, /**< 8-bits */
-} uart_word_length_t;
-
-/**
- * @brief UART stop bits
- */
-typedef enum
-{
- UART_STOP_BITS_1 = 0x0, /**< 1-bits */
- UART_STOP_BITS_2 = 0x1, /**< 2-bits */
- UART_STOP_BITS_0_5 = 0x0, /**< 0.5-bits, using smartcard mode */
- UART_STOP_BITS_1_5 = 0x1, /**< 1.5-bits, using smartcard mode */
-} uart_stop_bits_t;
-
-/**
- * @brief UART parity
- */
-typedef enum
-{
- UART_PARITY_NONE = 0x0, /**< Not parity */
- UART_PARITY_ODD = 0x1, /**< Odd parity */
- UART_PARITY_EVEN = 0x3, /**< Even parity */
-} uart_parity_t;
-
-/**
- * @brief UART mode
- */
-typedef enum
-{
- UART_MODE_UART = 0x0, /**< UART */
- UART_MODE_LIN = 0x1, /**< LIN */
- UART_MODE_IrDA = 0x2, /**< IrDA */
- UART_MODE_RS485 = 0x3, /**< RS485 */
- UART_MODE_HDSEL = 0x4, /**< Single-wire half-duplex */
-} uart_mode_t;
-
-/**
- * @brief UART hardware flow control
- */
-typedef enum
-{
- UART_HW_FLOW_CTL_DISABLE = 0x0, /**< Auto-flow-control disable */
- UART_HW_FLOW_CTL_ENABLE = 0x1, /**< Auto-flow-control enable */
-} uart_hw_flow_ctl_t;
-
-/**
- * @brief ALD UART state
- */
-typedef enum
-{
- UART_STATE_RESET = 0x00, /**< Peripheral is not initialized */
- UART_STATE_READY = 0x01, /**< Peripheral Initialized and ready for use */
- UART_STATE_BUSY = 0x02, /**< an internal process is ongoing */
- UART_STATE_BUSY_TX = 0x11, /**< Data Transmission process is ongoing */
- UART_STATE_BUSY_RX = 0x21, /**< Data Reception process is ongoing */
- UART_STATE_BUSY_TX_RX = 0x31, /**< Data Transmission Reception process is ongoing */
- UART_STATE_TIMEOUT = 0x03, /**< Timeout state */
- UART_STATE_ERROR = 0x04, /**< Error */
-} uart_state_t;
-
-/**
- * @brief UART error codes
- */
-typedef enum
-{
- UART_ERROR_NONE = ((uint32_t)0x00), /**< No error */
- UART_ERROR_PE = ((uint32_t)0x01), /**< Parity error */
- UART_ERROR_NE = ((uint32_t)0x02), /**< Noise error */
- UART_ERROR_FE = ((uint32_t)0x04), /**< frame error */
- UART_ERROR_ORE = ((uint32_t)0x08), /**< Overrun error */
- UART_ERROR_DMA = ((uint32_t)0x10), /**< DMA transfer error */
-} uart_error_t;
-
-/**
- * @brief UART init structure definition
- */
-typedef struct
-{
- uint32_t baud; /**< Specifies the uart communication baud rate */
- uart_word_length_t word_length; /**< Specifies the number of data bits transmitted or received in a frame */
- uart_stop_bits_t stop_bits; /**< Specifies the number of stop bits transmitted */
- uart_parity_t parity; /**< Specifies the parity mode */
- uart_mode_t mode; /**< Specifies uart mode */
- uart_hw_flow_ctl_t fctl; /**< Specifies wether the hardware flow control mode is enabled or disabled */
-} uart_init_t;
-
-/**
- * @brief UART handle structure definition
- */
-typedef struct uart_handle_s
-{
- UART_TypeDef *perh; /**< UART registers base address */
- uart_init_t init; /**< UART communication parameters */
- uint8_t *tx_buf; /**< Pointer to UART Tx transfer Buffer */
- uint16_t tx_size; /**< UART Tx Transfer size */
- uint16_t tx_count; /**< UART Tx Transfer Counter */
- uint8_t *rx_buf; /**< Pointer to UART Rx transfer Buffer */
- uint16_t rx_size; /**< UART Rx Transfer size */
- uint16_t rx_count; /**< UART Rx Transfer Counter */
-#ifdef ALD_DMA
- dma_handle_t hdmatx; /**< UART Tx DMA Handle parameters */
- dma_handle_t hdmarx; /**< UART Rx DMA Handle parameters */
-#endif
- lock_state_t lock; /**< Locking object */
- uart_state_t state; /**< UART communication state */
- uart_error_t err_code; /**< UART Error code */
-
- void (*tx_cplt_cbk)(struct uart_handle_s *arg); /**< Tx completed callback */
- void (*rx_cplt_cbk)(struct uart_handle_s *arg); /**< Rx completed callback */
- void (*error_cbk)(struct uart_handle_s *arg); /**< error callback */
-} uart_handle_t;
-
-/**
- * @brief UART RS485 configure structure definition
- */
-typedef struct
-{
- type_func_t normal; /**< Normal mode */
- type_func_t dir; /**< Auto-direction mode */
- type_func_t invert; /**< Address detection invert */
- uint8_t addr; /**< Address for compare */
-} uart_rs485_config_t;
-
-/**
- * @brief LIN detection break length
- */
-typedef enum
-{
- LIN_BREAK_LEN_10B = 0x0, /**< 10-bit break */
- LIN_BREAK_LEN_11B = 0x1, /**< 11-bit break */
-} uart_lin_break_len_t;
-
-/**
- * @brief UART TXFIFO size
- */
-typedef enum
-{
- UART_TXFIFO_EMPTY = 0x0, /**< Empty */
- UART_TXFIFO_2BYTE = 0x1, /**< 2-Bytes */
- UART_TXFIFO_4BYTE = 0x2, /**< 4-Bytes */
- UART_TXFIFO_8BYTE = 0x3, /**< 8-Bytes */
-} uart_txfifo_t;
-
-/**
- * @brief UART RXFIFO size
- */
-typedef enum
-{
- UART_RXFIFO_1BYTE = 0x0, /**< 1-Byte */
- UART_RXFIFO_4BYTE = 0x1, /**< 4-Bytes */
- UART_RXFIFO_8BYTE = 0x2, /**< 8-Bytes */
- UART_RXFIFO_14BYTE = 0x3, /**< 14-Bytes */
-} uart_rxfifo_t;
-
-/**
- * @brief UART auto-baud mode
- */
-typedef enum
-{
- UART_ABRMOD_1_TO_0 = 0x0, /**< Detect bit0:1, bit1:0 */
- UART_ABRMOD_1 = 0x1, /**< Detect bit0:1 */
- UART_ABRMOD_0_TO_1 = 0x2, /**< Detect bit0:0, bit1:1 */
-} uart_auto_baud_mode_t;
-
-/**
- * @brief UART status types
- */
-typedef enum
-{
- UART_STATUS_DR = (1U << 0), /**< Data ready */
- UART_STATUS_OE = (1U << 1), /**< Overrun error */
- UART_STATUS_PE = (1U << 2), /**< Parity error */
- UART_STATUS_FE = (1U << 3), /**< Framing error */
- UART_STATUS_BI = (1U << 4), /**< Break interrupt */
- UART_STATUS_TBEM = (1U << 5), /**< Transmit buffer empty */
- UART_STATUS_TEM = (1U << 6), /**< Transmitter empty */
- UART_STATUS_RFE = (1U << 7), /**< Reveiver FIFO data error */
- UART_STATUS_BUSY = (1U << 8), /**< UART busy */
- UART_STATUS_TFNF = (1U << 9), /**< Transmit FIFO not full */
- UART_STATUS_TFEM = (1U << 10), /**< Transmit FIFO not empty */
- UART_STATUS_RFNE = (1U << 11), /**< Receive FIFO not empty */
- UART_STATUS_RFF = (1U << 12), /**< Receive FIFO full */
- UART_STATUS_DCTS = (1U << 14), /**< Delta clear to send */
- UART_STATUS_CTS = (1U << 15), /**< Clear to send */
-} uart_status_t;
-
-/**
- * @brief UART interrupt types
- */
-typedef enum
-{
- UART_IT_RXRD = (1U << 0), /**< Receive data available */
- UART_IT_TXS = (1U << 1), /**< Tx empty status */
- UART_IT_RXS = (1U << 2), /**< Rx line status */
- UART_IT_MDS = (1U << 3), /**< Modem status */
- UART_IT_RTO = (1U << 4), /**< Receiver timeout */
- UART_IT_BZ = (1U << 5), /**< Busy status */
- UART_IT_ABE = (1U << 6), /**< Auto-baud rate detection end */
- UART_IT_ABTO = (1U << 7), /**< Auto-baud rate detection timeout */
- UART_IT_LINBK = (1U << 8), /**< Lin break detection */
- UART_IT_TC = (1U << 9), /**< Transmission complete */
- UART_IT_EOB = (1U << 10), /**< End of block */
- UART_IT_CM = (1U << 11), /**< Character match */
-} uart_it_t;
-
-/**
- * @brief UART flags types
- */
-typedef enum
-{
- UART_IF_RXRD = (1U << 0), /**< Receive data available */
- UART_IF_TXS = (1U << 1), /**< Tx empty status */
- UART_IF_RXS = (1U << 2), /**< Rx line status */
- UART_IF_MDS = (1U << 3), /**< Modem status */
- UART_IF_RTO = (1U << 4), /**< Receiver timeout */
- UART_IF_BZ = (1U << 5), /**< Busy status */
- UART_IF_ABE = (1U << 6), /**< Auto-baud rate detection end */
- UART_IF_ABTO = (1U << 7), /**< Auto-baud rate detection timeout */
- UART_IF_LINBK = (1U << 8), /**< Lin break detection */
- UART_IF_TC = (1U << 9), /**< Transmission complete */
- UART_IF_EOB = (1U << 10), /**< End of block */
- UART_IF_CM = (1U << 11), /**< Character match */
-} uart_flag_t;
-/**
- * @}
- */
-
-/** @defgroup UART_Private_Macros UART Private Macros
- * @{
- */
-#define IS_UART_ALL(x) (((x) == UART0) || \
- ((x) == UART1) || \
- ((x) == UART2) || \
- ((x) == UART3))
-#define IS_UART_WORD_LENGTH(x) (((x) == UART_WORD_LENGTH_5B) || \
- ((x) == UART_WORD_LENGTH_6B) || \
- ((x) == UART_WORD_LENGTH_7B) || \
- ((x) == UART_WORD_LENGTH_8B))
-#define IS_UART_STOPBITS(x) (((x) == UART_STOP_BITS_1) || \
- ((x) == UART_STOP_BITS_2) || \
- ((x) == UART_STOP_BITS_0_5) || \
- ((x) == UART_STOP_BITS_1_5))
-#define IS_UART_PARITY(x) (((x) == UART_PARITY_NONE) || \
- ((x) == UART_PARITY_ODD) || \
- ((x) == UART_PARITY_EVEN))
-#define IS_UART_MODE(x) (((x) == UART_MODE_UART) || \
- ((x) == UART_MODE_LIN) || \
- ((x) == UART_MODE_IrDA) || \
- ((x) == UART_MODE_RS485) || \
- ((x) == UART_MODE_HDSEL))
-#define IS_UART_HARDWARE_FLOW_CONTROL(x) \
- (((x) == UART_HW_FLOW_CTL_DISABLE) || \
- ((x) == UART_HW_FLOW_CTL_ENABLE))
-#define IS_UART_LIN_BREAK_LEN(x) (((x) == LIN_BREAK_LEN_10B) || \
- ((x) == LIN_BREAK_LEN_11B))
-#define IS_UART_TXFIFO_TYPE(x) (((x) == UART_TXFIFO_EMPTY) || \
- ((x) == UART_TXFIFO_2BYTE) || \
- ((x) == UART_TXFIFO_4BYTE) || \
- ((x) == UART_TXFIFO_8BYTE))
-#define IS_UART_RXFIFO_TYPE(x) (((x) == UART_RXFIFO_1BYTE) || \
- ((x) == UART_RXFIFO_4BYTE) || \
- ((x) == UART_RXFIFO_8BYTE) || \
- ((x) == UART_RXFIFO_14BYTE))
-#define IS_UART_AUTO_BAUD_MODE(x) (((x) == UART_ABRMOD_1_TO_0) || \
- ((x) == UART_ABRMOD_1) || \
- ((x) == UART_ABRMOD_0_TO_1))
-#define IS_UART_STATUS(x) (((x) == UART_STATUS_DR) || \
- ((x) == UART_STATUS_OE) || \
- ((x) == UART_STATUS_PE) || \
- ((x) == UART_STATUS_FE) || \
- ((x) == UART_STATUS_BI) || \
- ((x) == UART_STATUS_TBEM) || \
- ((x) == UART_STATUS_TEM) || \
- ((x) == UART_STATUS_RFE) || \
- ((x) == UART_STATUS_BUSY) || \
- ((x) == UART_STATUS_TFNF) || \
- ((x) == UART_STATUS_TFEM) || \
- ((x) == UART_STATUS_RFNE) || \
- ((x) == UART_STATUS_RFF) || \
- ((x) == UART_STATUS_DCTS) || \
- ((x) == UART_STATUS_CTS))
-#define IS_UART_IT(x) (((x) == UART_IT_RXRD) || \
- ((x) == UART_IT_TXS) || \
- ((x) == UART_IT_RXS) || \
- ((x) == UART_IT_MDS) || \
- ((x) == UART_IT_RTO) || \
- ((x) == UART_IT_BZ) || \
- ((x) == UART_IT_ABE) || \
- ((x) == UART_IT_ABTO) || \
- ((x) == UART_IT_LINBK) || \
- ((x) == UART_IT_TC) || \
- ((x) == UART_IT_EOB) || \
- ((x) == UART_IT_CM))
-#define IS_UART_IF(x) (((x) == UART_IF_RXRD) || \
- ((x) == UART_IF_TXS) || \
- ((x) == UART_IF_RXS) || \
- ((x) == UART_IF_MDS) || \
- ((x) == UART_IF_RTO) || \
- ((x) == UART_IF_BZ) || \
- ((x) == UART_IF_ABE) || \
- ((x) == UART_IF_ABTO) || \
- ((x) == UART_IF_LINBK) || \
- ((x) == UART_IF_TC) || \
- ((x) == UART_IF_EOB) || \
- ((x) == UART_IF_CM))
-#define IS_UART_BAUDRATE(x) (((x) > 0) && ((x) < 0x44AA21))
-#define IS_UART_DATA(x) ((x) <= 0x1FF)
-
-#define UART_STATE_TX_MASK (1U << 4)
-#define UART_STATE_RX_MASK (1U << 5)
-/**
- * @}
- */
-
-/** @addtogroup UART_Public_Functions
- * @{
- */
-
-/** @addtogroup UART_Public_Functions_Group1
- * @{
- */
-/* Initialization functions */
-void uart_init(uart_handle_t *hperh);
-void uart_reset(uart_handle_t *hperh);
-void uart_rs485_config(uart_handle_t *hperh, uart_rs485_config_t *config);
-/**
- * @}
- */
-
-/** @addtogroup UART_Public_Functions_Group2
- * @{
- */
-/* IO operation functions */
-ald_status_t uart_send(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout);
-ald_status_t uart_recv(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout);
-ald_status_t uart_send_by_it(uart_handle_t *hperh, uint8_t *buf, uint16_t size);
-ald_status_t uart_recv_by_it(uart_handle_t *hperh, uint8_t *buf, uint16_t size);
-#ifdef ALD_DMA
-ald_status_t uart_send_by_dma(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel);
-ald_status_t uart_recv_by_dma(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel);
-ald_status_t uart_dma_pause(uart_handle_t *hperh);
-ald_status_t uart_dma_resume(uart_handle_t *hperh);
-ald_status_t uart_dma_stop(uart_handle_t *hperh);
-#endif
-void uart_irq_handle(uart_handle_t *hperh);
-/**
- * @}
- */
-
-/** @addtogroup UART_Public_Functions_Group3
- * @{
- */
-/* Peripheral Control functions */
-void uart_interrupt_config(uart_handle_t *hperh, uart_it_t it, type_func_t state);
-void uart_dma_req_config(uart_handle_t *hperh, type_func_t state);
-void uart_tx_fifo_config(uart_handle_t *hperh, uart_rxfifo_t config, uint8_t level);
-void uart_rx_fifo_config(uart_handle_t *hperh, uart_rxfifo_t config, uint8_t level);
-void uart_lin_send_break(uart_handle_t *hperh);
-void uart_lin_detect_break_len_config(uart_handle_t *hperh, uart_lin_break_len_t len);
-void uart_auto_baud_config(uart_handle_t *hperh, uart_auto_baud_mode_t mode);
-ald_status_t uart_rs485_send_addr(uart_handle_t *hperh, uint16_t addr, uint32_t timeout);
-it_status_t uart_get_it_status(uart_handle_t *hperh, uart_it_t it);
-flag_status_t uart_get_status(uart_handle_t *hperh, uart_status_t status);
-flag_status_t uart_get_flag_status(uart_handle_t *hperh, uart_flag_t flag);
-flag_status_t uart_get_mask_flag_status(uart_handle_t *hperh, uart_flag_t flag);
-void uart_clear_flag_status(uart_handle_t *hperh, uart_flag_t flag);
-/**
- * @}
- */
-
-/** @addtogroup UART_Public_Functions_Group4
- * @{
- */
-/* Peripheral State and Errors functions */
-uart_state_t uart_get_state(uart_handle_t *hperh);
-uint32_t uart_get_error(uart_handle_t *hperh);
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __ALD_UART_H__ */
diff --git a/bsp/essemi/es32f0271/.config b/bsp/essemi/es32f0271/.config
new file mode 100644
index 0000000000000000000000000000000000000000..15ed9fadcdeec8cb13ace64af79a459d4f28e721
--- /dev/null
+++ b/bsp/essemi/es32f0271/.config
@@ -0,0 +1,439 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# RT-Thread Configuration
+#
+
+#
+# RT-Thread Kernel
+#
+CONFIG_RT_NAME_MAX=8
+# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
+# CONFIG_RT_USING_SMP is not set
+CONFIG_RT_ALIGN_SIZE=4
+# CONFIG_RT_THREAD_PRIORITY_8 is not set
+CONFIG_RT_THREAD_PRIORITY_32=y
+# CONFIG_RT_THREAD_PRIORITY_256 is not set
+CONFIG_RT_THREAD_PRIORITY_MAX=32
+CONFIG_RT_TICK_PER_SECOND=100
+CONFIG_RT_USING_OVERFLOW_CHECK=y
+CONFIG_RT_USING_HOOK=y
+CONFIG_RT_USING_IDLE_HOOK=y
+CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
+CONFIG_IDLE_THREAD_STACK_SIZE=256
+# CONFIG_RT_USING_TIMER_SOFT is not set
+CONFIG_RT_DEBUG=y
+CONFIG_RT_DEBUG_COLOR=y
+# CONFIG_RT_DEBUG_INIT_CONFIG is not set
+# CONFIG_RT_DEBUG_THREAD_CONFIG is not set
+# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set
+# CONFIG_RT_DEBUG_IPC_CONFIG is not set
+# CONFIG_RT_DEBUG_TIMER_CONFIG is not set
+# CONFIG_RT_DEBUG_IRQ_CONFIG is not set
+# CONFIG_RT_DEBUG_MEM_CONFIG is not set
+# CONFIG_RT_DEBUG_SLAB_CONFIG is not set
+# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set
+# CONFIG_RT_DEBUG_MODULE_CONFIG is not set
+
+#
+# Inter-Thread communication
+#
+CONFIG_RT_USING_SEMAPHORE=y
+CONFIG_RT_USING_MUTEX=y
+CONFIG_RT_USING_EVENT=y
+CONFIG_RT_USING_MAILBOX=y
+CONFIG_RT_USING_MESSAGEQUEUE=y
+# CONFIG_RT_USING_SIGNALS is not set
+
+#
+# Memory Management
+#
+CONFIG_RT_USING_MEMPOOL=y
+# CONFIG_RT_USING_MEMHEAP is not set
+# CONFIG_RT_USING_NOHEAP is not set
+CONFIG_RT_USING_SMALL_MEM=y
+# CONFIG_RT_USING_SLAB is not set
+# CONFIG_RT_USING_MEMTRACE is not set
+CONFIG_RT_USING_HEAP=y
+
+#
+# Kernel Device Object
+#
+CONFIG_RT_USING_DEVICE=y
+# CONFIG_RT_USING_DEVICE_OPS is not set
+# CONFIG_RT_USING_INTERRUPT_INFO is not set
+CONFIG_RT_USING_CONSOLE=y
+CONFIG_RT_CONSOLEBUF_SIZE=128
+CONFIG_RT_CONSOLE_DEVICE_NAME="uart1"
+CONFIG_RT_VER_NUM=0x40002
+# CONFIG_RT_USING_CPU_FFS is not set
+# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
+
+#
+# RT-Thread Components
+#
+CONFIG_RT_USING_COMPONENTS_INIT=y
+CONFIG_RT_USING_USER_MAIN=y
+CONFIG_RT_MAIN_THREAD_STACK_SIZE=1024
+CONFIG_RT_MAIN_THREAD_PRIORITY=10
+
+#
+# C++ features
+#
+# CONFIG_RT_USING_CPLUSPLUS is not set
+
+#
+# Command shell
+#
+CONFIG_RT_USING_FINSH=y
+CONFIG_FINSH_THREAD_NAME="tshell"
+CONFIG_FINSH_USING_HISTORY=y
+CONFIG_FINSH_HISTORY_LINES=5
+CONFIG_FINSH_USING_SYMTAB=y
+CONFIG_FINSH_USING_DESCRIPTION=y
+# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
+CONFIG_FINSH_THREAD_PRIORITY=20
+CONFIG_FINSH_THREAD_STACK_SIZE=2048
+CONFIG_FINSH_CMD_SIZE=80
+# CONFIG_FINSH_USING_AUTH is not set
+CONFIG_FINSH_USING_MSH=y
+CONFIG_FINSH_USING_MSH_DEFAULT=y
+CONFIG_FINSH_USING_MSH_ONLY=y
+CONFIG_FINSH_ARG_MAX=10
+
+#
+# Device virtual file system
+#
+# CONFIG_RT_USING_DFS is not set
+
+#
+# Device Drivers
+#
+CONFIG_RT_USING_DEVICE_IPC=y
+CONFIG_RT_PIPE_BUFSZ=512
+# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
+CONFIG_RT_USING_SERIAL=y
+# CONFIG_RT_SERIAL_USING_DMA is not set
+CONFIG_RT_SERIAL_RB_BUFSZ=64
+# CONFIG_RT_USING_CAN is not set
+# CONFIG_RT_USING_HWTIMER is not set
+# CONFIG_RT_USING_CPUTIME is not set
+# CONFIG_RT_USING_I2C is not set
+CONFIG_RT_USING_PIN=y
+# CONFIG_RT_USING_ADC is not set
+# CONFIG_RT_USING_PWM is not set
+# CONFIG_RT_USING_MTD_NOR is not set
+# CONFIG_RT_USING_MTD_NAND is not set
+# CONFIG_RT_USING_PM is not set
+# CONFIG_RT_USING_RTC is not set
+# CONFIG_RT_USING_SDIO is not set
+# CONFIG_RT_USING_SPI is not set
+# CONFIG_RT_USING_WDT is not set
+# CONFIG_RT_USING_AUDIO is not set
+# CONFIG_RT_USING_SENSOR is not set
+# CONFIG_RT_USING_TOUCH is not set
+# CONFIG_RT_USING_HWCRYPTO is not set
+# CONFIG_RT_USING_PULSE_ENCODER is not set
+# CONFIG_RT_USING_INPUT_CAPTURE is not set
+# CONFIG_RT_USING_WIFI is not set
+
+#
+# Using USB
+#
+# CONFIG_RT_USING_USB_HOST is not set
+# CONFIG_RT_USING_USB_DEVICE is not set
+
+#
+# POSIX layer and C standard library
+#
+# CONFIG_RT_USING_LIBC is not set
+# CONFIG_RT_USING_PTHREADS is not set
+# CONFIG_RT_LIBC_USING_TIME is not set
+
+#
+# Network
+#
+
+#
+# Socket abstraction layer
+#
+# CONFIG_RT_USING_SAL is not set
+
+#
+# Network interface device
+#
+# CONFIG_RT_USING_NETDEV is not set
+
+#
+# light weight TCP/IP stack
+#
+# CONFIG_RT_USING_LWIP is not set
+
+#
+# AT commands
+#
+# CONFIG_RT_USING_AT is not set
+
+#
+# VBUS(Virtual Software BUS)
+#
+# CONFIG_RT_USING_VBUS is not set
+
+#
+# Utilities
+#
+# CONFIG_RT_USING_RYM is not set
+# CONFIG_RT_USING_ULOG is not set
+# CONFIG_RT_USING_UTEST is not set
+
+#
+# RT-Thread online packages
+#
+
+#
+# IoT - internet of things
+#
+# CONFIG_PKG_USING_PAHOMQTT is not set
+# CONFIG_PKG_USING_WEBCLIENT is not set
+# CONFIG_PKG_USING_WEBNET is not set
+# CONFIG_PKG_USING_MONGOOSE is not set
+# CONFIG_PKG_USING_MYMQTT is not set
+# CONFIG_PKG_USING_WEBTERMINAL is not set
+# CONFIG_PKG_USING_CJSON is not set
+# CONFIG_PKG_USING_JSMN is not set
+# CONFIG_PKG_USING_LIBMODBUS is not set
+# CONFIG_PKG_USING_FREEMODBUS is not set
+# CONFIG_PKG_USING_LJSON is not set
+# CONFIG_PKG_USING_EZXML is not set
+# CONFIG_PKG_USING_NANOPB is not set
+
+#
+# Wi-Fi
+#
+
+#
+# Marvell WiFi
+#
+# CONFIG_PKG_USING_WLANMARVELL is not set
+
+#
+# Wiced WiFi
+#
+# CONFIG_PKG_USING_WLAN_WICED is not set
+# CONFIG_PKG_USING_RW007 is not set
+# CONFIG_PKG_USING_COAP is not set
+# CONFIG_PKG_USING_NOPOLL is not set
+# CONFIG_PKG_USING_NETUTILS is not set
+# CONFIG_PKG_USING_PPP_DEVICE is not set
+# CONFIG_PKG_USING_AT_DEVICE is not set
+# CONFIG_PKG_USING_ATSRV_SOCKET is not set
+# CONFIG_PKG_USING_WIZNET is not set
+
+#
+# IoT Cloud
+#
+# CONFIG_PKG_USING_ONENET is not set
+# CONFIG_PKG_USING_GAGENT_CLOUD is not set
+# CONFIG_PKG_USING_ALI_IOTKIT is not set
+# CONFIG_PKG_USING_AZURE is not set
+# CONFIG_PKG_USING_TENCENT_IOTHUB is not set
+# CONFIG_PKG_USING_JIOT-C-SDK is not set
+# CONFIG_PKG_USING_NIMBLE is not set
+# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
+# CONFIG_PKG_USING_IPMSG is not set
+# CONFIG_PKG_USING_LSSDP is not set
+# CONFIG_PKG_USING_AIRKISS_OPEN is not set
+# CONFIG_PKG_USING_LIBRWS is not set
+# CONFIG_PKG_USING_TCPSERVER is not set
+# CONFIG_PKG_USING_PROTOBUF_C is not set
+# CONFIG_PKG_USING_ONNX_PARSER is not set
+# CONFIG_PKG_USING_ONNX_BACKEND is not set
+# CONFIG_PKG_USING_DLT645 is not set
+# CONFIG_PKG_USING_QXWZ is not set
+# CONFIG_PKG_USING_SMTP_CLIENT is not set
+# CONFIG_PKG_USING_ABUP_FOTA is not set
+
+#
+# security packages
+#
+# CONFIG_PKG_USING_MBEDTLS is not set
+# CONFIG_PKG_USING_libsodium is not set
+# CONFIG_PKG_USING_TINYCRYPT is not set
+
+#
+# language packages
+#
+# CONFIG_PKG_USING_LUA is not set
+# CONFIG_PKG_USING_JERRYSCRIPT is not set
+# CONFIG_PKG_USING_MICROPYTHON is not set
+
+#
+# multimedia packages
+#
+# CONFIG_PKG_USING_OPENMV is not set
+# CONFIG_PKG_USING_MUPDF is not set
+# CONFIG_PKG_USING_STEMWIN is not set
+# CONFIG_PKG_USING_WAVPLAYER is not set
+# CONFIG_PKG_USING_TJPGD is not set
+
+#
+# tools packages
+#
+# CONFIG_PKG_USING_CMBACKTRACE is not set
+# CONFIG_PKG_USING_EASYFLASH is not set
+# CONFIG_PKG_USING_EASYLOGGER is not set
+# CONFIG_PKG_USING_SYSTEMVIEW is not set
+# CONFIG_PKG_USING_RDB is not set
+# CONFIG_PKG_USING_QRCODE is not set
+# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
+# CONFIG_PKG_USING_ADBD is not set
+# CONFIG_PKG_USING_COREMARK is not set
+# CONFIG_PKG_USING_DHRYSTONE is not set
+# CONFIG_PKG_USING_NR_MICRO_SHELL is not set
+
+#
+# system packages
+#
+# CONFIG_PKG_USING_GUIENGINE is not set
+# CONFIG_PKG_USING_CAIRO is not set
+# CONFIG_PKG_USING_PIXMAN is not set
+# CONFIG_PKG_USING_LWEXT4 is not set
+# CONFIG_PKG_USING_PARTITION is not set
+# CONFIG_PKG_USING_FAL is not set
+# CONFIG_PKG_USING_SQLITE is not set
+# CONFIG_PKG_USING_RTI is not set
+# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
+# CONFIG_PKG_USING_CMSIS is not set
+# CONFIG_PKG_USING_DFS_YAFFS is not set
+# CONFIG_PKG_USING_LITTLEFS is not set
+# CONFIG_PKG_USING_THREAD_POOL is not set
+# CONFIG_PKG_USING_ROBOTS is not set
+
+#
+# peripheral libraries and drivers
+#
+# CONFIG_PKG_USING_SENSORS_DRIVERS is not set
+# CONFIG_PKG_USING_REALTEK_AMEBA is not set
+# CONFIG_PKG_USING_SHT2X is not set
+# CONFIG_PKG_USING_SHT3X is not set
+# CONFIG_PKG_USING_STM32_SDIO is not set
+# CONFIG_PKG_USING_ICM20608 is not set
+# CONFIG_PKG_USING_U8G2 is not set
+# CONFIG_PKG_USING_BUTTON is not set
+# CONFIG_PKG_USING_PCF8574 is not set
+# CONFIG_PKG_USING_SX12XX is not set
+# CONFIG_PKG_USING_SIGNAL_LED is not set
+# CONFIG_PKG_USING_LEDBLINK is not set
+# CONFIG_PKG_USING_WM_LIBRARIES is not set
+# CONFIG_PKG_USING_KENDRYTE_SDK is not set
+# CONFIG_PKG_USING_INFRARED is not set
+# CONFIG_PKG_USING_ROSSERIAL is not set
+# CONFIG_PKG_USING_AGILE_BUTTON is not set
+# CONFIG_PKG_USING_AGILE_LED is not set
+# CONFIG_PKG_USING_AT24CXX is not set
+# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set
+# CONFIG_PKG_USING_AD7746 is not set
+# CONFIG_PKG_USING_PCA9685 is not set
+# CONFIG_PKG_USING_I2C_TOOLS is not set
+# CONFIG_PKG_USING_NRF24L01 is not set
+# CONFIG_PKG_USING_TOUCH_DRIVERS is not set
+# CONFIG_PKG_USING_LCD_DRIVERS is not set
+# CONFIG_PKG_USING_MAX17048 is not set
+# CONFIG_PKG_USING_RPLIDAR is not set
+
+#
+# miscellaneous packages
+#
+# CONFIG_PKG_USING_LIBCSV is not set
+# CONFIG_PKG_USING_OPTPARSE is not set
+# CONFIG_PKG_USING_FASTLZ is not set
+# CONFIG_PKG_USING_MINILZO is not set
+# CONFIG_PKG_USING_QUICKLZ is not set
+# CONFIG_PKG_USING_MULTIBUTTON is not set
+# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set
+# CONFIG_PKG_USING_CANFESTIVAL is not set
+# CONFIG_PKG_USING_ZLIB is not set
+# CONFIG_PKG_USING_DSTR is not set
+# CONFIG_PKG_USING_TINYFRAME is not set
+# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
+# CONFIG_PKG_USING_DIGITALCTRL is not set
+# CONFIG_PKG_USING_UPACKER is not set
+# CONFIG_PKG_USING_UPARAM is not set
+
+#
+# samples: kernel and components samples
+#
+# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
+# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
+# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
+# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
+# CONFIG_PKG_USING_HELLO is not set
+# CONFIG_PKG_USING_VI is not set
+# CONFIG_PKG_USING_NNOM is not set
+# CONFIG_PKG_USING_LIBANN is not set
+# CONFIG_PKG_USING_ELAPACK is not set
+# CONFIG_PKG_USING_ARMv7M_DWT is not set
+# CONFIG_PKG_USING_VT100 is not set
+# CONFIG_PKG_USING_ULAPACK is not set
+# CONFIG_PKG_USING_UKAL is not set
+CONFIG_SOC_ES32F0271LT=y
+
+#
+# Hardware Drivers Config
+#
+
+#
+# On-chip Peripheral Drivers
+#
+
+#
+# PIN Drivers
+#
+CONFIG_BSP_USING_GPIO=y
+
+#
+# UART Drivers
+#
+CONFIG_BSP_USING_UART1=y
+# CONFIG_BSP_USING_UART2 is not set
+# CONFIG_BSP_USING_UART3 is not set
+
+#
+# SPI Drivers
+#
+# CONFIG_BSP_USING_SPI1 is not set
+# CONFIG_BSP_USING_SPI2 is not set
+
+#
+# I2C Drivers
+#
+# CONFIG_BSP_USING_I2C1 is not set
+# CONFIG_BSP_USING_I2C2 is not set
+
+#
+# HWtimer Drivers
+#
+# CONFIG_BSP_USING_HWTIMER1 is not set
+
+#
+# PWM Drivers
+#
+# CONFIG_BSP_USING_PWM_GP16C2T1 is not set
+# CONFIG_BSP_USING_PWM_GP16C2T4 is not set
+
+#
+# RTC Drivers
+#
+# CONFIG_BSP_USING_RTC is not set
+
+#
+# ADC Drivers
+#
+# CONFIG_BSP_USING_ADC is not set
+
+#
+# Onboard Peripheral Drivers
+#
+
+#
+# Offboard Peripheral Drivers
+#
diff --git a/bsp/essemi/es32f0271/Kconfig b/bsp/essemi/es32f0271/Kconfig
new file mode 100644
index 0000000000000000000000000000000000000000..20657830420ecf9c45d5ba7615ce9dbae0837d2e
--- /dev/null
+++ b/bsp/essemi/es32f0271/Kconfig
@@ -0,0 +1,27 @@
+mainmenu "RT-Thread Configuration"
+
+config BSP_DIR
+ string
+ option env="BSP_ROOT"
+ default "."
+
+config RTT_DIR
+ string
+ option env="RTT_ROOT"
+ default "../../.."
+
+config PKGS_DIR
+ string
+ option env="PKGS_ROOT"
+ default "packages"
+
+source "$RTT_DIR/Kconfig"
+source "$PKGS_DIR/Kconfig"
+
+config SOC_ES32F0271LT
+ bool
+ select RT_USING_COMPONENTS_INIT
+ select RT_USING_USER_MAIN
+ default y
+
+source "drivers/Kconfig"
diff --git a/bsp/essemi/es32f0271/README.md b/bsp/essemi/es32f0271/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..c50443466b595e0d80c7bb507e4b36ed50dc2d1e
--- /dev/null
+++ b/bsp/essemi/es32f0271/README.md
@@ -0,0 +1,95 @@
+# ES-PDS-ES32F0271 开发板 BSP 说明
+标签: EastSoft、国产MCU、Cortex-M0、ES32F0271LT
+
+## 1. 简介
+
+本文档为上海东软载波微电子开发团队为 ES-PDS-ES32F0271 开发板提供的 BSP (板级支持包) 说明。
+通过阅读本文档,开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。
+
+### 1.1 开发板介绍
+
+主要内容如下:
+ES-PDS-ES32F0271 是东软载波微电子官方推出的一款基于 ARM Cortex-M0 内核的开发板,最高主频为 48MHz,可满足基础功能测试及高端功能扩展等开发需求。
+
+ES-PDS-ES32F0271-V1.1
+
+该开发板常用 **板载资源** 如下:
+
+- MCU:ES32F0271LT,主频 48MHz,8KB SRAM,64KB FLASH
+- 外部模块:SPI FLASH (MX25L64,8MB)、I2C EEPROM (M24C04,512B)
+- 常用外设
+ - 可调电阻:1个,(PC03)
+ - LED:2个,(PD03/PB08)
+ - 五轴按键:
+- 常用接口:GPIO、UART、SPI、I2C
+- 调试接口,ESLinkⅡ(EastSoft 官方推出的开发工具,有标准版和mini版两种版本,均自带 CDC 串口功能) SWD 下载
+
+外设支持:
+
+本 BSP 目前对外设的支持情况如下:
+
+| **板载外设** | **支持情况** | **备注** |
+| :---------------- | :----------: | :------------------------------------|
+| **片上外设** | **支持情况** | **备注** |
+| GPIO | 支持 | GPIOs |
+| UART | 支持 | UART1/2/3 |
+| SPI | 支持 | SPI1/2 |
+| I2C | 支持 | I2C1/2 |
+| PWM | 支持 | PWM1/2 |
+| TIMER | 支持 | TIMER1 |
+| RTC | 支持 | RTC |
+| ADC | 支持 | ADC |
+
+### 1.2 注意事项
+
+- 本BSP中,SPI2和PWM2不能同时使用
+
+更多详细信息请咨询[上海东软载波微电子技术支持](http://www.essemi.com/)
+
+## 2. 快速上手
+
+本 BSP 为开发者提供 MDK5 工程。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
+
+### 硬件连接
+
+使用 ESLinkⅡ (自带 CDC 串口)或 Jlink 等调试工具连接开发板到 PC端,拨动开关选择使用调试工具供电或使用外部电源供电。若使用 Jlink 等调试工具,还需要将 UART1_TX(PB06)、UART1_RX(PB07)、GND 接到串口工具上。
+
+ESLinkⅡ(mini) + ES-PDS-ES32F0271-V1.1
+
+### 编译下载
+
+双击 project.uvprojx 文件,打开 MDK5 工程,工程默认配置使用 JLink 下载程序,在通过 JLink 连接开发板的基础上,点击下载按钮即可下载程序到开发板,如果使用 ESLinkⅡ,则选择 "CMSIS-DAP Debugger",连接正常后即可编译并下载程序到开发板。
+
+### 运行结果
+
+下载程序成功之后,系统会自动运行,观察串口输出的信息,同时开发板LED闪烁。
+
+```bash
+ \ | /
+- RT - Thread Operating System
+ / | \ 4.0.2 build Oct 31 2019
+ 2006 - 2019 Copyright by rt-thread team
+msh >
+```
+## 3. 进阶使用
+
+此 BSP 默认只开启了 GPIO 和 uart1 的功能,如果需使用 Flash 等更多高级功能,需要利用 ENV 工具对 BSP 进行配置,步骤如下:
+
+1. 在 bsp 下打开 env 工具。
+
+2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
+
+3. 输入`pkgs --update`命令更新软件包。
+
+4. 输入`scons --target=mdk5/iar` 命令重新生成工程。
+
+更多 Env 工具的详细介绍请参考 [RT-Thread 文档中心](https://www.rt-thread.org/document/site/)
+
+## 4. 联系人信息
+
+- [yuzr](https://github.com/essemi-yuzr)
+
+## 5. 参考
+
+- [ EastSoft 官网](http://www.essemi.com)
+
diff --git a/bsp/es32f0654/SConscript b/bsp/essemi/es32f0271/SConscript
similarity index 100%
rename from bsp/es32f0654/SConscript
rename to bsp/essemi/es32f0271/SConscript
diff --git a/bsp/essemi/es32f0271/SConstruct b/bsp/essemi/es32f0271/SConstruct
new file mode 100644
index 0000000000000000000000000000000000000000..164265293da6f0f0240d637f812532529b46881b
--- /dev/null
+++ b/bsp/essemi/es32f0271/SConstruct
@@ -0,0 +1,39 @@
+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 = 'rtthread.' + rtconfig.TARGET_EXT
+
+env = Environment(tools = ['mingw'],
+ AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
+ CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
+ AR = rtconfig.AR, ARFLAGS = '-rc',
+ 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 project.map')
+
+Export('RTT_ROOT')
+Export('rtconfig')
+
+# prepare building environment
+objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
+
+# make a building
+DoBuilding(TARGET, objs)
diff --git a/bsp/es32f0654/applications/SConscript b/bsp/essemi/es32f0271/applications/SConscript
similarity index 100%
rename from bsp/es32f0654/applications/SConscript
rename to bsp/essemi/es32f0271/applications/SConscript
diff --git a/bsp/essemi/es32f0271/applications/main.c b/bsp/essemi/es32f0271/applications/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..31e31d355d224ddbbb20a84752b06d6733581492
--- /dev/null
+++ b/bsp/essemi/es32f0271/applications/main.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#include
+#include
+
+#define LED_PIN 61
+
+int main(void)
+{
+ /* LED pin configuration */
+ rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
+
+ while (1)
+ {
+ rt_pin_write(LED_PIN, PIN_HIGH);
+ rt_thread_mdelay(1000);
+ rt_pin_write(LED_PIN, PIN_LOW);
+ rt_thread_mdelay(1000);
+ }
+}
diff --git a/bsp/essemi/es32f0271/drivers/Kconfig b/bsp/essemi/es32f0271/drivers/Kconfig
new file mode 100644
index 0000000000000000000000000000000000000000..37265a5ba811e1cec537e98bc0efb68e4b3ef250
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/Kconfig
@@ -0,0 +1,102 @@
+menu "Hardware Drivers Config"
+
+ menu "On-chip Peripheral Drivers"
+ menu "PIN Drivers"
+ config BSP_USING_GPIO
+ bool "Enable GPIO"
+ select RT_USING_PIN
+ default y
+ endmenu
+
+ menu "UART Drivers"
+ config BSP_USING_UART1
+ bool "Enable UART1 PB06/PB07(T/R)"
+ select RT_USING_SERIAL
+ default y
+
+ config BSP_USING_UART2
+ bool "Enable UART2 PA02/PA03(T/R)"
+ select RT_USING_SERIAL
+ default n
+
+ config BSP_USING_UART3
+ bool "Enable UART3 PC06/PC07(T/R)"
+ select RT_USING_SERIAL
+ default n
+ endmenu
+
+ menu "SPI Drivers"
+ config BSP_USING_SPI1
+ bool "Enable SPI1 BUS PB03/PB04/PB05(CLK/MISO/MOSI)"
+ select RT_USING_SPI
+ select RT_USING_PIN
+ default n
+
+ config BSP_USING_SPI2
+ bool "Enable SPI2 BUS PB13/PB14/PB15(CLK/MISO/MOSI)"
+ select RT_USING_SPI
+ select RT_USING_PIN
+ default n
+ depends on !BSP_USING_PWM_GP16C2T4
+ endmenu
+
+ menu "I2C Drivers"
+ config BSP_USING_I2C1
+ bool "Enable I2C1 BUS PC12/PD02(SCL/SDA)"
+ select RT_USING_I2C
+ default n
+
+ config BSP_USING_I2C2
+ bool "Enable I2C2 BUS PB10/PB11(SCL/SDA)"
+ select RT_USING_I2C
+ default n
+ endmenu
+
+ menu "HWtimer Drivers"
+
+ config BSP_USING_HWTIMER1
+ bool "Using timer1"
+ select RT_USING_HWTIMER
+ default n
+ endmenu
+
+ menu "PWM Drivers"
+
+ config BSP_USING_PWM_GP16C2T1
+ bool "Using PWM_1(GP16C2T1) PB01/PB02"
+ select RT_USING_PWM
+ default n
+
+ config BSP_USING_PWM_GP16C2T4
+ bool "Using PWM2(GP16C2T4) PB12/PB14"
+ select RT_USING_PWM
+ default n
+ depends on !BSP_USING_SPI2
+
+ endmenu
+
+ menu "RTC Drivers"
+ config BSP_USING_RTC
+ bool "Using RTC"
+ select RT_USING_RTC
+ default n
+ endmenu
+
+ menu "ADC Drivers"
+ config BSP_USING_ADC
+ bool "Using ADC"
+ select RT_USING_ADC
+ default n
+ endmenu
+
+ endmenu
+
+ menu "Onboard Peripheral Drivers"
+
+ endmenu
+
+ menu "Offboard Peripheral Drivers"
+
+ endmenu
+
+endmenu
diff --git a/bsp/essemi/es32f0271/drivers/SConscript b/bsp/essemi/es32f0271/drivers/SConscript
new file mode 100644
index 0000000000000000000000000000000000000000..3be3df80c59c61bd23f3d02f367d0a9463b598c9
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/SConscript
@@ -0,0 +1,45 @@
+from building import *
+
+cwd = GetCurrentDir()
+
+# add the general drivers.
+src = Split('''
+board.c
+''')
+
+# add gpio code
+if GetDepend('RT_USING_PIN'):
+ src += ['drv_gpio.c']
+
+# add serial driver code
+if GetDepend('BSP_USING_UART1') or GetDepend('BSP_USING_UART2') or GetDepend('BSP_USING_UART3'):
+ src += ['drv_uart.c']
+
+# add spi driver code
+if GetDepend('BSP_USING_SPI1') or GetDepend('BSP_USING_SPI2'):
+ src += ['drv_spi.c']
+
+# add i2c driver code
+if GetDepend('BSP_USING_I2C1') or GetDepend('BSP_USING_I2C2'):
+ src += ['drv_i2c.c']
+
+# add pwm driver code
+if GetDepend('BSP_USING_PWM1') or GetDepend('BSP_USING_PWM2') or GetDepend('BSP_USING_PWM3') or GetDepend('BSP_USING_PWM4') or GetDepend('BSP_USING_PWM_GP16C2T1') or GetDepend('BSP_USING_PWM_GP16C2T4'):
+ src += ['drv_pwm.c']
+
+# add hwtimer driver code
+if GetDepend('BSP_USING_HWTIMER1'):
+ src += ['drv_hwtimer.c']
+
+# add rtc driver code
+if GetDepend(['BSP_USING_RTC']):
+ src += ['drv_rtc.c']
+
+# add adc driver code
+if GetDepend(['BSP_USING_ADC']):
+ src += ['drv_adc.c']
+
+CPPPATH = [cwd]
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/essemi/es32f0271/drivers/board.c b/bsp/essemi/es32f0271/drivers/board.c
new file mode 100644
index 0000000000000000000000000000000000000000..8ebc351ff1922c195befbd24629a557c95a098f1
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/board.c
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#include
+#include
+#include "board.h"
+#include "drv_uart.h"
+#include "drv_gpio.h"
+#include "md_gpio.h"
+
+/**
+ * @addtogroup es32f0
+ */
+
+/*@{*/
+
+/*******************************************************************************
+* Function Name : NVIC_Configuration
+* Description : Configures Vector Table base location.
+* Input : None
+* Output : None
+* Return : None
+*******************************************************************************/
+void NVIC_Configuration(void)
+{
+}
+
+/*******************************************************************************
+ * Function Name : SystemClock_Configuration
+ * Description : Configures the System Clock.
+ * Input : None
+ * Output : None
+ * Return : None
+ *******************************************************************************/
+void SystemClock_Config(void)
+{
+ /*-------------------------Clock Config-------------------------/
+ * Config system clock to 48MHz of which the clock source
+ * is PLL0.
+ */
+
+ //
+ // Open PLL0/HRC then wait it ready.
+ //
+ SET_BIT(RCU->CON, RCU_CON_PLL0ON_MSK);
+ SET_BIT(RCU->CON, RCU_CON_HRCON_MSK);
+
+ /* Wait HRC clock steady. */
+ while (!READ_BIT(RCU->CON, RCU_CON_HRCRDY_MSK));
+
+ //
+ // Change system clock source,PLL0,48MHz.
+ //
+ /* Chose PLL0 as system clock. */
+ MODIFY_REG(RCU->CFG, RCU_CFG_SW_MSK, (0x4 << RCU_CFG_SW_POSS));
+ /* Config mul of PLL0. */
+ MODIFY_REG(RCU->CFG, RCU_CFG_PLLMUL_MSK, (11 << RCU_CFG_PLLMUL_POSS));
+
+ //
+ // Start to change system clock and wait it ready.
+ //
+ /* Config flash read wait time. */
+ MODIFY_REG(FC->CON, FC_CON_WAIT_MSK, (0X2 << FC_CON_WAIT_POSS));
+ /* Start to change. */
+ SET_BIT(RCU->CFG, RCU_CFG_CKCFG_MSK);
+
+ /* Wait system clock ready. */
+ while (!READ_BIT(RCU->CON, RCU_CON_SWRDY_MSK));
+
+ //
+ // Remember the system clock.
+ //
+ SystemCoreClock = 48000000;
+}
+
+/*******************************************************************************
+ * Function Name : SysTick_Configuration
+ * Description : Configures the SysTick for OS tick.
+ * Input : None
+ * Output : None
+ * Return : None
+ *******************************************************************************/
+void SysTick_Configuration(void)
+{
+ /* ticks = sysclk / RT_TICK_PER_SECOND */
+ SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
+}
+
+/**
+ * This is the timer interrupt service routine.
+ *
+ */
+void SysTick_Handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ rt_tick_increase();
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+/*@}*/
+/**
+ * This function will initial ES32F0 board.
+ */
+void rt_hw_board_init(void)
+{
+ /* NVIC Configuration */
+ NVIC_Configuration();
+
+ /*System Clock Configuration */
+ SystemClock_Config();
+
+ /* Configure the SysTick */
+ SysTick_Configuration();
+
+#ifdef RT_USING_HEAP
+ rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
+#endif
+#ifdef RT_USING_COMPONENTS_INIT
+ rt_components_board_init();
+#endif
+#ifdef RT_USING_CONSOLE
+ rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
+#endif
+}
+
diff --git a/bsp/essemi/es32f0271/drivers/board.h b/bsp/essemi/es32f0271/drivers/board.h
new file mode 100644
index 0000000000000000000000000000000000000000..b1cb44890d2d77bc21a950af016385f833d90a96
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/board.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+// <<< Use Configuration Wizard in Context Menu >>>
+#ifndef __BOARD_H__
+#define __BOARD_H__
+
+#include "es32f0271.h"
+
+#define ES32F0_SRAM_SIZE 0x2000
+#define ES32F0_SRAM_END (0x20000000 + ES32F0_SRAM_SIZE)
+
+#if defined(__CC_ARM) || defined(__CLANG_ARM)
+ extern int Image$$RW_IRAM1$$ZI$$Limit;
+ #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
+#elif __ICCARM__
+ #pragma section="HEAP"
+ #define HEAP_BEGIN (__segment_end("HEAP"))
+#else
+ extern int __bss_end;
+ #define HEAP_BEGIN ((void *)&__bss_end)
+#endif
+
+#define HEAP_END ES32F0_SRAM_END
+
+void rt_hw_board_init(void);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_adc.c b/bsp/essemi/es32f0271/drivers/drv_adc.c
new file mode 100644
index 0000000000000000000000000000000000000000..d111b54f22bbdd263b3fe2df08c7300e91f758df
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_adc.c
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#include
+#include
+#include
+#include "board.h"
+#include "drv_adc.h"
+#include "md_gpio.h"
+#include "md_adc.h"
+#include "md_rcu.h"
+#include "md_syscfg.h"
+
+#ifdef RT_USING_ADC
+
+#define BSP_ADC_CHANNEL_NUM 8
+
+/* define adc instance */
+static struct rt_adc_device _device_adc0;
+
+/* enable or disable adc */
+static rt_err_t es32f0_adc_enabled(struct rt_adc_device *device, rt_uint32_t channel, rt_bool_t enabled)
+{
+ RT_ASSERT(device != RT_NULL);
+
+ if (enabled)
+ {
+ md_adc_enable_ssen_ss0en(ADC);
+ }
+ else
+ {
+ md_adc_disable_ssen_ss0en(ADC);
+ }
+
+ return RT_EOK;
+}
+
+static void _adc_channel_config(rt_uint32_t channel)
+{
+ /* select gpio pin as adc function */
+ switch (channel)
+ {
+ case 0:
+ md_gpio_set_mode(GPIOA, MD_GPIO_PIN_0, MD_GPIO_MODE_ANALOG);
+ break;
+ case 1:
+ md_gpio_set_mode(GPIOA, MD_GPIO_PIN_1, MD_GPIO_MODE_ANALOG);
+ break;
+ case 2:
+ md_gpio_set_mode(GPIOA, MD_GPIO_PIN_2, MD_GPIO_MODE_ANALOG);
+ break;
+ case 3:
+ md_gpio_set_mode(GPIOA, MD_GPIO_PIN_3, MD_GPIO_MODE_ANALOG);
+ break;
+ case 4:
+ md_gpio_set_mode(GPIOA, MD_GPIO_PIN_4, MD_GPIO_MODE_ANALOG);
+ break;
+ case 5:
+ md_gpio_set_mode(GPIOA, MD_GPIO_PIN_5, MD_GPIO_MODE_ANALOG);
+ break;
+ case 6:
+ md_gpio_set_mode(GPIOA, MD_GPIO_PIN_6, MD_GPIO_MODE_ANALOG);
+ break;
+ case 7:
+ md_gpio_set_mode(GPIOA, MD_GPIO_PIN_7, MD_GPIO_MODE_ANALOG);
+ break;
+ default:
+ break;
+ }
+}
+
+static rt_err_t es32f0_get_adc_value(struct rt_adc_device *device, rt_uint32_t channel, rt_uint32_t *value)
+{
+ rt_uint32_t chn_data[BSP_ADC_CHANNEL_NUM];
+ rt_uint32_t i;
+
+ RT_ASSERT(device != RT_NULL);
+ RT_ASSERT(value != RT_NULL);
+
+ /* config adc channel */
+ _adc_channel_config(channel);
+
+ md_adc_set_swtri_ss0(ADC);
+
+ while ((ADC->RIF & ADC_RIF_SS0RIF_MSK) == 0);
+
+ for (i=0; i
+#include
+#include "board.h"
+#include "drv_gpio.h"
+
+#ifdef RT_USING_PIN
+
+#define __ES32F0_PIN(index, gpio, gpio_index) {index, GPIO##gpio, gpio_index}
+#define __ES32F0_PIN_DEFAULT {-1, 0, 0}
+
+/* ES32F0 GPIO driver */
+struct pin_index
+{
+ int index;
+ GPIO_TypeDef *gpio;
+ uint32_t pin;
+};
+
+static const struct pin_index pins[] =
+{
+ __ES32F0_PIN_DEFAULT,
+ __ES32F0_PIN_DEFAULT,
+ __ES32F0_PIN(2, C, 13),
+ __ES32F0_PIN(3, C, 14),
+ __ES32F0_PIN(4, C, 15),
+ __ES32F0_PIN(5, D, 14),
+ __ES32F0_PIN(6, D, 15),
+ __ES32F0_PIN(7, D, 13),
+ __ES32F0_PIN(8, C, 0),
+ __ES32F0_PIN(9, C, 1),
+ __ES32F0_PIN(10, C, 2),
+ __ES32F0_PIN(11, C, 3),
+ __ES32F0_PIN_DEFAULT,
+ __ES32F0_PIN_DEFAULT,
+ __ES32F0_PIN(14, A, 0),
+ __ES32F0_PIN(15, A, 1),
+ __ES32F0_PIN(16, A, 2),
+ __ES32F0_PIN(17, A, 3),
+ __ES32F0_PIN(18, D, 0),
+ __ES32F0_PIN(19, D, 1),
+ __ES32F0_PIN(20, A, 4),
+ __ES32F0_PIN(21, A, 5),
+ __ES32F0_PIN(22, A, 6),
+ __ES32F0_PIN(23, A, 7),
+ __ES32F0_PIN(24, C, 4),
+ __ES32F0_PIN(25, C, 5),
+ __ES32F0_PIN(26, B, 0),
+ __ES32F0_PIN(27, B, 1),
+ __ES32F0_PIN(28, B, 2),
+ __ES32F0_PIN(29, B, 10),
+ __ES32F0_PIN(30, B, 11),
+ __ES32F0_PIN_DEFAULT,
+ __ES32F0_PIN_DEFAULT,
+ __ES32F0_PIN(33, B, 12),
+ __ES32F0_PIN(34, B, 13),
+ __ES32F0_PIN(35, B, 14),
+ __ES32F0_PIN(36, B, 15),
+ __ES32F0_PIN(37, C, 6),
+ __ES32F0_PIN(38, C, 7),
+ __ES32F0_PIN(39, C, 8),
+ __ES32F0_PIN(40, C, 9),
+ __ES32F0_PIN(41, A, 8),
+ __ES32F0_PIN(42, A, 9),
+ __ES32F0_PIN(43, A, 10),
+ __ES32F0_PIN(44, A, 11),
+ __ES32F0_PIN(45, A, 12),
+ __ES32F0_PIN(46, A, 13),
+ __ES32F0_PIN_DEFAULT,
+ __ES32F0_PIN_DEFAULT,
+ __ES32F0_PIN(49, A, 14),
+ __ES32F0_PIN(50, A, 15),
+ __ES32F0_PIN(51, C, 10),
+ __ES32F0_PIN(52, C, 11),
+ __ES32F0_PIN(53, C, 12),
+ __ES32F0_PIN(54, D, 2),
+ __ES32F0_PIN(55, B, 3),
+ __ES32F0_PIN(56, B, 4),
+ __ES32F0_PIN(57, B, 5),
+ __ES32F0_PIN(58, B, 6),
+ __ES32F0_PIN(59, B, 7),
+ __ES32F0_PIN(60, D, 3),
+ __ES32F0_PIN(61, B, 8),
+ __ES32F0_PIN(62, B, 9),
+ __ES32F0_PIN_DEFAULT,
+ __ES32F0_PIN_DEFAULT,
+};
+
+struct pin_irq_map
+{
+ rt_uint16_t pinbit;
+ IRQn_Type irqno;
+};
+static const struct pin_irq_map pin_irq_map[] =
+{
+ {0, EXTI_0to1_IRQn},
+ {1, EXTI_0to1_IRQn},
+ {2, EXTI_2to3_IRQn},
+ {3, EXTI_2to3_IRQn},
+ {4, EXTI_4to15_IRQn},
+ {5, EXTI_4to15_IRQn},
+ {6, EXTI_4to15_IRQn},
+ {7, EXTI_4to15_IRQn},
+ {8, EXTI_4to15_IRQn},
+ {9, EXTI_4to15_IRQn},
+ {10, EXTI_4to15_IRQn},
+ {11, EXTI_4to15_IRQn},
+ {12, EXTI_4to15_IRQn},
+ {13, EXTI_4to15_IRQn},
+ {14, EXTI_4to15_IRQn},
+ {15, EXTI_4to15_IRQn},
+};
+
+struct rt_pin_irq_hdr pin_irq_hdr_tab[] =
+{
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+ { -1, 0, RT_NULL, RT_NULL},
+};
+
+#define ITEM_NUM(items) sizeof(items) / sizeof(items[0])
+const struct pin_index *get_pin(uint8_t pin)
+{
+ const struct pin_index *index;
+ if (pin < ITEM_NUM(pins))
+ {
+ index = &pins[pin];
+ if (index->index == -1)
+ index = RT_NULL;
+ }
+ else
+ {
+ index = RT_NULL;
+ }
+ return index;
+};
+
+void es32f0_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value)
+{
+ const struct pin_index *index;
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return;
+ }
+
+ /* Write GPIO */
+ if (value == 0)
+ SET_BIT(index->gpio->BSBR, 0x1<<(index->pin+16));
+ else
+ SET_BIT(index->gpio->BSBR, 0x1<pin);
+}
+
+int es32f0_pin_read(rt_device_t dev, rt_base_t pin)
+{
+ int value;
+ const struct pin_index *index;
+ value = PIN_LOW;
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return value;
+ }
+
+ /* Read the GPIO value with the spcified index */
+ value = (index->gpio->IDATA & (0x1<pin)) != 0;
+
+ return value;
+}
+
+void es32f0_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
+{
+ const struct pin_index *index;
+ GPIO_TypeDef *gpiox;
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return;
+ }
+
+ /* Get the IO port */
+ gpiox = index->gpio;
+
+ /* Config GPIO */
+ switch(mode)
+ {
+ case PIN_MODE_OUTPUT:
+ {
+ /* pushpull & output & 16mA */
+ MODIFY_REG(gpiox->MOD, (0x3<<(index->pin*2)), (0x1<<(index->pin*2)));
+ CLEAR_BIT(gpiox->OT, (0x1<pin));
+ CLEAR_BIT(gpiox->DS, (0x1<pin));
+ break;
+ }
+ case PIN_MODE_OUTPUT_OD:
+ {
+ /* opendrain & output & 16mA */
+ MODIFY_REG(gpiox->MOD, (0x3<pin), (0x1<pin));
+ SET_BIT(gpiox->OT, (0x1<pin));
+ CLEAR_BIT(gpiox->DS, (0x1<pin));
+ break;
+ }
+ case PIN_MODE_INPUT:
+ {
+ /* input & no pull & CMOS & filter */
+ MODIFY_REG(gpiox->MOD, (0x3<pin), (0x0<pin));
+ MODIFY_REG(gpiox->PUD, (0x3<pin), (0x0<pin));
+ SET_BIT(gpiox->IST, (0x1<pin));
+ SET_BIT(gpiox->FIR, (0x1<pin));
+ break;
+ }
+ case PIN_MODE_INPUT_PULLUP:
+ {
+ /* input & pull up & CMOS & filter */
+ MODIFY_REG(gpiox->MOD, (0x3<pin), (0x0<pin));
+ MODIFY_REG(gpiox->PUD, (0x3<pin), (0x1<pin));
+ SET_BIT(gpiox->IST, (0x1<pin));
+ SET_BIT(gpiox->FIR, (0x1<pin));
+ break;
+ }
+ case PIN_MODE_INPUT_PULLDOWN:
+ {
+ /* input & pull down & CMOS & filter */
+ MODIFY_REG(gpiox->MOD, (0x3<pin), (0x0<pin));
+ MODIFY_REG(gpiox->PUD, (0x3<pin), (0x2<pin));
+ SET_BIT(gpiox->IST, (0x1<pin));
+ SET_BIT(gpiox->FIR, (0x1<pin));
+ break;
+ }
+ default:
+ {
+ /* output */
+ MODIFY_REG(gpiox->MOD, (0x3<pin), (0x1<pin));
+ }
+ }
+}
+
+rt_inline const struct pin_irq_map *get_pin_irq_map(rt_uint16_t gpio_pin)
+{
+ rt_int32_t mapindex = gpio_pin & 0x00FF;
+ if (mapindex < 0 || mapindex >= ITEM_NUM(pin_irq_map))
+ {
+ return RT_NULL;
+ }
+ return &pin_irq_map[mapindex];
+};
+
+rt_err_t es32f0_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
+ rt_uint32_t mode, void (*hdr)(void *args), void *args)
+{
+ const struct pin_index *index;
+ rt_base_t level;
+ rt_int32_t irqindex;
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return RT_ENOSYS;
+ }
+ /* pin no. convert to dec no. */
+ for (irqindex = 0; irqindex < 16; irqindex++)
+ {
+ if ((0x01 << irqindex) == index->pin)
+ {
+ break;
+ }
+ }
+ if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
+ {
+ return RT_ENOSYS;
+ }
+ level = rt_hw_interrupt_disable();
+ if (pin_irq_hdr_tab[irqindex].pin == pin &&
+ pin_irq_hdr_tab[irqindex].hdr == hdr &&
+ pin_irq_hdr_tab[irqindex].mode == mode &&
+ pin_irq_hdr_tab[irqindex].args == args)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EOK;
+ }
+ if (pin_irq_hdr_tab[irqindex].pin != -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EBUSY;
+ }
+ pin_irq_hdr_tab[irqindex].pin = pin;
+ pin_irq_hdr_tab[irqindex].hdr = hdr;
+ pin_irq_hdr_tab[irqindex].mode = mode;
+ pin_irq_hdr_tab[irqindex].args = args;
+ rt_hw_interrupt_enable(level);
+ return RT_EOK;
+}
+
+rt_err_t es32f0_pin_detach_irq(struct rt_device *device, rt_int32_t pin)
+{
+ const struct pin_index *index;
+ rt_base_t level;
+ rt_int32_t irqindex = -1;
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return RT_ENOSYS;
+ }
+ irqindex = index->pin & 0x00FF;
+ if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
+ {
+ return RT_ENOSYS;
+ }
+ level = rt_hw_interrupt_disable();
+ if (pin_irq_hdr_tab[irqindex].pin == -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EOK;
+ }
+ pin_irq_hdr_tab[irqindex].pin = -1;
+ pin_irq_hdr_tab[irqindex].hdr = RT_NULL;
+ pin_irq_hdr_tab[irqindex].mode = 0;
+ pin_irq_hdr_tab[irqindex].args = RT_NULL;
+ rt_hw_interrupt_enable(level);
+ return RT_EOK;
+}
+
+rt_err_t es32f0_pin_irq_enable(struct rt_device *device, rt_base_t pin,
+ rt_uint32_t enabled)
+{
+ const struct pin_index *index;
+ const struct pin_irq_map *irqmap;
+ GPIO_TypeDef *gpiox;
+ rt_base_t level;
+ rt_int32_t irqindex = -1;
+
+ index = get_pin(pin);
+ if (index == RT_NULL)
+ {
+ return RT_ENOSYS;
+ }
+
+ /* Get the IO port */
+ gpiox = index->gpio;
+
+ if (enabled == PIN_IRQ_ENABLE)
+ {
+ /* pin no. convert to dec no. */
+ for (irqindex = 0; irqindex < 16; irqindex++)
+ {
+ if ((0x01 << irqindex) == index->pin)
+ {
+ break;
+ }
+ }
+ if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map))
+ {
+ return RT_ENOSYS;
+ }
+ level = rt_hw_interrupt_disable();
+ if (pin_irq_hdr_tab[irqindex].pin == -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_ENOSYS;
+ }
+ irqmap = &pin_irq_map[irqindex];
+
+ /* Config EXTI */
+ MODIFY_REG(gpiox->MOD, (0x3<pin), (0x0<pin));
+ SET_BIT(gpiox->FIR, index->pin);
+ SET_BIT(gpiox->IST, index->pin);
+ MODIFY_REG(((uint32_t *)(&EXTI->ICFG1))[index->pin/8],
+ 0xF<<(index->pin%8),
+ (((uint32_t)(index->gpio) - AHB2_BASE)/0x400)<<(index->pin%8));
+ SET_BIT(EXTI->DB, 0x1<pin);
+
+ switch (pin_irq_hdr_tab[irqindex].mode)
+ {
+ case PIN_IRQ_MODE_RISING:
+ {
+ /* pull down the pin */
+ MODIFY_REG(gpiox->PUD, (0x3<pin), (0x2<pin));
+ /* Enable EXTI rising interrupt and disable falling interrupt */
+ SET_BIT(EXTI->RTS, (0x1<pin));
+ CLEAR_BIT(EXTI->FTS, (0x1<pin));
+ break;
+ }
+ case PIN_IRQ_MODE_FALLING:
+ {
+ /* pull up the pin */
+ MODIFY_REG(gpiox->PUD, (0x3<pin), (0x1<pin));
+ /* Enable EXTI falling interrupt and disable rising interrupt */
+ CLEAR_BIT(EXTI->RTS, (0x1<pin));
+ SET_BIT(EXTI->FTS, (0x1<pin));
+ break;
+ }
+ case PIN_IRQ_MODE_RISING_FALLING:
+ {
+ /* pull up the pin */
+ MODIFY_REG(gpiox->PUD, (0x3<pin), (0x1<pin));
+ /* Enable EXTI falling interrupt and enable rising interrupt */
+ SET_BIT(EXTI->RTS, (0x1<pin));
+ SET_BIT(EXTI->FTS, (0x1<pin));
+ break;
+ }
+ }
+
+ /* Enable EXTI interrupt */
+ SET_BIT(EXTI->IER, (0x1<pin));
+ NVIC_EnableIRQ(irqmap->irqno);
+ rt_hw_interrupt_enable(level);
+ }
+ else if (enabled == PIN_IRQ_DISABLE)
+ {
+ irqmap = get_pin_irq_map(index->pin);
+ if (irqmap == RT_NULL)
+ {
+ return RT_ENOSYS;
+ }
+ NVIC_DisableIRQ(irqmap->irqno);
+ }
+ else
+ {
+ return RT_ENOSYS;
+ }
+ return RT_EOK;
+}
+
+const static struct rt_pin_ops _es32f0_pin_ops =
+{
+ es32f0_pin_mode,
+ es32f0_pin_write,
+ es32f0_pin_read,
+ es32f0_pin_attach_irq,
+ es32f0_pin_detach_irq,
+ es32f0_pin_irq_enable,
+};
+
+int rt_hw_pin_init(void)
+{
+ int result;
+
+ /* Open IO clock */
+ SET_BIT(RCU->AHBEN, RCU_AHBEN_GPDEN_MSK|RCU_AHBEN_GPCEN_MSK \
+ |RCU_AHBEN_GPBEN_MSK|RCU_AHBEN_GPAEN_MSK);
+
+ /* register IO device */
+ result = rt_device_pin_register("pin", &_es32f0_pin_ops, RT_NULL);
+ return result;
+}
+INIT_BOARD_EXPORT(rt_hw_pin_init);
+
+rt_inline void pin_irq_hdr(uint16_t GPIO_Pin)
+{
+ uint16_t irqno;
+ /* pin no. convert to dec no. */
+ for (irqno = 0; irqno < 16; irqno++)
+ {
+ if ((0x01 << irqno) == GPIO_Pin)
+ {
+ break;
+ }
+ }
+ if (irqno == 16)
+ return;
+ if (pin_irq_hdr_tab[irqno].hdr)
+ {
+ pin_irq_hdr_tab[irqno].hdr(pin_irq_hdr_tab[irqno].args);
+ }
+}
+
+void GPIO_EXTI_Callback(uint16_t GPIO_Pin)
+{
+ /* Read the exti interrupt then clear the flag */
+ if ((EXTI->RIF & (0x1<ICR, 0x1<
+#include
+#include
+#include
+#include
+#include "md_ad16c4t.h"
+#include "md_rcu.h"
+
+#ifdef RT_USING_HWTIMER
+
+/* Defien the hardware timer control struct */
+struct es32f0_hwtimer_dev
+{
+ rt_hwtimer_t parent;
+ AD16C4T_TypeDef *hwtimer_periph;
+ IRQn_Type IRQn;
+};
+
+#ifdef BSP_USING_HWTIMER1
+static struct es32f0_hwtimer_dev hwtimer1;
+
+void BS16T1_IRQHandler(void)
+{
+ /* if BS16T1 IT */
+ if (BS16T1->IFM & AD16C4T_RIF_UI_MSK)
+ {
+ SET_BIT(BS16T1->ICR, AD16C4T_ICR_UI_MSK);
+ rt_device_hwtimer_isr(&hwtimer1.parent);
+
+ if (HWTIMER_MODE_ONESHOT == hwtimer1.parent.mode)
+ {
+ CLEAR_BIT(BS16T1->CON1, AD16C4T_CON1_CNTEN_MSK);
+ }
+ }
+}
+#endif
+
+static struct rt_hwtimer_info es32f0_hwtimer_info =
+{
+ 48000000, /* maximum count frequency */
+ 1, /* minimum count frequency */
+ 65535, /* counter maximum value */
+ HWTIMER_CNTMODE_UP
+};
+
+static void es32f0_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state)
+{
+ struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data;
+
+ RT_ASSERT(hwtimer != RT_NULL);
+
+ if (1 == state)
+ {
+ /* Set frequency */
+ WRITE_REG(hwtimer->hwtimer_periph->PRES, (SystemCoreClock/hwtimer->parent.freq - 1));
+ /* Enable timer IT */
+ SET_BIT(hwtimer->hwtimer_periph->IER, AD16C4T_IER_UI_MSK);
+ NVIC_EnableIRQ(hwtimer->IRQn);
+ }
+ else
+ {
+ /* Dsiable timer IT */
+ SET_BIT(hwtimer->hwtimer_periph->IDR, AD16C4T_IER_UI_MSK);
+ }
+}
+
+static rt_err_t es32f0_hwtimer_start(rt_hwtimer_t *timer,
+ rt_uint32_t cnt,
+ rt_hwtimer_mode_t mode)
+{
+ struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data;
+
+ RT_ASSERT(hwtimer != RT_NULL);
+
+ WRITE_REG(hwtimer->hwtimer_periph->AR, cnt);
+ SET_BIT(hwtimer->hwtimer_periph->CON1, AD16C4T_CON1_CNTEN_MSK);
+
+ return RT_EOK;
+}
+
+static void es32f0_hwtimer_stop(rt_hwtimer_t *timer)
+{
+ struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data;
+
+ RT_ASSERT(hwtimer != RT_NULL);
+
+ CLEAR_BIT(hwtimer->hwtimer_periph->CON1, AD16C4T_CON1_CNTEN_MSK);
+}
+
+static rt_uint32_t es32f0_hwtimer_count_get(rt_hwtimer_t *timer)
+{
+ struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data;
+ uint32_t hwtimer_count = 0;
+
+ RT_ASSERT(hwtimer != RT_NULL);
+
+ hwtimer_count = READ_REG(hwtimer->hwtimer_periph->COUNT);
+
+ return hwtimer_count;
+}
+
+static rt_err_t es32f0_hwtimer_control(rt_hwtimer_t *timer,
+ rt_uint32_t cmd,
+ void *args)
+{
+ rt_err_t ret = RT_EOK;
+ rt_uint32_t freq = 0;
+ struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data;
+
+ RT_ASSERT(hwtimer != RT_NULL);
+
+ switch (cmd)
+ {
+ case HWTIMER_CTRL_FREQ_SET:
+ freq = *(rt_uint32_t *)args;
+ if ((freq < hwtimer->parent.info->minfreq) || (freq > hwtimer->parent.info->maxfreq))
+ {
+ ret = RT_EINVAL;
+ }
+ /* Set frequency */
+ WRITE_REG(hwtimer->hwtimer_periph->PRES, (SystemCoreClock/freq - 1));
+ break;
+
+ case HWTIMER_CTRL_STOP:
+ CLEAR_BIT(hwtimer->hwtimer_periph->CON1, AD16C4T_CON1_CNTEN_MSK);
+ break;
+
+ default:
+ ret = RT_EINVAL;
+ break;
+ }
+
+ return ret;
+}
+
+static struct rt_hwtimer_ops es32f0_hwtimer_ops =
+{
+ es32f0_hwtimer_init,
+ es32f0_hwtimer_start,
+ es32f0_hwtimer_stop,
+ es32f0_hwtimer_count_get,
+ es32f0_hwtimer_control
+};
+
+int rt_hw_hwtimer_init(void)
+{
+ rt_err_t ret = RT_EOK;
+
+#ifdef BSP_USING_HWTIMER1
+ /*Open clock*/
+ SET_BIT(RCU->APB1EN, RCU_APB1EN_BS16T1EN_MSK);
+
+ hwtimer1.hwtimer_periph = BS16T1;
+ hwtimer1.IRQn = BS16T1_IRQn;
+ hwtimer1.parent.info = &es32f0_hwtimer_info;
+ hwtimer1.parent.ops = &es32f0_hwtimer_ops;
+ ret = rt_device_hwtimer_register(&hwtimer1.parent, "timer1", &hwtimer1);
+#endif
+
+ return ret;
+}
+INIT_BOARD_EXPORT(rt_hw_hwtimer_init);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_hwtimer.h b/bsp/essemi/es32f0271/drivers/drv_hwtimer.h
new file mode 100644
index 0000000000000000000000000000000000000000..576671e73537d41c6b8b000b7434e2bbe48fbe68
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_hwtimer.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#ifndef DRV_HWTIMER_H__
+#define DRV_HWTIMER_H__
+
+int rt_hw_hwtimer_init(void);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_i2c.c b/bsp/essemi/es32f0271/drivers/drv_i2c.c
new file mode 100644
index 0000000000000000000000000000000000000000..5d863fc447617652b6e93716375231c992cf8d6d
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_i2c.c
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#include
+#include
+#include
+#include "board.h"
+#include "drv_i2c.h"
+#include "md_i2c.h"
+#include "md_gpio.h"
+
+#ifdef RT_USING_I2C
+
+#define TIMEOUT 0xF
+/* Define I2C hardware SCL timeout */
+#define I2C_TIMING_48MHZ_CLK100KHZ ((0xBU<<28)|(4<<20)|(2<<16)|(0xF<<8)|(0x13))
+
+/**
+ * @brief: I2C receive.
+ * @param: i2cx, pointer to the I2Cx
+ * @param: addr, address
+ * @param: buf, send data buffer
+ * @param: len, the length of buf
+ * @param: timout, timeout
+ * @retval: rt_err_t
+ */
+static rt_err_t __i2c_master_recv(I2C_TypeDef *i2cx, rt_uint16_t addr,
+ rt_uint8_t *buf, rt_uint16_t len, rt_uint32_t timout)
+{
+ rt_uint32_t rt_timout;
+
+ //
+ // Config I2C transfer mode
+ //
+ md_i2c_set_con2_add10(i2cx, MD_I2C_ADDRESSINGMODE_7BIT);
+ /* Config slaver address */
+ md_i2c_set_con2_sadd(i2cx, addr);
+ /* Config data size */
+ md_i2c_set_con2_nbytes(i2cx, len);
+ /* Reset TX FIFO */
+ md_i2c_set_fcon_txfrst(i2cx, MD_I2C_TXFIFO_RESET);
+ /* Config mode */
+ md_i2c_set_con2_rd_wrn(i2cx, MD_I2C_MASTER_READ);
+ /* Config auto-reload */
+ md_i2c_set_con2_reload(i2cx, MD_I2C_NORELOAD_MODE);
+ /* When NBYTES is matched, the communication will be automatically stop */
+ md_i2c_set_con2_autoend(i2cx, MD_I2C_AUTOEND_MODE);
+ /* Start the I2C communication */
+ md_i2c_set_con2_start(i2cx, MD_I2C_START_GENERATION);
+
+ while (len > 0)
+ {
+ /* Wait Rx FIFO non-empty */
+ rt_timout = timout;
+ while (md_i2c_is_active_stat_rxe(i2cx) && (--rt_timout));
+ if (rt_timout == 0)
+ return RT_ETIMEOUT;
+
+ *buf++ = md_i2c_recv(i2cx);
+ len--;
+ }
+
+ return RT_EOK;
+}
+
+/**
+ * @brief: I2C send.
+ * @param: i2cx, pointer to the I2Cx
+ * @param: addr, address
+ * @param: buf, send data buffer
+ * @param: len, the length of buf
+ * @param: timout, timeout
+ * @retval: rt_err_t
+ */
+static rt_err_t __i2c_master_send(I2C_TypeDef *i2cx, rt_uint16_t addr,
+ rt_uint8_t *buf, rt_uint16_t len, rt_uint32_t timout)
+{
+ rt_uint32_t rt_timout;
+ rt_uint8_t index;
+
+ //
+ // Config I2C transfer mode
+ //
+ md_i2c_set_con2_add10(i2cx, MD_I2C_ADDRESSINGMODE_7BIT);
+ /* Config slaver address */
+ md_i2c_set_con2_sadd(i2cx, addr);
+ /* Config data size */
+ md_i2c_set_con2_nbytes(i2cx, len);
+ /* Reset TX FIFO */
+ md_i2c_set_fcon_txfrst(i2cx, MD_I2C_TXFIFO_RESET);
+ /* Config mode */
+ md_i2c_set_con2_rd_wrn(i2cx, MD_I2C_MASTER_WRITE);
+ /* Enable auto-end */
+ md_i2c_set_con2_autoend(i2cx, MD_I2C_AUTOEND_MODE);
+
+ //
+ // Check if the bus is busy
+ //
+ /* Wait bus to be ready */
+ rt_timout = timout;
+ while ((READ_BIT(i2cx->STAT, I2C_STAT_BUSY_MSK) == I2C_STAT_BUSY_MSK) && (--rt_timout));
+ if (rt_timout == 0)
+ return RT_EBUSY;
+
+ //
+ // Start to send
+ //
+ if (len <= 8)
+ {
+ for (index = 0; index < len; index++)
+ md_i2c_send(i2cx, *buf++);
+
+ len = 0;
+ }
+ else
+ {
+ for (index = 0; index < 8; index++)
+ md_i2c_send(i2cx, *buf++);
+
+ len -= 8;
+ }
+
+ /* Start the I2C communication */
+ md_i2c_set_con2_start(i2cx, MD_I2C_START_GENERATION);
+
+ while (len > 0)
+ {
+ rt_timout = timout;
+ while (md_i2c_is_active_stat_txf(i2cx) && (--rt_timout));
+ if (rt_timout == 0)
+ return RT_ETIMEOUT;
+
+ md_i2c_send(i2cx, *buf++);
+ len--;
+ }
+
+ return RT_EOK;
+}
+
+static rt_size_t es32f0_master_xfer(struct rt_i2c_bus_device *bus,
+ struct rt_i2c_msg msgs[],
+ rt_uint32_t num)
+{
+ struct rt_i2c_msg *msg;
+ rt_uint32_t i;
+ rt_err_t ret = RT_ERROR;
+
+ for (i = 0; i < num; i++)
+ {
+ msg = &msgs[i];
+ if (msg->flags & RT_I2C_RD)
+ {
+ if (__i2c_master_recv(bus->priv, msg->addr << 1, msg->buf, msg->len, TIMEOUT) != 0)
+ {
+ i2c_dbg("i2c bus write failed,i2c bus stop!\n");
+ goto out;
+ }
+ }
+ else
+ {
+ if (__i2c_master_send(bus->priv, msg->addr << 1, msg->buf, msg->len, TIMEOUT) != 0)
+ {
+ i2c_dbg("i2c bus write failed,i2c bus stop!\n");
+ goto out;
+ }
+ }
+ }
+
+ ret = i;
+
+out:
+ i2c_dbg("send stop condition\n");
+
+ return ret;
+}
+
+const struct rt_i2c_bus_device_ops es32f0_i2c_ops =
+{
+ es32f0_master_xfer,
+ RT_NULL,
+ RT_NULL,
+};
+
+static void _i2c_init(void)
+{
+ md_i2c_inittypedef I2C_Init =
+ {
+ .Timing = CLK100kHz48M,
+ .Address1 = 0x55 << 1,
+ .AddrSize = MD_I2C_ADDRESSINGMODE_7BIT,
+ .DualAddressMode = MD_I2C_DUALADDRESS_DISABLE,
+ .Address2 = 0xAA,
+ .Address2Masks = MD_I2C_ADDR2_NOMASK
+ };
+
+#ifdef BSP_USING_I2C1
+ /* Open I2C clock */
+ SET_BIT(RCU->APB1EN, RCU_APB1EN_I2C1EN_MSK);
+
+ /* GPIO configuration */
+ md_gpio_set_pull (GPIOC, MD_GPIO_PIN_12, MD_GPIO_PULL_UP);
+ md_gpio_set_pull (GPIOD, MD_GPIO_PIN_2, MD_GPIO_PULL_UP);
+ md_gpio_set_output_type (GPIOC, MD_GPIO_PIN_12, MD_GPIO_OUTPUT_OPENDRAIN);
+ md_gpio_set_output_type (GPIOD, MD_GPIO_PIN_2, MD_GPIO_OUTPUT_OPENDRAIN);
+ md_gpio_set_mode (GPIOC, MD_GPIO_PIN_12, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOD, MD_GPIO_PIN_2, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_function8_15(GPIOC, MD_GPIO_PIN_12, MD_GPIO_AF1);
+ md_gpio_set_function0_7 (GPIOD, MD_GPIO_PIN_2, MD_GPIO_AF1);
+
+ //
+ // Config I2C
+ //
+ md_i2c_init(I2C1, &I2C_Init);
+#endif
+
+#ifdef BSP_USING_I2C2
+ /* Open I2C clock */
+ SET_BIT(RCU->APB1EN, RCU_APB1EN_I2C2EN_MSK);
+
+ /* GPIO configuration */
+ md_gpio_set_pull (GPIOB, MD_GPIO_PIN_10, MD_GPIO_PULL_UP);
+ md_gpio_set_pull (GPIOB, MD_GPIO_PIN_11, MD_GPIO_PULL_UP);
+ md_gpio_set_output_type (GPIOB, MD_GPIO_PIN_10, MD_GPIO_OUTPUT_OPENDRAIN);
+ md_gpio_set_output_type (GPIOB, MD_GPIO_PIN_11, MD_GPIO_OUTPUT_OPENDRAIN);
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_10, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_11, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_function8_15(GPIOB, MD_GPIO_PIN_10, MD_GPIO_AF1);
+ md_gpio_set_function8_15(GPIOB, MD_GPIO_PIN_11, MD_GPIO_AF1);
+
+ //
+ // Config I2C
+ //
+ md_i2c_init(I2C2, &I2C_Init);
+#endif
+}
+
+#ifdef BSP_USING_I2C2
+static struct rt_i2c_bus_device i2c_device2;
+#endif
+
+#ifdef BSP_USING_I2C1
+static struct rt_i2c_bus_device i2c_device1;
+#endif
+int rt_hw_i2c_init(void)
+{
+ _i2c_init();
+
+#ifdef BSP_USING_I2C2
+ /* define i2c Instance */
+ rt_memset((void *)&i2c_device2, 0, sizeof(struct rt_i2c_bus_device));
+ i2c_device2.ops = &es32f0_i2c_ops;
+ i2c_device2.priv = I2C2;
+ rt_i2c_bus_device_register(&i2c_device2, "i2c2");
+#endif
+
+#ifdef BSP_USING_I2C1
+ /* define i2c Instance */
+ rt_memset((void *)&i2c_device1, 0, sizeof(struct rt_i2c_bus_device));
+ i2c_device1.ops = &es32f0_i2c_ops;
+ i2c_device1.priv = I2C1;
+ rt_i2c_bus_device_register(&i2c_device1, "i2c1");
+#endif
+
+ return RT_EOK;
+}
+INIT_DEVICE_EXPORT(rt_hw_i2c_init);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_i2c.h b/bsp/essemi/es32f0271/drivers/drv_i2c.h
new file mode 100644
index 0000000000000000000000000000000000000000..7af06805f70c18188f37725c999eadf1715585cb
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_i2c.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#ifndef DRV_I2C_H__
+#define DRV_I2C_H__
+
+int rt_hw_i2c_init(void);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_pwm.c b/bsp/essemi/es32f0271/drivers/drv_pwm.c
new file mode 100644
index 0000000000000000000000000000000000000000..768fcd04cd6b943c5e285e0a87368a202dbd18ed
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_pwm.c
@@ -0,0 +1,208 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#include
+#include
+#include
+#include
+#include "md_gpio.h"
+
+/* PWM device control struct */
+struct pwm_dev_ctrl {
+ AD16C4T_TypeDef *timx;
+ rt_uint8_t chnm; /* Cannel number */
+ struct rt_pwm_configuration *cfg;
+};
+
+#ifdef BSP_USING_PWM_GP16C2T1
+
+/* Remember channel configuration */
+static struct rt_pwm_configuration pwm_ch_cfg_gp16c2t1[2] = {
+ [0] = {
+ .channel = 1,
+ .period = 0,
+ .pulse = 0
+ },
+ [1] = {
+ .channel = 2,
+ .period = 0,
+ .pulse = 0
+ }
+};
+
+/* Define static device */
+static struct rt_device_pwm pwm_dev_gp16c2t1;
+static struct pwm_dev_ctrl pwm_dev_gp16c2t1_ctrl;
+#endif
+#ifdef BSP_USING_PWM_GP16C2T4
+
+/* Remember channel configuration */
+static struct rt_pwm_configuration pwm_ch_cfg_gp16c2t4[2] = {
+ [0] = {
+ .channel = 1,
+ .period = 0,
+ .pulse = 0
+ },
+ [1] = {
+ .channel = 2,
+ .period = 0,
+ .pulse = 0
+ }
+};
+
+/* Define static device */
+static struct rt_device_pwm pwm_dev_gp16c2t4;
+static struct pwm_dev_ctrl pwm_dev_gp16c2t4_ctrl;
+#endif
+
+static void pwm_auto_config_freq(AD16C4T_TypeDef *timerx, uint32_t ns)
+{
+ uint32_t temp_ar;
+ uint32_t temp_pres = timerx->PRES & 0xFFFF;
+ uint32_t err_cnt = 0;
+
+ /* Automatic setting frequency division ratio */
+ while (err_cnt++ < 65536)
+ {
+ temp_ar = (uint64_t)SystemCoreClock * ns / 1000000000 / (temp_pres + 1);
+ if (temp_ar <= 0xFFFF)
+ break;
+ temp_pres++;
+ }
+
+ /* Write back to PRES */
+ timerx->PRES = (uint16_t)(temp_pres & 0xFFFF);
+ timerx->AR = temp_ar;
+}
+
+static void pwm_set_duty(AD16C4T_TypeDef *timerx, uint8_t ch, uint32_t ns)
+{
+ uint32_t temp_pres = timerx->PRES & 0xFFFF;
+ uint64_t tmp = (uint64_t)SystemCoreClock * ns / 1000000000 / (temp_pres + 1);
+
+ if (ch == 1)
+ WRITE_REG(timerx->CCVAL1, (uint32_t)tmp);
+ else if (ch == 2)
+ WRITE_REG(timerx->CCVAL2, (uint32_t)tmp);
+}
+
+static rt_err_t es32f0_pwm_control(struct rt_device_pwm *device, int cmd, void *arg)
+{
+ rt_err_t ret = RT_EOK;
+ struct pwm_dev_ctrl *dev_ctrl
+ = (struct pwm_dev_ctrl *)device->parent.user_data;
+ struct rt_pwm_configuration *cfg = (struct rt_pwm_configuration *)arg;
+ AD16C4T_TypeDef *timerx = (AD16C4T_TypeDef *)dev_ctrl->timx;
+
+ switch (cmd)
+ {
+ case PWM_CMD_ENABLE:
+ {
+ if (cfg->channel == 1)
+ SET_BIT(timerx->CCEP, AD16C4T_CCEP_CC1EN_MSK);
+ else if (cfg->channel == 2)
+ SET_BIT(timerx->CCEP, AD16C4T_CCEP_CC2EN_MSK);
+ break;
+ }
+ case PWM_CMD_DISABLE:
+ {
+ if (cfg->channel == 1)
+ CLEAR_BIT(timerx->CCEP, AD16C4T_CCEP_CC1EN_MSK);
+ else if (cfg->channel == 2)
+ CLEAR_BIT(timerx->CCEP, AD16C4T_CCEP_CC2EN_MSK);
+ break;
+ }
+ case PWM_CMD_SET:
+ {
+ /* count registers max 0xFFFF, auto adjust prescaler */
+ pwm_auto_config_freq(timerx, cfg->period);
+ pwm_set_duty(timerx, cfg->channel, cfg->pulse);
+ /* Remember configuration */
+ dev_ctrl->cfg[cfg->channel-1].period = cfg->period;
+ dev_ctrl->cfg[cfg->channel-1].pulse = cfg->pulse;
+ break;
+ }
+ case PWM_CMD_GET:
+ {
+ cfg->period = dev_ctrl->cfg[cfg->channel-1].period;
+ cfg->pulse = dev_ctrl->cfg[cfg->channel-1].pulse;
+ break;
+ }
+
+ default:
+ break;
+ }
+ return ret;
+}
+
+const static struct rt_pwm_ops es32f0_pwm_ops =
+{
+ es32f0_pwm_control
+};
+
+int rt_hw_pwm_init(void)
+{
+ rt_err_t ret = RT_EOK;
+
+#ifdef BSP_USING_PWM_GP16C2T1 /* 2 channels */
+ /* Open clock */
+ SET_BIT(RCU->APB2EN, RCU_APB2EN_GP16C2T1EN_MSK);
+
+ /* GPIO configuration */
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_1, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_2, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_1, MD_GPIO_AF5);
+ md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_2, MD_GPIO_AF5);
+
+ /* Timer configuration */
+ MODIFY_REG(GP16C2T1->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1MOD_MSK,
+ (6 << AD16C4T_CHMR1_OUTPUT_CH1MOD_POSS));
+ MODIFY_REG(GP16C2T1->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2MOD_MSK,
+ (6 << AD16C4T_CHMR1_OUTPUT_CH2MOD_POSS));
+ SET_BIT(GP16C2T1->BDCFG, AD16C4T_BDCFG_GOEN_MSK);
+ SET_BIT(GP16C2T1->CON1, AD16C4T_CON1_CNTEN_MSK);
+
+ pwm_dev_gp16c2t1_ctrl.chnm = 2;
+ pwm_dev_gp16c2t1_ctrl.timx = GP16C2T1;
+ pwm_dev_gp16c2t1_ctrl.cfg = pwm_ch_cfg_gp16c2t1;
+ /* Register PWM device */
+ ret = rt_device_pwm_register(&pwm_dev_gp16c2t1,
+ "pwm1", &es32f0_pwm_ops, &pwm_dev_gp16c2t1_ctrl);
+#endif
+
+#ifdef BSP_USING_PWM_GP16C2T4 /* 2 channels */
+ /* Open clock */
+ SET_BIT(RCU->APB2EN, RCU_APB2EN_GP16C2T4EN_MSK);
+
+ /* GPIO configuration */
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_12, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_14, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_function8_15(GPIOB, MD_GPIO_PIN_12, MD_GPIO_AF5);
+ md_gpio_set_function8_15(GPIOB, MD_GPIO_PIN_14, MD_GPIO_AF5);
+
+ /* Timer configuration */
+ MODIFY_REG(GP16C2T4->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1MOD_MSK,
+ (6 << AD16C4T_CHMR1_OUTPUT_CH1MOD_POSS));
+ MODIFY_REG(GP16C2T4->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2MOD_MSK,
+ (6 << AD16C4T_CHMR1_OUTPUT_CH2MOD_POSS));
+ SET_BIT(GP16C2T4->BDCFG, AD16C4T_BDCFG_GOEN_MSK);
+ SET_BIT(GP16C2T4->CON1, AD16C4T_CON1_CNTEN_MSK);
+
+ pwm_dev_gp16c2t4_ctrl.chnm = 2;
+ pwm_dev_gp16c2t4_ctrl.timx = GP16C2T4;
+ pwm_dev_gp16c2t4_ctrl.cfg = pwm_ch_cfg_gp16c2t4;
+ /* Register PWM device */
+ ret = rt_device_pwm_register(&pwm_dev_gp16c2t4,
+ "pwm2", &es32f0_pwm_ops, &pwm_dev_gp16c2t4_ctrl);
+#endif
+
+ return ret;
+}
+INIT_DEVICE_EXPORT(rt_hw_pwm_init);
diff --git a/bsp/essemi/es32f0271/drivers/drv_pwm.h b/bsp/essemi/es32f0271/drivers/drv_pwm.h
new file mode 100644
index 0000000000000000000000000000000000000000..12c0364563a16688e71def91ca1c7b89cc8d903d
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_pwm.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#ifndef DRV_PWM_H__
+#define DRV_PWM_H__
+
+int rt_hw_pwm_init(void);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_rtc.c b/bsp/essemi/es32f0271/drivers/drv_rtc.c
new file mode 100644
index 0000000000000000000000000000000000000000..23bab4dc16bb58e5e64720118c9adb4c99c41769
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_rtc.c
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#include
+#include
+#include
+#include
+#include "board.h"
+#include "drv_rtc.h"
+
+#ifdef RT_USING_RTC
+
+/**
+ * @brief Time structure
+ */
+typedef struct
+{
+ uint8_t hour; /**< Hours */
+ uint8_t minute; /**< Minutes */
+ uint8_t second; /**< Seconds */
+ uint16_t sub_sec; /**< Sub-seconds */
+} rtc_time_t;
+
+/**
+ * @brief Date structure
+ */
+typedef struct
+{
+ uint8_t week; /**< Weeks */
+ uint8_t day; /**< days */
+ uint8_t month; /**< months */
+ uint8_t year; /**< years */
+} rtc_date_t;
+
+static rt_uint32_t bcd_to_dec(rt_uint32_t bcd)
+{
+ return ((bcd & 0xF) + ((bcd >> 4) & 0xF) * 10);
+}
+
+static void rtc_get_time(rtc_time_t *time)
+{
+ rt_uint32_t tmp = RTC->TIME;
+
+ time->second = bcd_to_dec(tmp & 0x7F);
+ time->minute = bcd_to_dec((tmp >> 8) & 0x7F);
+ time->hour = bcd_to_dec((tmp >> 16) & 0x7F);
+
+ return;
+}
+
+static void rtc_get_date(rtc_date_t *date)
+{
+ uint32_t tmp = RTC->CAL;
+
+ date->day = bcd_to_dec(tmp & 0x3F);
+ date->month = bcd_to_dec((tmp >> 8) & 0x1F);
+ date->year = bcd_to_dec((tmp >> 16) & 0xFF);
+ date->week = bcd_to_dec((RTC->TIME >> 24) & 0x7);
+
+ return;
+}
+
+static rt_err_t es32f0_rtc_control(rt_device_t dev, int cmd, void *args)
+{
+ rt_err_t result = RT_EOK;
+
+ struct tm time_temp;
+ struct tm *pNow;
+ rt_uint16_t timout = 0xFFF;
+ rtc_time_t *time = rt_malloc(sizeof(rtc_time_t));
+ rtc_date_t *date = rt_malloc(sizeof(rtc_date_t));
+
+ switch (cmd)
+ {
+ case RT_DEVICE_CTRL_RTC_GET_TIME:
+ {
+ /* Wait RTC data ready then read */
+ while ((--timout)&&((RTC->STAT & RTC_STAT_SYNDONE_MSK) != RTC_STAT_SYNDONE_MSK));
+ if (timout == 0)
+ result = RT_ERROR;
+ /* Read */
+ rtc_get_time(time);
+ rtc_get_date(date);
+
+ time_temp.tm_sec = time->second;
+ time_temp.tm_min = time->minute;
+ time_temp.tm_hour = time->hour;
+ time_temp.tm_wday = date->week - 1;
+ time_temp.tm_mday = date->day;
+ time_temp.tm_mon = date->month - 1;
+ time_temp.tm_year = date->year - 1900 + 2000;
+ *((time_t *)args) = mktime(&time_temp);
+ break;
+ }
+ case RT_DEVICE_CTRL_RTC_SET_TIME:
+ {
+ rt_enter_critical();
+ /* converts calendar time time into local time. */
+ pNow = localtime((const time_t *)args);
+ /* copy the statically located variable */
+ memcpy(&time_temp, pNow, sizeof(struct tm));
+ /* unlock scheduler. */
+ rt_exit_critical();
+
+ time->hour = time_temp.tm_hour;
+ time->minute = time_temp.tm_min;
+ time->second = time_temp.tm_sec;
+ date->year = time_temp.tm_year + 1900 - 2000;
+ date->month = time_temp.tm_mon + 1;
+ date->day = time_temp.tm_mday;
+ /* Stop RTC */
+ CLEAR_BIT(RTC->CON, RTC_CON_RTCEN_MSK);
+ WRITE_REG(RTC->TIME, ((time->hour/10)<hour%10)<minute/10)<minute%10)<second/10)<second%10)<CAL, ((date->year/10)<year%10)<month/10)<month%10)<day/10)<day%10)<CON, RTC_CON_RTCEN_MSK);
+ break;
+ }
+ case RT_DEVICE_CTRL_RTC_GET_ALARM:
+ break;
+
+ case RT_DEVICE_CTRL_RTC_SET_ALARM:
+ break;
+
+ default:
+ break;
+ }
+
+ rt_free(time);
+ rt_free(date);
+
+ return result;
+}
+
+#ifdef RT_USING_DEVICE_OPS
+const static struct rt_device_ops es32f0_rtc_ops =
+{
+ RT_NULL,
+ RT_NULL,
+ RT_NULL,
+ RT_NULL,
+ RT_NULL,
+ es32f0_rtc_control
+};
+#endif
+
+static struct rt_device rtc_dev;
+#define RTC_SOURCE_LOSC 0x1
+#define RTC_SOURCE_LRC 0x2
+int rt_hw_rtc_init(void)
+{
+ rt_err_t ret = RT_EOK;
+ rt_uint16_t timout = 0xFFFF;
+ rt_uint32_t rtc_clk = 32768-1;
+ rt_uint8_t rtc_src = RTC_SOURCE_LOSC;
+
+ /*
+ * Config RTC clock
+ * We config the external 32.768K crystal as RTC clock source for the first
+ * choice. If external 32.768K crystal is not ready, we will choose LRC.
+ */
+ /* Enable LOSC then wait it ready */
+ if ((RCU->CON & RCU_CON_LOSCON_MSK) != RCU_CON_LOSCON_MSK)
+ SET_BIT(RCU->CON, RCU_CON_LOSCON_MSK);
+
+ /* Wait external 32.768K crystal ready */
+ while (((RCU->CON & RCU_CON_LOSCRDY_MSK) != RCU_CON_LOSCRDY_MSK)&&(--timout));
+ if (timout == 0)
+ {
+ /* We use LRC if external 32.768K crystal is not ready */
+ if ((RCU->CON & RCU_CON_LRCON_MSK) != RCU_CON_LRCON_MSK)
+ SET_BIT(RCU->CON, RCU_CON_LRCON_MSK);
+ /* Wait LRC ready */
+ timout = 0xFF;
+ while (((RCU->CON & RCU_CON_LRCRDY_MSK) != RCU_CON_LRCRDY_MSK)&&(--timout));
+ rtc_clk = 32000-1;
+ rtc_src = RTC_SOURCE_LRC;
+ }
+
+ /* Open RTC clock */
+ SET_BIT(RCU->AHBEN, RCU_AHBEN_RTCEN_MSK);
+
+ /* Reset RTC */
+ SET_BIT(RCU->AHBRST, RCU_AHBRST_RTCEN_MSK);
+ CLEAR_BIT(RCU->AHBRST, RCU_AHBRST_RTCEN_MSK);
+ CLEAR_BIT(RTC->CON, RTC_CON_RTCEN_MSK);
+
+ /* Config RTC clock source */
+ MODIFY_REG(RTC->CON, RTC_CON_CKSEL_MSK, rtc_src<CON, RTC_CON_PSCALE_MSK|RTC_CON_SCALE_MSK,
+ ((rtc_clk&0x7F)<>7)&0xFF)<TIME, (0x3<CAL, (0x1<CON, RTC_CON_RTCEN_MSK);
+
+ rtc_dev.type = RT_Device_Class_RTC;
+ rtc_dev.rx_indicate = RT_NULL;
+ rtc_dev.tx_complete = RT_NULL;
+
+#ifdef RT_USING_DEVICE_OPS
+ rtc_dev.ops = &es32f0_rtc_ops;
+#else
+ rtc_dev.init = RT_NULL;
+ rtc_dev.open = RT_NULL;
+ rtc_dev.close = RT_NULL;
+ rtc_dev.read = RT_NULL;
+ rtc_dev.write = RT_NULL;
+ rtc_dev.control = es32f0_rtc_control;
+#endif
+
+ rtc_dev.user_data = RTC;
+
+ ret = rt_device_register(&rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR);
+
+ return ret;
+}
+INIT_DEVICE_EXPORT(rt_hw_rtc_init);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_rtc.h b/bsp/essemi/es32f0271/drivers/drv_rtc.h
new file mode 100644
index 0000000000000000000000000000000000000000..0fd0661026b7974e3d680cf30965912a7803421b
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_rtc.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#ifndef DRV_RTC_H__
+#define DRV_RTC_H__
+
+int rt_hw_rtc_init(void);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_spi.c b/bsp/essemi/es32f0271/drivers/drv_spi.c
new file mode 100644
index 0000000000000000000000000000000000000000..9a7fc3ab7064fc4462b3a0ac01cb1e33448bb600
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_spi.c
@@ -0,0 +1,439 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#include
+#include
+#include
+#include
+#include "board.h"
+#include "drv_spi.h"
+#include "md_spi.h"
+#include "md_gpio.h"
+
+#ifdef RT_USING_SPI
+
+#define SPITIMEOUT 0x0FFF
+
+static rt_err_t __spi_send(struct rt_spi_device *device, rt_uint8_t *buf,
+ rt_int32_t len, rt_uint32_t tmout);
+static rt_err_t __spi_recv(struct rt_spi_device *device, rt_uint8_t *buf,
+ rt_int32_t len, rt_uint32_t tmout);
+static rt_err_t __spi_send_recv(struct rt_spi_device *device, rt_uint8_t *tbuf,
+ rt_uint8_t *rbuf, rt_int32_t len, rt_uint32_t tmout);
+
+/**
+ * @brief: SPI single line send.
+ * @param: device, pointer to the SPI device
+ * @param: buf, send data buffer
+ * @param: len, the length of buf
+ * @param: tmout, timeout
+ * @retval: rt_err_t
+ */
+static rt_err_t __spi_send(struct rt_spi_device *device, rt_uint8_t *buf,
+ rt_int32_t len, rt_uint32_t tmout)
+{
+ SPI_TypeDef *hspi;
+ rt_uint32_t rt_timout;
+ rt_uint8_t temp_data;
+
+ /* Get the SPI port */
+ hspi = (SPI_TypeDef *)device->bus->parent.user_data;
+
+ /* Open SPI if it is disabled */
+ if (READ_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK) != SPI_CON1_SPIEN_MSK)
+ SET_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK);
+
+ while (len > 0)
+ {
+ /* Confirm that no data is being transmitted */
+ rt_timout = tmout;
+ while (((hspi->STAT & SPI_STAT_TXE_MSK) == 0) && (--rt_timout));
+ if (rt_timout == 0)
+ return RT_ETIMEOUT;
+
+ /* Send data */
+ if (device->config.data_width == 8)
+ {
+ hspi->DATA = *(rt_uint8_t *)buf;
+ buf++;
+ len--;
+ }
+ else if (device->config.data_width == 16)
+ {
+ hspi->DATA = *(rt_uint16_t *)buf;
+ buf += 2;
+ len -= 2;
+ }
+ else
+ return RT_EINVAL;
+ }
+
+ /* At here, we have transmitted all the data.
+ * The next step is to clear the IT flag.
+ */
+ for (rt_uint8_t i = 0; i < md_spi_get_stat_rxflv(hspi); i++)
+ temp_data = hspi->DATA;
+ UNUSED(temp_data);
+ hspi->ICR = hspi->RIF;
+
+ return RT_EOK;
+}
+
+/**
+ * @brief: SPI single line receive.
+ * @param: device, pointer to the SPI device
+ * @param: buf, receive data buffer
+ * @param: len, the length of buf
+ * @param: tmout, timeout
+ * @retval: rt_err_t
+ */
+static rt_err_t __spi_recv(struct rt_spi_device *device, rt_uint8_t *buf,
+ rt_int32_t len, rt_uint32_t tmout)
+{
+ SPI_TypeDef *hspi;
+ rt_uint32_t rt_timout;
+
+ /* Get the SPI port */
+ hspi = (SPI_TypeDef *)device->bus->parent.user_data;
+
+ /* Open SPI if it is disabled */
+ if (READ_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK) != SPI_CON1_SPIEN_MSK)
+ SET_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK);
+
+ /* Handle data in __spi_send_recv() function */
+ if (((device->config.mode & RT_SPI_SLAVE) == 0)
+ && ((device->config.mode & RT_SPI_3WIRE) == 0))
+ __spi_send_recv(device, buf, buf, len, tmout);
+
+ while (len > 0)
+ {
+ /* Waiting for data */
+ rt_timout = tmout;
+ while (((hspi->STAT & SPI_STAT_RXTH_MSK) == 0) && (--rt_timout));
+ if (rt_timout == 0)
+ return RT_ETIMEOUT;
+
+ /* Send data */
+ if (device->config.data_width == 8)
+ {
+ *(rt_uint8_t *)buf = hspi->DATA;
+ buf++;
+ len--;
+ }
+ else if (device->config.data_width == 16)
+ {
+ *(rt_uint16_t *)buf = hspi->DATA;
+ buf += 2;
+ len -= 2;
+ }
+ else
+ return RT_EINVAL;
+ }
+
+ /* At here, we have transmitted all the data.
+ * The next step is to clear the IT flag.
+ */
+ hspi->ICR = hspi->RIF;
+
+ return RT_EOK;
+}
+
+/**
+ * @brief: SPI two line transmission.
+ * @param: device, pointer to the SPI device
+ * @param: tbuf, send data buffer
+ * @param: rbuf, receive data buffer
+ * @param: len, the length of buf
+ * @param: tmout, timeout
+ * @retval: rt_err_t
+ */
+static rt_err_t __spi_send_recv(struct rt_spi_device *device, rt_uint8_t *tbuf,
+ rt_uint8_t *rbuf, rt_int32_t len, rt_uint32_t tmout)
+{
+ SPI_TypeDef *hspi;
+ rt_uint32_t rt_timout;
+
+ /* Get the SPI port */
+ hspi = (SPI_TypeDef *)device->bus->parent.user_data;
+
+ /* Open SPI if it is disabled */
+ if (READ_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK) != SPI_CON1_SPIEN_MSK)
+ SET_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK);
+
+ /* return error if SPI is in 1-line mode */
+ if ((device->config.mode & RT_SPI_3WIRE) == RT_SPI_3WIRE)
+ return RT_ERROR;
+
+ while (len > 0)
+ {
+ /* Confirm that no data is being transmitted */
+ rt_timout = tmout;
+ while (((hspi->STAT & SPI_STAT_TXE_MSK) == 0) && (--rt_timout));
+ if (rt_timout == 0)
+ return RT_ETIMEOUT;
+
+ /* Send data */
+ if (device->config.data_width == 8)
+ {
+ hspi->DATA = *(rt_uint8_t *)tbuf;
+ tbuf++;
+ len--;
+ }
+ else if (device->config.data_width == 16)
+ {
+ hspi->DATA = *(rt_uint16_t *)tbuf;
+ tbuf += 2;
+ len -= 2;
+ }
+ else
+ return RT_EINVAL;
+
+ /* Waiting for data */
+ rt_timout = tmout;
+ while (((hspi->STAT & SPI_STAT_RXTH_MSK) == 0) && (--rt_timout));
+ if (rt_timout == 0)
+ return RT_ETIMEOUT;
+
+ /* Send data */
+ if (device->config.data_width == 8)
+ {
+ *(rt_uint8_t *)rbuf = hspi->DATA;
+ rbuf++;
+ }
+ else if (device->config.data_width == 16)
+ {
+ *(rt_uint16_t *)rbuf = hspi->DATA;
+ rbuf += 2;
+ }
+ }
+
+ /* At here, we have transmitted all the data.
+ * The next step is to clear the IT flag.
+ */
+ hspi->ICR = hspi->RIF;
+
+ return RT_EOK;
+}
+
+rt_err_t spi_configure(struct rt_spi_device *device,
+ struct rt_spi_configuration *cfg)
+{
+ SPI_TypeDef *hspi;
+ hspi = (SPI_TypeDef *)device->bus->parent.user_data;
+
+ /* Close SPI temporarily */
+ md_spi_disable_con1_spien(hspi);
+
+ /* config spi mode */
+ if (cfg->mode & RT_SPI_SLAVE)
+ md_spi_set_con1_mstren(hspi, MD_SPI_MODE_SLAVE);
+ else
+ md_spi_set_con1_mstren(hspi, MD_SPI_MODE_MASTER);
+
+ /* Config data mode */
+ if (cfg->mode & RT_SPI_3WIRE)
+ md_spi_set_con1_bidimode(hspi, MD_SPI_HALF_DUPLEX);
+ else
+ md_spi_set_con1_bidimode(hspi, MD_SPI_FULL_DUPLEX);
+
+ /* Config data width */
+ if (cfg->data_width == 8)
+ md_spi_set_con1_flen(hspi, MD_SPI_FRAME_FORMAT_8BIT);
+ else if (cfg->data_width == 16)
+ md_spi_set_con1_flen(hspi, SPI_CON1_FLEN_MSK);
+
+ /* Config phase */
+ if (cfg->mode & RT_SPI_CPHA)
+ md_spi_set_con1_cpha(hspi, MD_SPI_PHASE_2EDGE);
+ else
+ md_spi_set_con1_cpha(hspi, MD_SPI_PHASE_1EDGE);
+
+ /* Config polarity */
+ if (cfg->mode & RT_SPI_CPOL)
+ md_spi_set_con1_cpol(hspi, MD_SPI_POLARITY_HIGH);
+ else
+ md_spi_set_con1_cpol(hspi, MD_SPI_POLARITY_LOW);
+
+ /* Config if NSS pin is managed by software */
+ md_spi_disable_con1_ssen(hspi);
+
+ /* config spi clock */
+ if (cfg->max_hz >= SystemCoreClock / 2)
+ {
+ /* pclk1 max speed 48MHz, spi master max speed 10MHz */
+ if (SystemCoreClock / 2 <= 10000000)
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV2);
+ else if (SystemCoreClock / 4 <= 10000000)
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV4);
+ else
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV8);
+ }
+ else if (cfg->max_hz >= SystemCoreClock / 4)
+ {
+ /* pclk1 max speed 48MHz, spi master max speed 10MHz */
+ if (SystemCoreClock / 4 <= 10000000)
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV4);
+ else
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV8);
+ }
+ else if (cfg->max_hz >= SystemCoreClock / 8)
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV8);
+ else if (cfg->max_hz >= SystemCoreClock / 16)
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV16);
+ else if (cfg->max_hz >= SystemCoreClock / 32)
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV32);
+ else if (cfg->max_hz >= SystemCoreClock / 64)
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV64);
+ else if (cfg->max_hz >= SystemCoreClock / 128)
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV128);
+ else
+ md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV256);
+
+ /* Enable SPI */
+ md_spi_enable_con1_spien(hspi);
+
+ return RT_EOK;
+}
+
+static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message)
+{
+ rt_err_t res;
+ rt_uint32_t *cs;
+
+ RT_ASSERT(device != RT_NULL);
+ RT_ASSERT(device->bus != RT_NULL);
+ RT_ASSERT(device->bus->parent.user_data != RT_NULL);
+ RT_ASSERT(message->send_buf != RT_NULL || message->recv_buf != RT_NULL);
+
+ cs = (rt_uint32_t *)device->parent.user_data;
+
+ /* only send data */
+ if (message->recv_buf == RT_NULL)
+ {
+ if (message->cs_take)
+ {
+ rt_pin_write(*cs, 0);
+ }
+ res = __spi_send(device, (rt_uint8_t *)message->send_buf, (rt_int32_t)message->length, SPITIMEOUT);
+ if (message->cs_release)
+ {
+ rt_pin_write(*cs, 1);
+ }
+ if (res != RT_EOK)
+ return RT_ERROR;
+ }
+
+ /* only receive data */
+ if (message->send_buf == RT_NULL)
+ {
+ if (message->cs_take)
+ {
+ rt_pin_write(*cs, 0);
+ }
+ res = __spi_recv(device, (rt_uint8_t *)message->recv_buf, (rt_int32_t)message->length, SPITIMEOUT);
+ if (message->cs_release)
+ {
+ rt_pin_write(*cs, 1);
+ }
+ if (res != RT_EOK)
+ return RT_ERROR;
+ }
+
+ /* send & receive */
+ else
+ {
+ if (message->cs_take)
+ {
+ rt_pin_write(*cs, 0);
+ }
+ res = __spi_send_recv(device, (rt_uint8_t *)message->send_buf, (rt_uint8_t *)message->recv_buf,
+ (rt_int32_t)message->length, SPITIMEOUT);
+ if (message->cs_release)
+ {
+ rt_pin_write(*cs, 1);
+ }
+ if (res != RT_EOK)
+ return RT_ERROR;
+ }
+
+ return message->length;
+}
+
+const struct rt_spi_ops es32f0_spi_ops =
+{
+ spi_configure,
+ spixfer,
+};
+
+static struct rt_spi_bus _spi_bus1, _spi_bus2;
+int es32f0_spi_register_bus(SPI_TypeDef *SPIx, const char *name)
+{
+ struct rt_spi_bus *spi_bus;
+
+ if (SPIx == SPI2)
+ {
+ /* Open GPIO and SPI clock */
+ SET_BIT(RCU->APB1EN, RCU_APB1EN_SPI2EN_MSK);
+ SET_BIT(RCU->AHBEN, RCU_AHBEN_GPBEN_MSK);
+
+ /* Config SPI2 GPIO */
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_13, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_14, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_15, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_function8_15 (GPIOB, MD_GPIO_PIN_13, MD_GPIO_AF0);
+ md_gpio_set_function8_15 (GPIOB, MD_GPIO_PIN_14, MD_GPIO_AF0);
+ md_gpio_set_function8_15 (GPIOB, MD_GPIO_PIN_15, MD_GPIO_AF0);
+
+ /* Remember SPI bus2 */
+ spi_bus = &_spi_bus2;
+ }
+ else if (SPIx == SPI1)
+ {
+ /* Open GPIO and SPI clock */
+ SET_BIT(RCU->APB2EN, RCU_APB2EN_SPI1EN_MSK);
+ SET_BIT(RCU->AHBEN, RCU_AHBEN_GPBEN_MSK);
+
+ /* Config SPI1 GPIO */
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_3, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_4, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_5, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_3, MD_GPIO_AF0);
+ md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_4, MD_GPIO_AF0);
+ md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_5, MD_GPIO_AF0);
+
+ /* Remember SPI bus1 */
+ spi_bus = &_spi_bus1;
+ }
+ else
+ {
+ return -1;
+ }
+ spi_bus->parent.user_data = SPIx;
+
+ return rt_spi_bus_register(spi_bus, name, &es32f0_spi_ops);
+}
+
+int rt_hw_spi_init(void)
+{
+ int result = 0;
+
+#ifdef BSP_USING_SPI2
+ result = es32f0_spi_register_bus(SPI2, "spi2");
+#endif
+
+#ifdef BSP_USING_SPI1
+ result = es32f0_spi_register_bus(SPI1, "spi1");
+#endif
+
+ return result;
+}
+INIT_BOARD_EXPORT(rt_hw_spi_init);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_spi.h b/bsp/essemi/es32f0271/drivers/drv_spi.h
new file mode 100644
index 0000000000000000000000000000000000000000..c7c8a13b4ad287e69804fa81dff9b7565a714e78
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_spi.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#ifndef DRV_SPI_H__
+#define DRV_SPI_H__
+
+#include
+#include
+#include
+
+///* cannot be used before completion init */
+//rt_err_t es32f0_spi_device_attach(rt_uint32_t pin, const char *bus_name, const char *device_name);
+int rt_hw_spi_init(void);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_uart.c b/bsp/essemi/es32f0271/drivers/drv_uart.c
new file mode 100644
index 0000000000000000000000000000000000000000..f860c2df91e2c0200212e13c7613fb40e8167f38
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_uart.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#include
+#include
+#include
+#include "board.h"
+#include "drv_uart.h"
+#include "md_gpio.h"
+#include "md_uart.h"
+
+#ifdef RT_USING_SERIAL
+
+/* es32 uart driver */
+struct es32_uart
+{
+ UART_TypeDef *huart;
+ IRQn_Type irq;
+};
+
+static rt_err_t es32f0x_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
+{
+ struct es32_uart *uart;
+ RT_ASSERT(serial != RT_NULL);
+ RT_ASSERT(cfg != RT_NULL);
+ uart = (struct es32_uart *)serial->parent.user_data;
+
+ /* Close TX/RX temporarily */
+ md_uart_disable_lcon_txen(uart->huart);
+ md_uart_disable_lcon_rxen(uart->huart);
+
+#ifdef BSP_USING_UART1
+ /* Open UART1 clock */
+ SET_BIT(RCU->APB2EN, RCU_APB2EN_UART1EN_MSK);
+
+ /* Config UART1 GPIO pin */
+ md_gpio_set_pull (GPIOB, MD_GPIO_PIN_7, MD_GPIO_PULL_UP);
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_6, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOB, MD_GPIO_PIN_7, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_6, MD_GPIO_AF2);
+ md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_7, MD_GPIO_AF2);
+#endif /* uart2 gpio init */
+
+#ifdef BSP_USING_UART2
+ /* Open UART2 clock */
+ SET_BIT(RCU->APB1EN, RCU_APB1EN_UART2EN_MSK);
+
+ /* Config UART2 GPIO pin */
+ md_gpio_set_pull (GPIOA, MD_GPIO_PIN_3, MD_GPIO_PULL_UP);
+ md_gpio_set_mode (GPIOA, MD_GPIO_PIN_2, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOA, MD_GPIO_PIN_3, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_function0_7 (GPIOA, MD_GPIO_PIN_2, MD_GPIO_AF2);
+ md_gpio_set_function0_7 (GPIOA, MD_GPIO_PIN_3, MD_GPIO_AF2);
+#endif /* uart1 gpio init */
+
+#ifdef BSP_USING_UART3
+ /* Open UART3 clock */
+ SET_BIT(RCU->APB1EN, RCU_APB1EN_UART3EN_MSK);
+
+ /* Config UART3 GPIO pin */
+ md_gpio_set_pull (GPIOC, MD_GPIO_PIN_7, MD_GPIO_PULL_UP);
+ md_gpio_set_mode (GPIOC, MD_GPIO_PIN_6, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_mode (GPIOC, MD_GPIO_PIN_7, MD_GPIO_MODE_FUNCTION);
+ md_gpio_set_function0_7 (GPIOC, MD_GPIO_PIN_6, MD_GPIO_AF2);
+ md_gpio_set_function0_7 (GPIOC, MD_GPIO_PIN_7, MD_GPIO_AF2);
+#endif /* uart3 gpio init */
+
+ if (cfg->bit_order == BIT_ORDER_MSB)
+ {
+ md_uart_set_lcon_msb(uart->huart, MD_UART_LCON_MSB_FIRST);
+ }
+ else
+ {
+ md_uart_set_lcon_msb(uart->huart, MD_UART_LCON_LSB_FIRST);
+ }
+
+ if (cfg->invert == NRZ_INVERTED)
+ {
+ md_uart_enable_lcon_datainv(uart->huart);
+ }
+ else
+ {
+ md_uart_disable_lcon_datainv(uart->huart);
+ }
+
+ /* Config buadrate */
+ md_uart_set_brr(uart->huart, SystemCoreClock/cfg->baud_rate);
+ /* Config data width */
+ md_uart_set_lcon_dls(uart->huart, 8-cfg->data_bits);
+ /* Config stop bits */
+ md_uart_set_lcon_stop(uart->huart, cfg->stop_bits);
+ /* Config parity */
+ if (cfg->parity > PARITY_NONE)
+ {
+ md_uart_set_lcon_ps(uart->huart, cfg->parity-1);
+ md_uart_enable_lcon_pe(uart->huart);
+ }
+ else
+ md_uart_disable_lcon_pe(uart->huart);
+
+ /* enable rx int */
+ md_uart_set_fcon_rxth(uart->huart, MD_UART_FCON_RXTH_1);
+ md_uart_enable_ier_rfth(uart->huart);
+ md_uart_enable_lcon_txen(uart->huart);
+ md_uart_enable_lcon_rxen(uart->huart);
+
+ return RT_EOK;
+}
+
+static rt_err_t es32f0x_control(struct rt_serial_device *serial, int cmd, void *arg)
+{
+ struct es32_uart *uart;
+ RT_ASSERT(serial != RT_NULL);
+
+ uart = (struct es32_uart *)serial->parent.user_data;
+ switch (cmd)
+ {
+ case RT_DEVICE_CTRL_CLR_INT:
+ /* disable rx irq */
+ NVIC_DisableIRQ(uart->irq);
+ /* disable interrupt */
+ md_uart_disable_idr_rfth(uart->huart);
+ break;
+
+ case RT_DEVICE_CTRL_SET_INT:
+ /* enable rx irq */
+ NVIC_EnableIRQ(uart->irq);
+ /* enable interrupt */
+ md_uart_enable_ier_rfth(uart->huart);
+ break;
+ }
+
+ return RT_EOK;
+}
+
+static int es32f0x_putc(struct rt_serial_device *serial, char c)
+{
+ struct es32_uart *uart;
+ RT_ASSERT(serial != RT_NULL);
+ uart = (struct es32_uart *)serial->parent.user_data;
+
+ while (uart->huart->STAT & UART_STAT_TSBUSY_MSK);
+ WRITE_REG(uart->huart->TXBUF, c);
+
+ return 1;
+}
+
+static int es32f0x_getc(struct rt_serial_device *serial)
+{
+ int ch = -1;
+ struct es32_uart *uart;
+
+ RT_ASSERT(serial != RT_NULL);
+ uart = (struct es32_uart *)serial->parent.user_data;
+
+ if (uart->huart->STAT & UART_STAT_RFTH_MSK)
+ {
+ ch = (uint8_t)(uart->huart->RXBUF & 0xFF);
+ }
+
+ return ch;
+}
+
+static const struct rt_uart_ops es32f0x_uart_ops =
+{
+ es32f0x_configure,
+ es32f0x_control,
+ es32f0x_putc,
+ es32f0x_getc,
+};
+
+#ifdef BSP_USING_UART1
+/* UART1 device driver structure */
+struct es32_uart uart1 =
+{
+ UART1,
+ UART1_IRQn
+};
+
+struct rt_serial_device serial1;
+
+void UART1_IRQHandler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ if (md_uart_is_active_flag_rif_rfth(UART1) == 1)
+ {
+ rt_hw_serial_isr(&serial1, RT_SERIAL_EVENT_RX_IND);
+ md_uart_clear_flag_rfth(UART1);
+ }
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+#endif /* BSP_USING_UART1 */
+
+#ifdef BSP_USING_UART2
+/* UART2 device driver structure */
+struct es32_uart uart2 =
+{
+ UART2,
+ UART2_IRQn
+};
+
+struct rt_serial_device serial2;
+
+void UART2_IRQHandler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ if (md_uart_is_active_flag_rif_rfth(UART2) == 1)
+ {
+ rt_hw_serial_isr(&serial2, RT_SERIAL_EVENT_RX_IND);
+ md_uart_clear_flag_rfth(UART2);
+ }
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+#endif /* BSP_USING_UART2 */
+
+#ifdef BSP_USING_UART3
+/* UART3 device driver structure */
+struct es32_uart uart3 =
+{
+ UART3,
+ UART3_IRQn
+};
+
+struct rt_serial_device serial3;
+
+void UART3_AES_IRQHandler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ if (md_uart_is_active_flag_rif_rfth(UART3) == 1)
+ {
+ rt_hw_serial_isr(&serial3, RT_SERIAL_EVENT_RX_IND);
+ md_uart_clear_flag_rfth(UART3);
+ }
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+#endif /* BSP_USING_UART3 */
+
+int rt_hw_uart_init(void)
+{
+ struct es32_uart *uart;
+ struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
+
+#ifdef BSP_USING_UART1
+ uart = &uart1;
+ serial1.ops = &es32f0x_uart_ops;
+ serial1.config = config;
+
+ /* register UART1 device */
+ rt_hw_serial_register(&serial1, "uart1",
+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
+ uart);
+#endif /* BSP_USING_UART1 */
+
+#ifdef BSP_USING_UART2
+ uart = &uart2;
+ serial2.ops = &es32f0x_uart_ops;
+ serial2.config = config;
+
+ /* register UART2 device */
+ rt_hw_serial_register(&serial2, "uart2",
+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
+ uart);
+#endif /* BSP_USING_UART2 */
+
+#ifdef BSP_USING_UART3
+ uart = &uart3;
+ serial3.ops = &es32f0x_uart_ops;
+ serial3.config = config;
+
+ /* register UART3 device */
+ rt_hw_serial_register(&serial3, "uart3",
+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
+ uart);
+#endif /* BSP_USING_UART3 */
+
+ return 0;
+}
+INIT_BOARD_EXPORT(rt_hw_uart_init);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/drv_uart.h b/bsp/essemi/es32f0271/drivers/drv_uart.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d3755d0a6db211c8f28cee324a5dbfb168ec97f
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/drv_uart.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-10-23 yuzrain the first version
+ */
+
+#ifndef DRV_UART_H__
+#define DRV_UART_H__
+
+int rt_hw_uart_init(void);
+
+#endif
diff --git a/bsp/essemi/es32f0271/drivers/linker_scripts/link.sct b/bsp/essemi/es32f0271/drivers/linker_scripts/link.sct
new file mode 100644
index 0000000000000000000000000000000000000000..4ee8d1e3fc8b0d721151fcb3200a6732c50f765d
--- /dev/null
+++ b/bsp/essemi/es32f0271/drivers/linker_scripts/link.sct
@@ -0,0 +1,14 @@
+; *************************************************************
+; *** Scatter-Loading Description File generated by uVision ***
+; *************************************************************
+
+LR_IROM1 0x00000000 0x10000 { ; load region size_region
+ ER_IROM1 0x00000000 0x10000 { ; load address = execution address
+ *.o (RESET, +First)
+ *(InRoot$$Sections)
+ .ANY (+RO)
+ }
+ RW_IRAM1 0x20000000 0x2000{ ; RW data
+ .ANY (+RW +ZI)
+ }
+}
diff --git a/bsp/es32f0654/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf b/bsp/essemi/es32f0271/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf
similarity index 100%
rename from bsp/es32f0654/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf
rename to bsp/essemi/es32f0271/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf
diff --git a/bsp/es32f0654/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.rtf b/bsp/essemi/es32f0271/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.rtf
similarity index 100%
rename from bsp/es32f0654/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.rtf
rename to bsp/essemi/es32f0271/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.rtf
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_ad16c4t.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_ad16c4t.h
new file mode 100644
index 0000000000000000000000000000000000000000..f70a10e35c1b006af73d87098ae17e362f310b6c
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_ad16c4t.h
@@ -0,0 +1,683 @@
+/**
+ **************************************************************************************
+ * @file reg_AD16C4T.h
+ * @brief AD16C4T Head File
+ *
+ * @version V0.01
+ * @date 3/12/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __REG_AD16C4T_H__
+#define __REG_AD16C4T_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for AD16C4T_CON1 register ************************/
+
+#define AD16C4T_CON1_DBGSEL_POS 15U
+#define AD16C4T_CON1_DBGSEL_MSK BIT(AD16C4T_CON1_DBGSEL_POS)
+
+#define AD16C4T_CON1_CMPSEL_POSS 11U
+#define AD16C4T_CON1_CMPSEL_POSE 13U
+#define AD16C4T_CON1_CMPSEL_MSK BITS(AD16C4T_CON1_CMPSEL_POSS,AD16C4T_CON1_CMPSEL_POSE)
+
+#define AD16C4T_CON1_CMPSELP_POS 10U
+#define AD16C4T_CON1_CMPSELP_MSK BIT(AD16C4T_CON1_CMPSELP_POS)
+
+#define AD16C4T_CON1_DFCKSEL_POSS 8U
+#define AD16C4T_CON1_DFCKSEL_POSE 9U
+#define AD16C4T_CON1_DFCKSEL_MSK BITS(AD16C4T_CON1_DFCKSEL_POSS,AD16C4T_CON1_DFCKSEL_POSE)
+
+#define AD16C4T_CON1_ARPEN_POS 7U
+#define AD16C4T_CON1_ARPEN_MSK BIT(AD16C4T_CON1_ARPEN_POS)
+
+#define AD16C4T_CON1_CMSEL_POSS 5U
+#define AD16C4T_CON1_CMSEL_POSE 6U
+#define AD16C4T_CON1_CMSEL_MSK BITS(AD16C4T_CON1_CMSEL_POSS,AD16C4T_CON1_CMSEL_POSE)
+
+#define AD16C4T_CON1_DIRSEL_POS 4U
+#define AD16C4T_CON1_DIRSEL_MSK BIT(AD16C4T_CON1_DIRSEL_POS)
+
+#define AD16C4T_CON1_SPMEN_POS 3U
+#define AD16C4T_CON1_SPMEN_MSK BIT(AD16C4T_CON1_SPMEN_POS)
+
+#define AD16C4T_CON1_UERSEL_POS 2U
+#define AD16C4T_CON1_UERSEL_MSK BIT(AD16C4T_CON1_UERSEL_POS)
+
+#define AD16C4T_CON1_DISUE_POS 1U
+#define AD16C4T_CON1_DISUE_MSK BIT(AD16C4T_CON1_DISUE_POS)
+
+#define AD16C4T_CON1_CNTEN_POS 0U
+#define AD16C4T_CON1_CNTEN_MSK BIT(AD16C4T_CON1_CNTEN_POS)
+
+/****************** Bit definition for AD16C4T_CON2 register ************************/
+
+#define AD16C4T_CON2_OISS4_POS 14U
+#define AD16C4T_CON2_OISS4_MSK BIT(AD16C4T_CON2_OISS4_POS)
+
+#define AD16C4T_CON2_OISS3N_POS 13U
+#define AD16C4T_CON2_OISS3N_MSK BIT(AD16C4T_CON2_OISS3N_POS)
+
+#define AD16C4T_CON2_OISS3_POS 12U
+#define AD16C4T_CON2_OISS3_MSK BIT(AD16C4T_CON2_OISS3_POS)
+
+#define AD16C4T_CON2_OISS2N_POS 11U
+#define AD16C4T_CON2_OISS2N_MSK BIT(AD16C4T_CON2_OISS2N_POS)
+
+#define AD16C4T_CON2_OISS2_POS 10U
+#define AD16C4T_CON2_OISS2_MSK BIT(AD16C4T_CON2_OISS2_POS)
+
+#define AD16C4T_CON2_OISS1N_POS 9U
+#define AD16C4T_CON2_OISS1N_MSK BIT(AD16C4T_CON2_OISS1N_POS)
+
+#define AD16C4T_CON2_OISS1_POS 8U
+#define AD16C4T_CON2_OISS1_MSK BIT(AD16C4T_CON2_OISS1_POS)
+
+#define AD16C4T_CON2_I1SEL_POS 7U
+#define AD16C4T_CON2_I1SEL_MSK BIT(AD16C4T_CON2_I1SEL_POS)
+
+#define AD16C4T_CON2_MMSEL_POSS 4U
+#define AD16C4T_CON2_MMSEL_POSE 6U
+#define AD16C4T_CON2_MMSEL_MSK BITS(AD16C4T_CON2_MMSEL_POSS,AD16C4T_CON2_MMSEL_POSE)
+
+#define AD16C4T_CON2_CCDMASEL_POS 3U
+#define AD16C4T_CON2_CCDMASEL_MSK BIT(AD16C4T_CON2_CCDMASEL_POS)
+
+#define AD16C4T_CON2_CCUSEL_POS 2U
+#define AD16C4T_CON2_CCUSEL_MSK BIT(AD16C4T_CON2_CCUSEL_POS)
+
+#define AD16C4T_CON2_CCPCEN_POS 0U
+#define AD16C4T_CON2_CCPCEN_MSK BIT(AD16C4T_CON2_CCPCEN_POS)
+
+/****************** Bit definition for AD16C4T_SMCON register ************************/
+
+#define AD16C4T_SMCON_ETPOL_POS 15U
+#define AD16C4T_SMCON_ETPOL_MSK BIT(AD16C4T_SMCON_ETPOL_POS)
+
+#define AD16C4T_SMCON_ECM2EN_POS 14U
+#define AD16C4T_SMCON_ECM2EN_MSK BIT(AD16C4T_SMCON_ECM2EN_POS)
+
+#define AD16C4T_SMCON_ETFLT_POSS 8U
+#define AD16C4T_SMCON_ETFLT_POSE 11U
+#define AD16C4T_SMCON_ETFLT_MSK BITS(AD16C4T_SMCON_ETFLT_POSS,AD16C4T_SMCON_ETFLT_POSE)
+
+#define AD16C4T_SMCON_MSCFG_POS 7U
+#define AD16C4T_SMCON_MSCFG_MSK BIT(AD16C4T_SMCON_MSCFG_POS)
+
+#define AD16C4T_SMCON_TSSEL_POSS 4U
+#define AD16C4T_SMCON_TSSEL_POSE 6U
+#define AD16C4T_SMCON_TSSEL_MSK BITS(AD16C4T_SMCON_TSSEL_POSS,AD16C4T_SMCON_TSSEL_POSE)
+
+#define AD16C4T_SMCON_CHCSEL_POS 3U
+#define AD16C4T_SMCON_CHCSEL_MSK BIT(AD16C4T_SMCON_CHCSEL_POS)
+
+#define AD16C4T_SMCON_SMODS_POSS 0U
+#define AD16C4T_SMCON_SMODS_POSE 2U
+#define AD16C4T_SMCON_SMODS_MSK BITS(AD16C4T_SMCON_SMODS_POSS,AD16C4T_SMCON_SMODS_POSE)
+
+/****************** Bit definition for AD16C4T_IER register ************************/
+
+#define AD16C4T_IER_CH4OVI_POS 12U
+#define AD16C4T_IER_CH4OVI_MSK BIT(AD16C4T_IER_CH4OVI_POS)
+
+#define AD16C4T_IER_CH3OVI_POS 11U
+#define AD16C4T_IER_CH3OVI_MSK BIT(AD16C4T_IER_CH3OVI_POS)
+
+#define AD16C4T_IER_CH2OVI_POS 10U
+#define AD16C4T_IER_CH2OVI_MSK BIT(AD16C4T_IER_CH2OVI_POS)
+
+#define AD16C4T_IER_CH1OVI_POS 9U
+#define AD16C4T_IER_CH1OVI_MSK BIT(AD16C4T_IER_CH1OVI_POS)
+
+#define AD16C4T_IER_BRKI_POS 7U
+#define AD16C4T_IER_BRKI_MSK BIT(AD16C4T_IER_BRKI_POS)
+
+#define AD16C4T_IER_TRGI_POS 6U
+#define AD16C4T_IER_TRGI_MSK BIT(AD16C4T_IER_TRGI_POS)
+
+#define AD16C4T_IER_COMI_POS 5U
+#define AD16C4T_IER_COMI_MSK BIT(AD16C4T_IER_COMI_POS)
+
+#define AD16C4T_IER_CH4I_POS 4U
+#define AD16C4T_IER_CH4I_MSK BIT(AD16C4T_IER_CH4I_POS)
+
+#define AD16C4T_IER_CH3I_POS 3U
+#define AD16C4T_IER_CH3I_MSK BIT(AD16C4T_IER_CH3I_POS)
+
+#define AD16C4T_IER_CH2I_POS 2U
+#define AD16C4T_IER_CH2I_MSK BIT(AD16C4T_IER_CH2I_POS)
+
+#define AD16C4T_IER_CH1I_POS 1U
+#define AD16C4T_IER_CH1I_MSK BIT(AD16C4T_IER_CH1I_POS)
+
+#define AD16C4T_IER_UI_POS 0U
+#define AD16C4T_IER_UI_MSK BIT(AD16C4T_IER_UI_POS)
+
+/****************** Bit definition for AD16C4T_IDR register ************************/
+
+#define AD16C4T_IDR_CH4OVI_POS 12U
+#define AD16C4T_IDR_CH4OVI_MSK BIT(AD16C4T_IDR_CH4OVI_POS)
+
+#define AD16C4T_IDR_CH3OVI_POS 11U
+#define AD16C4T_IDR_CH3OVI_MSK BIT(AD16C4T_IDR_CH3OVI_POS)
+
+#define AD16C4T_IDR_CH2OVI_POS 10U
+#define AD16C4T_IDR_CH2OVI_MSK BIT(AD16C4T_IDR_CH2OVI_POS)
+
+#define AD16C4T_IDR_CH1OVI_POS 9U
+#define AD16C4T_IDR_CH1OVI_MSK BIT(AD16C4T_IDR_CH1OVI_POS)
+
+#define AD16C4T_IDR_BRKI_POS 7U
+#define AD16C4T_IDR_BRKI_MSK BIT(AD16C4T_IDR_BRKI_POS)
+
+#define AD16C4T_IDR_TRGI_POS 6U
+#define AD16C4T_IDR_TRGI_MSK BIT(AD16C4T_IDR_TRGI_POS)
+
+#define AD16C4T_IDR_COMI_POS 5U
+#define AD16C4T_IDR_COMI_MSK BIT(AD16C4T_IDR_COMI_POS)
+
+#define AD16C4T_IDR_CH4I_POS 4U
+#define AD16C4T_IDR_CH4I_MSK BIT(AD16C4T_IDR_CH4I_POS)
+
+#define AD16C4T_IDR_CH3I_POS 3U
+#define AD16C4T_IDR_CH3I_MSK BIT(AD16C4T_IDR_CH3I_POS)
+
+#define AD16C4T_IDR_CH2I_POS 2U
+#define AD16C4T_IDR_CH2I_MSK BIT(AD16C4T_IDR_CH2I_POS)
+
+#define AD16C4T_IDR_CH1I_POS 1U
+#define AD16C4T_IDR_CH1I_MSK BIT(AD16C4T_IDR_CH1I_POS)
+
+#define AD16C4T_IDR_UI_POS 0U
+#define AD16C4T_IDR_UI_MSK BIT(AD16C4T_IDR_UI_POS)
+
+/****************** Bit definition for AD16C4T_IVS register ************************/
+
+#define AD16C4T_IVS_CH4OVI_POS 12U
+#define AD16C4T_IVS_CH4OVI_MSK BIT(AD16C4T_IVS_CH4OVI_POS)
+
+#define AD16C4T_IVS_CH3OVI_POS 11U
+#define AD16C4T_IVS_CH3OVI_MSK BIT(AD16C4T_IVS_CH3OVI_POS)
+
+#define AD16C4T_IVS_CH2OVI_POS 10U
+#define AD16C4T_IVS_CH2OVI_MSK BIT(AD16C4T_IVS_CH2OVI_POS)
+
+#define AD16C4T_IVS_CH1OVI_POS 9U
+#define AD16C4T_IVS_CH1OVI_MSK BIT(AD16C4T_IVS_CH1OVI_POS)
+
+#define AD16C4T_IVS_BRKI_POS 7U
+#define AD16C4T_IVS_BRKI_MSK BIT(AD16C4T_IVS_BRKI_POS)
+
+#define AD16C4T_IVS_TRGI_POS 6U
+#define AD16C4T_IVS_TRGI_MSK BIT(AD16C4T_IVS_TRGI_POS)
+
+#define AD16C4T_IVS_COMI_POS 5U
+#define AD16C4T_IVS_COMI_MSK BIT(AD16C4T_IVS_COMI_POS)
+
+#define AD16C4T_IVS_CH4I_POS 4U
+#define AD16C4T_IVS_CH4I_MSK BIT(AD16C4T_IVS_CH4I_POS)
+
+#define AD16C4T_IVS_CH3I_POS 3U
+#define AD16C4T_IVS_CH3I_MSK BIT(AD16C4T_IVS_CH3I_POS)
+
+#define AD16C4T_IVS_CH2I_POS 2U
+#define AD16C4T_IVS_CH2I_MSK BIT(AD16C4T_IVS_CH2I_POS)
+
+#define AD16C4T_IVS_CH1I_POS 1U
+#define AD16C4T_IVS_CH1I_MSK BIT(AD16C4T_IVS_CH1I_POS)
+
+#define AD16C4T_IVS_UI_POS 0U
+#define AD16C4T_IVS_UI_MSK BIT(AD16C4T_IVS_UI_POS)
+
+/****************** Bit definition for AD16C4T_RIF register ************************/
+
+#define AD16C4T_RIF_CH4OVI_POS 12U
+#define AD16C4T_RIF_CH4OVI_MSK BIT(AD16C4T_RIF_CH4OVI_POS)
+
+#define AD16C4T_RIF_CH3OVI_POS 11U
+#define AD16C4T_RIF_CH3OVI_MSK BIT(AD16C4T_RIF_CH3OVI_POS)
+
+#define AD16C4T_RIF_CH2OVI_POS 10U
+#define AD16C4T_RIF_CH2OVI_MSK BIT(AD16C4T_RIF_CH2OVI_POS)
+
+#define AD16C4T_RIF_CH1OVI_POS 9U
+#define AD16C4T_RIF_CH1OVI_MSK BIT(AD16C4T_RIF_CH1OVI_POS)
+
+#define AD16C4T_RIF_BRKI_POS 7U
+#define AD16C4T_RIF_BRKI_MSK BIT(AD16C4T_RIF_BRKI_POS)
+
+#define AD16C4T_RIF_TRGI_POS 6U
+#define AD16C4T_RIF_TRGI_MSK BIT(AD16C4T_RIF_TRGI_POS)
+
+#define AD16C4T_RIF_COMI_POS 5U
+#define AD16C4T_RIF_COMI_MSK BIT(AD16C4T_RIF_COMI_POS)
+
+#define AD16C4T_RIF_CH4I_POS 4U
+#define AD16C4T_RIF_CH4I_MSK BIT(AD16C4T_RIF_CH4I_POS)
+
+#define AD16C4T_RIF_CH3I_POS 3U
+#define AD16C4T_RIF_CH3I_MSK BIT(AD16C4T_RIF_CH3I_POS)
+
+#define AD16C4T_RIF_CH2I_POS 2U
+#define AD16C4T_RIF_CH2I_MSK BIT(AD16C4T_RIF_CH2I_POS)
+
+#define AD16C4T_RIF_CH1I_POS 1U
+#define AD16C4T_RIF_CH1I_MSK BIT(AD16C4T_RIF_CH1I_POS)
+
+#define AD16C4T_RIF_UI_POS 0U
+#define AD16C4T_RIF_UI_MSK BIT(AD16C4T_RIF_UI_POS)
+
+/****************** Bit definition for AD16C4T_IFM register ************************/
+
+#define AD16C4T_IFM_CH4OVI_POS 12U
+#define AD16C4T_IFM_CH4OVI_MSK BIT(AD16C4T_IFM_CH4OVI_POS)
+
+#define AD16C4T_IFM_CH3OVI_POS 11U
+#define AD16C4T_IFM_CH3OVI_MSK BIT(AD16C4T_IFM_CH3OVI_POS)
+
+#define AD16C4T_IFM_CH2OVI_POS 10U
+#define AD16C4T_IFM_CH2OVI_MSK BIT(AD16C4T_IFM_CH2OVI_POS)
+
+#define AD16C4T_IFM_CH1OVI_POS 9U
+#define AD16C4T_IFM_CH1OVI_MSK BIT(AD16C4T_IFM_CH1OVI_POS)
+
+#define AD16C4T_IFM_BRKI_POS 7U
+#define AD16C4T_IFM_BRKI_MSK BIT(AD16C4T_IFM_BRKI_POS)
+
+#define AD16C4T_IFM_TRGI_POS 6U
+#define AD16C4T_IFM_TRGI_MSK BIT(AD16C4T_IFM_TRGI_POS)
+
+#define AD16C4T_IFM_COMI_POS 5U
+#define AD16C4T_IFM_COMI_MSK BIT(AD16C4T_IFM_COMI_POS)
+
+#define AD16C4T_IFM_CH4I_POS 4U
+#define AD16C4T_IFM_CH4I_MSK BIT(AD16C4T_IFM_CH4I_POS)
+
+#define AD16C4T_IFM_CH3I_POS 3U
+#define AD16C4T_IFM_CH3I_MSK BIT(AD16C4T_IFM_CH3I_POS)
+
+#define AD16C4T_IFM_CH2I_POS 2U
+#define AD16C4T_IFM_CH2I_MSK BIT(AD16C4T_IFM_CH2I_POS)
+
+#define AD16C4T_IFM_CH1I_POS 1U
+#define AD16C4T_IFM_CH1I_MSK BIT(AD16C4T_IFM_CH1I_POS)
+
+#define AD16C4T_IFM_UI_POS 0U
+#define AD16C4T_IFM_UI_MSK BIT(AD16C4T_IFM_UI_POS)
+
+/****************** Bit definition for AD16C4T_ICR register ************************/
+
+#define AD16C4T_ICR_CH4OVI_POS 12U
+#define AD16C4T_ICR_CH4OVI_MSK BIT(AD16C4T_ICR_CH4OVI_POS)
+
+#define AD16C4T_ICR_CH3OVI_POS 11U
+#define AD16C4T_ICR_CH3OVI_MSK BIT(AD16C4T_ICR_CH3OVI_POS)
+
+#define AD16C4T_ICR_CH2OVI_POS 10U
+#define AD16C4T_ICR_CH2OVI_MSK BIT(AD16C4T_ICR_CH2OVI_POS)
+
+#define AD16C4T_ICR_CH1OVI_POS 9U
+#define AD16C4T_ICR_CH1OVI_MSK BIT(AD16C4T_ICR_CH1OVI_POS)
+
+#define AD16C4T_ICR_BRKI_POS 7U
+#define AD16C4T_ICR_BRKI_MSK BIT(AD16C4T_ICR_BRKI_POS)
+
+#define AD16C4T_ICR_TRGI_POS 6U
+#define AD16C4T_ICR_TRGI_MSK BIT(AD16C4T_ICR_TRGI_POS)
+
+#define AD16C4T_ICR_COMI_POS 5U
+#define AD16C4T_ICR_COMI_MSK BIT(AD16C4T_ICR_COMI_POS)
+
+#define AD16C4T_ICR_CH4I_POS 4U
+#define AD16C4T_ICR_CH4I_MSK BIT(AD16C4T_ICR_CH4I_POS)
+
+#define AD16C4T_ICR_CH3I_POS 3U
+#define AD16C4T_ICR_CH3I_MSK BIT(AD16C4T_ICR_CH3I_POS)
+
+#define AD16C4T_ICR_CH2I_POS 2U
+#define AD16C4T_ICR_CH2I_MSK BIT(AD16C4T_ICR_CH2I_POS)
+
+#define AD16C4T_ICR_CH1I_POS 1U
+#define AD16C4T_ICR_CH1I_MSK BIT(AD16C4T_ICR_CH1I_POS)
+
+#define AD16C4T_ICR_UI_POS 0U
+#define AD16C4T_ICR_UI_MSK BIT(AD16C4T_ICR_UI_POS)
+
+/****************** Bit definition for AD16C4T_SGE register ************************/
+
+#define AD16C4T_SGE_SGBRK_POS 7U
+#define AD16C4T_SGE_SGBRK_MSK BIT(AD16C4T_SGE_SGBRK_POS)
+
+#define AD16C4T_SGE_SGTRG_POS 6U
+#define AD16C4T_SGE_SGTRG_MSK BIT(AD16C4T_SGE_SGTRG_POS)
+
+#define AD16C4T_SGE_SGCOM_POS 5U
+#define AD16C4T_SGE_SGCOM_MSK BIT(AD16C4T_SGE_SGCOM_POS)
+
+#define AD16C4T_SGE_SGCH4_POS 4U
+#define AD16C4T_SGE_SGCH4_MSK BIT(AD16C4T_SGE_SGCH4_POS)
+
+#define AD16C4T_SGE_SGCH3_POS 3U
+#define AD16C4T_SGE_SGCH3_MSK BIT(AD16C4T_SGE_SGCH3_POS)
+
+#define AD16C4T_SGE_SGCH2_POS 2U
+#define AD16C4T_SGE_SGCH2_MSK BIT(AD16C4T_SGE_SGCH2_POS)
+
+#define AD16C4T_SGE_SGCH1_POS 1U
+#define AD16C4T_SGE_SGCH1_MSK BIT(AD16C4T_SGE_SGCH1_POS)
+
+#define AD16C4T_SGE_SGU_POS 0U
+#define AD16C4T_SGE_SGU_MSK BIT(AD16C4T_SGE_SGU_POS)
+
+/****************** Bit definition for AD16C4T_CHMR1_OUTPUT register ************************/
+
+#define AD16C4T_CHMR1_OUTPUT_CH2OCLREN_POS 15U
+#define AD16C4T_CHMR1_OUTPUT_CH2OCLREN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH2OCLREN_POS)
+
+#define AD16C4T_CHMR1_OUTPUT_CH2MOD_POSS 12U
+#define AD16C4T_CHMR1_OUTPUT_CH2MOD_POSE 14U
+#define AD16C4T_CHMR1_OUTPUT_CH2MOD_MSK BITS(AD16C4T_CHMR1_OUTPUT_CH2MOD_POSS,AD16C4T_CHMR1_OUTPUT_CH2MOD_POSE)
+
+#define AD16C4T_CHMR1_OUTPUT_CH2PEN_POS 11U
+#define AD16C4T_CHMR1_OUTPUT_CH2PEN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH2PEN_POS)
+
+#define AD16C4T_CHMR1_OUTPUT_CH2FEN_POS 10U
+#define AD16C4T_CHMR1_OUTPUT_CH2FEN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH2FEN_POS)
+
+#define AD16C4T_CHMR1_OUTPUT_CC2SSEL_POSS 8U
+#define AD16C4T_CHMR1_OUTPUT_CC2SSEL_POSE 9U
+#define AD16C4T_CHMR1_OUTPUT_CC2SSEL_MSK BITS(AD16C4T_CHMR1_OUTPUT_CC2SSEL_POSS,AD16C4T_CHMR1_OUTPUT_CC2SSEL_POSE)
+
+#define AD16C4T_CHMR1_OUTPUT_CH1OCLREN_POS 7U
+#define AD16C4T_CHMR1_OUTPUT_CH1OCLREN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH1OCLREN_POS)
+
+#define AD16C4T_CHMR1_OUTPUT_CH1MOD_POSS 4U
+#define AD16C4T_CHMR1_OUTPUT_CH1MOD_POSE 6U
+#define AD16C4T_CHMR1_OUTPUT_CH1MOD_MSK BITS(AD16C4T_CHMR1_OUTPUT_CH1MOD_POSS,AD16C4T_CHMR1_OUTPUT_CH1MOD_POSE)
+
+#define AD16C4T_CHMR1_OUTPUT_CH1PEN_POS 3U
+#define AD16C4T_CHMR1_OUTPUT_CH1PEN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH1PEN_POS)
+
+#define AD16C4T_CHMR1_OUTPUT_CH1FEN_POS 2U
+#define AD16C4T_CHMR1_OUTPUT_CH1FEN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH1FEN_POS)
+
+#define AD16C4T_CHMR1_OUTPUT_CC1SSEL_POSS 0U
+#define AD16C4T_CHMR1_OUTPUT_CC1SSEL_POSE 1U
+#define AD16C4T_CHMR1_OUTPUT_CC1SSEL_MSK BITS(AD16C4T_CHMR1_OUTPUT_CC1SSEL_POSS,AD16C4T_CHMR1_OUTPUT_CC1SSEL_POSE)
+
+/****************** Bit definition for AD16C4T_CHMR1_INPUT register ************************/
+
+#define AD16C4T_CHMR1_INPUT_I2FLT_POSS 12U
+#define AD16C4T_CHMR1_INPUT_I2FLT_POSE 15U
+#define AD16C4T_CHMR1_INPUT_I2FLT_MSK BITS(AD16C4T_CHMR1_INPUT_I2FLT_POSS,AD16C4T_CHMR1_INPUT_I2FLT_POSE)
+
+#define AD16C4T_CHMR1_INPUT_I2PRES_POSS 10U
+#define AD16C4T_CHMR1_INPUT_I2PRES_POSE 11U
+#define AD16C4T_CHMR1_INPUT_I2PRES_MSK BITS(AD16C4T_CHMR1_INPUT_I2PRES_POSS,AD16C4T_CHMR1_INPUT_I2PRES_POSE)
+
+#define AD16C4T_CHMR1_INPUT_CC2SSEL_POSS 8U
+#define AD16C4T_CHMR1_INPUT_CC2SSEL_POSE 9U
+#define AD16C4T_CHMR1_INPUT_CC2SSEL_MSK BITS(AD16C4T_CHMR1_INPUT_CC2SSEL_POSS,AD16C4T_CHMR1_INPUT_CC2SSEL_POSE)
+
+#define AD16C4T_CHMR1_INPUT_I1FLT_POSS 4U
+#define AD16C4T_CHMR1_INPUT_I1FLT_POSE 7U
+#define AD16C4T_CHMR1_INPUT_I1FLT_MSK BITS(AD16C4T_CHMR1_INPUT_I1FLT_POSS,AD16C4T_CHMR1_INPUT_I1FLT_POSE)
+
+#define AD16C4T_CHMR1_INPUT_I1PRES_POSS 2U
+#define AD16C4T_CHMR1_INPUT_I1PRES_POSE 3U
+#define AD16C4T_CHMR1_INPUT_I1PRES_MSK BITS(AD16C4T_CHMR1_INPUT_I1PRES_POSS,AD16C4T_CHMR1_INPUT_I1PRES_POSE)
+
+#define AD16C4T_CHMR1_INPUT_CC1SSEL_POSS 0U
+#define AD16C4T_CHMR1_INPUT_CC1SSEL_POSE 1U
+#define AD16C4T_CHMR1_INPUT_CC1SSEL_MSK BITS(AD16C4T_CHMR1_INPUT_CC1SSEL_POSS,AD16C4T_CHMR1_INPUT_CC1SSEL_POSE)
+
+/****************** Bit definition for AD16C4T_CHMR2_OUTPUT register ************************/
+
+#define AD16C4T_CHMR2_OUTPUT_CH4OCLREN_POS 15U
+#define AD16C4T_CHMR2_OUTPUT_CH4OCLREN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH4OCLREN_POS)
+
+#define AD16C4T_CHMR2_OUTPUT_CH4MOD_POSS 12U
+#define AD16C4T_CHMR2_OUTPUT_CH4MOD_POSE 14U
+#define AD16C4T_CHMR2_OUTPUT_CH4MOD_MSK BITS(AD16C4T_CHMR2_OUTPUT_CH4MOD_POSS,AD16C4T_CHMR2_OUTPUT_CH4MOD_POSE)
+
+#define AD16C4T_CHMR2_OUTPUT_CH4PEN_POS 11U
+#define AD16C4T_CHMR2_OUTPUT_CH4PEN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH4PEN_POS)
+
+#define AD16C4T_CHMR2_OUTPUT_CH4FEN_POS 10U
+#define AD16C4T_CHMR2_OUTPUT_CH4FEN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH4FEN_POS)
+
+#define AD16C4T_CHMR2_OUTPUT_CC4SSEL_POSS 8U
+#define AD16C4T_CHMR2_OUTPUT_CC4SSEL_POSE 9U
+#define AD16C4T_CHMR2_OUTPUT_CC4SSEL_MSK BITS(AD16C4T_CHMR2_OUTPUT_CC4SSEL_POSS,AD16C4T_CHMR2_OUTPUT_CC4SSEL_POSE)
+
+#define AD16C4T_CHMR2_OUTPUT_CH3OCLREN_POS 7U
+#define AD16C4T_CHMR2_OUTPUT_CH3OCLREN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH3OCLREN_POS)
+
+#define AD16C4T_CHMR2_OUTPUT_CH3MOD_POSS 4U
+#define AD16C4T_CHMR2_OUTPUT_CH3MOD_POSE 6U
+#define AD16C4T_CHMR2_OUTPUT_CH3MOD_MSK BITS(AD16C4T_CHMR2_OUTPUT_CH3MOD_POSS,AD16C4T_CHMR2_OUTPUT_CH3MOD_POSE)
+
+#define AD16C4T_CHMR2_OUTPUT_CH3PEN_POS 3U
+#define AD16C4T_CHMR2_OUTPUT_CH3PEN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH3PEN_POS)
+
+#define AD16C4T_CHMR2_OUTPUT_CH3FEN_POS 2U
+#define AD16C4T_CHMR2_OUTPUT_CH3FEN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH3FEN_POS)
+
+#define AD16C4T_CHMR2_OUTPUT_CC3SSEL_POSS 0U
+#define AD16C4T_CHMR2_OUTPUT_CC3SSEL_POSE 1U
+#define AD16C4T_CHMR2_OUTPUT_CC3SSEL_MSK BITS(AD16C4T_CHMR2_OUTPUT_CC3SSEL_POSS,AD16C4T_CHMR2_OUTPUT_CC3SSEL_POSE)
+
+/****************** Bit definition for AD16C4T_CHMR2_INPUT register ************************/
+
+#define AD16C4T_CHMR2_INPUT_I4FLT_POSS 12U
+#define AD16C4T_CHMR2_INPUT_I4FLT_POSE 15U
+#define AD16C4T_CHMR2_INPUT_I4FLT_MSK BITS(AD16C4T_CHMR2_INPUT_I4FLT_POSS,AD16C4T_CHMR2_INPUT_I4FLT_POSE)
+
+#define AD16C4T_CHMR2_INPUT_I4PRES_POSS 10U
+#define AD16C4T_CHMR2_INPUT_I4PRES_POSE 11U
+#define AD16C4T_CHMR2_INPUT_I4PRES_MSK BITS(AD16C4T_CHMR2_INPUT_I4PRES_POSS,AD16C4T_CHMR2_INPUT_I4PRES_POSE)
+
+#define AD16C4T_CHMR2_INPUT_CC4SSEL_POSS 8U
+#define AD16C4T_CHMR2_INPUT_CC4SSEL_POSE 9U
+#define AD16C4T_CHMR2_INPUT_CC4SSEL_MSK BITS(AD16C4T_CHMR2_INPUT_CC4SSEL_POSS,AD16C4T_CHMR2_INPUT_CC4SSEL_POSE)
+
+#define AD16C4T_CHMR2_INPUT_I3FLT_POSS 4U
+#define AD16C4T_CHMR2_INPUT_I3FLT_POSE 7U
+#define AD16C4T_CHMR2_INPUT_I3FLT_MSK BITS(AD16C4T_CHMR2_INPUT_I3FLT_POSS,AD16C4T_CHMR2_INPUT_I3FLT_POSE)
+
+#define AD16C4T_CHMR2_INPUT_I3PRES_POSS 2U
+#define AD16C4T_CHMR2_INPUT_I3PRES_POSE 3U
+#define AD16C4T_CHMR2_INPUT_I3PRES_MSK BITS(AD16C4T_CHMR2_INPUT_I3PRES_POSS,AD16C4T_CHMR2_INPUT_I3PRES_POSE)
+
+#define AD16C4T_CHMR2_INPUT_CC3SSEL_POSS 0U
+#define AD16C4T_CHMR2_INPUT_CC3SSEL_POSE 1U
+#define AD16C4T_CHMR2_INPUT_CC3SSEL_MSK BITS(AD16C4T_CHMR2_INPUT_CC3SSEL_POSS,AD16C4T_CHMR2_INPUT_CC3SSEL_POSE)
+
+/****************** Bit definition for AD16C4T_CCEP register ************************/
+
+#define AD16C4T_CCEP_CC4NPOL_POS 15U
+#define AD16C4T_CCEP_CC4NPOL_MSK BIT(AD16C4T_CCEP_CC4NPOL_POS)
+
+#define AD16C4T_CCEP_CC4POL_POS 13U
+#define AD16C4T_CCEP_CC4POL_MSK BIT(AD16C4T_CCEP_CC4POL_POS)
+
+#define AD16C4T_CCEP_CC4EN_POS 12U
+#define AD16C4T_CCEP_CC4EN_MSK BIT(AD16C4T_CCEP_CC4EN_POS)
+
+#define AD16C4T_CCEP_CC3NPOL_POS 11U
+#define AD16C4T_CCEP_CC3NPOL_MSK BIT(AD16C4T_CCEP_CC3NPOL_POS)
+
+#define AD16C4T_CCEP_CC3NEN_POS 10U
+#define AD16C4T_CCEP_CC3NEN_MSK BIT(AD16C4T_CCEP_CC3NEN_POS)
+
+#define AD16C4T_CCEP_CC3POL_POS 9U
+#define AD16C4T_CCEP_CC3POL_MSK BIT(AD16C4T_CCEP_CC3POL_POS)
+
+#define AD16C4T_CCEP_CC3EN_POS 8U
+#define AD16C4T_CCEP_CC3EN_MSK BIT(AD16C4T_CCEP_CC3EN_POS)
+
+#define AD16C4T_CCEP_CC2NPOL_POS 7U
+#define AD16C4T_CCEP_CC2NPOL_MSK BIT(AD16C4T_CCEP_CC2NPOL_POS)
+
+#define AD16C4T_CCEP_CC2NEN_POS 6U
+#define AD16C4T_CCEP_CC2NEN_MSK BIT(AD16C4T_CCEP_CC2NEN_POS)
+
+#define AD16C4T_CCEP_CC2POL_POS 5U
+#define AD16C4T_CCEP_CC2POL_MSK BIT(AD16C4T_CCEP_CC2POL_POS)
+
+#define AD16C4T_CCEP_CC2EN_POS 4U
+#define AD16C4T_CCEP_CC2EN_MSK BIT(AD16C4T_CCEP_CC2EN_POS)
+
+#define AD16C4T_CCEP_CC1NPOL_POS 3U
+#define AD16C4T_CCEP_CC1NPOL_MSK BIT(AD16C4T_CCEP_CC1NPOL_POS)
+
+#define AD16C4T_CCEP_CC1NEN_POS 2U
+#define AD16C4T_CCEP_CC1NEN_MSK BIT(AD16C4T_CCEP_CC1NEN_POS)
+
+#define AD16C4T_CCEP_CC1POL_POS 1U
+#define AD16C4T_CCEP_CC1POL_MSK BIT(AD16C4T_CCEP_CC1POL_POS)
+
+#define AD16C4T_CCEP_CC1EN_POS 0U
+#define AD16C4T_CCEP_CC1EN_MSK BIT(AD16C4T_CCEP_CC1EN_POS)
+
+/****************** Bit definition for AD16C4T_COUNT register ************************/
+
+#define AD16C4T_COUNT_CNTV_POSS 0U
+#define AD16C4T_COUNT_CNTV_POSE 15U
+#define AD16C4T_COUNT_CNTV_MSK BITS(AD16C4T_COUNT_CNTV_POSS,AD16C4T_COUNT_CNTV_POSE)
+
+/****************** Bit definition for AD16C4T_PRES register ************************/
+
+#define AD16C4T_PRES_PSCV_POSS 0U
+#define AD16C4T_PRES_PSCV_POSE 15U
+#define AD16C4T_PRES_PSCV_MSK BITS(AD16C4T_PRES_PSCV_POSS,AD16C4T_PRES_PSCV_POSE)
+
+/****************** Bit definition for AD16C4T_AR register ************************/
+
+#define AD16C4T_AR_ARV_POSS 0U
+#define AD16C4T_AR_ARV_POSE 15U
+#define AD16C4T_AR_ARV_MSK BITS(AD16C4T_AR_ARV_POSS,AD16C4T_AR_ARV_POSE)
+
+/****************** Bit definition for AD16C4T_REPAR register ************************/
+
+#define AD16C4T_REPAR_REPV_POSS 0U
+#define AD16C4T_REPAR_REPV_POSE 7U
+#define AD16C4T_REPAR_REPV_MSK BITS(AD16C4T_REPAR_REPV_POSS,AD16C4T_REPAR_REPV_POSE)
+
+/****************** Bit definition for AD16C4T_CCVAL1 register ************************/
+
+#define AD16C4T_CCVAL1_CCRV1_POSS 0U
+#define AD16C4T_CCVAL1_CCRV1_POSE 15U
+#define AD16C4T_CCVAL1_CCRV1_MSK BITS(AD16C4T_CCVAL1_CCRV1_POSS,AD16C4T_CCVAL1_CCRV1_POSE)
+
+/****************** Bit definition for AD16C4T_CCVAL2 register ************************/
+
+#define AD16C4T_CCVAL2_CCRV2_POSS 0U
+#define AD16C4T_CCVAL2_CCRV2_POSE 15U
+#define AD16C4T_CCVAL2_CCRV2_MSK BITS(AD16C4T_CCVAL2_CCRV2_POSS,AD16C4T_CCVAL2_CCRV2_POSE)
+
+/****************** Bit definition for AD16C4T_CCVAL3 register ************************/
+
+#define AD16C4T_CCVAL3_CCRV3_POSS 0U
+#define AD16C4T_CCVAL3_CCRV3_POSE 15U
+#define AD16C4T_CCVAL3_CCRV3_MSK BITS(AD16C4T_CCVAL3_CCRV3_POSS,AD16C4T_CCVAL3_CCRV3_POSE)
+
+/****************** Bit definition for AD16C4T_CCVAL4 register ************************/
+
+#define AD16C4T_CCVAL4_CCRV4_POSS 0U
+#define AD16C4T_CCVAL4_CCRV4_POSE 15U
+#define AD16C4T_CCVAL4_CCRV4_MSK BITS(AD16C4T_CCVAL4_CCRV4_POSS,AD16C4T_CCVAL4_CCRV4_POSE)
+
+/****************** Bit definition for AD16C4T_BDCFG register ************************/
+
+#define AD16C4T_BDCFG_GOEN_POS 15U
+#define AD16C4T_BDCFG_GOEN_MSK BIT(AD16C4T_BDCFG_GOEN_POS)
+
+#define AD16C4T_BDCFG_AOEN_POS 14U
+#define AD16C4T_BDCFG_AOEN_MSK BIT(AD16C4T_BDCFG_AOEN_POS)
+
+#define AD16C4T_BDCFG_BRKP_POS 13U
+#define AD16C4T_BDCFG_BRKP_MSK BIT(AD16C4T_BDCFG_BRKP_POS)
+
+#define AD16C4T_BDCFG_BRKEN_POS 12U
+#define AD16C4T_BDCFG_BRKEN_MSK BIT(AD16C4T_BDCFG_BRKEN_POS)
+
+#define AD16C4T_BDCFG_OFFSSR_POS 11U
+#define AD16C4T_BDCFG_OFFSSR_MSK BIT(AD16C4T_BDCFG_OFFSSR_POS)
+
+#define AD16C4T_BDCFG_OFFSSI_POS 10U
+#define AD16C4T_BDCFG_OFFSSI_MSK BIT(AD16C4T_BDCFG_OFFSSI_POS)
+
+#define AD16C4T_BDCFG_LOCKLVL_POSS 8U
+#define AD16C4T_BDCFG_LOCKLVL_POSE 9U
+#define AD16C4T_BDCFG_LOCKLVL_MSK BITS(AD16C4T_BDCFG_LOCKLVL_POSS,AD16C4T_BDCFG_LOCKLVL_POSE)
+
+#define AD16C4T_BDCFG_DT_POSS 0U
+#define AD16C4T_BDCFG_DT_POSE 7U
+#define AD16C4T_BDCFG_DT_MSK BITS(AD16C4T_BDCFG_DT_POSS,AD16C4T_BDCFG_DT_POSE)
+
+/****************** Bit definition for AD16C4T_DMAEN register ************************/
+
+#define AD16C4T_DMAEN_TRGIDE_POS 6U
+#define AD16C4T_DMAEN_TRGIDE_MSK BIT(AD16C4T_DMAEN_TRGIDE_POS)
+
+#define AD16C4T_DMAEN_COMDE_POS 5U
+#define AD16C4T_DMAEN_COMDE_MSK BIT(AD16C4T_DMAEN_COMDE_POS)
+
+#define AD16C4T_DMAEN_CH4DE_POS 4U
+#define AD16C4T_DMAEN_CH4DE_MSK BIT(AD16C4T_DMAEN_CH4DE_POS)
+
+#define AD16C4T_DMAEN_CH3DE_POS 3U
+#define AD16C4T_DMAEN_CH3DE_MSK BIT(AD16C4T_DMAEN_CH3DE_POS)
+
+#define AD16C4T_DMAEN_CH2DE_POS 2U
+#define AD16C4T_DMAEN_CH2DE_MSK BIT(AD16C4T_DMAEN_CH2DE_POS)
+
+#define AD16C4T_DMAEN_CH1DE_POS 1U
+#define AD16C4T_DMAEN_CH1DE_MSK BIT(AD16C4T_DMAEN_CH1DE_POS)
+
+#define AD16C4T_DMAEN_UDE_POS 0U
+#define AD16C4T_DMAEN_UDE_MSK BIT(AD16C4T_DMAEN_UDE_POS)
+
+typedef struct
+{
+ __IO uint32_t CON1; /* 0x000 AD16C4T_CON1 Control register 1 */
+ __IO uint32_t CON2; /* 0x004 AD16C4T_CON2 Control register 2 */
+ __IO uint32_t SMCON; /* 0x008 AD16C4T_SMCON Slave mode control register */
+ __O uint32_t IER; /* 0x00C AD16C4T_IER Interrupt Enable register */
+ __O uint32_t IDR; /* 0x010 AD16C4T_IDR Interrupt Disable register */
+ __I uint32_t IVS; /* 0x014 AD16C4T_IVS Interrupt Valid status register */
+ __I uint32_t RIF; /* 0x018 AD16C4T_RIF Interrupt Raw interrupt Flag */
+ __I uint32_t IFM; /* 0x01C AD16C4T_IFM Interrupt Masked interrupt Flag */
+ __O uint32_t ICR; /* 0x020 AD16C4T_ICR Interrupt Clear status register */
+ __O uint32_t SGE; /* 0x024 AD16C4T_SGE Event generation register */
+ __IO uint32_t CHMR1; /* 0x028 AD16C4T_CHMR1 Capture/compare mode register 1 */
+ __IO uint32_t CHMR2; /* 0x02C AD16C4T_CHMR2 Capture/compare mode register 2 */
+ __IO uint32_t CCEP; /* 0x030 AD16C4T_CCEP Capture/compare enable register */
+ __IO uint32_t COUNT; /* 0x034 AD16C4T_COUNT Timer Counter */
+ __IO uint32_t PRES; /* 0x038 AD16C4T_PRES Prescaler */
+ __IO uint32_t AR; /* 0x03C AD16C4T_AR Auto-reload register */
+ __IO uint32_t REPAR; /* 0x040 AD16C4T_REPAR Repetition counter register */
+ __IO uint32_t CCVAL1; /* 0x044 AD16C4T_CCVAL1 Capture/compare register 1 */
+ __IO uint32_t CCVAL2; /* 0x048 AD16C4T_CCVAL2 Capture/compare register 2 */
+ __IO uint32_t CCVAL3; /* 0x04C AD16C4T_CCVAL3 Capture/compare register 3 */
+ __IO uint32_t CCVAL4; /* 0x050 AD16C4T_CCVAL4 Capture/compare register 4 */
+ __IO uint32_t BDCFG; /* 0x054 AD16C4T_BDCFG Break and dead-time register */
+ __IO uint32_t DMAEN; /* 0x058 AD16C4T_DMAEN DMA trigger event enable */
+} AD16C4T_TypeDef;
+
+#endif
+/******************* (C) COPYRIGHT Eastsoft Microelectronics END OF REG_AD16C4T.H****/
+
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_adc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_adc.h
new file mode 100644
index 0000000000000000000000000000000000000000..e1b57e2773c6fb7b4f19160047f8c1f75aaf12aa
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_adc.h
@@ -0,0 +1,795 @@
+/**
+ **************************************************************************************
+ * @file REG_ADC.h
+ * @brief ADC Header File
+ *
+ * @version V1.00.01
+ * @date 04/12/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __ADC_H__
+#define __ADC_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for ADC_CFG register ************************/
+
+#define ADC_CFG_TESTEN_POSS 8U
+#define ADC_CFG_TESTEN_POSE 15U
+#define ADC_CFG_TESTEN_MSK BITS(ADC_CFG_TESTEN_POSS,ADC_CFG_TESTEN_POSE)
+
+#define ADC_CFG_MODE_POS 0U
+#define ADC_CFG_MODE_MSK BIT(ADC_CFG_MODE_POS)
+
+/****************** Bit definition for ADC_SRATE register ************************/
+
+#define ADC_SRATE_CNT_POSS 16U
+#define ADC_SRATE_CNT_POSE 23U
+#define ADC_SRATE_CNT_MSK BITS(ADC_SRATE_CNT_POSS,ADC_SRATE_CNT_POSE)
+
+#define ADC_SRATE_CNTINI_POSS 8U
+#define ADC_SRATE_CNTINI_POSE 15U
+#define ADC_SRATE_CNTINI_MSK BITS(ADC_SRATE_CNTINI_POSS,ADC_SRATE_CNTINI_POSE)
+
+#define ADC_SRATE_CKDIV_POSS 1U
+#define ADC_SRATE_CKDIV_POSE 4U
+#define ADC_SRATE_CKDIV_MSK BITS(ADC_SRATE_CKDIV_POSS,ADC_SRATE_CKDIV_POSE)
+
+#define ADC_SRATE_CKEN_POS 0U
+#define ADC_SRATE_CKEN_MSK BIT(ADC_SRATE_CKEN_POS)
+
+/****************** Bit definition for ADC_CHINV register ************************/
+
+#define ADC_CHINV_CH15INV_POS 15U
+#define ADC_CHINV_CH15INV_MSK BIT(ADC_CHINV_CH15INV_POS)
+
+#define ADC_CHINV_CH14INV_POS 14U
+#define ADC_CHINV_CH14INV_MSK BIT(ADC_CHINV_CH14INV_POS)
+
+#define ADC_CHINV_CH13INV_POS 13U
+#define ADC_CHINV_CH13INV_MSK BIT(ADC_CHINV_CH13INV_POS)
+
+#define ADC_CHINV_CH12INV_POS 12U
+#define ADC_CHINV_CH12INV_MSK BIT(ADC_CHINV_CH12INV_POS)
+
+#define ADC_CHINV_CH11INV_POS 11U
+#define ADC_CHINV_CH11INV_MSK BIT(ADC_CHINV_CH11INV_POS)
+
+#define ADC_CHINV_CH10INV_POS 10U
+#define ADC_CHINV_CH10INV_MSK BIT(ADC_CHINV_CH10INV_POS)
+
+#define ADC_CHINV_CH9INV_POS 9U
+#define ADC_CHINV_CH9INV_MSK BIT(ADC_CHINV_CH9INV_POS)
+
+#define ADC_CHINV_CH8INV_POS 8U
+#define ADC_CHINV_CH8INV_MSK BIT(ADC_CHINV_CH8INV_POS)
+
+#define ADC_CHINV_CH7INV_POS 7U
+#define ADC_CHINV_CH7INV_MSK BIT(ADC_CHINV_CH7INV_POS)
+
+#define ADC_CHINV_CH6INV_POS 6U
+#define ADC_CHINV_CH6INV_MSK BIT(ADC_CHINV_CH6INV_POS)
+
+#define ADC_CHINV_CH5INV_POS 5U
+#define ADC_CHINV_CH5INV_MSK BIT(ADC_CHINV_CH5INV_POS)
+
+#define ADC_CHINV_CH4INV_POS 4U
+#define ADC_CHINV_CH4INV_MSK BIT(ADC_CHINV_CH4INV_POS)
+
+#define ADC_CHINV_CH3INV_POS 3U
+#define ADC_CHINV_CH3INV_MSK BIT(ADC_CHINV_CH3INV_POS)
+
+#define ADC_CHINV_CH2INV_POS 2U
+#define ADC_CHINV_CH2INV_MSK BIT(ADC_CHINV_CH2INV_POS)
+
+#define ADC_CHINV_CH1INV_POS 1U
+#define ADC_CHINV_CH1INV_MSK BIT(ADC_CHINV_CH1INV_POS)
+
+#define ADC_CHINV_CH0INV_POS 0U
+#define ADC_CHINV_CH0INV_MSK BIT(ADC_CHINV_CH0INV_POS)
+
+/****************** Bit definition for ADC_GAINL register ************************/
+
+#define ADC_GAINL_CH7PGA_POSS 21U
+#define ADC_GAINL_CH7PGA_POSE 23U
+#define ADC_GAINL_CH7PGA_MSK BITS(ADC_GAINL_CH7PGA_POSS,ADC_GAINL_CH7PGA_POSE)
+
+#define ADC_GAINL_CH6PGA_POSS 18U
+#define ADC_GAINL_CH6PGA_POSE 20U
+#define ADC_GAINL_CH6PGA_MSK BITS(ADC_GAINL_CH6PGA_POSS,ADC_GAINL_CH6PGA_POSE)
+
+#define ADC_GAINL_CH5PGA_POSS 15U
+#define ADC_GAINL_CH5PGA_POSE 17U
+#define ADC_GAINL_CH5PGA_MSK BITS(ADC_GAINL_CH5PGA_POSS,ADC_GAINL_CH5PGA_POSE)
+
+#define ADC_GAINL_CH4PGA_POSS 12U
+#define ADC_GAINL_CH4PGA_POSE 14U
+#define ADC_GAINL_CH4PGA_MSK BITS(ADC_GAINL_CH4PGA_POSS,ADC_GAINL_CH4PGA_POSE)
+
+#define ADC_GAINL_CH3PGA_POSS 9U
+#define ADC_GAINL_CH3PGA_POSE 11U
+#define ADC_GAINL_CH3PGA_MSK BITS(ADC_GAINL_CH3PGA_POSS,ADC_GAINL_CH3PGA_POSE)
+
+#define ADC_GAINL_CH2PGA_POSS 6U
+#define ADC_GAINL_CH2PGA_POSE 8U
+#define ADC_GAINL_CH2PGA_MSK BITS(ADC_GAINL_CH2PGA_POSS,ADC_GAINL_CH2PGA_POSE)
+
+#define ADC_GAINL_CH1PGA_POSS 3U
+#define ADC_GAINL_CH1PGA_POSE 5U
+#define ADC_GAINL_CH1PGA_MSK BITS(ADC_GAINL_CH1PGA_POSS,ADC_GAINL_CH1PGA_POSE)
+
+#define ADC_GAINL_CH0PGA_POSS 0U
+#define ADC_GAINL_CH0PGA_POSE 2U
+#define ADC_GAINL_CH0PGA_MSK BITS(ADC_GAINL_CH0PGA_POSS,ADC_GAINL_CH0PGA_POSE)
+
+/****************** Bit definition for ADC_GAINH register ************************/
+
+#define ADC_GAINH_CH15PGA_POSS 21U
+#define ADC_GAINH_CH15PGA_POSE 23U
+#define ADC_GAINH_CH15PGA_MSK BITS(ADC_GAINH_CH15PGA_POSS,ADC_GAINH_CH15PGA_POSE)
+
+#define ADC_GAINH_CH14PGA_POSS 18U
+#define ADC_GAINH_CH14PGA_POSE 20U
+#define ADC_GAINH_CH14PGA_MSK BITS(ADC_GAINH_CH14PGA_POSS,ADC_GAINH_CH14PGA_POSE)
+
+#define ADC_GAINH_CH13PGA_POSS 15U
+#define ADC_GAINH_CH13PGA_POSE 17U
+#define ADC_GAINH_CH13PGA_MSK BITS(ADC_GAINH_CH13PGA_POSS,ADC_GAINH_CH13PGA_POSE)
+
+#define ADC_GAINH_CH12PGA_POSS 12U
+#define ADC_GAINH_CH12PGA_POSE 14U
+#define ADC_GAINH_CH12PGA_MSK BITS(ADC_GAINH_CH12PGA_POSS,ADC_GAINH_CH12PGA_POSE)
+
+#define ADC_GAINH_CH11PGA_POSS 9U
+#define ADC_GAINH_CH11PGA_POSE 11U
+#define ADC_GAINH_CH11PGA_MSK BITS(ADC_GAINH_CH11PGA_POSS,ADC_GAINH_CH11PGA_POSE)
+
+#define ADC_GAINH_CH10PGA_POSS 6U
+#define ADC_GAINH_CH10PGA_POSE 8U
+#define ADC_GAINH_CH10PGA_MSK BITS(ADC_GAINH_CH10PGA_POSS,ADC_GAINH_CH10PGA_POSE)
+
+#define ADC_GAINH_CH9PGA_POSS 3U
+#define ADC_GAINH_CH9PGA_POSE 5U
+#define ADC_GAINH_CH9PGA_MSK BITS(ADC_GAINH_CH9PGA_POSS,ADC_GAINH_CH9PGA_POSE)
+
+#define ADC_GAINH_CH8PGA_POSS 0U
+#define ADC_GAINH_CH8PGA_POSE 2U
+#define ADC_GAINH_CH8PGA_MSK BITS(ADC_GAINH_CH8PGA_POSS,ADC_GAINH_CH8PGA_POSE)
+
+/****************** Bit definition for ADC_FRF register ************************/
+
+#define ADC_FRF_FFRST_POS 4U
+#define ADC_FRF_FFRST_MSK BIT(ADC_FRF_FFRST_POS)
+
+#define ADC_FRF_SS3RF_POS 3U
+#define ADC_FRF_SS3RF_MSK BIT(ADC_FRF_SS3RF_POS)
+
+#define ADC_FRF_SS2RF_POS 2U
+#define ADC_FRF_SS2RF_MSK BIT(ADC_FRF_SS2RF_POS)
+
+#define ADC_FRF_SS1RF_POS 1U
+#define ADC_FRF_SS1RF_MSK BIT(ADC_FRF_SS1RF_POS)
+
+#define ADC_FRF_SS0RF_POS 0U
+#define ADC_FRF_SS0RF_MSK BIT(ADC_FRF_SS0RF_POS)
+
+/****************** Bit definition for ADC_SSEN register ************************/
+
+#define ADC_SSEN_IDLE_POS 4U
+#define ADC_SSEN_IDLE_MSK BIT(ADC_SSEN_IDLE_POS)
+
+#define ADC_SSEN_SS3EN_POS 3U
+#define ADC_SSEN_SS3EN_MSK BIT(ADC_SSEN_SS3EN_POS)
+
+#define ADC_SSEN_SS2EN_POS 2U
+#define ADC_SSEN_SS2EN_MSK BIT(ADC_SSEN_SS2EN_POS)
+
+#define ADC_SSEN_SS1EN_POS 1U
+#define ADC_SSEN_SS1EN_MSK BIT(ADC_SSEN_SS1EN_POS)
+
+#define ADC_SSEN_SS0EN_POS 0U
+#define ADC_SSEN_SS0EN_MSK BIT(ADC_SSEN_SS0EN_POS)
+
+/****************** Bit definition for ADC_SWTRI register ************************/
+
+#define ADC_SWTRI_SS3_POS 3U
+#define ADC_SWTRI_SS3_MSK BIT(ADC_SWTRI_SS3_POS)
+
+#define ADC_SWTRI_SS2_POS 2U
+#define ADC_SWTRI_SS2_MSK BIT(ADC_SWTRI_SS2_POS)
+
+#define ADC_SWTRI_SS1_POS 1U
+#define ADC_SWTRI_SS1_MSK BIT(ADC_SWTRI_SS1_POS)
+
+#define ADC_SWTRI_SS0_POS 0U
+#define ADC_SWTRI_SS0_MSK BIT(ADC_SWTRI_SS0_POS)
+
+/****************** Bit definition for ADC_IER register ************************/
+
+#define ADC_IER_TOIE_POS 4U
+#define ADC_IER_TOIE_MSK BIT(ADC_IER_TOIE_POS)
+
+#define ADC_IER_SS3IE_POS 3U
+#define ADC_IER_SS3IE_MSK BIT(ADC_IER_SS3IE_POS)
+
+#define ADC_IER_SS2IE_POS 2U
+#define ADC_IER_SS2IE_MSK BIT(ADC_IER_SS2IE_POS)
+
+#define ADC_IER_SS1IE_POS 1U
+#define ADC_IER_SS1IE_MSK BIT(ADC_IER_SS1IE_POS)
+
+#define ADC_IER_SS0IE_POS 0U
+#define ADC_IER_SS0IE_MSK BIT(ADC_IER_SS0IE_POS)
+
+/****************** Bit definition for ADC_IDR register ************************/
+
+#define ADC_IDR_TOID_POS 4U
+#define ADC_IDR_TOID_MSK BIT(ADC_IDR_TOID_POS)
+
+#define ADC_IDR_SS3ID_POS 3U
+#define ADC_IDR_SS3ID_MSK BIT(ADC_IDR_SS3ID_POS)
+
+#define ADC_IDR_SS2ID_POS 2U
+#define ADC_IDR_SS2ID_MSK BIT(ADC_IDR_SS2ID_POS)
+
+#define ADC_IDR_SS1ID_POS 1U
+#define ADC_IDR_SS1ID_MSK BIT(ADC_IDR_SS1ID_POS)
+
+#define ADC_IDR_SS0ID_POS 0U
+#define ADC_IDR_SS0ID_MSK BIT(ADC_IDR_SS0ID_POS)
+
+/****************** Bit definition for ADC_IVS register ************************/
+
+#define ADC_IVS_TOIVS_POS 4U
+#define ADC_IVS_TOIVS_MSK BIT(ADC_IVS_TOIVS_POS)
+
+#define ADC_IVS_SS3IVS_POS 3U
+#define ADC_IVS_SS3IVS_MSK BIT(ADC_IVS_SS3IVS_POS)
+
+#define ADC_IVS_SS2IVS_POS 2U
+#define ADC_IVS_SS2IVS_MSK BIT(ADC_IVS_SS2IVS_POS)
+
+#define ADC_IVS_SS1IVS_POS 1U
+#define ADC_IVS_SS1IVS_MSK BIT(ADC_IVS_SS1IVS_POS)
+
+#define ADC_IVS_SS0IVS_POS 0U
+#define ADC_IVS_SS0IVS_MSK BIT(ADC_IVS_SS0IVS_POS)
+
+/****************** Bit definition for ADC_RIF register ************************/
+
+#define ADC_RIF_TORIF_POS 4U
+#define ADC_RIF_TORIF_MSK BIT(ADC_RIF_TORIF_POS)
+
+#define ADC_RIF_SS3RIF_POS 3U
+#define ADC_RIF_SS3RIF_MSK BIT(ADC_RIF_SS3RIF_POS)
+
+#define ADC_RIF_SS2RIF_POS 2U
+#define ADC_RIF_SS2RIF_MSK BIT(ADC_RIF_SS2RIF_POS)
+
+#define ADC_RIF_SS1RIF_POS 1U
+#define ADC_RIF_SS1RIF_MSK BIT(ADC_RIF_SS1RIF_POS)
+
+#define ADC_RIF_SS0RIF_POS 0U
+#define ADC_RIF_SS0RIF_MSK BIT(ADC_RIF_SS0RIF_POS)
+
+/****************** Bit definition for ADC_IFM register ************************/
+
+#define ADC_IFM_TOIFM_POS 4U
+#define ADC_IFM_TOIFM_MSK BIT(ADC_IFM_TOIFM_POS)
+
+#define ADC_IFM_SS3IFM_POS 3U
+#define ADC_IFM_SS3IFM_MSK BIT(ADC_IFM_SS3IFM_POS)
+
+#define ADC_IFM_SS2IFM_POS 2U
+#define ADC_IFM_SS2IFM_MSK BIT(ADC_IFM_SS2IFM_POS)
+
+#define ADC_IFM_SS1IFM_POS 1U
+#define ADC_IFM_SS1IFM_MSK BIT(ADC_IFM_SS1IFM_POS)
+
+#define ADC_IFM_SS0IFM_POS 0U
+#define ADC_IFM_SS0IFM_MSK BIT(ADC_IFM_SS0IFM_POS)
+
+/****************** Bit definition for ADC_ICR register ************************/
+
+#define ADC_ICR_TOICR_POS 4U
+#define ADC_ICR_TOICR_MSK BIT(ADC_ICR_TOICR_POS)
+
+#define ADC_ICR_SS3ICR_POS 3U
+#define ADC_ICR_SS3ICR_MSK BIT(ADC_ICR_SS3ICR_POS)
+
+#define ADC_ICR_SS2ICR_POS 2U
+#define ADC_ICR_SS2ICR_MSK BIT(ADC_ICR_SS2ICR_POS)
+
+#define ADC_ICR_SS1ICR_POS 1U
+#define ADC_ICR_SS1ICR_MSK BIT(ADC_ICR_SS1ICR_POS)
+
+#define ADC_ICR_SS0ICR_POS 0U
+#define ADC_ICR_SS0ICR_MSK BIT(ADC_ICR_SS0ICR_POS)
+
+/****************** Bit definition for ADC_DMA register ************************/
+
+#define ADC_DMA_SS3_DMAEN_POS 3U
+#define ADC_DMA_SS3_DMAEN_MSK BIT(ADC_DMA_SS3_DMAEN_POS)
+
+#define ADC_DMA_SS2_DMAEN_POS 2U
+#define ADC_DMA_SS2_DMAEN_MSK BIT(ADC_DMA_SS2_DMAEN_POS)
+
+#define ADC_DMA_SS1_DMAEN_POS 1U
+#define ADC_DMA_SS1_DMAEN_MSK BIT(ADC_DMA_SS1_DMAEN_POS)
+
+#define ADC_DMA_SS0_DMAEN_POS 0U
+#define ADC_DMA_SS0_DMAEN_MSK BIT(ADC_DMA_SS0_DMAEN_POS)
+
+/****************** Bit definition for ADC_SS0_CON register ************************/
+
+#define ADC_SS0_CON_SEL_POSS 11U
+#define ADC_SS0_CON_SEL_POSE 15U
+#define ADC_SS0_CON_SEL_MSK BITS(ADC_SS0_CON_SEL_POSS,ADC_SS0_CON_SEL_POSE)
+
+#define ADC_SS0_CON_TYP_POS 8U
+#define ADC_SS0_CON_TYP_MSK BIT(ADC_SS0_CON_TYP_POS)
+
+#define ADC_SS0_CON_PRI_POSS 4U
+#define ADC_SS0_CON_PRI_POSE 5U
+#define ADC_SS0_CON_PRI_MSK BITS(ADC_SS0_CON_PRI_POSS,ADC_SS0_CON_PRI_POSE)
+
+#define ADC_SS0_CON_ONE_POS 0U
+#define ADC_SS0_CON_ONE_MSK BIT(ADC_SS0_CON_ONE_POS)
+
+/****************** Bit definition for ADC_SS0_MUX0 register ************************/
+
+#define ADC_SS0_MUX0_MUX7_POSS 28U
+#define ADC_SS0_MUX0_MUX7_POSE 31U
+#define ADC_SS0_MUX0_MUX7_MSK BITS(ADC_SS0_MUX0_MUX7_POSS,ADC_SS0_MUX0_MUX7_POSE)
+
+#define ADC_SS0_MUX0_MUX6_POSS 24U
+#define ADC_SS0_MUX0_MUX6_POSE 27U
+#define ADC_SS0_MUX0_MUX6_MSK BITS(ADC_SS0_MUX0_MUX6_POSS,ADC_SS0_MUX0_MUX6_POSE)
+
+#define ADC_SS0_MUX0_MUX5_POSS 20U
+#define ADC_SS0_MUX0_MUX5_POSE 23U
+#define ADC_SS0_MUX0_MUX5_MSK BITS(ADC_SS0_MUX0_MUX5_POSS,ADC_SS0_MUX0_MUX5_POSE)
+
+#define ADC_SS0_MUX0_MUX4_POSS 16U
+#define ADC_SS0_MUX0_MUX4_POSE 19U
+#define ADC_SS0_MUX0_MUX4_MSK BITS(ADC_SS0_MUX0_MUX4_POSS,ADC_SS0_MUX0_MUX4_POSE)
+
+#define ADC_SS0_MUX0_MUX3_POSS 12U
+#define ADC_SS0_MUX0_MUX3_POSE 15U
+#define ADC_SS0_MUX0_MUX3_MSK BITS(ADC_SS0_MUX0_MUX3_POSS,ADC_SS0_MUX0_MUX3_POSE)
+
+#define ADC_SS0_MUX0_MUX2_POSS 8U
+#define ADC_SS0_MUX0_MUX2_POSE 11U
+#define ADC_SS0_MUX0_MUX2_MSK BITS(ADC_SS0_MUX0_MUX2_POSS,ADC_SS0_MUX0_MUX2_POSE)
+
+#define ADC_SS0_MUX0_MUX1_POSS 4U
+#define ADC_SS0_MUX0_MUX1_POSE 7U
+#define ADC_SS0_MUX0_MUX1_MSK BITS(ADC_SS0_MUX0_MUX1_POSS,ADC_SS0_MUX0_MUX1_POSE)
+
+#define ADC_SS0_MUX0_MUX0_POSS 0U
+#define ADC_SS0_MUX0_MUX0_POSE 3U
+#define ADC_SS0_MUX0_MUX0_MSK BITS(ADC_SS0_MUX0_MUX0_POSS,ADC_SS0_MUX0_MUX0_POSE)
+
+/****************** Bit definition for ADC_SS0_MUX1 register ************************/
+
+#define ADC_SS0_MUX1_MUX15_POSS 28U
+#define ADC_SS0_MUX1_MUX15_POSE 31U
+#define ADC_SS0_MUX1_MUX15_MSK BITS(ADC_SS0_MUX1_MUX15_POSS,ADC_SS0_MUX1_MUX15_POSE)
+
+#define ADC_SS0_MUX1_MUX14_POSS 24U
+#define ADC_SS0_MUX1_MUX14_POSE 27U
+#define ADC_SS0_MUX1_MUX14_MSK BITS(ADC_SS0_MUX1_MUX14_POSS,ADC_SS0_MUX1_MUX14_POSE)
+
+#define ADC_SS0_MUX1_MUX13_POSS 20U
+#define ADC_SS0_MUX1_MUX13_POSE 23U
+#define ADC_SS0_MUX1_MUX13_MSK BITS(ADC_SS0_MUX1_MUX13_POSS,ADC_SS0_MUX1_MUX13_POSE)
+
+#define ADC_SS0_MUX1_MUX12_POSS 16U
+#define ADC_SS0_MUX1_MUX12_POSE 19U
+#define ADC_SS0_MUX1_MUX12_MSK BITS(ADC_SS0_MUX1_MUX12_POSS,ADC_SS0_MUX1_MUX12_POSE)
+
+#define ADC_SS0_MUX1_MUX11_POSS 12U
+#define ADC_SS0_MUX1_MUX11_POSE 15U
+#define ADC_SS0_MUX1_MUX11_MSK BITS(ADC_SS0_MUX1_MUX11_POSS,ADC_SS0_MUX1_MUX11_POSE)
+
+#define ADC_SS0_MUX1_MUX10_POSS 8U
+#define ADC_SS0_MUX1_MUX10_POSE 11U
+#define ADC_SS0_MUX1_MUX10_MSK BITS(ADC_SS0_MUX1_MUX10_POSS,ADC_SS0_MUX1_MUX10_POSE)
+
+#define ADC_SS0_MUX1_MUX9_POSS 4U
+#define ADC_SS0_MUX1_MUX9_POSE 7U
+#define ADC_SS0_MUX1_MUX9_MSK BITS(ADC_SS0_MUX1_MUX9_POSS,ADC_SS0_MUX1_MUX9_POSE)
+
+#define ADC_SS0_MUX1_MUX8_POSS 0U
+#define ADC_SS0_MUX1_MUX8_POSE 3U
+#define ADC_SS0_MUX1_MUX8_MSK BITS(ADC_SS0_MUX1_MUX8_POSS,ADC_SS0_MUX1_MUX8_POSE)
+
+/****************** Bit definition for ADC_SS0_END register ************************/
+
+#define ADC_SS0_END_IE15_POS 23U
+#define ADC_SS0_END_IE15_MSK BIT(ADC_SS0_END_IE15_POS)
+
+#define ADC_SS0_END_IE14_POS 22U
+#define ADC_SS0_END_IE14_MSK BIT(ADC_SS0_END_IE14_POS)
+
+#define ADC_SS0_END_IE13_POS 21U
+#define ADC_SS0_END_IE13_MSK BIT(ADC_SS0_END_IE13_POS)
+
+#define ADC_SS0_END_IE12_POS 20U
+#define ADC_SS0_END_IE12_MSK BIT(ADC_SS0_END_IE12_POS)
+
+#define ADC_SS0_END_IE11_POS 19U
+#define ADC_SS0_END_IE11_MSK BIT(ADC_SS0_END_IE11_POS)
+
+#define ADC_SS0_END_IE10_POS 18U
+#define ADC_SS0_END_IE10_MSK BIT(ADC_SS0_END_IE10_POS)
+
+#define ADC_SS0_END_IE9_POS 17U
+#define ADC_SS0_END_IE9_MSK BIT(ADC_SS0_END_IE9_POS)
+
+#define ADC_SS0_END_IE8_POS 16U
+#define ADC_SS0_END_IE8_MSK BIT(ADC_SS0_END_IE8_POS)
+
+#define ADC_SS0_END_IE7_POS 15U
+#define ADC_SS0_END_IE7_MSK BIT(ADC_SS0_END_IE7_POS)
+
+#define ADC_SS0_END_IE6_POS 14U
+#define ADC_SS0_END_IE6_MSK BIT(ADC_SS0_END_IE6_POS)
+
+#define ADC_SS0_END_IE5_POS 13U
+#define ADC_SS0_END_IE5_MSK BIT(ADC_SS0_END_IE5_POS)
+
+#define ADC_SS0_END_IE4_POS 12U
+#define ADC_SS0_END_IE4_MSK BIT(ADC_SS0_END_IE4_POS)
+
+#define ADC_SS0_END_IE3_POS 11U
+#define ADC_SS0_END_IE3_MSK BIT(ADC_SS0_END_IE3_POS)
+
+#define ADC_SS0_END_IE2_POS 10U
+#define ADC_SS0_END_IE2_MSK BIT(ADC_SS0_END_IE2_POS)
+
+#define ADC_SS0_END_IE1_POS 9U
+#define ADC_SS0_END_IE1_MSK BIT(ADC_SS0_END_IE1_POS)
+
+#define ADC_SS0_END_IE0_POS 8U
+#define ADC_SS0_END_IE0_MSK BIT(ADC_SS0_END_IE0_POS)
+
+#define ADC_SS0_END_END_POSS 0U
+#define ADC_SS0_END_END_POSE 3U
+#define ADC_SS0_END_END_MSK BITS(ADC_SS0_END_END_POSS,ADC_SS0_END_END_POSE)
+
+/****************** Bit definition for ADC_SS0_FSTAT register ************************/
+
+#define ADC_SS0_FSTAT_OV_POS 11U
+#define ADC_SS0_FSTAT_OV_MSK BIT(ADC_SS0_FSTAT_OV_POS)
+
+#define ADC_SS0_FSTAT_FULL_POS 10U
+#define ADC_SS0_FSTAT_FULL_MSK BIT(ADC_SS0_FSTAT_FULL_POS)
+
+#define ADC_SS0_FSTAT_UV_POS 9U
+#define ADC_SS0_FSTAT_UV_MSK BIT(ADC_SS0_FSTAT_UV_POS)
+
+#define ADC_SS0_FSTAT_EMPTY_POS 8U
+#define ADC_SS0_FSTAT_EMPTY_MSK BIT(ADC_SS0_FSTAT_EMPTY_POS)
+
+#define ADC_SS0_FSTAT_HPTR_POSS 4U
+#define ADC_SS0_FSTAT_HPTR_POSE 7U
+#define ADC_SS0_FSTAT_HPTR_MSK BITS(ADC_SS0_FSTAT_HPTR_POSS,ADC_SS0_FSTAT_HPTR_POSE)
+
+#define ADC_SS0_FSTAT_TPTR_POSS 0U
+#define ADC_SS0_FSTAT_TPTR_POSE 3U
+#define ADC_SS0_FSTAT_TPTR_MSK BITS(ADC_SS0_FSTAT_TPTR_POSS,ADC_SS0_FSTAT_TPTR_POSE)
+
+/****************** Bit definition for ADC_SS0_DATA register ************************/
+
+#define ADC_SS0_DATA_DATA_POSS 0U
+#define ADC_SS0_DATA_DATA_POSE 11U
+#define ADC_SS0_DATA_DATA_MSK BITS(ADC_SS0_DATA_DATA_POSS,ADC_SS0_DATA_DATA_POSE)
+
+/****************** Bit definition for ADC_SS1_CON register ************************/
+
+#define ADC_SS1_CON_SEL_POSS 11U
+#define ADC_SS1_CON_SEL_POSE 15U
+#define ADC_SS1_CON_SEL_MSK BITS(ADC_SS1_CON_SEL_POSS,ADC_SS1_CON_SEL_POSE)
+
+#define ADC_SS1_CON_TYP_POS 8U
+#define ADC_SS1_CON_TYP_MSK BIT(ADC_SS1_CON_TYP_POS)
+
+#define ADC_SS1_CON_PRI_POSS 4U
+#define ADC_SS1_CON_PRI_POSE 5U
+#define ADC_SS1_CON_PRI_MSK BITS(ADC_SS1_CON_PRI_POSS,ADC_SS1_CON_PRI_POSE)
+
+#define ADC_SS1_CON_ONE_POS 0U
+#define ADC_SS1_CON_ONE_MSK BIT(ADC_SS1_CON_ONE_POS)
+
+/****************** Bit definition for ADC_SS1_MUX0 register ************************/
+
+#define ADC_SS1_MUX0_MUX7_POSS 28U
+#define ADC_SS1_MUX0_MUX7_POSE 31U
+#define ADC_SS1_MUX0_MUX7_MSK BITS(ADC_SS1_MUX0_MUX7_POSS,ADC_SS1_MUX0_MUX7_POSE)
+
+#define ADC_SS1_MUX0_MUX6_POSS 24U
+#define ADC_SS1_MUX0_MUX6_POSE 27U
+#define ADC_SS1_MUX0_MUX6_MSK BITS(ADC_SS1_MUX0_MUX6_POSS,ADC_SS1_MUX0_MUX6_POSE)
+
+#define ADC_SS1_MUX0_MUX5_POSS 20U
+#define ADC_SS1_MUX0_MUX5_POSE 23U
+#define ADC_SS1_MUX0_MUX5_MSK BITS(ADC_SS1_MUX0_MUX5_POSS,ADC_SS1_MUX0_MUX5_POSE)
+
+#define ADC_SS1_MUX0_MUX4_POSS 16U
+#define ADC_SS1_MUX0_MUX4_POSE 19U
+#define ADC_SS1_MUX0_MUX4_MSK BITS(ADC_SS1_MUX0_MUX4_POSS,ADC_SS1_MUX0_MUX4_POSE)
+
+#define ADC_SS1_MUX0_MUX3_POSS 12U
+#define ADC_SS1_MUX0_MUX3_POSE 15U
+#define ADC_SS1_MUX0_MUX3_MSK BITS(ADC_SS1_MUX0_MUX3_POSS,ADC_SS1_MUX0_MUX3_POSE)
+
+#define ADC_SS1_MUX0_MUX2_POSS 8U
+#define ADC_SS1_MUX0_MUX2_POSE 11U
+#define ADC_SS1_MUX0_MUX2_MSK BITS(ADC_SS1_MUX0_MUX2_POSS,ADC_SS1_MUX0_MUX2_POSE)
+
+#define ADC_SS1_MUX0_MUX1_POSS 4U
+#define ADC_SS1_MUX0_MUX1_POSE 7U
+#define ADC_SS1_MUX0_MUX1_MSK BITS(ADC_SS1_MUX0_MUX1_POSS,ADC_SS1_MUX0_MUX1_POSE)
+
+#define ADC_SS1_MUX0_MUX0_POSS 0U
+#define ADC_SS1_MUX0_MUX0_POSE 3U
+#define ADC_SS1_MUX0_MUX0_MSK BITS(ADC_SS1_MUX0_MUX0_POSS,ADC_SS1_MUX0_MUX0_POSE)
+
+/****************** Bit definition for ADC_SS1_END register ************************/
+
+#define ADC_SS1_END_IE7_POS 15U
+#define ADC_SS1_END_IE7_MSK BIT(ADC_SS1_END_IE7_POS)
+
+#define ADC_SS1_END_IE6_POS 14U
+#define ADC_SS1_END_IE6_MSK BIT(ADC_SS1_END_IE6_POS)
+
+#define ADC_SS1_END_IE5_POS 13U
+#define ADC_SS1_END_IE5_MSK BIT(ADC_SS1_END_IE5_POS)
+
+#define ADC_SS1_END_IE4_POS 12U
+#define ADC_SS1_END_IE4_MSK BIT(ADC_SS1_END_IE4_POS)
+
+#define ADC_SS1_END_IE3_POS 11U
+#define ADC_SS1_END_IE3_MSK BIT(ADC_SS1_END_IE3_POS)
+
+#define ADC_SS1_END_IE2_POS 10U
+#define ADC_SS1_END_IE2_MSK BIT(ADC_SS1_END_IE2_POS)
+
+#define ADC_SS1_END_IE1_POS 9U
+#define ADC_SS1_END_IE1_MSK BIT(ADC_SS1_END_IE1_POS)
+
+#define ADC_SS1_END_IE0_POS 8U
+#define ADC_SS1_END_IE0_MSK BIT(ADC_SS1_END_IE0_POS)
+
+#define ADC_SS1_END_END_POSS 0U
+#define ADC_SS1_END_END_POSE 2U
+#define ADC_SS1_END_END_MSK BITS(ADC_SS1_END_END_POSS,ADC_SS1_END_END_POSE)
+
+/****************** Bit definition for ADC_SS1_FSTAT register ************************/
+
+#define ADC_SS1_FSTAT_OV_POS 11U
+#define ADC_SS1_FSTAT_OV_MSK BIT(ADC_SS1_FSTAT_OV_POS)
+
+#define ADC_SS1_FSTAT_FULL_POS 10U
+#define ADC_SS1_FSTAT_FULL_MSK BIT(ADC_SS1_FSTAT_FULL_POS)
+
+#define ADC_SS1_FSTAT_UV_POS 9U
+#define ADC_SS1_FSTAT_UV_MSK BIT(ADC_SS1_FSTAT_UV_POS)
+
+#define ADC_SS1_FSTAT_EMPTY_POS 8U
+#define ADC_SS1_FSTAT_EMPTY_MSK BIT(ADC_SS1_FSTAT_EMPTY_POS)
+
+#define ADC_SS1_FSTAT_HPTR_POSS 4U
+#define ADC_SS1_FSTAT_HPTR_POSE 7U
+#define ADC_SS1_FSTAT_HPTR_MSK BITS(ADC_SS1_FSTAT_HPTR_POSS,ADC_SS1_FSTAT_HPTR_POSE)
+
+#define ADC_SS1_FSTAT_TPTR_POSS 0U
+#define ADC_SS1_FSTAT_TPTR_POSE 3U
+#define ADC_SS1_FSTAT_TPTR_MSK BITS(ADC_SS1_FSTAT_TPTR_POSS,ADC_SS1_FSTAT_TPTR_POSE)
+
+/****************** Bit definition for ADC_SS1_DATA register ************************/
+
+#define ADC_SS1_DATA_DATA_POSS 0U
+#define ADC_SS1_DATA_DATA_POSE 11U
+#define ADC_SS1_DATA_DATA_MSK BITS(ADC_SS1_DATA_DATA_POSS,ADC_SS1_DATA_DATA_POSE)
+
+/****************** Bit definition for ADC_SS2_CON register ************************/
+
+#define ADC_SS2_CON_SEL_POSS 11U
+#define ADC_SS2_CON_SEL_POSE 15U
+#define ADC_SS2_CON_SEL_MSK BITS(ADC_SS2_CON_SEL_POSS,ADC_SS2_CON_SEL_POSE)
+
+#define ADC_SS2_CON_TYP_POS 8U
+#define ADC_SS2_CON_TYP_MSK BIT(ADC_SS2_CON_TYP_POS)
+
+#define ADC_SS2_CON_PRI_POSS 4U
+#define ADC_SS2_CON_PRI_POSE 5U
+#define ADC_SS2_CON_PRI_MSK BITS(ADC_SS2_CON_PRI_POSS,ADC_SS2_CON_PRI_POSE)
+
+#define ADC_SS2_CON_ONE_POS 0U
+#define ADC_SS2_CON_ONE_MSK BIT(ADC_SS2_CON_ONE_POS)
+
+/****************** Bit definition for ADC_SS2_MUX0 register ************************/
+
+#define ADC_SS2_MUX0_MUX3_POSS 12U
+#define ADC_SS2_MUX0_MUX3_POSE 15U
+#define ADC_SS2_MUX0_MUX3_MSK BITS(ADC_SS2_MUX0_MUX3_POSS,ADC_SS2_MUX0_MUX3_POSE)
+
+#define ADC_SS2_MUX0_MUX2_POSS 8U
+#define ADC_SS2_MUX0_MUX2_POSE 11U
+#define ADC_SS2_MUX0_MUX2_MSK BITS(ADC_SS2_MUX0_MUX2_POSS,ADC_SS2_MUX0_MUX2_POSE)
+
+#define ADC_SS2_MUX0_MUX1_POSS 4U
+#define ADC_SS2_MUX0_MUX1_POSE 7U
+#define ADC_SS2_MUX0_MUX1_MSK BITS(ADC_SS2_MUX0_MUX1_POSS,ADC_SS2_MUX0_MUX1_POSE)
+
+#define ADC_SS2_MUX0_MUX0_POSS 0U
+#define ADC_SS2_MUX0_MUX0_POSE 3U
+#define ADC_SS2_MUX0_MUX0_MSK BITS(ADC_SS2_MUX0_MUX0_POSS,ADC_SS2_MUX0_MUX0_POSE)
+
+/****************** Bit definition for ADC_SS2_END register ************************/
+
+#define ADC_SS2_END_IE3_POS 11U
+#define ADC_SS2_END_IE3_MSK BIT(ADC_SS2_END_IE3_POS)
+
+#define ADC_SS2_END_IE2_POS 10U
+#define ADC_SS2_END_IE2_MSK BIT(ADC_SS2_END_IE2_POS)
+
+#define ADC_SS2_END_IE1_POS 9U
+#define ADC_SS2_END_IE1_MSK BIT(ADC_SS2_END_IE1_POS)
+
+#define ADC_SS2_END_IE0_POS 8U
+#define ADC_SS2_END_IE0_MSK BIT(ADC_SS2_END_IE0_POS)
+
+#define ADC_SS2_END_END_POSS 0U
+#define ADC_SS2_END_END_POSE 1U
+#define ADC_SS2_END_END_MSK BITS(ADC_SS2_END_END_POSS,ADC_SS2_END_END_POSE)
+
+/****************** Bit definition for ADC_SS2_FSTAT register ************************/
+
+#define ADC_SS2_FSTAT_OV_POS 11U
+#define ADC_SS2_FSTAT_OV_MSK BIT(ADC_SS2_FSTAT_OV_POS)
+
+#define ADC_SS2_FSTAT_FULL_POS 10U
+#define ADC_SS2_FSTAT_FULL_MSK BIT(ADC_SS2_FSTAT_FULL_POS)
+
+#define ADC_SS2_FSTAT_UV_POS 9U
+#define ADC_SS2_FSTAT_UV_MSK BIT(ADC_SS2_FSTAT_UV_POS)
+
+#define ADC_SS2_FSTAT_EMPTY_POS 8U
+#define ADC_SS2_FSTAT_EMPTY_MSK BIT(ADC_SS2_FSTAT_EMPTY_POS)
+
+#define ADC_SS2_FSTAT_HPTR_POSS 4U
+#define ADC_SS2_FSTAT_HPTR_POSE 7U
+#define ADC_SS2_FSTAT_HPTR_MSK BITS(ADC_SS2_FSTAT_HPTR_POSS,ADC_SS2_FSTAT_HPTR_POSE)
+
+#define ADC_SS2_FSTAT_TPTR_POSS 0U
+#define ADC_SS2_FSTAT_TPTR_POSE 3U
+#define ADC_SS2_FSTAT_TPTR_MSK BITS(ADC_SS2_FSTAT_TPTR_POSS,ADC_SS2_FSTAT_TPTR_POSE)
+
+/****************** Bit definition for ADC_SS2_DATA register ************************/
+
+#define ADC_SS2_DATA_DATA_POSS 0U
+#define ADC_SS2_DATA_DATA_POSE 11U
+#define ADC_SS2_DATA_DATA_MSK BITS(ADC_SS2_DATA_DATA_POSS,ADC_SS2_DATA_DATA_POSE)
+
+/****************** Bit definition for ADC_SS3_CON register ************************/
+
+#define ADC_SS3_CON_SEL_POSS 11U
+#define ADC_SS3_CON_SEL_POSE 15U
+#define ADC_SS3_CON_SEL_MSK BITS(ADC_SS3_CON_SEL_POSS,ADC_SS3_CON_SEL_POSE)
+
+#define ADC_SS3_CON_TYP_POS 8U
+#define ADC_SS3_CON_TYP_MSK BIT(ADC_SS3_CON_TYP_POS)
+
+#define ADC_SS3_CON_PRI_POSS 4U
+#define ADC_SS3_CON_PRI_POSE 5U
+#define ADC_SS3_CON_PRI_MSK BITS(ADC_SS3_CON_PRI_POSS,ADC_SS3_CON_PRI_POSE)
+
+#define ADC_SS3_CON_ONE_POS 0U
+#define ADC_SS3_CON_ONE_MSK BIT(ADC_SS3_CON_ONE_POS)
+
+/****************** Bit definition for ADC_SS3_MUX0 register ************************/
+
+#define ADC_SS3_MUX0_MUX0_POSS 0U
+#define ADC_SS3_MUX0_MUX0_POSE 3U
+#define ADC_SS3_MUX0_MUX0_MSK BITS(ADC_SS3_MUX0_MUX0_POSS,ADC_SS3_MUX0_MUX0_POSE)
+
+/****************** Bit definition for ADC_SS3_END register ************************/
+
+#define ADC_SS3_END_IE0_POS 8U
+#define ADC_SS3_END_IE0_MSK BIT(ADC_SS3_END_IE0_POS)
+
+#define ADC_SS3_END_END_POS 0U
+#define ADC_SS3_END_END_MSK BIT(ADC_SS3_END_END_POS)
+
+/****************** Bit definition for ADC_SS3_FSTAT register ************************/
+
+#define ADC_SS3_FSTAT_OV_POS 11U
+#define ADC_SS3_FSTAT_OV_MSK BIT(ADC_SS3_FSTAT_OV_POS)
+
+#define ADC_SS3_FSTAT_FULL_POS 10U
+#define ADC_SS3_FSTAT_FULL_MSK BIT(ADC_SS3_FSTAT_FULL_POS)
+
+#define ADC_SS3_FSTAT_UV_POS 9U
+#define ADC_SS3_FSTAT_UV_MSK BIT(ADC_SS3_FSTAT_UV_POS)
+
+#define ADC_SS3_FSTAT_EMPTY_POS 8U
+#define ADC_SS3_FSTAT_EMPTY_MSK BIT(ADC_SS3_FSTAT_EMPTY_POS)
+
+#define ADC_SS3_FSTAT_HPTR_POSS 4U
+#define ADC_SS3_FSTAT_HPTR_POSE 7U
+#define ADC_SS3_FSTAT_HPTR_MSK BITS(ADC_SS3_FSTAT_HPTR_POSS,ADC_SS3_FSTAT_HPTR_POSE)
+
+#define ADC_SS3_FSTAT_TPTR_POSS 0U
+#define ADC_SS3_FSTAT_TPTR_POSE 3U
+#define ADC_SS3_FSTAT_TPTR_MSK BITS(ADC_SS3_FSTAT_TPTR_POSS,ADC_SS3_FSTAT_TPTR_POSE)
+
+/****************** Bit definition for ADC_SS3_DATA register ************************/
+
+#define ADC_SS3_DATA_DATA_POSS 0U
+#define ADC_SS3_DATA_DATA_POSE 11U
+#define ADC_SS3_DATA_DATA_MSK BITS(ADC_SS3_DATA_DATA_POSS,ADC_SS3_DATA_DATA_POSE)
+
+typedef struct
+{
+ __IO uint32_t CFG;
+ __IO uint32_t SRATE;
+ __IO uint32_t CHINV;
+ __IO uint32_t GAINL;
+ __IO uint32_t GAINH;
+ __O uint32_t FRF;
+ __IO uint32_t SSEN;
+ __IO uint32_t SWTRI;
+ __O uint32_t IER;
+ __O uint32_t IDR;
+ __I uint32_t IVS;
+ __I uint32_t RIF;
+ __I uint32_t IFM;
+ __O uint32_t ICR;
+ __IO uint32_t DMA;
+ uint32_t RESERVED0 ;
+ __IO uint32_t SS0_CON;
+ __IO uint32_t SS0_MUX0;
+ __IO uint32_t SS0_MUX1;
+ __IO uint32_t SS0_END;
+ __I uint32_t SS0_FSTAT;
+ __IO uint32_t SS0_DATA;
+ uint32_t RESERVED1[2] ;
+ __IO uint32_t SS1_CON;
+ __IO uint32_t SS1_MUX0;
+ __IO uint32_t SS1_END;
+ __I uint32_t SS1_FSTAT;
+ __IO uint32_t SS1_DATA;
+ uint32_t RESERVED2 ;
+ __IO uint32_t SS2_CON;
+ __IO uint32_t SS2_MUX0;
+ __IO uint32_t SS2_END;
+ __I uint32_t SS2_FSTAT;
+ __IO uint32_t SS2_DATA;
+ uint32_t RESERVED3 ;
+ __IO uint32_t SS3_CON;
+ __IO uint32_t SS3_MUX0;
+ __IO uint32_t SS3_END;
+ __I uint32_t SS3_FSTAT;
+ __IO uint32_t SS3_DATA;
+} ADC_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_aes.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_aes.h
new file mode 100644
index 0000000000000000000000000000000000000000..dd47cdea101d554d024022e839c8710e02f2e3a9
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_aes.h
@@ -0,0 +1,193 @@
+/**
+ **************************************************************************************
+ * @file REG_AES.h
+ * @brief AES Head File
+ *
+ * @version V0.01
+ * @data 11/16/2018
+ * @author Eastsoft AE Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __AES_H__
+#define __AES_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for AES_CON register ************************/
+
+#define AES_CON_READY_POS 22U
+#define AES_CON_READY_MSK BIT(AES_CON_READY_POS)
+
+#define AES_CON_OT_DMA_ST_POS 21U
+#define AES_CON_OT_DMA_ST_MSK BIT(AES_CON_OT_DMA_ST_POS)
+
+#define AES_CON_IT_DMA_ST_POS 20U
+#define AES_CON_IT_DMA_ST_MSK BIT(AES_CON_IT_DMA_ST_POS)
+
+#define AES_CON_OT_DEPTH_POSS 18U
+#define AES_CON_OT_DEPTH_POSE 19U
+#define AES_CON_OT_DEPTH_MSK BITS(AES_CON_OT_DEPTH_POSS,AES_CON_OT_DEPTH_POSE)
+
+#define AES_CON_IT_DEPTH_POSS 16U
+#define AES_CON_IT_DEPTH_POSE 17U
+#define AES_CON_IT_DEPTH_MSK BITS(AES_CON_IT_DEPTH_POSS,AES_CON_IT_DEPTH_POSE)
+
+#define AES_CON_RE_INIT_POS 8U
+#define AES_CON_RE_INIT_MSK BIT(AES_CON_RE_INIT_POS)
+
+#define AES_CON_DMA_EN_POSS 6U
+#define AES_CON_DMA_EN_POSE 7U
+#define AES_CON_DMA_EN_MSK BITS(AES_CON_DMA_EN_POSS,AES_CON_DMA_EN_POSE)
+
+#define AES_CON_BL_POSS 3U
+#define AES_CON_BL_POSE 5U
+#define AES_CON_BL_MSK BITS(AES_CON_BL_POSS,AES_CON_BL_POSE)
+
+#define AES_CON_REV_POS 2U
+#define AES_CON_REV_MSK BIT(AES_CON_REV_POS)
+
+#define AES_CON_MODE_POS 1U
+#define AES_CON_MODE_MSK BIT(AES_CON_MODE_POS)
+
+#define AES_CON_START_POS 0U
+#define AES_CON_START_MSK BIT(AES_CON_START_POS)
+
+/****************** Bit definition for AES_IER register ************************/
+
+#define AES_IER_DECIE_POS 1U
+#define AES_IER_DECIE_MSK BIT(AES_IER_DECIE_POS)
+
+#define AES_IER_ENCIE_POS 0U
+#define AES_IER_ENCIE_MSK BIT(AES_IER_ENCIE_POS)
+
+/****************** Bit definition for AES_IDR register ************************/
+
+#define AES_IDR_DECID_POS 1U
+#define AES_IDR_DECID_MSK BIT(AES_IDR_DECID_POS)
+
+#define AES_IDR_ENCID_POS 0U
+#define AES_IDR_ENCID_MSK BIT(AES_IDR_ENCID_POS)
+
+/****************** Bit definition for AES_IVS register ************************/
+
+#define AES_IVS_DECIVS_POS 1U
+#define AES_IVS_DECIVS_MSK BIT(AES_IVS_DECIVS_POS)
+
+#define AES_IVS_ENCIVS_POS 0U
+#define AES_IVS_ENCIVS_MSK BIT(AES_IVS_ENCIVS_POS)
+
+/****************** Bit definition for AES_RIF register ************************/
+
+#define AES_RIF_DECRIF_POS 1U
+#define AES_RIF_DECRIF_MSK BIT(AES_RIF_DECRIF_POS)
+
+#define AES_RIF_ENCRIF_POS 0U
+#define AES_RIF_ENCRIF_MSK BIT(AES_RIF_ENCRIF_POS)
+
+/****************** Bit definition for AES_IFM register ************************/
+
+#define AES_IFM_DECIFM_POS 1U
+#define AES_IFM_DECIFM_MSK BIT(AES_IFM_DECIFM_POS)
+
+#define AES_IFM_ENCIFM_POS 0U
+#define AES_IFM_ENCIFM_MSK BIT(AES_IFM_ENCIFM_POS)
+
+/****************** Bit definition for AES_ICR register ************************/
+
+#define AES_ICR_DECICR_POS 1U
+#define AES_ICR_DECICR_MSK BIT(AES_ICR_DECICR_POS)
+
+#define AES_ICR_ENCICR_POS 0U
+#define AES_ICR_ENCICR_MSK BIT(AES_ICR_ENCICR_POS)
+
+/****************** Bit definition for AES_DIO register ************************/
+
+#define AES_DIO_DIO_POSS 0U
+#define AES_DIO_DIO_POSE 31U
+#define AES_DIO_DIO_MSK BITS(AES_DIO_DIO_POSS,AES_DIO_DIO_POSE)
+
+/****************** Bit definition for AES_KEY0 register ************************/
+
+#define AES_KEY0_KEY0_POSS 0U
+#define AES_KEY0_KEY0_POSE 31U
+#define AES_KEY0_KEY0_MSK BITS(AES_KEY0_KEY0_POSS,AES_KEY0_KEY0_POSE)
+
+/****************** Bit definition for AES_KEY1 register ************************/
+
+#define AES_KEY1_KEY1_POSS 0U
+#define AES_KEY1_KEY1_POSE 31U
+#define AES_KEY1_KEY1_MSK BITS(AES_KEY1_KEY1_POSS,AES_KEY1_KEY1_POSE)
+
+/****************** Bit definition for AES_KEY2 register ************************/
+
+#define AES_KEY2_KEY2_POSS 0U
+#define AES_KEY2_KEY2_POSE 31U
+#define AES_KEY2_KEY2_MSK BITS(AES_KEY2_KEY2_POSS,AES_KEY2_KEY2_POSE)
+
+/****************** Bit definition for AES_KEY3 register ************************/
+
+#define AES_KEY3_KEY3_POSS 0U
+#define AES_KEY3_KEY3_POSE 31U
+#define AES_KEY3_KEY3_MSK BITS(AES_KEY3_KEY3_POSS,AES_KEY3_KEY3_POSE)
+
+/****************** Bit definition for AES_IV0 register ************************/
+
+#define AES_IV0_IV0_POSS 0U
+#define AES_IV0_IV0_POSE 31U
+#define AES_IV0_IV0_MSK BITS(AES_IV0_IV0_POSS,AES_IV0_IV0_POSE)
+
+/****************** Bit definition for AES_IV1 register ************************/
+
+#define AES_IV1_IV1_POSS 0U
+#define AES_IV1_IV1_POSE 31U
+#define AES_IV1_IV1_MSK BITS(AES_IV1_IV1_POSS,AES_IV1_IV1_POSE)
+
+/****************** Bit definition for AES_IV2 register ************************/
+
+#define AES_IV2_IV2_POSS 0U
+#define AES_IV2_IV2_POSE 31U
+#define AES_IV2_IV2_MSK BITS(AES_IV2_IV2_POSS,AES_IV2_IV2_POSE)
+
+/****************** Bit definition for AES_IV3 register ************************/
+
+#define AES_IV3_IV3_POSS 0U
+#define AES_IV3_IV3_POSE 31U
+#define AES_IV3_IV3_MSK BITS(AES_IV3_IV3_POSS,AES_IV3_IV3_POSE)
+
+typedef struct
+{
+ __IO uint32_t CON; /* 0x000 AES_CON AES Control Register */
+ __O uint32_t IER; /* 0x004 AES_IER AES Interrupt Enable Register */
+ __O uint32_t IDR; /* 0x008 AES_IDR AES Interrupt Disable Register */
+ __I uint32_t IVS; /* 0x00C AES_IVS AES Interrupt Valid Status Register */
+ __I uint32_t RIF; /* 0x010 AES_RIF AES Raw Interrupt Flag Status Register */
+ __I uint32_t IFM; /* 0x014 AES_IFM AES Interrupt Flag Masked Register */
+ __O uint32_t ICR; /* 0x018 AES_ICR AES Interrupt Clear Register */
+ __IO uint32_t DIO; /* 0x01C AES_DIO AES 128-bit Input/Output Data Register */
+ __IO uint32_t KEY0; /* 0x020 AES_KEY0 AES 256-bit Keyword Register 0 */
+ __IO uint32_t KEY1; /* 0x024 AES_KEY1 AES 256-bit Keyword Register 1 */
+ __IO uint32_t KEY2; /* 0x028 AES_KEY2 AES 256-bit Keyword Register 2 */
+ __IO uint32_t KEY3; /* 0x02C AES_KEY3 AES 256-bit Keyword Register 3 */
+ uint32_t RESERVED0[4] ;
+ __IO uint32_t IV0; /* 0x040 AES_IV0 AES 128-bit Initial Vector Register 0 */
+ __IO uint32_t IV1; /* 0x044 AES_IV1 AES 128-bit Initial Vector Register 1 */
+ __IO uint32_t IV2; /* 0x048 AES_IV2 AES 128-bit Initial Vector Register 2 */
+ __IO uint32_t IV3; /* 0x04C AES_IV3 AES 128-bit Initial Vector Register 3 */
+} AES_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_cmp.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_cmp.h
new file mode 100644
index 0000000000000000000000000000000000000000..8b1f4e5de6c77fcc89d6e9209e7296175de09446
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_cmp.h
@@ -0,0 +1,95 @@
+/**
+ **************************************************************************************
+ * @file REG_CMP.h
+ * @brief CMP Head File
+ *
+ * @version V0.01
+ * @data 12/3/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __CMP_H__
+#define __CMP_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for CMP_CON register ************************/
+
+#define CMP_CON_REFON_POS 4U
+#define CMP_CON_REFON_MSK BIT(CMP_CON_REFON_POS)
+
+#define CMP_CON_CMPON2_POS 1U
+#define CMP_CON_CMPON2_MSK BIT(CMP_CON_CMPON2_POS)
+
+#define CMP_CON_CMPON1_POS 0U
+#define CMP_CON_CMPON1_MSK BIT(CMP_CON_CMPON1_POS)
+
+/****************** Bit definition for CMP_CFG1 register ************************/
+
+#define CMP_CFG1_RS_POSS 4U
+#define CMP_CFG1_RS_POSE 5U
+#define CMP_CFG1_RS_MSK BITS(CMP_CFG1_RS_POSS,CMP_CFG1_RS_POSE)
+
+#define CMP_CFG1_FEN_POS 3U
+#define CMP_CFG1_FEN_MSK BIT(CMP_CFG1_FEN_POS)
+
+#define CMP_CFG1_PSEN_POS 2U
+#define CMP_CFG1_PSEN_MSK BIT(CMP_CFG1_PSEN_POS)
+
+#define CMP_CFG1_INSEL_POS 1U
+#define CMP_CFG1_INSEL_MSK BIT(CMP_CFG1_INSEL_POS)
+
+#define CMP_CFG1_IPSEL_POS 0U
+#define CMP_CFG1_IPSEL_MSK BIT(CMP_CFG1_IPSEL_POS)
+
+/****************** Bit definition for CMP_CFG2 register ************************/
+
+#define CMP_CFG2_RS_POSS 4U
+#define CMP_CFG2_RS_POSE 5U
+#define CMP_CFG2_RS_MSK BITS(CMP_CFG2_RS_POSS,CMP_CFG2_RS_POSE)
+
+#define CMP_CFG2_FEN_POS 3U
+#define CMP_CFG2_FEN_MSK BIT(CMP_CFG1_FEN_POS)
+
+#define CMP_CFG2_PSEN_POS 2U
+#define CMP_CFG2_PSEN_MSK BIT(CMP_CFG1_PSEN_POS)
+
+#define CMP_CFG2_INSEL_POS 1U
+#define CMP_CFG2_INSEL_MSK BIT(CMP_CFG1_INSEL_POS)
+
+#define CMP_CFG2_IPSEL_POS 0U
+#define CMP_CFG2_IPSEL_MSK BIT(CMP_CFG1_IPSEL_POS)
+
+/****************** Bit definition for CMP_RULT register ************************/
+
+#define CMP_RULT_CMPO2_POS 1U
+#define CMP_RULT_CMPO2_MSK BIT(CMP_RULT_CMPO2_POS)
+
+#define CMP_RULT_CMPO1_POS 0U
+#define CMP_RULT_CMPO1_MSK BIT(CMP_RULT_CMPO1_POS)
+
+typedef struct
+{
+ __IO uint32_t CON;
+ __IO uint32_t CFG1;
+ __IO uint32_t CFG2;
+ uint32_t RESERVED0[2] ;
+ __I uint32_t RULT;
+} CMP_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_crc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_crc.h
new file mode 100644
index 0000000000000000000000000000000000000000..cdbb00b45c61c7d5d4e3e94bf1c28b67474583c7
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_crc.h
@@ -0,0 +1,125 @@
+/**
+ **************************************************************************************
+ * @file REG_CRC.h
+ * @brief CRC Head File
+ *
+ * @version V0.01
+ * @data 11/16/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __CRC_H__
+#define __CRC_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for CRC_INIT register ************************/
+
+#define CRC_INIT_INIT_POSS 0U
+#define CRC_INIT_INIT_POSE 31U
+#define CRC_INIT_INIT_MSK BITS(CRC_INIT_INIT_POSS,CRC_INIT_INIT_POSE)
+
+/****************** Bit definition for CRC_POLY register ************************/
+
+#define CRC_POLY_POLY_POSS 0U
+#define CRC_POLY_POLY_POSE 31U
+#define CRC_POLY_POLY_MSK BITS(CRC_POLY_POLY_POSS,CRC_POLY_POLY_POSE)
+
+/****************** Bit definition for CRC_DATA register ************************/
+
+#define CRC_DATA_DATA_POSS 0U
+#define CRC_DATA_DATA_POSE 31U
+#define CRC_DATA_DATA_MSK BITS(CRC_DATA_DATA_POSS,CRC_DATA_DATA_POSE)
+
+/****************** Bit definition for CRC_COMP register ************************/
+
+#define CRC_COMP_COMP_POSS 0U
+#define CRC_COMP_COMP_POSE 31U
+#define CRC_COMP_COMP_MSK BITS(CRC_COMP_COMP_POSS,CRC_COMP_COMP_POSE)
+
+/****************** Bit definition for CRC_REMA register ************************/
+
+#define CRC_REMA_REMA_POSS 0U
+#define CRC_REMA_REMA_POSE 31U
+#define CRC_REMA_REMA_MSK BITS(CRC_REMA_REMA_POSS,CRC_REMA_REMA_POSE)
+
+/****************** Bit definition for CRC_CON register ************************/
+
+#define CRC_CON_DMA_POS 16U
+#define CRC_CON_DMA_MSK BIT(CRC_CON_DMA_POS)
+
+#define CRC_CON_MSB_POS 12U
+#define CRC_CON_MSB_MSK BIT(CRC_CON_MSB_POS)
+
+#define CRC_CON_REOUT_POS 10U
+#define CRC_CON_REOUT_MSK BIT(CRC_CON_REOUT_POS)
+
+#define CRC_CON_REIN_POS 8U
+#define CRC_CON_REIN_MSK BIT(CRC_CON_REIN_POS)
+
+#define CRC_CON_SIZE_POSS 4U
+#define CRC_CON_SIZE_POSE 5U
+#define CRC_CON_SIZE_MSK BITS(CRC_CON_SIZE_POSS,CRC_CON_SIZE_POSE)
+
+#define CRC_CON_MODE_POSS 2U
+#define CRC_CON_MODE_POSE 3U
+#define CRC_CON_MODE_MSK BITS(CRC_CON_MODE_POSS,CRC_CON_MODE_POSE)
+
+#define CRC_CON_RESET_POS 0U
+#define CRC_CON_RESET_MSK BIT(CRC_CON_RESET_POS)
+
+/****************** Bit definition for CRC_DOUT register ************************/
+
+#define CRC_DOUT_DOUT_POSS 0U
+#define CRC_DOUT_DOUT_POSE 31U
+#define CRC_DOUT_DOUT_MSK BITS(CRC_DOUT_DOUT_POSS,CRC_DOUT_DOUT_POSE)
+
+/****************** Bit definition for CRC_DOUT_XOR register ************************/
+
+#define CRC_DOUT_XOR_DOUT_XOR_POSS 0U
+#define CRC_DOUT_XOR_DOUT_XOR_POSE 31U
+#define CRC_DOUT_XOR_DOUT_XOR_MSK BITS(CRC_DOUT_XOR_DOUT_XOR_POSS,CRC_DOUT_XOR_DOUT_XOR_POSE)
+
+/****************** Bit definition for CRC_STAT register ************************/
+
+#define CRC_STAT_FAIL_POS 8U
+#define CRC_STAT_FAIL_MSK BIT(CRC_STAT_FAIL_POS)
+
+#define CRC_STAT_EMPTY_POS 2U
+#define CRC_STAT_EMPTY_MSK BIT(CRC_STAT_EMPTY_POS)
+
+#define CRC_STAT_BUSY_POS 1U
+#define CRC_STAT_BUSY_MSK BIT(CRC_STAT_BUSY_POS)
+
+#define CRC_STAT_DONE_POS 0U
+#define CRC_STAT_DONE_MSK BIT(CRC_STAT_DONE_POS)
+
+typedef struct
+{
+ __IO uint32_t INIT; /* 0x000 CRC_INIT CRC Iintial Value Register */
+ __IO uint32_t POLY; /* 0x004 CRC_POLY CRC Polynomial Register */
+ __IO uint32_t DATA; /* 0x008 CRC_DATA CRC Input Data Register */
+ __IO uint32_t COMP; /* 0x00C CRC_COMP CRC Compare Data Register */
+ __IO uint32_t REMA; /* 0x010 CRC_REMA CRC Remainder Register */
+ __IO uint32_t CON; /* 0x014 CRC_CTRL CRC Control Register */
+ __I uint32_t DOUT; /* 0x018 CRC_DOUT CRC Output Data Register */
+ __I uint32_t DOUT_XOR; /* 0x01C CRC_DOUT_XOR CRC Output Data Register */
+ __I uint32_t STAT; /* 0x020 CRC_STA CRC Status Register */
+} CRC_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dac.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dac.h
new file mode 100644
index 0000000000000000000000000000000000000000..73a409e5eb2fd81d6006d211030ffc1fb265a6da
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dac.h
@@ -0,0 +1,97 @@
+/**
+ **************************************************************************************
+ * @file REG_DAC.h
+ * @brief DAC Head File
+ *
+ * @version V0.01
+ * @data 1/14/2019
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __DAC_H__
+#define __DAC_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for DAC_CON register ************************/
+
+#define DAC_CON_T_SEL_POSS 9U
+#define DAC_CON_T_SEL_POSE 13U
+#define DAC_CON_T_SEL_MSK BITS(DAC_CON_T_SEL_POSS,DAC_CON_T_SEL_POSE)
+
+#define DAC_CON_TRIEN_POS 8U
+#define DAC_CON_TRIEN_MSK BIT(DAC_CON_TRIEN_POS)
+
+#define DAC_CON_MAMP_POSS 3U
+#define DAC_CON_MAMP_POSE 6U
+#define DAC_CON_MAMP_MSK BITS(DAC_CON_MAMP_POSS,DAC_CON_MAMP_POSE)
+
+#define DAC_CON_WAVE_POSS 1U
+#define DAC_CON_WAVE_POSE 2U
+#define DAC_CON_WAVE_MSK BITS(DAC_CON_WAVE_POSS,DAC_CON_WAVE_POSE)
+
+#define DAC_CON_INVREN_POS 0U
+#define DAC_CON_INVREN_MSK BIT(DAC_CON_INVREN_POS)
+
+/****************** Bit definition for DAC_DIV register ************************/
+
+#define DAC_DIV_DIV_VALUE_POSS 0U
+#define DAC_DIV_DIV_VALUE_POSE 15U
+#define DAC_DIV_DIV_VALUE_MSK BITS(DAC_DIV_DIV_VALUE_POSS,DAC_DIV_DIV_VALUE_POSE)
+
+/****************** Bit definition for DAC_STAT register ************************/
+
+#define DAC_STAT_TX_FULL_POS 1U
+#define DAC_STAT_TX_FULL_MSK BIT(DAC_STAT_TX_FULL_POS)
+
+#define DAC_STAT_BUSY_POS 0U
+#define DAC_STAT_BUSY_MSK BIT(DAC_STAT_BUSY_POS)
+
+/****************** Bit definition for DAC_EN register ************************/
+
+#define DAC_EN_DAC_EN_POS 0U
+#define DAC_EN_DAC_EN_MSK BIT(DAC_EN_DAC_EN_POS)
+
+/****************** Bit definition for DAC_DMAC register ************************/
+
+#define DAC_DMAC_TXDMAEN_POS 0U
+#define DAC_DMAC_TXDMAEN_MSK BIT(DAC_DMAC_TXDMAEN_POS)
+
+/****************** Bit definition for DAC_TRIG register ************************/
+
+#define DAC_TRIG_S_TRIG_POS 0U
+#define DAC_TRIG_S_TRIG_MSK BIT(DAC_TRIG_S_TRIG_POS)
+
+/****************** Bit definition for DAC_DATA register ************************/
+
+#define DAC_DATA_TXDATA_POSS 0U
+#define DAC_DATA_TXDATA_POSE 11U
+#define DAC_DATA_TXDATA_MSK BITS(DAC_DATA_TXDATA_POSS,DAC_DATA_TXDATA_POSE)
+
+typedef struct
+{
+ __IO uint32_t CON;
+ __IO uint32_t DIV;
+ __I uint32_t STAT;
+ __IO uint32_t EN;
+ __IO uint32_t DMAC;
+ __O uint32_t TRIG;
+ __IO uint32_t DATA;
+} DAC_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dma.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dma.h
new file mode 100644
index 0000000000000000000000000000000000000000..bead8afcdb5e0180745897fda692a1b6b35ffae3
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dma.h
@@ -0,0 +1,825 @@
+/**
+ **************************************************************************************
+ * @file REG_DMA.h
+ * @brief DMA Head File
+ *
+ * @version V0.01
+ * @date 12/5/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __DMA_H__
+#define __DMA_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for DMA_IER register ************************/
+
+#define DMA_IER_CH5TABIE_POS 11U
+#define DMA_IER_CH5TABIE_MSK BIT(DMA_IER_CH5TABIE_POS)
+
+#define DMA_IER_CH5BTDIE_POS 10U
+#define DMA_IER_CH5BTDIE_MSK BIT(DMA_IER_CH5BTDIE_POS)
+
+#define DMA_IER_CH4TABIE_POS 9U
+#define DMA_IER_CH4TABIE_MSK BIT(DMA_IER_CH4TABIE_POS)
+
+#define DMA_IER_CH4BTDIE_POS 8U
+#define DMA_IER_CH4BTDIE_MSK BIT(DMA_IER_CH4BTDIE_POS)
+
+#define DMA_IER_CH3TABIE_POS 7U
+#define DMA_IER_CH3TABIE_MSK BIT(DMA_IER_CH3TABIE_POS)
+
+#define DMA_IER_CH3BTDIE_POS 6U
+#define DMA_IER_CH3BTDIE_MSK BIT(DMA_IER_CH3BTDIE_POS)
+
+#define DMA_IER_CH2TABIE_POS 5U
+#define DMA_IER_CH2TABIE_MSK BIT(DMA_IER_CH2TABIE_POS)
+
+#define DMA_IER_CH2BTDIE_POS 4U
+#define DMA_IER_CH2BTDIE_MSK BIT(DMA_IER_CH2BTDIE_POS)
+
+#define DMA_IER_CH1TABIE_POS 3U
+#define DMA_IER_CH1TABIE_MSK BIT(DMA_IER_CH1TABIE_POS)
+
+#define DMA_IER_CH1BTDIE_POS 2U
+#define DMA_IER_CH1BTDIE_MSK BIT(DMA_IER_CH1BTDIE_POS)
+
+#define DMA_IER_CH0TABIE_POS 1U
+#define DMA_IER_CH0TABIE_MSK BIT(DMA_IER_CH0TABIE_POS)
+
+#define DMA_IER_CH0BTDIE_POS 0U
+#define DMA_IER_CH0BTDIE_MSK BIT(DMA_IER_CH0BTDIE_POS)
+
+/****************** Bit definition for DMA_IDR register ************************/
+
+#define DMA_IDR_CH5TABID_POS 11U
+#define DMA_IDR_CH5TABID_MSK BIT(DMA_IDR_CH5TABID_POS)
+
+#define DMA_IDR_CH5BTDID_POS 10U
+#define DMA_IDR_CH5BTDID_MSK BIT(DMA_IDR_CH5BTDID_POS)
+
+#define DMA_IDR_CH4TABID_POS 9U
+#define DMA_IDR_CH4TABID_MSK BIT(DMA_IDR_CH4TABID_POS)
+
+#define DMA_IDR_CH4BTDID_POS 8U
+#define DMA_IDR_CH4BTDID_MSK BIT(DMA_IDR_CH4BTDID_POS)
+
+#define DMA_IDR_CH3TABID_POS 7U
+#define DMA_IDR_CH3TABID_MSK BIT(DMA_IDR_CH3TABID_POS)
+
+#define DMA_IDR_CH3BTDID_POS 6U
+#define DMA_IDR_CH3BTDID_MSK BIT(DMA_IDR_CH3BTDID_POS)
+
+#define DMA_IDR_CH2TABID_POS 5U
+#define DMA_IDR_CH2TABID_MSK BIT(DMA_IDR_CH2TABID_POS)
+
+#define DMA_IDR_CH2BTDID_POS 4U
+#define DMA_IDR_CH2BTDID_MSK BIT(DMA_IDR_CH2BTDID_POS)
+
+#define DMA_IDR_CH1TABID_POS 3U
+#define DMA_IDR_CH1TABID_MSK BIT(DMA_IDR_CH1TABID_POS)
+
+#define DMA_IDR_CH1BTDID_POS 2U
+#define DMA_IDR_CH1BTDID_MSK BIT(DMA_IDR_CH1BTDID_POS)
+
+#define DMA_IDR_CH0TABID_POS 1U
+#define DMA_IDR_CH0TABID_MSK BIT(DMA_IDR_CH0TABID_POS)
+
+#define DMA_IDR_CH0BTDID_POS 0U
+#define DMA_IDR_CH0BTDID_MSK BIT(DMA_IDR_CH0BTDID_POS)
+
+/****************** Bit definition for DMA_IVS register ************************/
+
+#define DMA_IVS_CH5TABIVS_POS 11U
+#define DMA_IVS_CH5TABIVS_MSK BIT(DMA_IVS_CH5TABIVS_POS)
+
+#define DMA_IVS_CH5BTDIVS_POS 10U
+#define DMA_IVS_CH5BTDIVS_MSK BIT(DMA_IVS_CH5BTDIVS_POS)
+
+#define DMA_IVS_CH4TABIVS_POS 9U
+#define DMA_IVS_CH4TABIVS_MSK BIT(DMA_IVS_CH4TABIVS_POS)
+
+#define DMA_IVS_CH4BTDIVS_POS 8U
+#define DMA_IVS_CH4BTDIVS_MSK BIT(DMA_IVS_CH4BTDIVS_POS)
+
+#define DMA_IVS_CH3TABIVS_POS 7U
+#define DMA_IVS_CH3TABIVS_MSK BIT(DMA_IVS_CH3TABIVS_POS)
+
+#define DMA_IVS_CH3BTDIVS_POS 6U
+#define DMA_IVS_CH3BTDIVS_MSK BIT(DMA_IVS_CH3BTDIVS_POS)
+
+#define DMA_IVS_CH2TABIVS_POS 5U
+#define DMA_IVS_CH2TABIVS_MSK BIT(DMA_IVS_CH2TABIVS_POS)
+
+#define DMA_IVS_CH2BTDIVS_POS 4U
+#define DMA_IVS_CH2BTDIVS_MSK BIT(DMA_IVS_CH2BTDIVS_POS)
+
+#define DMA_IVS_CH1TABIVS_POS 3U
+#define DMA_IVS_CH1TABIVS_MSK BIT(DMA_IVS_CH1TABIVS_POS)
+
+#define DMA_IVS_CH1BTDIVS_POS 2U
+#define DMA_IVS_CH1BTDIVS_MSK BIT(DMA_IVS_CH1BTDIVS_POS)
+
+#define DMA_IVS_CH0TABIVS_POS 1U
+#define DMA_IVS_CH0TABIVS_MSK BIT(DMA_IVS_CH0TABIVS_POS)
+
+#define DMA_IVS_CH0BTDIVS_POS 0U
+#define DMA_IVS_CH0BTDIVS_MSK BIT(DMA_IVS_CH0BTDIVS_POS)
+
+/****************** Bit definition for DMA_RIF register ************************/
+
+#define DMA_RIF_CH5TABRIF_POS 11U
+#define DMA_RIF_CH5TABRIF_MSK BIT(DMA_RIF_CH5TABRIF_POS)
+
+#define DMA_RIF_CH5BTDRIF_POS 10U
+#define DMA_RIF_CH5BTDRIF_MSK BIT(DMA_RIF_CH5BTDRIF_POS)
+
+#define DMA_RIF_CH4TABRIF_POS 9U
+#define DMA_RIF_CH4TABRIF_MSK BIT(DMA_RIF_CH4TABRIF_POS)
+
+#define DMA_RIF_CH4BTDRIF_POS 8U
+#define DMA_RIF_CH4BTDRIF_MSK BIT(DMA_RIF_CH4BTDRIF_POS)
+
+#define DMA_RIF_CH3TABRIF_POS 7U
+#define DMA_RIF_CH3TABRIF_MSK BIT(DMA_RIF_CH3TABRIF_POS)
+
+#define DMA_RIF_CH3BTDRIF_POS 6U
+#define DMA_RIF_CH3BTDRIF_MSK BIT(DMA_RIF_CH3BTDRIF_POS)
+
+#define DMA_RIF_CH2TABRIF_POS 5U
+#define DMA_RIF_CH2TABRIF_MSK BIT(DMA_RIF_CH2TABRIF_POS)
+
+#define DMA_RIF_CH2BTDRIF_POS 4U
+#define DMA_RIF_CH2BTDRIF_MSK BIT(DMA_RIF_CH2BTDRIF_POS)
+
+#define DMA_RIF_CH1TABRIF_POS 3U
+#define DMA_RIF_CH1TABRIF_MSK BIT(DMA_RIF_CH1TABRIF_POS)
+
+#define DMA_RIF_CH1BTDRIF_POS 2U
+#define DMA_RIF_CH1BTDRIF_MSK BIT(DMA_RIF_CH1BTDRIF_POS)
+
+#define DMA_RIF_CH0TABRIF_POS 1U
+#define DMA_RIF_CH0TABRIF_MSK BIT(DMA_RIF_CH0TABRIF_POS)
+
+#define DMA_RIF_CH0BTDRIF_POS 0U
+#define DMA_RIF_CH0BTDRIF_MSK BIT(DMA_RIF_CH0BTDRIF_POS)
+
+/****************** Bit definition for DMA_IFM register ************************/
+
+#define DMA_IFM_CH5TABIFM_POS 11U
+#define DMA_IFM_CH5TABIFM_MSK BIT(DMA_IFM_CH5TABIFM_POS)
+
+#define DMA_IFM_CH5BTDIFM_POS 10U
+#define DMA_IFM_CH5BTDIFM_MSK BIT(DMA_IFM_CH5BTDIFM_POS)
+
+#define DMA_IFM_CH4TABIFM_POS 9U
+#define DMA_IFM_CH4TABIFM_MSK BIT(DMA_IFM_CH4TABIFM_POS)
+
+#define DMA_IFM_CH4BTDIFM_POS 8U
+#define DMA_IFM_CH4BTDIFM_MSK BIT(DMA_IFM_CH4BTDIFM_POS)
+
+#define DMA_IFM_CH3TABIFM_POS 7U
+#define DMA_IFM_CH3TABIFM_MSK BIT(DMA_IFM_CH3TABIFM_POS)
+
+#define DMA_IFM_CH3BTDIFM_POS 6U
+#define DMA_IFM_CH3BTDIFM_MSK BIT(DMA_IFM_CH3BTDIFM_POS)
+
+#define DMA_IFM_CH2TABIFM_POS 5U
+#define DMA_IFM_CH2TABIFM_MSK BIT(DMA_IFM_CH2TABIFM_POS)
+
+#define DMA_IFM_CH2BTDIFM_POS 4U
+#define DMA_IFM_CH2BTDIFM_MSK BIT(DMA_IFM_CH2BTDIFM_POS)
+
+#define DMA_IFM_CH1TABIFM_POS 3U
+#define DMA_IFM_CH1TABIFM_MSK BIT(DMA_IFM_CH1TABIFM_POS)
+
+#define DMA_IFM_CH1BTDIFM_POS 2U
+#define DMA_IFM_CH1BTDIFM_MSK BIT(DMA_IFM_CH1BTDIFM_POS)
+
+#define DMA_IFM_CH0TABIFM_POS 1U
+#define DMA_IFM_CH0TABIFM_MSK BIT(DMA_IFM_CH0TABIFM_POS)
+
+#define DMA_IFM_CH0BTDIFM_POS 0U
+#define DMA_IFM_CH0BTDIFM_MSK BIT(DMA_IFM_CH0BTDIFM_POS)
+
+/****************** Bit definition for DMA_ICR register ************************/
+
+#define DMA_ICR_CH5TABICR_POS 11U
+#define DMA_ICR_CH5TABICR_MSK BIT(DMA_ICR_CH5TABICR_POS)
+
+#define DMA_ICR_CH5BTDICR_POS 10U
+#define DMA_ICR_CH5BTDICR_MSK BIT(DMA_ICR_CH5BTDICR_POS)
+
+#define DMA_ICR_CH4TABICR_POS 9U
+#define DMA_ICR_CH4TABICR_MSK BIT(DMA_ICR_CH4TABICR_POS)
+
+#define DMA_ICR_CH4BTDICR_POS 8U
+#define DMA_ICR_CH4BTDICR_MSK BIT(DMA_ICR_CH4BTDICR_POS)
+
+#define DMA_ICR_CH3TABICR_POS 7U
+#define DMA_ICR_CH3TABICR_MSK BIT(DMA_ICR_CH3TABICR_POS)
+
+#define DMA_ICR_CH3BTDICR_POS 6U
+#define DMA_ICR_CH3BTDICR_MSK BIT(DMA_ICR_CH3BTDICR_POS)
+
+#define DMA_ICR_CH2TABICR_POS 5U
+#define DMA_ICR_CH2TABICR_MSK BIT(DMA_ICR_CH2TABICR_POS)
+
+#define DMA_ICR_CH2BTDICR_POS 4U
+#define DMA_ICR_CH2BTDICR_MSK BIT(DMA_ICR_CH2BTDICR_POS)
+
+#define DMA_ICR_CH1TABICR_POS 3U
+#define DMA_ICR_CH1TABICR_MSK BIT(DMA_ICR_CH1TABICR_POS)
+
+#define DMA_ICR_CH1BTDICR_POS 2U
+#define DMA_ICR_CH1BTDICR_MSK BIT(DMA_ICR_CH1BTDICR_POS)
+
+#define DMA_ICR_CH0TABICR_POS 1U
+#define DMA_ICR_CH0TABICR_MSK BIT(DMA_ICR_CH0TABICR_POS)
+
+#define DMA_ICR_CH0BTDICR_POS 0U
+#define DMA_ICR_CH0BTDICR_MSK BIT(DMA_ICR_CH0BTDICR_POS)
+
+/****************** Bit definition for DMA_EMSG register ************************/
+
+#define DMA_EMSG_CH5PFSER_POS 23U
+#define DMA_EMSG_CH5PFSER_MSK BIT(DMA_EMSG_CH5PFSER_POS)
+
+#define DMA_EMSG_CH5PFOV_POS 22U
+#define DMA_EMSG_CH5PFOV_MSK BIT(DMA_EMSG_CH5PFOV_POS)
+
+#define DMA_EMSG_CH5SETBUER_POS 21U
+#define DMA_EMSG_CH5SETBUER_MSK BIT(DMA_EMSG_CH5SETBUER_POS)
+
+#define DMA_EMSG_CH5SETBCER_POS 20U
+#define DMA_EMSG_CH5SETBCER_MSK BIT(DMA_EMSG_CH5SETBCER_POS)
+
+#define DMA_EMSG_CH4PFSER_POS 19U
+#define DMA_EMSG_CH4PFSER_MSK BIT(DMA_EMSG_CH4PFSER_POS)
+
+#define DMA_EMSG_CH4PFOV_POS 18U
+#define DMA_EMSG_CH4PFOV_MSK BIT(DMA_EMSG_CH4PFOV_POS)
+
+#define DMA_EMSG_CH4SETBUER_POS 17U
+#define DMA_EMSG_CH4SETBUER_MSK BIT(DMA_EMSG_CH4SETBUER_POS)
+
+#define DMA_EMSG_CH4SETBCER_POS 16U
+#define DMA_EMSG_CH4SETBCER_MSK BIT(DMA_EMSG_CH4SETBCER_POS)
+
+#define DMA_EMSG_CH3PFSER_POS 15U
+#define DMA_EMSG_CH3PFSER_MSK BIT(DMA_EMSG_CH3PFSER_POS)
+
+#define DMA_EMSG_CH3PFOV_POS 14U
+#define DMA_EMSG_CH3PFOV_MSK BIT(DMA_EMSG_CH3PFOV_POS)
+
+#define DMA_EMSG_CH3SETBUER_POS 13U
+#define DMA_EMSG_CH3SETBUER_MSK BIT(DMA_EMSG_CH3SETBUER_POS)
+
+#define DMA_EMSG_CH3SETBCER_POS 12U
+#define DMA_EMSG_CH3SETBCER_MSK BIT(DMA_EMSG_CH3SETBCER_POS)
+
+#define DMA_EMSG_CH2PFSER_POS 11U
+#define DMA_EMSG_CH2PFSER_MSK BIT(DMA_EMSG_CH2PFSER_POS)
+
+#define DMA_EMSG_CH2PFOV_POS 10U
+#define DMA_EMSG_CH2PFOV_MSK BIT(DMA_EMSG_CH2PFOV_POS)
+
+#define DMA_EMSG_CH2SETBUER_POS 9U
+#define DMA_EMSG_CH2SETBUER_MSK BIT(DMA_EMSG_CH2SETBUER_POS)
+
+#define DMA_EMSG_CH2SETBCER_POS 8U
+#define DMA_EMSG_CH2SETBCER_MSK BIT(DMA_EMSG_CH2SETBCER_POS)
+
+#define DMA_EMSG_CH1PFSER_POS 7U
+#define DMA_EMSG_CH1PFSER_MSK BIT(DMA_EMSG_CH1PFSER_POS)
+
+#define DMA_EMSG_CH1PFOV_POS 6U
+#define DMA_EMSG_CH1PFOV_MSK BIT(DMA_EMSG_CH1PFOV_POS)
+
+#define DMA_EMSG_CH1SETBUER_POS 5U
+#define DMA_EMSG_CH1SETBUER_MSK BIT(DMA_EMSG_CH1SETBUER_POS)
+
+#define DMA_EMSG_CH1SETBCER_POS 4U
+#define DMA_EMSG_CH1SETBCER_MSK BIT(DMA_EMSG_CH1SETBCER_POS)
+
+#define DMA_EMSG_CH0PFSER_POS 3U
+#define DMA_EMSG_CH0PFSER_MSK BIT(DMA_EMSG_CH0PFSER_POS)
+
+#define DMA_EMSG_CH0PFOV_POS 2U
+#define DMA_EMSG_CH0PFOV_MSK BIT(DMA_EMSG_CH0PFOV_POS)
+
+#define DMA_EMSG_CH0SETBUER_POS 1U
+#define DMA_EMSG_CH0SETBUER_MSK BIT(DMA_EMSG_CH0SETBUER_POS)
+
+#define DMA_EMSG_CH0SETBCER_POS 0U
+#define DMA_EMSG_CH0SETBCER_MSK BIT(DMA_EMSG_CH0SETBCER_POS)
+
+/****************** Bit definition for DMA_CSR0 register ************************/
+
+#define DMA_CSR0_DINCOS_POS 30U
+#define DMA_CSR0_DINCOS_MSK BIT(DMA_CSR0_DINCOS_POS)
+
+#define DMA_CSR0_DBUSEL_POSS 27U
+#define DMA_CSR0_DBUSEL_POSE 29U
+#define DMA_CSR0_DBUSEL_MSK BITS(DMA_CSR0_DBUSEL_POSS,DMA_CSR0_DBUSEL_POSE)
+
+#define DMA_CSR0_DDWSEL_POSS 25U
+#define DMA_CSR0_DDWSEL_POSE 26U
+#define DMA_CSR0_DDWSEL_MSK BITS(DMA_CSR0_DDWSEL_POSS,DMA_CSR0_DDWSEL_POSE)
+
+#define DMA_CSR0_DINC_POS 24U
+#define DMA_CSR0_DINC_MSK BIT(DMA_CSR0_DINC_POS)
+
+#define DMA_CSR0_SINCOS_POS 22U
+#define DMA_CSR0_SINCOS_MSK BIT(DMA_CSR0_SINCOS_POS)
+
+#define DMA_CSR0_SBUSEL_POSS 19U
+#define DMA_CSR0_SBUSEL_POSE 21U
+#define DMA_CSR0_SBUSEL_MSK BITS(DMA_CSR0_SBUSEL_POSS,DMA_CSR0_SBUSEL_POSE)
+
+#define DMA_CSR0_SDWSEL_POSS 17U
+#define DMA_CSR0_SDWSEL_POSE 18U
+#define DMA_CSR0_SDWSEL_MSK BITS(DMA_CSR0_SDWSEL_POSS,DMA_CSR0_SDWSEL_POSE)
+
+#define DMA_CSR0_SINC_POS 16U
+#define DMA_CSR0_SINC_MSK BIT(DMA_CSR0_SINC_POS)
+
+#define DMA_CSR0_PHSS_POSS 9U
+#define DMA_CSR0_PHSS_POSE 15U
+#define DMA_CSR0_PHSS_MSK BITS(DMA_CSR0_PHSS_POSS,DMA_CSR0_PHSS_POSE)
+
+#define DMA_CSR0_CHPRI_POSS 6U
+#define DMA_CSR0_CHPRI_POSE 8U
+#define DMA_CSR0_CHPRI_MSK BITS(DMA_CSR0_CHPRI_POSS,DMA_CSR0_CHPRI_POSE)
+
+#define DMA_CSR0_MODESEL_POSS 4U
+#define DMA_CSR0_MODESEL_POSE 5U
+#define DMA_CSR0_MODESEL_MSK BITS(DMA_CSR0_MODESEL_POSS,DMA_CSR0_MODESEL_POSE)
+
+#define DMA_CSR0_DIRMDEN_POS 3U
+#define DMA_CSR0_DIRMDEN_MSK BIT(DMA_CSR0_DIRMDEN_POS)
+
+#define DMA_CSR0_PFCTRL_POS 2U
+#define DMA_CSR0_PFCTRL_MSK BIT(DMA_CSR0_PFCTRL_POS)
+
+#define DMA_CSR0_CIRC_POS 1U
+#define DMA_CSR0_CIRC_MSK BIT(DMA_CSR0_CIRC_POS)
+
+#define DMA_CSR0_CHEN_POS 0U
+#define DMA_CSR0_CHEN_MSK BIT(DMA_CSR0_CHEN_POS)
+
+/****************** Bit definition for DMA_SAR0 register ************************/
+
+#define DMA_SAR0_SAR_POSS 0U
+#define DMA_SAR0_SAR_POSE 31U
+#define DMA_SAR0_SAR_MSK BITS(DMA_SAR0_SAR_POSS,DMA_SAR0_SAR_POSE)
+
+/****************** Bit definition for DMA_DAR0 register ************************/
+
+#define DMA_DAR0_DAR_POSS 0U
+#define DMA_DAR0_DAR_POSE 31U
+#define DMA_DAR0_DAR_MSK BITS(DMA_DAR0_DAR_POSS,DMA_DAR0_DAR_POSE)
+
+/****************** Bit definition for DMA_BCR0 register ************************/
+
+#define DMA_BCR0_CBCR_POSS 16U
+#define DMA_BCR0_CBCR_POSE 31U
+#define DMA_BCR0_CBCR_MSK BITS(DMA_BCR0_CBCR_POSS,DMA_BCR0_CBCR_POSE)
+
+#define DMA_BCR0_BCR_POSS 0U
+#define DMA_BCR0_BCR_POSE 15U
+#define DMA_BCR0_BCR_MSK BITS(DMA_BCR0_BCR_POSS,DMA_BCR0_BCR_POSE)
+
+/****************** Bit definition for DMA_CSR1 register ************************/
+
+#define DMA_CSR1_DINCOS_POS 30U
+#define DMA_CSR1_DINCOS_MSK BIT(DMA_CSR1_DINCOS_POS)
+
+#define DMA_CSR1_DBUSEL_POSS 27U
+#define DMA_CSR1_DBUSEL_POSE 29U
+#define DMA_CSR1_DBUSEL_MSK BITS(DMA_CSR1_DBUSEL_POSS,DMA_CSR1_DBUSEL_POSE)
+
+#define DMA_CSR1_DDWSEL_POSS 25U
+#define DMA_CSR1_DDWSEL_POSE 26U
+#define DMA_CSR1_DDWSEL_MSK BITS(DMA_CSR1_DDWSEL_POSS,DMA_CSR1_DDWSEL_POSE)
+
+#define DMA_CSR1_DINC_POS 24U
+#define DMA_CSR1_DINC_MSK BIT(DMA_CSR1_DINC_POS)
+
+#define DMA_CSR1_SINCOS_POS 22U
+#define DMA_CSR1_SINCOS_MSK BIT(DMA_CSR1_SINCOS_POS)
+
+#define DMA_CSR1_SBUSEL_POSS 19U
+#define DMA_CSR1_SBUSEL_POSE 21U
+#define DMA_CSR1_SBUSEL_MSK BITS(DMA_CSR1_SBUSEL_POSS,DMA_CSR1_SBUSEL_POSE)
+
+#define DMA_CSR1_SDWSEL_POSS 17U
+#define DMA_CSR1_SDWSEL_POSE 18U
+#define DMA_CSR1_SDWSEL_MSK BITS(DMA_CSR1_SDWSEL_POSS,DMA_CSR1_SDWSEL_POSE)
+
+#define DMA_CSR1_SINC_POS 16U
+#define DMA_CSR1_SINC_MSK BIT(DMA_CSR1_SINC_POS)
+
+#define DMA_CSR1_PHSS_POSS 9U
+#define DMA_CSR1_PHSS_POSE 15U
+#define DMA_CSR1_PHSS_MSK BITS(DMA_CSR1_PHSS_POSS,DMA_CSR1_PHSS_POSE)
+
+#define DMA_CSR1_CHPRI_POSS 6U
+#define DMA_CSR1_CHPRI_POSE 8U
+#define DMA_CSR1_CHPRI_MSK BITS(DMA_CSR1_CHPRI_POSS,DMA_CSR1_CHPRI_POSE)
+
+#define DMA_CSR1_MODESEL_POSS 4U
+#define DMA_CSR1_MODESEL_POSE 5U
+#define DMA_CSR1_MODESEL_MSK BITS(DMA_CSR1_MODESEL_POSS,DMA_CSR1_MODESEL_POSE)
+
+#define DMA_CSR1_DIRMDEN_POS 3U
+#define DMA_CSR1_DIRMDEN_MSK BIT(DMA_CSR1_DIRMDEN_POS)
+
+#define DMA_CSR1_PFCTRL_POS 2U
+#define DMA_CSR1_PFCTRL_MSK BIT(DMA_CSR1_PFCTRL_POS)
+
+#define DMA_CSR1_CIRC_POS 1U
+#define DMA_CSR1_CIRC_MSK BIT(DMA_CSR1_CIRC_POS)
+
+#define DMA_CSR1_CHEN_POS 0U
+#define DMA_CSR1_CHEN_MSK BIT(DMA_CSR1_CHEN_POS)
+
+/****************** Bit definition for DMA_SAR1 register ************************/
+
+#define DMA_SAR1_SAR_POSS 0U
+#define DMA_SAR1_SAR_POSE 31U
+#define DMA_SAR1_SAR_MSK BITS(DMA_SAR1_SAR_POSS,DMA_SAR1_SAR_POSE)
+
+/****************** Bit definition for DMA_DAR1 register ************************/
+
+#define DMA_DAR1_DAR_POSS 0U
+#define DMA_DAR1_DAR_POSE 31U
+#define DMA_DAR1_DAR_MSK BITS(DMA_DAR1_DAR_POSS,DMA_DAR1_DAR_POSE)
+
+/****************** Bit definition for DMA_BCR1 register ************************/
+
+#define DMA_BCR1_CBCR_POSS 16U
+#define DMA_BCR1_CBCR_POSE 31U
+#define DMA_BCR1_CBCR_MSK BITS(DMA_BCR1_CBCR_POSS,DMA_BCR1_CBCR_POSE)
+
+#define DMA_BCR1_BCR_POSS 0U
+#define DMA_BCR1_BCR_POSE 15U
+#define DMA_BCR1_BCR_MSK BITS(DMA_BCR1_BCR_POSS,DMA_BCR1_BCR_POSE)
+
+/****************** Bit definition for DMA_CSR2 register ************************/
+
+#define DMA_CSR2_DINCOS_POS 30U
+#define DMA_CSR2_DINCOS_MSK BIT(DMA_CSR2_DINCOS_POS)
+
+#define DMA_CSR2_DBUSEL_POSS 27U
+#define DMA_CSR2_DBUSEL_POSE 29U
+#define DMA_CSR2_DBUSEL_MSK BITS(DMA_CSR2_DBUSEL_POSS,DMA_CSR2_DBUSEL_POSE)
+
+#define DMA_CSR2_DDWSEL_POSS 25U
+#define DMA_CSR2_DDWSEL_POSE 26U
+#define DMA_CSR2_DDWSEL_MSK BITS(DMA_CSR2_DDWSEL_POSS,DMA_CSR2_DDWSEL_POSE)
+
+#define DMA_CSR2_DINC_POS 24U
+#define DMA_CSR2_DINC_MSK BIT(DMA_CSR2_DINC_POS)
+
+#define DMA_CSR2_SINCOS_POS 22U
+#define DMA_CSR2_SINCOS_MSK BIT(DMA_CSR2_SINCOS_POS)
+
+#define DMA_CSR2_SBUSEL_POSS 19U
+#define DMA_CSR2_SBUSEL_POSE 21U
+#define DMA_CSR2_SBUSEL_MSK BITS(DMA_CSR2_SBUSEL_POSS,DMA_CSR2_SBUSEL_POSE)
+
+#define DMA_CSR2_SDWSEL_POSS 17U
+#define DMA_CSR2_SDWSEL_POSE 18U
+#define DMA_CSR2_SDWSEL_MSK BITS(DMA_CSR2_SDWSEL_POSS,DMA_CSR2_SDWSEL_POSE)
+
+#define DMA_CSR2_SINC_POS 16U
+#define DMA_CSR2_SINC_MSK BIT(DMA_CSR2_SINC_POS)
+
+#define DMA_CSR2_PHSS_POSS 9U
+#define DMA_CSR2_PHSS_POSE 15U
+#define DMA_CSR2_PHSS_MSK BITS(DMA_CSR2_PHSS_POSS,DMA_CSR2_PHSS_POSE)
+
+#define DMA_CSR2_CHPRI_POSS 6U
+#define DMA_CSR2_CHPRI_POSE 8U
+#define DMA_CSR2_CHPRI_MSK BITS(DMA_CSR2_CHPRI_POSS,DMA_CSR2_CHPRI_POSE)
+
+#define DMA_CSR2_MODESEL_POSS 4U
+#define DMA_CSR2_MODESEL_POSE 5U
+#define DMA_CSR2_MODESEL_MSK BITS(DMA_CSR2_MODESEL_POSS,DMA_CSR2_MODESEL_POSE)
+
+#define DMA_CSR2_DIRMDEN_POS 3U
+#define DMA_CSR2_DIRMDEN_MSK BIT(DMA_CSR2_DIRMDEN_POS)
+
+#define DMA_CSR2_PFCTRL_POS 2U
+#define DMA_CSR2_PFCTRL_MSK BIT(DMA_CSR2_PFCTRL_POS)
+
+#define DMA_CSR2_CIRC_POS 1U
+#define DMA_CSR2_CIRC_MSK BIT(DMA_CSR2_CIRC_POS)
+
+#define DMA_CSR2_CHEN_POS 0U
+#define DMA_CSR2_CHEN_MSK BIT(DMA_CSR2_CHEN_POS)
+
+/****************** Bit definition for DMA_SAR2 register ************************/
+
+#define DMA_SAR2_SAR_POSS 0U
+#define DMA_SAR2_SAR_POSE 31U
+#define DMA_SAR2_SAR_MSK BITS(DMA_SAR2_SAR_POSS,DMA_SAR2_SAR_POSE)
+
+/****************** Bit definition for DMA_DAR2 register ************************/
+
+#define DMA_DAR2_DAR_POSS 0U
+#define DMA_DAR2_DAR_POSE 31U
+#define DMA_DAR2_DAR_MSK BITS(DMA_DAR2_DAR_POSS,DMA_DAR2_DAR_POSE)
+
+/****************** Bit definition for DMA_BCR2 register ************************/
+
+#define DMA_BCR2_CBCR_POSS 16U
+#define DMA_BCR2_CBCR_POSE 31U
+#define DMA_BCR2_CBCR_MSK BITS(DMA_BCR2_CBCR_POSS,DMA_BCR2_CBCR_POSE)
+
+#define DMA_BCR2_BCR_POSS 0U
+#define DMA_BCR2_BCR_POSE 15U
+#define DMA_BCR2_BCR_MSK BITS(DMA_BCR2_BCR_POSS,DMA_BCR2_BCR_POSE)
+
+/****************** Bit definition for DMA_CSR3 register ************************/
+
+#define DMA_CSR3_DINCOS_POS 30U
+#define DMA_CSR3_DINCOS_MSK BIT(DMA_CSR3_DINCOS_POS)
+
+#define DMA_CSR3_DBUSEL_POSS 27U
+#define DMA_CSR3_DBUSEL_POSE 29U
+#define DMA_CSR3_DBUSEL_MSK BITS(DMA_CSR3_DBUSEL_POSS,DMA_CSR3_DBUSEL_POSE)
+
+#define DMA_CSR3_DDWSEL_POSS 25U
+#define DMA_CSR3_DDWSEL_POSE 26U
+#define DMA_CSR3_DDWSEL_MSK BITS(DMA_CSR3_DDWSEL_POSS,DMA_CSR3_DDWSEL_POSE)
+
+#define DMA_CSR3_DINC_POS 24U
+#define DMA_CSR3_DINC_MSK BIT(DMA_CSR3_DINC_POS)
+
+#define DMA_CSR3_SINCOS_POS 22U
+#define DMA_CSR3_SINCOS_MSK BIT(DMA_CSR3_SINCOS_POS)
+
+#define DMA_CSR3_SBUSEL_POSS 19U
+#define DMA_CSR3_SBUSEL_POSE 21U
+#define DMA_CSR3_SBUSEL_MSK BITS(DMA_CSR3_SBUSEL_POSS,DMA_CSR3_SBUSEL_POSE)
+
+#define DMA_CSR3_SDWSEL_POSS 17U
+#define DMA_CSR3_SDWSEL_POSE 18U
+#define DMA_CSR3_SDWSEL_MSK BITS(DMA_CSR3_SDWSEL_POSS,DMA_CSR3_SDWSEL_POSE)
+
+#define DMA_CSR3_SINC_POS 16U
+#define DMA_CSR3_SINC_MSK BIT(DMA_CSR3_SINC_POS)
+
+#define DMA_CSR3_PHSS_POSS 9U
+#define DMA_CSR3_PHSS_POSE 15U
+#define DMA_CSR3_PHSS_MSK BITS(DMA_CSR3_PHSS_POSS,DMA_CSR3_PHSS_POSE)
+
+#define DMA_CSR3_CHPRI_POSS 6U
+#define DMA_CSR3_CHPRI_POSE 8U
+#define DMA_CSR3_CHPRI_MSK BITS(DMA_CSR3_CHPRI_POSS,DMA_CSR3_CHPRI_POSE)
+
+#define DMA_CSR3_MODESEL_POSS 4U
+#define DMA_CSR3_MODESEL_POSE 5U
+#define DMA_CSR3_MODESEL_MSK BITS(DMA_CSR3_MODESEL_POSS,DMA_CSR3_MODESEL_POSE)
+
+#define DMA_CSR3_DIRMDEN_POS 3U
+#define DMA_CSR3_DIRMDEN_MSK BIT(DMA_CSR3_DIRMDEN_POS)
+
+#define DMA_CSR3_PFCTRL_POS 2U
+#define DMA_CSR3_PFCTRL_MSK BIT(DMA_CSR3_PFCTRL_POS)
+
+#define DMA_CSR3_CIRC_POS 1U
+#define DMA_CSR3_CIRC_MSK BIT(DMA_CSR3_CIRC_POS)
+
+#define DMA_CSR3_CHEN_POS 0U
+#define DMA_CSR3_CHEN_MSK BIT(DMA_CSR3_CHEN_POS)
+
+/****************** Bit definition for DMA_SAR3 register ************************/
+
+#define DMA_SAR3_SAR_POSS 0U
+#define DMA_SAR3_SAR_POSE 31U
+#define DMA_SAR3_SAR_MSK BITS(DMA_SAR3_SAR_POSS,DMA_SAR3_SAR_POSE)
+
+/****************** Bit definition for DMA_DAR3 register ************************/
+
+#define DMA_DAR3_DAR_POSS 0U
+#define DMA_DAR3_DAR_POSE 31U
+#define DMA_DAR3_DAR_MSK BITS(DMA_DAR3_DAR_POSS,DMA_DAR3_DAR_POSE)
+
+/****************** Bit definition for DMA_BCR3 register ************************/
+
+#define DMA_BCR3_CBCR_POSS 16U
+#define DMA_BCR3_CBCR_POSE 31U
+#define DMA_BCR3_CBCR_MSK BITS(DMA_BCR3_CBCR_POSS,DMA_BCR3_CBCR_POSE)
+
+#define DMA_BCR3_BCR_POSS 0U
+#define DMA_BCR3_BCR_POSE 15U
+#define DMA_BCR3_BCR_MSK BITS(DMA_BCR3_BCR_POSS,DMA_BCR3_BCR_POSE)
+
+/****************** Bit definition for DMA_CSR4 register ************************/
+
+#define DMA_CSR4_DINCOS_POS 30U
+#define DMA_CSR4_DINCOS_MSK BIT(DMA_CSR4_DINCOS_POS)
+
+#define DMA_CSR4_DBUSEL_POSS 27U
+#define DMA_CSR4_DBUSEL_POSE 29U
+#define DMA_CSR4_DBUSEL_MSK BITS(DMA_CSR4_DBUSEL_POSS,DMA_CSR4_DBUSEL_POSE)
+
+#define DMA_CSR4_DDWSEL_POSS 25U
+#define DMA_CSR4_DDWSEL_POSE 26U
+#define DMA_CSR4_DDWSEL_MSK BITS(DMA_CSR4_DDWSEL_POSS,DMA_CSR4_DDWSEL_POSE)
+
+#define DMA_CSR4_DINC_POS 24U
+#define DMA_CSR4_DINC_MSK BIT(DMA_CSR4_DINC_POS)
+
+#define DMA_CSR4_SINCOS_POS 22U
+#define DMA_CSR4_SINCOS_MSK BIT(DMA_CSR4_SINCOS_POS)
+
+#define DMA_CSR4_SBUSEL_POSS 19U
+#define DMA_CSR4_SBUSEL_POSE 21U
+#define DMA_CSR4_SBUSEL_MSK BITS(DMA_CSR4_SBUSEL_POSS,DMA_CSR4_SBUSEL_POSE)
+
+#define DMA_CSR4_SDWSEL_POSS 17U
+#define DMA_CSR4_SDWSEL_POSE 18U
+#define DMA_CSR4_SDWSEL_MSK BITS(DMA_CSR4_SDWSEL_POSS,DMA_CSR4_SDWSEL_POSE)
+
+#define DMA_CSR4_SINC_POS 16U
+#define DMA_CSR4_SINC_MSK BIT(DMA_CSR4_SINC_POS)
+
+#define DMA_CSR4_PHSS_POSS 9U
+#define DMA_CSR4_PHSS_POSE 15U
+#define DMA_CSR4_PHSS_MSK BITS(DMA_CSR4_PHSS_POSS,DMA_CSR4_PHSS_POSE)
+
+#define DMA_CSR4_CHPRI_POSS 6U
+#define DMA_CSR4_CHPRI_POSE 8U
+#define DMA_CSR4_CHPRI_MSK BITS(DMA_CSR4_CHPRI_POSS,DMA_CSR4_CHPRI_POSE)
+
+#define DMA_CSR4_MODESEL_POSS 4U
+#define DMA_CSR4_MODESEL_POSE 5U
+#define DMA_CSR4_MODESEL_MSK BITS(DMA_CSR4_MODESEL_POSS,DMA_CSR4_MODESEL_POSE)
+
+#define DMA_CSR4_DIRMDEN_POS 3U
+#define DMA_CSR4_DIRMDEN_MSK BIT(DMA_CSR4_DIRMDEN_POS)
+
+#define DMA_CSR4_PFCTRL_POS 2U
+#define DMA_CSR4_PFCTRL_MSK BIT(DMA_CSR4_PFCTRL_POS)
+
+#define DMA_CSR4_CIRC_POS 1U
+#define DMA_CSR4_CIRC_MSK BIT(DMA_CSR4_CIRC_POS)
+
+#define DMA_CSR4_CHEN_POS 0U
+#define DMA_CSR4_CHEN_MSK BIT(DMA_CSR4_CHEN_POS)
+
+/****************** Bit definition for DMA_SAR4 register ************************/
+
+#define DMA_SAR4_SAR_POSS 0U
+#define DMA_SAR4_SAR_POSE 31U
+#define DMA_SAR4_SAR_MSK BITS(DMA_SAR4_SAR_POSS,DMA_SAR4_SAR_POSE)
+
+/****************** Bit definition for DMA_DAR4 register ************************/
+
+#define DMA_DAR4_DAR_POSS 0U
+#define DMA_DAR4_DAR_POSE 31U
+#define DMA_DAR4_DAR_MSK BITS(DMA_DAR4_DAR_POSS,DMA_DAR4_DAR_POSE)
+
+/****************** Bit definition for DMA_BCR4 register ************************/
+
+#define DMA_BCR4_CBCR_POSS 16U
+#define DMA_BCR4_CBCR_POSE 31U
+#define DMA_BCR4_CBCR_MSK BITS(DMA_BCR4_CBCR_POSS,DMA_BCR4_CBCR_POSE)
+
+#define DMA_BCR4_BCR_POSS 0U
+#define DMA_BCR4_BCR_POSE 15U
+#define DMA_BCR4_BCR_MSK BITS(DMA_BCR4_BCR_POSS,DMA_BCR4_BCR_POSE)
+
+/****************** Bit definition for DMA_CSR5 register ************************/
+
+#define DMA_CSR5_DINCOS_POS 30U
+#define DMA_CSR5_DINCOS_MSK BIT(DMA_CSR5_DINCOS_POS)
+
+#define DMA_CSR5_DBUSEL_POSS 27U
+#define DMA_CSR5_DBUSEL_POSE 29U
+#define DMA_CSR5_DBUSEL_MSK BITS(DMA_CSR5_DBUSEL_POSS,DMA_CSR5_DBUSEL_POSE)
+
+#define DMA_CSR5_DDWSEL_POSS 25U
+#define DMA_CSR5_DDWSEL_POSE 26U
+#define DMA_CSR5_DDWSEL_MSK BITS(DMA_CSR5_DDWSEL_POSS,DMA_CSR5_DDWSEL_POSE)
+
+#define DMA_CSR5_DINC_POS 24U
+#define DMA_CSR5_DINC_MSK BIT(DMA_CSR5_DINC_POS)
+
+#define DMA_CSR5_SINCOS_POS 22U
+#define DMA_CSR5_SINCOS_MSK BIT(DMA_CSR5_SINCOS_POS)
+
+#define DMA_CSR5_SBUSEL_POSS 19U
+#define DMA_CSR5_SBUSEL_POSE 21U
+#define DMA_CSR5_SBUSEL_MSK BITS(DMA_CSR5_SBUSEL_POSS,DMA_CSR5_SBUSEL_POSE)
+
+#define DMA_CSR5_SDWSEL_POSS 17U
+#define DMA_CSR5_SDWSEL_POSE 18U
+#define DMA_CSR5_SDWSEL_MSK BITS(DMA_CSR5_SDWSEL_POSS,DMA_CSR5_SDWSEL_POSE)
+
+#define DMA_CSR5_SINC_POS 16U
+#define DMA_CSR5_SINC_MSK BIT(DMA_CSR5_SINC_POS)
+
+#define DMA_CSR5_PHSS_POSS 9U
+#define DMA_CSR5_PHSS_POSE 15U
+#define DMA_CSR5_PHSS_MSK BITS(DMA_CSR5_PHSS_POSS,DMA_CSR5_PHSS_POSE)
+
+#define DMA_CSR5_CHPRI_POSS 6U
+#define DMA_CSR5_CHPRI_POSE 8U
+#define DMA_CSR5_CHPRI_MSK BITS(DMA_CSR5_CHPRI_POSS,DMA_CSR5_CHPRI_POSE)
+
+#define DMA_CSR5_MODESEL_POSS 4U
+#define DMA_CSR5_MODESEL_POSE 5U
+#define DMA_CSR5_MODESEL_MSK BITS(DMA_CSR5_MODESEL_POSS,DMA_CSR5_MODESEL_POSE)
+
+#define DMA_CSR5_DIRMDEN_POS 3U
+#define DMA_CSR5_DIRMDEN_MSK BIT(DMA_CSR5_DIRMDEN_POS)
+
+#define DMA_CSR5_PFCTRL_POS 2U
+#define DMA_CSR5_PFCTRL_MSK BIT(DMA_CSR5_PFCTRL_POS)
+
+#define DMA_CSR5_CIRC_POS 1U
+#define DMA_CSR5_CIRC_MSK BIT(DMA_CSR5_CIRC_POS)
+
+#define DMA_CSR5_CHEN_POS 0U
+#define DMA_CSR5_CHEN_MSK BIT(DMA_CSR5_CHEN_POS)
+
+/****************** Bit definition for DMA_SAR5 register ************************/
+
+#define DMA_SAR5_SAR_POSS 0U
+#define DMA_SAR5_SAR_POSE 31U
+#define DMA_SAR5_SAR_MSK BITS(DMA_SAR5_SAR_POSS,DMA_SAR5_SAR_POSE)
+
+/****************** Bit definition for DMA_DAR5 register ************************/
+
+#define DMA_DAR5_DAR_POSS 0U
+#define DMA_DAR5_DAR_POSE 31U
+#define DMA_DAR5_DAR_MSK BITS(DMA_DAR5_DAR_POSS,DMA_DAR5_DAR_POSE)
+
+/****************** Bit definition for DMA_BCR5 register ************************/
+
+#define DMA_BCR5_CBCR_POSS 16U
+#define DMA_BCR5_CBCR_POSE 31U
+#define DMA_BCR5_CBCR_MSK BITS(DMA_BCR5_CBCR_POSS,DMA_BCR5_CBCR_POSE)
+
+#define DMA_BCR5_BCR_POSS 0U
+#define DMA_BCR5_BCR_POSE 15U
+#define DMA_BCR5_BCR_MSK BITS(DMA_BCR5_BCR_POSS,DMA_BCR5_BCR_POSE)
+
+typedef struct
+{
+ __O uint32_t IER;
+ __O uint32_t IDR;
+ __I uint32_t IVS;
+ __I uint32_t RIF;
+ __I uint32_t IFM;
+ __O uint32_t ICR;
+ __I uint32_t EMSG;
+ uint32_t RESERVED0 ;
+ __IO uint32_t CSR0;
+ __IO uint32_t SAR0;
+ __IO uint32_t DAR0;
+ __IO uint32_t BCR0;
+ __IO uint32_t CSR1;
+ __IO uint32_t SAR1;
+ __IO uint32_t DAR1;
+ __IO uint32_t BCR1;
+ __IO uint32_t CSR2;
+ __IO uint32_t SAR2;
+ __IO uint32_t DAR2;
+ __IO uint32_t BCR2;
+ __IO uint32_t CSR3;
+ __IO uint32_t SAR3;
+ __IO uint32_t DAR3;
+ __IO uint32_t BCR3;
+ __IO uint32_t CSR4;
+ __IO uint32_t SAR4;
+ __IO uint32_t DAR4;
+ __IO uint32_t BCR4;
+ __IO uint32_t CSR5;
+ __IO uint32_t SAR5;
+ __IO uint32_t DAR5;
+ __IO uint32_t BCR5;
+} DMA_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_exti.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_exti.h
new file mode 100644
index 0000000000000000000000000000000000000000..92a82288896dd5704158831876e5bb2329851e2c
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_exti.h
@@ -0,0 +1,809 @@
+/**
+ **************************************************************************************
+ * @file REG_EXTI.h
+ * @brief EXTI Head File
+ *
+ * @version V0.01
+ * @data 12/3/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __EXTI_H__
+#define __EXTI_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for EXTI_IER register ************************/
+
+#define EXTI_IER_WAKEUP_POS 21U
+#define EXTI_IER_WAKEUP_MSK BIT(EXTI_IER_WAKEUP_POS)
+
+#define EXTI_IER_PVD0_POS 20U
+#define EXTI_IER_PVD0_MSK BIT(EXTI_IER_PVD0_POS)
+
+#define EXTI_IER_CMP2_POS 17U
+#define EXTI_IER_CMP2_MSK BIT(EXTI_IER_CMP2_POS)
+
+#define EXTI_IER_CMP1_POS 16U
+#define EXTI_IER_CMP1_MSK BIT(EXTI_IER_CMP1_POS)
+
+#define EXTI_IER_GPIO15_POS 15U
+#define EXTI_IER_GPIO15_MSK BIT(EXTI_IER_GPIO15_POS)
+
+#define EXTI_IER_GPIO14_POS 14U
+#define EXTI_IER_GPIO14_MSK BIT(EXTI_IER_GPIO14_POS)
+
+#define EXTI_IER_GPIO13_POS 13U
+#define EXTI_IER_GPIO13_MSK BIT(EXTI_IER_GPIO13_POS)
+
+#define EXTI_IER_GPIO12_POS 12U
+#define EXTI_IER_GPIO12_MSK BIT(EXTI_IER_GPIO12_POS)
+
+#define EXTI_IER_GPIO11_POS 11U
+#define EXTI_IER_GPIO11_MSK BIT(EXTI_IER_GPIO11_POS)
+
+#define EXTI_IER_GPIO10_POS 10U
+#define EXTI_IER_GPIO10_MSK BIT(EXTI_IER_GPIO10_POS)
+
+#define EXTI_IER_GPIO9_POS 9U
+#define EXTI_IER_GPIO9_MSK BIT(EXTI_IER_GPIO9_POS)
+
+#define EXTI_IER_GPIO8_POS 8U
+#define EXTI_IER_GPIO8_MSK BIT(EXTI_IER_GPIO8_POS)
+
+#define EXTI_IER_GPIO7_POS 7U
+#define EXTI_IER_GPIO7_MSK BIT(EXTI_IER_GPIO7_POS)
+
+#define EXTI_IER_GPIO6_POS 6U
+#define EXTI_IER_GPIO6_MSK BIT(EXTI_IER_GPIO6_POS)
+
+#define EXTI_IER_GPIO5_POS 5U
+#define EXTI_IER_GPIO5_MSK BIT(EXTI_IER_GPIO5_POS)
+
+#define EXTI_IER_GPIO4_POS 4U
+#define EXTI_IER_GPIO4_MSK BIT(EXTI_IER_GPIO4_POS)
+
+#define EXTI_IER_GPIO3_POS 3U
+#define EXTI_IER_GPIO3_MSK BIT(EXTI_IER_GPIO3_POS)
+
+#define EXTI_IER_GPIO2_POS 2U
+#define EXTI_IER_GPIO2_MSK BIT(EXTI_IER_GPIO2_POS)
+
+#define EXTI_IER_GPIO1_POS 1U
+#define EXTI_IER_GPIO1_MSK BIT(EXTI_IER_GPIO1_POS)
+
+#define EXTI_IER_GPIO0_POS 0U
+#define EXTI_IER_GPIO0_MSK BIT(EXTI_IER_GPIO0_POS)
+
+/****************** Bit definition for EXTI_IDR register ************************/
+
+#define EXTI_IDR_WAKEUP_POS 21U
+#define EXTI_IDR_WAKEUP_MSK BIT(EXTI_IDR_WAKEUP_POS)
+
+#define EXTI_IDR_PVD0_POS 20U
+#define EXTI_IDR_PVD0_MSK BIT(EXTI_IDR_PVD0_POS)
+
+#define EXTI_IDR_CMP2_POS 17U
+#define EXTI_IDR_CMP2_MSK BIT(EXTI_IDR_CMP2_POS)
+
+#define EXTI_IDR_CMP1_POS 16U
+#define EXTI_IDR_CMP1_MSK BIT(EXTI_IDR_CMP1_POS)
+
+#define EXTI_IDR_GPIO15_POS 15U
+#define EXTI_IDR_GPIO15_MSK BIT(EXTI_IDR_GPIO15_POS)
+
+#define EXTI_IDR_GPIO14_POS 14U
+#define EXTI_IDR_GPIO14_MSK BIT(EXTI_IDR_GPIO14_POS)
+
+#define EXTI_IDR_GPIO13_POS 13U
+#define EXTI_IDR_GPIO13_MSK BIT(EXTI_IDR_GPIO13_POS)
+
+#define EXTI_IDR_GPIO12_POS 12U
+#define EXTI_IDR_GPIO12_MSK BIT(EXTI_IDR_GPIO12_POS)
+
+#define EXTI_IDR_GPIO11_POS 11U
+#define EXTI_IDR_GPIO11_MSK BIT(EXTI_IDR_GPIO11_POS)
+
+#define EXTI_IDR_GPIO10_POS 10U
+#define EXTI_IDR_GPIO10_MSK BIT(EXTI_IDR_GPIO10_POS)
+
+#define EXTI_IDR_GPIO9_POS 9U
+#define EXTI_IDR_GPIO9_MSK BIT(EXTI_IDR_GPIO9_POS)
+
+#define EXTI_IDR_GPIO8_POS 8U
+#define EXTI_IDR_GPIO8_MSK BIT(EXTI_IDR_GPIO8_POS)
+
+#define EXTI_IDR_GPIO7_POS 7U
+#define EXTI_IDR_GPIO7_MSK BIT(EXTI_IDR_GPIO7_POS)
+
+#define EXTI_IDR_GPIO6_POS 6U
+#define EXTI_IDR_GPIO6_MSK BIT(EXTI_IDR_GPIO6_POS)
+
+#define EXTI_IDR_GPIO5_POS 5U
+#define EXTI_IDR_GPIO5_MSK BIT(EXTI_IDR_GPIO5_POS)
+
+#define EXTI_IDR_GPIO4_POS 4U
+#define EXTI_IDR_GPIO4_MSK BIT(EXTI_IDR_GPIO4_POS)
+
+#define EXTI_IDR_GPIO3_POS 3U
+#define EXTI_IDR_GPIO3_MSK BIT(EXTI_IDR_GPIO3_POS)
+
+#define EXTI_IDR_GPIO2_POS 2U
+#define EXTI_IDR_GPIO2_MSK BIT(EXTI_IDR_GPIO2_POS)
+
+#define EXTI_IDR_GPIO1_POS 1U
+#define EXTI_IDR_GPIO1_MSK BIT(EXTI_IDR_GPIO1_POS)
+
+#define EXTI_IDR_GPIO0_POS 0U
+#define EXTI_IDR_GPIO0_MSK BIT(EXTI_IDR_GPIO0_POS)
+
+/****************** Bit definition for EXTI_IVS register ************************/
+
+#define EXTI_IVS_WAKEUP_POS 21U
+#define EXTI_IVS_WAKEUP_MSK BIT(EXTI_IVS_WAKEUP_POS)
+
+#define EXTI_IVS_PVD0_POS 20U
+#define EXTI_IVS_PVD0_MSK BIT(EXTI_IVS_PVD0_POS)
+
+#define EXTI_IVS_CMP2_POS 17U
+#define EXTI_IVS_CMP2_MSK BIT(EXTI_IVS_CMP2_POS)
+
+#define EXTI_IVS_CMP1_POS 16U
+#define EXTI_IVS_CMP1_MSK BIT(EXTI_IVS_CMP1_POS)
+
+#define EXTI_IVS_GPIO15_POS 15U
+#define EXTI_IVS_GPIO15_MSK BIT(EXTI_IVS_GPIO15_POS)
+
+#define EXTI_IVS_GPIO14_POS 14U
+#define EXTI_IVS_GPIO14_MSK BIT(EXTI_IVS_GPIO14_POS)
+
+#define EXTI_IVS_GPIO13_POS 13U
+#define EXTI_IVS_GPIO13_MSK BIT(EXTI_IVS_GPIO13_POS)
+
+#define EXTI_IVS_GPIO12_POS 12U
+#define EXTI_IVS_GPIO12_MSK BIT(EXTI_IVS_GPIO12_POS)
+
+#define EXTI_IVS_GPIO11_POS 11U
+#define EXTI_IVS_GPIO11_MSK BIT(EXTI_IVS_GPIO11_POS)
+
+#define EXTI_IVS_GPIO10_POS 10U
+#define EXTI_IVS_GPIO10_MSK BIT(EXTI_IVS_GPIO10_POS)
+
+#define EXTI_IVS_GPIO9_POS 9U
+#define EXTI_IVS_GPIO9_MSK BIT(EXTI_IVS_GPIO9_POS)
+
+#define EXTI_IVS_GPIO8_POS 8U
+#define EXTI_IVS_GPIO8_MSK BIT(EXTI_IVS_GPIO8_POS)
+
+#define EXTI_IVS_GPIO7_POS 7U
+#define EXTI_IVS_GPIO7_MSK BIT(EXTI_IVS_GPIO7_POS)
+
+#define EXTI_IVS_GPIO6_POS 6U
+#define EXTI_IVS_GPIO6_MSK BIT(EXTI_IVS_GPIO6_POS)
+
+#define EXTI_IVS_GPIO5_POS 5U
+#define EXTI_IVS_GPIO5_MSK BIT(EXTI_IVS_GPIO5_POS)
+
+#define EXTI_IVS_GPIO4_POS 4U
+#define EXTI_IVS_GPIO4_MSK BIT(EXTI_IVS_GPIO4_POS)
+
+#define EXTI_IVS_GPIO3_POS 3U
+#define EXTI_IVS_GPIO3_MSK BIT(EXTI_IVS_GPIO3_POS)
+
+#define EXTI_IVS_GPIO2_POS 2U
+#define EXTI_IVS_GPIO2_MSK BIT(EXTI_IVS_GPIO2_POS)
+
+#define EXTI_IVS_GPIO1_POS 1U
+#define EXTI_IVS_GPIO1_MSK BIT(EXTI_IVS_GPIO1_POS)
+
+#define EXTI_IVS_GPIO0_POS 0U
+#define EXTI_IVS_GPIO0_MSK BIT(EXTI_IVS_GPIO0_POS)
+
+/****************** Bit definition for EXTI_RIF register ************************/
+
+#define EXTI_RIF_WAKEUP_POS 21U
+#define EXTI_RIF_WAKEUP_MSK BIT(EXTI_RIF_WAKEUP_POS)
+
+#define EXTI_RIF_PVD0_POS 20U
+#define EXTI_RIF_PVD0_MSK BIT(EXTI_RIF_PVD0_POS)
+
+#define EXTI_RIF_CMP2_POS 17U
+#define EXTI_RIF_CMP2_MSK BIT(EXTI_RIF_CMP2_POS)
+
+#define EXTI_RIF_CMP1_POS 16U
+#define EXTI_RIF_CMP1_MSK BIT(EXTI_RIF_CMP1_POS)
+
+#define EXTI_RIF_GPIO15_POS 15U
+#define EXTI_RIF_GPIO15_MSK BIT(EXTI_RIF_GPIO15_POS)
+
+#define EXTI_RIF_GPIO14_POS 14U
+#define EXTI_RIF_GPIO14_MSK BIT(EXTI_RIF_GPIO14_POS)
+
+#define EXTI_RIF_GPIO13_POS 13U
+#define EXTI_RIF_GPIO13_MSK BIT(EXTI_RIF_GPIO13_POS)
+
+#define EXTI_RIF_GPIO12_POS 12U
+#define EXTI_RIF_GPIO12_MSK BIT(EXTI_RIF_GPIO12_POS)
+
+#define EXTI_RIF_GPIO11_POS 11U
+#define EXTI_RIF_GPIO11_MSK BIT(EXTI_RIF_GPIO11_POS)
+
+#define EXTI_RIF_GPIO10_POS 10U
+#define EXTI_RIF_GPIO10_MSK BIT(EXTI_RIF_GPIO10_POS)
+
+#define EXTI_RIF_GPIO9_POS 9U
+#define EXTI_RIF_GPIO9_MSK BIT(EXTI_RIF_GPIO9_POS)
+
+#define EXTI_RIF_GPIO8_POS 8U
+#define EXTI_RIF_GPIO8_MSK BIT(EXTI_RIF_GPIO8_POS)
+
+#define EXTI_RIF_GPIO7_POS 7U
+#define EXTI_RIF_GPIO7_MSK BIT(EXTI_RIF_GPIO7_POS)
+
+#define EXTI_RIF_GPIO6_POS 6U
+#define EXTI_RIF_GPIO6_MSK BIT(EXTI_RIF_GPIO6_POS)
+
+#define EXTI_RIF_GPIO5_POS 5U
+#define EXTI_RIF_GPIO5_MSK BIT(EXTI_RIF_GPIO5_POS)
+
+#define EXTI_RIF_GPIO4_POS 4U
+#define EXTI_RIF_GPIO4_MSK BIT(EXTI_RIF_GPIO4_POS)
+
+#define EXTI_RIF_GPIO3_POS 3U
+#define EXTI_RIF_GPIO3_MSK BIT(EXTI_RIF_GPIO3_POS)
+
+#define EXTI_RIF_GPIO2_POS 2U
+#define EXTI_RIF_GPIO2_MSK BIT(EXTI_RIF_GPIO2_POS)
+
+#define EXTI_RIF_GPIO1_POS 1U
+#define EXTI_RIF_GPIO1_MSK BIT(EXTI_RIF_GPIO1_POS)
+
+#define EXTI_RIF_GPIO0_POS 0U
+#define EXTI_RIF_GPIO0_MSK BIT(EXTI_RIF_GPIO0_POS)
+
+/****************** Bit definition for EXTI_IFM register ************************/
+
+#define EXTI_IFM_WAKEUP_POS 21U
+#define EXTI_IFM_WAKEUP_MSK BIT(EXTI_IFM_WAKEUP_POS)
+
+#define EXTI_IFM_PVD0_POS 20U
+#define EXTI_IFM_PVD0_MSK BIT(EXTI_IFM_PVD0_POS)
+
+#define EXTI_IFM_CMP2_POS 17U
+#define EXTI_IFM_CMP2_MSK BIT(EXTI_IFM_CMP2_POS)
+
+#define EXTI_IFM_CMP1_POS 16U
+#define EXTI_IFM_CMP1_MSK BIT(EXTI_IFM_CMP1_POS)
+
+#define EXTI_IFM_GPIO15_POS 15U
+#define EXTI_IFM_GPIO15_MSK BIT(EXTI_IFM_GPIO15_POS)
+
+#define EXTI_IFM_GPIO14_POS 14U
+#define EXTI_IFM_GPIO14_MSK BIT(EXTI_IFM_GPIO14_POS)
+
+#define EXTI_IFM_GPIO13_POS 13U
+#define EXTI_IFM_GPIO13_MSK BIT(EXTI_IFM_GPIO13_POS)
+
+#define EXTI_IFM_GPIO12_POS 12U
+#define EXTI_IFM_GPIO12_MSK BIT(EXTI_IFM_GPIO12_POS)
+
+#define EXTI_IFM_GPIO11_POS 11U
+#define EXTI_IFM_GPIO11_MSK BIT(EXTI_IFM_GPIO11_POS)
+
+#define EXTI_IFM_GPIO10_POS 10U
+#define EXTI_IFM_GPIO10_MSK BIT(EXTI_IFM_GPIO10_POS)
+
+#define EXTI_IFM_GPIO9_POS 9U
+#define EXTI_IFM_GPIO9_MSK BIT(EXTI_IFM_GPIO9_POS)
+
+#define EXTI_IFM_GPIO8_POS 8U
+#define EXTI_IFM_GPIO8_MSK BIT(EXTI_IFM_GPIO8_POS)
+
+#define EXTI_IFM_GPIO7_POS 7U
+#define EXTI_IFM_GPIO7_MSK BIT(EXTI_IFM_GPIO7_POS)
+
+#define EXTI_IFM_GPIO6_POS 6U
+#define EXTI_IFM_GPIO6_MSK BIT(EXTI_IFM_GPIO6_POS)
+
+#define EXTI_IFM_GPIO5_POS 5U
+#define EXTI_IFM_GPIO5_MSK BIT(EXTI_IFM_GPIO5_POS)
+
+#define EXTI_IFM_GPIO4_POS 4U
+#define EXTI_IFM_GPIO4_MSK BIT(EXTI_IFM_GPIO4_POS)
+
+#define EXTI_IFM_GPIO3_POS 3U
+#define EXTI_IFM_GPIO3_MSK BIT(EXTI_IFM_GPIO3_POS)
+
+#define EXTI_IFM_GPIO2_POS 2U
+#define EXTI_IFM_GPIO2_MSK BIT(EXTI_IFM_GPIO2_POS)
+
+#define EXTI_IFM_GPIO1_POS 1U
+#define EXTI_IFM_GPIO1_MSK BIT(EXTI_IFM_GPIO1_POS)
+
+#define EXTI_IFM_GPIO0_POS 0U
+#define EXTI_IFM_GPIO0_MSK BIT(EXTI_IFM_GPIO0_POS)
+
+/****************** Bit definition for EXTI_ICR register ************************/
+
+#define EXTI_ICR_WAKEUP_POS 21U
+#define EXTI_ICR_WAKEUP_MSK BIT(EXTI_ICR_WAKEUP_POS)
+
+#define EXTI_ICR_PVD0_POS 20U
+#define EXTI_ICR_PVD0_MSK BIT(EXTI_ICR_PVD0_POS)
+
+#define EXTI_ICR_CMP2_POS 17U
+#define EXTI_ICR_CMP2_MSK BIT(EXTI_ICR_CMP2_POS)
+
+#define EXTI_ICR_CMP1_POS 16U
+#define EXTI_ICR_CMP1_MSK BIT(EXTI_ICR_CMP1_POS)
+
+#define EXTI_ICR_GPIO15_POS 15U
+#define EXTI_ICR_GPIO15_MSK BIT(EXTI_ICR_GPIO15_POS)
+
+#define EXTI_ICR_GPIO14_POS 14U
+#define EXTI_ICR_GPIO14_MSK BIT(EXTI_ICR_GPIO14_POS)
+
+#define EXTI_ICR_GPIO13_POS 13U
+#define EXTI_ICR_GPIO13_MSK BIT(EXTI_ICR_GPIO13_POS)
+
+#define EXTI_ICR_GPIO12_POS 12U
+#define EXTI_ICR_GPIO12_MSK BIT(EXTI_ICR_GPIO12_POS)
+
+#define EXTI_ICR_GPIO11_POS 11U
+#define EXTI_ICR_GPIO11_MSK BIT(EXTI_ICR_GPIO11_POS)
+
+#define EXTI_ICR_GPIO10_POS 10U
+#define EXTI_ICR_GPIO10_MSK BIT(EXTI_ICR_GPIO10_POS)
+
+#define EXTI_ICR_GPIO9_POS 9U
+#define EXTI_ICR_GPIO9_MSK BIT(EXTI_ICR_GPIO9_POS)
+
+#define EXTI_ICR_GPIO8_POS 8U
+#define EXTI_ICR_GPIO8_MSK BIT(EXTI_ICR_GPIO8_POS)
+
+#define EXTI_ICR_GPIO7_POS 7U
+#define EXTI_ICR_GPIO7_MSK BIT(EXTI_ICR_GPIO7_POS)
+
+#define EXTI_ICR_GPIO6_POS 6U
+#define EXTI_ICR_GPIO6_MSK BIT(EXTI_ICR_GPIO6_POS)
+
+#define EXTI_ICR_GPIO5_POS 5U
+#define EXTI_ICR_GPIO5_MSK BIT(EXTI_ICR_GPIO5_POS)
+
+#define EXTI_ICR_GPIO4_POS 4U
+#define EXTI_ICR_GPIO4_MSK BIT(EXTI_ICR_GPIO4_POS)
+
+#define EXTI_ICR_GPIO3_POS 3U
+#define EXTI_ICR_GPIO3_MSK BIT(EXTI_ICR_GPIO3_POS)
+
+#define EXTI_ICR_GPIO2_POS 2U
+#define EXTI_ICR_GPIO2_MSK BIT(EXTI_ICR_GPIO2_POS)
+
+#define EXTI_ICR_GPIO1_POS 1U
+#define EXTI_ICR_GPIO1_MSK BIT(EXTI_ICR_GPIO1_POS)
+
+#define EXTI_ICR_GPIO0_POS 0U
+#define EXTI_ICR_GPIO0_MSK BIT(EXTI_ICR_GPIO0_POS)
+
+/****************** Bit definition for EXTI_RTS register ************************/
+
+#define EXTI_RTS_WAKEUP_POS 21U
+#define EXTI_RTS_WAKEUP_MSK BIT(EXTI_RTS_WAKEUP_POS)
+
+#define EXTI_RTS_PVD0_POS 20U
+#define EXTI_RTS_PVD0_MSK BIT(EXTI_RTS_PVD0_POS)
+
+#define EXTI_RTS_CMP2_POS 17U
+#define EXTI_RTS_CMP2_MSK BIT(EXTI_RTS_CMP2_POS)
+
+#define EXTI_RTS_CMP1_POS 16U
+#define EXTI_RTS_CMP1_MSK BIT(EXTI_RTS_CMP1_POS)
+
+#define EXTI_RTS_GPIO15_POS 15U
+#define EXTI_RTS_GPIO15_MSK BIT(EXTI_RTS_GPIO15_POS)
+
+#define EXTI_RTS_GPIO14_POS 14U
+#define EXTI_RTS_GPIO14_MSK BIT(EXTI_RTS_GPIO14_POS)
+
+#define EXTI_RTS_GPIO13_POS 13U
+#define EXTI_RTS_GPIO13_MSK BIT(EXTI_RTS_GPIO13_POS)
+
+#define EXTI_RTS_GPIO12_POS 12U
+#define EXTI_RTS_GPIO12_MSK BIT(EXTI_RTS_GPIO12_POS)
+
+#define EXTI_RTS_GPIO11_POS 11U
+#define EXTI_RTS_GPIO11_MSK BIT(EXTI_RTS_GPIO11_POS)
+
+#define EXTI_RTS_GPIO10_POS 10U
+#define EXTI_RTS_GPIO10_MSK BIT(EXTI_RTS_GPIO10_POS)
+
+#define EXTI_RTS_GPIO9_POS 9U
+#define EXTI_RTS_GPIO9_MSK BIT(EXTI_RTS_GPIO9_POS)
+
+#define EXTI_RTS_GPIO8_POS 8U
+#define EXTI_RTS_GPIO8_MSK BIT(EXTI_RTS_GPIO8_POS)
+
+#define EXTI_RTS_GPIO7_POS 7U
+#define EXTI_RTS_GPIO7_MSK BIT(EXTI_RTS_GPIO7_POS)
+
+#define EXTI_RTS_GPIO6_POS 6U
+#define EXTI_RTS_GPIO6_MSK BIT(EXTI_RTS_GPIO6_POS)
+
+#define EXTI_RTS_GPIO5_POS 5U
+#define EXTI_RTS_GPIO5_MSK BIT(EXTI_RTS_GPIO5_POS)
+
+#define EXTI_RTS_GPIO4_POS 4U
+#define EXTI_RTS_GPIO4_MSK BIT(EXTI_RTS_GPIO4_POS)
+
+#define EXTI_RTS_GPIO3_POS 3U
+#define EXTI_RTS_GPIO3_MSK BIT(EXTI_RTS_GPIO3_POS)
+
+#define EXTI_RTS_GPIO2_POS 2U
+#define EXTI_RTS_GPIO2_MSK BIT(EXTI_RTS_GPIO2_POS)
+
+#define EXTI_RTS_GPIO1_POS 1U
+#define EXTI_RTS_GPIO1_MSK BIT(EXTI_RTS_GPIO1_POS)
+
+#define EXTI_RTS_GPIO0_POS 0U
+#define EXTI_RTS_GPIO0_MSK BIT(EXTI_RTS_GPIO0_POS)
+
+/****************** Bit definition for EXTI_FTS register ************************/
+
+#define EXTI_FTS_WAKEUP_POS 21U
+#define EXTI_FTS_WAKEUP_MSK BIT(EXTI_FTS_WAKEUP_POS)
+
+#define EXTI_FTS_PVD0_POS 20U
+#define EXTI_FTS_PVD0_MSK BIT(EXTI_FTS_PVD0_POS)
+
+#define EXTI_FTS_CMP2_POS 17U
+#define EXTI_FTS_CMP2_MSK BIT(EXTI_FTS_CMP2_POS)
+
+#define EXTI_FTS_CMP1_POS 16U
+#define EXTI_FTS_CMP1_MSK BIT(EXTI_FTS_CMP1_POS)
+
+#define EXTI_FTS_GPIO15_POS 15U
+#define EXTI_FTS_GPIO15_MSK BIT(EXTI_FTS_GPIO15_POS)
+
+#define EXTI_FTS_GPIO14_POS 14U
+#define EXTI_FTS_GPIO14_MSK BIT(EXTI_FTS_GPIO14_POS)
+
+#define EXTI_FTS_GPIO13_POS 13U
+#define EXTI_FTS_GPIO13_MSK BIT(EXTI_FTS_GPIO13_POS)
+
+#define EXTI_FTS_GPIO12_POS 12U
+#define EXTI_FTS_GPIO12_MSK BIT(EXTI_FTS_GPIO12_POS)
+
+#define EXTI_FTS_GPIO11_POS 11U
+#define EXTI_FTS_GPIO11_MSK BIT(EXTI_FTS_GPIO11_POS)
+
+#define EXTI_FTS_GPIO10_POS 10U
+#define EXTI_FTS_GPIO10_MSK BIT(EXTI_FTS_GPIO10_POS)
+
+#define EXTI_FTS_GPIO9_POS 9U
+#define EXTI_FTS_GPIO9_MSK BIT(EXTI_FTS_GPIO9_POS)
+
+#define EXTI_FTS_GPIO8_POS 8U
+#define EXTI_FTS_GPIO8_MSK BIT(EXTI_FTS_GPIO8_POS)
+
+#define EXTI_FTS_GPIO7_POS 7U
+#define EXTI_FTS_GPIO7_MSK BIT(EXTI_FTS_GPIO7_POS)
+
+#define EXTI_FTS_GPIO6_POS 6U
+#define EXTI_FTS_GPIO6_MSK BIT(EXTI_FTS_GPIO6_POS)
+
+#define EXTI_FTS_GPIO5_POS 5U
+#define EXTI_FTS_GPIO5_MSK BIT(EXTI_FTS_GPIO5_POS)
+
+#define EXTI_FTS_GPIO4_POS 4U
+#define EXTI_FTS_GPIO4_MSK BIT(EXTI_FTS_GPIO4_POS)
+
+#define EXTI_FTS_GPIO3_POS 3U
+#define EXTI_FTS_GPIO3_MSK BIT(EXTI_FTS_GPIO3_POS)
+
+#define EXTI_FTS_GPIO2_POS 2U
+#define EXTI_FTS_GPIO2_MSK BIT(EXTI_FTS_GPIO2_POS)
+
+#define EXTI_FTS_GPIO1_POS 1U
+#define EXTI_FTS_GPIO1_MSK BIT(EXTI_FTS_GPIO1_POS)
+
+#define EXTI_FTS_GPIO0_POS 0U
+#define EXTI_FTS_GPIO0_MSK BIT(EXTI_FTS_GPIO0_POS)
+
+/****************** Bit definition for EXTI_SWI register ************************/
+
+#define EXTI_SWI_WAKEUP_POS 21U
+#define EXTI_SWI_WAKEUP_MSK BIT(EXTI_SWI_WAKEUP_POS)
+
+#define EXTI_SWI_PVD0_POS 20U
+#define EXTI_SWI_PVD0_MSK BIT(EXTI_SWI_PVD0_POS)
+
+#define EXTI_SWI_CMP2_POS 17U
+#define EXTI_SWI_CMP2_MSK BIT(EXTI_SWI_CMP2_POS)
+
+#define EXTI_SWI_CMP1_POS 16U
+#define EXTI_SWI_CMP1_MSK BIT(EXTI_SWI_CMP1_POS)
+
+#define EXTI_SWI_GPIO15_POS 15U
+#define EXTI_SWI_GPIO15_MSK BIT(EXTI_SWI_GPIO15_POS)
+
+#define EXTI_SWI_GPIO14_POS 14U
+#define EXTI_SWI_GPIO14_MSK BIT(EXTI_SWI_GPIO14_POS)
+
+#define EXTI_SWI_GPIO13_POS 13U
+#define EXTI_SWI_GPIO13_MSK BIT(EXTI_SWI_GPIO13_POS)
+
+#define EXTI_SWI_GPIO12_POS 12U
+#define EXTI_SWI_GPIO12_MSK BIT(EXTI_SWI_GPIO12_POS)
+
+#define EXTI_SWI_GPIO11_POS 11U
+#define EXTI_SWI_GPIO11_MSK BIT(EXTI_SWI_GPIO11_POS)
+
+#define EXTI_SWI_GPIO10_POS 10U
+#define EXTI_SWI_GPIO10_MSK BIT(EXTI_SWI_GPIO10_POS)
+
+#define EXTI_SWI_GPIO9_POS 9U
+#define EXTI_SWI_GPIO9_MSK BIT(EXTI_SWI_GPIO9_POS)
+
+#define EXTI_SWI_GPIO8_POS 8U
+#define EXTI_SWI_GPIO8_MSK BIT(EXTI_SWI_GPIO8_POS)
+
+#define EXTI_SWI_GPIO7_POS 7U
+#define EXTI_SWI_GPIO7_MSK BIT(EXTI_SWI_GPIO7_POS)
+
+#define EXTI_SWI_GPIO6_POS 6U
+#define EXTI_SWI_GPIO6_MSK BIT(EXTI_SWI_GPIO6_POS)
+
+#define EXTI_SWI_GPIO5_POS 5U
+#define EXTI_SWI_GPIO5_MSK BIT(EXTI_SWI_GPIO5_POS)
+
+#define EXTI_SWI_GPIO4_POS 4U
+#define EXTI_SWI_GPIO4_MSK BIT(EXTI_SWI_GPIO4_POS)
+
+#define EXTI_SWI_GPIO3_POS 3U
+#define EXTI_SWI_GPIO3_MSK BIT(EXTI_SWI_GPIO3_POS)
+
+#define EXTI_SWI_GPIO2_POS 2U
+#define EXTI_SWI_GPIO2_MSK BIT(EXTI_SWI_GPIO2_POS)
+
+#define EXTI_SWI_GPIO1_POS 1U
+#define EXTI_SWI_GPIO1_MSK BIT(EXTI_SWI_GPIO1_POS)
+
+#define EXTI_SWI_GPIO0_POS 0U
+#define EXTI_SWI_GPIO0_MSK BIT(EXTI_SWI_GPIO0_POS)
+
+/****************** Bit definition for EXTI_ADTE register ************************/
+
+#define EXTI_ADTE_WAKEUP_POS 21U
+#define EXTI_ADTE_WAKEUP_MSK BIT(EXTI_ADTE_WAKEUP_POS)
+
+#define EXTI_ADTE_PVD0_POS 20U
+#define EXTI_ADTE_PVD0_MSK BIT(EXTI_ADTE_PVD0_POS)
+
+#define EXTI_ADTE_CMP2_POS 17U
+#define EXTI_ADTE_CMP2_MSK BIT(EXTI_ADTE_CMP2_POS)
+
+#define EXTI_ADTE_CMP1_POS 16U
+#define EXTI_ADTE_CMP1_MSK BIT(EXTI_ADTE_CMP1_POS)
+
+#define EXTI_ADTE_GPIO15_POS 15U
+#define EXTI_ADTE_GPIO15_MSK BIT(EXTI_ADTE_GPIO15_POS)
+
+#define EXTI_ADTE_GPIO14_POS 14U
+#define EXTI_ADTE_GPIO14_MSK BIT(EXTI_ADTE_GPIO14_POS)
+
+#define EXTI_ADTE_GPIO13_POS 13U
+#define EXTI_ADTE_GPIO13_MSK BIT(EXTI_ADTE_GPIO13_POS)
+
+#define EXTI_ADTE_GPIO12_POS 12U
+#define EXTI_ADTE_GPIO12_MSK BIT(EXTI_ADTE_GPIO12_POS)
+
+#define EXTI_ADTE_GPIO11_POS 11U
+#define EXTI_ADTE_GPIO11_MSK BIT(EXTI_ADTE_GPIO11_POS)
+
+#define EXTI_ADTE_GPIO10_POS 10U
+#define EXTI_ADTE_GPIO10_MSK BIT(EXTI_ADTE_GPIO10_POS)
+
+#define EXTI_ADTE_GPIO9_POS 9U
+#define EXTI_ADTE_GPIO9_MSK BIT(EXTI_ADTE_GPIO9_POS)
+
+#define EXTI_ADTE_GPIO8_POS 8U
+#define EXTI_ADTE_GPIO8_MSK BIT(EXTI_ADTE_GPIO8_POS)
+
+#define EXTI_ADTE_GPIO7_POS 7U
+#define EXTI_ADTE_GPIO7_MSK BIT(EXTI_ADTE_GPIO7_POS)
+
+#define EXTI_ADTE_GPIO6_POS 6U
+#define EXTI_ADTE_GPIO6_MSK BIT(EXTI_ADTE_GPIO6_POS)
+
+#define EXTI_ADTE_GPIO5_POS 5U
+#define EXTI_ADTE_GPIO5_MSK BIT(EXTI_ADTE_GPIO5_POS)
+
+#define EXTI_ADTE_GPIO4_POS 4U
+#define EXTI_ADTE_GPIO4_MSK BIT(EXTI_ADTE_GPIO4_POS)
+
+#define EXTI_ADTE_GPIO3_POS 3U
+#define EXTI_ADTE_GPIO3_MSK BIT(EXTI_ADTE_GPIO3_POS)
+
+#define EXTI_ADTE_GPIO2_POS 2U
+#define EXTI_ADTE_GPIO2_MSK BIT(EXTI_ADTE_GPIO2_POS)
+
+#define EXTI_ADTE_GPIO1_POS 1U
+#define EXTI_ADTE_GPIO1_MSK BIT(EXTI_ADTE_GPIO1_POS)
+
+#define EXTI_ADTE_GPIO0_POS 0U
+#define EXTI_ADTE_GPIO0_MSK BIT(EXTI_ADTE_GPIO0_POS)
+
+/****************** Bit definition for EXTI_DB register ************************/
+
+#define EXTI_DB_WAKEUP_POS 21U
+#define EXTI_DB_WAKEUP_MSK BIT(EXTI_DB_WAKEUP_POS)
+
+#define EXTI_DB_PVD0_POS 20U
+#define EXTI_DB_PVD0_MSK BIT(EXTI_DB_PVD0_POS)
+
+#define EXTI_DB_CMP2_POS 17U
+#define EXTI_DB_CMP2_MSK BIT(EXTI_DB_CMP2_POS)
+
+#define EXTI_DB_CMP1_POS 16U
+#define EXTI_DB_CMP1_MSK BIT(EXTI_DB_CMP1_POS)
+
+#define EXTI_DB_GPIO15_POS 15U
+#define EXTI_DB_GPIO15_MSK BIT(EXTI_DB_GPIO15_POS)
+
+#define EXTI_DB_GPIO14_POS 14U
+#define EXTI_DB_GPIO14_MSK BIT(EXTI_DB_GPIO14_POS)
+
+#define EXTI_DB_GPIO13_POS 13U
+#define EXTI_DB_GPIO13_MSK BIT(EXTI_DB_GPIO13_POS)
+
+#define EXTI_DB_GPIO12_POS 12U
+#define EXTI_DB_GPIO12_MSK BIT(EXTI_DB_GPIO12_POS)
+
+#define EXTI_DB_GPIO11_POS 11U
+#define EXTI_DB_GPIO11_MSK BIT(EXTI_DB_GPIO11_POS)
+
+#define EXTI_DB_GPIO10_POS 10U
+#define EXTI_DB_GPIO10_MSK BIT(EXTI_DB_GPIO10_POS)
+
+#define EXTI_DB_GPIO9_POS 9U
+#define EXTI_DB_GPIO9_MSK BIT(EXTI_DB_GPIO9_POS)
+
+#define EXTI_DB_GPIO8_POS 8U
+#define EXTI_DB_GPIO8_MSK BIT(EXTI_DB_GPIO8_POS)
+
+#define EXTI_DB_GPIO7_POS 7U
+#define EXTI_DB_GPIO7_MSK BIT(EXTI_DB_GPIO7_POS)
+
+#define EXTI_DB_GPIO6_POS 6U
+#define EXTI_DB_GPIO6_MSK BIT(EXTI_DB_GPIO6_POS)
+
+#define EXTI_DB_GPIO5_POS 5U
+#define EXTI_DB_GPIO5_MSK BIT(EXTI_DB_GPIO5_POS)
+
+#define EXTI_DB_GPIO4_POS 4U
+#define EXTI_DB_GPIO4_MSK BIT(EXTI_DB_GPIO4_POS)
+
+#define EXTI_DB_GPIO3_POS 3U
+#define EXTI_DB_GPIO3_MSK BIT(EXTI_DB_GPIO3_POS)
+
+#define EXTI_DB_GPIO2_POS 2U
+#define EXTI_DB_GPIO2_MSK BIT(EXTI_DB_GPIO2_POS)
+
+#define EXTI_DB_GPIO1_POS 1U
+#define EXTI_DB_GPIO1_MSK BIT(EXTI_DB_GPIO1_POS)
+
+#define EXTI_DB_GPIO0_POS 0U
+#define EXTI_DB_GPIO0_MSK BIT(EXTI_DB_GPIO0_POS)
+
+/****************** Bit definition for EXTI_DBCON register ************************/
+
+#define EXTI_DBCON_DBPRE_POSS 8U
+#define EXTI_DBCON_DBPRE_POSE 15U
+#define EXTI_DBCON_DBPRE_MSK BITS(EXTI_DBCON_DBPRE_POSS,EXTI_DBCON_DBPRE_POSE)
+
+#define EXTI_DBCON_DBCNT_POSS 0U
+#define EXTI_DBCON_DBCNT_POSE 2U
+#define EXTI_DBCON_DBCNT_MSK BITS(EXTI_DBCON_DBCNT_POSS,EXTI_DBCON_DBCNT_POSE)
+
+/****************** Bit definition for EXTI_ICFG1 register ************************/
+
+#define EXTI_ICFG1_GPIO7_POSS 28U
+#define EXTI_ICFG1_GPIO7_POSE 31U
+#define EXTI_ICFG1_GPIO7_MSK BITS(EXTI_ICFG1_GPIO7_POSS,EXTI_ICFG1_GPIO7_POSE)
+
+#define EXTI_ICFG1_GPIO6_POSS 24U
+#define EXTI_ICFG1_GPIO6_POSE 27U
+#define EXTI_ICFG1_GPIO6_MSK BITS(EXTI_ICFG1_GPIO6_POSS,EXTI_ICFG1_GPIO6_POSE)
+
+#define EXTI_ICFG1_GPIO5_POSS 20U
+#define EXTI_ICFG1_GPIO5_POSE 23U
+#define EXTI_ICFG1_GPIO5_MSK BITS(EXTI_ICFG1_GPIO5_POSS,EXTI_ICFG1_GPIO5_POSE)
+
+#define EXTI_ICFG1_GPIO4_POSS 16U
+#define EXTI_ICFG1_GPIO4_POSE 19U
+#define EXTI_ICFG1_GPIO4_MSK BITS(EXTI_ICFG1_GPIO4_POSS,EXTI_ICFG1_GPIO4_POSE)
+
+#define EXTI_ICFG1_GPIO3_POSS 12U
+#define EXTI_ICFG1_GPIO3_POSE 15U
+#define EXTI_ICFG1_GPIO3_MSK BITS(EXTI_ICFG1_GPIO3_POSS,EXTI_ICFG1_GPIO3_POSE)
+
+#define EXTI_ICFG1_GPIO2_POSS 8U
+#define EXTI_ICFG1_GPIO2_POSE 11U
+#define EXTI_ICFG1_GPIO2_MSK BITS(EXTI_ICFG1_GPIO2_POSS,EXTI_ICFG1_GPIO2_POSE)
+
+#define EXTI_ICFG1_GPIO1_POSS 4U
+#define EXTI_ICFG1_GPIO1_POSE 7U
+#define EXTI_ICFG1_GPIO1_MSK BITS(EXTI_ICFG1_GPIO1_POSS,EXTI_ICFG1_GPIO1_POSE)
+
+#define EXTI_ICFG1_GPIO0_POSS 0U
+#define EXTI_ICFG1_GPIO0_POSE 3U
+#define EXTI_ICFG1_GPIO0_MSK BITS(EXTI_ICFG1_GPIO0_POSS,EXTI_ICFG1_GPIO0_POSE)
+
+/****************** Bit definition for EXTI_ICFG2 register ************************/
+
+#define EXTI_ICFG2_GPIO15_POSS 28U
+#define EXTI_ICFG2_GPIO15_POSE 31U
+#define EXTI_ICFG2_GPIO15_MSK BITS(EXTI_ICFG2_GPIO15_POSS,EXTI_ICFG2_GPIO15_POSE)
+
+#define EXTI_ICFG2_GPIO14_POSS 24U
+#define EXTI_ICFG2_GPIO14_POSE 27U
+#define EXTI_ICFG2_GPIO14_MSK BITS(EXTI_ICFG2_GPIO14_POSS,EXTI_ICFG2_GPIO14_POSE)
+
+#define EXTI_ICFG2_GPIO13_POSS 20U
+#define EXTI_ICFG2_GPIO13_POSE 23U
+#define EXTI_ICFG2_GPIO13_MSK BITS(EXTI_ICFG2_GPIO13_POSS,EXTI_ICFG2_GPIO13_POSE)
+
+#define EXTI_ICFG2_GPIO12_POSS 16U
+#define EXTI_ICFG2_GPIO12_POSE 19U
+#define EXTI_ICFG2_GPIO12_MSK BITS(EXTI_ICFG2_GPIO12_POSS,EXTI_ICFG2_GPIO12_POSE)
+
+#define EXTI_ICFG2_GPIO11_POSS 12U
+#define EXTI_ICFG2_GPIO11_POSE 15U
+#define EXTI_ICFG2_GPIO11_MSK BITS(EXTI_ICFG2_GPIO11_POSS,EXTI_ICFG2_GPIO11_POSE)
+
+#define EXTI_ICFG2_GPIO10_POSS 8U
+#define EXTI_ICFG2_GPIO10_POSE 11U
+#define EXTI_ICFG2_GPIO10_MSK BITS(EXTI_ICFG2_GPIO10_POSS,EXTI_ICFG2_GPIO10_POSE)
+
+#define EXTI_ICFG2_GPIO9_POSS 4U
+#define EXTI_ICFG2_GPIO9_POSE 7U
+#define EXTI_ICFG2_GPIO9_MSK BITS(EXTI_ICFG2_GPIO9_POSS,EXTI_ICFG2_GPIO9_POSE)
+
+#define EXTI_ICFG2_GPIO8_POSS 0U
+#define EXTI_ICFG2_GPIO8_POSE 3U
+#define EXTI_ICFG2_GPIO8_MSK BITS(EXTI_ICFG2_GPIO8_POSS,EXTI_ICFG2_GPIO8_POSE)
+
+typedef struct
+{
+ __O uint32_t IER;
+ __O uint32_t IDR;
+ __I uint32_t IVS;
+ __I uint32_t RIF;
+ __I uint32_t IFM;
+ __O uint32_t ICR;
+ __IO uint32_t RTS;
+ __IO uint32_t FTS;
+ __O uint32_t SWI;
+ __IO uint32_t ADTE;
+ __IO uint32_t DB;
+ __IO uint32_t DBCON;
+ __IO uint32_t ICFG1;
+ __IO uint32_t ICFG2;
+} EXTI_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_fc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_fc.h
new file mode 100644
index 0000000000000000000000000000000000000000..0b9850cb4e68986ba97ad2ab20b6669da69f4f89
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_fc.h
@@ -0,0 +1,181 @@
+/**
+ **************************************************************************************
+ * @file REG_FC.h
+ * @brief FC Head File
+ *
+ * @version V0.01
+ * @data 12/3/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __fc_H__
+#define __fc_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for FC_CMD register ************************/
+
+#define FC_CMD_FC_CMD_POSS 0U
+#define FC_CMD_FC_CMD_POSE 7U
+#define FC_CMD_FC_CMD_MSK BITS(FC_CMD_FC_CMD_POSS,FC_CMD_FC_CMD_POSE)
+
+/****************** Bit definition for FC_PA register ************************/
+
+#define FC_PA_PCNT_POSS 25U
+#define FC_PA_PCNT_POSE 31U
+#define FC_PA_PCNT_MSK BITS(FC_PA_PCNT_POSS,FC_PA_PCNT_POSE)
+
+#define FC_PA_IFREN_POS 24U
+#define FC_PA_IFREN_MSK BIT(FC_PA_IFREN_POS)
+
+#define FC_PA_PROG_ADDR_POSS 0U
+#define FC_PA_PROG_ADDR_POSE 23U
+#define FC_PA_PROG_ADDR_MSK BITS(FC_PA_PROG_ADDR_POSS,FC_PA_PROG_ADDR_POSE)
+
+/****************** Bit definition for FC_PLD register ************************/
+
+#define FC_PLD_PROG_DATA_L_POSS 0U
+#define FC_PLD_PROG_DATA_L_POSE 31U
+#define FC_PLD_PROG_DATA_L_MSK BITS(FC_PLD_PROG_DATA_L_POSS,FC_PLD_PROG_DATA_L_POSE)
+
+/****************** Bit definition for FC_PHD register ************************/
+
+#define FC_PHD_PROG_DATA_H_POSS 0U
+#define FC_PHD_PROG_DATA_H_POSE 31U
+#define FC_PHD_PROG_DATA_H_MSK BITS(FC_PHD_PROG_DATA_H_POSS,FC_PHD_PROG_DATA_H_POSE)
+
+/****************** Bit definition for FC_CON register ************************/
+
+#define FC_CON_SLEEP_POS 9U
+#define FC_CON_SLEEP_MSK BIT(FC_CON_SLEEP_POS)
+
+#define FC_CON_PFEN_POS 8U
+#define FC_CON_PFEN_MSK BIT(FC_CON_PFEN_POS)
+
+#define FC_CON_WAIT_POSS 0U
+#define FC_CON_WAIT_POSE 1U
+#define FC_CON_WAIT_MSK BITS(FC_CON_WAIT_POSS,FC_CON_WAIT_POSE)
+
+/****************** Bit definition for FC_STAT register ************************/
+
+#define FC_STAT_OPVD_POS 2U
+#define FC_STAT_OPVD_MSK BIT(FC_STAT_OPVD_POS)
+
+#define FC_STAT_MUNP2_POS 1U
+#define FC_STAT_MUNP2_MSK BIT(FC_STAT_MUNP2_POS)
+
+#define FC_STAT_MUNP1_POS 0U
+#define FC_STAT_MUNP1_MSK BIT(FC_STAT_MUNP1_POS)
+
+/****************** Bit definition for FC_UPL register ************************/
+
+#define FC_UPL_UPL_POSS 0U
+#define FC_UPL_UPL_POSE 31U
+#define FC_UPL_UPL_MSK BITS(FC_UPL_UPL_POSS,FC_UPL_UPL_POSE)
+
+/****************** Bit definition for FC_UPH register ************************/
+
+#define FC_UPH_UPH_POSS 0U
+#define FC_UPH_UPH_POSE 31U
+#define FC_UPH_UPH_MSK BITS(FC_UPH_UPH_POSS,FC_UPH_UPH_POSE)
+
+/****************** Bit definition for FC_OP_TRIM register ************************/
+
+#define FC_OP_TRIM_BGTRIMVD_POSS 24U
+#define FC_OP_TRIM_BGTRIMVD_POSE 31U
+#define FC_OP_TRIM_BGTRIMVD_MSK BITS(FC_OP_TRIM_BGTRIMVD_POSS,FC_OP_TRIM_BGTRIMVD_POSE)
+
+#define FC_OP_TRIM_BGTRIM_POSS 16U
+#define FC_OP_TRIM_BGTRIM_POSE 23U
+#define FC_OP_TRIM_BGTRIM_MSK BITS(FC_OP_TRIM_BGTRIM_POSS,FC_OP_TRIM_BGTRIM_POSE)
+
+#define FC_OP_TRIM_HRCTRIMVD_POSS 8U
+#define FC_OP_TRIM_HRCTRIMVD_POSE 15U
+#define FC_OP_TRIM_HRCTRIMVD_MSK BITS(FC_OP_TRIM_HRCTRIMVD_POSS,FC_OP_TRIM_HRCTRIMVD_POSE)
+
+#define FC_OP_TRIM_HRCTRIM_POSS 0U
+#define FC_OP_TRIM_HRCTRIM_POSE 7U
+#define FC_OP_TRIM_HRCTRIM_MSK BITS(FC_OP_TRIM_HRCTRIM_POSS,FC_OP_TRIM_HRCTRIM_POSE)
+
+/****************** Bit definition for FC_OP_PRT2L register ************************/
+
+#define FC_OP_PRT2L_PRTLV2L_POSS 0U
+#define FC_OP_PRT2L_PRTLV2L_POSE 31U
+#define FC_OP_PRT2L_PRTLV2L_MSK BITS(FC_OP_PRT2L_PRTLV2L_POSS,FC_OP_PRT2L_PRTLV2L_POSE)
+
+/****************** Bit definition for FC_OP_PRT2H register ************************/
+
+#define FC_OP_PRT2H_PRTLV2H_POSS 0U
+#define FC_OP_PRT2H_PRTLV2H_POSE 31U
+#define FC_OP_PRT2H_PRTLV2H_MSK BITS(FC_OP_PRT2H_PRTLV2H_POSS,FC_OP_PRT2H_PRTLV2H_POSE)
+
+/****************** Bit definition for FC_OP_PRT1L register ************************/
+
+#define FC_OP_PRT1L_PRTLV1L_POSS 0U
+#define FC_OP_PRT1L_PRTLV1L_POSE 31U
+#define FC_OP_PRT1L_PRTLV1L_MSK BITS(FC_OP_PRT1L_PRTLV1L_POSS,FC_OP_PRT1L_PRTLV1L_POSE)
+
+/****************** Bit definition for FC_OP_PRT1H register ************************/
+
+#define FC_OP_PRT1H_PRTLV1H_POSS 0U
+#define FC_OP_PRT1H_PRTLV1H_POSE 31U
+#define FC_OP_PRT1H_PRTLV1H_MSK BITS(FC_OP_PRT1H_PRTLV1H_POSS,FC_OP_PRT1H_PRTLV1H_POSE)
+
+/****************** Bit definition for FC_OP_REMAP register ************************/
+
+#define FC_OP_REMAP_HREMAP_POSS 8U
+#define FC_OP_REMAP_HREMAP_POSE 15U
+#define FC_OP_REMAP_HREMAP_MSK BITS(FC_OP_REMAP_HREMAP_POSS,FC_OP_REMAP_HREMAP_POSE)
+
+#define FC_OP_REMAP_SREMAP_POSS 4U
+#define FC_OP_REMAP_SREMAP_POSE 5U
+#define FC_OP_REMAP_SREMAP_MSK BITS(FC_OP_REMAP_SREMAP_POSS,FC_OP_REMAP_SREMAP_POSE)
+
+#define FC_OP_REMAP_SEFBASE_POSS 0U
+#define FC_OP_REMAP_SEFBASE_POSE 3U
+#define FC_OP_REMAP_SEFBASE_MSK BITS(FC_OP_REMAP_SEFBASE_POSS,FC_OP_REMAP_SEFBASE_POSE)
+
+typedef struct
+{
+ __IO uint32_t CMD;
+ __IO uint32_t PA;
+ __IO uint32_t PLD;
+ __IO uint32_t PHD;
+ __IO uint32_t CON;
+ __I uint32_t STAT;
+ uint32_t RESERVED0[2] ;
+ __IO uint32_t UPL;
+ __IO uint32_t UPH;
+ uint32_t RESERVED1[2] ;
+ __I uint32_t OP_TRIM;
+ uint32_t RESERVED2[4] ;
+// uint32_t ADCTRIM_1V;
+// uint32_t ADCTRIM_2V;
+// uint32_t RESERVED3;
+
+ uint32_t ADCTRIM_VDD5V_VREF5V;
+ uint32_t ADCTRIM_VDD3V3_VREF3V3;
+ uint32_t ADCTRIM_VDD5V_VREF2V5;
+ __I uint32_t OP_PRT2L;
+ __I uint32_t OP_PRT2H;
+ __I uint32_t OP_PRT1L;
+ __I uint32_t OP_PRT1H;
+ __I uint32_t OP_REMAP;
+} FC_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_gpio.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_gpio.h
new file mode 100644
index 0000000000000000000000000000000000000000..d965ef3b94aa8abf8a88ede1ede6a8eaeceb1e58
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_gpio.h
@@ -0,0 +1,710 @@
+/**
+ **************************************************************************************
+ * @file REG_GPIO.h
+ * @brief GPIO Head File
+ *
+ * @version V0.01
+ * @date 12/5/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __GPIO_H__
+#define __GPIO_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for GPIO_IDATA register ************************/
+
+#define GPIO_IDATA_ID15_POS 15U
+#define GPIO_IDATA_ID15_MSK BIT(GPIO_IDATA_ID15_POS)
+
+#define GPIO_IDATA_ID14_POS 14U
+#define GPIO_IDATA_ID14_MSK BIT(GPIO_IDATA_ID14_POS)
+
+#define GPIO_IDATA_ID13_POS 13U
+#define GPIO_IDATA_ID13_MSK BIT(GPIO_IDATA_ID13_POS)
+
+#define GPIO_IDATA_ID12_POS 12U
+#define GPIO_IDATA_ID12_MSK BIT(GPIO_IDATA_ID12_POS)
+
+#define GPIO_IDATA_ID11_POS 11U
+#define GPIO_IDATA_ID11_MSK BIT(GPIO_IDATA_ID11_POS)
+
+#define GPIO_IDATA_ID10_POS 10U
+#define GPIO_IDATA_ID10_MSK BIT(GPIO_IDATA_ID10_POS)
+
+#define GPIO_IDATA_ID9_POS 9U
+#define GPIO_IDATA_ID9_MSK BIT(GPIO_IDATA_ID9_POS)
+
+#define GPIO_IDATA_ID8_POS 8U
+#define GPIO_IDATA_ID8_MSK BIT(GPIO_IDATA_ID8_POS)
+
+#define GPIO_IDATA_ID7_POS 7U
+#define GPIO_IDATA_ID7_MSK BIT(GPIO_IDATA_ID7_POS)
+
+#define GPIO_IDATA_ID6_POS 6U
+#define GPIO_IDATA_ID6_MSK BIT(GPIO_IDATA_ID6_POS)
+
+#define GPIO_IDATA_ID5_POS 5U
+#define GPIO_IDATA_ID5_MSK BIT(GPIO_IDATA_ID5_POS)
+
+#define GPIO_IDATA_ID4_POS 4U
+#define GPIO_IDATA_ID4_MSK BIT(GPIO_IDATA_ID4_POS)
+
+#define GPIO_IDATA_ID3_POS 3U
+#define GPIO_IDATA_ID3_MSK BIT(GPIO_IDATA_ID3_POS)
+
+#define GPIO_IDATA_ID2_POS 2U
+#define GPIO_IDATA_ID2_MSK BIT(GPIO_IDATA_ID2_POS)
+
+#define GPIO_IDATA_ID1_POS 1U
+#define GPIO_IDATA_ID1_MSK BIT(GPIO_IDATA_ID1_POS)
+
+#define GPIO_IDATA_ID0_POS 0U
+#define GPIO_IDATA_ID0_MSK BIT(GPIO_IDATA_ID0_POS)
+
+/****************** Bit definition for GPIO_ODATA register ************************/
+
+#define GPIO_ODATA_OD15_POS 15U
+#define GPIO_ODATA_OD15_MSK BIT(GPIO_ODATA_OD15_POS)
+
+#define GPIO_ODATA_OD14_POS 14U
+#define GPIO_ODATA_OD14_MSK BIT(GPIO_ODATA_OD14_POS)
+
+#define GPIO_ODATA_OD13_POS 13U
+#define GPIO_ODATA_OD13_MSK BIT(GPIO_ODATA_OD13_POS)
+
+#define GPIO_ODATA_OD12_POS 12U
+#define GPIO_ODATA_OD12_MSK BIT(GPIO_ODATA_OD12_POS)
+
+#define GPIO_ODATA_OD11_POS 11U
+#define GPIO_ODATA_OD11_MSK BIT(GPIO_ODATA_OD11_POS)
+
+#define GPIO_ODATA_OD10_POS 10U
+#define GPIO_ODATA_OD10_MSK BIT(GPIO_ODATA_OD10_POS)
+
+#define GPIO_ODATA_OD9_POS 9U
+#define GPIO_ODATA_OD9_MSK BIT(GPIO_ODATA_OD9_POS)
+
+#define GPIO_ODATA_OD8_POS 8U
+#define GPIO_ODATA_OD8_MSK BIT(GPIO_ODATA_OD8_POS)
+
+#define GPIO_ODATA_OD7_POS 7U
+#define GPIO_ODATA_OD7_MSK BIT(GPIO_ODATA_OD7_POS)
+
+#define GPIO_ODATA_OD6_POS 6U
+#define GPIO_ODATA_OD6_MSK BIT(GPIO_ODATA_OD6_POS)
+
+#define GPIO_ODATA_OD5_POS 5U
+#define GPIO_ODATA_OD5_MSK BIT(GPIO_ODATA_OD5_POS)
+
+#define GPIO_ODATA_OD4_POS 4U
+#define GPIO_ODATA_OD4_MSK BIT(GPIO_ODATA_OD4_POS)
+
+#define GPIO_ODATA_OD3_POS 3U
+#define GPIO_ODATA_OD3_MSK BIT(GPIO_ODATA_OD3_POS)
+
+#define GPIO_ODATA_OD2_POS 2U
+#define GPIO_ODATA_OD2_MSK BIT(GPIO_ODATA_OD2_POS)
+
+#define GPIO_ODATA_OD1_POS 1U
+#define GPIO_ODATA_OD1_MSK BIT(GPIO_ODATA_OD1_POS)
+
+#define GPIO_ODATA_OD0_POS 0U
+#define GPIO_ODATA_OD0_MSK BIT(GPIO_ODATA_OD0_POS)
+
+/****************** Bit definition for GPIO_BSBR register ************************/
+
+#define GPIO_BSBR_BR15_POS 31U
+#define GPIO_BSBR_BR15_MSK BIT(GPIO_BSBR_BR15_POS)
+
+#define GPIO_BSBR_BR14_POS 30U
+#define GPIO_BSBR_BR14_MSK BIT(GPIO_BSBR_BR14_POS)
+
+#define GPIO_BSBR_BR13_POS 29U
+#define GPIO_BSBR_BR13_MSK BIT(GPIO_BSBR_BR13_POS)
+
+#define GPIO_BSBR_BR12_POS 28U
+#define GPIO_BSBR_BR12_MSK BIT(GPIO_BSBR_BR12_POS)
+
+#define GPIO_BSBR_BR11_POS 27U
+#define GPIO_BSBR_BR11_MSK BIT(GPIO_BSBR_BR11_POS)
+
+#define GPIO_BSBR_BR10_POS 26U
+#define GPIO_BSBR_BR10_MSK BIT(GPIO_BSBR_BR10_POS)
+
+#define GPIO_BSBR_BR9_POS 25U
+#define GPIO_BSBR_BR9_MSK BIT(GPIO_BSBR_BR9_POS)
+
+#define GPIO_BSBR_BR8_POS 24U
+#define GPIO_BSBR_BR8_MSK BIT(GPIO_BSBR_BR8_POS)
+
+#define GPIO_BSBR_BR7_POS 23U
+#define GPIO_BSBR_BR7_MSK BIT(GPIO_BSBR_BR7_POS)
+
+#define GPIO_BSBR_BR6_POS 22U
+#define GPIO_BSBR_BR6_MSK BIT(GPIO_BSBR_BR6_POS)
+
+#define GPIO_BSBR_BR5_POS 21U
+#define GPIO_BSBR_BR5_MSK BIT(GPIO_BSBR_BR5_POS)
+
+#define GPIO_BSBR_BR4_POS 20U
+#define GPIO_BSBR_BR4_MSK BIT(GPIO_BSBR_BR4_POS)
+
+#define GPIO_BSBR_BR3_POS 19U
+#define GPIO_BSBR_BR3_MSK BIT(GPIO_BSBR_BR3_POS)
+
+#define GPIO_BSBR_BR2_POS 18U
+#define GPIO_BSBR_BR2_MSK BIT(GPIO_BSBR_BR2_POS)
+
+#define GPIO_BSBR_BR1_POS 17U
+#define GPIO_BSBR_BR1_MSK BIT(GPIO_BSBR_BR1_POS)
+
+#define GPIO_BSBR_BR0_POS 16U
+#define GPIO_BSBR_BR0_MSK BIT(GPIO_BSBR_BR0_POS)
+
+#define GPIO_BSBR_BS15_POS 15U
+#define GPIO_BSBR_BS15_MSK BIT(GPIO_BSBR_BS15_POS)
+
+#define GPIO_BSBR_BS14_POS 14U
+#define GPIO_BSBR_BS14_MSK BIT(GPIO_BSBR_BS14_POS)
+
+#define GPIO_BSBR_BS13_POS 13U
+#define GPIO_BSBR_BS13_MSK BIT(GPIO_BSBR_BS13_POS)
+
+#define GPIO_BSBR_BS12_POS 12U
+#define GPIO_BSBR_BS12_MSK BIT(GPIO_BSBR_BS12_POS)
+
+#define GPIO_BSBR_BS11_POS 11U
+#define GPIO_BSBR_BS11_MSK BIT(GPIO_BSBR_BS11_POS)
+
+#define GPIO_BSBR_BS10_POS 10U
+#define GPIO_BSBR_BS10_MSK BIT(GPIO_BSBR_BS10_POS)
+
+#define GPIO_BSBR_BS9_POS 9U
+#define GPIO_BSBR_BS9_MSK BIT(GPIO_BSBR_BS9_POS)
+
+#define GPIO_BSBR_BS8_POS 8U
+#define GPIO_BSBR_BS8_MSK BIT(GPIO_BSBR_BS8_POS)
+
+#define GPIO_BSBR_BS7_POS 7U
+#define GPIO_BSBR_BS7_MSK BIT(GPIO_BSBR_BS7_POS)
+
+#define GPIO_BSBR_BS6_POS 6U
+#define GPIO_BSBR_BS6_MSK BIT(GPIO_BSBR_BS6_POS)
+
+#define GPIO_BSBR_BS5_POS 5U
+#define GPIO_BSBR_BS5_MSK BIT(GPIO_BSBR_BS5_POS)
+
+#define GPIO_BSBR_BS4_POS 4U
+#define GPIO_BSBR_BS4_MSK BIT(GPIO_BSBR_BS4_POS)
+
+#define GPIO_BSBR_BS3_POS 3U
+#define GPIO_BSBR_BS3_MSK BIT(GPIO_BSBR_BS3_POS)
+
+#define GPIO_BSBR_BS2_POS 2U
+#define GPIO_BSBR_BS2_MSK BIT(GPIO_BSBR_BS2_POS)
+
+#define GPIO_BSBR_BS1_POS 1U
+#define GPIO_BSBR_BS1_MSK BIT(GPIO_BSBR_BS1_POS)
+
+#define GPIO_BSBR_BS0_POS 0U
+#define GPIO_BSBR_BS0_MSK BIT(GPIO_BSBR_BS0_POS)
+
+/****************** Bit definition for GPIO_LCK register ************************/
+
+#define GPIO_LCK_LCKK_POS 16U
+#define GPIO_LCK_LCKK_MSK BIT(GPIO_LCK_LCKK_POS)
+
+#define GPIO_LCK_LCK15_POS 15U
+#define GPIO_LCK_LCK15_MSK BIT(GPIO_LCK_LCK15_POS)
+
+#define GPIO_LCK_LCK14_POS 14U
+#define GPIO_LCK_LCK14_MSK BIT(GPIO_LCK_LCK14_POS)
+
+#define GPIO_LCK_LCK13_POS 13U
+#define GPIO_LCK_LCK13_MSK BIT(GPIO_LCK_LCK13_POS)
+
+#define GPIO_LCK_LCK12_POS 12U
+#define GPIO_LCK_LCK12_MSK BIT(GPIO_LCK_LCK12_POS)
+
+#define GPIO_LCK_LCK11_POS 11U
+#define GPIO_LCK_LCK11_MSK BIT(GPIO_LCK_LCK11_POS)
+
+#define GPIO_LCK_LCK10_POS 10U
+#define GPIO_LCK_LCK10_MSK BIT(GPIO_LCK_LCK10_POS)
+
+#define GPIO_LCK_LCK9_POS 9U
+#define GPIO_LCK_LCK9_MSK BIT(GPIO_LCK_LCK9_POS)
+
+#define GPIO_LCK_LCK8_POS 8U
+#define GPIO_LCK_LCK8_MSK BIT(GPIO_LCK_LCK8_POS)
+
+#define GPIO_LCK_LCK7_POS 7U
+#define GPIO_LCK_LCK7_MSK BIT(GPIO_LCK_LCK7_POS)
+
+#define GPIO_LCK_LCK6_POS 6U
+#define GPIO_LCK_LCK6_MSK BIT(GPIO_LCK_LCK6_POS)
+
+#define GPIO_LCK_LCK5_POS 5U
+#define GPIO_LCK_LCK5_MSK BIT(GPIO_LCK_LCK5_POS)
+
+#define GPIO_LCK_LCK4_POS 4U
+#define GPIO_LCK_LCK4_MSK BIT(GPIO_LCK_LCK4_POS)
+
+#define GPIO_LCK_LCK3_POS 3U
+#define GPIO_LCK_LCK3_MSK BIT(GPIO_LCK_LCK3_POS)
+
+#define GPIO_LCK_LCK2_POS 2U
+#define GPIO_LCK_LCK2_MSK BIT(GPIO_LCK_LCK2_POS)
+
+#define GPIO_LCK_LCK1_POS 1U
+#define GPIO_LCK_LCK1_MSK BIT(GPIO_LCK_LCK1_POS)
+
+#define GPIO_LCK_LCK0_POS 0U
+#define GPIO_LCK_LCK0_MSK BIT(GPIO_LCK_LCK0_POS)
+
+/****************** Bit definition for GPIO_MOD register ************************/
+
+#define GPIO_MOD_MOD15_POSS 30U
+#define GPIO_MOD_MOD15_POSE 31U
+#define GPIO_MOD_MOD15_MSK BITS(GPIO_MOD_MOD15_POSS,GPIO_MOD_MOD15_POSE)
+
+#define GPIO_MOD_MOD14_POSS 28U
+#define GPIO_MOD_MOD14_POSE 29U
+#define GPIO_MOD_MOD14_MSK BITS(GPIO_MOD_MOD14_POSS,GPIO_MOD_MOD14_POSE)
+
+#define GPIO_MOD_MOD13_POSS 26U
+#define GPIO_MOD_MOD13_POSE 27U
+#define GPIO_MOD_MOD13_MSK BITS(GPIO_MOD_MOD13_POSS,GPIO_MOD_MOD13_POSE)
+
+#define GPIO_MOD_MOD12_POSS 24U
+#define GPIO_MOD_MOD12_POSE 25U
+#define GPIO_MOD_MOD12_MSK BITS(GPIO_MOD_MOD12_POSS,GPIO_MOD_MOD12_POSE)
+
+#define GPIO_MOD_MOD11_POSS 22U
+#define GPIO_MOD_MOD11_POSE 23U
+#define GPIO_MOD_MOD11_MSK BITS(GPIO_MOD_MOD11_POSS,GPIO_MOD_MOD11_POSE)
+
+#define GPIO_MOD_MOD10_POSS 20U
+#define GPIO_MOD_MOD10_POSE 21U
+#define GPIO_MOD_MOD10_MSK BITS(GPIO_MOD_MOD10_POSS,GPIO_MOD_MOD10_POSE)
+
+#define GPIO_MOD_MOD9_POSS 18U
+#define GPIO_MOD_MOD9_POSE 19U
+#define GPIO_MOD_MOD9_MSK BITS(GPIO_MOD_MOD9_POSS,GPIO_MOD_MOD9_POSE)
+
+#define GPIO_MOD_MOD8_POSS 16U
+#define GPIO_MOD_MOD8_POSE 17U
+#define GPIO_MOD_MOD8_MSK BITS(GPIO_MOD_MOD8_POSS,GPIO_MOD_MOD8_POSE)
+
+#define GPIO_MOD_MOD7_POSS 14U
+#define GPIO_MOD_MOD7_POSE 15U
+#define GPIO_MOD_MOD7_MSK BITS(GPIO_MOD_MOD7_POSS,GPIO_MOD_MOD7_POSE)
+
+#define GPIO_MOD_MOD6_POSS 12U
+#define GPIO_MOD_MOD6_POSE 13U
+#define GPIO_MOD_MOD6_MSK BITS(GPIO_MOD_MOD6_POSS,GPIO_MOD_MOD6_POSE)
+
+#define GPIO_MOD_MOD5_POSS 10U
+#define GPIO_MOD_MOD5_POSE 11U
+#define GPIO_MOD_MOD5_MSK BITS(GPIO_MOD_MOD5_POSS,GPIO_MOD_MOD5_POSE)
+
+#define GPIO_MOD_MOD4_POSS 8U
+#define GPIO_MOD_MOD4_POSE 9U
+#define GPIO_MOD_MOD4_MSK BITS(GPIO_MOD_MOD4_POSS,GPIO_MOD_MOD4_POSE)
+
+#define GPIO_MOD_MOD3_POSS 6U
+#define GPIO_MOD_MOD3_POSE 7U
+#define GPIO_MOD_MOD3_MSK BITS(GPIO_MOD_MOD3_POSS,GPIO_MOD_MOD3_POSE)
+
+#define GPIO_MOD_MOD2_POSS 4U
+#define GPIO_MOD_MOD2_POSE 5U
+#define GPIO_MOD_MOD2_MSK BITS(GPIO_MOD_MOD2_POSS,GPIO_MOD_MOD2_POSE)
+
+#define GPIO_MOD_MOD1_POSS 2U
+#define GPIO_MOD_MOD1_POSE 3U
+#define GPIO_MOD_MOD1_MSK BITS(GPIO_MOD_MOD1_POSS,GPIO_MOD_MOD1_POSE)
+
+#define GPIO_MOD_MOD0_POSS 0U
+#define GPIO_MOD_MOD0_POSE 1U
+#define GPIO_MOD_MOD0_MSK BITS(GPIO_MOD_MOD0_POSS,GPIO_MOD_MOD0_POSE)
+
+/****************** Bit definition for GPIO_PUD register ************************/
+
+#define GPIO_PUD_PUD15_POSS 30U
+#define GPIO_PUD_PUD15_POSE 31U
+#define GPIO_PUD_PUD15_MSK BITS(GPIO_PUD_PUD15_POSS,GPIO_PUD_PUD15_POSE)
+
+#define GPIO_PUD_PUD14_POSS 28U
+#define GPIO_PUD_PUD14_POSE 29U
+#define GPIO_PUD_PUD14_MSK BITS(GPIO_PUD_PUD14_POSS,GPIO_PUD_PUD14_POSE)
+
+#define GPIO_PUD_PUD13_POSS 26U
+#define GPIO_PUD_PUD13_POSE 27U
+#define GPIO_PUD_PUD13_MSK BITS(GPIO_PUD_PUD13_POSS,GPIO_PUD_PUD13_POSE)
+
+#define GPIO_PUD_PUD12_POSS 24U
+#define GPIO_PUD_PUD12_POSE 25U
+#define GPIO_PUD_PUD12_MSK BITS(GPIO_PUD_PUD12_POSS,GPIO_PUD_PUD12_POSE)
+
+#define GPIO_PUD_PUD11_POSS 22U
+#define GPIO_PUD_PUD11_POSE 23U
+#define GPIO_PUD_PUD11_MSK BITS(GPIO_PUD_PUD11_POSS,GPIO_PUD_PUD11_POSE)
+
+#define GPIO_PUD_PUD10_POSS 20U
+#define GPIO_PUD_PUD10_POSE 21U
+#define GPIO_PUD_PUD10_MSK BITS(GPIO_PUD_PUD10_POSS,GPIO_PUD_PUD10_POSE)
+
+#define GPIO_PUD_PUD9_POSS 18U
+#define GPIO_PUD_PUD9_POSE 19U
+#define GPIO_PUD_PUD9_MSK BITS(GPIO_PUD_PUD9_POSS,GPIO_PUD_PUD9_POSE)
+
+#define GPIO_PUD_PUD8_POSS 16U
+#define GPIO_PUD_PUD8_POSE 17U
+#define GPIO_PUD_PUD8_MSK BITS(GPIO_PUD_PUD8_POSS,GPIO_PUD_PUD8_POSE)
+
+#define GPIO_PUD_PUD7_POSS 14U
+#define GPIO_PUD_PUD7_POSE 15U
+#define GPIO_PUD_PUD7_MSK BITS(GPIO_PUD_PUD7_POSS,GPIO_PUD_PUD7_POSE)
+
+#define GPIO_PUD_PUD6_POSS 12U
+#define GPIO_PUD_PUD6_POSE 13U
+#define GPIO_PUD_PUD6_MSK BITS(GPIO_PUD_PUD6_POSS,GPIO_PUD_PUD6_POSE)
+
+#define GPIO_PUD_PUD5_POSS 10U
+#define GPIO_PUD_PUD5_POSE 11U
+#define GPIO_PUD_PUD5_MSK BITS(GPIO_PUD_PUD5_POSS,GPIO_PUD_PUD5_POSE)
+
+#define GPIO_PUD_PUD4_POSS 8U
+#define GPIO_PUD_PUD4_POSE 9U
+#define GPIO_PUD_PUD4_MSK BITS(GPIO_PUD_PUD4_POSS,GPIO_PUD_PUD4_POSE)
+
+#define GPIO_PUD_PUD3_POSS 6U
+#define GPIO_PUD_PUD3_POSE 7U
+#define GPIO_PUD_PUD3_MSK BITS(GPIO_PUD_PUD3_POSS,GPIO_PUD_PUD3_POSE)
+
+#define GPIO_PUD_PUD2_POSS 4U
+#define GPIO_PUD_PUD2_POSE 5U
+#define GPIO_PUD_PUD2_MSK BITS(GPIO_PUD_PUD2_POSS,GPIO_PUD_PUD2_POSE)
+
+#define GPIO_PUD_PUD1_POSS 2U
+#define GPIO_PUD_PUD1_POSE 3U
+#define GPIO_PUD_PUD1_MSK BITS(GPIO_PUD_PUD1_POSS,GPIO_PUD_PUD1_POSE)
+
+#define GPIO_PUD_PUD0_POSS 0U
+#define GPIO_PUD_PUD0_POSE 1U
+#define GPIO_PUD_PUD0_MSK BITS(GPIO_PUD_PUD0_POSS,GPIO_PUD_PUD0_POSE)
+
+/****************** Bit definition for GPIO_OT register ************************/
+
+#define GPIO_OT_OT15_POS 15U
+#define GPIO_OT_OT15_MSK BIT(GPIO_OT_OT15_POS)
+
+#define GPIO_OT_OT14_POS 14U
+#define GPIO_OT_OT14_MSK BIT(GPIO_OT_OT14_POS)
+
+#define GPIO_OT_OT13_POS 13U
+#define GPIO_OT_OT13_MSK BIT(GPIO_OT_OT13_POS)
+
+#define GPIO_OT_OT12_POS 12U
+#define GPIO_OT_OT12_MSK BIT(GPIO_OT_OT12_POS)
+
+#define GPIO_OT_OT11_POS 11U
+#define GPIO_OT_OT11_MSK BIT(GPIO_OT_OT11_POS)
+
+#define GPIO_OT_OT10_POS 10U
+#define GPIO_OT_OT10_MSK BIT(GPIO_OT_OT10_POS)
+
+#define GPIO_OT_OT9_POS 9U
+#define GPIO_OT_OT9_MSK BIT(GPIO_OT_OT9_POS)
+
+#define GPIO_OT_OT8_POS 8U
+#define GPIO_OT_OT8_MSK BIT(GPIO_OT_OT8_POS)
+
+#define GPIO_OT_OT7_POS 7U
+#define GPIO_OT_OT7_MSK BIT(GPIO_OT_OT7_POS)
+
+#define GPIO_OT_OT6_POS 6U
+#define GPIO_OT_OT6_MSK BIT(GPIO_OT_OT6_POS)
+
+#define GPIO_OT_OT5_POS 5U
+#define GPIO_OT_OT5_MSK BIT(GPIO_OT_OT5_POS)
+
+#define GPIO_OT_OT4_POS 4U
+#define GPIO_OT_OT4_MSK BIT(GPIO_OT_OT4_POS)
+
+#define GPIO_OT_OT3_POS 3U
+#define GPIO_OT_OT3_MSK BIT(GPIO_OT_OT3_POS)
+
+#define GPIO_OT_OT2_POS 2U
+#define GPIO_OT_OT2_MSK BIT(GPIO_OT_OT2_POS)
+
+#define GPIO_OT_OT1_POS 1U
+#define GPIO_OT_OT1_MSK BIT(GPIO_OT_OT1_POS)
+
+#define GPIO_OT_OT0_POS 0U
+#define GPIO_OT_OT0_MSK BIT(GPIO_OT_OT0_POS)
+
+#define GPIO_OT_OT_POSS 0U
+#define GPIO_OT_OT_POSE 15U
+#define GPIO_OT_OT_MSK BITS(GPIO_OT_OT_POSS,GPIO_OT_OT_POSE)
+
+/****************** Bit definition for GPIO_DS register ************************/
+
+#define GPIO_DS_DS15_POS 15U
+#define GPIO_DS_DS15_MSK BIT(GPIO_DS_DS15_POS)
+
+#define GPIO_DS_DS14_POS 14U
+#define GPIO_DS_DS14_MSK BIT(GPIO_DS_DS14_POS)
+
+#define GPIO_DS_DS13_POS 13U
+#define GPIO_DS_DS13_MSK BIT(GPIO_DS_DS13_POS)
+
+#define GPIO_DS_DS12_POS 12U
+#define GPIO_DS_DS12_MSK BIT(GPIO_DS_DS12_POS)
+
+#define GPIO_DS_DS11_POS 11U
+#define GPIO_DS_DS11_MSK BIT(GPIO_DS_DS11_POS)
+
+#define GPIO_DS_DS10_POS 10U
+#define GPIO_DS_DS10_MSK BIT(GPIO_DS_DS10_POS)
+
+#define GPIO_DS_DS9_POS 9U
+#define GPIO_DS_DS9_MSK BIT(GPIO_DS_DS9_POS)
+
+#define GPIO_DS_DS8_POS 8U
+#define GPIO_DS_DS8_MSK BIT(GPIO_DS_DS8_POS)
+
+#define GPIO_DS_DS7_POS 7U
+#define GPIO_DS_DS7_MSK BIT(GPIO_DS_DS7_POS)
+
+#define GPIO_DS_DS6_POS 6U
+#define GPIO_DS_DS6_MSK BIT(GPIO_DS_DS6_POS)
+
+#define GPIO_DS_DS5_POS 5U
+#define GPIO_DS_DS5_MSK BIT(GPIO_DS_DS5_POS)
+
+#define GPIO_DS_DS4_POS 4U
+#define GPIO_DS_DS4_MSK BIT(GPIO_DS_DS4_POS)
+
+#define GPIO_DS_DS3_POS 3U
+#define GPIO_DS_DS3_MSK BIT(GPIO_DS_DS3_POS)
+
+#define GPIO_DS_DS2_POS 2U
+#define GPIO_DS_DS2_MSK BIT(GPIO_DS_DS2_POS)
+
+#define GPIO_DS_DS1_POS 1U
+#define GPIO_DS_DS1_MSK BIT(GPIO_DS_DS1_POS)
+
+#define GPIO_DS_DS0_POS 0U
+#define GPIO_DS_DS0_MSK BIT(GPIO_DS_DS0_POS)
+
+#define GPIO_DS_DS_POSS 0U
+#define GPIO_DS_DS_POSE 15U
+#define GPIO_DS_DS_MSK BITS(GPIO_DS_DS_POSS,GPIO_DS_DS_POSE)
+
+/****************** Bit definition for GPIO_FIR register ************************/
+
+#define GPIO_FIR_FIR15_POS 15U
+#define GPIO_FIR_FIR15_MSK BIT(GPIO_FIR_FIR15_POS)
+
+#define GPIO_FIR_FIR14_POS 14U
+#define GPIO_FIR_FIR14_MSK BIT(GPIO_FIR_FIR14_POS)
+
+#define GPIO_FIR_FIR13_POS 13U
+#define GPIO_FIR_FIR13_MSK BIT(GPIO_FIR_FIR13_POS)
+
+#define GPIO_FIR_FIR12_POS 12U
+#define GPIO_FIR_FIR12_MSK BIT(GPIO_FIR_FIR12_POS)
+
+#define GPIO_FIR_FIR11_POS 11U
+#define GPIO_FIR_FIR11_MSK BIT(GPIO_FIR_FIR11_POS)
+
+#define GPIO_FIR_FIR10_POS 10U
+#define GPIO_FIR_FIR10_MSK BIT(GPIO_FIR_FIR10_POS)
+
+#define GPIO_FIR_FIR9_POS 9U
+#define GPIO_FIR_FIR9_MSK BIT(GPIO_FIR_FIR9_POS)
+
+#define GPIO_FIR_FIR8_POS 8U
+#define GPIO_FIR_FIR8_MSK BIT(GPIO_FIR_FIR8_POS)
+
+#define GPIO_FIR_FIR7_POS 7U
+#define GPIO_FIR_FIR7_MSK BIT(GPIO_FIR_FIR7_POS)
+
+#define GPIO_FIR_FIR6_POS 6U
+#define GPIO_FIR_FIR6_MSK BIT(GPIO_FIR_FIR6_POS)
+
+#define GPIO_FIR_FIR5_POS 5U
+#define GPIO_FIR_FIR5_MSK BIT(GPIO_FIR_FIR5_POS)
+
+#define GPIO_FIR_FIR4_POS 4U
+#define GPIO_FIR_FIR4_MSK BIT(GPIO_FIR_FIR4_POS)
+
+#define GPIO_FIR_FIR3_POS 3U
+#define GPIO_FIR_FIR3_MSK BIT(GPIO_FIR_FIR3_POS)
+
+#define GPIO_FIR_FIR2_POS 2U
+#define GPIO_FIR_FIR2_MSK BIT(GPIO_FIR_FIR2_POS)
+
+#define GPIO_FIR_FIR1_POS 1U
+#define GPIO_FIR_FIR1_MSK BIT(GPIO_FIR_FIR1_POS)
+
+#define GPIO_FIR_FIR0_POS 0U
+#define GPIO_FIR_FIR0_MSK BIT(GPIO_FIR_FIR0_POS)
+
+/****************** Bit definition for GPIO_IST register ************************/
+
+#define GPIO_IST_IST15_POS 15U
+#define GPIO_IST_IST15_MSK BIT(GPIO_IST_IST15_POS)
+
+#define GPIO_IST_IST14_POS 14U
+#define GPIO_IST_IST14_MSK BIT(GPIO_IST_IST14_POS)
+
+#define GPIO_IST_IST13_POS 13U
+#define GPIO_IST_IST13_MSK BIT(GPIO_IST_IST13_POS)
+
+#define GPIO_IST_IST12_POS 12U
+#define GPIO_IST_IST12_MSK BIT(GPIO_IST_IST12_POS)
+
+#define GPIO_IST_IST11_POS 11U
+#define GPIO_IST_IST11_MSK BIT(GPIO_IST_IST11_POS)
+
+#define GPIO_IST_IST10_POS 10U
+#define GPIO_IST_IST10_MSK BIT(GPIO_IST_IST10_POS)
+
+#define GPIO_IST_IST9_POS 9U
+#define GPIO_IST_IST9_MSK BIT(GPIO_IST_IST9_POS)
+
+#define GPIO_IST_IST8_POS 8U
+#define GPIO_IST_IST8_MSK BIT(GPIO_IST_IST8_POS)
+
+#define GPIO_IST_IST7_POS 7U
+#define GPIO_IST_IST7_MSK BIT(GPIO_IST_IST7_POS)
+
+#define GPIO_IST_IST6_POS 6U
+#define GPIO_IST_IST6_MSK BIT(GPIO_IST_IST6_POS)
+
+#define GPIO_IST_IST5_POS 5U
+#define GPIO_IST_IST5_MSK BIT(GPIO_IST_IST5_POS)
+
+#define GPIO_IST_IST4_POS 4U
+#define GPIO_IST_IST4_MSK BIT(GPIO_IST_IST4_POS)
+
+#define GPIO_IST_IST3_POS 3U
+#define GPIO_IST_IST3_MSK BIT(GPIO_IST_IST3_POS)
+
+#define GPIO_IST_IST2_POS 2U
+#define GPIO_IST_IST2_MSK BIT(GPIO_IST_IST2_POS)
+
+#define GPIO_IST_IST1_POS 1U
+#define GPIO_IST_IST1_MSK BIT(GPIO_IST_IST1_POS)
+
+#define GPIO_IST_IST0_POS 0U
+#define GPIO_IST_IST0_MSK BIT(GPIO_IST_IST0_POS)
+
+#define GPIO_IST_IST_POSS 0U
+#define GPIO_IST_IST_POSE 15U
+#define GPIO_IST_IST_MSK BITS(GPIO_IST_IST_POSS, GPIO_IST_IST_POSE)
+
+/****************** Bit definition for GPIO_AFL register ************************/
+
+#define GPIO_AFL_AF7_POSS 28U
+#define GPIO_AFL_AF7_POSE 31U
+#define GPIO_AFL_AF7_MSK BITS(GPIO_AFL_AF7_POSS,GPIO_AFL_AF7_POSE)
+
+#define GPIO_AFL_AF6_POSS 24U
+#define GPIO_AFL_AF6_POSE 27U
+#define GPIO_AFL_AF6_MSK BITS(GPIO_AFL_AF6_POSS,GPIO_AFL_AF6_POSE)
+
+#define GPIO_AFL_AF5_POSS 20U
+#define GPIO_AFL_AF5_POSE 23U
+#define GPIO_AFL_AF5_MSK BITS(GPIO_AFL_AF5_POSS,GPIO_AFL_AF5_POSE)
+
+#define GPIO_AFL_AF4_POSS 16U
+#define GPIO_AFL_AF4_POSE 19U
+#define GPIO_AFL_AF4_MSK BITS(GPIO_AFL_AF4_POSS,GPIO_AFL_AF4_POSE)
+
+#define GPIO_AFL_AF3_POSS 12U
+#define GPIO_AFL_AF3_POSE 15U
+#define GPIO_AFL_AF3_MSK BITS(GPIO_AFL_AF3_POSS,GPIO_AFL_AF3_POSE)
+
+#define GPIO_AFL_AF2_POSS 8U
+#define GPIO_AFL_AF2_POSE 11U
+#define GPIO_AFL_AF2_MSK BITS(GPIO_AFL_AF2_POSS,GPIO_AFL_AF2_POSE)
+
+#define GPIO_AFL_AF1_POSS 4U
+#define GPIO_AFL_AF1_POSE 7U
+#define GPIO_AFL_AF1_MSK BITS(GPIO_AFL_AF1_POSS,GPIO_AFL_AF1_POSE)
+
+#define GPIO_AFL_AF0_POSS 0U
+#define GPIO_AFL_AF0_POSE 3U
+#define GPIO_AFL_AF0_MSK BITS(GPIO_AFL_AF0_POSS,GPIO_AFL_AF0_POSE)
+
+/****************** Bit definition for GPIO_AFH register ************************/
+
+#define GPIO_AFH_AF15_POSS 28U
+#define GPIO_AFH_AF15_POSE 31U
+#define GPIO_AFH_AF15_MSK BITS(GPIO_AFH_AF15_POSS,GPIO_AFH_AF15_POSE)
+
+#define GPIO_AFH_AF14_POSS 24U
+#define GPIO_AFH_AF14_POSE 27U
+#define GPIO_AFH_AF14_MSK BITS(GPIO_AFH_AF14_POSS,GPIO_AFH_AF14_POSE)
+
+#define GPIO_AFH_AF13_POSS 20U
+#define GPIO_AFH_AF13_POSE 23U
+#define GPIO_AFH_AF13_MSK BITS(GPIO_AFH_AF13_POSS,GPIO_AFH_AF13_POSE)
+
+#define GPIO_AFH_AF12_POSS 16U
+#define GPIO_AFH_AF12_POSE 19U
+#define GPIO_AFH_AF12_MSK BITS(GPIO_AFH_AF12_POSS,GPIO_AFH_AF12_POSE)
+
+#define GPIO_AFH_AF11_POSS 12U
+#define GPIO_AFH_AF11_POSE 15U
+#define GPIO_AFH_AF11_MSK BITS(GPIO_AFH_AF11_POSS,GPIO_AFH_AF11_POSE)
+
+#define GPIO_AFH_AF10_POSS 8U
+#define GPIO_AFH_AF10_POSE 11U
+#define GPIO_AFH_AF10_MSK BITS(GPIO_AFH_AF10_POSS,GPIO_AFH_AF10_POSE)
+
+#define GPIO_AFH_AF9_POSS 4U
+#define GPIO_AFH_AF9_POSE 7U
+#define GPIO_AFH_AF9_MSK BITS(GPIO_AFH_AF9_POSS,GPIO_AFH_AF9_POSE)
+
+#define GPIO_AFH_AF8_POSS 0U
+#define GPIO_AFH_AF8_POSE 3U
+#define GPIO_AFH_AF8_MSK BITS(GPIO_AFH_AF8_POSS,GPIO_AFH_AF8_POSE)
+
+typedef struct
+{
+ __I uint32_t IDATA;
+ __IO uint32_t ODATA;
+ __O uint32_t BSBR;
+ __IO uint32_t LCK;
+ __IO uint32_t MOD;
+ __IO uint32_t PUD;
+ __IO uint32_t OT;
+ __IO uint32_t DS;
+ __IO uint32_t FIR;
+ __IO uint32_t IST;
+ __IO uint32_t AFL;
+ __IO uint32_t AFH;
+} GPIO_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_hdiv.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_hdiv.h
new file mode 100644
index 0000000000000000000000000000000000000000..d1ffd0d102ecff98692b9b2f6a9ad493c35896eb
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_hdiv.h
@@ -0,0 +1,75 @@
+/**
+ **************************************************************************************
+ * @file REG_HDIV.h
+ * @brief HDIV Head File
+ *
+ * @version V0.01
+ * @data 12/3/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __hdiv_H__
+#define __hdiv_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for HDIV_DIVDR register ************************/
+
+#define HDIV_DIVDR_DIVS_POSS 0U
+#define HDIV_DIVDR_DIVS_POSE 31U
+#define HDIV_DIVDR_DIVD_MSK BITS(HDIV_DIVDR_DIVD_POSS,HDIV_DIVDR_DIVD_POSE)
+
+/****************** Bit definition for HDIV_DIVSR register ************************/
+
+#define HDIV_DIVSR_DIVS_POSS 0U
+#define HDIV_DIVSR_DIVS_POSE 31U
+#define HDIV_DIVSR_DIVS_MSK BITS(HDIV_DIVSR_DIVS_POSS,HDIV_DIVSR_DIVS_POSE)
+
+/****************** Bit definition for HDIV_DIVQR register ************************/
+
+#define HDIV_DIVQR_DIVQ_POSS 0U
+#define HDIV_DIVQR_DIVQ_POSE 31U
+#define HDIV_DIVQR_DIVQ_MSK BITS(HDIV_DIVQR_DIVQ_POSS,HDIV_DIVQR_DIVQ_POSE)
+
+/****************** Bit definition for HDIV_DIVRR register ************************/
+
+#define HDIV_DIVRR_DIVR_POSS 0U
+#define HDIV_DIVRR_DIVR_POSE 31U
+#define HDIV_DIVRR_DIVR_MSK BITS(HDIV_DIVRR_DIVR_POSS,HDIV_DIVRR_DIVR_POSE)
+
+/****************** Bit definition for HDIV_DIVSTAT register ************************/
+
+#define HDIV_DIVSTAT_SIGN_POS 2U
+#define HDIV_DIVSTAT_SIGN_MSK BIT(HDIV_DIVSTAT_SIGN_POS)
+
+#define HDIV_DIVSTAT_DIV0_POS 1U
+#define HDIV_DIVSTAT_DIV0_MSK BIT(HDIV_DIVSTAT_DIV0_POS)
+
+#define HDIV_DIVSTAT_BUSY_POS 0U
+#define HDIV_DIVSTAT_BUSY_MSK BIT(HDIV_DIVSTAT_BUSY_POS)
+
+typedef struct
+{
+ __IO uint32_t DIVDR;
+ __IO uint32_t DIVSR;
+ __I uint32_t DIVQR;
+ __I uint32_t DIVRR;
+ __I uint32_t DIVSTAT;
+} HDIV_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_i2c.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_i2c.h
new file mode 100644
index 0000000000000000000000000000000000000000..887eb01e0363751a70792031988f9c99770a1bb0
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_i2c.h
@@ -0,0 +1,623 @@
+/**
+ **************************************************************************************
+ * @file REG_I2C.h
+ * @brief I2C Head File
+ *
+ * @version V0.01
+ * @date 4/12/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __REG_I2C_H__
+#define __REG_I2C_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for I2C_CON1 register ************************/
+
+#define I2C_CON1_PECEN_POS 23U
+#define I2C_CON1_PECEN_MSK BIT(I2C_CON1_PECEN_POS)
+
+#define I2C_CON1_ALERTEN_POS 22U
+#define I2C_CON1_ALERTEN_MSK BIT(I2C_CON1_ALERTEN_POS)
+
+#define I2C_CON1_SMBDEN_POS 21U
+#define I2C_CON1_SMBDEN_MSK BIT(I2C_CON1_SMBDEN_POS)
+
+#define I2C_CON1_SMBHEN_POS 20U
+#define I2C_CON1_SMBHEN_MSK BIT(I2C_CON1_SMBHEN_POS)
+
+#define I2C_CON1_GCEN_POS 19U
+#define I2C_CON1_GCEN_MSK BIT(I2C_CON1_GCEN_POS)
+
+#define I2C_CON1_NOSTRETCH_POS 17U
+#define I2C_CON1_NOSTRETCH_MSK BIT(I2C_CON1_NOSTRETCH_POS)
+
+#define I2C_CON1_SBC_POS 16U
+#define I2C_CON1_SBC_MSK BIT(I2C_CON1_SBC_POS)
+
+#define I2C_CON1_RXDMAEN_POS 15U
+#define I2C_CON1_RXDMAEN_MSK BIT(I2C_CON1_RXDMAEN_POS)
+
+#define I2C_CON1_TXDMAEN_POS 14U
+#define I2C_CON1_TXDMAEN_MSK BIT(I2C_CON1_TXDMAEN_POS)
+
+#define I2C_CON1_DNF_POSS 8U
+#define I2C_CON1_DNF_POSE 11U
+#define I2C_CON1_DNF_MSK BITS(I2C_CON1_DNF_POSS,I2C_CON1_DNF_POSE)
+
+#define I2C_CON1_PE_POS 0U
+#define I2C_CON1_PE_MSK BIT(I2C_CON1_PE_POS)
+
+/****************** Bit definition for I2C_CON2 register ************************/
+
+#define I2C_CON2_ACK_UPD_POS 29U
+#define I2C_CON2_ACK_UPD_MSK BIT(I2C_CON2_ACK_UPD_POS)
+
+#define I2C_CON2_HOLDACK_POS 28U
+#define I2C_CON2_HOLDACK_MSK BIT(I2C_CON2_HOLDACK_POS)
+
+#define I2C_CON2_PECBYTE_POS 26U
+#define I2C_CON2_PECBYTE_MSK BIT(I2C_CON2_PECBYTE_POS)
+
+#define I2C_CON2_AUTOEND_POS 25U
+#define I2C_CON2_AUTOEND_MSK BIT(I2C_CON2_AUTOEND_POS)
+
+#define I2C_CON2_RELOAD_POS 24U
+#define I2C_CON2_RELOAD_MSK BIT(I2C_CON2_RELOAD_POS)
+
+#define I2C_CON2_NBYTES_POSS 16U
+#define I2C_CON2_NBYTES_POSE 23U
+#define I2C_CON2_NBYTES_MSK BITS(I2C_CON2_NBYTES_POSS,I2C_CON2_NBYTES_POSE)
+
+#define I2C_CON2_NACK_POS 15U
+#define I2C_CON2_NACK_MSK BIT(I2C_CON2_NACK_POS)
+
+#define I2C_CON2_STOP_POS 14U
+#define I2C_CON2_STOP_MSK BIT(I2C_CON2_STOP_POS)
+
+#define I2C_CON2_START_POS 13U
+#define I2C_CON2_START_MSK BIT(I2C_CON2_START_POS)
+
+#define I2C_CON2_HEAD10R_POS 12U
+#define I2C_CON2_HEAD10R_MSK BIT(I2C_CON2_HEAD10R_POS)
+
+#define I2C_CON2_ADD10_POS 11U
+#define I2C_CON2_ADD10_MSK BIT(I2C_CON2_ADD10_POS)
+
+#define I2C_CON2_RD_WRN_POS 10U
+#define I2C_CON2_RD_WRN_MSK BIT(I2C_CON2_RD_WRN_POS)
+
+#define I2C_CON2_SADD_POSS 0U
+#define I2C_CON2_SADD_POSE 9U
+#define I2C_CON2_SADD_MSK BITS(I2C_CON2_SADD_POSS,I2C_CON2_SADD_POSE)
+
+/****************** Bit definition for I2C_ADDR1 register ************************/
+
+#define I2C_ADDR1_OA1EN_POS 15U
+#define I2C_ADDR1_OA1EN_MSK BIT(I2C_ADDR1_OA1EN_POS)
+
+#define I2C_ADDR1_OA1MODE_POS 10U
+#define I2C_ADDR1_OA1MODE_MSK BIT(I2C_ADDR1_OA1MODE_POS)
+
+#define I2C_ADDR1_OA1_POSS 0U
+#define I2C_ADDR1_OA1_POSE 9U
+#define I2C_ADDR1_OA1_MSK BITS(I2C_ADDR1_OA1_POSS,I2C_ADDR1_OA1_POSE)
+
+/****************** Bit definition for I2C_ADDR2 register ************************/
+
+#define I2C_ADDR2_OA2EN_POS 15U
+#define I2C_ADDR2_OA2EN_MSK BIT(I2C_ADDR2_OA2EN_POS)
+
+#define I2C_ADDR2_OA2MSK_POSS 8U
+#define I2C_ADDR2_OA2MSK_POSE 10U
+#define I2C_ADDR2_OA2MSK_MSK BITS(I2C_ADDR2_OA2MSK_POSS,I2C_ADDR2_OA2MSK_POSE)
+
+#define I2C_ADDR2_OA2_POSS 1U
+#define I2C_ADDR2_OA2_POSE 7U
+#define I2C_ADDR2_OA2_MSK BITS(I2C_ADDR2_OA2_POSS,I2C_ADDR2_OA2_POSE)
+
+/****************** Bit definition for I2C_TIMINGR register ************************/
+
+#define I2C_TIMINGR_PRESC_POSS 28U
+#define I2C_TIMINGR_PRESC_POSE 31U
+#define I2C_TIMINGR_PRESC_MSK BITS(I2C_TIMINGR_PRESC_POSS,I2C_TIMINGR_PRESC_POSE)
+
+#define I2C_TIMINGR_SCLDEL_POSS 20U
+#define I2C_TIMINGR_SCLDEL_POSE 23U
+#define I2C_TIMINGR_SCLDEL_MSK BITS(I2C_TIMINGR_SCLDEL_POSS,I2C_TIMINGR_SCLDEL_POSE)
+
+#define I2C_TIMINGR_SDADEL_POSS 16U
+#define I2C_TIMINGR_SDADEL_POSE 19U
+#define I2C_TIMINGR_SDADEL_MSK BITS(I2C_TIMINGR_SDADEL_POSS,I2C_TIMINGR_SDADEL_POSE)
+
+#define I2C_TIMINGR_SCLH_POSS 8U
+#define I2C_TIMINGR_SCLH_POSE 15U
+#define I2C_TIMINGR_SCLH_MSK BITS(I2C_TIMINGR_SCLH_POSS,I2C_TIMINGR_SCLH_POSE)
+
+#define I2C_TIMINGR_SCLL_POSS 0U
+#define I2C_TIMINGR_SCLL_POSE 7U
+#define I2C_TIMINGR_SCLL_MSK BITS(I2C_TIMINGR_SCLL_POSS,I2C_TIMINGR_SCLL_POSE)
+
+/****************** Bit definition for I2C_TIMEOUTR register ************************/
+
+#define I2C_TIMEOUTR_TEXTEN_POS 31U
+#define I2C_TIMEOUTR_TEXTEN_MSK BIT(I2C_TIMEOUTR_TEXTEN_POS)
+
+#define I2C_TIMEOUTR_TIMEOUTB_POSS 16U
+#define I2C_TIMEOUTR_TIMEOUTB_POSE 27U
+#define I2C_TIMEOUTR_TIMEOUTB_MSK BITS(I2C_TIMEOUTR_TIMEOUTB_POSS,I2C_TIMEOUTR_TIMEOUTB_POSE)
+
+#define I2C_TIMEOUTR_TIMEOUTEN_POS 15U
+#define I2C_TIMEOUTR_TIMEOUTEN_MSK BIT(I2C_TIMEOUTR_TIMEOUTEN_POS)
+
+#define I2C_TIMEOUTR_TIDLE_POS 12U
+#define I2C_TIMEOUTR_TIDLE_MSK BIT(I2C_TIMEOUTR_TIDLE_POS)
+
+#define I2C_TIMEOUTR_TIMEOUTA_POSS 0U
+#define I2C_TIMEOUTR_TIMEOUTA_POSE 11U
+#define I2C_TIMEOUTR_TIMEOUTA_MSK BITS(I2C_TIMEOUTR_TIMEOUTA_POSS,I2C_TIMEOUTR_TIMEOUTA_POSE)
+
+/****************** Bit definition for I2C_STAT register ************************/
+
+#define I2C_STAT_ADDCODE_POSS 17U
+#define I2C_STAT_ADDCODE_POSE 23U
+#define I2C_STAT_ADDCODE_MSK BITS(I2C_STAT_ADDCODE_POSS,I2C_STAT_ADDCODE_POSE)
+
+#define I2C_STAT_DIR_POS 16U
+#define I2C_STAT_DIR_MSK BIT(I2C_STAT_DIR_POS)
+
+#define I2C_STAT_BUSY_POS 15U
+#define I2C_STAT_BUSY_MSK BIT(I2C_STAT_BUSY_POS)
+
+#define I2C_STAT_TCR_POS 11U
+#define I2C_STAT_TCR_MSK BIT(I2C_STAT_TCR_POS)
+
+#define I2C_STAT_TC_POS 10U
+#define I2C_STAT_TC_MSK BIT(I2C_STAT_TC_POS)
+
+#define I2C_STAT_RXTH_POS 9U
+#define I2C_STAT_RXTH_MSK BIT(I2C_STAT_RXTH_POS)
+
+#define I2C_STAT_RXUD_POS 8U
+#define I2C_STAT_RXUD_MSK BIT(I2C_STAT_RXUD_POS)
+
+#define I2C_STAT_RXOV_POS 7U
+#define I2C_STAT_RXOV_MSK BIT(I2C_STAT_RXOV_POS)
+
+#define I2C_STAT_RXF_POS 6U
+#define I2C_STAT_RXF_MSK BIT(I2C_STAT_RXF_POS)
+
+#define I2C_STAT_RXE_POS 5U
+#define I2C_STAT_RXE_MSK BIT(I2C_STAT_RXE_POS)
+
+#define I2C_STAT_TXTH_POS 4U
+#define I2C_STAT_TXTH_MSK BIT(I2C_STAT_TXTH_POS)
+
+#define I2C_STAT_TXUD_POS 3U
+#define I2C_STAT_TXUD_MSK BIT(I2C_STAT_TXUD_POS)
+
+#define I2C_STAT_TXOV_POS 2U
+#define I2C_STAT_TXOV_MSK BIT(I2C_STAT_TXOV_POS)
+
+#define I2C_STAT_TXF_POS 1U
+#define I2C_STAT_TXF_MSK BIT(I2C_STAT_TXF_POS)
+
+#define I2C_STAT_TXE_POS 0U
+#define I2C_STAT_TXE_MSK BIT(I2C_STAT_TXE_POS)
+
+/****************** Bit definition for I2C_FCON register ************************/
+
+#define I2C_FCON_RXFTH_POSS 14U
+#define I2C_FCON_RXFTH_POSE 15U
+#define I2C_FCON_RXFTH_MSK BITS(I2C_FCON_RXFTH_POSS,I2C_FCON_RXFTH_POSE)
+
+#define I2C_FCON_RXFRST_POS 13U
+#define I2C_FCON_RXFRST_MSK BIT(I2C_FCON_RXFRST_POS)
+
+#define I2C_FCON_RXFLV_POSS 8U
+#define I2C_FCON_RXFLV_POSE 12U
+#define I2C_FCON_RXFLV_MSK BITS(I2C_FCON_RXFLV_POSS,I2C_FCON_RXFLV_POSE)
+
+#define I2C_FCON_TXFTH_POSS 6U
+#define I2C_FCON_TXFTH_POSE 7U
+#define I2C_FCON_TXFTH_MSK BITS(I2C_FCON_TXFTH_POSS,I2C_FCON_TXFTH_POSE)
+
+#define I2C_FCON_TXFRST_POS 5U
+#define I2C_FCON_TXFRST_MSK BIT(I2C_FCON_TXFRST_POS)
+
+#define I2C_FCON_TXFLV_POSS 0U
+#define I2C_FCON_TXFLV_POSE 4U
+#define I2C_FCON_TXFLV_MSK BITS(I2C_FCON_TXFLV_POSS,I2C_FCON_TXFLV_POSE)
+
+/****************** Bit definition for I2C_PECR register ************************/
+
+#define I2C_PECR_PEC_POSS 0U
+#define I2C_PECR_PEC_POSE 7U
+#define I2C_PECR_PEC_MSK BITS(I2C_PECR_PEC_POSS,I2C_PECR_PEC_POSE)
+
+/****************** Bit definition for I2C_RXDATA register ************************/
+
+#define I2C_RXDATA_RXDATA_POSS 0U
+#define I2C_RXDATA_RXDATA_POSE 7U
+#define I2C_RXDATA_RXDATA_MSK BITS(I2C_RXDATA_RXDATA_POSS,I2C_RXDATA_RXDATA_POSE)
+
+/****************** Bit definition for I2C_TXDATA register ************************/
+
+#define I2C_TXDATA_TXDATA_POSS 0U
+#define I2C_TXDATA_TXDATA_POSE 7U
+#define I2C_TXDATA_TXDATA_MSK BITS(I2C_TXDATA_TXDATA_POSS,I2C_TXDATA_TXDATA_POSE)
+
+/****************** Bit definition for I2C_IER register ************************/
+
+#define I2C_IER_ALERTIE_POS 20U
+#define I2C_IER_ALERTIE_MSK BIT(I2C_IER_ALERTIE_POS)
+
+#define I2C_IER_TOUTIE_POS 19U
+#define I2C_IER_TOUTIE_MSK BIT(I2C_IER_TOUTIE_POS)
+
+#define I2C_IER_PECEIE_POS 18U
+#define I2C_IER_PECEIE_MSK BIT(I2C_IER_PECEIE_POS)
+
+#define I2C_IER_ARLOIE_POS 17U
+#define I2C_IER_ARLOIE_MSK BIT(I2C_IER_ARLOIE_POS)
+
+#define I2C_IER_BERRIE_POS 16U
+#define I2C_IER_BERRIE_MSK BIT(I2C_IER_BERRIE_POS)
+
+#define I2C_IER_STOPIE_POS 14U
+#define I2C_IER_STOPIE_MSK BIT(I2C_IER_STOPIE_POS)
+
+#define I2C_IER_NACKIE_POS 13U
+#define I2C_IER_NACKIE_MSK BIT(I2C_IER_NACKIE_POS)
+
+#define I2C_IER_ADDRIE_POS 12U
+#define I2C_IER_ADDRIE_MSK BIT(I2C_IER_ADDRIE_POS)
+
+#define I2C_IER_TCRIE_POS 11U
+#define I2C_IER_TCRIE_MSK BIT(I2C_IER_TCRIE_POS)
+
+#define I2C_IER_TCIE_POS 10U
+#define I2C_IER_TCIE_MSK BIT(I2C_IER_TCIE_POS)
+
+#define I2C_IER_RXTHIE_POS 9U
+#define I2C_IER_RXTHIE_MSK BIT(I2C_IER_RXTHIE_POS)
+
+#define I2C_IER_RXUDIE_POS 8U
+#define I2C_IER_RXUDIE_MSK BIT(I2C_IER_RXUDIE_POS)
+
+#define I2C_IER_RXOVIE_POS 7U
+#define I2C_IER_RXOVIE_MSK BIT(I2C_IER_RXOVIE_POS)
+
+#define I2C_IER_RXFIE_POS 6U
+#define I2C_IER_RXFIE_MSK BIT(I2C_IER_RXFIE_POS)
+
+#define I2C_IER_TXTHIE_POS 4U
+#define I2C_IER_TXTHIE_MSK BIT(I2C_IER_TXTHIE_POS)
+
+#define I2C_IER_TXUDIE_POS 3U
+#define I2C_IER_TXUDIE_MSK BIT(I2C_IER_TXUDIE_POS)
+
+#define I2C_IER_TXOVIE_POS 2U
+#define I2C_IER_TXOVIE_MSK BIT(I2C_IER_TXOVIE_POS)
+
+#define I2C_IER_TXEIE_POS 0U
+#define I2C_IER_TXEIE_MSK BIT(I2C_IER_TXEIE_POS)
+
+/****************** Bit definition for I2C_IDR register ************************/
+
+#define I2C_IDR_ALERTID_POS 20U
+#define I2C_IDR_ALERTID_MSK BIT(I2C_IDR_ALERTID_POS)
+
+#define I2C_IDR_TOUTID_POS 19U
+#define I2C_IDR_TOUTID_MSK BIT(I2C_IDR_TOUTID_POS)
+
+#define I2C_IDR_PECEID_POS 18U
+#define I2C_IDR_PECEID_MSK BIT(I2C_IDR_PECEID_POS)
+
+#define I2C_IDR_ARLOID_POS 17U
+#define I2C_IDR_ARLOID_MSK BIT(I2C_IDR_ARLOID_POS)
+
+#define I2C_IDR_BERRID_POS 16U
+#define I2C_IDR_BERRID_MSK BIT(I2C_IDR_BERRID_POS)
+
+#define I2C_IDR_STOPID_POS 14U
+#define I2C_IDR_STOPID_MSK BIT(I2C_IDR_STOPID_POS)
+
+#define I2C_IDR_NACKID_POS 13U
+#define I2C_IDR_NACKID_MSK BIT(I2C_IDR_NACKID_POS)
+
+#define I2C_IDR_ADDRID_POS 12U
+#define I2C_IDR_ADDRID_MSK BIT(I2C_IDR_ADDRID_POS)
+
+#define I2C_IDR_TCRID_POS 11U
+#define I2C_IDR_TCRID_MSK BIT(I2C_IDR_TCRID_POS)
+
+#define I2C_IDR_TCID_POS 10U
+#define I2C_IDR_TCID_MSK BIT(I2C_IDR_TCID_POS)
+
+#define I2C_IDR_RXTHID_POS 9U
+#define I2C_IDR_RXTHID_MSK BIT(I2C_IDR_RXTHID_POS)
+
+#define I2C_IDR_RXUDID_POS 8U
+#define I2C_IDR_RXUDID_MSK BIT(I2C_IDR_RXUDID_POS)
+
+#define I2C_IDR_RXOVID_POS 7U
+#define I2C_IDR_RXOVID_MSK BIT(I2C_IDR_RXOVID_POS)
+
+#define I2C_IDR_RXFID_POS 6U
+#define I2C_IDR_RXFID_MSK BIT(I2C_IDR_RXFID_POS)
+
+#define I2C_IDR_TXTHID_POS 4U
+#define I2C_IDR_TXTHID_MSK BIT(I2C_IDR_TXTHID_POS)
+
+#define I2C_IDR_TXUDID_POS 3U
+#define I2C_IDR_TXUDID_MSK BIT(I2C_IDR_TXUDID_POS)
+
+#define I2C_IDR_TXOVID_POS 2U
+#define I2C_IDR_TXOVID_MSK BIT(I2C_IDR_TXOVID_POS)
+
+#define I2C_IDR_TXEID_POS 0U
+#define I2C_IDR_TXEID_MSK BIT(I2C_IDR_TXEID_POS)
+
+/****************** Bit definition for I2C_IVS register ************************/
+
+#define I2C_IVS_ALERTIV_POS 20U
+#define I2C_IVS_ALERTIV_MSK BIT(I2C_IVS_ALERTIV_POS)
+
+#define I2C_IVS_TOUTIV_POS 19U
+#define I2C_IVS_TOUTIV_MSK BIT(I2C_IVS_TOUTIV_POS)
+
+#define I2C_IVS_PECEIV_POS 18U
+#define I2C_IVS_PECEIV_MSK BIT(I2C_IVS_PECEIV_POS)
+
+#define I2C_IVS_ARLOIV_POS 17U
+#define I2C_IVS_ARLOIV_MSK BIT(I2C_IVS_ARLOIV_POS)
+
+#define I2C_IVS_BERRIV_POS 16U
+#define I2C_IVS_BERRIV_MSK BIT(I2C_IVS_BERRIV_POS)
+
+#define I2C_IVS_STOPIV_POS 14U
+#define I2C_IVS_STOPIV_MSK BIT(I2C_IVS_STOPIV_POS)
+
+#define I2C_IVS_NACKIV_POS 13U
+#define I2C_IVS_NACKIV_MSK BIT(I2C_IVS_NACKIV_POS)
+
+#define I2C_IVS_ADDRIV_POS 12U
+#define I2C_IVS_ADDRIV_MSK BIT(I2C_IVS_ADDRIV_POS)
+
+#define I2C_IVS_TCRIV_POS 11U
+#define I2C_IVS_TCRIV_MSK BIT(I2C_IVS_TCRIV_POS)
+
+#define I2C_IVS_TCIV_POS 10U
+#define I2C_IVS_TCIV_MSK BIT(I2C_IVS_TCIV_POS)
+
+#define I2C_IVS_RXTHIV_POS 9U
+#define I2C_IVS_RXTHIV_MSK BIT(I2C_IVS_RXTHIV_POS)
+
+#define I2C_IVS_RXUDIV_POS 8U
+#define I2C_IVS_RXUDIV_MSK BIT(I2C_IVS_RXUDIV_POS)
+
+#define I2C_IVS_RXOVIV_POS 7U
+#define I2C_IVS_RXOVIV_MSK BIT(I2C_IVS_RXOVIV_POS)
+
+#define I2C_IVS_RXFIV_POS 6U
+#define I2C_IVS_RXFIV_MSK BIT(I2C_IVS_RXFIV_POS)
+
+#define I2C_IVS_TXTHIV_POS 4U
+#define I2C_IVS_TXTHIV_MSK BIT(I2C_IVS_TXTHIV_POS)
+
+#define I2C_IVS_TXUDIV_POS 3U
+#define I2C_IVS_TXUDIV_MSK BIT(I2C_IVS_TXUDIV_POS)
+
+#define I2C_IVS_TXOVIV_POS 2U
+#define I2C_IVS_TXOVIV_MSK BIT(I2C_IVS_TXOVIV_POS)
+
+#define I2C_IVS_TXEIV_POS 0U
+#define I2C_IVS_TXEIV_MSK BIT(I2C_IVS_TXEIV_POS)
+
+/****************** Bit definition for I2C_RIF register ************************/
+
+#define I2C_RIF_ALERTRI_POS 20U
+#define I2C_RIF_ALERTRI_MSK BIT(I2C_RIF_ALERTRI_POS)
+
+#define I2C_RIF_TOUTRI_POS 19U
+#define I2C_RIF_TOUTRI_MSK BIT(I2C_RIF_TOUTRI_POS)
+
+#define I2C_RIF_PECERI_POS 18U
+#define I2C_RIF_PECERI_MSK BIT(I2C_RIF_PECERI_POS)
+
+#define I2C_RIF_ARLORI_POS 17U
+#define I2C_RIF_ARLORI_MSK BIT(I2C_RIF_ARLORI_POS)
+
+#define I2C_RIF_BERRRI_POS 16U
+#define I2C_RIF_BERRRI_MSK BIT(I2C_RIF_BERRRI_POS)
+
+#define I2C_RIF_STOPRI_POS 14U
+#define I2C_RIF_STOPRI_MSK BIT(I2C_RIF_STOPRI_POS)
+
+#define I2C_RIF_NACKRI_POS 13U
+#define I2C_RIF_NACKRI_MSK BIT(I2C_RIF_NACKRI_POS)
+
+#define I2C_RIF_ADDRRI_POS 12U
+#define I2C_RIF_ADDRRI_MSK BIT(I2C_RIF_ADDRRI_POS)
+
+#define I2C_RIF_TCRRI_POS 11U
+#define I2C_RIF_TCRRI_MSK BIT(I2C_RIF_TCRRI_POS)
+
+#define I2C_RIF_TCRI_POS 10U
+#define I2C_RIF_TCRI_MSK BIT(I2C_RIF_TCRI_POS)
+
+#define I2C_RIF_RXTHRI_POS 9U
+#define I2C_RIF_RXTHRI_MSK BIT(I2C_RIF_RXTHRI_POS)
+
+#define I2C_RIF_RXUDRI_POS 8U
+#define I2C_RIF_RXUDRI_MSK BIT(I2C_RIF_RXUDRI_POS)
+
+#define I2C_RIF_RXOVRI_POS 7U
+#define I2C_RIF_RXOVRI_MSK BIT(I2C_RIF_RXOVRI_POS)
+
+#define I2C_RIF_RXFRI_POS 6U
+#define I2C_RIF_RXFRI_MSK BIT(I2C_RIF_RXFRI_POS)
+
+#define I2C_RIF_TXTHRI_POS 4U
+#define I2C_RIF_TXTHRI_MSK BIT(I2C_RIF_TXTHRI_POS)
+
+#define I2C_RIF_TXUDRI_POS 3U
+#define I2C_RIF_TXUDRI_MSK BIT(I2C_RIF_TXUDRI_POS)
+
+#define I2C_RIF_TXOVRI_POS 2U
+#define I2C_RIF_TXOVRI_MSK BIT(I2C_RIF_TXOVRI_POS)
+
+#define I2C_RIF_TXERI_POS 0U
+#define I2C_RIF_TXERI_MSK BIT(I2C_RIF_TXERI_POS)
+
+/****************** Bit definition for I2C_IFM register ************************/
+
+#define I2C_IFM_ALERTFM_POS 20U
+#define I2C_IFM_ALERTFM_MSK BIT(I2C_IFM_ALERTFM_POS)
+
+#define I2C_IFM_TOUTFM_POS 19U
+#define I2C_IFM_TOUTFM_MSK BIT(I2C_IFM_TOUTFM_POS)
+
+#define I2C_IFM_PECEFM_POS 18U
+#define I2C_IFM_PECEFM_MSK BIT(I2C_IFM_PECEFM_POS)
+
+#define I2C_IFM_ARLOFM_POS 17U
+#define I2C_IFM_ARLOFM_MSK BIT(I2C_IFM_ARLOFM_POS)
+
+#define I2C_IFM_BERRFM_POS 16U
+#define I2C_IFM_BERRFM_MSK BIT(I2C_IFM_BERRFM_POS)
+
+#define I2C_IFM_STOPFM_POS 14U
+#define I2C_IFM_STOPFM_MSK BIT(I2C_IFM_STOPFM_POS)
+
+#define I2C_IFM_NACKFM_POS 13U
+#define I2C_IFM_NACKFM_MSK BIT(I2C_IFM_NACKFM_POS)
+
+#define I2C_IFM_ADDRFM_POS 12U
+#define I2C_IFM_ADDRFM_MSK BIT(I2C_IFM_ADDRFM_POS)
+
+#define I2C_IFM_TCRFM_POS 11U
+#define I2C_IFM_TCRFM_MSK BIT(I2C_IFM_TCRFM_POS)
+
+#define I2C_IFM_TCFM_POS 10U
+#define I2C_IFM_TCFM_MSK BIT(I2C_IFM_TCFM_POS)
+
+#define I2C_IFM_RXTHFM_POS 9U
+#define I2C_IFM_RXTHFM_MSK BIT(I2C_IFM_RXTHFM_POS)
+
+#define I2C_IFM_RXUDFM_POS 8U
+#define I2C_IFM_RXUDFM_MSK BIT(I2C_IFM_RXUDFM_POS)
+
+#define I2C_IFM_RXOVFM_POS 7U
+#define I2C_IFM_RXOVFM_MSK BIT(I2C_IFM_RXOVFM_POS)
+
+#define I2C_IFM_RXFFM_POS 6U
+#define I2C_IFM_RXFFM_MSK BIT(I2C_IFM_RXFFM_POS)
+
+#define I2C_IFM_TXTHFM_POS 4U
+#define I2C_IFM_TXTHFM_MSK BIT(I2C_IFM_TXTHFM_POS)
+
+#define I2C_IFM_TXUDFM_POS 3U
+#define I2C_IFM_TXUDFM_MSK BIT(I2C_IFM_TXUDFM_POS)
+
+#define I2C_IFM_TXOVFM_POS 2U
+#define I2C_IFM_TXOVFM_MSK BIT(I2C_IFM_TXOVFM_POS)
+
+#define I2C_IFM_TXEFM_POS 0U
+#define I2C_IFM_TXEFM_MSK BIT(I2C_IFM_TXEFM_POS)
+
+/****************** Bit definition for I2C_ICR register ************************/
+
+#define I2C_ICR_ALERTIC_POS 20U
+#define I2C_ICR_ALERTIC_MSK BIT(I2C_ICR_ALERTIC_POS)
+
+#define I2C_ICR_TOUTIC_POS 19U
+#define I2C_ICR_TOUTIC_MSK BIT(I2C_ICR_TOUTIC_POS)
+
+#define I2C_ICR_PECEIC_POS 18U
+#define I2C_ICR_PECEIC_MSK BIT(I2C_ICR_PECEIC_POS)
+
+#define I2C_ICR_ARLOIC_POS 17U
+#define I2C_ICR_ARLOIC_MSK BIT(I2C_ICR_ARLOIC_POS)
+
+#define I2C_ICR_BERRIC_POS 16U
+#define I2C_ICR_BERRIC_MSK BIT(I2C_ICR_BERRIC_POS)
+
+#define I2C_ICR_STOPIC_POS 14U
+#define I2C_ICR_STOPIC_MSK BIT(I2C_ICR_STOPIC_POS)
+
+#define I2C_ICR_NACKIC_POS 13U
+#define I2C_ICR_NACKIC_MSK BIT(I2C_ICR_NACKIC_POS)
+
+#define I2C_ICR_ADDRIC_POS 12U
+#define I2C_ICR_ADDRIC_MSK BIT(I2C_ICR_ADDRIC_POS)
+
+#define I2C_ICR_TCRIC_POS 11U
+#define I2C_ICR_TCRIC_MSK BIT(I2C_ICR_TCRIC_POS)
+
+#define I2C_ICR_TCIC_POS 10U
+#define I2C_ICR_TCIC_MSK BIT(I2C_ICR_TCIC_POS)
+
+#define I2C_ICR_RXTHIC_POS 9U
+#define I2C_ICR_RXTHIC_MSK BIT(I2C_ICR_RXTHIC_POS)
+
+#define I2C_ICR_RXUDIC_POS 8U
+#define I2C_ICR_RXUDIC_MSK BIT(I2C_ICR_RXUDIC_POS)
+
+#define I2C_ICR_RXOVIC_POS 7U
+#define I2C_ICR_RXOVIC_MSK BIT(I2C_ICR_RXOVIC_POS)
+
+#define I2C_ICR_RXFIC_POS 6U
+#define I2C_ICR_RXFIC_MSK BIT(I2C_ICR_RXFIC_POS)
+
+#define I2C_ICR_TXTHIC_POS 4U
+#define I2C_ICR_TXTHIC_MSK BIT(I2C_ICR_TXTHIC_POS)
+
+#define I2C_ICR_TXUDIC_POS 3U
+#define I2C_ICR_TXUDIC_MSK BIT(I2C_ICR_TXUDIC_POS)
+
+#define I2C_ICR_TXOVIC_POS 2U
+#define I2C_ICR_TXOVIC_MSK BIT(I2C_ICR_TXOVIC_POS)
+
+#define I2C_ICR_TXEIC_POS 0U
+#define I2C_ICR_TXEIC_MSK BIT(I2C_ICR_TXEIC_POS)
+
+typedef struct
+{
+ __IO uint32_t CON1;
+ __IO uint32_t CON2;
+ __IO uint32_t ADDR1;
+ __IO uint32_t ADDR2;
+ __IO uint32_t TIMINGR;
+ __IO uint32_t TIMEOUTR;
+ __I uint32_t STAT;
+ __IO uint32_t FCON;
+ __I uint32_t PECR;
+ __I uint32_t RXDATA;
+ __O uint32_t TXDATA;
+ __O uint32_t IER;
+ __O uint32_t IDR;
+ __I uint32_t IVS;
+ __I uint32_t RIF;
+ __I uint32_t IFM;
+ __O uint32_t ICR;
+} I2C_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_iwdg.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_iwdg.h
new file mode 100644
index 0000000000000000000000000000000000000000..a5c657c89a200c9a6ab8be6ae356e261aefe558b
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_iwdg.h
@@ -0,0 +1,73 @@
+/**
+ **************************************************************************************
+ * @file reg_IWDG.h
+ * @brief IWDG Head File
+ *
+ * @version V1.00.01
+ * @data 19/10/2018
+ * @author Eastsoft AE Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __IWDG_H__
+#define __IWDG_H__
+
+typedef struct
+{
+ __O uint32_t KR ; /* 0x00 IWDG_KR - Key register */
+ __IO uint32_t PR ; /* 0x04 IWDG_PR - Prescaler register */
+ __IO uint32_t RLR ; /* 0x08 IWDG_RLR - Reload register */
+ __I uint32_t FR ; /* 0x0C IWDG_SR - Status register */
+ __IO uint32_t WINR; /* 0x10 IWDG_WINR - Window register */
+} IWDG_TypeDef;
+
+/******************************************************************************/
+/* Ȧs줸wq */
+/******************************************************************************/
+
+/* #pragma anon_unions */
+
+/****************** Bit definition for IWDG_KR register ************************/
+
+#define IWDG_KR_KEY_POSS 0U
+#define IWDG_KR_KEY_POSE 15U
+#define IWDG_KR_KEY_MSK BITS(IWDG_KR_KEY_POSS,IWDG_KR_KEY_POSE)
+
+/****************** Bit definition for IWDG_PR register ************************/
+
+#define IWDG_PR_PR_POSS 0U
+#define IWDG_PR_PR_POSE 2U
+#define IWDG_PR_PR_MSK BITS(IWDG_PR_PR_POSS,IWDG_PR_PR_POSE)
+
+/****************** Bit definition for IWDG_RLR register ************************/
+
+#define IWDG_RLR_RL_POSS 0U
+#define IWDG_RLR_RL_POSE 12U
+#define IWDG_RLR_RL_MSK BITS(IWDG_RLR_RL_POSS,IWDG_RLR_RL_POSE)
+
+/****************** Bit definition for IWDG_FR register ************************/
+
+#define IWDG_FR_BUSY_POS 15U
+#define IWDG_FR_BUSY_MSK BIT(IWDG_FR_BUSY_POS)
+
+#define IWDG_FR_STR_POS 12U
+#define IWDG_FR_STR_MSK BIT(IWDG_FR_STR_POS)
+
+#define IWDG_FR_CNT_POSS 0U
+#define IWDG_FR_CNT_POSE 11U
+#define IWDG_FR_CNT_MSK BITS(IWDG_FR_CNT_POSS,IWDG_FR_CNT_POSE)
+
+/****************** Bit definition for IWDG_WINR register ************************/
+
+#define IWDG_WINR_WIN_POSS 0U
+#define IWDG_WINR_WIN_POSE 31U
+#define IWDG_WINR_WIN_MSK BITS(IWDG_WINR_WIN_POSS,IWDG_WINR_WIN_POSE)
+
+
+#else
+/* */
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mcm.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mcm.h
new file mode 100644
index 0000000000000000000000000000000000000000..ebb675dafe20efdc33ca6bb903ee45352c59c7f3
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mcm.h
@@ -0,0 +1,211 @@
+/**
+ **************************************************************************************
+ * @file reg_MCM.h
+ * @brief MCM Head File
+ *
+ * @version V1.00.01
+ * @data 19/10/2018
+ * @author Eastsoft AE Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __MCM_H__
+#define __MCM_H__
+
+typedef struct
+{
+ __IO uint32_t RAMP_INI; // 0x00 MCM Ramp Generator Initialization Register
+ __IO uint32_t RAMP_IDATA; // 0x04 MCM Ramp Generator Initial Data Register
+ __IO uint32_t RAMP_DIV; // 0x08 MCM Ramp Clock Divider Register
+ __IO uint32_t RAMP_SCALE; // 0x0C MCM Ramp Generator Output Scale Register
+ __IO uint32_t RAMP_STEP; // 0x10 MCM Step Increment of the Ramp Output Register
+ __IO uint32_t RAMP_SET; // 0x14 MCM Ramp Generator Reference Data Register
+ __IO uint32_t RAMP_EN; // 0x18 MCM Ramp Generator Enable Register
+ __I uint32_t RAMP_DO; // 0x1C MCM Ramp Generator Output Register
+ __IO uint32_t RMAP_CON; // 0x20 MCM Connect Ramp Generator to PI control Register
+ __IO uint32_t IX_UPD; // 0x24 MCM Inverse Transform Update Register
+ __IO uint32_t IX_VQ; // 0x28 MCM Inverse Park Transform Vq Input Register
+ __IO uint32_t IX_VD; // 0x2C MCM Inverse Park Transform Vd Input Register
+ __I uint32_t IX_VA; // 0x30 MCM Inverse Clarke Transform Va Output Register
+ __I uint32_t IX_VB; // 0x34 MCM Inverse Clarke Transform Vb Output Register
+ __I uint32_t IX_VC; // 0x38 MCM Inverse Clarke Transform Vc Output Register
+ __I uint32_t IX_VALPHA; // 0x3C MCM Inverse Clarke Transform Valpha Output Register
+ __I uint32_t IX_VBETA; // 0x40 MCM Inverse Clarke Transform Vbeta Output Register
+ __I uint32_t IX_SVMVA; // 0x44 MCM Inverse Clarke Transform SVPWM Va Output Register
+ __I uint32_t IX_SVMVB; // 0x48 MCM Inverse Clarke Transform SVPWM Vb Output Register
+ __I uint32_t IX_SVMVC; // 0x4C MCM Inverse Clarke Transform SVPWM Vc Output Register
+ __I uint32_t IX_DONE; // 0x50 MCM Inverse Transform Processing Status Register
+ __I uint32_t IX_SDONE; // 0x54 MCM Inverse SVPWM Process Status Register
+ __IO uint32_t IX_CON; // 0x58 MCM Connect PI Control To The Inverse Transform Register
+ __IO uint32_t IX_NORMAL; // 0x5C MCM Normal Clarke Inverse Transform Register
+ __IO uint32_t X_UPD; // 0x60 MCM Transform Function Update Register
+ __IO uint32_t X_IA; // 0x64 MCM Clarke Transform Ia Input Register
+ __IO uint32_t X_IB; // 0x68 MCM Clarke Transform Ib Input Register
+ __IO uint32_t X_IC; // 0x6C MCM Clarke Transform Ic Input Register
+ __I uint32_t X_IALPHA; // 0x70 MCM Clarke Transform Ialpha Output Register
+ __I uint32_t X_IBETA; // 0x74 MCM Clarke Transform Ibeta Output Register
+ __I uint32_t X_ID; // 0x78 MCM Park Transform Id Output Register
+ __I uint32_t X_IQ; // 0x7C MCM Park Transform Iq Output Register
+ __I uint32_t X_DONE; // 0x80 MCM Transform Process Status Register
+ __IO uint32_t X_CON; // 0x84 MCM Forward Transform Input Source Selection Register
+ uint32_t REV88; // 0x88 RESERVED
+ __IO uint32_t PI0_UPD; // 0x8C MCM PI Control 0 Update Register
+ __IO uint32_t PI0_INI; // 0x90 MCM Initialize PI Control 0 Register
+ __IO uint32_t PI0_IDATA; // 0x94 MCM PI Control 0 Initial Data Register
+ __IO uint32_t PI0_ELIMIT; // 0x98 MCM PI Control 0 Error Limit Register
+ __IO uint32_t PI0_KP; // 0x9C MCM PI Control 0 Kp Coefficient Register
+ __IO uint32_t PI0_KI; // 0xA0 MCM PI Control 0 Ki Coefficient Register
+ __IO uint32_t PI0_REF; // 0xA4 MCM PI Control 0 Reference Value Register
+ __IO uint32_t PI0_ACTUAL; // 0xA8 MCM PI Control 0 Actual Value Register
+ __IO uint32_t PI0_MIN; // 0xAC MCM PI Control 0 Minimum Output Register
+ __IO uint32_t PI0_MAX; // 0xB0 MCM PI Control 0 Maximum Output Register
+ __I uint32_t PI0_DO; // 0xB4 MCM PI Control 0 Data Out Register
+ __IO uint32_t PI0_OSCALE; // 0xB8 MCM PI Control 0 Data Output Scale Register
+ __I uint32_t PI_DONE; // 0xBC MCM PI Control Processing Status Register
+ __IO uint32_t PI1_UPD; // 0xC0 MCM PI Control 1 Update Register
+ __IO uint32_t PI1_INI; // 0xC4 MCM Initialize PI Control 1 Register
+ __IO uint32_t PI1_IDATA; // 0xC8 MCM PI Control 1 Initial Data Register
+ __IO uint32_t PI1_ELIMIT; // 0xCC MCM PI Control 1 Error Limit Register
+ __IO uint32_t PI1_KP; // 0xD0 MCM PI Control 1 Kp Coefficient Register
+ __IO uint32_t PI1_KI; // 0xD4 MCM PI Control 1 Ki Coefficient Register
+ __IO uint32_t PI1_REF; // 0xD8 MCM PI Control 1 Reference Value Register
+ __IO uint32_t PI1_ACTUAL; // 0xDC MCM PI Control 1 Actual Value Register
+ __IO uint32_t PI1_MIN; // 0xE0 MCM PI Control 1 Minimum Output Register
+ __IO uint32_t PI1_MAX; // 0xE4 MCM PI Control 1 Maximum Output Register
+ __I uint32_t PI1_DO; // 0xE8 MCM PI Control 1 Data Out Register
+ __IO uint32_t PI1_OSCALE; // 0xEC MCM PI Control 1 Data Output Scale Register
+ __IO uint32_t PI2_UPD; // 0xF0 MCM PI Control 2 Update Register
+ __IO uint32_t PI2_INI; // 0xF4 MCM Initialize PI Control 2 Register
+ __IO uint32_t PI2_IDATA; // 0xF8 MCM PI Control 2 Initial Data Register
+ __IO uint32_t PI2_ELIMIT; // 0xFC MCM PI Control 2 Error Limit Register
+ __IO uint32_t PI2_KP; // 0x100 MCM PI Control 2 Kp Coefficient Register
+ __IO uint32_t PI2_KI; // 0x104 MCM PI Control 2 Ki Coefficient Register
+ __IO uint32_t PI2_REF; // 0x108 MCM PI Control 2 Reference Value Register
+ __IO uint32_t PI2_ACTUAL; // 0x10C MCM PI Control 2 Actual Value Register
+ __IO uint32_t PI2_MIN; // 0x110 MCM PI Control 2 Minimum Output Register
+ __IO uint32_t PI2_MAX; // 0x114 MCM PI Control 2 Maximum Output Register
+ __I uint32_t PI2_DO; // 0x118 MCM PI Control 2 Data Out Register
+ __IO uint32_t PI2_OSCALE; // 0x11C MCM PI Control 2 Data Output Scale Register
+ __IO uint32_t COR_START; // 0x120 MCM Start CORDIC Calculation Register
+ __IO uint32_t COR_X; // 0x124 MCM CORDIC X Input Register
+ __IO uint32_t COR_Y; // 0x128 MCM CORDIC Y Input Register
+ __I uint32_t COR_RES; // 0x12C MCM CORDIC Result Register
+ __I uint32_t COR_DONE; // 0x130 MCM CORDIC Processing Status Register
+ __IO uint32_t COR_CON; // 0x134 MCM CORDIC Input Selection Register
+ uint32_t REV138; // 0x138 RESERVED
+ uint32_t REV13C; // 0x13C RESERVED
+ __IO uint32_t LPFA_INI; // 0x140 MCM LPF A Channel Initialize Register
+ __IO uint32_t LPFA_UPD; // 0x144 MCM LPF A Channel Update Register
+ __IO uint32_t LPFA_DIN; // 0x148 MCM LPF A Input Register
+ __IO uint32_t LPFA_A0; // 0x14C MCM LPF A a0 Coefficient Register
+ __IO uint32_t LPFA_B0; // 0x150 MCM LPF A b0 Coefficient Register
+ __IO uint32_t LPFA_B1; // 0x154 MCM LPF A b1 Coefficient Register
+
+ __IO uint32_t LPFA_A0SCALE; // 0x158 MCM LPF A a0 Coefficient Scale Register
+ __IO uint32_t LPFA_B0SCALE; // 0x15C MCM LPF A b0 Coefficient Scale Register
+ __IO uint32_t LPFA_B1SCALE; // 0x160 MCM LPF A b1 Coefficient Scale Register
+
+ __I uint32_t LPFA_DO; // 0x164 MCM LPF A Data Output Register
+ __I uint32_t LPFA_DONE; // 0x168 MCM LPF A Process Status Register
+ __IO uint32_t LPFB_INI; // 0x16C MCM LPF B Channel Initialize Register
+ __IO uint32_t LPFB_UPD; // 0x170 MCM LPF B Channel Update Register
+ __IO uint32_t LPFB_DIN; // 0x174 MCM LPF B Input Register
+ __IO uint32_t LPFB_A0; // 0x178 MCM LPF B a0 Coefficient Register
+ __IO uint32_t LPFB_B0; // 0x17C MCM LPF B b0 Coefficient Register
+ __IO uint32_t LPFB_B1; // 0x180 MCM LPF B b1 Coefficient Register
+
+ __IO uint32_t LPFB_A0SCALE; // 0x184 MCM LPF B a0 Coefficient Scale Register
+ __IO uint32_t LPFB_B0SCALE; // 0x188 MCM LPF B b0 Coefficient Scale Register
+ __IO uint32_t LPFB_B1SCALE; // 0x18C MCM LPF B b1 Coefficient Scale Register
+
+ __I uint32_t LPFB_DO; // 0x190 MCM LPF B Data Output Register
+ __I uint32_t LPFB_DONE; // 0x194 MCM LPF B Process Status Register
+ __IO uint32_t LPFC_INI; // 0x198 MCM LPF C Channel Initialize Register
+ __IO uint32_t LPFC_UPD; // 0x19C MCM LPF C Channel Update Register
+ __IO uint32_t LPFC_DIN; // 0x1A0 MCM LPF C Input Register
+ __IO uint32_t LPFC_A0; // 0x1A4 MCM LPF C a0 Coefficient Register
+ __IO uint32_t LPFC_B0; // 0x1A8 MCM LPF C b0 Coefficient Register
+ __IO uint32_t LPFC_B1; // 0x1AC MCM LPF C b1 Coefficient Register
+
+ __IO uint32_t LPFC_A0SCALE; // 0x1B0 MCM LPF C a0 Coefficient Scale Register
+ __IO uint32_t LPFC_B0SCALE; // 0x1B4 MCM LPF C b0 Coefficient Scale Register
+ __IO uint32_t LPFC_B1SCALE; // 0x1B8 MCM LPF C b1 Coefficient Scale Register
+
+ __I uint32_t LPFC_DO; // 0x1BC MCM LPF C Data Output Register
+ __I uint32_t LPFC_DONE; // 0x1C0 MCM LPF C Process Status Register
+ __IO uint32_t GL_UPD; // 0x1C4 MCM Global Update Register
+ __IO uint32_t GL_STAT; // 0x1C8 MCM Global Status Register
+ __IO uint32_t THETA_SIN; // 0x1CC MCM Sine Angle Register
+ __IO uint32_t THETA_COS; // 0x1D0 MCM Cosine Angle Register
+ __IO uint32_t PI_TYPE; // 0x1D4 MCM PI Control Type Register
+ __IO uint32_t MOTOR_DIR; // 0x1D8 MCM Motor Direction Register
+ __I uint32_t MCM_VER; // 0x1DC MCM Version Register
+ __IO uint32_t SMC_UPD; // 0x1E0 MCM Slide Mode Controller Update Register
+ __IO uint32_t SMC_INI; // 0x1E4 MCM Slide Mode Controller Initialization Register
+ __IO uint32_t SMC_ALPHAINI; // 0x1E8 MCM Slide Mode Controller Alpha Initial Data Register
+ __IO uint32_t SMC_BETAINI; // 0x1EC MCM Slide Mode Controller Beta Initial Data Register
+ __IO uint32_t SMC_A0; // 0x1F0 MCM Slide Mode Controller Dynamic LPF coefficient Register
+ __IO uint32_t SMC_ELIMIT; // 0x1F4 MCM Slide Mode Controller Error Limit Register
+ __IO uint32_t SMC_KSLIDE; // 0x1F8 MCM Slide Mode Controller Z Factor Error Amplification Register
+ __I uint32_t SMC_DONE; // 0x1FC MCM Slide Mode Controller Process Status Register
+ __IO uint32_t SMC_IEALPHA; // 0x200 MCM SMC Estimated Current Alpha Register
+ __IO uint32_t SMC_IEBETA; // 0x204 MCM SMC Estimated Current Beta Register
+ __IO uint32_t SMC_IALPHA; // 0x208 MCM SMC Measured Current Alpha Register
+ __IO uint32_t SMC_IBETA; // 0x20C MCM SMC Measured Current Beta Register
+ __IO uint32_t SMC_DISI; // 0x210 MCM SMC Estimated Current Input Selection Register
+ __I uint32_t SMC_ZALPHA; // 0x214 MCM SMC Z Factor Alpha Register
+ __I uint32_t SMC_ZBETA; // 0x218 MCM SMC Z Factor Beta Register
+ __I uint32_t SMC_BEMF1A; // 0x21C MCM SMC Estimated BEMF Alpha Register
+ __I uint32_t SMC_BEMF1B; // 0x220 MCM SMC Estimated BEMF Beta Register
+ __I uint32_t SMC_BEMF2A; // 0x224 MCM SMC BEMF Filtered Alpha Register
+ __I uint32_t SMC_BEMF2B; // 0x228 MCM SMC BEMF Filtered Beta Register
+ __IO uint32_t SMC_LPFSCALE; // 0x22C MCM SMC LPF Coefficient Scale Factor Register
+ uint32_t REV230; // 0x230 RESERVED
+ __IO uint32_t VM_UPD; // 0x234 MCM Virtual Motor Update Register
+ __IO uint32_t VM_INI; // 0x238 MCM Virtual Motor Initialization Register
+ __IO uint32_t VM_ALPHAINI; // 0x23C MCM Virtual Motor Initial Data Alpha Register
+ __IO uint32_t VM_BETAINI; // 0x240 MCM Virtual Motor Initial Data Beta Register
+ __IO uint32_t VM_KF; // 0x244 MCM Virtual Motor F Constant Register
+ __IO uint32_t VM_KG; // 0x248 MCM Virtual Motor G Constant Register
+ __IO uint32_t VM_VALPHA; // 0x24C MCM Virtual Motor Voltage Vector Alpha Register
+ __IO uint32_t VM_VBETA; // 0x250 MCM Virtual Motor Voltage Vector BETA Register
+ __IO uint32_t VM_BEMFA; // 0x254 MCM Virtual Motor BEMF Vector Alpha Register
+ __IO uint32_t VM_BEMFB; // 0x258 MCM Virtual Motor BEMF Vector BETA Register
+ __IO uint32_t VM_ZALPHA; // 0x25C MCM Virtual Motor Z Vector Alpha Register
+ __IO uint32_t VM_ZBETA; // 0x260 MCM Virtual Motor Z Vector BETA Register
+ __IO uint32_t VM_DISZ; // 0x264 MCM Virtual Motor Z Factor Input Selection Register
+ __I uint32_t VM_DONE; // 0x268 MCM Virtual Motor Process Status Register
+ __I uint32_t VM_IEALPHA; // 0x26C MCM Virtual Motor Estimated IS Result Alpha Register
+ __I uint32_t VM_IEBETA; // 0x270 MCM Virtual Motor Estimated IS Result BETA Register
+ __IO uint32_t VM_CON; // 0x274 MCM Virtual Motor Connect Register
+
+ __IO uint32_t VM_KFSCALE; // 0x278 MCM Virtual Motor F Constant Scale Register
+ __IO uint32_t VM_KGSCALE; // 0x27C MCM Virtual Motor G Constant Scale Register
+ __IO uint32_t VM_CONVS; // 0x280 MCM Virtual Motor Voltage Connect Register
+
+ uint32_t REV284; // 0x284 RESERVED
+ __IO uint32_t SVM_UPD; // 0x288 MCM SVM Update Register
+ __IO uint32_t SVM_CON; // 0x28C MCM SVM Source Input Select Register
+ __IO uint32_t SVM_DINA; // 0x290 MCM SVM Phase A Register
+ __IO uint32_t SVM_DINB; // 0x294 MCM SVM Phase B Register
+ __IO uint32_t SVM_DINC; // 0x298 MCM SVM Phase C Register
+} MCM_TypeDef;
+
+/******************************************************************************/
+/* Ȧs줸wq */
+/******************************************************************************/
+
+/* #pragma anon_unions */
+
+/****************** Bit definition for WWDG_CR register ************************/
+
+
+
+
+#else
+/* */
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mswd.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mswd.h
new file mode 100644
index 0000000000000000000000000000000000000000..3a7d2f5dcf7ae1db494b2e6fb746d1ed20a096b6
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mswd.h
@@ -0,0 +1,58 @@
+/**
+ **************************************************************************************
+ * @file reg_MSWD.h
+ * @brief WWDG Head File
+ *
+ * @version V1.00.01
+ * @data 19/10/2018
+ * @author Eastsoft AE Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __MSWD_H__
+#define __MSWD_H__
+
+typedef struct
+{
+ __IO uint32_t CFG; // 0x00 SW_CFG Serial Wire Configure Register
+ __IO uint32_t JTAG2SWD; // 0x04 SW_JTAG2SW Serial Wire JTAG2SWD Register
+ __IO uint32_t LINERESET; // 0x08 SW_LINERESET Serial Wire LINERESET Resister
+ __O uint32_t STS; // 0x0C SW_STS Serial Wire STATUS Register
+ __IO uint32_t DP_IDR_ABORT; // 0x10 SW_DP_IDR_ABORT Serial Wire DP R-IDR W-ABORT Register
+ __IO uint32_t DP_CSR_WCR; // 0x14 SW_DP_CSR_WCR Serial Wire DP R-CSR W-WCR Register
+ __IO uint32_t DP_RESEND_SELECT; // 0x18 SW_DP_RESEND_SELECT Serial Wire DP R-RESEND W-SELECT Register
+ __IO uint32_t DP_RDBUF_ROUTESEL; // 0x1C SW_DP_RDBUF_ROUTESEL Serial Wire DP R-RDBUF W-ROUTESEL Register
+ __IO uint32_t AP_CSW; // 0x20 SW_AP_CSW Serial Wire AP CSW Register
+ __IO uint32_t AP_TAR; // 0x24 SW_AP_TAR Serial Wire AP TAR Register
+ __IO uint32_t AP_DRW; // 0x28 SW_AP_DRW Serial Wire AP DRW Register
+ __IO uint32_t AP_BD0; // 0x2C SW_AP_BD0 Serial Wire AP BD0 Register
+ __IO uint32_t AP_BD1; // 0x30 SW_AP_BD1 Serial Wire AP BD1 Register
+ __IO uint32_t AP_BD2; // 0x34 SW_AP_BD2 Serial Wire AP BD2 Register
+ __IO uint32_t AP_BD3; // 0x38 SW_AP_BD3 Serial Wire AP BD3 Register
+ __IO uint32_t AP_CFG; // 0x3C SW_AP_CFG Serial Wire AP CFG Register
+ __IO uint32_t AP_BASE; // 0x40 SW_AP_BASE Serial Wire AP BASE Register
+ __IO uint32_t AP_IDR; // 0x44 SW_AP_IDR Serial Wire AP IDR Register
+ uint32_t RES0; // 0x48
+ uint32_t RES1; // 0x4C
+ __IO uint32_t ISP_CMD; // 0x50 SW_ISP_CMD Serial Wire ISP Command Register
+ __IO uint32_t ISP_DAT; // 0x54 SW_ISP_DAT Serial Wire ISP Data Register
+} MSWD_TypeDef;
+
+/******************************************************************************/
+/* Ȧs줸wq */
+/******************************************************************************/
+
+/* #pragma anon_unions */
+
+/****************** Bit definition for WWDG_CR register ************************/
+
+
+
+
+#else
+/* */
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rcu.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rcu.h
new file mode 100644
index 0000000000000000000000000000000000000000..af6a59c419c117717c4c78a7b020e59a70d2461e
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rcu.h
@@ -0,0 +1,585 @@
+/**
+ **************************************************************************************
+ * @file REG_RCU.h
+ * @brief RCU Head File
+ *
+ * @version V0.01
+ * @date 12/5/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __RCU_H__
+#define __RCU_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for RCU_CON register ************************/
+
+#define RCU_CON_SWRDY_POS 24U
+#define RCU_CON_SWRDY_MSK BIT(RCU_CON_SWRDY_POS)
+
+#define RCU_CON_CSSFLG_POS 23U
+#define RCU_CON_CSSFLG_MSK BIT(RCU_CON_CSSFLG_POS)
+
+#define RCU_CON_PLL1RDY_POS 21U
+#define RCU_CON_PLL1RDY_MSK BIT(RCU_CON_PLL1RDY_POS)
+
+#define RCU_CON_PLL0RDY_POS 20U
+#define RCU_CON_PLL0RDY_MSK BIT(RCU_CON_PLL0RDY_POS)
+
+#define RCU_CON_LOSCRDY_POS 19U
+#define RCU_CON_LOSCRDY_MSK BIT(RCU_CON_LOSCRDY_POS)
+
+#define RCU_CON_LRCRDY_POS 18U
+#define RCU_CON_LRCRDY_MSK BIT(RCU_CON_LRCRDY_POS)
+
+#define RCU_CON_HOSCRDY_POS 17U
+#define RCU_CON_HOSCRDY_MSK BIT(RCU_CON_HOSCRDY_POS)
+
+#define RCU_CON_HRCRDY_POS 16U
+#define RCU_CON_HRCRDY_MSK BIT(RCU_CON_HRCRDY_POS)
+
+#define RCU_CON_CSSON_POS 7U
+#define RCU_CON_CSSON_MSK BIT(RCU_CON_CSSON_POS)
+
+#define RCU_CON_PLL1ON_POS 5U
+#define RCU_CON_PLL1ON_MSK BIT(RCU_CON_PLL1ON_POS)
+
+#define RCU_CON_PLL0ON_POS 4U
+#define RCU_CON_PLL0ON_MSK BIT(RCU_CON_PLL0ON_POS)
+
+#define RCU_CON_LOSCON_POS 3U
+#define RCU_CON_LOSCON_MSK BIT(RCU_CON_LOSCON_POS)
+
+#define RCU_CON_LRCON_POS 2U
+#define RCU_CON_LRCON_MSK BIT(RCU_CON_LRCON_POS)
+
+#define RCU_CON_HOSCON_POS 1U
+#define RCU_CON_HOSCON_MSK BIT(RCU_CON_HOSCON_POS)
+
+#define RCU_CON_HRCON_POS 0U
+#define RCU_CON_HRCON_MSK BIT(RCU_CON_HRCON_POS)
+
+/****************** Bit definition for RCU_CFG register ************************/
+
+#define RCU_CFG_CKCFG_POS 31U
+#define RCU_CFG_CKCFG_MSK BIT(RCU_CFG_CKCFG_POS)
+
+#define RCU_CFG_MPRE_POSS 28U
+#define RCU_CFG_MPRE_POSE 30U
+#define RCU_CFG_MPRE_MSK BITS(RCU_CFG_MPRE_POSS,RCU_CFG_MPRE_POSE)
+
+#define RCU_CFG_MSW_POSS 24U
+#define RCU_CFG_MSW_POSE 27U
+#define RCU_CFG_MSW_MSK BITS(RCU_CFG_MSW_POSS,RCU_CFG_MSW_POSE)
+
+#define RCU_CFG_PLLMUL_POSS 17U
+#define RCU_CFG_PLLMUL_POSE 21U
+#define RCU_CFG_PLLMUL_MSK BITS(RCU_CFG_PLLMUL_POSS,RCU_CFG_PLLMUL_POSE)
+
+#define RCU_CFG_PLLSRC_POS 16U
+#define RCU_CFG_PLLSRC_MSK BIT(RCU_CFG_PLLSRC_POS)
+
+#define RCU_CFG_HOSCDIV_POSS 12U
+#define RCU_CFG_HOSCDIV_POSE 14U
+#define RCU_CFG_HOSCDIV_MSK BITS(RCU_CFG_HOSCDIV_POSS,RCU_CFG_HOSCDIV_POSE)
+
+#define RCU_CFG_PPRE_POSS 8U
+#define RCU_CFG_PPRE_POSE 10U
+#define RCU_CFG_PPRE_MSK BITS(RCU_CFG_PPRE_POSS,RCU_CFG_PPRE_POSE)
+
+#define RCU_CFG_HPRE_POSS 4U
+#define RCU_CFG_HPRE_POSE 7U
+#define RCU_CFG_HPRE_MSK BITS(RCU_CFG_HPRE_POSS,RCU_CFG_HPRE_POSE)
+
+#define RCU_CFG_SW_POSS 0U
+#define RCU_CFG_SW_POSE 2U
+#define RCU_CFG_SW_MSK BITS(RCU_CFG_SW_POSS,RCU_CFG_SW_POSE)
+
+/****************** Bit definition for RCU_STCALIB register ************************/
+
+#define RCU_STCALIB_SKEW_POS 30U
+#define RCU_STCALIB_SKEW_MSK BIT(RCU_STCALIB_SKEW_POS)
+
+#define RCU_STCALIB_TENMS_POSS 0U
+#define RCU_STCALIB_TENMS_POSE 23U
+#define RCU_STCALIB_TENMS_MSK BITS(RCU_STCALIB_TENMS_POSS,RCU_STCALIB_TENMS_POSE)
+
+/****************** Bit definition for RCU_PSCK register ************************/
+
+#define RCU_PSCK_I2S2CKSL_POSS 2U
+#define RCU_PSCK_I2S2CKSL_POSE 3U
+#define RCU_PSCK_I2S2CKSL_MSK BITS(RCU_PSCK_I2S2CKSL_POSS,RCU_PSCK_I2S2CKSL_POSE)
+
+#define RCU_PSCK_I2S1CKSL_POSS 0U
+#define RCU_PSCK_I2S1CKSL_POSE 1U
+#define RCU_PSCK_I2S1CKSL_MSK BITS(RCU_PSCK_I2S1CKSL_POSS,RCU_PSCK_I2S1CKSL_POSE)
+
+/****************** Bit definition for RCU_AHBRST register ************************/
+
+#define RCU_AHBRST_GPDEN_POS 19U
+#define RCU_AHBRST_GPDEN_MSK BIT(RCU_AHBRST_GPDEN_POS)
+
+#define RCU_AHBRST_GPCEN_POS 18U
+#define RCU_AHBRST_GPCEN_MSK BIT(RCU_AHBRST_GPCEN_POS)
+
+#define RCU_AHBRST_GPBEN_POS 17U
+#define RCU_AHBRST_GPBEN_MSK BIT(RCU_AHBRST_GPBEN_POS)
+
+#define RCU_AHBRST_GPAEN_POS 16U
+#define RCU_AHBRST_GPAEN_MSK BIT(RCU_AHBRST_GPAEN_POS)
+
+#define RCU_AHBRST_HDIVEN_POS 15U
+#define RCU_AHBRST_HDIVEN_MSK BIT(RCU_AHBRST_HDIVEN_POS)
+
+#define RCU_AHBRST_USBEN_POS 14U
+#define RCU_AHBRST_USBEN_MSK BIT(RCU_AHBRST_USBEN_POS)
+
+#define RCU_AHBRST_AESEN_POS 13U
+#define RCU_AHBRST_AESEN_MSK BIT(RCU_AHBRST_AESEN_POS)
+
+#define RCU_AHBRST_CRCEN_POS 12U
+#define RCU_AHBRST_CRCEN_MSK BIT(RCU_AHBRST_CRCEN_POS)
+
+#define RCU_AHBRST_RTCEN_POS 6U
+#define RCU_AHBRST_RTCEN_MSK BIT(RCU_AHBRST_RTCEN_POS)
+
+#define RCU_AHBRST_DMA1EN_POS 0U
+#define RCU_AHBRST_DMA1EN_MSK BIT(RCU_AHBRST_DMA1EN_POS)
+
+/****************** Bit definition for RCU_APB1RST register ************************/
+
+#define RCU_APB1RST_DACEN_POS 23U
+#define RCU_APB1RST_DACEN_MSK BIT(RCU_APB1RST_DACEN_POS)
+
+#define RCU_APB1RST_I2C2EN_POS 22U
+#define RCU_APB1RST_I2C2EN_MSK BIT(RCU_APB1RST_I2C2EN_POS)
+
+#define RCU_APB1RST_I2C1EN_POS 21U
+#define RCU_APB1RST_I2C1EN_MSK BIT(RCU_APB1RST_I2C1EN_POS)
+
+#define RCU_APB1RST_SUART2EN_POS 20U
+#define RCU_APB1RST_SUART2EN_MSK BIT(RCU_APB1RST_SUART2EN_POS)
+
+#define RCU_APB1RST_SUART1EN_POS 19U
+#define RCU_APB1RST_SUART1EN_MSK BIT(RCU_APB1RST_SUART1EN_POS)
+
+#define RCU_APB1RST_UART3EN_POS 18U
+#define RCU_APB1RST_UART3EN_MSK BIT(RCU_APB1RST_UART3EN_POS)
+
+#define RCU_APB1RST_UART2EN_POS 17U
+#define RCU_APB1RST_UART2EN_MSK BIT(RCU_APB1RST_UART2EN_POS)
+
+#define RCU_APB1RST_SPI2EN_POS 14U
+#define RCU_APB1RST_SPI2EN_MSK BIT(RCU_APB1RST_SPI2EN_POS)
+
+#define RCU_APB1RST_IWDTEN_POS 12U
+#define RCU_APB1RST_IWDTEN_MSK BIT(RCU_APB1RST_IWDTEN_POS)
+
+#define RCU_APB1RST_WWDTEN_POS 11U
+#define RCU_APB1RST_WWDTEN_MSK BIT(RCU_APB1RST_WWDTEN_POS)
+
+#define RCU_APB1RST_BS16T1EN_POS 4U
+#define RCU_APB1RST_BS16T1EN_MSK BIT(RCU_APB1RST_BS16T1EN_POS)
+
+#define RCU_APB1RST_GP16C4T3EN_POS 3U
+#define RCU_APB1RST_GP16C4T3EN_MSK BIT(RCU_APB1RST_GP16C4T3EN_POS)
+
+#define RCU_APB1RST_GP16C4T2EN_POS 2U
+#define RCU_APB1RST_GP16C4T2EN_MSK BIT(RCU_APB1RST_GP16C4T2EN_POS)
+
+#define RCU_APB1RST_GP16C4T1EN_POS 1U
+#define RCU_APB1RST_GP16C4T1EN_MSK BIT(RCU_APB1RST_GP16C4T1EN_POS)
+
+#define RCU_APB1RST_GP32C4T1EN_POS 0U
+#define RCU_APB1RST_GP32C4T1EN_MSK BIT(RCU_APB1RST_GP32C4T1EN_POS)
+
+/****************** Bit definition for RCU_APB2RST register ************************/
+
+#define RCU_APB2RST_CMPEN_POS 23U
+#define RCU_APB2RST_CMPEN_MSK BIT(RCU_APB2RST_CMPEN_POS)
+
+#define RCU_APB2RST_GP16C2T4EN_POS 19U
+#define RCU_APB2RST_GP16C2T4EN_MSK BIT(RCU_APB2RST_GP16C2T4EN_POS)
+
+#define RCU_APB2RST_GP16C2T3EN_POS 18U
+#define RCU_APB2RST_GP16C2T3EN_MSK BIT(RCU_APB2RST_GP16C2T3EN_POS)
+
+#define RCU_APB2RST_GP16C2T2EN_POS 17U
+#define RCU_APB2RST_GP16C2T2EN_MSK BIT(RCU_APB2RST_GP16C2T2EN_POS)
+
+#define RCU_APB2RST_GP16C2T1EN_POS 16U
+#define RCU_APB2RST_GP16C2T1EN_MSK BIT(RCU_APB2RST_GP16C2T1EN_POS)
+
+#define RCU_APB2RST_UART1EN_POS 14U
+#define RCU_APB2RST_UART1EN_MSK BIT(RCU_APB2RST_UART1EN_POS)
+
+#define RCU_APB2RST_SPI1EN_POS 12U
+#define RCU_APB2RST_SPI1EN_MSK BIT(RCU_APB2RST_SPI1EN_POS)
+
+#define RCU_APB2RST_AD16C4T1EN_POS 11U
+#define RCU_APB2RST_AD16C4T1EN_MSK BIT(RCU_APB2RST_AD16C4T1EN_POS)
+
+#define RCU_APB2RST_ADCEN_POS 9U
+#define RCU_APB2RST_ADCEN_MSK BIT(RCU_APB2RST_ADCEN_POS)
+
+/****************** Bit definition for RCU_AHBEN register ************************/
+
+#define RCU_AHBEN_GPDEN_POS 19U
+#define RCU_AHBEN_GPDEN_MSK BIT(RCU_AHBEN_GPDEN_POS)
+
+#define RCU_AHBEN_GPCEN_POS 18U
+#define RCU_AHBEN_GPCEN_MSK BIT(RCU_AHBEN_GPCEN_POS)
+
+#define RCU_AHBEN_GPBEN_POS 17U
+#define RCU_AHBEN_GPBEN_MSK BIT(RCU_AHBEN_GPBEN_POS)
+
+#define RCU_AHBEN_GPAEN_POS 16U
+#define RCU_AHBEN_GPAEN_MSK BIT(RCU_AHBEN_GPAEN_POS)
+
+#define RCU_AHBEN_HDIVEN_POS 15U
+#define RCU_AHBEN_HDIVEN_MSK BIT(RCU_AHBEN_HDIVEN_POS)
+
+#define RCU_AHBEN_USBEN_POS 14U
+#define RCU_AHBEN_USBEN_MSK BIT(RCU_AHBEN_USBEN_POS)
+
+#define RCU_AHBEN_AESEN_POS 13U
+#define RCU_AHBEN_AESEN_MSK BIT(RCU_AHBEN_AESEN_POS)
+
+#define RCU_AHBEN_CRCEN_POS 12U
+#define RCU_AHBEN_CRCEN_MSK BIT(RCU_AHBEN_CRCEN_POS)
+
+#define RCU_AHBEN_RTCEN_POS 6U
+#define RCU_AHBEN_RTCEN_MSK BIT(RCU_AHBEN_RTCEN_POS)
+
+#define RCU_AHBEN_DMA1EN_POS 0U
+#define RCU_AHBEN_DMA1EN_MSK BIT(RCU_AHBEN_DMA1EN_POS)
+
+/****************** Bit definition for RCU_APB1EN register ************************/
+
+#define RCU_APB1EN_DACEN_POS 23U
+#define RCU_APB1EN_DACEN_MSK BIT(RCU_APB1EN_DACEN_POS)
+
+#define RCU_APB1EN_I2C2EN_POS 22U
+#define RCU_APB1EN_I2C2EN_MSK BIT(RCU_APB1EN_I2C2EN_POS)
+
+#define RCU_APB1EN_I2C1EN_POS 21U
+#define RCU_APB1EN_I2C1EN_MSK BIT(RCU_APB1EN_I2C1EN_POS)
+
+#define RCU_APB1EN_SUART2EN_POS 20U
+#define RCU_APB1EN_SUART2EN_MSK BIT(RCU_APB1EN_SUART2EN_POS)
+
+#define RCU_APB1EN_SUART1EN_POS 19U
+#define RCU_APB1EN_SUART1EN_MSK BIT(RCU_APB1EN_SUART1EN_POS)
+
+#define RCU_APB1EN_UART3EN_POS 18U
+#define RCU_APB1EN_UART3EN_MSK BIT(RCU_APB1EN_UART3EN_POS)
+
+#define RCU_APB1EN_UART2EN_POS 17U
+#define RCU_APB1EN_UART2EN_MSK BIT(RCU_APB1EN_UART2EN_POS)
+
+#define RCU_APB1EN_SPI2EN_POS 14U
+#define RCU_APB1EN_SPI2EN_MSK BIT(RCU_APB1EN_SPI2EN_POS)
+
+#define RCU_APB1EN_IWDTEN_POS 12U
+#define RCU_APB1EN_IWDTEN_MSK BIT(RCU_APB1EN_IWDTEN_POS)
+
+#define RCU_APB1EN_WWDTEN_POS 11U
+#define RCU_APB1EN_WWDTEN_MSK BIT(RCU_APB1EN_WWDTEN_POS)
+
+#define RCU_APB1EN_BS16T1EN_POS 4U
+#define RCU_APB1EN_BS16T1EN_MSK BIT(RCU_APB1EN_BS16T1EN_POS)
+
+#define RCU_APB1EN_GP16C4T3EN_POS 3U
+#define RCU_APB1EN_GP16C4T3EN_MSK BIT(RCU_APB1EN_GP16C4T3EN_POS)
+
+#define RCU_APB1EN_GP16C4T2EN_POS 2U
+#define RCU_APB1EN_GP16C4T2EN_MSK BIT(RCU_APB1EN_GP16C4T2EN_POS)
+
+#define RCU_APB1EN_GP16C4T1EN_POS 1U
+#define RCU_APB1EN_GP16C4T1EN_MSK BIT(RCU_APB1EN_GP16C4T1EN_POS)
+
+#define RCU_APB1EN_GP32C4T1EN_POS 0U
+#define RCU_APB1EN_GP32C4T1EN_MSK BIT(RCU_APB1EN_GP32C4T1EN_POS)
+
+/****************** Bit definition for RCU_APB2EN register ************************/
+
+#define RCU_APB2EN_CMPEN_POS 23U
+#define RCU_APB2EN_CMPEN_MSK BIT(RCU_APB2EN_CMPEN_POS)
+
+#define RCU_APB2EN_GP16C2T4EN_POS 19U
+#define RCU_APB2EN_GP16C2T4EN_MSK BIT(RCU_APB2EN_GP16C2T4EN_POS)
+
+#define RCU_APB2EN_GP16C2T3EN_POS 18U
+#define RCU_APB2EN_GP16C2T3EN_MSK BIT(RCU_APB2EN_GP16C2T3EN_POS)
+
+#define RCU_APB2EN_GP16C2T2EN_POS 17U
+#define RCU_APB2EN_GP16C2T2EN_MSK BIT(RCU_APB2EN_GP16C2T2EN_POS)
+
+#define RCU_APB2EN_GP16C2T1EN_POS 16U
+#define RCU_APB2EN_GP16C2T1EN_MSK BIT(RCU_APB2EN_GP16C2T1EN_POS)
+
+#define RCU_APB2EN_UART1EN_POS 14U
+#define RCU_APB2EN_UART1EN_MSK BIT(RCU_APB2EN_UART1EN_POS)
+
+#define RCU_APB2EN_SPI1EN_POS 12U
+#define RCU_APB2EN_SPI1EN_MSK BIT(RCU_APB2EN_SPI1EN_POS)
+
+#define RCU_APB2EN_AD16C4T1EN_POS 11U
+#define RCU_APB2EN_AD16C4T1EN_MSK BIT(RCU_APB2EN_AD16C4T1EN_POS)
+
+#define RCU_APB2EN_ADCEN_POS 9U
+#define RCU_APB2EN_ADCEN_MSK BIT(RCU_APB2EN_ADCEN_POS)
+
+/****************** Bit definition for RCU_AHBSL register ************************/
+
+#define RCU_AHBSL_GPDEN_POS 19U
+#define RCU_AHBSL_GPDEN_MSK BIT(RCU_AHBSL_GPDEN_POS)
+
+#define RCU_AHBSL_GPCEN_POS 18U
+#define RCU_AHBSL_GPCEN_MSK BIT(RCU_AHBSL_GPCEN_POS)
+
+#define RCU_AHBSL_GPBEN_POS 17U
+#define RCU_AHBSL_GPBEN_MSK BIT(RCU_AHBSL_GPBEN_POS)
+
+#define RCU_AHBSL_GPAEN_POS 16U
+#define RCU_AHBSL_GPAEN_MSK BIT(RCU_AHBSL_GPAEN_POS)
+
+#define RCU_AHBSL_HDIVEN_POS 15U
+#define RCU_AHBSL_HDIVEN_MSK BIT(RCU_AHBSL_HDIVEN_POS)
+
+#define RCU_AHBSL_USBEN_POS 14U
+#define RCU_AHBSL_USBEN_MSK BIT(RCU_AHBSL_USBEN_POS)
+
+#define RCU_AHBSL_AESEN_POS 13U
+#define RCU_AHBSL_AESEN_MSK BIT(RCU_AHBSL_AESEN_POS)
+
+#define RCU_AHBSL_CRCEN_POS 12U
+#define RCU_AHBSL_CRCEN_MSK BIT(RCU_AHBSL_CRCEN_POS)
+
+#define RCU_AHBSL_RTCEN_POS 6U
+#define RCU_AHBSL_RTCEN_MSK BIT(RCU_AHBSL_RTCEN_POS)
+
+#define RCU_AHBSL_DMA1EN_POS 0U
+#define RCU_AHBSL_DMA1EN_MSK BIT(RCU_AHBSL_DMA1EN_POS)
+
+/****************** Bit definition for RCU_APB1SL register ************************/
+
+#define RCU_APB1SL_DACEN_POS 23U
+#define RCU_APB1SL_DACEN_MSK BIT(RCU_APB1SL_DACEN_POS)
+
+#define RCU_APB1SL_I2C2EN_POS 22U
+#define RCU_APB1SL_I2C2EN_MSK BIT(RCU_APB1SL_I2C2EN_POS)
+
+#define RCU_APB1SL_I2C1EN_POS 21U
+#define RCU_APB1SL_I2C1EN_MSK BIT(RCU_APB1SL_I2C1EN_POS)
+
+#define RCU_APB1SL_SUART2EN_POS 20U
+#define RCU_APB1SL_SUART2EN_MSK BIT(RCU_APB1SL_SUART2EN_POS)
+
+#define RCU_APB1SL_SUART1EN_POS 19U
+#define RCU_APB1SL_SUART1EN_MSK BIT(RCU_APB1SL_SUART1EN_POS)
+
+#define RCU_APB1SL_UART3EN_POS 18U
+#define RCU_APB1SL_UART3EN_MSK BIT(RCU_APB1SL_UART3EN_POS)
+
+#define RCU_APB1SL_UART2EN_POS 17U
+#define RCU_APB1SL_UART2EN_MSK BIT(RCU_APB1SL_UART2EN_POS)
+
+#define RCU_APB1SL_SPI2EN_POS 14U
+#define RCU_APB1SL_SPI2EN_MSK BIT(RCU_APB1SL_SPI2EN_POS)
+
+#define RCU_APB1SL_IWDTEN_POS 12U
+#define RCU_APB1SL_IWDTEN_MSK BIT(RCU_APB1SL_IWDTEN_POS)
+
+#define RCU_APB1SL_WWDTEN_POS 11U
+#define RCU_APB1SL_WWDTEN_MSK BIT(RCU_APB1SL_WWDTEN_POS)
+
+#define RCU_APB1SL_BS16T1EN_POS 4U
+#define RCU_APB1SL_BS16T1EN_MSK BIT(RCU_APB1SL_BS16T1EN_POS)
+
+#define RCU_APB1SL_GP16C4T3EN_POS 3U
+#define RCU_APB1SL_GP16C4T3EN_MSK BIT(RCU_APB1SL_GP16C4T3EN_POS)
+
+#define RCU_APB1SL_GP16C4T2EN_POS 2U
+#define RCU_APB1SL_GP16C4T2EN_MSK BIT(RCU_APB1SL_GP16C4T2EN_POS)
+
+#define RCU_APB1SL_GP16C4T1EN_POS 1U
+#define RCU_APB1SL_GP16C4T1EN_MSK BIT(RCU_APB1SL_GP16C4T1EN_POS)
+
+#define RCU_APB1SL_GP32C4T1EN_POS 0U
+#define RCU_APB1SL_GP32C4T1EN_MSK BIT(RCU_APB1SL_GP32C4T1EN_POS)
+
+/****************** Bit definition for RCU_APB2SL register ************************/
+
+#define RCU_APB2SL_CMPEN_POS 23U
+#define RCU_APB2SL_CMPEN_MSK BIT(RCU_APB2SL_CMPEN_POS)
+
+#define RCU_APB2SL_GP16C2T4EN_POS 19U
+#define RCU_APB2SL_GP16C2T4EN_MSK BIT(RCU_APB2SL_GP16C2T4EN_POS)
+
+#define RCU_APB2SL_GP16C2T3EN_POS 18U
+#define RCU_APB2SL_GP16C2T3EN_MSK BIT(RCU_APB2SL_GP16C2T3EN_POS)
+
+#define RCU_APB2SL_GP16C2T2EN_POS 17U
+#define RCU_APB2SL_GP16C2T2EN_MSK BIT(RCU_APB2SL_GP16C2T2EN_POS)
+
+#define RCU_APB2SL_GP16C2T1EN_POS 16U
+#define RCU_APB2SL_GP16C2T1EN_MSK BIT(RCU_APB2SL_GP16C2T1EN_POS)
+
+#define RCU_APB2SL_UART1EN_POS 14U
+#define RCU_APB2SL_UART1EN_MSK BIT(RCU_APB2SL_UART1EN_POS)
+
+#define RCU_APB2SL_SPI1EN_POS 12U
+#define RCU_APB2SL_SPI1EN_MSK BIT(RCU_APB2SL_SPI1EN_POS)
+
+#define RCU_APB2SL_AD16C4T1EN_POS 11U
+#define RCU_APB2SL_AD16C4T1EN_MSK BIT(RCU_APB2SL_AD16C4T1EN_POS)
+
+#define RCU_APB2SL_ADCEN_POS 9U
+#define RCU_APB2SL_ADCEN_MSK BIT(RCU_APB2SL_ADCEN_POS)
+
+/****************** Bit definition for RCU_AHBDSL register ************************/
+
+#define RCU_AHBDSL_GPDEN_POS 19U
+#define RCU_AHBDSL_GPDEN_MSK BIT(RCU_AHBDSL_GPDEN_POS)
+
+#define RCU_AHBDSL_GPCEN_POS 18U
+#define RCU_AHBDSL_GPCEN_MSK BIT(RCU_AHBDSL_GPCEN_POS)
+
+#define RCU_AHBDSL_GPBEN_POS 17U
+#define RCU_AHBDSL_GPBEN_MSK BIT(RCU_AHBDSL_GPBEN_POS)
+
+#define RCU_AHBDSL_GPAEN_POS 16U
+#define RCU_AHBDSL_GPAEN_MSK BIT(RCU_AHBDSL_GPAEN_POS)
+
+#define RCU_AHBDSL_HDIVEN_POS 15U
+#define RCU_AHBDSL_HDIVEN_MSK BIT(RCU_AHBDSL_HDIVEN_POS)
+
+#define RCU_AHBDSL_USBEN_POS 14U
+#define RCU_AHBDSL_USBEN_MSK BIT(RCU_AHBDSL_USBEN_POS)
+
+#define RCU_AHBDSL_AESEN_POS 13U
+#define RCU_AHBDSL_AESEN_MSK BIT(RCU_AHBDSL_AESEN_POS)
+
+#define RCU_AHBDSL_CRCEN_POS 12U
+#define RCU_AHBDSL_CRCEN_MSK BIT(RCU_AHBDSL_CRCEN_POS)
+
+#define RCU_AHBDSL_RTCEN_POS 6U
+#define RCU_AHBDSL_RTCEN_MSK BIT(RCU_AHBDSL_RTCEN_POS)
+
+#define RCU_AHBDSL_DMA1EN_POS 0U
+#define RCU_AHBDSL_DMA1EN_MSK BIT(RCU_AHBDSL_DMA1EN_POS)
+
+/****************** Bit definition for RCU_APB1DSL register ************************/
+
+#define RCU_APB1DSL_DACEN_POS 23U
+#define RCU_APB1DSL_DACEN_MSK BIT(RCU_APB1DSL_DACEN_POS)
+
+#define RCU_APB1DSL_I2C2EN_POS 22U
+#define RCU_APB1DSL_I2C2EN_MSK BIT(RCU_APB1DSL_I2C2EN_POS)
+
+#define RCU_APB1DSL_I2C1EN_POS 21U
+#define RCU_APB1DSL_I2C1EN_MSK BIT(RCU_APB1DSL_I2C1EN_POS)
+
+#define RCU_APB1DSL_SUART2EN_POS 20U
+#define RCU_APB1DSL_SUART2EN_MSK BIT(RCU_APB1DSL_SUART2EN_POS)
+
+#define RCU_APB1DSL_SUART1EN_POS 19U
+#define RCU_APB1DSL_SUART1EN_MSK BIT(RCU_APB1DSL_SUART1EN_POS)
+
+#define RCU_APB1DSL_UART3EN_POS 18U
+#define RCU_APB1DSL_UART3EN_MSK BIT(RCU_APB1DSL_UART3EN_POS)
+
+#define RCU_APB1DSL_UART2EN_POS 17U
+#define RCU_APB1DSL_UART2EN_MSK BIT(RCU_APB1DSL_UART2EN_POS)
+
+#define RCU_APB1DSL_SPI2EN_POS 14U
+#define RCU_APB1DSL_SPI2EN_MSK BIT(RCU_APB1DSL_SPI2EN_POS)
+
+#define RCU_APB1DSL_IWDTEN_POS 12U
+#define RCU_APB1DSL_IWDTEN_MSK BIT(RCU_APB1DSL_IWDTEN_POS)
+
+#define RCU_APB1DSL_WWDTEN_POS 11U
+#define RCU_APB1DSL_WWDTEN_MSK BIT(RCU_APB1DSL_WWDTEN_POS)
+
+#define RCU_APB1DSL_BS16T1EN_POS 4U
+#define RCU_APB1DSL_BS16T1EN_MSK BIT(RCU_APB1DSL_BS16T1EN_POS)
+
+#define RCU_APB1DSL_GP16C4T3EN_POS 3U
+#define RCU_APB1DSL_GP16C4T3EN_MSK BIT(RCU_APB1DSL_GP16C4T3EN_POS)
+
+#define RCU_APB1DSL_GP16C4T2EN_POS 2U
+#define RCU_APB1DSL_GP16C4T2EN_MSK BIT(RCU_APB1DSL_GP16C4T2EN_POS)
+
+#define RCU_APB1DSL_GP16C4T1EN_POS 1U
+#define RCU_APB1DSL_GP16C4T1EN_MSK BIT(RCU_APB1DSL_GP16C4T1EN_POS)
+
+#define RCU_APB1DSL_GP32C4T1EN_POS 0U
+#define RCU_APB1DSL_GP32C4T1EN_MSK BIT(RCU_APB1DSL_GP32C4T1EN_POS)
+
+/****************** Bit definition for RCU_APB2DSL register ************************/
+
+#define RCU_APB2DSL_CMPEN_POS 23U
+#define RCU_APB2DSL_CMPEN_MSK BIT(RCU_APB2DSL_CMPEN_POS)
+
+#define RCU_APB2DSL_GP16C2T4EN_POS 19U
+#define RCU_APB2DSL_GP16C2T4EN_MSK BIT(RCU_APB2DSL_GP16C2T4EN_POS)
+
+#define RCU_APB2DSL_GP16C2T3EN_POS 18U
+#define RCU_APB2DSL_GP16C2T3EN_MSK BIT(RCU_APB2DSL_GP16C2T3EN_POS)
+
+#define RCU_APB2DSL_GP16C2T2EN_POS 17U
+#define RCU_APB2DSL_GP16C2T2EN_MSK BIT(RCU_APB2DSL_GP16C2T2EN_POS)
+
+#define RCU_APB2DSL_GP16C2T1EN_POS 16U
+#define RCU_APB2DSL_GP16C2T1EN_MSK BIT(RCU_APB2DSL_GP16C2T1EN_POS)
+
+#define RCU_APB2DSL_UART1EN_POS 14U
+#define RCU_APB2DSL_UART1EN_MSK BIT(RCU_APB2DSL_UART1EN_POS)
+
+#define RCU_APB2DSL_SPI1EN_POS 12U
+#define RCU_APB2DSL_SPI1EN_MSK BIT(RCU_APB2DSL_SPI1EN_POS)
+
+#define RCU_APB2DSL_AD16C4T1EN_POS 11U
+#define RCU_APB2DSL_AD16C4T1EN_MSK BIT(RCU_APB2DSL_AD16C4T1EN_POS)
+
+#define RCU_APB2DSL_ADCEN_POS 9U
+#define RCU_APB2DSL_ADCEN_MSK BIT(RCU_APB2DSL_ADCEN_POS)
+
+typedef struct
+{
+ __IO uint32_t CON;
+ __IO uint32_t CFG;
+ __IO uint32_t STCALIB;
+ __IO uint32_t PSCK;
+ __IO uint32_t AHBRST;
+ __IO uint32_t APB1RST;
+ __IO uint32_t APB2RST;
+ __IO uint32_t AHBEN;
+ __IO uint32_t APB1EN;
+ __IO uint32_t APB2EN;
+ __IO uint32_t AHBSL;
+ __IO uint32_t APB1SL;
+ __IO uint32_t APB2SL;
+ __IO uint32_t AHBDSL;
+ __IO uint32_t APB1DSL;
+ __IO uint32_t APB2DSL;
+} RCU_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rtc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rtc.h
new file mode 100644
index 0000000000000000000000000000000000000000..a22674f22ba6a7731f234366828397339c10ab1d
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rtc.h
@@ -0,0 +1,613 @@
+/**
+ **************************************************************************************
+ * @file REG_RTC.h
+ * @brief RTC Head File
+ *
+ * @version V0.01
+ * @date 12/5/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __RTC_H__
+#define __RTC_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for RTC_CON register ************************/
+
+#define RTC_CON_MODE_POS 30U
+#define RTC_CON_MODE_MSK BIT(RTC_CON_MODE_POS)
+
+#define RTC_CON_CALVAL_POSS 24U
+#define RTC_CON_CALVAL_POSE 29U
+#define RTC_CON_CALVAL_MSK BITS(RTC_CON_CALVAL_POSS,RTC_CON_CALVAL_POSE)
+
+#define RTC_CON_SCALE_POSS 16U
+#define RTC_CON_SCALE_POSE 23U
+#define RTC_CON_SCALE_MSK BITS(RTC_CON_SCALE_POSS,RTC_CON_SCALE_POSE)
+
+#define RTC_CON_PSCALE_POSS 8U
+#define RTC_CON_PSCALE_POSE 14U
+#define RTC_CON_PSCALE_MSK BITS(RTC_CON_PSCALE_POSS,RTC_CON_PSCALE_POSE)
+
+#define RTC_CON_CYCLE_POS 5U
+#define RTC_CON_CYCLE_MSK BIT(RTC_CON_CYCLE_POS)
+
+#define RTC_CON_CALIB_POS 4U
+#define RTC_CON_CALIB_MSK BIT(RTC_CON_CALIB_POS)
+
+#define RTC_CON_CKSEL_POSS 2U
+#define RTC_CON_CKSEL_POSE 3U
+#define RTC_CON_CKSEL_MSK BITS(RTC_CON_CKSEL_POSS,RTC_CON_CKSEL_POSE)
+
+#define RTC_CON_RTCEN_POS 0U
+#define RTC_CON_RTCEN_MSK BIT(RTC_CON_RTCEN_POS)
+
+/****************** Bit definition for RTC_WKUP register ************************/
+
+#define RTC_WKUP_WKSCAL_POSS 26U
+#define RTC_WKUP_WKSCAL_POSE 29U
+#define RTC_WKUP_WKSCAL_MSK BITS(RTC_WKUP_WKSCAL_POSS,RTC_WKUP_WKSCAL_POSE)
+
+#define RTC_WKUP_WKSEL_POSS 24U
+#define RTC_WKUP_WKSEL_POSE 25U
+#define RTC_WKUP_WKSEL_MSK BITS(RTC_WKUP_WKSEL_POSS,RTC_WKUP_WKSEL_POSE)
+
+#define RTC_WKUP_WKCAL_POSS 0U
+#define RTC_WKUP_WKCAL_POSE 23U
+#define RTC_WKUP_WKCAL_MSK BITS(RTC_WKUP_WKCAL_POSS,RTC_WKUP_WKCAL_POSE)
+
+/****************** Bit definition for RTC_TIME register ************************/
+
+#define RTC_TIME_WEEK_POSS 24U
+#define RTC_TIME_WEEK_POSE 26U
+#define RTC_TIME_WEEK_MSK BITS(RTC_TIME_WEEK_POSS,RTC_TIME_WEEK_POSE)
+
+#define RTC_TIME_HOUR_T_POSS 20U
+#define RTC_TIME_HOUR_T_POSE 21U
+#define RTC_TIME_HOUR_T_MSK BITS(RTC_TIME_HOUR_T_POSS,RTC_TIME_HOUR_T_POSE)
+
+#define RTC_TIME_HOUR_U_POSS 16U
+#define RTC_TIME_HOUR_U_POSE 19U
+#define RTC_TIME_HOUR_U_MSK BITS(RTC_TIME_HOUR_U_POSS,RTC_TIME_HOUR_U_POSE)
+
+#define RTC_TIME_MIN_T_POSS 12U
+#define RTC_TIME_MIN_T_POSE 14U
+#define RTC_TIME_MIN_T_MSK BITS(RTC_TIME_MIN_T_POSS,RTC_TIME_MIN_T_POSE)
+
+#define RTC_TIME_MIN_U_POSS 8U
+#define RTC_TIME_MIN_U_POSE 11U
+#define RTC_TIME_MIN_U_MSK BITS(RTC_TIME_MIN_U_POSS,RTC_TIME_MIN_U_POSE)
+
+#define RTC_TIME_SEC_T_POSS 4U
+#define RTC_TIME_SEC_T_POSE 6U
+#define RTC_TIME_SEC_T_MSK BITS(RTC_TIME_SEC_T_POSS,RTC_TIME_SEC_T_POSE)
+
+#define RTC_TIME_SEC_U_POSS 0U
+#define RTC_TIME_SEC_U_POSE 3U
+#define RTC_TIME_SEC_U_MSK BITS(RTC_TIME_SEC_U_POSS,RTC_TIME_SEC_U_POSE)
+
+/****************** Bit definition for RTC_CAL register ************************/
+
+#define RTC_CAL_YEAR_T_POSS 20U
+#define RTC_CAL_YEAR_T_POSE 23U
+#define RTC_CAL_YEAR_T_MSK BITS(RTC_CAL_YEAR_T_POSS,RTC_CAL_YEAR_T_POSE)
+
+#define RTC_CAL_YEAR_U_POSS 16U
+#define RTC_CAL_YEAR_U_POSE 19U
+#define RTC_CAL_YEAR_U_MSK BITS(RTC_CAL_YEAR_U_POSS,RTC_CAL_YEAR_U_POSE)
+
+#define RTC_CAL_MON_T_POS 12U
+#define RTC_CAL_MON_T_MSK BIT(RTC_CAL_MON_T_POS)
+
+#define RTC_CAL_MON_U_POSS 8U
+#define RTC_CAL_MON_U_POSE 11U
+#define RTC_CAL_MON_U_MSK BITS(RTC_CAL_MON_U_POSS,RTC_CAL_MON_U_POSE)
+
+#define RTC_CAL_DATE_T_POSS 4U
+#define RTC_CAL_DATE_T_POSE 5U
+#define RTC_CAL_DATE_T_MSK BITS(RTC_CAL_DATE_T_POSS,RTC_CAL_DATE_T_POSE)
+
+#define RTC_CAL_DATE_U_POSS 0U
+#define RTC_CAL_DATE_U_POSE 3U
+#define RTC_CAL_DATE_U_MSK BITS(RTC_CAL_DATE_U_POSS,RTC_CAL_DATE_U_POSE)
+
+/****************** Bit definition for RTC_ALTIME register ************************/
+
+#define RTC_ALTIME_WEEK_POSS 24U
+#define RTC_ALTIME_WEEK_POSE 26U
+#define RTC_ALTIME_WEEK_MSK BITS(RTC_ALTIME_WEEK_POSS,RTC_ALTIME_WEEK_POSE)
+
+#define RTC_ALTIME_HOUR_T_POSS 20U
+#define RTC_ALTIME_HOUR_T_POSE 21U
+#define RTC_ALTIME_HOUR_T_MSK BITS(RTC_ALTIME_HOUR_T_POSS,RTC_ALTIME_HOUR_T_POSE)
+
+#define RTC_ALTIME_HOUR_U_POSS 16U
+#define RTC_ALTIME_HOUR_U_POSE 19U
+#define RTC_ALTIME_HOUR_U_MSK BITS(RTC_ALTIME_HOUR_U_POSS,RTC_ALTIME_HOUR_U_POSE)
+
+#define RTC_ALTIME_MIN_T_POSS 12U
+#define RTC_ALTIME_MIN_T_POSE 14U
+#define RTC_ALTIME_MIN_T_MSK BITS(RTC_ALTIME_MIN_T_POSS,RTC_ALTIME_MIN_T_POSE)
+
+#define RTC_ALTIME_MIN_U_POSS 8U
+#define RTC_ALTIME_MIN_U_POSE 11U
+#define RTC_ALTIME_MIN_U_MSK BITS(RTC_ALTIME_MIN_U_POSS,RTC_ALTIME_MIN_U_POSE)
+
+#define RTC_ALTIME_SEC_T_POSS 4U
+#define RTC_ALTIME_SEC_T_POSE 6U
+#define RTC_ALTIME_SEC_T_MSK BITS(RTC_ALTIME_SEC_T_POSS,RTC_ALTIME_SEC_T_POSE)
+
+#define RTC_ALTIME_SEC_U_POSS 0U
+#define RTC_ALTIME_SEC_U_POSE 3U
+#define RTC_ALTIME_SEC_U_MSK BITS(RTC_ALTIME_SEC_U_POSS,RTC_ALTIME_SEC_U_POSE)
+
+/****************** Bit definition for RTC_ALCAL register ************************/
+
+#define RTC_ALCAL_YEAR_T_POSS 20U
+#define RTC_ALCAL_YEAR_T_POSE 23U
+#define RTC_ALCAL_YEAR_T_MSK BITS(RTC_ALCAL_YEAR_T_POSS,RTC_ALCAL_YEAR_T_POSE)
+
+#define RTC_ALCAL_YEAR_U_POSS 16U
+#define RTC_ALCAL_YEAR_U_POSE 19U
+#define RTC_ALCAL_YEAR_U_MSK BITS(RTC_ALCAL_YEAR_U_POSS,RTC_ALCAL_YEAR_U_POSE)
+
+#define RTC_ALCAL_MON_T_POS 12U
+#define RTC_ALCAL_MON_T_MSK BIT(RTC_ALCAL_MON_T_POS)
+
+#define RTC_ALCAL_MON_U_POSS 8U
+#define RTC_ALCAL_MON_U_POSE 11U
+#define RTC_ALCAL_MON_U_MSK BITS(RTC_ALCAL_MON_U_POSS,RTC_ALCAL_MON_U_POSE)
+
+#define RTC_ALCAL_DATE_T_POSS 4U
+#define RTC_ALCAL_DATE_T_POSE 5U
+#define RTC_ALCAL_DATE_T_MSK BITS(RTC_ALCAL_DATE_T_POSS,RTC_ALCAL_DATE_T_POSE)
+
+#define RTC_ALCAL_DATE_U_POSS 0U
+#define RTC_ALCAL_DATE_U_POSE 3U
+#define RTC_ALCAL_DATE_U_MSK BITS(RTC_ALCAL_DATE_U_POSS,RTC_ALCAL_DATE_U_POSE)
+
+/****************** Bit definition for RTC_ALEN register ************************/
+
+#define RTC_ALEN_YEAR_POS 6U
+#define RTC_ALEN_YEAR_MSK BIT(RTC_ALEN_YEAR_POS)
+
+#define RTC_ALEN_MONTH_POS 5U
+#define RTC_ALEN_MONTH_MSK BIT(RTC_ALEN_MONTH_POS)
+
+#define RTC_ALEN_DATE_POS 4U
+#define RTC_ALEN_DATE_MSK BIT(RTC_ALEN_DATE_POS)
+
+#define RTC_ALEN_WEEK_POS 3U
+#define RTC_ALEN_WEEK_MSK BIT(RTC_ALEN_WEEK_POS)
+
+#define RTC_ALEN_HOUR_POS 2U
+#define RTC_ALEN_HOUR_MSK BIT(RTC_ALEN_HOUR_POS)
+
+#define RTC_ALEN_MIN_POS 1U
+#define RTC_ALEN_MIN_MSK BIT(RTC_ALEN_MIN_POS)
+
+#define RTC_ALEN_SEC_POS 0U
+#define RTC_ALEN_SEC_MSK BIT(RTC_ALEN_SEC_POS)
+
+/****************** Bit definition for RTC_TRIG register ************************/
+
+#define RTC_TRIG_WKTM_POS 16U
+#define RTC_TRIG_WKTM_MSK BIT(RTC_TRIG_WKTM_POS)
+
+#define RTC_TRIG_F1HZ_POS 15U
+#define RTC_TRIG_F1HZ_MSK BIT(RTC_TRIG_F1HZ_POS)
+
+#define RTC_TRIG_RYEAR_POS 14U
+#define RTC_TRIG_RYEAR_MSK BIT(RTC_TRIG_RYEAR_POS)
+
+#define RTC_TRIG_RMON_POS 13U
+#define RTC_TRIG_RMON_MSK BIT(RTC_TRIG_RMON_POS)
+
+#define RTC_TRIG_RDATE_POS 12U
+#define RTC_TRIG_RDATE_MSK BIT(RTC_TRIG_RDATE_POS)
+
+#define RTC_TRIG_RWEEK_POS 11U
+#define RTC_TRIG_RWEEK_MSK BIT(RTC_TRIG_RWEEK_POS)
+
+#define RTC_TRIG_RHOUR_POS 10U
+#define RTC_TRIG_RHOUR_MSK BIT(RTC_TRIG_RHOUR_POS)
+
+#define RTC_TRIG_RMIN_POS 9U
+#define RTC_TRIG_RMIN_MSK BIT(RTC_TRIG_RMIN_POS)
+
+#define RTC_TRIG_RSEC_POS 8U
+#define RTC_TRIG_RSEC_MSK BIT(RTC_TRIG_RSEC_POS)
+
+#define RTC_TRIG_AMALL_POS 7U
+#define RTC_TRIG_AMALL_MSK BIT(RTC_TRIG_AMALL_POS)
+
+#define RTC_TRIG_AYEAR_POS 6U
+#define RTC_TRIG_AYEAR_MSK BIT(RTC_TRIG_AYEAR_POS)
+
+#define RTC_TRIG_AMON_POS 5U
+#define RTC_TRIG_AMON_MSK BIT(RTC_TRIG_AMON_POS)
+
+#define RTC_TRIG_ADTAE_POS 4U
+#define RTC_TRIG_ADTAE_MSK BIT(RTC_TRIG_ADTAE_POS)
+
+#define RTC_TRIG_AWEEK_POS 3U
+#define RTC_TRIG_AWEEK_MSK BIT(RTC_TRIG_AWEEK_POS)
+
+#define RTC_TRIG_AHOUR_POS 2U
+#define RTC_TRIG_AHOUR_MSK BIT(RTC_TRIG_AHOUR_POS)
+
+#define RTC_TRIG_AMIN_POS 1U
+#define RTC_TRIG_AMIN_MSK BIT(RTC_TRIG_AMIN_POS)
+
+#define RTC_TRIG_ASEC_POS 0U
+#define RTC_TRIG_ASEC_MSK BIT(RTC_TRIG_ASEC_POS)
+
+/****************** Bit definition for RTC_IER register ************************/
+
+#define RTC_IER_WKTM_POS 16U
+#define RTC_IER_WKTM_MSK BIT(RTC_IER_WKTM_POS)
+
+#define RTC_IER_F1HZ_POS 15U
+#define RTC_IER_F1HZ_MSK BIT(RTC_IER_F1HZ_POS)
+
+#define RTC_IER_RYEAR_POS 14U
+#define RTC_IER_RYEAR_MSK BIT(RTC_IER_RYEAR_POS)
+
+#define RTC_IER_RMON_POS 13U
+#define RTC_IER_RMON_MSK BIT(RTC_IER_RMON_POS)
+
+#define RTC_IER_RDATE_POS 12U
+#define RTC_IER_RDATE_MSK BIT(RTC_IER_RDATE_POS)
+
+#define RTC_IER_RWEEK_POS 11U
+#define RTC_IER_RWEEK_MSK BIT(RTC_IER_RWEEK_POS)
+
+#define RTC_IER_RHOUR_POS 10U
+#define RTC_IER_RHOUR_MSK BIT(RTC_IER_RHOUR_POS)
+
+#define RTC_IER_RMIN_POS 9U
+#define RTC_IER_RMIN_MSK BIT(RTC_IER_RMIN_POS)
+
+#define RTC_IER_RSEC_POS 8U
+#define RTC_IER_RSEC_MSK BIT(RTC_IER_RSEC_POS)
+
+#define RTC_IER_AMALL_POS 7U
+#define RTC_IER_AMALL_MSK BIT(RTC_IER_AMALL_POS)
+
+#define RTC_IER_AYEAR_POS 6U
+#define RTC_IER_AYEAR_MSK BIT(RTC_IER_AYEAR_POS)
+
+#define RTC_IER_AMON_POS 5U
+#define RTC_IER_AMON_MSK BIT(RTC_IER_AMON_POS)
+
+#define RTC_IER_ADTAE_POS 4U
+#define RTC_IER_ADTAE_MSK BIT(RTC_IER_ADTAE_POS)
+
+#define RTC_IER_AWEEK_POS 3U
+#define RTC_IER_AWEEK_MSK BIT(RTC_IER_AWEEK_POS)
+
+#define RTC_IER_AHOUR_POS 2U
+#define RTC_IER_AHOUR_MSK BIT(RTC_IER_AHOUR_POS)
+
+#define RTC_IER_AMIN_POS 1U
+#define RTC_IER_AMIN_MSK BIT(RTC_IER_AMIN_POS)
+
+#define RTC_IER_ASEC_POS 0U
+#define RTC_IER_ASEC_MSK BIT(RTC_IER_ASEC_POS)
+
+/****************** Bit definition for RTC_IDR register ************************/
+
+#define RTC_IDR_WKTM_POS 16U
+#define RTC_IDR_WKTM_MSK BIT(RTC_IDR_WKTM_POS)
+
+#define RTC_IDR_F1HZ_POS 15U
+#define RTC_IDR_F1HZ_MSK BIT(RTC_IDR_F1HZ_POS)
+
+#define RTC_IDR_RYEAR_POS 14U
+#define RTC_IDR_RYEAR_MSK BIT(RTC_IDR_RYEAR_POS)
+
+#define RTC_IDR_RMON_POS 13U
+#define RTC_IDR_RMON_MSK BIT(RTC_IDR_RMON_POS)
+
+#define RTC_IDR_RDATE_POS 12U
+#define RTC_IDR_RDATE_MSK BIT(RTC_IDR_RDATE_POS)
+
+#define RTC_IDR_RWEEK_POS 11U
+#define RTC_IDR_RWEEK_MSK BIT(RTC_IDR_RWEEK_POS)
+
+#define RTC_IDR_RHOUR_POS 10U
+#define RTC_IDR_RHOUR_MSK BIT(RTC_IDR_RHOUR_POS)
+
+#define RTC_IDR_RMIN_POS 9U
+#define RTC_IDR_RMIN_MSK BIT(RTC_IDR_RMIN_POS)
+
+#define RTC_IDR_RSEC_POS 8U
+#define RTC_IDR_RSEC_MSK BIT(RTC_IDR_RSEC_POS)
+
+#define RTC_IDR_AMALL_POS 7U
+#define RTC_IDR_AMALL_MSK BIT(RTC_IDR_AMALL_POS)
+
+#define RTC_IDR_AYEAR_POS 6U
+#define RTC_IDR_AYEAR_MSK BIT(RTC_IDR_AYEAR_POS)
+
+#define RTC_IDR_AMON_POS 5U
+#define RTC_IDR_AMON_MSK BIT(RTC_IDR_AMON_POS)
+
+#define RTC_IDR_ADTAE_POS 4U
+#define RTC_IDR_ADTAE_MSK BIT(RTC_IDR_ADTAE_POS)
+
+#define RTC_IDR_AWEEK_POS 3U
+#define RTC_IDR_AWEEK_MSK BIT(RTC_IDR_AWEEK_POS)
+
+#define RTC_IDR_AHOUR_POS 2U
+#define RTC_IDR_AHOUR_MSK BIT(RTC_IDR_AHOUR_POS)
+
+#define RTC_IDR_AMIN_POS 1U
+#define RTC_IDR_AMIN_MSK BIT(RTC_IDR_AMIN_POS)
+
+#define RTC_IDR_ASEC_POS 0U
+#define RTC_IDR_ASEC_MSK BIT(RTC_IDR_ASEC_POS)
+
+/****************** Bit definition for RTC_IVS register ************************/
+
+#define RTC_IVS_WKTM_POS 16U
+#define RTC_IVS_WKTM_MSK BIT(RTC_IVS_WKTM_POS)
+
+#define RTC_IVS_F1HZ_POS 15U
+#define RTC_IVS_F1HZ_MSK BIT(RTC_IVS_F1HZ_POS)
+
+#define RTC_IVS_RYEAR_POS 14U
+#define RTC_IVS_RYEAR_MSK BIT(RTC_IVS_RYEAR_POS)
+
+#define RTC_IVS_RMON_POS 13U
+#define RTC_IVS_RMON_MSK BIT(RTC_IVS_RMON_POS)
+
+#define RTC_IVS_RDATE_POS 12U
+#define RTC_IVS_RDATE_MSK BIT(RTC_IVS_RDATE_POS)
+
+#define RTC_IVS_RWEEK_POS 11U
+#define RTC_IVS_RWEEK_MSK BIT(RTC_IVS_RWEEK_POS)
+
+#define RTC_IVS_RHOUR_POS 10U
+#define RTC_IVS_RHOUR_MSK BIT(RTC_IVS_RHOUR_POS)
+
+#define RTC_IVS_RMIN_POS 9U
+#define RTC_IVS_RMIN_MSK BIT(RTC_IVS_RMIN_POS)
+
+#define RTC_IVS_RSEC_POS 8U
+#define RTC_IVS_RSEC_MSK BIT(RTC_IVS_RSEC_POS)
+
+#define RTC_IVS_AMALL_POS 7U
+#define RTC_IVS_AMALL_MSK BIT(RTC_IVS_AMALL_POS)
+
+#define RTC_IVS_AYEAR_POS 6U
+#define RTC_IVS_AYEAR_MSK BIT(RTC_IVS_AYEAR_POS)
+
+#define RTC_IVS_AMON_POS 5U
+#define RTC_IVS_AMON_MSK BIT(RTC_IVS_AMON_POS)
+
+#define RTC_IVS_ADTAE_POS 4U
+#define RTC_IVS_ADTAE_MSK BIT(RTC_IVS_ADTAE_POS)
+
+#define RTC_IVS_AWEEK_POS 3U
+#define RTC_IVS_AWEEK_MSK BIT(RTC_IVS_AWEEK_POS)
+
+#define RTC_IVS_AHOUR_POS 2U
+#define RTC_IVS_AHOUR_MSK BIT(RTC_IVS_AHOUR_POS)
+
+#define RTC_IVS_AMIN_POS 1U
+#define RTC_IVS_AMIN_MSK BIT(RTC_IVS_AMIN_POS)
+
+#define RTC_IVS_ASEC_POS 0U
+#define RTC_IVS_ASEC_MSK BIT(RTC_IVS_ASEC_POS)
+
+/****************** Bit definition for RTC_RIF register ************************/
+
+#define RTC_RIF_WKTM_POS 16U
+#define RTC_RIF_WKTM_MSK BIT(RTC_RIF_WKTM_POS)
+
+#define RTC_RIF_F1HZ_POS 15U
+#define RTC_RIF_F1HZ_MSK BIT(RTC_RIF_F1HZ_POS)
+
+#define RTC_RIF_RYEAR_POS 14U
+#define RTC_RIF_RYEAR_MSK BIT(RTC_RIF_RYEAR_POS)
+
+#define RTC_RIF_RMON_POS 13U
+#define RTC_RIF_RMON_MSK BIT(RTC_RIF_RMON_POS)
+
+#define RTC_RIF_RDATE_POS 12U
+#define RTC_RIF_RDATE_MSK BIT(RTC_RIF_RDATE_POS)
+
+#define RTC_RIF_RWEEK_POS 11U
+#define RTC_RIF_RWEEK_MSK BIT(RTC_RIF_RWEEK_POS)
+
+#define RTC_RIF_RHOUR_POS 10U
+#define RTC_RIF_RHOUR_MSK BIT(RTC_RIF_RHOUR_POS)
+
+#define RTC_RIF_RMIN_POS 9U
+#define RTC_RIF_RMIN_MSK BIT(RTC_RIF_RMIN_POS)
+
+#define RTC_RIF_RSEC_POS 8U
+#define RTC_RIF_RSEC_MSK BIT(RTC_RIF_RSEC_POS)
+
+#define RTC_RIF_AMALL_POS 7U
+#define RTC_RIF_AMALL_MSK BIT(RTC_RIF_AMALL_POS)
+
+#define RTC_RIF_AYEAR_POS 6U
+#define RTC_RIF_AYEAR_MSK BIT(RTC_RIF_AYEAR_POS)
+
+#define RTC_RIF_AMON_POS 5U
+#define RTC_RIF_AMON_MSK BIT(RTC_RIF_AMON_POS)
+
+#define RTC_RIF_ADTAE_POS 4U
+#define RTC_RIF_ADTAE_MSK BIT(RTC_RIF_ADTAE_POS)
+
+#define RTC_RIF_AWEEK_POS 3U
+#define RTC_RIF_AWEEK_MSK BIT(RTC_RIF_AWEEK_POS)
+
+#define RTC_RIF_AHOUR_POS 2U
+#define RTC_RIF_AHOUR_MSK BIT(RTC_RIF_AHOUR_POS)
+
+#define RTC_RIF_AMIN_POS 1U
+#define RTC_RIF_AMIN_MSK BIT(RTC_RIF_AMIN_POS)
+
+#define RTC_RIF_ASEC_POS 0U
+#define RTC_RIF_ASEC_MSK BIT(RTC_RIF_ASEC_POS)
+
+/****************** Bit definition for RTC_IFM register ************************/
+
+#define RTC_IFM_WKTM_POS 16U
+#define RTC_IFM_WKTM_MSK BIT(RTC_IFM_WKTM_POS)
+
+#define RTC_IFM_F1HZ_POS 15U
+#define RTC_IFM_F1HZ_MSK BIT(RTC_IFM_F1HZ_POS)
+
+#define RTC_IFM_RYEAR_POS 14U
+#define RTC_IFM_RYEAR_MSK BIT(RTC_IFM_RYEAR_POS)
+
+#define RTC_IFM_RMON_POS 13U
+#define RTC_IFM_RMON_MSK BIT(RTC_IFM_RMON_POS)
+
+#define RTC_IFM_RDATE_POS 12U
+#define RTC_IFM_RDATE_MSK BIT(RTC_IFM_RDATE_POS)
+
+#define RTC_IFM_RWEEK_POS 11U
+#define RTC_IFM_RWEEK_MSK BIT(RTC_IFM_RWEEK_POS)
+
+#define RTC_IFM_RHOUR_POS 10U
+#define RTC_IFM_RHOUR_MSK BIT(RTC_IFM_RHOUR_POS)
+
+#define RTC_IFM_RMIN_POS 9U
+#define RTC_IFM_RMIN_MSK BIT(RTC_IFM_RMIN_POS)
+
+#define RTC_IFM_RSEC_POS 8U
+#define RTC_IFM_RSEC_MSK BIT(RTC_IFM_RSEC_POS)
+
+#define RTC_IFM_AMALL_POS 7U
+#define RTC_IFM_AMALL_MSK BIT(RTC_IFM_AMALL_POS)
+
+#define RTC_IFM_AYEAR_POS 6U
+#define RTC_IFM_AYEAR_MSK BIT(RTC_IFM_AYEAR_POS)
+
+#define RTC_IFM_AMON_POS 5U
+#define RTC_IFM_AMON_MSK BIT(RTC_IFM_AMON_POS)
+
+#define RTC_IFM_ADTAE_POS 4U
+#define RTC_IFM_ADTAE_MSK BIT(RTC_IFM_ADTAE_POS)
+
+#define RTC_IFM_AWEEK_POS 3U
+#define RTC_IFM_AWEEK_MSK BIT(RTC_IFM_AWEEK_POS)
+
+#define RTC_IFM_AHOUR_POS 2U
+#define RTC_IFM_AHOUR_MSK BIT(RTC_IFM_AHOUR_POS)
+
+#define RTC_IFM_AMIN_POS 1U
+#define RTC_IFM_AMIN_MSK BIT(RTC_IFM_AMIN_POS)
+
+#define RTC_IFM_ASEC_POS 0U
+#define RTC_IFM_ASEC_MSK BIT(RTC_IFM_ASEC_POS)
+
+/****************** Bit definition for RTC_ICR register ************************/
+
+#define RTC_ICR_WKTM_POS 16U
+#define RTC_ICR_WKTM_MSK BIT(RTC_ICR_WKTM_POS)
+
+#define RTC_ICR_F1HZ_POS 15U
+#define RTC_ICR_F1HZ_MSK BIT(RTC_ICR_F1HZ_POS)
+
+#define RTC_ICR_RYEAR_POS 14U
+#define RTC_ICR_RYEAR_MSK BIT(RTC_ICR_RYEAR_POS)
+
+#define RTC_ICR_RMON_POS 13U
+#define RTC_ICR_RMON_MSK BIT(RTC_ICR_RMON_POS)
+
+#define RTC_ICR_RDATE_POS 12U
+#define RTC_ICR_RDATE_MSK BIT(RTC_ICR_RDATE_POS)
+
+#define RTC_ICR_RWEEK_POS 11U
+#define RTC_ICR_RWEEK_MSK BIT(RTC_ICR_RWEEK_POS)
+
+#define RTC_ICR_RHOUR_POS 10U
+#define RTC_ICR_RHOUR_MSK BIT(RTC_ICR_RHOUR_POS)
+
+#define RTC_ICR_RMIN_POS 9U
+#define RTC_ICR_RMIN_MSK BIT(RTC_ICR_RMIN_POS)
+
+#define RTC_ICR_RSEC_POS 8U
+#define RTC_ICR_RSEC_MSK BIT(RTC_ICR_RSEC_POS)
+
+#define RTC_ICR_AMALL_POS 7U
+#define RTC_ICR_AMALL_MSK BIT(RTC_ICR_AMALL_POS)
+
+#define RTC_ICR_AYEAR_POS 6U
+#define RTC_ICR_AYEAR_MSK BIT(RTC_ICR_AYEAR_POS)
+
+#define RTC_ICR_AMON_POS 5U
+#define RTC_ICR_AMON_MSK BIT(RTC_ICR_AMON_POS)
+
+#define RTC_ICR_ADTAE_POS 4U
+#define RTC_ICR_ADTAE_MSK BIT(RTC_ICR_ADTAE_POS)
+
+#define RTC_ICR_AWEEK_POS 3U
+#define RTC_ICR_AWEEK_MSK BIT(RTC_ICR_AWEEK_POS)
+
+#define RTC_ICR_AHOUR_POS 2U
+#define RTC_ICR_AHOUR_MSK BIT(RTC_ICR_AHOUR_POS)
+
+#define RTC_ICR_AMIN_POS 1U
+#define RTC_ICR_AMIN_MSK BIT(RTC_ICR_AMIN_POS)
+
+#define RTC_ICR_ASEC_POS 0U
+#define RTC_ICR_ASEC_MSK BIT(RTC_ICR_ASEC_POS)
+
+/****************** Bit definition for RTC_STAT register ************************/
+
+#define RTC_STAT_SYNDONE_POS 1U
+#define RTC_STAT_SYNDONE_MSK BIT(RTC_STAT_SYNDONE_POS)
+
+#define RTC_STAT_EMPTY_POS 0U
+#define RTC_STAT_EMPTY_MSK BIT(RTC_STAT_EMPTY_POS)
+
+/****************** Bit definition for RTC_BKEN register ************************/
+
+#define RTC_BKEN_BKEN_POS 0U
+#define RTC_BKEN_BKEN_MSK BIT(RTC_BKEN_BKEN_POS)
+
+typedef struct
+{
+ __IO uint32_t CON;
+ __IO uint32_t WKUP;
+ __IO uint32_t TIME;
+ __IO uint32_t CAL;
+ __IO uint32_t ALTIME;
+ __IO uint32_t ALCAL;
+ __IO uint32_t ALEN;
+ __IO uint32_t TRIG;
+ __O uint32_t IER;
+ __O uint32_t IDR;
+ __I uint32_t IVS;
+ __I uint32_t RIF;
+ __I uint32_t IFM;
+ __O uint32_t ICR;
+ uint32_t RESERVED0[2] ;
+ __I uint32_t STAT;
+ __IO uint32_t BKEN;
+} RTC_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_spi.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_spi.h
new file mode 100644
index 0000000000000000000000000000000000000000..0d7fbf6ccccea2d1d756f952a0416f5a88d9ede4
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_spi.h
@@ -0,0 +1,444 @@
+/**
+ **************************************************************************************
+ * @file REG_SPI.h
+ * @brief SPI Head File
+ *
+ * @version V0.01
+ * @data 12/3/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __SPI_H__
+#define __SPI_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for SPI_CON1 register ************************/
+
+#define SPI_CON1_BIDEN_POS 15U
+#define SPI_CON1_BIDEN_MSK BIT(SPI_CON1_BIDEN_POS)
+
+#define SPI_CON1_BIDOEN_POS 14U
+#define SPI_CON1_BIDOEN_MSK BIT(SPI_CON1_BIDOEN_POS)
+
+#define SPI_CON1_CRCEN_POS 13U
+#define SPI_CON1_CRCEN_MSK BIT(SPI_CON1_CRCEN_POS)
+
+#define SPI_CON1_NXTCRC_POS 12U
+#define SPI_CON1_NXTCRC_MSK BIT(SPI_CON1_NXTCRC_POS)
+
+#define SPI_CON1_FLEN_POS 11U
+#define SPI_CON1_FLEN_MSK BIT(SPI_CON1_FLEN_POS)
+
+#define SPI_CON1_RXO_POS 10U
+#define SPI_CON1_RXO_MSK BIT(SPI_CON1_RXO_POS)
+
+#define SPI_CON1_SSEN_POS 9U
+#define SPI_CON1_SSEN_MSK BIT(SPI_CON1_SSEN_POS)
+
+#define SPI_CON1_SSOUT_POS 8U
+#define SPI_CON1_SSOUT_MSK BIT(SPI_CON1_SSOUT_POS)
+
+#define SPI_CON1_LSBFST_POS 7U
+#define SPI_CON1_LSBFST_MSK BIT(SPI_CON1_LSBFST_POS)
+
+#define SPI_CON1_SPIEN_POS 6U
+#define SPI_CON1_SPIEN_MSK BIT(SPI_CON1_SPIEN_POS)
+
+#define SPI_CON1_BAUD_POSS 3U
+#define SPI_CON1_BAUD_POSE 5U
+#define SPI_CON1_BAUD_MSK BITS(SPI_CON1_BAUD_POSS,SPI_CON1_BAUD_POSE)
+
+#define SPI_CON1_MSTREN_POS 2U
+#define SPI_CON1_MSTREN_MSK BIT(SPI_CON1_MSTREN_POS)
+
+#define SPI_CON1_CPOL_POS 1U
+#define SPI_CON1_CPOL_MSK BIT(SPI_CON1_CPOL_POS)
+
+#define SPI_CON1_CPHA_POS 0U
+#define SPI_CON1_CPHA_MSK BIT(SPI_CON1_CPHA_POS)
+
+/****************** Bit definition for SPI_CON2 register ************************/
+
+#define SPI_CON2_RXFTH_POSS 14U
+#define SPI_CON2_RXFTH_POSE 15U
+#define SPI_CON2_RXFTH_MSK BITS(SPI_CON2_RXFTH_POSS,SPI_CON2_RXFTH_POSE)
+
+#define SPI_CON2_TXFTH_POSS 12U
+#define SPI_CON2_TXFTH_POSE 13U
+#define SPI_CON2_TXFTH_MSK BITS(SPI_CON2_TXFTH_POSS,SPI_CON2_TXFTH_POSE)
+
+#define SPI_CON2_FRF_POS 4U
+#define SPI_CON2_FRF_MSK BIT(SPI_CON2_FRF_POS)
+
+#define SPI_CON2_NSSP_POS 3U
+#define SPI_CON2_NSSP_MSK BIT(SPI_CON2_NSSP_POS)
+
+#define SPI_CON2_NSSOE_POS 2U
+#define SPI_CON2_NSSOE_MSK BIT(SPI_CON2_NSSOE_POS)
+
+#define SPI_CON2_TXDMA_POS 1U
+#define SPI_CON2_TXDMA_MSK BIT(SPI_CON2_TXDMA_POS)
+
+#define SPI_CON2_RXDMA_POS 0U
+#define SPI_CON2_RXDMA_MSK BIT(SPI_CON2_RXDMA_POS)
+
+/****************** Bit definition for SPI_STAT register ************************/
+
+#define SPI_STAT_RXFLV_POSS 24U
+#define SPI_STAT_RXFLV_POSE 28U
+#define SPI_STAT_RXFLV_MSK BITS(SPI_STAT_RXFLV_POSS,SPI_STAT_RXFLV_POSE)
+
+#define SPI_STAT_TXFLV_POSS 16U
+#define SPI_STAT_TXFLV_POSE 20U
+#define SPI_STAT_TXFLV_MSK BITS(SPI_STAT_TXFLV_POSS,SPI_STAT_TXFLV_POSE)
+
+#define SPI_STAT_BUSY_POS 15U
+#define SPI_STAT_BUSY_MSK BIT(SPI_STAT_BUSY_POS)
+
+#define SPI_STAT_CHSIDE_POS 14U
+#define SPI_STAT_CHSIDE_MSK BIT(SPI_STAT_CHSIDE_POS)
+
+#define SPI_STAT_RXTH_POS 12U
+#define SPI_STAT_RXTH_MSK BIT(SPI_STAT_RXTH_POS)
+
+#define SPI_STAT_RXUD_POS 11U
+#define SPI_STAT_RXUD_MSK BIT(SPI_STAT_RXUD_POS)
+
+#define SPI_STAT_RXOV_POS 10U
+#define SPI_STAT_RXOV_MSK BIT(SPI_STAT_RXOV_POS)
+
+#define SPI_STAT_RXF_POS 9U
+#define SPI_STAT_RXF_MSK BIT(SPI_STAT_RXF_POS)
+
+#define SPI_STAT_RXE_POS 8U
+#define SPI_STAT_RXE_MSK BIT(SPI_STAT_RXE_POS)
+
+#define SPI_STAT_TXTH_POS 4U
+#define SPI_STAT_TXTH_MSK BIT(SPI_STAT_TXTH_POS)
+
+#define SPI_STAT_TXUD_POS 3U
+#define SPI_STAT_TXUD_MSK BIT(SPI_STAT_TXUD_POS)
+
+#define SPI_STAT_TXOV_POS 2U
+#define SPI_STAT_TXOV_MSK BIT(SPI_STAT_TXOV_POS)
+
+#define SPI_STAT_TXF_POS 1U
+#define SPI_STAT_TXF_MSK BIT(SPI_STAT_TXF_POS)
+
+#define SPI_STAT_TXE_POS 0U
+#define SPI_STAT_TXE_MSK BIT(SPI_STAT_TXE_POS)
+
+/****************** Bit definition for SPI_DATA register ************************/
+
+#define SPI_DATA_DATA_POSS 0U
+#define SPI_DATA_DATA_POSE 15U
+#define SPI_DATA_DATA_MSK BITS(SPI_DATA_DATA_POSS,SPI_DATA_DATA_POSE)
+
+/****************** Bit definition for SPI_CRCPOLY register ************************/
+
+#define SPI_CRCPOLY_CRCPOLY_POSS 0U
+#define SPI_CRCPOLY_CRCPOLY_POSE 15U
+#define SPI_CRCPOLY_CRCPOLY_MSK BITS(SPI_CRCPOLY_CRCPOLY_POSS,SPI_CRCPOLY_CRCPOLY_POSE)
+
+/****************** Bit definition for SPI_RXCRC register ************************/
+
+#define SPI_RXCRC_RXCRC_POSS 0U
+#define SPI_RXCRC_RXCRC_POSE 15U
+#define SPI_RXCRC_RXCRC_MSK BITS(SPI_RXCRC_RXCRC_POSS,SPI_RXCRC_RXCRC_POSE)
+
+/****************** Bit definition for SPI_TXCRC register ************************/
+
+#define SPI_TXCRC_TXCRC_POSS 0U
+#define SPI_TXCRC_TXCRC_POSE 15U
+#define SPI_TXCRC_TXCRC_MSK BITS(SPI_TXCRC_TXCRC_POSS,SPI_TXCRC_TXCRC_POSE)
+
+/****************** Bit definition for SPI_I2SCFG register ************************/
+
+#define SPI_I2SCFG_I2SMOD_POS 11U
+#define SPI_I2SCFG_I2SMOD_MSK BIT(SPI_I2SCFG_I2SMOD_POS)
+
+#define SPI_I2SCFG_I2SE_POS 10U
+#define SPI_I2SCFG_I2SE_MSK BIT(SPI_I2SCFG_I2SE_POS)
+
+#define SPI_I2SCFG_I2SCFG_POSS 8U
+#define SPI_I2SCFG_I2SCFG_POSE 9U
+#define SPI_I2SCFG_I2SCFG_MSK BITS(SPI_I2SCFG_I2SCFG_POSS,SPI_I2SCFG_I2SCFG_POSE)
+
+#define SPI_I2SCFG_PCMSYNC_POS 7U
+#define SPI_I2SCFG_PCMSYNC_MSK BIT(SPI_I2SCFG_PCMSYNC_POS)
+
+#define SPI_I2SCFG_I2SSTD_POSS 4U
+#define SPI_I2SCFG_I2SSTD_POSE 5U
+#define SPI_I2SCFG_I2SSTD_MSK BITS(SPI_I2SCFG_I2SSTD_POSS,SPI_I2SCFG_I2SSTD_POSE)
+
+#define SPI_I2SCFG_CKPOL_POS 3U
+#define SPI_I2SCFG_CKPOL_MSK BIT(SPI_I2SCFG_CKPOL_POS)
+
+#define SPI_I2SCFG_DATLEN_POSS 1U
+#define SPI_I2SCFG_DATLEN_POSE 2U
+#define SPI_I2SCFG_DATLEN_MSK BITS(SPI_I2SCFG_DATLEN_POSS,SPI_I2SCFG_DATLEN_POSE)
+
+#define SPI_I2SCFG_CHLEN_POS 0U
+#define SPI_I2SCFG_CHLEN_MSK BIT(SPI_I2SCFG_CHLEN_POS)
+
+/****************** Bit definition for SPI_I2SPR register ************************/
+
+#define SPI_I2SPR_EXTCKEN_POS 10U
+#define SPI_I2SPR_EXTCKEN_MSK BIT(SPI_I2SPR_EXTCKEN_POS)
+
+#define SPI_I2SPR_MCKOE_POS 9U
+#define SPI_I2SPR_MCKOE_MSK BIT(SPI_I2SPR_MCKOE_POS)
+
+#define SPI_I2SPR_ODD_POS 8U
+#define SPI_I2SPR_ODD_MSK BIT(SPI_I2SPR_ODD_POS)
+
+#define SPI_I2SPR_I2SDIV_POSS 0U
+#define SPI_I2SPR_I2SDIV_POSE 7U
+#define SPI_I2SPR_I2SDIV_MSK BITS(SPI_I2SPR_I2SDIV_POSS,SPI_I2SPR_I2SDIV_POSE)
+
+/****************** Bit definition for SPI_IER register ************************/
+
+#define SPI_IER_FREIE_POS 18U
+#define SPI_IER_FREIE_MSK BIT(SPI_IER_FREIE_POS)
+
+#define SPI_IER_MODFIE_POS 17U
+#define SPI_IER_MODFIE_MSK BIT(SPI_IER_MODFIE_POS)
+
+#define SPI_IER_CRCERRIE_POS 16U
+#define SPI_IER_CRCERRIE_MSK BIT(SPI_IER_CRCERRIE_POS)
+
+#define SPI_IER_RXTHIE_POS 12U
+#define SPI_IER_RXTHIE_MSK BIT(SPI_IER_RXTHIE_POS)
+
+#define SPI_IER_RXUDIE_POS 11U
+#define SPI_IER_RXUDIE_MSK BIT(SPI_IER_RXUDIE_POS)
+
+#define SPI_IER_RXOVIE_POS 10U
+#define SPI_IER_RXOVIE_MSK BIT(SPI_IER_RXOVIE_POS)
+
+#define SPI_IER_RXFIE_POS 9U
+#define SPI_IER_RXFIE_MSK BIT(SPI_IER_RXFIE_POS)
+
+#define SPI_IER_TXTHIE_POS 4U
+#define SPI_IER_TXTHIE_MSK BIT(SPI_IER_TXTHIE_POS)
+
+#define SPI_IER_TXUDIE_POS 3U
+#define SPI_IER_TXUDIE_MSK BIT(SPI_IER_TXUDIE_POS)
+
+#define SPI_IER_TXOVIE_POS 2U
+#define SPI_IER_TXOVIE_MSK BIT(SPI_IER_TXOVIE_POS)
+
+#define SPI_IER_TXEIE_POS 0U
+#define SPI_IER_TXEIE_MSK BIT(SPI_IER_TXEIE_POS)
+
+/****************** Bit definition for SPI_IDR register ************************/
+
+#define SPI_IDR_FREID_POS 18U
+#define SPI_IDR_FREID_MSK BIT(SPI_IDR_FREID_POS)
+
+#define SPI_IDR_MODFID_POS 17U
+#define SPI_IDR_MODFID_MSK BIT(SPI_IDR_MODFID_POS)
+
+#define SPI_IDR_CRCERRID_POS 16U
+#define SPI_IDR_CRCERRID_MSK BIT(SPI_IDR_CRCERRID_POS)
+
+#define SPI_IDR_RXTHID_POS 12U
+#define SPI_IDR_RXTHID_MSK BIT(SPI_IDR_RXTHID_POS)
+
+#define SPI_IDR_RXUDID_POS 11U
+#define SPI_IDR_RXUDID_MSK BIT(SPI_IDR_RXUDID_POS)
+
+#define SPI_IDR_RXOVID_POS 10U
+#define SPI_IDR_RXOVID_MSK BIT(SPI_IDR_RXOVID_POS)
+
+#define SPI_IDR_RXFID_POS 9U
+#define SPI_IDR_RXFID_MSK BIT(SPI_IDR_RXFID_POS)
+
+#define SPI_IDR_TXTHID_POS 4U
+#define SPI_IDR_TXTHID_MSK BIT(SPI_IDR_TXTHID_POS)
+
+#define SPI_IDR_TXUDID_POS 3U
+#define SPI_IDR_TXUDID_MSK BIT(SPI_IDR_TXUDID_POS)
+
+#define SPI_IDR_TXOVID_POS 2U
+#define SPI_IDR_TXOVID_MSK BIT(SPI_IDR_TXOVID_POS)
+
+#define SPI_IDR_TXEID_POS 0U
+#define SPI_IDR_TXEID_MSK BIT(SPI_IDR_TXEID_POS)
+
+/****************** Bit definition for SPI_IVS register ************************/
+
+#define SPI_IVS_FREIV_POS 18U
+#define SPI_IVS_FREIV_MSK BIT(SPI_IVS_FREIV_POS)
+
+#define SPI_IVS_MODFIV_POS 17U
+#define SPI_IVS_MODFIV_MSK BIT(SPI_IVS_MODFIV_POS)
+
+#define SPI_IVS_CRCERRIV_POS 16U
+#define SPI_IVS_CRCERRIV_MSK BIT(SPI_IVS_CRCERRIV_POS)
+
+#define SPI_IVS_RXTHIV_POS 12U
+#define SPI_IVS_RXTHIV_MSK BIT(SPI_IVS_RXTHIV_POS)
+
+#define SPI_IVS_RXUDIV_POS 11U
+#define SPI_IVS_RXUDIV_MSK BIT(SPI_IVS_RXUDIV_POS)
+
+#define SPI_IVS_RXOVIV_POS 10U
+#define SPI_IVS_RXOVIV_MSK BIT(SPI_IVS_RXOVIV_POS)
+
+#define SPI_IVS_RXFIV_POS 9U
+#define SPI_IVS_RXFIV_MSK BIT(SPI_IVS_RXFIV_POS)
+
+#define SPI_IVS_TXTHIV_POS 4U
+#define SPI_IVS_TXTHIV_MSK BIT(SPI_IVS_TXTHIV_POS)
+
+#define SPI_IVS_TXUDIV_POS 3U
+#define SPI_IVS_TXUDIV_MSK BIT(SPI_IVS_TXUDIV_POS)
+
+#define SPI_IVS_TXOVIV_POS 2U
+#define SPI_IVS_TXOVIV_MSK BIT(SPI_IVS_TXOVIV_POS)
+
+#define SPI_IVS_TXEIV_POS 0U
+#define SPI_IVS_TXEIV_MSK BIT(SPI_IVS_TXEIV_POS)
+
+/****************** Bit definition for SPI_RIF register ************************/
+
+#define SPI_RIF_FRERI_POS 18U
+#define SPI_RIF_FRERI_MSK BIT(SPI_RIF_FRERI_POS)
+
+#define SPI_RIF_MODFRI_POS 17U
+#define SPI_RIF_MODFRI_MSK BIT(SPI_RIF_MODFRI_POS)
+
+#define SPI_RIF_CRCERRRI_POS 16U
+#define SPI_RIF_CRCERRRI_MSK BIT(SPI_RIF_CRCERRRI_POS)
+
+#define SPI_RIF_RXTHRI_POS 12U
+#define SPI_RIF_RXTHRI_MSK BIT(SPI_RIF_RXTHRI_POS)
+
+#define SPI_RIF_RXUDRI_POS 11U
+#define SPI_RIF_RXUDRI_MSK BIT(SPI_RIF_RXUDRI_POS)
+
+#define SPI_RIF_RXOVRI_POS 10U
+#define SPI_RIF_RXOVRI_MSK BIT(SPI_RIF_RXOVRI_POS)
+
+#define SPI_RIF_RXFRI_POS 9U
+#define SPI_RIF_RXFRI_MSK BIT(SPI_RIF_RXFRI_POS)
+
+#define SPI_RIF_TXTHRI_POS 4U
+#define SPI_RIF_TXTHRI_MSK BIT(SPI_RIF_TXTHRI_POS)
+
+#define SPI_RIF_TXUDRI_POS 3U
+#define SPI_RIF_TXUDRI_MSK BIT(SPI_RIF_TXUDRI_POS)
+
+#define SPI_RIF_TXOVRI_POS 2U
+#define SPI_RIF_TXOVRI_MSK BIT(SPI_RIF_TXOVRI_POS)
+
+#define SPI_RIF_TXERI_POS 0U
+#define SPI_RIF_TXERI_MSK BIT(SPI_RIF_TXERI_POS)
+
+/****************** Bit definition for SPI_IFM register ************************/
+
+#define SPI_IFM_FREFM_POS 18U
+#define SPI_IFM_FREFM_MSK BIT(SPI_IFM_FREFM_POS)
+
+#define SPI_IFM_MODFFM_POS 17U
+#define SPI_IFM_MODFFM_MSK BIT(SPI_IFM_MODFFM_POS)
+
+#define SPI_IFM_CRCERRFM_POS 16U
+#define SPI_IFM_CRCERRFM_MSK BIT(SPI_IFM_CRCERRFM_POS)
+
+#define SPI_IFM_RXTHFM_POS 12U
+#define SPI_IFM_RXTHFM_MSK BIT(SPI_IFM_RXTHFM_POS)
+
+#define SPI_IFM_RXUDFM_POS 11U
+#define SPI_IFM_RXUDFM_MSK BIT(SPI_IFM_RXUDFM_POS)
+
+#define SPI_IFM_RXOVFM_POS 10U
+#define SPI_IFM_RXOVFM_MSK BIT(SPI_IFM_RXOVFM_POS)
+
+#define SPI_IFM_RXFFM_POS 9U
+#define SPI_IFM_RXFFM_MSK BIT(SPI_IFM_RXFFM_POS)
+
+#define SPI_IFM_TXTHFM_POS 4U
+#define SPI_IFM_TXTHFM_MSK BIT(SPI_IFM_TXTHFM_POS)
+
+#define SPI_IFM_TXUDFM_POS 3U
+#define SPI_IFM_TXUDFM_MSK BIT(SPI_IFM_TXUDFM_POS)
+
+#define SPI_IFM_TXOVFM_POS 2U
+#define SPI_IFM_TXOVFM_MSK BIT(SPI_IFM_TXOVFM_POS)
+
+#define SPI_IFM_TXEFM_POS 0U
+#define SPI_IFM_TXEFM_MSK BIT(SPI_IFM_TXEFM_POS)
+
+/****************** Bit definition for SPI_ICR register ************************/
+
+#define SPI_ICR_FREIC_POS 18U
+#define SPI_ICR_FREIC_MSK BIT(SPI_ICR_FREIC_POS)
+
+#define SPI_ICR_MODFIC_POS 17U
+#define SPI_ICR_MODFIC_MSK BIT(SPI_ICR_MODFIC_POS)
+
+#define SPI_ICR_CRCERRIC_POS 16U
+#define SPI_ICR_CRCERRIC_MSK BIT(SPI_ICR_CRCERRIC_POS)
+
+#define SPI_ICR_RXTHIC_POS 12U
+#define SPI_ICR_RXTHIC_MSK BIT(SPI_ICR_RXTHIC_POS)
+
+#define SPI_ICR_RXUDIC_POS 11U
+#define SPI_ICR_RXUDIC_MSK BIT(SPI_ICR_RXUDIC_POS)
+
+#define SPI_ICR_RXOVIC_POS 10U
+#define SPI_ICR_RXOVIC_MSK BIT(SPI_ICR_RXOVIC_POS)
+
+#define SPI_ICR_RXFIC_POS 9U
+#define SPI_ICR_RXFIC_MSK BIT(SPI_ICR_RXFIC_POS)
+
+#define SPI_ICR_TXTHIC_POS 4U
+#define SPI_ICR_TXTHIC_MSK BIT(SPI_ICR_TXTHIC_POS)
+
+#define SPI_ICR_TXUDIC_POS 3U
+#define SPI_ICR_TXUDIC_MSK BIT(SPI_ICR_TXUDIC_POS)
+
+#define SPI_ICR_TXOVIC_POS 2U
+#define SPI_ICR_TXOVIC_MSK BIT(SPI_ICR_TXOVIC_POS)
+
+#define SPI_ICR_TXEIC_POS 0U
+#define SPI_ICR_TXEIC_MSK BIT(SPI_ICR_TXEIC_POS)
+
+typedef struct
+{
+ __IO uint32_t CON1;
+ __IO uint32_t CON2;
+ __I uint32_t STAT;
+ __IO uint32_t DATA;
+ __IO uint32_t CRCPOLY;
+ __I uint32_t RXCRC;
+ __I uint32_t TXCRC;
+ __IO uint32_t I2SCFG;
+ __IO uint32_t I2SPR;
+ __O uint32_t IER;
+ __O uint32_t IDR;
+ __I uint32_t IVS;
+ __I uint32_t RIF;
+ __I uint32_t IFM;
+ __O uint32_t ICR;
+} SPI_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_syscfg.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_syscfg.h
new file mode 100644
index 0000000000000000000000000000000000000000..675d9484c9841ad57b31a1f37ddeef6c85b4e8c8
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_syscfg.h
@@ -0,0 +1,215 @@
+/**
+ **************************************************************************************
+ * @file REG_SYSCFG.h
+ * @brief SYSCFG Head File
+ *
+ * @version V0.01
+ * @date 12/5/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __SYSCFG_H__
+#define __SYSCFG_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for SYSCFG_REMAP register ************************/
+
+#define SYSCFG_REMAP_REALMOD_POSS 10U
+#define SYSCFG_REMAP_REALMOD_POSE 11U
+#define SYSCFG_REMAP_REALMOD_MSK BITS(SYSCFG_REMAP_REALMOD_POSS,SYSCFG_REMAP_REALMOD_POSE)
+
+#define SYSCFG_REMAP_EFBASE_POSS 4U
+#define SYSCFG_REMAP_EFBASE_POSE 7U
+#define SYSCFG_REMAP_EFBASE_MSK BITS(SYSCFG_REMAP_EFBASE_POSS,SYSCFG_REMAP_EFBASE_POSE)
+
+#define SYSCFG_REMAP_MEMMOD_POSS 2U
+#define SYSCFG_REMAP_MEMMOD_POSE 3U
+#define SYSCFG_REMAP_MEMMOD_MSK BITS(SYSCFG_REMAP_MEMMOD_POSS,SYSCFG_REMAP_MEMMOD_POSE)
+
+#define SYSCFG_REMAP_REMAP_POS 0U
+#define SYSCFG_REMAP_REMAP_MSK BIT(SYSCFG_REMAP_REMAP_POS)
+
+/****************** Bit definition for SYSCFG_TRIM register ************************/
+
+#define SYSCFG_TRIM_CNT_POSS 20U
+#define SYSCFG_TRIM_CNT_POSE 31U
+#define SYSCFG_TRIM_CNT_MSK BITS(SYSCFG_TRIM_CNT_POSS,SYSCFG_TRIM_CNT_POSE)
+
+#define SYSCFG_TRIM_FAIL_POS 18U
+#define SYSCFG_TRIM_FAIL_MSK BIT(SYSCFG_TRIM_FAIL_POS)
+
+#define SYSCFG_TRIM_NOEQU_POS 17U
+#define SYSCFG_TRIM_NOEQU_MSK BIT(SYSCFG_TRIM_NOEQU_POS)
+
+#define SYSCFG_TRIM_BUSY_POS 16U
+#define SYSCFG_TRIM_BUSY_MSK BIT(SYSCFG_TRIM_BUSY_POS)
+
+#define SYSCFG_TRIM_HRCTRIM_POSS 8U
+#define SYSCFG_TRIM_HRCTRIM_POSE 15U
+#define SYSCFG_TRIM_HRCTRIM_MSK BITS(SYSCFG_TRIM_HRCTRIM_POSS,SYSCFG_TRIM_HRCTRIM_POSE)
+
+#define SYSCFG_TRIM_TSRC_POS 1U
+#define SYSCFG_TRIM_TSRC_MSK BIT(SYSCFG_TRIM_TSRC_POS)
+
+#define SYSCFG_TRIM_TRIM_POS 0U
+#define SYSCFG_TRIM_TRIM_MSK BIT(SYSCFG_TRIM_TRIM_POS)
+
+/****************** Bit definition for SYSCFG_IRSEL register ************************/
+
+#define SYSCFG_IRSEL_PLR_POS 8U
+#define SYSCFG_IRSEL_PLR_MSK BIT(SYSCFG_IRSEL_PLR_POS)
+
+#define SYSCFG_IRSEL_SEL2_POSS 4U
+#define SYSCFG_IRSEL_SEL2_POSE 7U
+#define SYSCFG_IRSEL_SEL2_MSK BITS(SYSCFG_IRSEL_SEL2_POSS,SYSCFG_IRSEL_SEL2_POSE)
+
+#define SYSCFG_IRSEL_SEL1_POSS 0U
+#define SYSCFG_IRSEL_SEL1_POSE 3U
+#define SYSCFG_IRSEL_SEL1_MSK BITS(SYSCFG_IRSEL_SEL1_POSS,SYSCFG_IRSEL_SEL1_POSE)
+
+/****************** Bit definition for SYSCFG_CFG register ************************/
+
+#define SYSCFG_CFG_DBGH_EN_POSS 16U
+#define SYSCFG_CFG_DBGH_EN_POSE 31U
+#define SYSCFG_CFG_DBGH_EN_MSK BITS(SYSCFG_CFG_DBGH_EN_POSS,SYSCFG_CFG_DBGH_EN_POSE)
+
+#define SYSCFG_CFG_PVD_LCK_POS 14U
+#define SYSCFG_CFG_PVD_LCK_MSK BIT(SYSCFG_CFG_PVD_LCK_POS)
+
+#define SYSCFG_CFG_CSS_LCK_POS 13U
+#define SYSCFG_CFG_CSS_LCK_MSK BIT(SYSCFG_CFG_CSS_LCK_POS)
+
+#define SYSCFG_CFG_CPU_LCK_POS 12U
+#define SYSCFG_CFG_CPU_LCK_MSK BIT(SYSCFG_CFG_CPU_LCK_POS)
+
+#define SYSCFG_CFG_VTST_POSS 8U
+#define SYSCFG_CFG_VTST_POSE 9U
+#define SYSCFG_CFG_VTST_MSK BITS(SYSCFG_CFG_VTST_POSS,SYSCFG_CFG_VTST_POSE)
+
+#define SYSCFG_CFG_NRSTREQ_POS 7U
+#define SYSCFG_CFG_NRSTREQ_MSK BIT(SYSCFG_CFG_NRSTREQ_POS)
+
+#define SYSCFG_CFG_CURRGEN_POS 5U
+#define SYSCFG_CFG_CURRGEN_MSK BIT(SYSCFG_CFG_CURRGEN_POS)
+
+#define SYSCFG_CFG_TEMPEN_POS 4U
+#define SYSCFG_CFG_TEMPEN_MSK BIT(SYSCFG_CFG_TEMPEN_POS)
+
+#define SYSCFG_CFG_VREFEN_POS 3U
+#define SYSCFG_CFG_VREFEN_MSK BIT(SYSCFG_CFG_VREFEN_POS)
+
+#define SYSCFG_CFG_VRLS_POSS 0U
+#define SYSCFG_CFG_VRLS_POSE 2U
+#define SYSCFG_CFG_VRLS_MSK BITS(SYSCFG_CFG_VRLS_POSS,SYSCFG_CFG_VRLS_POSE)
+
+/****************** Bit definition for SYSCFG_PWCON register ************************/
+
+#define SYSCFG_PWCON_IOLOCK_POS 23U
+#define SYSCFG_PWCON_IOLOCK_MSK BIT(SYSCFG_PWCON_IOLOCK_POS)
+
+#define SYSCFG_PWCON_BGTRIM_POSS 17U
+#define SYSCFG_PWCON_BGTRIM_POSE 20U
+#define SYSCFG_PWCON_BGTRIM_MSK BITS(SYSCFG_PWCON_BGTRIM_POSS,SYSCFG_PWCON_BGTRIM_POSE)
+
+#define SYSCFG_PWCON_HRCLOCK_POS 16U
+#define SYSCFG_PWCON_HRCLOCK_MSK BIT(SYSCFG_PWCON_HRCLOCK_POS)
+
+#define SYSCFG_PWCON_HRCTRIM_POSS 8U
+#define SYSCFG_PWCON_HRCTRIM_POSE 15U
+#define SYSCFG_PWCON_HRCTRIM_MSK BITS(SYSCFG_PWCON_HRCTRIM_POSS,SYSCFG_PWCON_HRCTRIM_POSE)
+
+#define SYSCFG_PWCON_LOSCDRV_POSS 5U
+#define SYSCFG_PWCON_LOSCDRV_POSE 7U
+#define SYSCFG_PWCON_LOSCDRV_MSK BITS(SYSCFG_PWCON_LOSCDRV_POSS,SYSCFG_PWCON_LOSCDRV_POSE)
+
+#define SYSCFG_PWCON_PVDEN_POS 4U
+#define SYSCFG_PWCON_PVDEN_MSK BIT(SYSCFG_PWCON_PVDEN_POS)
+
+#define SYSCFG_PWCON_PVLS_POSS 0U
+#define SYSCFG_PWCON_PVLS_POSE 3U
+#define SYSCFG_PWCON_PVLS_MSK BITS(SYSCFG_PWCON_PVLS_POSS,SYSCFG_PWCON_PVLS_POSE)
+
+/****************** Bit definition for SYSCFG_WKCON register ************************/
+
+#define SYSCFG_WKCON_WKCLR_POS 31U
+#define SYSCFG_WKCON_WKCLR_MSK BIT(SYSCFG_WKCON_WKCLR_POS)
+
+#define SYSCFG_WKCON_LPLS_POSS 28U
+#define SYSCFG_WKCON_LPLS_POSE 30U
+#define SYSCFG_WKCON_LPLS_MSK BITS(SYSCFG_WKCON_LPLS_POSS,SYSCFG_WKCON_LPLS_POSE)
+
+#define SYSCFG_WKCON_WKEG_POSS 16U
+#define SYSCFG_WKCON_WKEG_POSE 27U
+#define SYSCFG_WKCON_WKEG_MSK BITS(SYSCFG_WKCON_WKEG_POSS,SYSCFG_WKCON_WKEG_POSE)
+
+#define SYSCFG_WKCON_WKEN_POSS 0U
+#define SYSCFG_WKCON_WKEN_POSE 11U
+#define SYSCFG_WKCON_WKEN_MSK BITS(SYSCFG_WKCON_WKEN_POSS,SYSCFG_WKCON_WKEN_POSE)
+
+/****************** Bit definition for SYSCFG_WKSTAT register ************************/
+
+#define SYSCFG_WKSTAT_FLAG_POS 16U
+#define SYSCFG_WKSTAT_FLAG_MSK BIT(SYSCFG_WKSTAT_FLAG_POS)
+
+#define SYSCFG_WKSTAT_FG_POSS 0U
+#define SYSCFG_WKSTAT_FG_POSE 11U
+#define SYSCFG_WKSTAT_FG_MSK BITS(SYSCFG_WKSTAT_FG_POSS,SYSCFG_WKSTAT_FG_POSE)
+
+/****************** Bit definition for SYSCFG_BKREG0 register ************************/
+
+#define SYSCFG_BKREG0_BKREG0_POSS 0U
+#define SYSCFG_BKREG0_BKREG0_POSE 31U
+#define SYSCFG_BKREG0_BKREG0_MSK BITS(SYSCFG_BKREG0_BKREG0_POSS,SYSCFG_BKREG0_BKREG0_POSE)
+
+/****************** Bit definition for SYSCFG_BKREG1 register ************************/
+
+#define SYSCFG_BKREG1_BKREG1_POSS 0U
+#define SYSCFG_BKREG1_BKREG1_POSE 31U
+#define SYSCFG_BKREG1_BKREG1_MSK BITS(SYSCFG_BKREG1_BKREG1_POSS,SYSCFG_BKREG1_BKREG1_POSE)
+
+/****************** Bit definition for SYSCFG_BKREG2 register ************************/
+
+#define SYSCFG_BKREG2_BKREG2_POSS 0U
+#define SYSCFG_BKREG2_BKREG2_POSE 31U
+#define SYSCFG_BKREG2_BKREG2_MSK BITS(SYSCFG_BKREG2_BKREG2_POSS,SYSCFG_BKREG2_BKREG2_POSE)
+
+/****************** Bit definition for SYSCFG_BKREG3 register ************************/
+
+#define SYSCFG_BKREG3_BKREG3_POSS 0U
+#define SYSCFG_BKREG3_BKREG3_POSE 29U
+#define SYSCFG_BKREG3_BKREG3_MSK BITS(SYSCFG_BKREG3_BKREG3_POSS,SYSCFG_BKREG3_BKREG3_POSE)
+
+typedef struct
+{
+ __O uint32_t REMAP;
+ __O uint32_t TRIM;
+ __IO uint32_t IRSEL;
+ uint32_t RESERVED0[12] ;
+ __IO uint32_t CFG;
+ __IO uint32_t PWCON;
+ uint32_t RESERVED1 ;
+ __IO uint32_t WKCON;
+ __I uint32_t WKSTAT;
+ __IO uint32_t BKREG0;
+ __IO uint32_t BKREG1;
+ __IO uint32_t BKREG2;
+ __IO uint32_t BKREG3;
+} SYSCFG_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_tick.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_tick.h
new file mode 100644
index 0000000000000000000000000000000000000000..13122aef46b42f4f92ed933d9b8a77f921cc83a3
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_tick.h
@@ -0,0 +1,113 @@
+/**
+ **************************************************************************************
+ * @file reg_TICK.h
+ * @brief TICK Head File
+ *
+ * @version V1.00.01
+ * @date 19/10/2018
+ * @author Eastsoft AE Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __TICK_H__
+#define __TICK_H__
+
+/******************************************************************************/
+/* Ȧs줸wq */
+/******************************************************************************/
+
+/* #pragma anon_unions */
+
+/****************** Bit definition for TICK_CSR register ************************/
+
+#define TICK_CSR_ENABLE_POS 0U
+#define TICK_CSR_ENABLE_MSK BIT(TICK_CSR_ENABLE_POS)
+
+#define TICK_CSR_TICKINT_POS 1U
+#define TICK_CSR_TICKINT_MSK BIT(TICK_CSR_TICKINT_POS)
+
+#define TICK_CSR_CLKSOURCE_POS 2U
+#define TICK_CSR_CLKSOURCE_MSK BIT(TICK_CSR_CLKSOURCE_POS)
+
+#define TICK_CSR_COUNTFLAG_POS 16U
+#define TICK_CSR_COUNTFLAG_MSK BIT(TICK_CSR_COUNTFLAG_POS)
+
+/****************** Bit definition for TICK_RVR register ************************/
+
+#define TICK_RVR_RELOAD_POSS 0U
+#define TICK_RVR_RELOAD_POSE 23U
+#define TICK_RVR_RELOAD_MSK BITS(TICK_RVR_RELOAD_POSS,TICK_RVR_RELOAD_POSE)
+
+/****************** Bit definition for TICK_CVR register ************************/
+
+#define TICK_CVR_CURRENT_POSS 0U
+#define TICK_CVR_CURRENT_POSE 23U
+#define TICK_CVR_CURRENT_MSK BITS(TICK_CVR_CURRENT_POSS,TICK_CVR_CURRENT_POSE)
+
+
+/****************** Bit definition for TICK_CALIB register ************************/
+
+#define TICK_CALIB_TENMS_POSS 0U
+#define TICK_CALIB_TENMS_POSE 23U
+#define TICK_CALIB_TENMS_MSK BITS(TICK_CALIB_TENMS_POSS,TICK_CALIB_TENMS_POSE)
+
+#define TICK_CALIB_SKEW_POS 30U
+#define TICK_CALIB_SKEW_MSK BIT(TICK_CALIB_SKEW_POS)
+
+#define TICK_CALIB_NOREF_POS 31U
+#define TICK_CALIB_NOREF_MSK BIT(TICK_CALIB_NOREF_POS)
+
+
+/* TICK Register */
+#define pTICK TICK
+
+/* TICK CSR Register(TICK_CSR) */
+#define CSR_COUNTFLAG(x) (x<<16) /* Indicates whether the counter has counted to 0 since the last read of this register
+ 0 timer has not counted to 0
+ 1 timer has counted to 0 */
+#define CSR_CLKSOURCE(x) (x<<2) /* Indicates the SysTick clock source:
+ 0 SysTick uses the optional external reference clock
+ 1 SysTick uses the processor clock */
+#define CSR_TICKINT(x) (x<<1) /* Indicates whether counting to 0 causes the status of the SysTick exception to change to pending:
+ 0 count to 0 does not affect the SysTick exception status
+ 1 count to 0 changes the SysTick exception status to pending */
+#define CSR_ENABLE(x) (x<<0) /* /Indicates the enabled status of the SysTick counter:
+ 0 counter is disabled
+ 1 counter is operating */
+
+
+/* TICK RVR Register(TICK_RVR) */
+#define RVR_RELOAD(x) (x<<0) /* The value to load into the SYST_CVR register when the counter reaches 0 */
+
+
+/* TICK CVR Register(TICK_CVR) */
+#define CVR_CURRENT(x) (x<<0) /* Current counter value
+ This is the value of the counter at the time it is sampled */
+
+
+/* TICK CALIB Register(TICK_CALIB) */
+#define CALIB_NOREF(x) (x<<31) /* Indicates whether the IMPLEMENTATION DEFINED reference clock is provided:
+ 0 the reference clock is implemented
+ 1 the reference clock is not implemented
+ When this bit is 1, the CLKSOURCE bit of the SYST_CSR register is forced to 1 and cannot be cleared to 0 */
+#define CALIB_SKEW(x) (x<<30) /* Indicates whether the 10ms calibration value is exact:
+ 0 10ms calibration value is exact
+ 1 10ms calibration value is inexact, because of the clock frequency */
+#define CALIB_TENMS(x) (x<<0) /* Optionally, holds a reload value to be used for 10ms (100Hz) timing, subject to system clock skew errors.
+ If this field is zero, the calibration value is not known */
+typedef struct
+{
+ __IO uint32_t CSR; /* 0x0, Control and Status */
+ __IO uint32_t RVR; /* 0x4, Reload Value */
+ __IO uint32_t CVR; /* 0x8, Current Value */
+ __I uint32_t CALIB; /* 0xC, Calibration */
+} TICK_TypeDef;
+
+
+#else
+/* */
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_uart.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_uart.h
new file mode 100644
index 0000000000000000000000000000000000000000..1cd5670f8edf067178451720645f2d19d1478944
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_uart.h
@@ -0,0 +1,606 @@
+/**
+ **************************************************************************************
+ * @file REG_UART.h
+ * @brief UART Head File
+ *
+ * @version V0.01
+ * @data 12/3/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __UART_H__
+#define __UART_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for UART_RXBUF register ************************/
+
+#define UART_RXBUF_RXBUF_POSS 0U
+#define UART_RXBUF_RXBUF_POSE 8U
+#define UART_RXBUF_RXBUF_MSK BITS(UART_RXBUF_RXBUF_POSS,UART_RXBUF_RXBUF_POSE)
+
+/****************** Bit definition for UART_TXBUF register ************************/
+
+#define UART_TXBUF_TXBUF_POSS 0U
+#define UART_TXBUF_TXBUF_POSE 8U
+#define UART_TXBUF_TXBUF_MSK BITS(UART_TXBUF_TXBUF_POSS,UART_TXBUF_TXBUF_POSE)
+
+/****************** Bit definition for UART_BRR register ************************/
+
+#define UART_BRR_BRR_POSS 0U
+#define UART_BRR_BRR_POSE 15U
+#define UART_BRR_BRR_MSK BITS(UART_BRR_BRR_POSS,UART_BRR_BRR_POSE)
+
+/****************** Bit definition for UART_LCON register ************************/
+
+#define UART_LCON_TXEN_POS 15U
+#define UART_LCON_TXEN_MSK BIT(UART_LCON_TXEN_POS)
+
+#define UART_LCON_RXEN_POS 14U
+#define UART_LCON_RXEN_MSK BIT(UART_LCON_RXEN_POS)
+
+#define UART_LCON_DBCEN_POS 13U
+#define UART_LCON_DBCEN_MSK BIT(UART_LCON_DBCEN_POS)
+
+#define UART_LCON_BREAK_POS 10U
+#define UART_LCON_BREAK_MSK BIT(UART_LCON_BREAK_POS)
+
+#define UART_LCON_SWAP_POS 9U
+#define UART_LCON_SWAP_MSK BIT(UART_LCON_SWAP_POS)
+
+#define UART_LCON_TXINV_POS 8U
+#define UART_LCON_TXINV_MSK BIT(UART_LCON_TXINV_POS)
+
+#define UART_LCON_RXINV_POS 7U
+#define UART_LCON_RXINV_MSK BIT(UART_LCON_RXINV_POS)
+
+#define UART_LCON_DATAINV_POS 6U
+#define UART_LCON_DATAINV_MSK BIT(UART_LCON_DATAINV_POS)
+
+#define UART_LCON_MSB_POS 5U
+#define UART_LCON_MSB_MSK BIT(UART_LCON_MSB_POS)
+
+#define UART_LCON_PS_POS 4U
+#define UART_LCON_PS_MSK BIT(UART_LCON_PS_POS)
+
+#define UART_LCON_PE_POS 3U
+#define UART_LCON_PE_MSK BIT(UART_LCON_PE_POS)
+
+#define UART_LCON_STOP_POS 2U
+#define UART_LCON_STOP_MSK BIT(UART_LCON_STOP_POS)
+
+#define UART_LCON_DLS_POSS 0U
+#define UART_LCON_DLS_POSE 1U
+#define UART_LCON_DLS_MSK BITS(UART_LCON_DLS_POSS,UART_LCON_DLS_POSE)
+
+/****************** Bit definition for UART_MCON register ************************/
+
+#define UART_MCON_TXDMAEN_POS 15U
+#define UART_MCON_TXDMAEN_MSK BIT(UART_MCON_TXDMAEN_POS)
+
+#define UART_MCON_RXDMAEN_POS 14U
+#define UART_MCON_RXDMAEN_MSK BIT(UART_MCON_RXDMAEN_POS)
+
+#define UART_MCON_ABRREPT_POS 11U
+#define UART_MCON_ABRREPT_MSK BIT(UART_MCON_ABRREPT_POS)
+
+#define UART_MCON_ABRMOD_POSS 9U
+#define UART_MCON_ABRMOD_POSE 10U
+#define UART_MCON_ABRMOD_MSK BITS(UART_MCON_ABRMOD_POSS,UART_MCON_ABRMOD_POSE)
+
+#define UART_MCON_ABREN_POS 8U
+#define UART_MCON_ABREN_MSK BIT(UART_MCON_ABREN_POS)
+
+#define UART_MCON_BKREQ_POS 5U
+#define UART_MCON_BKREQ_MSK BIT(UART_MCON_BKREQ_POS)
+
+#define UART_MCON_HDEN_POS 4U
+#define UART_MCON_HDEN_MSK BIT(UART_MCON_HDEN_POS)
+
+#define UART_MCON_IREN_POS 3U
+#define UART_MCON_IREN_MSK BIT(UART_MCON_IREN_POS)
+
+#define UART_MCON_AFCEN_POS 2U
+#define UART_MCON_AFCEN_MSK BIT(UART_MCON_AFCEN_POS)
+
+#define UART_MCON_RTSSET_POS 1U
+#define UART_MCON_RTSSET_MSK BIT(UART_MCON_RTSSET_POS)
+
+#define UART_MCON_LPBKEN_POS 0U
+#define UART_MCON_LPBKEN_MSK BIT(UART_MCON_LPBKEN_POS)
+
+/****************** Bit definition for UART_RS485 register ************************/
+
+#define UART_RS485_DLY_POSS 16U
+#define UART_RS485_DLY_POSE 23U
+#define UART_RS485_DLY_MSK BITS(UART_RS485_DLY_POSS,UART_RS485_DLY_POSE)
+
+#define UART_RS485_ADDR_POSS 8U
+#define UART_RS485_ADDR_POSE 15U
+#define UART_RS485_ADDR_MSK BITS(UART_RS485_ADDR_POSS,UART_RS485_ADDR_POSE)
+
+#define UART_RS485_AADINV_POS 3U
+#define UART_RS485_AADINV_MSK BIT(UART_RS485_AADINV_POS)
+
+#define UART_RS485_AADACEN_POS 2U
+#define UART_RS485_AADACEN_MSK BIT(UART_RS485_AADACEN_POS)
+
+#define UART_RS485_AADNEN_POS 1U
+#define UART_RS485_AADNEN_MSK BIT(UART_RS485_AADNEN_POS)
+
+#define UART_RS485_AADEN_POS 0U
+#define UART_RS485_AADEN_MSK BIT(UART_RS485_AADEN_POS)
+
+/****************** Bit definition for UART_SCARD register ************************/
+
+#define UART_SCARD_BLEN_POSS 24U
+#define UART_SCARD_BLEN_POSE 31U
+#define UART_SCARD_BLEN_MSK BITS(UART_SCARD_BLEN_POSS,UART_SCARD_BLEN_POSE)
+
+#define UART_SCARD_GT_POSS 16U
+#define UART_SCARD_GT_POSE 23U
+#define UART_SCARD_GT_MSK BITS(UART_SCARD_GT_POSS,UART_SCARD_GT_POSE)
+
+#define UART_SCARD_PSC_POSS 8U
+#define UART_SCARD_PSC_POSE 15U
+#define UART_SCARD_PSC_MSK BITS(UART_SCARD_PSC_POSS,UART_SCARD_PSC_POSE)
+
+#define UART_SCARD_SCCNT_POSS 3U
+#define UART_SCARD_SCCNT_POSE 5U
+#define UART_SCARD_SCCNT_MSK BITS(UART_SCARD_SCCNT_POSS,UART_SCARD_SCCNT_POSE)
+
+#define UART_SCARD_SCLKEN_POS 2U
+#define UART_SCARD_SCLKEN_MSK BIT(UART_SCARD_SCLKEN_POS)
+
+#define UART_SCARD_SCNACK_POS 1U
+#define UART_SCARD_SCNACK_MSK BIT(UART_SCARD_SCNACK_POS)
+
+#define UART_SCARD_SCEN_POS 0U
+#define UART_SCARD_SCEN_MSK BIT(UART_SCARD_SCEN_POS)
+
+/****************** Bit definition for UART_LIN register ************************/
+
+#define UART_LIN_LINBKREQ_POS 2U
+#define UART_LIN_LINBKREQ_MSK BIT(UART_LIN_LINBKREQ_POS)
+
+#define UART_LIN_LINBDL_POS 1U
+#define UART_LIN_LINBDL_MSK BIT(UART_LIN_LINBDL_POS)
+
+#define UART_LIN_LINEN_POS 0U
+#define UART_LIN_LINEN_MSK BIT(UART_LIN_LINEN_POS)
+
+/****************** Bit definition for UART_RTOR register ************************/
+
+#define UART_RTOR_RTOEN_POS 24U
+#define UART_RTOR_RTOEN_MSK BIT(UART_RTOR_RTOEN_POS)
+
+#define UART_RTOR_RTO_POSS 0U
+#define UART_RTOR_RTO_POSE 23U
+#define UART_RTOR_RTO_MSK BITS(UART_RTOR_RTO_POSS,UART_RTOR_RTO_POSE)
+
+/****************** Bit definition for UART_FCON register ************************/
+
+#define UART_FCON_TXFL_POSS 11U
+#define UART_FCON_TXFL_POSE 15U
+#define UART_FCON_TXFL_MSK BITS(UART_FCON_TXFL_POSS,UART_FCON_TXFL_POSE)
+
+#define UART_FCON_TXTH_POSS 9U
+#define UART_FCON_TXTH_POSE 10U
+#define UART_FCON_TXTH_MSK BITS(UART_FCON_TXTH_POSS,UART_FCON_TXTH_POSE)
+
+#define UART_FCON_TFRST_POS 8U
+#define UART_FCON_TFRST_MSK BIT(UART_FCON_TFRST_POS)
+
+#define UART_FCON_RXFL_POSS 3U
+#define UART_FCON_RXFL_POSE 7U
+#define UART_FCON_RXFL_MSK BITS(UART_FCON_RXFL_POSS,UART_FCON_RXFL_POSE)
+
+#define UART_FCON_RXTH_POSS 1U
+#define UART_FCON_RXTH_POSE 2U
+#define UART_FCON_RXTH_MSK BITS(UART_FCON_RXTH_POSS,UART_FCON_RXTH_POSE)
+
+#define UART_FCON_RFRST_POS 0U
+#define UART_FCON_RFRST_MSK BIT(UART_FCON_RFRST_POS)
+
+/****************** Bit definition for UART_STAT register ************************/
+
+#define UART_STAT_TFOERR_POS 18U
+#define UART_STAT_TFOERR_MSK BIT(UART_STAT_TFOERR_POS)
+
+#define UART_STAT_TFFULL_POS 17U
+#define UART_STAT_TFFULL_MSK BIT(UART_STAT_TFFULL_POS)
+
+#define UART_STAT_TFEMPTY_POS 16U
+#define UART_STAT_TFEMPTY_MSK BIT(UART_STAT_TFEMPTY_POS)
+
+#define UART_STAT_TFTH_POS 15U
+#define UART_STAT_TFTH_MSK BIT(UART_STAT_TFTH_POS)
+
+#define UART_STAT_TSBUSY_POS 14U
+#define UART_STAT_TSBUSY_MSK BIT(UART_STAT_TSBUSY_POS)
+
+#define UART_STAT_RFUERR_POS 13U
+#define UART_STAT_RFUERR_MSK BIT(UART_STAT_RFUERR_POS)
+
+#define UART_STAT_RFOERR_POS 12U
+#define UART_STAT_RFOERR_MSK BIT(UART_STAT_RFOERR_POS)
+
+#define UART_STAT_RFFULL_POS 11U
+#define UART_STAT_RFFULL_MSK BIT(UART_STAT_RFFULL_POS)
+
+#define UART_STAT_RFEMPTY_POS 10U
+#define UART_STAT_RFEMPTY_MSK BIT(UART_STAT_RFEMPTY_POS)
+
+#define UART_STAT_RFTH_POS 9U
+#define UART_STAT_RFTH_MSK BIT(UART_STAT_RFTH_POS)
+
+#define UART_STAT_RSBUSY_POS 8U
+#define UART_STAT_RSBUSY_MSK BIT(UART_STAT_RSBUSY_POS)
+
+#define UART_STAT_CTSSTA_POS 3U
+#define UART_STAT_CTSSTA_MSK BIT(UART_STAT_CTSSTA_POS)
+
+#define UART_STAT_BKERR_POS 2U
+#define UART_STAT_BKERR_MSK BIT(UART_STAT_BKERR_POS)
+
+#define UART_STAT_FERR_POS 1U
+#define UART_STAT_FERR_MSK BIT(UART_STAT_FERR_POS)
+
+#define UART_STAT_PERR_POS 0U
+#define UART_STAT_PERR_MSK BIT(UART_STAT_PERR_POS)
+
+/****************** Bit definition for UART_IER register ************************/
+
+#define UART_IER_TFOVER_POS 18U
+#define UART_IER_TFOVER_MSK BIT(UART_IER_TFOVER_POS)
+
+#define UART_IER_TFEMPTY_POS 16U
+#define UART_IER_TFEMPTY_MSK BIT(UART_IER_TFEMPTY_POS)
+
+#define UART_IER_TFTH_POS 15U
+#define UART_IER_TFTH_MSK BIT(UART_IER_TFTH_POS)
+
+#define UART_IER_TBC_POS 14U
+#define UART_IER_TBC_MSK BIT(UART_IER_TBC_POS)
+
+#define UART_IER_RFUERR_POS 13U
+#define UART_IER_RFUERR_MSK BIT(UART_IER_RFUERR_POS)
+
+#define UART_IER_RFOERR_POS 12U
+#define UART_IER_RFOERR_MSK BIT(UART_IER_RFOERR_POS)
+
+#define UART_IER_RFFULL_POS 11U
+#define UART_IER_RFFULL_MSK BIT(UART_IER_RFFULL_POS)
+
+#define UART_IER_RFTH_POS 9U
+#define UART_IER_RFTH_MSK BIT(UART_IER_RFTH_POS)
+
+#define UART_IER_NOISE_POS 8U
+#define UART_IER_NOISE_MSK BIT(UART_IER_NOISE_POS)
+
+#define UART_IER_EOB_POS 7U
+#define UART_IER_EOB_MSK BIT(UART_IER_EOB_POS)
+
+#define UART_IER_LINBK_POS 6U
+#define UART_IER_LINBK_MSK BIT(UART_IER_LINBK_POS)
+
+#define UART_IER_ADDRM_POS 5U
+#define UART_IER_ADDRM_MSK BIT(UART_IER_ADDRM_POS)
+
+#define UART_IER_RXTO_POS 4U
+#define UART_IER_RXTO_MSK BIT(UART_IER_RXTO_POS)
+
+#define UART_IER_DCTS_POS 3U
+#define UART_IER_DCTS_MSK BIT(UART_IER_DCTS_POS)
+
+#define UART_IER_ABTO_POS 2U
+#define UART_IER_ABTO_MSK BIT(UART_IER_ABTO_POS)
+
+#define UART_IER_ABEND_POS 1U
+#define UART_IER_ABEND_MSK BIT(UART_IER_ABEND_POS)
+
+#define UART_IER_RXBERR_POS 0U
+#define UART_IER_RXBERR_MSK BIT(UART_IER_RXBERR_POS)
+
+/****************** Bit definition for UART_IDR register ************************/
+
+#define UART_IDR_TFOVER_POS 18U
+#define UART_IDR_TFOVER_MSK BIT(UART_IDR_TFOVER_POS)
+
+#define UART_IDR_TFEMPTY_POS 16U
+#define UART_IDR_TFEMPTY_MSK BIT(UART_IDR_TFEMPTY_POS)
+
+#define UART_IDR_TFTH_POS 15U
+#define UART_IDR_TFTH_MSK BIT(UART_IDR_TFTH_POS)
+
+#define UART_IDR_TBC_POS 14U
+#define UART_IDR_TBC_MSK BIT(UART_IDR_TBC_POS)
+
+#define UART_IDR_RFUERR_POS 13U
+#define UART_IDR_RFUERR_MSK BIT(UART_IDR_RFUERR_POS)
+
+#define UART_IDR_RFOERR_POS 12U
+#define UART_IDR_RFOERR_MSK BIT(UART_IDR_RFOERR_POS)
+
+#define UART_IDR_RFFULL_POS 11U
+#define UART_IDR_RFFULL_MSK BIT(UART_IDR_RFFULL_POS)
+
+#define UART_IDR_RFTH_POS 9U
+#define UART_IDR_RFTH_MSK BIT(UART_IDR_RFTH_POS)
+
+#define UART_IDR_NOISE_POS 8U
+#define UART_IDR_NOISE_MSK BIT(UART_IDR_NOISE_POS)
+
+#define UART_IDR_EOB_POS 7U
+#define UART_IDR_EOB_MSK BIT(UART_IDR_EOB_POS)
+
+#define UART_IDR_LINBK_POS 6U
+#define UART_IDR_LINBK_MSK BIT(UART_IDR_LINBK_POS)
+
+#define UART_IDR_ADDRM_POS 5U
+#define UART_IDR_ADDRM_MSK BIT(UART_IDR_ADDRM_POS)
+
+#define UART_IDR_RXTO_POS 4U
+#define UART_IDR_RXTO_MSK BIT(UART_IDR_RXTO_POS)
+
+#define UART_IDR_DCTS_POS 3U
+#define UART_IDR_DCTS_MSK BIT(UART_IDR_DCTS_POS)
+
+#define UART_IDR_ABTO_POS 2U
+#define UART_IDR_ABTO_MSK BIT(UART_IDR_ABTO_POS)
+
+#define UART_IDR_ABEND_POS 1U
+#define UART_IDR_ABEND_MSK BIT(UART_IDR_ABEND_POS)
+
+#define UART_IDR_RXBERR_POS 0U
+#define UART_IDR_RXBERR_MSK BIT(UART_IDR_RXBERR_POS)
+
+/****************** Bit definition for UART_IVS register ************************/
+
+#define UART_IVS_TFOVER_POS 18U
+#define UART_IVS_TFOVER_MSK BIT(UART_IVS_TFOVER_POS)
+
+#define UART_IVS_TFEMPTY_POS 16U
+#define UART_IVS_TFEMPTY_MSK BIT(UART_IVS_TFEMPTY_POS)
+
+#define UART_IVS_TFTH_POS 15U
+#define UART_IVS_TFTH_MSK BIT(UART_IVS_TFTH_POS)
+
+#define UART_IVS_TBC_POS 14U
+#define UART_IVS_TBC_MSK BIT(UART_IVS_TBC_POS)
+
+#define UART_IVS_RFUERR_POS 13U
+#define UART_IVS_RFUERR_MSK BIT(UART_IVS_RFUERR_POS)
+
+#define UART_IVS_RFOERR_POS 12U
+#define UART_IVS_RFOERR_MSK BIT(UART_IVS_RFOERR_POS)
+
+#define UART_IVS_RFFULL_POS 11U
+#define UART_IVS_RFFULL_MSK BIT(UART_IVS_RFFULL_POS)
+
+#define UART_IVS_RFTH_POS 9U
+#define UART_IVS_RFTH_MSK BIT(UART_IVS_RFTH_POS)
+
+#define UART_IVS_NOISE_POS 8U
+#define UART_IVS_NOISE_MSK BIT(UART_IVS_NOISE_POS)
+
+#define UART_IVS_EOB_POS 7U
+#define UART_IVS_EOB_MSK BIT(UART_IVS_EOB_POS)
+
+#define UART_IVS_LINBK_POS 6U
+#define UART_IVS_LINBK_MSK BIT(UART_IVS_LINBK_POS)
+
+#define UART_IVS_ADDRM_POS 5U
+#define UART_IVS_ADDRM_MSK BIT(UART_IVS_ADDRM_POS)
+
+#define UART_IVS_RXTO_POS 4U
+#define UART_IVS_RXTO_MSK BIT(UART_IVS_RXTO_POS)
+
+#define UART_IVS_DCTS_POS 3U
+#define UART_IVS_DCTS_MSK BIT(UART_IVS_DCTS_POS)
+
+#define UART_IVS_ABTO_POS 2U
+#define UART_IVS_ABTO_MSK BIT(UART_IVS_ABTO_POS)
+
+#define UART_IVS_ABEND_POS 1U
+#define UART_IVS_ABEND_MSK BIT(UART_IVS_ABEND_POS)
+
+#define UART_IVS_RXBERR_POS 0U
+#define UART_IVS_RXBERR_MSK BIT(UART_IVS_RXBERR_POS)
+
+/****************** Bit definition for UART_RIF register ************************/
+
+#define UART_RIF_TFOVER_POS 18U
+#define UART_RIF_TFOVER_MSK BIT(UART_RIF_TFOVER_POS)
+
+#define UART_RIF_TFEMPTY_POS 16U
+#define UART_RIF_TFEMPTY_MSK BIT(UART_RIF_TFEMPTY_POS)
+
+#define UART_RIF_TFTH_POS 15U
+#define UART_RIF_TFTH_MSK BIT(UART_RIF_TFTH_POS)
+
+#define UART_RIF_TBC_POS 14U
+#define UART_RIF_TBC_MSK BIT(UART_RIF_TBC_POS)
+
+#define UART_RIF_RFUERR_POS 13U
+#define UART_RIF_RFUERR_MSK BIT(UART_RIF_RFUERR_POS)
+
+#define UART_RIF_RFOERR_POS 12U
+#define UART_RIF_RFOERR_MSK BIT(UART_RIF_RFOERR_POS)
+
+#define UART_RIF_RFFULL_POS 11U
+#define UART_RIF_RFFULL_MSK BIT(UART_RIF_RFFULL_POS)
+
+#define UART_RIF_RFTH_POS 9U
+#define UART_RIF_RFTH_MSK BIT(UART_RIF_RFTH_POS)
+
+#define UART_RIF_NOISE_POS 8U
+#define UART_RIF_NOISE_MSK BIT(UART_RIF_NOISE_POS)
+
+#define UART_RIF_EOB_POS 7U
+#define UART_RIF_EOB_MSK BIT(UART_RIF_EOB_POS)
+
+#define UART_RIF_LINBK_POS 6U
+#define UART_RIF_LINBK_MSK BIT(UART_RIF_LINBK_POS)
+
+#define UART_RIF_ADDRM_POS 5U
+#define UART_RIF_ADDRM_MSK BIT(UART_RIF_ADDRM_POS)
+
+#define UART_RIF_RXTO_POS 4U
+#define UART_RIF_RXTO_MSK BIT(UART_RIF_RXTO_POS)
+
+#define UART_RIF_DCTS_POS 3U
+#define UART_RIF_DCTS_MSK BIT(UART_RIF_DCTS_POS)
+
+#define UART_RIF_ABTO_POS 2U
+#define UART_RIF_ABTO_MSK BIT(UART_RIF_ABTO_POS)
+
+#define UART_RIF_ABEND_POS 1U
+#define UART_RIF_ABEND_MSK BIT(UART_RIF_ABEND_POS)
+
+#define UART_RIF_RXBERR_POS 0U
+#define UART_RIF_RXBERR_MSK BIT(UART_RIF_RXBERR_POS)
+
+/****************** Bit definition for UART_IFM register ************************/
+
+#define UART_IFM_TFOVER_POS 18U
+#define UART_IFM_TFOVER_MSK BIT(UART_IFM_TFOVER_POS)
+
+#define UART_IFM_TFEMPTY_POS 16U
+#define UART_IFM_TFEMPTY_MSK BIT(UART_IFM_TFEMPTY_POS)
+
+#define UART_IFM_TFTH_POS 15U
+#define UART_IFM_TFTH_MSK BIT(UART_IFM_TFTH_POS)
+
+#define UART_IFM_TBC_POS 14U
+#define UART_IFM_TBC_MSK BIT(UART_IFM_TBC_POS)
+
+#define UART_IFM_RFUERR_POS 13U
+#define UART_IFM_RFUERR_MSK BIT(UART_IFM_RFUERR_POS)
+
+#define UART_IFM_RFOERR_POS 12U
+#define UART_IFM_RFOERR_MSK BIT(UART_IFM_RFOERR_POS)
+
+#define UART_IFM_RFFULL_POS 11U
+#define UART_IFM_RFFULL_MSK BIT(UART_IFM_RFFULL_POS)
+
+#define UART_IFM_RFTH_POS 9U
+#define UART_IFM_RFTH_MSK BIT(UART_IFM_RFTH_POS)
+
+#define UART_IFM_NOISE_POS 8U
+#define UART_IFM_NOISE_MSK BIT(UART_IFM_NOISE_POS)
+
+#define UART_IFM_EOB_POS 7U
+#define UART_IFM_EOB_MSK BIT(UART_IFM_EOB_POS)
+
+#define UART_IFM_LINBK_POS 6U
+#define UART_IFM_LINBK_MSK BIT(UART_IFM_LINBK_POS)
+
+#define UART_IFM_ADDRM_POS 5U
+#define UART_IFM_ADDRM_MSK BIT(UART_IFM_ADDRM_POS)
+
+#define UART_IFM_RXTO_POS 4U
+#define UART_IFM_RXTO_MSK BIT(UART_IFM_RXTO_POS)
+
+#define UART_IFM_DCTS_POS 3U
+#define UART_IFM_DCTS_MSK BIT(UART_IFM_DCTS_POS)
+
+#define UART_IFM_ABTO_POS 2U
+#define UART_IFM_ABTO_MSK BIT(UART_IFM_ABTO_POS)
+
+#define UART_IFM_ABEND_POS 1U
+#define UART_IFM_ABEND_MSK BIT(UART_IFM_ABEND_POS)
+
+#define UART_IFM_RXBERR_POS 0U
+#define UART_IFM_RXBERR_MSK BIT(UART_IFM_RXBERR_POS)
+
+/****************** Bit definition for UART_ICR register ************************/
+
+#define UART_ICR_TFOVER_POS 18U
+#define UART_ICR_TFOVER_MSK BIT(UART_ICR_TFOVER_POS)
+
+#define UART_ICR_TFEMPTY_POS 16U
+#define UART_ICR_TFEMPTY_MSK BIT(UART_ICR_TFEMPTY_POS)
+
+#define UART_ICR_TFTH_POS 15U
+#define UART_ICR_TFTH_MSK BIT(UART_ICR_TFTH_POS)
+
+#define UART_ICR_TBC_POS 14U
+#define UART_ICR_TBC_MSK BIT(UART_ICR_TBC_POS)
+
+#define UART_ICR_RFUERR_POS 13U
+#define UART_ICR_RFUERR_MSK BIT(UART_ICR_RFUERR_POS)
+
+#define UART_ICR_RFOERR_POS 12U
+#define UART_ICR_RFOERR_MSK BIT(UART_ICR_RFOERR_POS)
+
+#define UART_ICR_RFFULL_POS 11U
+#define UART_ICR_RFFULL_MSK BIT(UART_ICR_RFFULL_POS)
+
+#define UART_ICR_RFTH_POS 9U
+#define UART_ICR_RFTH_MSK BIT(UART_ICR_RFTH_POS)
+
+#define UART_ICR_NOISE_POS 8U
+#define UART_ICR_NOISE_MSK BIT(UART_ICR_NOISE_POS)
+
+#define UART_ICR_EOB_POS 7U
+#define UART_ICR_EOB_MSK BIT(UART_ICR_EOB_POS)
+
+#define UART_ICR_LINBK_POS 6U
+#define UART_ICR_LINBK_MSK BIT(UART_ICR_LINBK_POS)
+
+#define UART_ICR_ADDRM_POS 5U
+#define UART_ICR_ADDRM_MSK BIT(UART_ICR_ADDRM_POS)
+
+#define UART_ICR_RXTO_POS 4U
+#define UART_ICR_RXTO_MSK BIT(UART_ICR_RXTO_POS)
+
+#define UART_ICR_DCTS_POS 3U
+#define UART_ICR_DCTS_MSK BIT(UART_ICR_DCTS_POS)
+
+#define UART_ICR_ABTO_POS 2U
+#define UART_ICR_ABTO_MSK BIT(UART_ICR_ABTO_POS)
+
+#define UART_ICR_ABEND_POS 1U
+#define UART_ICR_ABEND_MSK BIT(UART_ICR_ABEND_POS)
+
+#define UART_ICR_RXBERR_POS 0U
+#define UART_ICR_RXBERR_MSK BIT(UART_ICR_RXBERR_POS)
+
+typedef struct
+{
+ __I uint32_t RXBUF;
+ __IO uint32_t TXBUF;
+ __IO uint32_t BRR;
+ __IO uint32_t LCON;
+ __IO uint32_t MCON;
+ __IO uint32_t RS485;
+ __IO uint32_t SCARD;
+ __IO uint32_t LIN;
+ __IO uint32_t RTOR;
+ __O uint32_t FCON;
+ __I uint32_t STAT;
+ __O uint32_t IER;
+ __O uint32_t IDR;
+ __I uint32_t IVS;
+ __I uint32_t RIF;
+ __I uint32_t IFM;
+ __O uint32_t ICR;
+} UART_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_usb.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_usb.h
new file mode 100644
index 0000000000000000000000000000000000000000..96858065519d45137f8841acf4c2c9d63247eb8a
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_usb.h
@@ -0,0 +1,873 @@
+/**
+ **************************************************************************************
+ * @file reg_usb.h
+ * @brief USB Head File
+ * @data 5/22/2018
+ * @author Eastsoft AE Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __REG_USB_H__
+#define __REG_USB_H__
+
+
+/******************************************************************************/
+/* ṹ嶨 */
+/******************************************************************************/
+
+/* ṹ */
+/* #pragma anon_unions */
+
+/****************** Bit definition for USB_FADDR register ************************/
+
+#define USB_FADDR_ADDR_POSS 0U
+#define USB_FADDR_ADDR_POSE 6U
+#define USB_FADDR_ADDR_MSK BITS(USB_FADDR_ADDR_POSS,USB_FADDR_ADDR_POSE)
+
+/****************** Bit definition for USB_POWER register ************************/
+
+#define USB_POWER_ISOUDT_POSS 7U
+#define USB_POWER_ISOUDT_MSK BIT(USB_POWER_ISOUDT_POSS)
+
+#define USB_POWER_RESET_POSS 3U
+#define USB_POWER_RESET_MSK BIT(USB_POWER_RESET_POSS)
+
+#define USB_POWER_RESUME_POSS 2U
+#define USB_POWER_RESUME_MSK BIT(USB_POWER_RESUME_POSS)
+
+#define USB_POWER_SUSPEND_POSS 1U
+#define USB_POWER_SUSPEND_MSK BIT(USB_POWER_SUSPEND_POSS)
+
+#define USB_POWER_SUSPENDEN_POSS 0U
+#define USB_POWER_SUSPENDEN_MSK BIT(USB_POWER_SUSPENDEN_POSS)
+
+/****************** Bit definition for USB_DPDMCTL register ************************/
+
+#define USB_DPDMCTL_DPPUD_POSS 3U
+#define USB_DPDMCTL_DPPUD_POSE 4U
+#define USB_DPDMCTL_DPPUD_MSK BITS(USB_DPDMCTL_DPPUD_POSS,USB_DPDMCTL_DPPUD_POSE)
+
+#define USB_DPDMCTL_DMPUD_POSS 1U
+#define USB_DPDMCTL_DMPUD_POSE 2U
+#define USB_DPDMCTL_DMPUD_MSK BITS(USB_DPDMCTL_DMPUD_POSS,USB_DPDMCTL_DMPUD_POSE)
+
+#define USB_DPDMCTL_PHYPWREN_POS 0U
+#define USB_DPDMCTL_PHYPWREN_MSK BIT(USB_DPDMCTL_PHYPWREN_POS)
+
+/****************** Bit definition for USB_SWCID register ************************/
+
+#define USB_SWCID_HOST_POSS 1U
+#define USB_SWCID_HOST_MSK BIT(USB_SWCID_HOST_POSS)
+
+#define USB_SWCID_CIDCTRL_POSS 0U
+#define USB_SWCID_CIDCTRL_MSK BIT(USB_SWCID_CIDCTRL_POSS)
+
+/****************** Bit definition for USB_SWVBUS register ************************/
+
+#define USB_SWVBUS_VALTH_POS 3U
+#define USB_SWVBUS_VALTH_MSK BIT(USB_SWVBUS_VALTH_POS)
+
+#define USB_SWVBUS_SESVALTH_POS 2U
+#define USB_SWVBUS_SESVALTH_MSK BIT(USB_SWVBUS_SESVALTH_POS)
+
+#define USB_SWVBUS_SESENDTH_POS 1U
+#define USB_SWVBUS_SESENDTH_MSK BIT(USB_SWVBUS_SESENDTH_POS)
+
+#define USB_SWVBUS_SIGCTRL_POS 0U
+#define USB_SWVBUS_SIGCTRL_MSK BIT(USB_SWVBUS_SIGCTRL_POS)
+
+/****************** Bit definition for USB_TMODE register ************************/
+
+#define USB_TMODE_PROTECT_POSS 1U
+#define USB_TMODE_PROTECT_POSE 7U
+#define USB_TMODE_PROTECT_MSK BITS(USB_TMODE_PROTECT_POSS,USB_TMODE_PROTECT_POSE)
+
+#define USB_TMODE_ENABLE_POS 0U
+#define USB_TMODE_ENABLE_MSK BIT(USB_TMODE_ENABLE_POS)
+
+/****************** Bit definition for USB_FRAME1 register ************************/
+
+#define USB_FRAME1_LOWFRAME_POSS 0U
+#define USB_FRAME1_LOWFRAME_POSE 7U
+#define USB_FRAME1_LOWFRAME_MSK BITS(USB_FRAME1_LOWFRAME_POSS,USB_FRAME1_LOWFRAME_POSE)
+
+/****************** Bit definition for USB_FRAME2 register ************************/
+
+#define USB_FRAME2_UPFRAME_POSS 0U
+#define USB_FRAME2_UPFRAME_POSE 2U
+#define USB_FRAME2_UPFRAME_MSK BITS(USB_FRAME2_UPFRAME_POSS,USB_FRAME2_UPFRAME_POSE)
+
+/****************** Bit definition for USB_INDEX register ************************/
+
+#define USB_INDEX_EPTIDX_POSS 0U
+#define USB_INDEX_EPTIDX_POSE 3U
+#define USB_INDEX_EPTIDX_MSK BITS(USB_INDEX_EPTIDX_POSS,USB_INDEX_EPTIDX_POSE)
+
+/****************** Bit definition for USB_DEVCTRL register ************************/
+
+#define USB_DEVCTRL_FSDEV_POS 6U
+#define USB_DEVCTRL_FSDEV_MSK BIT(USB_DEVCTRL_FSDEV_POS)
+
+#define USB_DEVCTRL_LSDEV_POS 5U
+#define USB_DEVCTRL_LSDEV_MSK BIT(USB_DEVCTRL_LSDEV_POS)
+
+#define USB_DEVCTRL_HOST_POS 2U
+#define USB_DEVCTRL_HOST_MSK BIT(USB_DEVCTRL_HOST_POS)
+
+#define USB_DEVCTRL_HOSTREQ_POS 1U
+#define USB_DEVCTRL_HOSTREQ_MSK BIT(USB_DEVCTRL_HOSTREQ_POS)
+
+#define USB_DEVCTRL_SESSION_POS 0U
+#define USB_DEVCTRL_SESSION_MSK BIT(USB_DEVCTRL_SESSION_POS)
+
+/****************** Bit definition for USB_TXMAXP register ************************/
+
+#define USB_TXMAXP_MAXSIZE_POSS 0U
+#define USB_TXMAXP_MAXSIZE_POSE 7U
+#define USB_TXMAXP_MAXSIZE_MSK BITS(USB_TXMAXP_MAXSIZE_POSS,USB_TXMAXP_MAXSIZE_POSE)
+
+/****************** Bit definition for USB_CSR0L_TXCSRL register ************************/
+
+//
+//Endpoint 0
+//
+/* host mode */
+#define USB_CSR0L_TXCSRL_NAKTO_POS 7U
+#define USB_CSR0L_TXCSRL_NAKTO_MSK BIT(USB_CSR0L_TXCSRL_NAKTO_POS)
+
+#define USB_CSR0L_TXCSRL_STATUSPKT_POS 6U
+#define USB_CSR0L_TXCSRL_STATUSPKT_MSK BIT(USB_CSR0L_TXCSRL_STATUSPKT_POS)
+
+#define USB_CSR0L_TXCSRL_REQPKT_POS 5U
+#define USB_CSR0L_TXCSRL_REQPKT_MSK BIT(USB_CSR0L_TXCSRL_REQPKT_POS)
+
+#define USB_CSR0L_TXCSRL_ERROR_POS 4U
+#define USB_CSR0L_TXCSRL_ERROR_MSK BIT(USB_CSR0L_TXCSRL_ERROR_POS)
+
+#define USB_CSR0L_TXCSRL_SETUPPKT_POS 3U
+#define USB_CSR0L_TXCSRL_SETUPPKT_MSK BIT(USB_CSR0L_TXCSRL_SETUPPKT_POS)
+
+/* device mode */
+#define USB_CSR0L_TXCSRL_SETENDC_POS 7U
+#define USB_CSR0L_TXCSRL_SETENDC_MSK BIT(USB_CSR0L_TXCSRL_SETENDC_POS)
+
+#define USB_CSR0L_TXCSRL_RXRDYC_POS 6U
+#define USB_CSR0L_TXCSRL_RXRDYC_MSK BIT(USB_CSR0L_TXCSRL_RXRDYC_POS)
+
+#define USB_CSR0L_TXCSRL_STALL_POS 5U
+#define USB_CSR0L_TXCSRL_STALL_MSK BIT(USB_CSR0L_TXCSRL_STALL_POS)
+
+#define USB_CSR0L_TXCSRL_SETEND_POS 4U
+#define USB_CSR0L_TXCSRL_SETEND_MSK BIT(USB_CSR0L_TXCSRL_SETEND_POS)
+
+#define USB_CSR0L_TXCSRL_DATAEND_POS 3U
+#define USB_CSR0L_TXCSRL_DATAEND_MSK BIT(USB_CSR0L_TXCSRL_DATAEND_POS)
+
+#define USB_CSR0L_TXCSRL_STALLED_POS 2U
+#define USB_CSR0L_TXCSRL_STALLED_MSK BIT(USB_CSR0L_TXCSRL_STALLED_POS)
+
+#define USB_CSR0L_TXCSRL_TXRDY_POS 1U
+#define USB_CSR0L_TXCSRL_TXRDY_MSK BIT(USB_CSR0L_TXCSRL_TXRDY_POS)
+
+#define USB_CSR0L_TXCSRL_RXRDY_POS 0U
+#define USB_CSR0L_TXCSRL_RXRDY_MSK BIT(USB_CSR0L_TXCSRL_RXRDY_POS)
+
+//
+//Endpoint 1-6
+//
+/* host mode */
+#define USB_CSR0L_TXCSRL_NACKOUT_POS 7U
+#define USB_CSR0L_TXCSRL_NACKOUT_MSK BIT(USB_CSR0L_TXCSRL_NACKOUT_POS)
+
+#define USB_CSR0L_TXCSRL_CLRDATAT_POS 6U
+#define USB_CSR0L_TXCSRL_CLRDATAT_MSK BIT(USB_CSR0L_TXCSRL_CLRDATAT_POS)
+
+#define USB_CSR0L_TXCSRL_RXSTALL_POS 5U
+#define USB_CSR0L_TXCSRL_RXSTALL_MSK BIT(USB_CSR0L_TXCSRL_RXSTALL_POS)
+
+#define USB_CSR0L_TXCSRL_TXPKTRDY_POS 0U
+#define USB_CSR0L_TXCSRL_TXPKTRDY_MSK BIT(USB_CSR0L_TXCSRL_TXPKTRDY_POS)
+
+/* device mode */
+#define USB_CSR0L_TXCSRL_INCOMPTX_POS 7U
+#define USB_CSR0L_TXCSRL_INCOMPTX_MSK BIT(USB_CSR0L_TXCSRL_INCOMPTX_POS)
+
+#define USB_CSR0L_TXCSRL_CLRDATAT_POS 6U
+#define USB_CSR0L_TXCSRL_CLRDATAT_MSK BIT(USB_CSR0L_TXCSRL_CLRDATAT_POS)
+
+#define USB_CSR0L_TXCSRL_SENTSTALL_POS 5U
+#define USB_CSR0L_TXCSRL_SENTSTALL_MSK BIT(USB_CSR0L_TXCSRL_SENTSTALL_POS)
+
+#define USB_CSR0L_TXCSRL_SENDSTALL_POS 4U
+#define USB_CSR0L_TXCSRL_SENDSTALL_MSK BIT(USB_CSR0L_TXCSRL_SENDSTALL_POS)
+
+#define USB_CSR0L_TXCSRL_FLUSHFIFO_POS 3U
+#define USB_CSR0L_TXCSRL_FLUSHFIFO_MSK BIT(USB_CSR0L_TXCSRL_FLUSHFIFO_POS)
+
+#define USB_CSR0L_TXCSRL_UNDERRUN_POS 2U
+#define USB_CSR0L_TXCSRL_UNDERRUN_MSK BIT(USB_CSR0L_TXCSRL_UNDERRUN_POS)
+
+#define USB_CSR0L_TXCSRL_FIFONE_POS 1U
+#define USB_CSR0L_TXCSRL_FIFONE_MSK BIT(USB_CSR0L_TXCSRL_FIFONE_POS)
+
+#define USB_CSR0L_TXCSRL_TXPKTRDY_POS 0U
+#define USB_CSR0L_TXCSRL_TXPKTRDY_MSK BIT(USB_CSR0L_TXCSRL_TXPKTRDY_POS)
+
+/****************** Bit definition for USB_CSR0H_TXCSRH register ************************/
+//
+//For endpoint 0
+//
+#define USB_CSR0H_TXCSRH_FLUSH_POS 0U
+#define USB_CSR0H_TXCSRH_FLUSH_MSK BIT(USB_CSR0H_TXCSRH_FLUSH_POS)
+
+//
+//For endpoint 1-6
+//
+#define USB_CSR0H_TXCSRH_AUTOSET_POS 7U
+#define USB_CSR0H_TXCSRH_AUTOSET_MSK BIT(USB_CSR0H_TXCSRH_AUTOSET_POS)
+
+#define USB_CSR0H_TXCSRH_ISO_POS 6U
+#define USB_CSR0H_TXCSRH_ISO_MSK BIT(USB_CSR0H_TXCSRH_ISO_POS)
+
+#define USB_CSR0H_TXCSRH_MODE_POS 5U
+#define USB_CSR0H_TXCSRH_MODE_MSK BIT(USB_CSR0H_TXCSRH_MODE_POS)
+
+#define USB_CSR0H_TXCSRH_FDT_POS 3U
+#define USB_CSR0H_TXCSRH_FDT_MSK BIT(USB_CSR0H_TXCSRH_FDT_POS)
+
+/****************** Bit definition for USB_RXMAXP register ************************/
+
+#define USB_RXMAXP_MAXSIZE_POSS 0U
+#define USB_RXMAXP_MAXSIZE_POSE 7U
+#define USB_RXMAXP_MAXSIZE_MSK BITS(USB_RXMAXP_MAXSIZE_POSS,USB_RXMAXP_MAXSIZE_POSE)
+
+/****************** Bit definition for USB_RXCSRL register ************************/
+
+#define USB_RXCSRL_CLRDT_POS 7U
+#define USB_RXCSRL_CLRDT_MSK BIT(USB_RXCSRL_CLRDT_POS)
+
+#define USB_RXCSRL_STALLED_POS 6U
+#define USB_RXCSRL_STALLED_MSK BIT(USB_RXCSRL_STALLED_POS)
+
+#define USB_RXCSRL_REQPKT_POS 5U
+#define USB_RXCSRL_REQPKT_MSK BIT(USB_RXCSRL_REQPKT_POS)
+
+#define USB_RXCSRL_STALL_POS 5U
+#define USB_RXCSRL_STALL_MSK BIT(USB_RXCSRL_STALL_POS)
+
+#define USB_RXCSRL_FLUSH_POS 4U
+#define USB_RXCSRL_FLUSH_MSK BIT(USB_RXCSRL_FLUSH_POS)
+
+#define USB_RXCSRL_DATAERR_NAKTO_POS 3U
+#define USB_RXCSRL_DATAERR_NAKTO_MSK BIT(USB_RXCSRL_DATAERR_NAKTO_POS)
+
+#define USB_RXCSRL_ERROR_POS 2U
+#define USB_RXCSRL_ERROR_MSK BIT(USB_RXCSRL_ERROR_POS)
+
+#define USB_RXCSRL_OVERRUN_POS 2U
+#define USB_RXCSRL_OVERRUN_MSK BIT(USB_RXCSRL_OVERRUN_POS)
+
+#define USB_RXCSRL_FULL_POS 1U
+#define USB_RXCSRL_FULL_MSK BIT(USB_RXCSRL_FULL_POS)
+
+#define USB_RXCSRL_RXRDY_POS 0U
+#define USB_RXCSRL_RXRDY_MSK BIT(USB_RXCSRL_RXRDY_POS)
+
+/****************** Bit definition for USB_RXCSRH register ************************/
+
+#define USB_RXCSRH_AUTOCLR_POS 7U
+#define USB_RXCSRH_AUTOCLR_MSK BIT(USB_RXCSRH_AUTOCLR_POS)
+
+#define USB_RXCSRH_AUTOREQ_POS 6U
+#define USB_RXCSRH_AUTOREQ_MSK BIT(USB_RXCSRH_AUTOREQ_POS)
+
+#define USB_RXCSRH_ISO_POS 6U
+#define USB_RXCSRH_ISO_MSK BIT(USB_RXCSRH_ISO_POS)
+
+/****************** Bit definition for USB_RXCOUNT1 register ************************/
+
+#define USB_RXCOUNT1_COUNT_POSS 0U
+#define USB_RXCOUNT1_COUNT_POSE 6U
+#define USB_RXCOUNT1_COUNT_MSK BITS(USB_RXCOUNT1_COUNT_POSS,USB_RXCOUNT1_COUNT_POSE)
+
+#define USB_RXCOUNT1_PKTLOW_POSS 0U
+#define USB_RXCOUNT1_PKTLOW_POSE 7U
+#define USB_RXCOUNT1_PKTLOW_MSK BITS(USB_RXCOUNT1_PKTLOW_POSS,USB_RXCOUNT1_PKTLOW_POSE)
+
+/****************** Bit definition for USB_RXCOUNT2 register ************************/
+
+#define USB_RXCOUNT2_PKTHIGH_POSS 0U
+#define USB_RXCOUNT2_PKTHIGH_POSE 2U
+#define USB_RXCOUNT2_PKTHIGH_MSK BITS(USB_RXCOUNT2_PKTHIGH_POSS,USB_RXCOUNT2_PKTHIGH_POSE)
+
+/****************** Bit definition for USB_TXTYPE register ************************/
+
+#define USB_TXTYPE_PROTOCOL_POSS 4U
+#define USB_TXTYPE_PROTOCOL_POSE 5U
+#define USB_TXTYPE_PROTOCOL_MSK BITS(USB_TXTYPE_PROTOCOL_POSS,USB_TXTYPE_PROTOCOL_POSE)
+
+#define USB_TXTYPE_TEPN_POSS 0U
+#define USB_TXTYPE_TEPN_POSE 3U
+#define USB_TXTYPE_TEPN_MSK BITS(USB_TXTYPE_TEPN_POSS,USB_TXTYPE_TEPN_POSE)
+
+/****************** Bit definition for USB_NAKLIMIT0_TXINTERVAL register ************************/
+
+#define USB_NAKLIMIT0_TXINTERVAL_NAKLMT_POSS 0U
+#define USB_NAKLIMIT0_TXINTERVAL_NAKLMT_POSE 7U
+#define USB_NAKLIMIT0_TXINTERVAL_NAKLMT_MSK BITS(USB_NAKLIMIT0_TXINTERVAL_NAKLMT_POSS,USB_NAKLIMIT0_TXINTERVAL_NAKLMT_POSE)
+
+/****************** Bit definition for USB_RXTYPE register ************************/
+
+#define USB_RXTYPE_PROTOCOL_POSS 4U
+#define USB_RXTYPE_PROTOCOL_POSE 5U
+#define USB_RXTYPE_PROTOCOL_MSK BITS(USB_RXTYPE_PROTOCOL_POSS,USB_RXTYPE_PROTOCOL_POSE)
+
+#define USB_RXTYPE_TEPN_POSS 0U
+#define USB_RXTYPE_TEPN_POSE 3U
+#define USB_RXTYPE_TEPN_MSK BITS(USB_RXTYPE_TEPN_POSS,USB_RXTYPE_TEPN_POSE)
+
+/****************** Bit definition for USB_RXINTERVAL register ************************/
+
+#define USB_RXINTERVAL_NAKLMT_POSS 0U
+#define USB_RXINTERVAL_NAKLMT_POSE 7U
+#define USB_RXINTERVAL_NAKLMT_MSK BITS(USB_RXINTERVAL_NAKLMT_POSS,USB_RXINTERVAL_NAKLMT_POSE)
+
+/****************** Bit definition for USB_TXFIFO1 register ************************/
+
+#define USB_TXFIFO1_ADDRL_POSS 0U
+#define USB_TXFIFO1_ADDRL_POSE 7U
+#define USB_TXFIFO1_ADDRL_MSK BITS(USB_TXFIFO1_ADDRL_POSS,USB_TXFIFO1_ADDRL_POSE)
+
+/****************** Bit definition for USB_TXFIFO2 register ************************/
+
+#define USB_TXFIFO2_MAXPKTSIZE_POSS 5U
+#define USB_TXFIFO2_MAXPKTSIZE_POSE 7U
+#define USB_TXFIFO2_MAXPKTSIZE_MSK BITS(USB_TXFIFO2_MAXPKTSIZE_POSS,USB_TXFIFO2_MAXPKTSIZE_POSE)
+
+#define USB_TXFIFO2_DPB_POS 4U
+#define USB_TXFIFO2_DPB_MSK BIT(USB_TXFIFO2_DPB_POS)
+
+#define USB_TXFIFO2_ADDRH_POSS 0U
+#define USB_TXFIFO2_ADDRH_POSE 3U
+#define USB_TXFIFO2_ADDRH_MSK BITS(USB_TXFIFO2_ADDRH_POSS,USB_TXFIFO2_ADDRH_POSE)
+
+/****************** Bit definition for USB_RXFIFO1 register ************************/
+
+#define USB_RXFIFO1_ADDRL_POSS 0U
+#define USB_RXFIFO1_ADDRL_POSE 7U
+#define USB_RXFIFO1_ADDRL_MSK BITS(USB_RXFIFO1_ADDRL_POSS,USB_RXFIFO1_ADDRL_POSE)
+
+/****************** Bit definition for USB_RXFIFO2 register ************************/
+
+#define USB_RXFIFO2_MAXPKTSIZE_POSS 5U
+#define USB_RXFIFO2_MAXPKTSIZE_POSE 7U
+#define USB_RXFIFO2_MAXPKTSIZE_MSK BITS(USB_RXFIFO2_MAXPKTSIZE_POSS,USB_RXFIFO2_MAXPKTSIZE_POSE)
+
+#define USB_RXFIFO2_DPB_POS 4U
+#define USB_RXFIFO2_DPB_MSK BIT(USB_RXFIFO2_DPB_POS)
+
+#define USB_RXFIFO2_ADDRH_POSS 0U
+#define USB_RXFIFO2_ADDRH_POSE 3U
+#define USB_RXFIFO2_ADDRH_MSK BITS(USB_RXFIFO2_ADDRH_POSS,USB_RXFIFO2_ADDRH_POSE)
+
+/************* Bit definition for USB_EP0FIFO/USB_EPxFIFO register *****************/
+
+#define USB_EPxFIFO_FIFO_POSS 0U
+#define USB_EPxFIFO_FIFO_POSE 7U
+#define USB_EPxFIFO_FIFO_MSK BITS(USB_EPxFIFO_FIFO_POSS,USB_EPxFIFO_FIFO_POSE)
+
+/****************** Bit definition for USB_TXIER register ************************/
+
+#define USB_TXIER_EP6IE_POS 6U
+#define USB_TXIER_EP6IE_MSK BIT(USB_TXIER_EP6IE_POS)
+
+#define USB_TXIER_EP5IE_POS 5U
+#define USB_TXIER_EP5IE_MSK BIT(USB_TXIER_EP5IE_POS)
+
+#define USB_TXIER_EP4IE_POS 4U
+#define USB_TXIER_EP4IE_MSK BIT(USB_TXIER_EP4IE_POS)
+
+#define USB_TXIER_EP3IE_POS 3U
+#define USB_TXIER_EP3IE_MSK BIT(USB_TXIER_EP3IE_POS)
+
+#define USB_TXIER_EP2IE_POS 2U
+#define USB_TXIER_EP2IE_MSK BIT(USB_TXIER_EP2IE_POS)
+
+#define USB_TXIER_EP1IE_POS 1U
+#define USB_TXIER_EP1IE_MSK BIT(USB_TXIER_EP1IE_POS)
+
+#define USB_TXIER_EP0IE_POS 0U
+#define USB_TXIER_EP0IE_MSK BIT(USB_TXIER_EP0IE_POS)
+
+/****************** Bit definition for USB_RXIER register ************************/
+
+#define USB_RXIER_EP6IE_POS 6U
+#define USB_RXIER_EP6IE_MSK BIT(USB_RXIER_EP6IE_POS)
+
+#define USB_RXIER_EP5IE_POS 5U
+#define USB_RXIER_EP5IE_MSK BIT(USB_RXIER_EP5IE_POS)
+
+#define USB_RXIER_EP4IE_POS 4U
+#define USB_RXIER_EP4IE_MSK BIT(USB_RXIER_EP4IE_POS)
+
+#define USB_RXIER_EP3IE_POS 3U
+#define USB_RXIER_EP3IE_MSK BIT(USB_RXIER_EP3IE_POS)
+
+#define USB_RXIER_EP2IE_POS 2U
+#define USB_RXIER_EP2IE_MSK BIT(USB_RXIER_EP2IE_POS)
+
+#define USB_RXIER_EP1IE_POS 1U
+#define USB_RXIER_EP1IE_MSK BIT(USB_RXIER_EP1IE_POS)
+
+/****************** Bit definition for USB_TXIDR register ************************/
+
+#define USB_TXIDR_EP6ID_POS 6U
+#define USB_TXIDR_EP6ID_MSK BIT(USB_TXIDR_EP6ID_POS)
+
+#define USB_TXIDR_EP5ID_POS 5U
+#define USB_TXIDR_EP5ID_MSK BIT(USB_TXIDR_EP5ID_POS)
+
+#define USB_TXIDR_EP4ID_POS 4U
+#define USB_TXIDR_EP4ID_MSK BIT(USB_TXIDR_EP4ID_POS)
+
+#define USB_TXIDR_EP3ID_POS 3U
+#define USB_TXIDR_EP3ID_MSK BIT(USB_TXIDR_EP3ID_POS)
+
+#define USB_TXIDR_EP2ID_POS 2U
+#define USB_TXIDR_EP2ID_MSK BIT(USB_TXIDR_EP2ID_POS)
+
+#define USB_TXIDR_EP1ID_POS 1U
+#define USB_TXIDR_EP1ID_MSK BIT(USB_TXIDR_EP1ID_POS)
+
+#define USB_TXIDR_EP0ID_POS 0U
+#define USB_TXIDR_EP0ID_MSK BIT(USB_TXIDR_EP0ID_POS)
+
+/****************** Bit definition for USB_RXIDR register ************************/
+
+#define USB_RXIDR_EP6ID_POS 6U
+#define USB_RXIDR_EP6ID_MSK BIT(USB_RXIDR_EP6ID_POS)
+
+#define USB_RXIDR_EP5ID_POS 5U
+#define USB_RXIDR_EP5ID_MSK BIT(USB_RXIDR_EP5ID_POS)
+
+#define USB_RXIDR_EP4ID_POS 4U
+#define USB_RXIDR_EP4ID_MSK BIT(USB_RXIDR_EP4ID_POS)
+
+#define USB_RXIDR_EP3ID_POS 3U
+#define USB_RXIDR_EP3ID_MSK BIT(USB_RXIDR_EP3ID_POS)
+
+#define USB_RXIDR_EP2ID_POS 2U
+#define USB_RXIDR_EP2ID_MSK BIT(USB_RXIDR_EP2ID_POS)
+
+#define USB_RXIDR_EP1ID_POS 1U
+#define USB_RXIDR_EP1ID_MSK BIT(USB_RXIDR_EP1ID_POS)
+
+/****************** Bit definition for USB_TXIVS register ************************/
+
+#define USB_TXIVS_EP6IVS_POS 6U
+#define USB_TXIVS_EP6IVS_MSK BIT(USB_TXIVS_EP6IVS_POS)
+
+#define USB_TXIVS_EP5IVS_POS 5U
+#define USB_TXIVS_EP5IVS_MSK BIT(USB_TXIVS_EP5IVS_POS)
+
+#define USB_TXIVS_EP4IVS_POS 4U
+#define USB_TXIVS_EP4IVS_MSK BIT(USB_TXIVS_EP4IVS_POS)
+
+#define USB_TXIVS_EP3IVS_POS 3U
+#define USB_TXIVS_EP3IVS_MSK BIT(USB_TXIVS_EP3IVS_POS)
+
+#define USB_TXIVS_EP2IVS_POS 2U
+#define USB_TXIVS_EP2IVS_MSK BIT(USB_TXIVS_EP2IVS_POS)
+
+#define USB_TXIVS_EP1IVS_POS 1U
+#define USB_TXIVS_EP1IVS_MSK BIT(USB_TXIVS_EP1IVS_POS)
+
+#define USB_TXIVS_EP0IVS_POS 0U
+#define USB_TXIVS_EP0IVS_MSK BIT(USB_TXIVS_EP0IVS_POS)
+
+/****************** Bit definition for USB_RXIVS register ************************/
+
+#define USB_RXIVS_EP6IVS_POS 6U
+#define USB_RXIVS_EP6IVS_MSK BIT(USB_RXIVS_EP6IVS_POS)
+
+#define USB_RXIVS_EP5IVS_POS 5U
+#define USB_RXIVS_EP5IVS_MSK BIT(USB_RXIVS_EP5IVS_POS)
+
+#define USB_RXIVS_EP4IVS_POS 4U
+#define USB_RXIVS_EP4IVS_MSK BIT(USB_RXIVS_EP4IVS_POS)
+
+#define USB_RXIVS_EP3IVS_POS 3U
+#define USB_RXIVS_EP3IVS_MSK BIT(USB_RXIVS_EP3IVS_POS)
+
+#define USB_RXIVS_EP2IVS_POS 2U
+#define USB_RXIVS_EP2IVS_MSK BIT(USB_RXIVS_EP2IVS_POS)
+
+#define USB_RXIVS_EP1IVS_POS 1U
+#define USB_RXIVS_EP1IVS_MSK BIT(USB_RXIVS_EP1IVS_POS)
+
+/****************** Bit definition for USB_TXRIF register ************************/
+
+#define USB_TXRIF_EP6RIF_POS 6U
+#define USB_TXRIF_EP6RIF_MSK BIT(USB_TXRIF_EP6RIF_POS)
+
+#define USB_TXRIF_EP5RIF_POS 5U
+#define USB_TXRIF_EP5RIF_MSK BIT(USB_TXRIF_EP5RIF_POS)
+
+#define USB_TXRIF_EP4RIF_POS 4U
+#define USB_TXRIF_EP4RIF_MSK BIT(USB_TXRIF_EP4RIF_POS)
+
+#define USB_TXRIF_EP3RIF_POS 3U
+#define USB_TXRIF_EP3RIF_MSK BIT(USB_TXRIF_EP3RIF_POS)
+
+#define USB_TXRIF_EP2RIF_POS 2U
+#define USB_TXRIF_EP2RIF_MSK BIT(USB_TXRIF_EP2RIF_POS)
+
+#define USB_TXRIF_EP1RIF_POS 1U
+#define USB_TXRIF_EP1RIF_MSK BIT(USB_TXRIF_EP1RIF_POS)
+
+#define USB_TXRIF_EP0RIF_POS 0U
+#define USB_TXRIF_EP0RIF_MSK BIT(USB_TXRIF_EP0RIF_POS)
+
+/****************** Bit definition for USB_RXRIF register ************************/
+
+#define USB_RXRIF_EP6RIF_POS 6U
+#define USB_RXRIF_EP6RIF_MSK BIT(USB_RXRIF_EP6RIF_POS)
+
+#define USB_RXRIF_EP5RIF_POS 5U
+#define USB_RXRIF_EP5RIF_MSK BIT(USB_RXRIF_EP5RIF_POS)
+
+#define USB_RXRIF_EP4RIF_POS 4U
+#define USB_RXRIF_EP4RIF_MSK BIT(USB_RXRIF_EP4RIF_POS)
+
+#define USB_RXRIF_EP3RIF_POS 3U
+#define USB_RXRIF_EP3RIF_MSK BIT(USB_RXRIF_EP3RIF_POS)
+
+#define USB_RXRIF_EP2RIF_POS 2U
+#define USB_RXRIF_EP2RIF_MSK BIT(USB_RXRIF_EP2RIF_POS)
+
+#define USB_RXRIF_EP1RIF_POS 1U
+#define USB_RXRIF_EP1RIF_MSK BIT(USB_RXRIF_EP1RIF_POS)
+
+/****************** Bit definition for USB_TXIFM register ************************/
+
+#define USB_TXIFM_EP6IFM_POS 6U
+#define USB_TXIFM_EP6IFM_MSK BIT(USB_TXIFM_EP6IFM_POS)
+
+#define USB_TXIFM_EP5IFM_POS 5U
+#define USB_TXIFM_EP5IFM_MSK BIT(USB_TXIFM_EP5IFM_POS)
+
+#define USB_TXIFM_EP4IFM_POS 4U
+#define USB_TXIFM_EP4IFM_MSK BIT(USB_TXIFM_EP4IFM_POS)
+
+#define USB_TXIFM_EP3IFM_POS 3U
+#define USB_TXIFM_EP3IFM_MSK BIT(USB_TXIFM_EP3IFM_POS)
+
+#define USB_TXIFM_EP2IFM_POS 2U
+#define USB_TXIFM_EP2IFM_MSK BIT(USB_TXIFM_EP2IFM_POS)
+
+#define USB_TXIFM_EP1IFM_POS 1U
+#define USB_TXIFM_EP1IFM_MSK BIT(USB_TXIFM_EP1IFM_POS)
+
+#define USB_TXIFM_EP0IFM_POS 0U
+#define USB_TXIFM_EP0IFM_MSK BIT(USB_TXIFM_EP0IFM_POS)
+
+/****************** Bit definition for USB_RXIFM register ************************/
+
+#define USB_RXIFM_EP6IFM_POS 6U
+#define USB_RXIFM_EP6IFM_MSK BIT(USB_RXIFM_EP6IFM_POS)
+
+#define USB_RXIFM_EP5IFM_POS 5U
+#define USB_RXIFM_EP5IFM_MSK BIT(USB_RXIFM_EP5IFM_POS)
+
+#define USB_RXIFM_EP4IFM_POS 4U
+#define USB_RXIFM_EP4IFM_MSK BIT(USB_RXIFM_EP4IFM_POS)
+
+#define USB_RXIFM_EP3IFM_POS 3U
+#define USB_RXIFM_EP3IFM_MSK BIT(USB_RXIFM_EP3IFM_POS)
+
+#define USB_RXIFM_EP2IFM_POS 2U
+#define USB_RXIFM_EP2IFM_MSK BIT(USB_RXIFM_EP2IFM_POS)
+
+#define USB_RXIFM_EP1IFM_POS 1U
+#define USB_RXIFM_EP1IFM_MSK BIT(USB_RXIFM_EP1IFM_POS)
+
+/****************** Bit definition for USB_TXICR register ************************/
+
+#define USB_TXICR_EP6ICR_POS 6U
+#define USB_TXICR_EP6ICR_MSK BIT(USB_TXICR_EP6ICR_POS)
+
+#define USB_TXICR_EP5ICR_POS 5U
+#define USB_TXICR_EP5ICR_MSK BIT(USB_TXICR_EP5ICR_POS)
+
+#define USB_TXICR_EP4ICR_POS 4U
+#define USB_TXICR_EP4ICR_MSK BIT(USB_TXICR_EP4ICR_POS)
+
+#define USB_TXICR_EP3ICR_POS 3U
+#define USB_TXICR_EP3ICR_MSK BIT(USB_TXICR_EP3ICR_POS)
+
+#define USB_TXICR_EP2ICR_POS 2U
+#define USB_TXICR_EP2ICR_MSK BIT(USB_TXICR_EP2ICR_POS)
+
+#define USB_TXICR_EP1ICR_POS 1U
+#define USB_TXICR_EP1ICR_MSK BIT(USB_TXICR_EP1ICR_POS)
+
+#define USB_TXICR_EP0ICR_POS 0U
+#define USB_TXICR_EP0ICR_MSK BIT(USB_TXICR_EP0ICR_POS)
+
+/****************** Bit definition for USB_RXICR register ************************/
+
+#define USB_RXICR_EP6ICR_POS 6U
+#define USB_RXICR_EP6ICR_MSK BIT(USB_RXICR_EP6ICR_POS)
+
+#define USB_RXICR_EP5ICR_POS 5U
+#define USB_RXICR_EP5ICR_MSK BIT(USB_RXICR_EP5ICR_POS)
+
+#define USB_RXICR_EP4ICR_POS 4U
+#define USB_RXICR_EP4ICR_MSK BIT(USB_RXICR_EP4ICR_POS)
+
+#define USB_RXICR_EP3ICR_POS 3U
+#define USB_RXICR_EP3ICR_MSK BIT(USB_RXICR_EP3ICR_POS)
+
+#define USB_RXICR_EP2ICR_POS 2U
+#define USB_RXICR_EP2ICR_MSK BIT(USB_RXICR_EP2ICR_POS)
+
+#define USB_RXICR_EP1ICR_POS 1U
+#define USB_RXICR_EP1ICR_MSK BIT(USB_RXICR_EP1ICR_POS)
+
+/****************** Bit definition for USB_IER register ************************/
+
+#define USB_IER_SESREQIE_POS 6U
+#define USB_IER_SESREQIE_MSK BIT(USB_IER_SESREQIE_POS)
+
+#define USB_IER_DISCONIE_POS 5U
+#define USB_IER_DISCONIE_MSK BIT(USB_IER_DISCONIE_POS)
+
+#define USB_IER_CONIE_POS 4U
+#define USB_IER_CONIE_MSK BIT(USB_IER_CONIE_POS)
+
+#define USB_IER_SOFIE_POS 3U
+#define USB_IER_SOFIE_MSK BIT(USB_IER_SOFIE_POS)
+
+#define USB_IER_BABIE_POS 2U
+#define USB_IER_BABIE_MSK BIT(USB_IER_BABIE_POS)
+
+#define USB_IER_RESTIE_POS 2U
+#define USB_IER_RESTIE_MSK BIT(USB_IER_RESTIE_POS)
+
+#define USB_IER_RESIE_POS 1U
+#define USB_IER_RESIE_MSK BIT(USB_IER_RESIE_POS)
+
+#define USB_IER_SUSPDIE_POS 0U
+#define USB_IER_SUSPDIE_MSK BIT(USB_IER_SUSPDIE_POS)
+
+/****************** Bit definition for USB_IDR register ************************/
+
+#define USB_IDR_SESREQID_POS 6U
+#define USB_IDR_SESREQID_MSK BIT(USB_IDR_SESREQID_POS)
+
+#define USB_IDR_DISCONID_POS 5U
+#define USB_IDR_DISCONID_MSK BIT(USB_IDR_DISCONID_POS)
+
+#define USB_IDR_CONID_POS 4U
+#define USB_IDR_CONID_MSK BIT(USB_IDR_CONID_POS)
+
+#define USB_IDR_SOFID_POS 3U
+#define USB_IDR_SOFID_MSK BIT(USB_IDR_SOFID_POS)
+
+#define USB_IDR_BABID_POS 2U
+#define USB_IDR_BABID_MSK BIT(USB_IDR_BABID_POS)
+
+#define USB_IDR_RESTID_POS 2U
+#define USB_IDR_RESTID_MSK BIT(USB_IDR_RESTID_POS)
+
+#define USB_IDR_RESID_POS 1U
+#define USB_IDR_RESID_MSK BIT(USB_IDR_RESID_POS)
+
+#define USB_IDR_SUSPDID_POS 0U
+#define USB_IDR_SUSPDID_MSK BIT(USB_IDR_SUSPDID_POS)
+
+/****************** Bit definition for USB_IVS register ************************/
+
+#define USB_IVS_SESREQIVS_POS 6U
+#define USB_IVS_SESREQIVS_MSK BIT(USB_IVS_SESREQIVS_POS)
+
+#define USB_IVS_DISCONIVS_POS 5U
+#define USB_IVS_DISCONIVS_MSK BIT(USB_IVS_DISCONIVS_POS)
+
+#define USB_IVS_CONIVS_POS 4U
+#define USB_IVS_CONIVS_MSK BIT(USB_IVS_CONIVS_POS)
+
+#define USB_IVS_SOFIVS_POS 3U
+#define USB_IVS_SOFIVS_MSK BIT(USB_IVS_SOFIVS_POS)
+
+#define USB_IVS_BABIVS_POS 2U
+#define USB_IVS_BABIVS_MSK BIT(USB_IVS_BABIVS_POS)
+
+#define USB_IVS_RESTIVS_POS 2U
+#define USB_IVS_RESTIVS_MSK BIT(USB_IVS_RESTIVS_POS)
+
+#define USB_IVS_RESIVS_POS 1U
+#define USB_IVS_RESIVS_MSK BIT(USB_IVS_RESIVS_POS)
+
+#define USB_IVS_SUSPDIVS_POS 0U
+#define USB_IVS_SUSPDIVS_MSK BIT(USB_IVS_SUSPDIVS_POS)
+
+/****************** Bit definition for USB_RIF register ************************/
+
+#define USB_RIF_SESREQRIF_POS 6U
+#define USB_RIF_SESREQRIF_MSK BIT(USB_RIF_SESREQRIF_POS)
+
+#define USB_RIF_DISCONRIF_POS 5U
+#define USB_RIF_DISCONRIF_MSK BIT(USB_RIF_DISCONRIF_POS)
+
+#define USB_RIF_CONRIF_POS 4U
+#define USB_RIF_CONRIF_MSK BIT(USB_RIF_CONRIF_POS)
+
+#define USB_RIF_SOFRIF_POS 3U
+#define USB_RIF_SOFRIF_MSK BIT(USB_RIF_SOFRIF_POS)
+
+#define USB_RIF_BABRIF_POS 2U
+#define USB_RIF_BABRIF_MSK BIT(USB_RIF_BABRIF_POS)
+
+#define USB_RIF_RESTRIF_POS 2U
+#define USB_RIF_RESTRIF_MSK BIT(USB_RIF_RESTRIF_POS)
+
+#define USB_RIF_RESRIF_POS 1U
+#define USB_RIF_RESRIF_MSK BIT(USB_RIF_RESRIF_POS)
+
+#define USB_RIF_SUSPDRIF_POS 0U
+#define USB_RIF_SUSPDRIF_MSK BIT(USB_RIF_SUSPDRIF_POS)
+
+/****************** Bit definition for USB_IFM register ************************/
+
+#define USB_IFM_SESREQIFM_POS 6U
+#define USB_IFM_SESREQIFM_MSK BIT(USB_IFM_SESREQIFM_POS)
+
+#define USB_IFM_DISCONIFM_POS 5U
+#define USB_IFM_DISCONIFM_MSK BIT(USB_IFM_DISCONIFM_POS)
+
+#define USB_IFM_CONIFM_POS 4U
+#define USB_IFM_CONIFM_MSK BIT(USB_IFM_CONIFM_POS)
+
+#define USB_IFM_SOFIFM_POS 3U
+#define USB_IFM_SOFIFM_MSK BIT(USB_IFM_SOFIFM_POS)
+
+#define USB_IFM_BABIFM_POS 2U
+#define USB_IFM_BABIFM_MSK BIT(USB_IFM_BABIFM_POS)
+
+#define USB_IFM_RESTIFM_POS 2U
+#define USB_IFM_RESTIFM_MSK BIT(USB_IFM_RESTIFM_POS)
+
+#define USB_IFM_RESIFM_POS 1U
+#define USB_IFM_RESIFM_MSK BIT(USB_IFM_RESIFM_POS)
+
+#define USB_IFM_SUSPDIFM_POS 0U
+#define USB_IFM_SUSPDIFM_MSK BIT(USB_IFM_SUSPDIFM_POS)
+
+/****************** Bit definition for USB_ICR register ************************/
+
+#define USB_ICR_SESREQICR_POS 6U
+#define USB_ICR_SESREQICR_MSK BIT(USB_ICR_SESREQICR_POS)
+
+#define USB_ICR_DISCONICR_POS 5U
+#define USB_ICR_DISCONICR_MSK BIT(USB_ICR_DISCONICR_POS)
+
+#define USB_ICR_CONICR_POS 4U
+#define USB_ICR_CONICR_MSK BIT(USB_ICR_CONICR_POS)
+
+#define USB_ICR_SOFICR_POS 3U
+#define USB_ICR_SOFICR_MSK BIT(USB_ICR_SOFICR_POS)
+
+#define USB_ICR_BABICR_POS 2U
+#define USB_ICR_BABICR_MSK BIT(USB_ICR_BABICR_POS)
+
+#define USB_ICR_RESTICR_POS 2U
+#define USB_ICR_RESTICR_MSK BIT(USB_ICR_RESTICR_POS)
+
+#define USB_ICR_RESICR_POS 1U
+#define USB_ICR_RESICR_MSK BIT(USB_ICR_RESICR_POS)
+
+#define USB_ICR_SUSPDICR_POS 0U
+#define USB_ICR_SUSPDICR_MSK BIT(USB_ICR_SUSPDICR_POS)
+
+typedef struct
+{
+ __IO uint8_t FADDR ; //0x0000 Function address register.
+ __IO uint8_t POWER ; //0x0001 Power management register.
+ __IO uint8_t DPDMCTRL ; //0x0002 DP DM Control register.
+ __IO uint8_t SWCID ; //0x0003 Softwave CID register.
+ __IO uint8_t SWVBUS ; //0x0004 Softwave VBUS register.
+ __IO uint8_t TMODE ; //0x0005 Test Mode register.
+ __IO uint8_t RES002[6] ; //0x0006~0x0B, Reserved
+ __IO uint8_t FRAME1 ; //0x000C, Frame number bits 0 to 7.
+ __IO uint8_t FRAME2 ; //0x000D, Frame number bits 8 to 10.
+ __IO uint8_t INDEX ; //0x000E, Index register for selecting the endp
+ __IO uint8_t DEVCTRL ; //0x000F, USB device control register.
+ __IO uint8_t TXMAXP ; //0x0010, Peripheral mode - Maximum packet size
+ __IO uint8_t CSR0L_TXCSRL ;//0x0011, Peripheral mode - Control Status regi
+ __IO uint8_t CSR0H_TXCSRH ;//0x0012, Peripheral mode - Control Status regi
+ __IO uint8_t RXMAXP ; //0x0013, Peripheral mode - Maximum packet size
+ __IO uint8_t RXCSR1 ; //0x0014, Peripheral mode - Control Status regi
+ __IO uint8_t RXCSR2 ; //0x0015, Peripheral mode - Control Status regi
+ __IO uint8_t RXCOUNT1 ; //0x0016, Peripheral mode - Number of bytes in
+ __IO uint8_t RXCOUNT2 ; //0x0017, Peripheral mode - Number of bytes in
+ __IO uint8_t TXTYPE ; //0x0018, Peripheral mode - //
+ __IO uint8_t NAKLIMIT0_TXINTERVAL ; //0x0019, Peripheral mode - //
+ __IO uint8_t RXTYPE ; //0x001A, Peripheral mode - //
+ __IO uint8_t RXINTERVAL ; //0x001B, Peripheral mode - //
+ __IO uint8_t TXFIFO1 ; //0x001C, Tx Endpoint FIFO details
+ __IO uint8_t TXFIFO2 ; //0x001D, Tx Endpoint FIFO details
+ __IO uint8_t RXFIFO1 ; //0x001E, Rx Endpoint FIFO details
+ __IO uint8_t RXFIFO2 ; //0x001F, Rx Endpoint FIFO details
+ __IO uint8_t EP0FIFO ; //0x0020, FIFOs for Endpoints 0.
+ __IO uint8_t RES021[3] ; //0x0021~0x23, Reserved
+ __IO uint8_t EP1FIFO ; //0x0024, FIFOs for Endpoints 1.
+ __IO uint8_t RES025[3] ; //0x0025~0x27, Reserved
+ __IO uint8_t EP2FIFO ; //0x0028, FIFOs for Endpoints 2.
+ __IO uint8_t RES029[3] ; //0x0029~0x2B, Reserved
+ __IO uint8_t EP3FIFO ; //0x002C, FIFOs for Endpoints 3.
+ __IO uint8_t RES02D[3] ; //0x002D~0x2F, Reserved
+ __IO uint8_t EP4FIFO ; //0x0030, FIFOs for Endpoints 4.
+ __IO uint8_t RES031[3] ; //0x0031~0x33, Reserved
+ __IO uint8_t EP5FIFO ; //0x0034, FIFOs for Endpoints 5.
+ __IO uint8_t RES035[3] ; //0x0035~0x37, Reserved
+ __IO uint8_t EP6FIFO ; //0x0038, FIFOs for Endpoints 6.
+ __IO uint8_t RES039[71] ; //0x0039~0x7C, Reserved
+ __IO uint8_t TXIER ; //0x0080, TX Endpoint 0~6 Interrupt Enable
+ __IO uint8_t RES081 ; //0x0081, Reserved
+ __IO uint8_t RXIER ; //0x0082, RX Endpoint 0~6 Interrupt Enable
+ __IO uint8_t RES083 ; //0x0083, Reserved
+ __IO uint8_t TXIDR ; //0x0084, TX Endpoint 0~6 Interrupt Disable
+ __IO uint8_t RES085 ; //0x0085, Reserved
+ __IO uint8_t RXIDR ; //0x0086, RX Endpoint 0~6 Interrupt Disable
+ __IO uint8_t RES087 ; //0x0087, Reserved
+ __IO uint8_t TXIVS ; //0x0088, TX Endpoint 0~6 Interrupt Valid Status
+ __IO uint8_t RES089 ; //0x0089, Reserved
+ __IO uint8_t RXIVS ; //0x008A, RX Endpoint 0~6 Interrupt Valid Status
+ __IO uint8_t RES08B ; //0x008B, Reserved
+ __IO uint8_t TXRIF ; //0x008C, TX Endpoint 0~6 Raw Interrupt Flag Status
+ __IO uint8_t RES08D ; //0x008D, Reserved
+ __IO uint8_t RXRIF ; //0x008E, RX Endpoint 0~6 Raw Interrupt Flag Status
+ __IO uint8_t RES08F ; //0x008F, Reserved
+ __IO uint8_t TXIFM ; //0x0090, TX Endpoint 0~6 Interrupt Flag Masked Status
+ __IO uint8_t RES091 ; //0x0091, Reserved
+ __IO uint8_t RXIFM ; //0x0092, RX Endpoint 0~6 Interrupt Flag Masked Status
+ __IO uint8_t RES093 ; //0x0093, Reserved
+ __IO uint8_t TXICR ; //0x0094, TX Endpoint 0~6 Interrupt Clear Register
+ __IO uint8_t RES095 ; //0x0095, Reserved
+ __IO uint8_t RXICR ; //0x0096, RX Endpoint 0~6 Interrupt Clear Register
+ __IO uint8_t RES097[9] ; //0x0097~0x9C, Reserved
+ __O uint32_t IER ; //0x00A0, USB Interrupt Enable Register
+ __O uint32_t IDR ; //0x00A4, USB Interrupt Disable Register
+ __I uint32_t IVS ; //0x00A8, USB Interrupt Valid Register
+ __I uint32_t RIF ; //0x00AC, USB Raw Interrupt Flag Status Register
+ __I uint32_t IFM ; //0x00B0, USB Interrupt Flag Masked Status
+ __O uint32_t ICR ; //0x00B4, USB Interrupt Clear Register
+} USBCTRL_TypeDef;
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdg.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdg.h
new file mode 100644
index 0000000000000000000000000000000000000000..0c64ea3d43ccf9f6d141e5ffe7cfb960fd51549b
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdg.h
@@ -0,0 +1,88 @@
+/**
+ **************************************************************************************
+ * @file reg_WWDG.h
+ * @brief WWDG Head File
+ *
+ * @version V1.00.01
+ * @data 19/10/2018
+ * @author Eastsoft AE Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __WWDG_H__
+#define __WWDG_H__
+
+typedef struct
+{
+ __IO uint32_t CR; /* 0x00 WWDG_CR Control register */
+ __IO uint32_t CFR; /* 0x04 WWDG_CFR Configuration register */
+ __O uint32_t IER; /* 0x08 WWDG_IER Interrupt enable register */
+ __O uint32_t IDR; /* 0x0C WWDG_IDR Interrupt disable register */
+ __I uint32_t IVS; /* 0x10 WWDG_IVS Interrupt valid status */
+ __I uint32_t RIF; /* 0x14 WWDG_RIF Raw interrupt flag */
+ __I uint32_t IFM; /* 0x18 WWDG_IFM Interrupt flag masked */
+ __O uint32_t ICR; /* 0x1C WWDG_ICR Interrupt clear register */
+} WWDG_TypeDef;
+
+/******************************************************************************/
+/* Ȧs줸wq */
+/******************************************************************************/
+
+/* #pragma anon_unions */
+
+/****************** Bit definition for WWDG_CR register ************************/
+
+#define WWDG_CR_WDGA_POS 7U
+#define WWDG_CR_WDGA_MSK BIT(WWDG_CR_WDGA_POS)
+
+#define WWDG_CR_T_POSS 0U
+#define WWDG_CR_T_POSE 6U
+#define WWDG_CR_T_MSK BITS(WWDG_CR_T_POSS,WWDG_CR_T_POSE)
+
+/****************** Bit definition for WWDG_CFR register ************************/
+
+#define WWDG_CFR_WDGTB_POS 7U
+#define WWDG_CFR_WDGTB_MSK BIT(WWDG_CFR_WDGTB_POS)
+
+#define WWDG_CFR_W_POSS 0U
+#define WWDG_CFR_W_POSE 6U
+#define WWDG_CFR_W_MSK BITS(WWDG_CFR_W_POSS,WWDG_CFR_W_POSE)
+
+/****************** Bit definition for WWDG_IER register ************************/
+
+#define WWDG_IER_EWIS_POS 7U
+#define WWDG_IER_EWIS_MSK BIT(WWDG_IER_EWIS_POS)
+
+/****************** Bit definition for WWDG_IDR register ************************/
+
+#define WWDG_IDR_EWIS_POS 7U
+#define WWDG_IDR_EWIS_MSK BIT(WWDG_IER_EWIS_POS)
+
+/****************** Bit definition for WWDG_IVS register ************************/
+
+#define WWDG_IVS_EWIS_POS 7U
+#define WWDG_IVS_EWIS_MSK BIT(WWDG_IER_EWIS_POS)
+
+/****************** Bit definition for WWDG_RIF register ************************/
+
+#define WWDG_RIF_EWIS_POS 7U
+#define WWDG_RIF_EWIS_MSK BIT(WWDG_IER_EWIS_POS)
+
+/****************** Bit definition for WWDG_IFM register ************************/
+
+#define WWDG_IFM_EWIS_POS 7U
+#define WWDG_IFM_EWIS_MSK BIT(WWDG_IER_EWIS_POS)
+
+/****************** Bit definition for WWDG_ICR register ************************/
+
+#define WWDG_ICR_EWIS_POS 7U
+#define WWDG_ICR_EWIS_MSK BIT(WWDG_IER_EWIS_POS)
+
+
+#else
+/* */
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdt.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdt.h
new file mode 100644
index 0000000000000000000000000000000000000000..b1ee6dcf18ad887719577641ab7d07ce9d9a9800
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdt.h
@@ -0,0 +1,92 @@
+/**
+ **************************************************************************************
+ * @file REG_WWDT.h
+ * @brief WWDT Head File
+ *
+ * @version V0.01
+ * @date 4/12/2018
+ * @author Eastsoft MCU Software Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+#ifndef __REG_WWDT_H__
+#define __REG_WWDT_H__
+
+
+/******************************************************************************/
+/* 设备特殊寄存器结构定义 */
+/******************************************************************************/
+
+/* 允许匿名结构和匿名联合 */
+/* #pragma anon_unions */
+
+/****************** Bit definition for WWDT_CON register ************************/
+
+#define WWDT_CON_WDGA_POS 7U
+#define WWDT_CON_WDGA_MSK BIT(WWDT_CON_WDGA_POS)
+
+#define WWDT_CON_T_POSS 0U
+#define WWDT_CON_T_POSE 6U
+#define WWDT_CON_T_MSK BITS(WWDT_CON_T_POSS,WWDT_CON_T_POSE)
+
+/****************** Bit definition for WWDT_CFG register ************************/
+
+#define WWDT_CFG_WDGTB_POSS 7U
+#define WWDT_CFG_WDGTB_POSE 8U
+#define WWDT_CFG_WDGTB_MSK BITS(WWDT_CFG_WDGTB_POSS,WWDT_CFG_WDGTB_POSE)
+
+#define WWDT_CFG_W_POSS 0U
+#define WWDT_CFG_W_POSE 6U
+#define WWDT_CFG_W_MSK BITS(WWDT_CFG_W_POSS,WWDT_CFG_W_POSE)
+
+/****************** Bit definition for WWDT_IER register ************************/
+
+#define WWDT_IER_EWIS_POS 0U
+#define WWDT_IER_EWIS_MSK BIT(WWDT_IER_EWIS_POS)
+
+/****************** Bit definition for WWDT_IDR register ************************/
+
+#define WWDT_IDR_EWIS_POS 0U
+#define WWDT_IDR_EWIS_MSK BIT(WWDT_IDR_EWIS_POS)
+
+/****************** Bit definition for WWDT_IVS register ************************/
+
+#define WWDT_IVS_EWIS_POS 0U
+#define WWDT_IVS_EWIS_MSK BIT(WWDT_IVS_EWIS_POS)
+
+/****************** Bit definition for WWDT_RIF register ************************/
+
+#define WWDT_RIF_EWIF_POS 0U
+#define WWDT_RIF_EWIF_MSK BIT(WWDT_RIF_EWIF_POS)
+
+/****************** Bit definition for WWDT_IFM register ************************/
+
+#define WWDT_IFM_EWIM_POS 0U
+#define WWDT_IFM_EWIM_MSK BIT(WWDT_IFM_EWIM_POS)
+
+/****************** Bit definition for WWDT_ICR register ************************/
+
+#define WWDT_ICR_EWIC_POS 0U
+#define WWDT_ICR_EWIC_MSK BIT(WWDT_ICR_EWIC_POS)
+
+typedef struct
+{
+ __IO uint32_t CON;
+ __IO uint32_t CFG;
+ __O uint32_t IER;
+ __O uint32_t IDR;
+ __I uint32_t IVS;
+ __I uint32_t RIF;
+ __I uint32_t IFM;
+ __O uint32_t ICR;
+} WWDT_TypeDef;
+
+
+
+
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/es32f0271.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/es32f0271.h
new file mode 100644
index 0000000000000000000000000000000000000000..2810051370a15c4781e0de78dd79f3167a566811
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/es32f0271.h
@@ -0,0 +1,389 @@
+/*******************************************************************
+* *file : ES32F0271_sub.h
+* *description: ES32F0271 Device Head File
+* *author : Eastsoft AE Team
+* *version : V1.00.01
+* *data : 4/10/2018
+*
+* *Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+*******************************************************************/
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup ES32F0271_SUB1
+ * @{
+ */
+
+#ifndef __ES32F0271_SUB_H__
+#define __ES32F0271_SUB_H__
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/**
+ * @brief defines 'read only' 、'write only'、 'read / write' permissions.
+ */
+#define __I volatile const /* defines 'read only' permissions */
+#define __O volatile /* defines 'write only' permissions */
+#define __IO volatile /* defines 'read / write' permissions */
+
+/** @addtogroup Configuration_section_for_CMSIS
+ * @{
+ */
+/**
+ * @brief configuration of the cortex-M3 processor and core peripherals.
+ */
+
+#define __MPU_PRESENT 0 /*!< cm0ikmcu does not provide a MPU present or not */
+#define __NVIC_PRIO_BITS 2 /*!< cm0ikmcu Supports 2 Bits for the Priority Levels */
+#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
+/**
+ * @}
+ */
+
+/** @addtogroup peripherals_interrupt_number_definition
+ * @{
+ */
+
+typedef enum IRQn
+{
+
+ /****** ES32 Processor Exceptions Numbers ******************************************************/
+
+ /*************** Cortex-M0 Processor Exceptions Numbers **************************/
+ NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
+ HardFault_IRQn = -13, /*!< 3 Cortex-M0 Hard Fault Interrupt */
+ SVCall_IRQn = -5, /*!< 11 Cortex-M0 SV Call Interrupt */
+ PendSV_IRQn = -2, /*!< 14 Cortex-M0 Pend SV Interrupt */
+ SysTick_IRQn = -1, /*!< 15 Cortex-M0 System Tick Interrupt */
+
+ /**************** ES32F0271_SUB specific Exceptions Numbers **************************/
+ WWDT_IRQn = 0, /* 0 | WWDT Interrupt */
+ PVD_IRQn = 1, /* 1 | PVD Interrupt EXTI[20] */
+ RTC_IRQn = 2, /* 2 | RTC Interrupt */
+ WAKEUP_IRQn = 3, /* 3 | WAKEUP Interrupt EXTI[21] */
+ CM0IKMCU_IRQ04_IRQn = 4, /* 4 | Interrupt */
+ EXTI_0to1_IRQn = 5, /* 5 | EXTI[1:0] Interrupt GPIOx[1:0] */
+ EXTI_2to3_IRQn = 6, /* 6 | EXTI[3:2] Interrupt GPIOx[3:2] */
+ EXTI_4to15_IRQn = 7, /* 7 | EXTI[15:4] Interrupt GPIOx[15:4] */
+ CM0IKMCU_IRQ08_IRQn = 8, /* 8 | Interrupt */
+ DMA1_CH0_IRQn = 9, /* 9 | DMA1_CH0 Interrupt */
+ DMA1_CH12_IRQn = 10, /* 10 | DMA1_CH12 Interrupt */
+ DMA1_CH345_IRQn = 11, /* 11 | DMA1_CH345 Interrupt */
+ ADC_CMP_IRQn = 12, /* 12 | ADC/COMP0-3 Interrupt EXTI[19:16]) */
+ AD16C4T1_IRQn = 13, /* 13 | AD16C4T1 Interrupt */
+ BS16T1_IRQn = 14, /* 14 | BS16T1 Interrupt */
+ GP32C4T1_IRQn = 15, /* 15 | GP32C4T1 Interrupt */
+ GP16C4T1_IRQn = 16, /* 16 | GP16C4T1 Interrupt */
+ GP16C4T2_IRQn = 17, /* 17 | GP16C4T2 Interrupt */
+ GP16C4T3_IRQn = 18, /* 18 | GP16C4T3 Interrupt */
+ GP16C2T1_IRQn = 19, /* 19 | GP16C2T1 Interrupt */
+ GP16C2T2_IRQn = 20, /* 20 | GP16C2T2 Interrupt */
+ GP16C2T3_IRQn = 21, /* 21 | GP16C2T3 Interrupt */
+ GP16C2T4_IRQn = 22, /* 22 | GP16C2T4 Interrupt */
+ I2C1_IRQn = 23, /* 23 | I2C1 Interrupt */
+ I2C2_IRQn = 24, /* 24 | I2C2 Interrupt */
+ SPI1_IRQn = 25, /* 25 | SPI1 Interrupt */
+ SPI2_IRQn = 26, /* 26 | SPI2 Interrupt */
+ UART1_IRQn = 27, /* 27 | UART1 Interrupt */
+ UART2_IRQn = 28, /* 28 | UART2 Interrupt */
+ UART3_IRQn = 29, /* 29 | UART3 Interrupt */
+ SUART12_IRQn = 30, /* 30 | SUART1/2 Interrupt */
+ USB_IRQn = 31 /* 31 | USB Interrupt */
+} IRQn_Type;
+
+/**
+ * @}
+ */
+
+/* Includes-------------------------------------------------------------------------------*/
+
+#include "core_cm0.h"
+#include
+#include
+#include "system_es32f027x.h"
+/**
+ * @brief these files declare Peripheral register bit_definition.
+ */
+#include "reg_rcu.h"
+#include "reg_syscfg.h"
+#include "reg_fc.h"
+#include "reg_dma.h"
+#include "reg_gpio.h"
+#include "reg_i2c.h"
+#include "reg_uart.h"
+#include "reg_adc.h"
+#include "reg_cmp.h"
+#include "reg_dac.h"
+#include "reg_spi.h"
+#include "reg_crc.h"
+#include "reg_ad16c4t.h"
+#include "reg_hdiv.h"
+#include "reg_aes.h"
+#include "reg_wwdt.h"
+#include "reg_rtc.h"
+#include "reg_mswd.h"
+#include "reg_mcm.h"
+#include "reg_exti.h"
+#include "reg_usb.h"
+
+/******************************************************************************/
+/* Peripheral register */
+/******************************************************************************/
+
+/* allow anonymous structures and anonymous enumeration */
+/* #pragma anon_unions */
+
+/******************************************************************************/
+/* Peripheral memory map */
+/******************************************************************************/
+
+/********************* Base addresses *************************/
+#define FLASH_BASE (0x08000000UL)
+#define FLASH_INFO_BASE (0x1FFFE000UL) /* EFLASH Info ( 6K Bytes) - Boot Loader Memory */
+#define SRAM_BASE (0x20000000UL)
+#define APB1_BASE (0x40000000UL)
+#define APB2_BASE (0x40010000UL)
+#define AHB1_BASE (0x40020000UL)
+#define AHB2_BASE (0x48000000UL)
+#define CM0IN_BASE (0xE0000000UL)
+
+/* Cortex簧-M0 internal Peripherals - CM0IN_BASE: 0xE0000000*/
+#define TICK_BASE (CM0IN_BASE + 0xE010)
+
+#define SRAM1_BASE (SRAM_BASE + 0x0000) // SRAM1 Memory ( 4K Bytes)
+#define SRAM2_BASE (SRAM_BASE + 0x1000) // SRAM2 Memory ( 4K Bytes) for Rev.B
+#define STACK_SIZE 0x00000400>>2 // Stack size (in Words)
+#define SRAMTOP 0x1000//0x2000 // Jackey 2018.9.5
+
+/***************** peripherals base addresses ********************/
+/* APB1 */
+#define GP32C4T1_BASE (APB1_BASE + 0x0000)
+#define GP16C4T1_BASE (APB1_BASE + 0x0400)
+#define GP16C4T2_BASE (APB1_BASE + 0x0800)
+#define GP16C4T3_BASE (APB1_BASE + 0x0C00)
+#define BS16T1_BASE (APB1_BASE + 0x1000)
+#define WWDT_BASE (APB1_BASE + 0x2C00)
+#define IWDT_BASE (APB1_BASE + 0x3000)
+#define SPI2_BASE (APB1_BASE + 0x3800)
+#define UART2_BASE (APB1_BASE + 0x4400)
+#define UART3_BASE (APB1_BASE + 0x4800)
+#define SUART1_BASE (APB1_BASE + 0x4C00)
+#define SUART2_BASE (APB1_BASE + 0x5000)
+#define I2C1_BASE (APB1_BASE + 0x5400)
+#define I2C2_BASE (APB1_BASE + 0x5800)
+#define DAC_BASE (APB1_BASE + 0x5C00)
+#define PWR_BASE (APB1_BASE + 0x7000)
+/* APB2 */
+#define EXTI_BASE (APB2_BASE + 0x0400)
+#define ADC_BASE (APB2_BASE + 0x2400)
+#define AD16C4T1_BASE (APB2_BASE + 0x2C00)
+#define SPI1_BASE (APB2_BASE + 0x3000)
+#define UART1_BASE (APB2_BASE + 0x3800)
+#define GP16C2T1_BASE (APB2_BASE + 0x4000)
+#define GP16C2T2_BASE (APB2_BASE + 0x4400)
+#define GP16C2T3_BASE (APB2_BASE + 0x4800)
+#define GP16C2T4_BASE (APB2_BASE + 0x4C00)
+#define MCM_BASE (APB2_BASE + 0x5400)
+#define DBGMCU_BASE (APB2_BASE + 0x5800)
+#define COMP_BASE (APB2_BASE + 0x5C00)
+/* AHB1 */
+#define DMA1_BASE (AHB1_BASE + 0x0000)
+#define RCU_BASE (AHB1_BASE + 0x1000)
+#define SYSCFG_BASE (AHB1_BASE + 0x1400)
+#define RTC_BASE (AHB1_BASE + 0x1800)
+#define EFLASH_BASE (AHB1_BASE + 0x2000)
+#define MSWD_BASE (AHB1_BASE + 0x2C00)
+#define CRC_BASE (AHB1_BASE + 0x3000)
+#define AES_BASE (AHB1_BASE + 0x3400)
+#define USB_BASE (AHB1_BASE + 0x3800)
+#define HDIV_BASE (AHB1_BASE + 0x3C00)
+/* AHB2 */
+#define GPIOA_BASE (AHB2_BASE + 0x0000)
+#define GPIOB_BASE (AHB2_BASE + 0x0400)
+#define GPIOC_BASE (AHB2_BASE + 0x0800)
+#define GPIOD_BASE (AHB2_BASE + 0x0C00)
+#define GPIOE_BASE (AHB2_BASE + 0x1000)
+#define GPIOF_BASE (AHB2_BASE + 0x1400)
+
+/********************* Peripheral declaration *************************/
+#define TICK (( TICK_TypeDef *) TICK_BASE)
+#define GPIOA (( GPIO_TypeDef *) GPIOA_BASE)
+#define GPIOB (( GPIO_TypeDef *) GPIOB_BASE)
+#define GPIOC (( GPIO_TypeDef *) GPIOC_BASE)
+#define GPIOD (( GPIO_TypeDef *) GPIOD_BASE)
+#define DMA1 (( DMA_TypeDef *) DMA1_BASE)
+#define RCU (( RCU_TypeDef *) RCU_BASE)
+#define SYSCFG (( SYSCFG_TypeDef *) SYSCFG_BASE)
+#define FC (( FC_TypeDef *) EFLASH_BASE)
+#define CRC (( CRC_TypeDef *) CRC_BASE)
+#define AES (( AES_TypeDef *) AES_BASE)
+#define HDIV (( HDIV_TypeDef *) HDIV_BASE)
+#define MSWD (( MSWD_TypeDef *) MSWD_BASE)
+#define USB (( USBCTRL_TypeDef *) USB_BASE)
+#define USBH (( USBCTRL_TypeDef *) USB_BASE)
+#define USBD (( USBCTRL_TypeDef *) USB_BASE)
+#define IWDT (( IWDT_TypeDef *) IWDT_BASE)
+#define WWDT (( WWDT_TypeDef *) WWDT_BASE)
+#define ADC (( ADC_TypeDef *) ADC_BASE)
+#define AD16C4T1 (( AD16C4T_TypeDef *) AD16C4T1_BASE)
+#define GP32C4T1 (( AD16C4T_TypeDef *) GP32C4T1_BASE)
+#define GP16C4T1 (( AD16C4T_TypeDef *) GP16C4T1_BASE)
+#define GP16C4T2 (( AD16C4T_TypeDef *) GP16C4T2_BASE)
+#define GP16C4T3 (( AD16C4T_TypeDef *) GP16C4T3_BASE)
+#define GP16C2T1 (( AD16C4T_TypeDef *) GP16C2T1_BASE)
+#define GP16C2T2 (( AD16C4T_TypeDef *) GP16C2T2_BASE)
+#define GP16C2T3 (( AD16C4T_TypeDef *) GP16C2T3_BASE)
+#define GP16C2T4 (( AD16C4T_TypeDef *) GP16C2T4_BASE)
+#define BS16T1 (( AD16C4T_TypeDef *) BS16T1_BASE)
+#define SPI1 (( SPI_TypeDef *) SPI1_BASE)
+#define SPI2 (( SPI_TypeDef *) SPI2_BASE)
+#define I2C1 (( I2C_TypeDef *) I2C1_BASE)
+#define I2C2 (( I2C_TypeDef *) I2C2_BASE)
+#define DAC (( DAC_TypeDef *) DAC_BASE)
+#define CMP (( CMP_TypeDef *) COMP_BASE)
+#define UART1 (( UART_TypeDef *) UART1_BASE)
+#define UART2 (( UART_TypeDef *) UART2_BASE)
+#define UART3 (( UART_TypeDef *) UART3_BASE)
+#define SUART1 (( UART_TypeDef *) SUART1_BASE)
+#define SUART2 (( UART_TypeDef *) SUART2_BASE)
+#define EXTI (( EXTI_TypeDef *) EXTI_BASE)
+#define RTC (( RTC_TypeDef *) RTC_BASE)
+#define MCM (( MCM_TypeDef *) MCM_BASE)
+/* Special stuff */
+#define MSG_INCR ( __IO uint8_t *) (DBGMCU_BASE + 0x50)
+#define MSG_WR ( __IO uint32_t *) (DBGMCU_BASE + 0x54)
+#define MSG_END ( __IO uint32_t *) (DBGMCU_BASE + 0x58)
+#define MSG_INCR_S ( __IO uint32_t *) (DBGMCU_BASE + 0x5C)
+#define MSG_INCR_X ( __IO uint32_t *) (DBGMCU_BASE + 0x60)
+#define MSG_INCR_B ( __IO uint32_t *) (DBGMCU_BASE + 0x64)
+#define MSG_PTR ( __IO uint8_t **) (DBGMCU_BASE + 0x68)
+#define MSG_INCR_D ( __IO uint32_t *) (DBGMCU_BASE + 0x78)
+#define INCR_ERR_CNT ( __IO uint32_t *) (DBGMCU_BASE + 0x6C)
+
+#define END_SIM *MSG_END
+#define SIM_FAIL 0xFFFFAAAA
+#define SIM_PASS 0xFFFF5555
+/******************************************************************************/
+/* macros */
+/******************************************************************************/
+
+/** @addtogroup Public_macros
+ * @{
+ */
+#if defined (__CC_ARM)
+#define __INLINE__ __inline
+#else
+#define __INLINE__ inline
+#endif
+
+#define __isr__
+
+#define UNUSED(x) ((void)(x))
+
+#ifdef USE_ASSERT
+#define assert_param(x) \
+do \
+{ \
+ if (!(x)) \
+ { \
+ __disable_irq(); \
+ while (1) \
+ ; \
+ } \
+} while (0)
+#else
+#define assert_param(x)
+#endif
+
+#define BIT(x) ((uint32_t)((uint32_t)0x01U<<(x)))
+
+#define BITS(start, end) ((0xFFFFFFFFUL << (start)) &\
+ (0xFFFFFFFFUL >> (31U - (uint32_t)(end))))
+
+#define SET_BIT(REG, SETMASK) ((REG) |= (SETMASK))
+
+#define CLEAR_BIT(REG, SETMASK) ((REG) &= ~(SETMASK))
+
+#define READ_BIT(REG, SETMASK) ((REG) & (SETMASK))
+
+#define CLEAR_REG(REG) ((REG) = (0x0))
+
+#define WRITE_REG(REG, VAL) ((REG) = (VAL))
+
+#define READ_REG(REG) ((REG))
+
+#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
+
+#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
+
+/**
+ * @}
+ */
+
+/******************************************************************************/
+/* types */
+/******************************************************************************/
+/** @addtogroup Public_types
+ * @{
+ */
+typedef enum
+{
+ DISABLE = 0,
+ ENABLE = !DISABLE
+} TypeFunc,FuncState;
+#define IS_FUNC_STATE(x) (((x) == DISABLE) || ((x) == ENABLE))
+
+typedef enum
+{
+ RESET = 0,
+ SET = !RESET
+} FlagStatus, ITStatus, PinStatus;
+
+typedef enum
+{
+ ERROR = 0,
+ SUCCESS = !ERROR
+} ErrorStatus;
+
+typedef enum
+{
+ BIT_RESET = 0x0,
+ BIT_SET = 0x1,
+} BitStatus;
+
+typedef enum
+{
+ FALSE = 0x0,
+ TRUE = 0x1,
+} TypeBool;
+
+typedef enum
+{
+ UNLOCK = 0x0,
+ LOCK = 0x1,
+} LockState;
+#define IS_LOCK_STATE(x) (((x) == UNLOCK) || ((x) == LOCK))
+
+/**
+ * @} Public_types
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/**
+ * @} ES32F0271_SUB
+ */
+
+/**
+ * @} CMSIS
+ */
+
+/************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/rt_misc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/rt_misc.h
new file mode 100644
index 0000000000000000000000000000000000000000..71a3270c6e3093d4ddb0dd5b793dc0c72ca6d82f
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/rt_misc.h
@@ -0,0 +1,183 @@
+/* rt_misc.h: definitions for miscellaneous retargetable functions
+ *
+ * Copyright 1999,2013-2014 ARM Limited. All rights reserved.
+ *
+ * RCS $Revision$
+ * Checkin $Date$
+ * Revising $Author$
+ */
+
+#ifndef __RT_MISC_H
+#define __RT_MISC_H
+#define __ARMCLIB_VERSION 5060019
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include
+#include
+
+/*
+ * This will be called during startup if it's defined, in order to
+ * allow a user reimplementation of getenv() to initialise itself.
+ */
+extern void _getenv_init(void);
+
+/*
+ * This will be called during startup if it's defined, in order to
+ * allow a user reimplementation of clock() to initialise itself.
+ */
+extern void _clock_init(void);
+
+/*
+ * This must return a pointer to __USER_LIBSPACE_SIZE bytes of
+ * zero-initialised space, used to store vital static data such as
+ * errno, the heap state, and the FP status word.
+ */
+#define __USER_LIBSPACE_SIZE 96
+extern void *__user_libspace(void);
+
+/*
+ * This is the library init function itself, provided just in case
+ * a user needs to call it directly. It is called just after
+ * __rt_stackheap_init(), and passed an initial chunk of memory to
+ * use as a heap. It returns argc and argv ready to be passed to
+ * main(). (The __argc_argv structure contains four words rather
+ * than just two, in case you need to pass anything else to main()
+ * such as the Unix envp. For AArch64 struct __argc_argv is 8 words
+ * (4 registers) and explicit padding is used to ensure argc is in w0.)
+ */
+struct __argc_argv {
+#if (defined(__ARM_64BIT_STATE) || defined(__TARGET_ARCH_AARCH64)) && \
+ (defined(__ARM_BIG_ENDIAN) || defined(__BIG_ENDIAN))
+ int padding;
+#endif
+ int argc;
+#if (defined(__ARM_64BIT_STATE) || defined(__TARGET_ARCH_AARCH64)) && \
+ !(defined(__ARM_BIG_ENDIAN) || defined(__BIG_ENDIAN))
+ int padding;
+#endif
+ char **argv;
+ void *r2;
+ void *r3;
+};
+extern __value_in_regs struct __argc_argv
+__rt_lib_init(unsigned /*heapbase*/, unsigned /*heaptop*/);
+
+/*
+ * This function is responsible for constructing argc and argv to
+ * be passed to main(). Normally it works by calling
+ * _sys_command_string() and then splitting up the returned command
+ * line. If you define main() without arguments, the compiler also
+ * defines an empty version of this function to save time. In
+ * special circumstances, you might need to redefine this function
+ * explicitly yourself.
+ */
+__value_in_regs struct __argc_argv __ARM_get_argv(void */*internal use only*/);
+
+/*
+ * This is the library shutdown function, analogous to
+ * __rt_lib_init().
+ */
+extern void __rt_lib_shutdown(void);
+
+/*
+ * The medium-level exit function. exit() calls atexit()-registered
+ * functions and shuts down the library; _sys_exit() does neither
+ * of those things; __rt_exit() shuts down the library but doesn't
+ * call atexit() functions.
+ */
+extern void __rt_exit(int /*returncode*/); /* never returns */
+
+/*
+ * This can be defined to override the standard memory models' way
+ * of determining where to put the initial stack and heap.
+ *
+ * The input parameters R0 and R2 contain nothing useful. The input
+ * parameters SP and SL are the values that were in SP and SL when
+ * the program began execution (so you can return them if you want
+ * to keep that stack).
+ *
+ * The two `limit' fields in the return structure are ignored if
+ * you are using the one-region memory model: the memory region is
+ * taken to be all the space between heap_base and stack_base.
+ */
+struct __initial_stackheap {
+ unsigned heap_base; /* low-address end of initial heap */
+ unsigned stack_base; /* high-address end of initial stack */
+ unsigned heap_limit; /* high-address end of initial heap */
+ unsigned stack_limit; /* low-address end of initial stack */
+};
+extern __value_in_regs struct __initial_stackheap
+__user_initial_stackheap(unsigned /*R0*/, unsigned /*SP*/,
+ unsigned /*R2*/, unsigned /*SL*/);
+
+/*
+ * This can be defined to give bounds on the address space the heap
+ * will ever use.
+ */
+struct __heap_extent {
+ uintptr_t base;
+ size_t range;
+};
+extern __value_in_regs struct __heap_extent
+__user_heap_extent(uintptr_t /*ignore*/, size_t /*ignore*/);
+
+/*
+ * This can be defined to specify how much spare stack is needed
+ * below SL in addition to the 256 bytes required by ATPCS:
+ * `always' gives the number of bytes of extra stack required at
+ * all instants (so that an interrupt handler has space to run in,
+ * for example), while `cleanup' gives the number of bytes of extra
+ * stack required to be available after a stack overflow has
+ * occurred, so that the stack overflow routine (e.g. SIGSTAK
+ * handler) has room to tidy up.
+ */
+struct __stack_slop {
+ unsigned always, cleanup;
+};
+extern __value_in_regs struct __stack_slop
+__user_stack_slop(unsigned /*ignore*/, unsigned /*ignore*/);
+
+/*
+ * This can be defined to return extra blocks of memory, separate
+ * from the initial one, to be used by the heap. It should place a
+ * pointer to a block of at least the requested size in `*base',
+ * and return the size of the block. It should return 0 if no such
+ * block can be returned, in which case the value stored at `*base'
+ * is never used.
+ */
+extern size_t __user_heap_extend(int /*ignore*/,
+ void ** /*base*/,
+ size_t /*requestedsize*/);
+
+/*
+ * Redefine this to completely override the C handling of signals
+ * (bypassing the signal() mechanism). Return values are 0 to
+ * continue execution, or a non-zero value to cause an exit with
+ * that return code.
+ */
+int __raise(int /*sig*/, intptr_t /*type*/);
+
+/*
+ * Redefine this to change the default handling of signals. The
+ * interface is the same as __raise(), but this function will only
+ * get called after the C signal handling mechanism has declined to
+ * process the signal.
+ */
+int __default_signal_handler(int /*sig*/, intptr_t /*type*/);
+
+/*
+ * Redefine this to replace the library's entire signal handling
+ * mechanism in the most efficient possible way. The default
+ * implementation of this is what calls __raise (above).
+ */
+void __rt_raise(int /*sig*/, intptr_t /*type*/);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/ReleaseNote.html b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/ReleaseNote.html
similarity index 47%
rename from bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/ReleaseNote.html
rename to bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/ReleaseNote.html
index a57c58046d66d43f9d1161783c33531f4309db61..dce80ba62c72cc960649193235529b61a0068b3d 100644
--- a/bsp/es32f0654/libraries/ES32F065x_ALD_StdPeriph_Driver/ReleaseNote.html
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/ReleaseNote.html
@@ -3,10 +3,12 @@
ReleaseNote
-ES32F065x MD Release Note
-V1.00 2018-12-26
-
-- First release
+ES32F0271 Device Release Note
+V1.00 2019-1-4
+初版发布
+V1.03 2019-09-23
+
+- Drivers\CMSIS\Device\EastSoft\ES32F0271\Startup\iar\ : 增加startup_es32f027x.s
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/iar/startup_es32f027x.s b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/iar/startup_es32f027x.s
new file mode 100644
index 0000000000000000000000000000000000000000..bda1ad6ecd778a0e18ec55a0d832913d1221060a
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/iar/startup_es32f027x.s
@@ -0,0 +1,256 @@
+;*******************************************************************************
+; file : startup_ES32f027x.s
+; description: ES32F027x Device Startup File
+; author : Eastsoft MCU Software Team
+; data : 10 Dec 2018
+; Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
+;*******************************************************************************
+
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+ PUBLIC __vector_table
+
+ DATA
+__vector_table
+ DCD sfe(CSTACK) ;0, load top of stack
+ DCD Reset_Handler ;1, reset handler
+ DCD NMI_Handler ;2, nmi handler
+ DCD HardFault_Handler ;3, hard fault handler
+ DCD 0 ;4, MPU Fault Handler
+ DCD 0 ;5, Bus Fault Handler
+ DCD 0 ;6, Usage Fault Handler
+ DCD 0 ;7, Reserved
+ DCD 0 ;8, Reserved
+ DCD 0 ;9, Reserved
+ DCD 0 ;10, Reserved
+ DCD SVC_Handler ;11, svcall handler
+ DCD 0 ;12, Reserved
+ DCD 0 ;13, Reserved
+ DCD PENDSV_Handler ;14, PENDSV Handler
+ DCD SYSTICK_Handler ;15, SYSTICK Handler
+ DCD WWDT_IRQHandler ;16, WWDT IRQHandler
+ DCD PVD_IRQHandler ;17, PVD IRQHandler
+ DCD RTC_IRQHandler ;18, RTC IRQHandler
+ DCD LowPowerWakeup_IRQHandler ;19, LowPowerWakeup IRQHandler
+ DCD 0 ;20, Reserved
+ DCD EXTI0_1_IRQHandler ;21, EXTI01_1 IRQHandler
+ DCD EXTI2_3_IRQHandler ;22, EXTI2_3 IRQHandler
+ DCD EXTI4_15_IRQHandler ;23, EXTI4_15 IRQHandler
+ DCD 0 ;24, Reserved
+ DCD DMA1_CH0_IRQHandler ;25, DMA1_CH1 IRQHandler
+ DCD DMA1_CH1_2_IRQHandler ;26, DMA1_CH2_3 IRQHandler
+ DCD DMA1_CH3_5_IRQHandler ;27, DMA1_CH4_7 IRQHandler
+ DCD ADC_CMP_IRQHandler ;28, ADC_CMP IRQHandler
+ DCD AD16C4T1_IRQHandler ;29, AD16C4T1 IRQHandler
+ DCD BS16T1_IRQHandler ;30, BS16T1 IRQHandler
+ DCD GP32C4T1_IRQHandler ;31, GP32C4T1 IRQHandler
+ DCD GP16C4T1_IRQHandler ;32, GP16C4T1 IRQHandler
+ DCD GP16C4T2_IRQHandler ;33, GP16C4T2 IRQHandler
+ DCD GP16C4T3_IRQHandler ;34, GP16C4T3 IRQHandler
+ DCD GP16C2T1_IRQHandler ;35, GP16C2T1 IRQHandler
+ DCD GP16C2T2_IRQHandler ;36, GP16C2T2 IRQHandler
+ DCD GP16C2T3_IRQHandler ;37, GP16C2T3 IRQHandler
+ DCD GP16C2T4_IRQHandler ;38, GP16C2T4 IRQHandler
+ DCD I2C1_IRQHandler ;39, I2C1 IRQHandler
+ DCD I2C2_IRQHandler ;40, I2C2 IRQHandler
+ DCD SPI1_IRQHandler ;41, SPI1 IRQHandler
+ DCD SPI2_IRQHandler ;42, SPI2 IRQHandler
+ DCD UART1_IRQHandler ;43, UART1 IRQHandler
+ DCD UART2_IRQHandler ;44, UART2 IRQHandler
+ DCD UART3_AES_IRQHandler ;45, UART3_AES IRQHandler
+ DCD SUART1_SUART2_IRQHandler ;46, SUART1_SUART2 IRQHandler
+ DCD USB_IRQHandler ;47, USB IRQHandler
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Default interrupt handlers.
+;;
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:NOROOT:REORDER(2)
+Reset_Handler
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+HardFault_Handler
+ B HardFault_Handler
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK PENDSV_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+PENDSV_Handler
+ B PENDSV_Handler
+
+ PUBWEAK SYSTICK_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+SYSTICK_Handler
+ B SYSTICK_Handler
+
+ PUBWEAK WWDT_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+WWDT_IRQHandler
+ B WWDT_IRQHandler
+
+ PUBWEAK PVD_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+PVD_IRQHandler
+ B PVD_IRQHandler
+
+ PUBWEAK RTC_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+RTC_IRQHandler
+ B RTC_IRQHandler
+
+ PUBWEAK LowPowerWakeup_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+LowPowerWakeup_IRQHandler
+ B LowPowerWakeup_IRQHandler
+
+ PUBWEAK EXTI0_1_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+EXTI0_1_IRQHandler
+ B EXTI0_1_IRQHandler
+
+ PUBWEAK EXTI2_3_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+EXTI2_3_IRQHandler
+ B EXTI2_3_IRQHandler
+
+ PUBWEAK EXTI4_15_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+EXTI4_15_IRQHandler
+ B EXTI4_15_IRQHandler
+
+ PUBWEAK DMA1_CH0_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+DMA1_CH0_IRQHandler
+ B DMA1_CH0_IRQHandler
+
+ PUBWEAK DMA1_CH1_2_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+DMA1_CH1_2_IRQHandler
+ B DMA1_CH1_2_IRQHandler
+
+ PUBWEAK DMA1_CH3_5_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+DMA1_CH3_5_IRQHandler
+ B DMA1_CH3_5_IRQHandler
+
+ PUBWEAK ADC_CMP_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+ADC_CMP_IRQHandler
+ B ADC_CMP_IRQHandler
+
+ PUBWEAK AD16C4T1_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+AD16C4T1_IRQHandler
+ B AD16C4T1_IRQHandler
+
+ PUBWEAK BS16T1_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+BS16T1_IRQHandler
+ B BS16T1_IRQHandler
+
+ PUBWEAK GP32C4T1_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+GP32C4T1_IRQHandler
+ B GP32C4T1_IRQHandler
+
+ PUBWEAK GP16C4T1_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+GP16C4T1_IRQHandler
+ B GP16C4T1_IRQHandler
+
+ PUBWEAK GP16C4T2_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+GP16C4T2_IRQHandler
+ B GP16C4T2_IRQHandler
+
+ PUBWEAK GP16C4T3_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+GP16C4T3_IRQHandler
+ B GP16C4T3_IRQHandler
+
+ PUBWEAK GP16C2T1_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+GP16C2T1_IRQHandler
+ B GP16C2T1_IRQHandler
+
+ PUBWEAK GP16C2T2_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+GP16C2T2_IRQHandler
+ B GP16C2T2_IRQHandler
+
+ PUBWEAK GP16C2T3_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+GP16C2T3_IRQHandler
+ B GP16C2T3_IRQHandler
+
+ PUBWEAK GP16C2T4_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+GP16C2T4_IRQHandler
+ B GP16C2T4_IRQHandler
+
+ PUBWEAK I2C1_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+I2C1_IRQHandler
+ B I2C1_IRQHandler
+
+ PUBWEAK I2C2_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+I2C2_IRQHandler
+ B I2C2_IRQHandler
+
+ PUBWEAK SPI1_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+SPI1_IRQHandler
+ B SPI1_IRQHandler
+
+ PUBWEAK SPI2_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+SPI2_IRQHandler
+ B SPI2_IRQHandler
+
+ PUBWEAK UART1_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+UART1_IRQHandler
+ B UART1_IRQHandler
+
+ PUBWEAK UART2_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+UART2_IRQHandler
+ B UART2_IRQHandler
+
+ PUBWEAK UART3_AES_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+UART3_AES_IRQHandler
+ B UART3_AES_IRQHandler
+
+ PUBWEAK SUART1_SUART2_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+SUART1_SUART2_IRQHandler
+ B SUART1_SUART2_IRQHandler
+
+ PUBWEAK USB_IRQHandler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+USB_IRQHandler
+ B USB_IRQHandler
+
+ END
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/boot.c b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/boot.c
new file mode 100644
index 0000000000000000000000000000000000000000..4c4e15ee4c80c85604ce452f8a092d678f6212cc
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/boot.c
@@ -0,0 +1,321 @@
+
+//
+// Boot (vectors) file for Cortex-M0 Integration Kit
+//
+
+#include
+#include
+#include
+#include "es32F0271_sub.h"
+
+//
+// Build a stand-alone image
+//
+
+#pragma import(__use_no_semihosting)
+
+
+/*----------------------------------------------------------------------*/
+/*-------------- Interrupt Handlers --------------*/
+/*----------------------------------------------------------------------*/
+// The following functions are defined weakly to allow the user
+// to override them at link time simply by declaring their own
+// function of the same name.
+//
+// If no user function is provided, the weak function is used.
+//
+//------------------------------------ IRQ NMI Handler
+__weak void NMI_Handler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ Hard Fault Handler
+__weak void HardFault_Handler(void)
+{
+ //printf("Hard Fault\r\n");
+ while(1);
+}
+//------------------------------------ IRQ SVCall Handler
+__weak void SVC_Handler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ PendSV Handler
+__weak void PendSV_Handler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ SysTick Handler
+__weak void SysTick_Handler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 31
+__weak void USB_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 30
+__weak void SUART12_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 29
+__weak void UART3_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 28
+__weak void UART2_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 27
+__weak void UART1_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 26
+__weak void SPI2_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 25
+__weak void SPI1_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 24
+__weak void I2C2_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 23
+__weak void I2C1_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 22
+__weak void GPTIMC4_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 21
+__weak void GPTIMC3_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 20
+__weak void GPTIMC2_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 19
+__weak void GPTIMC1_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 18
+__weak void GPTIMB3_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 17
+__weak void GPTIMB2_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 16
+__weak void GPTIMB1_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 15
+__weak void GPTIMA1_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 14
+__weak void BSTIM1_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 13
+__weak void ADTIM1_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 12
+__weak void ADC_COMP_IRQHandler(void)
+{
+ // while(1);
+}
+//------------------------------------ IRQ 11
+__weak void DMA1_CH345_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 10
+__weak void DMA1_CH12_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 9
+__weak void DMA1_CH0_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 8
+//------------------------------------ IRQ 7
+__weak void EXTI_4to15_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 6
+__weak void EXTI_2to3_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 5
+__weak void EXTI_0to1_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 4
+//------------------------------------ IRQ 3
+__weak void WAKEUP_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 2
+__weak void RTC_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 1
+__weak void PVD_IRQHandler(void)
+{
+ while(1);
+}
+//------------------------------------ IRQ 0
+__weak void WWDT_IRQHandler(void)
+{
+ while(1);
+}
+
+
+/*----------------------------------------------------------------------*/
+/*-------------- Defined Handler --------------*/
+/*----------------------------------------------------------------------*/
+__weak void Default_IRQHandler(void)
+{
+ while(1);
+}
+
+/*----------------------------------------------------------------------*/
+/*-------------- Symbols defined in linker script ---------*/
+/*----------------------------------------------------------------------*/
+
+extern void __main(void);
+
+/*----------------------------------------------------------------------*/
+/*-------------- Reset Handler --------------*/
+/*----------------------------------------------------------------------*/
+void Reset_Handler(void)
+{
+ __main();
+ while(1) {;} // In case main() fails
+}
+
+/*----------------------------------------------------------------------*/
+/*-------------- Set up Vector Table --------------*/
+/*----------------------------------------------------------------------*/
+typedef void (*const vect_t)(void) __irq;
+
+vect_t __Vectors[]
+__attribute__ ((section("vectors"))) = {
+ (vect_t)(SRAM1_BASE+SRAMTOP),//(vect_t)(0x20000F80), // Top of Stack - Allowing 4 words for DEBUGDRIVERDATA
+ (vect_t)Reset_Handler, // Reset Handler
+ (vect_t)NMI_Handler, // NMI Handler
+ (vect_t)HardFault_Handler,// Hard Fault Handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ (vect_t)SVC_Handler, // SVCall Handler
+ 0, // Reserved
+ 0, // Reserved
+ (vect_t)PendSV_Handler, // PendSV Handler
+ (vect_t)SysTick_Handler, // SysTick Handler
+ /*----------External Exceptions---------------------------------------------*/
+ // External Interrupts 0 - 31
+ // These are essentially unused, so will all
+ // take the same default handler if invoked.
+ // External Interrupts
+ //|=========================================|
+ //| IRQ NO. | M621 |
+ //|-----------------------------------------|
+ (vect_t)WWDT_IRQHandler, //| 0 | WWDG | |
+ (vect_t)PVD_IRQHandler, //| 1 | PVD | EXTI[20] |
+ (vect_t)RTC_IRQHandler, //| 2 | RTC | |
+ (vect_t)WAKEUP_IRQHandler, //| 3 | WAKEUP | EXTI[21] |
+ (vect_t)Default_IRQHandler, //| 4 | | |
+ (vect_t)EXTI_0to1_IRQHandler, //| 5 | EXTI[1:0] | GPIOx[1:0] |
+ (vect_t)EXTI_2to3_IRQHandler, //| 6 | EXTI[3:2] | GPIOx[3:2] |
+ (vect_t)EXTI_4to15_IRQHandler, //| 7 | EXTI[15:4] | GPIOx[15:4] |
+ (vect_t)Default_IRQHandler, //| 8 | | |
+ (vect_t)DMA1_CH0_IRQHandler, //| 9 | DMA1_CH0 | |
+ (vect_t)DMA1_CH12_IRQHandler, //| 10 | DMA1_CH12 | |
+ (vect_t)DMA1_CH345_IRQHandler, //| 11 | DMA1_CH345 | |
+ (vect_t)ADC_COMP_IRQHandler, //| 12 | ADC/COMP0-3 | EXTI[19:16] |
+ (vect_t)ADTIM1_IRQHandler, //| 13 | ADTIM1 | |
+ (vect_t)BSTIM1_IRQHandler, //| 14 | BSTIM1 | |
+ (vect_t)GPTIMA1_IRQHandler, //| 15 | GPTIMA1 | |
+ (vect_t)GPTIMB1_IRQHandler, //| 16 | GPTIMB1 | |
+ (vect_t)GPTIMB2_IRQHandler, //| 17 | GPTIMB2 | |
+ (vect_t)GPTIMB3_IRQHandler, //| 18 | GPTIMB3 | |
+ (vect_t)GPTIMC1_IRQHandler, //| 19 | GPTIMC1 | |
+ (vect_t)GPTIMC2_IRQHandler, //| 20 | GPTIMC2 | |
+ (vect_t)GPTIMC3_IRQHandler, //| 21 | GPTIMC3 | |
+ (vect_t)GPTIMC4_IRQHandler, //| 22 | GPTIMC4 | |
+ (vect_t)I2C1_IRQHandler, //| 23 | I2C1 | |
+ (vect_t)I2C2_IRQHandler, //| 24 | I2C2 | |
+ (vect_t)SPI1_IRQHandler, //| 25 | SPI1 | |
+ (vect_t)SPI2_IRQHandler, //| 26 | SPI2 | |
+ (vect_t)UART1_IRQHandler, //| 27 | UART1 | |
+ (vect_t)UART2_IRQHandler, //| 28 | UART2 | |
+ (vect_t)UART3_IRQHandler, //| 29 | UART3 | |
+ (vect_t)SUART12_IRQHandler, //| 30 | SUART1/2 | |
+ (vect_t)USB_IRQHandler //| 31 | USB | |
+ //==========================================|
+};
+
+
+/*----------------------------------------------------------------------*/
+/*-------------- Set up initial stack and heap --------------*/
+/*----------------------------------------------------------------------*/
+__value_in_regs struct __initial_stackheap
+__user_initial_stackheap(unsigned hb, unsigned sb, unsigned hl, unsigned sl)
+{
+ struct __initial_stackheap s;
+
+ s.heap_base = hb;
+ s.stack_base = sb;
+ s.heap_limit = s.stack_base;
+ s.stack_limit = s.heap_base;
+ return s;
+}
+
+/*----------------------------------------------------------------------*/
+/*------ Set test status bits in testbench when main() exits -------*/
+/*----------------------------------------------------------------------*/
+void _sys_exit(int return_code)
+{
+ while(1);
+}
+
+
+
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/startup_es32f027x.s b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/startup_es32f027x.s
new file mode 100644
index 0000000000000000000000000000000000000000..78c14566c3787dae557b46ee5b30a2a393c69e17
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/startup_es32f027x.s
@@ -0,0 +1,244 @@
+;*******************************************************************************
+; *file : startup_ES32F027x.s
+; *description: ES32F027x Device Startup File
+; *author : Eastsoft MCU Software Team
+; *version : V0.01
+; *data : 12/10/2018
+;
+; *Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd.
+; *
+; * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
+; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
+; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
+; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
+;*******************************************************************************
+
+
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Stack_Size EQU 0x00000400
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+;
+
+Heap_Size EQU 0x00000000
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+
+__Vectors DCD __initial_sp ; Top of Stack
+ ; External Interrupts
+ DCD Reset_Handler ;1, Reset Handler
+ DCD NMI_Handler ;2, NMI Handler
+ DCD HardFault_Handler ;3, HARDFAULT Handler
+ DCD 0 ;4, Reserved
+ DCD 0 ;5, Reserved
+ DCD 0 ;6, Reserved
+ DCD 0 ;7, Reserved
+ DCD 0 ;8, Reserved
+ DCD 0 ;9, Reserved
+ DCD 0 ;10, Reserved
+ DCD SVC_Handler ;11, SVC Handler
+ DCD 0 ;12, Reserved
+ DCD 0 ;13, Reserved
+ DCD PendSV_Handler ;14, PENDSV Handler
+ DCD SysTick_Handler ;15, SYSTICK Handler
+ DCD WWDT_IRQHandler ;16, WWDT IRQHandler
+ DCD PVD_IRQHandler ;17, PVD IRQHandler
+ DCD RTC_IRQHandler ;18, RTC IRQHandler
+ DCD LowPowerWakeup_IRQHandler ;19, LowPowerWakeup IRQHandler
+ DCD 0 ;20, Reserved
+ DCD EXTI0_1_IRQHandler ;21, EXTI01_1 IRQHandler
+ DCD EXTI2_3_IRQHandler ;22, EXTI2_3 IRQHandler
+ DCD EXTI4_15_IRQHandler ;23, EXTI4_15 IRQHandler
+ DCD 0 ;24, Reserved
+ DCD DMA1_CH0_IRQHandler ;25, DMA1_CH0 IRQHandler
+ DCD DMA1_CH1_2_IRQHandler ;26, DMA1_CH1_2 IRQHandler
+ DCD DMA1_CH3_5_IRQHandler ;27, DMA1_CH3_5 IRQHandler
+ DCD ADC_CMP_IRQHandler ;28, ADC_CMP IRQHandler
+ DCD AD16C4T1_IRQHandler ;29, AD16C4T1 IRQHandler
+ DCD BS16T1_IRQHandler ;30, BS16T1 IRQHandler
+ DCD GP32C4T1_IRQHandler ;31, GP32C4T1 IRQHandler
+ DCD GP16C4T1_IRQHandler ;32, GP16C4T1 IRQHandler
+ DCD GP16C4T2_IRQHandler ;33, GP16C4T2 IRQHandler
+ DCD GP16C4T3_IRQHandler ;34, GP16C4T3 IRQHandler
+ DCD GP16C2T1_IRQHandler ;35, GP16C2T1 IRQHandler
+ DCD GP16C2T2_IRQHandler ;36, GP16C2T2 IRQHandler
+ DCD GP16C2T3_IRQHandler ;37, GP16C2T3 IRQHandler
+ DCD GP16C2T4_IRQHandler ;38, GP16C2T4 IRQHandler
+ DCD I2C1_IRQHandler ;39, I2C1 IRQHandler
+ DCD I2C2_IRQHandler ;40, I2C2 IRQHandler
+ DCD SPI1_IRQHandler ;41, SPI1 IRQHandler
+ DCD SPI2_IRQHandler ;42, SPI2 IRQHandler
+ DCD UART1_IRQHandler ;43, UART1 IRQHandler
+ DCD UART2_IRQHandler ;44, UART2 IRQHandler
+ DCD UART3_AES_IRQHandler ;45, UART3_AES IRQHandler
+ DCD SUART1_SUART2_IRQHandler ;46, SUART1_SUART2 IRQHandler
+ DCD USB_IRQHandler ;47, USB IRQHandler
+
+
+ AREA |.text|, CODE, READONLY
+
+
+; Reset Handler
+
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT __main
+ IMPORT SystemInit
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+; Dummy Exception IRQHandlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+
+
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+
+
+ EXPORT WWDT_IRQHandler [WEAK]
+ EXPORT PVD_IRQHandler [WEAK]
+ EXPORT RTC_IRQHandler [WEAK]
+ EXPORT LowPowerWakeup_IRQHandler [WEAK]
+ EXPORT EXTI0_1_IRQHandler [WEAK]
+ EXPORT EXTI2_3_IRQHandler [WEAK]
+ EXPORT EXTI4_15_IRQHandler [WEAK]
+ EXPORT DMA1_CH0_IRQHandler [WEAK]
+ EXPORT DMA1_CH1_2_IRQHandler [WEAK]
+ EXPORT DMA1_CH3_5_IRQHandler [WEAK]
+ EXPORT ADC_CMP_IRQHandler [WEAK]
+ EXPORT AD16C4T1_IRQHandler [WEAK]
+ EXPORT BS16T1_IRQHandler [WEAK]
+ EXPORT GP32C4T1_IRQHandler [WEAK]
+ EXPORT GP16C4T1_IRQHandler [WEAK]
+ EXPORT GP16C4T2_IRQHandler [WEAK]
+ EXPORT GP16C4T3_IRQHandler [WEAK]
+ EXPORT GP16C2T1_IRQHandler [WEAK]
+ EXPORT GP16C2T2_IRQHandler [WEAK]
+ EXPORT GP16C2T3_IRQHandler [WEAK]
+ EXPORT GP16C2T4_IRQHandler [WEAK]
+ EXPORT I2C1_IRQHandler [WEAK]
+ EXPORT I2C2_IRQHandler [WEAK]
+ EXPORT SPI1_IRQHandler [WEAK]
+ EXPORT SPI2_IRQHandler [WEAK]
+ EXPORT UART1_IRQHandler [WEAK]
+ EXPORT UART2_IRQHandler [WEAK]
+ EXPORT UART3_AES_IRQHandler [WEAK]
+ EXPORT SUART1_SUART2_IRQHandler [WEAK]
+ EXPORT USB_IRQHandler [WEAK]
+
+
+
+WWDT_IRQHandler
+PVD_IRQHandler
+RTC_IRQHandler
+LowPowerWakeup_IRQHandler
+EXTI0_1_IRQHandler
+EXTI2_3_IRQHandler
+EXTI4_15_IRQHandler
+DMA1_CH0_IRQHandler
+DMA1_CH1_2_IRQHandler
+DMA1_CH3_5_IRQHandler
+ADC_CMP_IRQHandler
+AD16C4T1_IRQHandler
+BS16T1_IRQHandler
+GP32C4T1_IRQHandler
+GP16C4T1_IRQHandler
+GP16C4T2_IRQHandler
+GP16C4T3_IRQHandler
+GP16C2T1_IRQHandler
+GP16C2T2_IRQHandler
+GP16C2T3_IRQHandler
+GP16C2T4_IRQHandler
+I2C1_IRQHandler
+I2C2_IRQHandler
+SPI1_IRQHandler
+SPI2_IRQHandler
+UART1_IRQHandler
+UART2_IRQHandler
+UART3_AES_IRQHandler
+SUART1_SUART2_IRQHandler
+USB_IRQHandler
+
+
+ B .
+
+ ENDP
+
+ ALIGN
+
+; User Initial Stack & Heap
+
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+ END
+
+
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/core_cm0.c b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/core_cm0.c
new file mode 100644
index 0000000000000000000000000000000000000000..e8a1ed21c0235902bbece97627636b693fd2dc45
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/core_cm0.c
@@ -0,0 +1,472 @@
+/*
+ *-----------------------------------------------------------------------------
+ * The confidential and proprietary information contained in this file may
+ * only be used by a person authorised under and to the extent permitted
+ * by a subsisting licensing agreement from ARM Limited.
+ *
+ * (C) COPYRIGHT 2009-2010 ARM Limited.
+ * ALL RIGHTS RESERVED
+ *
+ * This entire notice must be reproduced on all copies of this file
+ * and copies of this file may only be made by a person if such person is
+ * permitted to do so under the terms of a subsisting license agreement
+ * from ARM Limited.
+ *
+ * SVN Information
+ *
+ * Checked In : $Date: 2008-12-31 10:59:44 +0000 (Wed, 31 Dec 2008) $
+ *
+ * Revision : $Revision: 97564 $
+ *
+ * Release Information : Cortex-M0-AT510-r0p0-03rel0
+ *-----------------------------------------------------------------------------
+ */
+
+
+#include
+
+
+/* define compiler specific symbols */
+#if defined ( __CC_ARM )
+ #define __ASM __asm /*!< asm keyword for armcc */
+ #define __INLINE __inline /*!< inline keyword for armcc */
+
+#elif defined ( __ICCARM__ )
+ #define __ASM __asm /*!< asm keyword for iarcc */
+ #define __INLINE inline /*!< inline keyword for iarcc. Only avaiable in High optimization mode! */
+ #define __nop __no_operation /*!< no operation intrinsic in iarcc */
+
+#elif defined ( __GNUC__ )
+ #define __ASM asm /*!< asm keyword for gcc */
+ #define __INLINE inline /*!< inline keyword for gcc */
+#endif
+
+
+
+#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
+
+/**
+ * @brief Return the Process Stack Pointer
+ *
+ * @param none
+ * @return uint32_t ProcessStackPointer
+ *
+ * Return the actual process stack pointer
+ */
+__ASM uint32_t __get_PSP(void)
+{
+ mrs r0, psp
+ bx lr
+}
+
+/**
+ * @brief Set the Process Stack Pointer
+ *
+ * @param uint32_t Process Stack Pointer
+ * @return none
+ *
+ * Assign the value ProcessStackPointer to the MSP
+ * (process stack pointer) Cortex processor register
+ */
+__ASM void __set_PSP(uint32_t topOfProcStack)
+{
+ msr psp, r0
+ bx lr
+}
+
+/**
+ * @brief Return the Main Stack Pointer
+ *
+ * @param none
+ * @return uint32_t Main Stack Pointer
+ *
+ * Return the current value of the MSP (main stack pointer)
+ * Cortex processor register
+ */
+__ASM uint32_t __get_MSP(void)
+{
+ mrs r0, msp
+ bx lr
+}
+
+/**
+ * @brief Set the Main Stack Pointer
+ *
+ * @param uint32_t Main Stack Pointer
+ * @return none
+ *
+ * Assign the value mainStackPointer to the MSP
+ * (main stack pointer) Cortex processor register
+ */
+__ASM void __set_MSP(uint32_t mainStackPointer)
+{
+ msr msp, r0
+ bx lr
+}
+
+/**
+ * @brief Reverse byte order in unsigned short value
+ *
+ * @param uint16_t value to reverse
+ * @return uint32_t reversed value
+ *
+ * Reverse byte order in unsigned short value
+ */
+__ASM uint32_t __REV16(uint16_t value)
+{
+ rev16 r0, r0
+ bx lr
+}
+
+/**
+ * @brief Reverse byte order in signed short value with sign extension to integer
+ *
+ * @param int16_t value to reverse
+ * @return int32_t reversed value
+ *
+ * Reverse byte order in signed short value with sign extension to integer
+ */
+__ASM int32_t __REVSH(int16_t value)
+{
+ revsh r0, r0
+ bx lr
+}
+
+
+#if (__ARMCC_VERSION < 400000)
+
+
+/**
+ * @brief Return the Priority Mask value
+ *
+ * @param none
+ * @return uint32_t PriMask
+ *
+ * Return the state of the priority mask bit from the priority mask
+ * register
+ */
+__ASM uint32_t __get_PRIMASK(void)
+{
+ mrs r0, primask
+ bx lr
+}
+
+/**
+ * @brief Set the Priority Mask value
+ *
+ * @param uint32_t PriMask
+ * @return none
+ *
+ * Set the priority mask bit in the priority mask register
+ */
+__ASM void __set_PRIMASK(uint32_t priMask)
+{
+ msr primask, r0
+ bx lr
+}
+
+
+/**
+ * @brief Return the Control Register value
+ *
+ * @param none
+ * @return uint32_t Control value
+ *
+ * Return the content of the control register
+ */
+__ASM uint32_t __get_CONTROL(void)
+{
+ mrs r0, control
+ bx lr
+}
+
+/**
+ * @brief Set the Control Register value
+ *
+ * @param uint32_t Control value
+ * @return none
+ *
+ * Set the control register
+ */
+__ASM void __set_CONTROL(uint32_t control)
+{
+ msr control, r0
+ bx lr
+}
+
+#endif /* __ARMCC_VERSION */
+
+
+#elif (defined (__ICCARM__)) /*------------------ ICC Compiler -------------------*/
+#pragma diag_suppress=Pe940
+
+/**
+ * @brief Return the Process Stack Pointer
+ *
+ * @param none
+ * @return uint32_t ProcessStackPointer
+ *
+ * Return the actual process stack pointer
+ */
+uint32_t __get_PSP(void)
+{
+ __ASM("mrs r0, psp");
+ __ASM("bx lr");
+}
+
+/**
+ * @brief Set the Process Stack Pointer
+ *
+ * @param uint32_t Process Stack Pointer
+ * @return none
+ *
+ * Assign the value ProcessStackPointer to the MSP
+ * (process stack pointer) Cortex processor register
+ */
+void __set_PSP(uint32_t topOfProcStack)
+{
+ __ASM("msr psp, r0");
+ __ASM("bx lr");
+}
+
+/**
+ * @brief Return the Main Stack Pointer
+ *
+ * @param none
+ * @return uint32_t Main Stack Pointer
+ *
+ * Return the current value of the MSP (main stack pointer)
+ * Cortex processor register
+ */
+uint32_t __get_MSP(void)
+{
+ __ASM("mrs r0, msp");
+ __ASM("bx lr");
+}
+
+/**
+ * @brief Set the Main Stack Pointer
+ *
+ * @param uint32_t Main Stack Pointer
+ * @return none
+ *
+ * Assign the value mainStackPointer to the MSP
+ * (main stack pointer) Cortex processor register
+ */
+void __set_MSP(uint32_t topOfMainStack)
+{
+ __ASM("msr msp, r0");
+ __ASM("bx lr");
+}
+
+/**
+ * @brief Reverse byte order in unsigned short value
+ *
+ * @param uint16_t value to reverse
+ * @return uint32_t reversed value
+ *
+ * Reverse byte order in unsigned short value
+ */
+uint32_t __REV16(uint16_t value)
+{
+ __ASM("rev16 r0, r0");
+ __ASM("bx lr");
+}
+
+
+#pragma diag_default=Pe940
+
+
+
+
+#elif (defined (__GNUC__)) /*------------------ GNU Compiler ---------------------*/
+
+/**
+ * @brief Return the Process Stack Pointer
+ *
+ * @param none
+ * @return uint32_t ProcessStackPointer
+ *
+ * Return the actual process stack pointer
+ */
+uint32_t __get_PSP(void)
+{
+ uint32_t result=0;
+
+ __ASM volatile ("MRS %0, psp" : "=r" (result) );
+ return(result);
+}
+
+/**
+ * @brief Set the Process Stack Pointer
+ *
+ * @param uint32_t Process Stack Pointer
+ * @return none
+ *
+ * Assign the value ProcessStackPointer to the MSP
+ * (process stack pointer) Cortex processor register
+ */
+void __set_PSP(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) );
+}
+
+/**
+ * @brief Return the Main Stack Pointer
+ *
+ * @param none
+ * @return uint32_t Main Stack Pointer
+ *
+ * Return the current value of the MSP (main stack pointer)
+ * Cortex processor register
+ */
+uint32_t __get_MSP(void)
+{
+ uint32_t result=0;
+
+ __ASM volatile ("MRS %0, msp" : "=r" (result) );
+ return(result);
+}
+
+/**
+ * @brief Set the Main Stack Pointer
+ *
+ * @param uint32_t Main Stack Pointer
+ * @return none
+ *
+ * Assign the value mainStackPointer to the MSP
+ * (main stack pointer) Cortex processor register
+ */
+void __set_MSP(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) );
+}
+
+
+/**
+ * @brief Return the Priority Mask value
+ *
+ * @param none
+ * @return uint32_t PriMask
+ *
+ * Return the state of the priority mask bit from the priority mask
+ * register
+ */
+uint32_t __get_PRIMASK(void)
+{
+ uint32_t result=0;
+
+ __ASM volatile ("MRS %0, primask" : "=r" (result) );
+ return(result);
+}
+
+/**
+ * @brief Set the Priority Mask value
+ *
+ * @param uint32_t PriMask
+ * @return none
+ *
+ * Set the priority mask bit in the priority mask register
+ */
+void __set_PRIMASK(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask, %0" : : "r" (priMask) );
+}
+
+
+/**
+ * @brief Reverse byte order in integer value
+ *
+ * @param uint32_t value to reverse
+ * @return uint32_t reversed value
+ *
+ * Reverse byte order in integer value
+ */
+uint32_t __REV(uint32_t value)
+{
+ uint32_t result=0;
+
+ __ASM volatile ("rev %0, %1" : "=r" (result) : "r" (value) );
+ return(result);
+}
+
+/**
+ * @brief Reverse byte order in unsigned short value
+ *
+ * @param uint16_t value to reverse
+ * @return uint32_t reversed value
+ *
+ * Reverse byte order in unsigned short value
+ */
+uint32_t __REV16(uint16_t value)
+{
+ uint32_t result=0;
+
+ __ASM volatile ("rev16 %0, %1" : "=r" (result) : "r" (value) );
+ return(result);
+}
+
+/**
+ * @brief Reverse byte order in signed short value with sign extension to integer
+ *
+ * @param int32_t value to reverse
+ * @return int32_t reversed value
+ *
+ * Reverse byte order in signed short value with sign extension to integer
+ */
+int32_t __REVSH(int16_t value)
+{
+ uint32_t result=0;
+
+ __ASM volatile ("revsh %0, %1" : "=r" (result) : "r" (value) );
+ return(result);
+}
+
+
+/**
+ * @brief Return the Control Register value
+ *
+ * @param none
+ * @return uint32_t Control value
+ *
+ * Return the content of the control register
+ */
+uint32_t __get_CONTROL(void)
+{
+ uint32_t result=0;
+
+ __ASM volatile ("MRS %0, control" : "=r" (result) );
+ return(result);
+}
+
+/**
+ * @brief Set the Control Register value
+ *
+ * @param uint32_t Control value
+ * @return none
+ *
+ * Set the control register
+ */
+void __set_CONTROL(uint32_t control)
+{
+ __ASM volatile ("MSR control, %0" : : "r" (control) );
+}
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/retarget.c b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/retarget.c
new file mode 100644
index 0000000000000000000000000000000000000000..1303e0765e88b926081916b00540f1aab56218e7
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/retarget.c
@@ -0,0 +1,55 @@
+/******************************************************************************/
+/* RETARGET.C: 'Retarget' layer for target-dependent low level functions */
+/******************************************************************************/
+/* This file is part of the uVision/ARM development tools. */
+/* Copyright (c) 2005-2006 Keil Software. All rights reserved. */
+/* This software may only be used under the terms of a valid, current, */
+/* end user licence from KEIL for a compatible version of KEIL software */
+/* development tools. Nothing else gives you the right to use this software. */
+/******************************************************************************/
+
+#include
+#include
+
+//#pragma import(__use_no_semihosting_swi)
+
+__weak uint8_t sendchar(uint8_t ui8char)
+{
+ (void) ui8char;
+ return 0;
+}
+
+
+int ITM_fputc(int ch); /* ITM debug */
+
+struct __FILE
+{
+int handle; /* Add whatever you need here */
+};
+FILE __stdout;
+
+
+int fputc(int ch, FILE *f)
+{
+ return (sendchar(ch));
+}
+
+
+int ferror(FILE *f)
+{
+ /* Your implementation of ferror */
+ return EOF;
+}
+
+
+void _ttywrch(int ch)
+{
+ sendchar(ch);
+}
+
+
+void _sys_exit(int return_code)
+{
+label:
+ goto label; /* endless loop */
+}
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.c b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.c
new file mode 100644
index 0000000000000000000000000000000000000000..6112c52bb4ca5f2292919972f8b23029367bbfb1
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.c
@@ -0,0 +1,79 @@
+/**
+ **************************************************************************************
+ * @file system_es32f027x.c
+ * @brief System File.
+ *
+ * @version V0.01
+ * @data 5/17/2018
+ * @author Eastsoft AE Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+/* Incudes--------------------------------------------------------*/
+#include "system_es32f027x.h"
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup System_ES32F027X
+ * @{
+ */
+
+/* Public Functions -----------------------------------------------------------*/
+/* Public Init Structure ------------------------------------------------------*/
+/* Public Macros --------------------------------------------------------------*/
+/* Public Constants -----------------------------------------------------------*/
+/* Private Macros -------------------------------------------------------------*/
+/* Private Constants-----------------------------------------------------------*/
+
+/* Private Variables ----------------------------------------------------------*/
+/** @addtogroup Private_Variables
+ * @{
+ */
+
+/**
+ * @brief update the value of SystemCoreClock after changing the system clock.
+ */
+unsigned int SystemCoreClock = 4000000;
+unsigned int SystemFrequency_SysClk = 4000000;
+unsigned int SystemFrequency_AHBClk = 4000000;
+unsigned int SystemFrequency_APBClk = 4000000;
+unsigned int PLL1Frequency = 48000000;
+unsigned int PLL0Frequency = 4000000;
+
+/**
+ * @} Private_Variables
+ */
+
+/* Private Functions ----------------------------------------------------------*/
+/** @addtogroup Private_Functions
+ * @{
+ */
+
+/**
+ * @brief:SystemInit.
+ * @param:none
+ * @retval:none
+ */
+void SystemInit (void)
+{
+}
+
+/**
+ * @} Private_Functions
+ */
+
+/**
+ * @} System_ES32F072X
+ */
+
+/**
+ * @} CMSIS
+ */
+/********** (C) COPYRIGHT Eastsoft Microelectronics END OF FILE SYSTEM_ES32F027X.H **********/
+
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.h
new file mode 100644
index 0000000000000000000000000000000000000000..d2cee80354f455407f220592ef5f73702946ec02
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.h
@@ -0,0 +1,83 @@
+/**
+ **************************************************************************************
+ * @file SYSTEM_ES32F027x.H
+ * @brief es32f0271 system head file.
+ *
+ * @version V0.01
+ * @data 5/17/2018
+ * @author Eastsoft AE Team
+ * @note
+ *
+ * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved.
+ *
+ **************************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __SYSTEM_ES32F027x_H__
+#define __SYSTEM_ES32F027x_H__
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes -------------------------------------------------------*/
+#include
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup System_ES32F027x
+ * @{
+ */
+
+/* Public Functions -----------------------------------------------------------*/
+/* Public Init Structure ------------------------------------------------------*/
+/* Public Macros --------------------------------------------------------------*/
+/* Public Constants -----------------------------------------------------------*/
+/* Private Variables ----------------------------------------------------------*/
+/* Private Macros -------------------------------------------------------------*/
+/* Private Constants-----------------------------------------------------------*/
+
+/* Public Types ---------------------------------------------------------------*/
+/** @addtogroup Public_Types
+ * @{
+ */
+extern unsigned int SystemCoreClock;
+extern unsigned int SystemFrequency_SysClk;
+extern unsigned int SystemFrequency_AHBClk;
+extern unsigned int SystemFrequency_APBClk;
+extern unsigned int PLL1Frequency;
+extern unsigned int PLL0Frequency;
+
+/* Exported function -------------------------------------------------*/
+/** @addtogroup Public_Functions
+ * @{
+ */
+
+extern void SystemInit (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/**
+ * @} Public_Functions
+ */
+
+/**
+ * @} Public_Types
+ */
+
+/**
+ * @} System_ES32F027x
+ */
+
+/**
+ * @} CMSIS
+ */
+/********** (C) COPYRIGHT Eastsoft Microelectronics END OF FILE SYSTEM_ES32F027x.H **********/
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_common_tables.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_common_tables.h
new file mode 100644
index 0000000000000000000000000000000000000000..dfea7460e9a79e5b20670d947e6a52a894b29801
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_common_tables.h
@@ -0,0 +1,121 @@
+/* ----------------------------------------------------------------------
+ * Project: CMSIS DSP Library
+ * Title: arm_common_tables.h
+ * Description: Extern declaration for common tables
+ *
+ * $Date: 27. January 2017
+ * $Revision: V.1.5.1
+ *
+ * Target Processor: Cortex-M cores
+ * -------------------------------------------------------------------- */
+/*
+ * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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 _ARM_COMMON_TABLES_H
+#define _ARM_COMMON_TABLES_H
+
+#include "arm_math.h"
+
+extern const uint16_t armBitRevTable[1024];
+extern const q15_t armRecipTableQ15[64];
+extern const q31_t armRecipTableQ31[64];
+extern const float32_t twiddleCoef_16[32];
+extern const float32_t twiddleCoef_32[64];
+extern const float32_t twiddleCoef_64[128];
+extern const float32_t twiddleCoef_128[256];
+extern const float32_t twiddleCoef_256[512];
+extern const float32_t twiddleCoef_512[1024];
+extern const float32_t twiddleCoef_1024[2048];
+extern const float32_t twiddleCoef_2048[4096];
+extern const float32_t twiddleCoef_4096[8192];
+#define twiddleCoef twiddleCoef_4096
+extern const q31_t twiddleCoef_16_q31[24];
+extern const q31_t twiddleCoef_32_q31[48];
+extern const q31_t twiddleCoef_64_q31[96];
+extern const q31_t twiddleCoef_128_q31[192];
+extern const q31_t twiddleCoef_256_q31[384];
+extern const q31_t twiddleCoef_512_q31[768];
+extern const q31_t twiddleCoef_1024_q31[1536];
+extern const q31_t twiddleCoef_2048_q31[3072];
+extern const q31_t twiddleCoef_4096_q31[6144];
+extern const q15_t twiddleCoef_16_q15[24];
+extern const q15_t twiddleCoef_32_q15[48];
+extern const q15_t twiddleCoef_64_q15[96];
+extern const q15_t twiddleCoef_128_q15[192];
+extern const q15_t twiddleCoef_256_q15[384];
+extern const q15_t twiddleCoef_512_q15[768];
+extern const q15_t twiddleCoef_1024_q15[1536];
+extern const q15_t twiddleCoef_2048_q15[3072];
+extern const q15_t twiddleCoef_4096_q15[6144];
+extern const float32_t twiddleCoef_rfft_32[32];
+extern const float32_t twiddleCoef_rfft_64[64];
+extern const float32_t twiddleCoef_rfft_128[128];
+extern const float32_t twiddleCoef_rfft_256[256];
+extern const float32_t twiddleCoef_rfft_512[512];
+extern const float32_t twiddleCoef_rfft_1024[1024];
+extern const float32_t twiddleCoef_rfft_2048[2048];
+extern const float32_t twiddleCoef_rfft_4096[4096];
+
+/* floating-point bit reversal tables */
+#define ARMBITREVINDEXTABLE_16_TABLE_LENGTH ((uint16_t)20)
+#define ARMBITREVINDEXTABLE_32_TABLE_LENGTH ((uint16_t)48)
+#define ARMBITREVINDEXTABLE_64_TABLE_LENGTH ((uint16_t)56)
+#define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208)
+#define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440)
+#define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448)
+#define ARMBITREVINDEXTABLE_1024_TABLE_LENGTH ((uint16_t)1800)
+#define ARMBITREVINDEXTABLE_2048_TABLE_LENGTH ((uint16_t)3808)
+#define ARMBITREVINDEXTABLE_4096_TABLE_LENGTH ((uint16_t)4032)
+
+extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE_16_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE_32_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE_64_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE_1024_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE_2048_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE_4096_TABLE_LENGTH];
+
+/* fixed-point bit reversal tables */
+#define ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH ((uint16_t)12)
+#define ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH ((uint16_t)24)
+#define ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH ((uint16_t)56)
+#define ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH ((uint16_t)112)
+#define ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH ((uint16_t)240)
+#define ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH ((uint16_t)480)
+#define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992)
+#define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984)
+#define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032)
+
+extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH];
+extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH];
+
+/* Tables for Fast Math Sine and Cosine */
+extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1];
+extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1];
+extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1];
+
+#endif /* ARM_COMMON_TABLES_H */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_const_structs.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_const_structs.h
new file mode 100644
index 0000000000000000000000000000000000000000..80a3e8bbe72b8c54f34a0f40aa1e01f2bfb3308f
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_const_structs.h
@@ -0,0 +1,66 @@
+/* ----------------------------------------------------------------------
+ * Project: CMSIS DSP Library
+ * Title: arm_const_structs.h
+ * Description: Constant structs that are initialized for user convenience.
+ * For example, some can be given as arguments to the arm_cfft_f32() function.
+ *
+ * $Date: 27. January 2017
+ * $Revision: V.1.5.1
+ *
+ * Target Processor: Cortex-M cores
+ * -------------------------------------------------------------------- */
+/*
+ * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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 _ARM_CONST_STRUCTS_H
+#define _ARM_CONST_STRUCTS_H
+
+#include "arm_math.h"
+#include "arm_common_tables.h"
+
+ extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16;
+ extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32;
+ extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64;
+ extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128;
+ extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256;
+ extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512;
+ extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024;
+ extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048;
+ extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096;
+
+ extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16;
+ extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32;
+ extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64;
+ extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128;
+ extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256;
+ extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512;
+ extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024;
+ extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048;
+ extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096;
+
+ extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16;
+ extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32;
+ extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64;
+ extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128;
+ extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256;
+ extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512;
+ extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024;
+ extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048;
+ extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096;
+
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_math.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_math.h
new file mode 100644
index 0000000000000000000000000000000000000000..ea9dd26aa8110a0a90babc7b297c5bc6d5eb4216
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_math.h
@@ -0,0 +1,7157 @@
+/******************************************************************************
+ * @file arm_math.h
+ * @brief Public header file for CMSIS DSP LibraryU
+ * @version V1.5.3
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2010-2018 Arm Limited or its affiliates. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+/**
+ \mainpage CMSIS DSP Software Library
+ *
+ * Introduction
+ * ------------
+ *
+ * This user manual describes the CMSIS DSP software library,
+ * a suite of common signal processing functions for use on Cortex-M processor based devices.
+ *
+ * The library is divided into a number of functions each covering a specific category:
+ * - Basic math functions
+ * - Fast math functions
+ * - Complex math functions
+ * - Filters
+ * - Matrix functions
+ * - Transforms
+ * - Motor control functions
+ * - Statistical functions
+ * - Support functions
+ * - Interpolation functions
+ *
+ * The library has separate functions for operating on 8-bit integers, 16-bit integers,
+ * 32-bit integer and 32-bit floating-point values.
+ *
+ * Using the Library
+ * ------------
+ *
+ * The library installer contains prebuilt versions of the libraries in the Lib
folder.
+ * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
+ * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)
+ * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
+ * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)
+ * - arm_cortexM7l_math.lib (Cortex-M7, Little endian)
+ * - arm_cortexM7b_math.lib (Cortex-M7, Big endian)
+ * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)
+ * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)
+ * - arm_cortexM4l_math.lib (Cortex-M4, Little endian)
+ * - arm_cortexM4b_math.lib (Cortex-M4, Big endian)
+ * - arm_cortexM3l_math.lib (Cortex-M3, Little endian)
+ * - arm_cortexM3b_math.lib (Cortex-M3, Big endian)
+ * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)
+ * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)
+ * - arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian)
+ * - arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian)
+ * - arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit)
+ * - arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions)
+ * - arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit)
+ *
+ * The library functions are declared in the public file arm_math.h
which is placed in the Include
folder.
+ * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
+ * public header file arm_math.h
for Cortex-M cores with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
+ * Define the appropriate preprocessor macro ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
+ * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
+ * For Armv8-M cores define preprocessor macro ARM_MATH_ARMV8MBL or ARM_MATH_ARMV8MML.
+ * Set preprocessor macro __DSP_PRESENT if Armv8-M Mainline core supports DSP instructions.
+ *
+ *
+ * Examples
+ * --------
+ *
+ * The library ships with a number of examples which demonstrate how to use the library functions.
+ *
+ * Toolchain Support
+ * ------------
+ *
+ * The library has been developed and tested with MDK version 5.14.0.0
+ * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
+ *
+ * Building the Library
+ * ------------
+ *
+ * The library installer contains a project file to rebuild libraries on MDK toolchain in the CMSIS\\DSP_Lib\\Source\\ARM
folder.
+ * - arm_cortexM_math.uvprojx
+ *
+ *
+ * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional preprocessor macros detailed above.
+ *
+ * Preprocessor Macros
+ * ------------
+ *
+ * Each library project have different preprocessor macros.
+ *
+ * - UNALIGNED_SUPPORT_DISABLE:
+ *
+ * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
+ *
+ * - ARM_MATH_BIG_ENDIAN:
+ *
+ * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
+ *
+ * - ARM_MATH_MATRIX_CHECK:
+ *
+ * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
+ *
+ * - ARM_MATH_ROUNDING:
+ *
+ * Define macro ARM_MATH_ROUNDING for rounding on support functions
+ *
+ * - ARM_MATH_CMx:
+ *
+ * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
+ * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
+ * ARM_MATH_CM7 for building the library on cortex-M7.
+ *
+ * - ARM_MATH_ARMV8MxL:
+ *
+ * Define macro ARM_MATH_ARMV8MBL for building the library on Armv8-M Baseline target, ARM_MATH_ARMV8MML for building library
+ * on Armv8-M Mainline target.
+ *
+ * - __FPU_PRESENT:
+ *
+ * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for floating point libraries.
+ *
+ * - __DSP_PRESENT:
+ *
+ * Initialize macro __DSP_PRESENT = 1 when Armv8-M Mainline core supports DSP instructions.
+ *
+ *
+ * CMSIS-DSP in ARM::CMSIS Pack
+ * -----------------------------
+ *
+ * The following files relevant to CMSIS-DSP are present in the ARM::CMSIS Pack directories:
+ * |File/Folder |Content |
+ * |------------------------------|------------------------------------------------------------------------|
+ * |\b CMSIS\\Documentation\\DSP | This documentation |
+ * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
+ * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
+ * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
+ *
+ *
+ * Revision History of CMSIS-DSP
+ * ------------
+ * Please refer to \ref ChangeLog_pg.
+ *
+ * Copyright Notice
+ * ------------
+ *
+ * Copyright (C) 2010-2015 Arm Limited. All rights reserved.
+ */
+
+
+/**
+ * @defgroup groupMath Basic Math Functions
+ */
+
+/**
+ * @defgroup groupFastMath Fast Math Functions
+ * This set of functions provides a fast approximation to sine, cosine, and square root.
+ * As compared to most of the other functions in the CMSIS math library, the fast math functions
+ * operate on individual values and not arrays.
+ * There are separate functions for Q15, Q31, and floating-point data.
+ *
+ */
+
+/**
+ * @defgroup groupCmplxMath Complex Math Functions
+ * This set of functions operates on complex data vectors.
+ * The data in the complex arrays is stored in an interleaved fashion
+ * (real, imag, real, imag, ...).
+ * In the API functions, the number of samples in a complex array refers
+ * to the number of complex values; the array contains twice this number of
+ * real values.
+ */
+
+/**
+ * @defgroup groupFilters Filtering Functions
+ */
+
+/**
+ * @defgroup groupMatrix Matrix Functions
+ *
+ * This set of functions provides basic matrix math operations.
+ * The functions operate on matrix data structures. For example,
+ * the type
+ * definition for the floating-point matrix structure is shown
+ * below:
+ *
+ * typedef struct
+ * {
+ * uint16_t numRows; // number of rows of the matrix.
+ * uint16_t numCols; // number of columns of the matrix.
+ * float32_t *pData; // points to the data of the matrix.
+ * } arm_matrix_instance_f32;
+ *
+ * There are similar definitions for Q15 and Q31 data types.
+ *
+ * The structure specifies the size of the matrix and then points to
+ * an array of data. The array is of size numRows X numCols
+ * and the values are arranged in row order. That is, the
+ * matrix element (i, j) is stored at:
+ *
+ * pData[i*numCols + j]
+ *
+ *
+ * \par Init Functions
+ * There is an associated initialization function for each type of matrix
+ * data structure.
+ * The initialization function sets the values of the internal structure fields.
+ * Refer to the function arm_mat_init_f32()
, arm_mat_init_q31()
+ * and arm_mat_init_q15()
for floating-point, Q31 and Q15 types, respectively.
+ *
+ * \par
+ * Use of the initialization function is optional. However, if initialization function is used
+ * then the instance structure cannot be placed into a const data section.
+ * To place the instance structure in a const data
+ * section, manually initialize the data structure. For example:
+ *
+ * arm_matrix_instance_f32 S = {nRows, nColumns, pData};
+ * arm_matrix_instance_q31 S = {nRows, nColumns, pData};
+ * arm_matrix_instance_q15 S = {nRows, nColumns, pData};
+ *
+ * where nRows
specifies the number of rows, nColumns
+ * specifies the number of columns, and pData
points to the
+ * data array.
+ *
+ * \par Size Checking
+ * By default all of the matrix functions perform size checking on the input and
+ * output matrices. For example, the matrix addition function verifies that the
+ * two input matrices and the output matrix all have the same number of rows and
+ * columns. If the size check fails the functions return:
+ *
+ * ARM_MATH_SIZE_MISMATCH
+ *
+ * Otherwise the functions return
+ *
+ * ARM_MATH_SUCCESS
+ *
+ * There is some overhead associated with this matrix size checking.
+ * The matrix size checking is enabled via the \#define
+ *
+ * ARM_MATH_MATRIX_CHECK
+ *
+ * within the library project settings. By default this macro is defined
+ * and size checking is enabled. By changing the project settings and
+ * undefining this macro size checking is eliminated and the functions
+ * run a bit faster. With size checking disabled the functions always
+ * return ARM_MATH_SUCCESS
.
+ */
+
+/**
+ * @defgroup groupTransforms Transform Functions
+ */
+
+/**
+ * @defgroup groupController Controller Functions
+ */
+
+/**
+ * @defgroup groupStats Statistics Functions
+ */
+/**
+ * @defgroup groupSupport Support Functions
+ */
+
+/**
+ * @defgroup groupInterpolation Interpolation Functions
+ * These functions perform 1- and 2-dimensional interpolation of data.
+ * Linear interpolation is used for 1-dimensional data and
+ * bilinear interpolation is used for 2-dimensional data.
+ */
+
+/**
+ * @defgroup groupExamples Examples
+ */
+#ifndef _ARM_MATH_H
+#define _ARM_MATH_H
+
+/* Compiler specific diagnostic adjustment */
+#if defined ( __CC_ARM )
+
+#elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
+
+#elif defined ( __GNUC__ )
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+
+#elif defined ( __ICCARM__ )
+
+#elif defined ( __TI_ARM__ )
+
+#elif defined ( __CSMC__ )
+
+#elif defined ( __TASKING__ )
+
+#else
+ #error Unknown compiler
+#endif
+
+
+#define __CMSIS_GENERIC /* disable NVIC and Systick functions */
+
+#if defined(ARM_MATH_CM7)
+ #include "core_cm7.h"
+ #define ARM_MATH_DSP
+#elif defined (ARM_MATH_CM4)
+ #include "core_cm4.h"
+ #define ARM_MATH_DSP
+#elif defined (ARM_MATH_CM3)
+ #include "core_cm3.h"
+#elif defined (ARM_MATH_CM0)
+ #include "core_cm0.h"
+ #define ARM_MATH_CM0_FAMILY
+#elif defined (ARM_MATH_CM0PLUS)
+ #include "core_cm0plus.h"
+ #define ARM_MATH_CM0_FAMILY
+#elif defined (ARM_MATH_ARMV8MBL)
+ #include "core_armv8mbl.h"
+ #define ARM_MATH_CM0_FAMILY
+#elif defined (ARM_MATH_ARMV8MML)
+ #include "core_armv8mml.h"
+ #if (defined (__DSP_PRESENT) && (__DSP_PRESENT == 1))
+ #define ARM_MATH_DSP
+ #endif
+#else
+ #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS, ARM_MATH_CM0, ARM_MATH_ARMV8MBL, ARM_MATH_ARMV8MML"
+#endif
+
+#undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
+#include "string.h"
+#include "math.h"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+ /**
+ * @brief Macros required for reciprocal calculation in Normalized LMS
+ */
+
+#define DELTA_Q31 (0x100)
+#define DELTA_Q15 0x5
+#define INDEX_MASK 0x0000003F
+#ifndef PI
+ #define PI 3.14159265358979f
+#endif
+
+ /**
+ * @brief Macros required for SINE and COSINE Fast math approximations
+ */
+
+#define FAST_MATH_TABLE_SIZE 512
+#define FAST_MATH_Q31_SHIFT (32 - 10)
+#define FAST_MATH_Q15_SHIFT (16 - 10)
+#define CONTROLLER_Q31_SHIFT (32 - 9)
+#define TABLE_SPACING_Q31 0x400000
+#define TABLE_SPACING_Q15 0x80
+
+ /**
+ * @brief Macros required for SINE and COSINE Controller functions
+ */
+ /* 1.31(q31) Fixed value of 2/360 */
+ /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
+#define INPUT_SPACING 0xB60B61
+
+ /**
+ * @brief Macro for Unaligned Support
+ */
+#ifndef UNALIGNED_SUPPORT_DISABLE
+ #define ALIGN4
+#else
+ #if defined (__GNUC__)
+ #define ALIGN4 __attribute__((aligned(4)))
+ #else
+ #define ALIGN4 __align(4)
+ #endif
+#endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
+
+ /**
+ * @brief Error status returned by some functions in the library.
+ */
+
+ typedef enum
+ {
+ ARM_MATH_SUCCESS = 0, /**< No error */
+ ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
+ ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
+ ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
+ ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
+ ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
+ ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
+ } arm_status;
+
+ /**
+ * @brief 8-bit fractional data type in 1.7 format.
+ */
+ typedef int8_t q7_t;
+
+ /**
+ * @brief 16-bit fractional data type in 1.15 format.
+ */
+ typedef int16_t q15_t;
+
+ /**
+ * @brief 32-bit fractional data type in 1.31 format.
+ */
+ typedef int32_t q31_t;
+
+ /**
+ * @brief 64-bit fractional data type in 1.63 format.
+ */
+ typedef int64_t q63_t;
+
+ /**
+ * @brief 32-bit floating-point type definition.
+ */
+ typedef float float32_t;
+
+ /**
+ * @brief 64-bit floating-point type definition.
+ */
+ typedef double float64_t;
+
+ /**
+ * @brief definition to read/write two 16 bit values.
+ */
+#if defined ( __CC_ARM )
+ #define __SIMD32_TYPE int32_t __packed
+ #define CMSIS_UNUSED __attribute__((unused))
+ #define CMSIS_INLINE __attribute__((always_inline))
+
+#elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
+ #define __SIMD32_TYPE int32_t
+ #define CMSIS_UNUSED __attribute__((unused))
+ #define CMSIS_INLINE __attribute__((always_inline))
+
+#elif defined ( __GNUC__ )
+ #define __SIMD32_TYPE int32_t
+ #define CMSIS_UNUSED __attribute__((unused))
+ #define CMSIS_INLINE __attribute__((always_inline))
+
+#elif defined ( __ICCARM__ )
+ #define __SIMD32_TYPE int32_t __packed
+ #define CMSIS_UNUSED
+ #define CMSIS_INLINE
+
+#elif defined ( __TI_ARM__ )
+ #define __SIMD32_TYPE int32_t
+ #define CMSIS_UNUSED __attribute__((unused))
+ #define CMSIS_INLINE
+
+#elif defined ( __CSMC__ )
+ #define __SIMD32_TYPE int32_t
+ #define CMSIS_UNUSED
+ #define CMSIS_INLINE
+
+#elif defined ( __TASKING__ )
+ #define __SIMD32_TYPE __unaligned int32_t
+ #define CMSIS_UNUSED
+ #define CMSIS_INLINE
+
+#else
+ #error Unknown compiler
+#endif
+
+#define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
+#define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
+#define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
+#define __SIMD64(addr) (*(int64_t **) & (addr))
+
+#if !defined (ARM_MATH_DSP)
+ /**
+ * @brief definition to pack two 16 bit values.
+ */
+#define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
+ (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
+#define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
+ (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
+
+#endif /* !defined (ARM_MATH_DSP) */
+
+ /**
+ * @brief definition to pack four 8 bit values.
+ */
+#ifndef ARM_MATH_BIG_ENDIAN
+
+#define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
+ (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
+ (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
+ (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
+#else
+
+#define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
+ (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
+ (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
+ (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
+
+#endif
+
+
+ /**
+ * @brief Clips Q63 to Q31 values.
+ */
+ CMSIS_INLINE __STATIC_INLINE q31_t clip_q63_to_q31(
+ q63_t x)
+ {
+ return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
+ ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
+ }
+
+ /**
+ * @brief Clips Q63 to Q15 values.
+ */
+ CMSIS_INLINE __STATIC_INLINE q15_t clip_q63_to_q15(
+ q63_t x)
+ {
+ return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
+ ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
+ }
+
+ /**
+ * @brief Clips Q31 to Q7 values.
+ */
+ CMSIS_INLINE __STATIC_INLINE q7_t clip_q31_to_q7(
+ q31_t x)
+ {
+ return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
+ ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
+ }
+
+ /**
+ * @brief Clips Q31 to Q15 values.
+ */
+ CMSIS_INLINE __STATIC_INLINE q15_t clip_q31_to_q15(
+ q31_t x)
+ {
+ return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
+ ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
+ }
+
+ /**
+ * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
+ */
+
+ CMSIS_INLINE __STATIC_INLINE q63_t mult32x64(
+ q63_t x,
+ q31_t y)
+ {
+ return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
+ (((q63_t) (x >> 32) * y)));
+ }
+
+ /**
+ * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
+ */
+
+ CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q31(
+ q31_t in,
+ q31_t * dst,
+ q31_t * pRecipTable)
+ {
+ q31_t out;
+ uint32_t tempVal;
+ uint32_t index, i;
+ uint32_t signBits;
+
+ if (in > 0)
+ {
+ signBits = ((uint32_t) (__CLZ( in) - 1));
+ }
+ else
+ {
+ signBits = ((uint32_t) (__CLZ(-in) - 1));
+ }
+
+ /* Convert input sample to 1.31 format */
+ in = (in << signBits);
+
+ /* calculation of index for initial approximated Val */
+ index = (uint32_t)(in >> 24);
+ index = (index & INDEX_MASK);
+
+ /* 1.31 with exp 1 */
+ out = pRecipTable[index];
+
+ /* calculation of reciprocal value */
+ /* running approximation for two iterations */
+ for (i = 0U; i < 2U; i++)
+ {
+ tempVal = (uint32_t) (((q63_t) in * out) >> 31);
+ tempVal = 0x7FFFFFFFu - tempVal;
+ /* 1.31 with exp 1 */
+ /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */
+ out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30);
+ }
+
+ /* write output */
+ *dst = out;
+
+ /* return num of signbits of out = 1/in value */
+ return (signBits + 1U);
+ }
+
+
+ /**
+ * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q15(
+ q15_t in,
+ q15_t * dst,
+ q15_t * pRecipTable)
+ {
+ q15_t out = 0;
+ uint32_t tempVal = 0;
+ uint32_t index = 0, i = 0;
+ uint32_t signBits = 0;
+
+ if (in > 0)
+ {
+ signBits = ((uint32_t)(__CLZ( in) - 17));
+ }
+ else
+ {
+ signBits = ((uint32_t)(__CLZ(-in) - 17));
+ }
+
+ /* Convert input sample to 1.15 format */
+ in = (in << signBits);
+
+ /* calculation of index for initial approximated Val */
+ index = (uint32_t)(in >> 8);
+ index = (index & INDEX_MASK);
+
+ /* 1.15 with exp 1 */
+ out = pRecipTable[index];
+
+ /* calculation of reciprocal value */
+ /* running approximation for two iterations */
+ for (i = 0U; i < 2U; i++)
+ {
+ tempVal = (uint32_t) (((q31_t) in * out) >> 15);
+ tempVal = 0x7FFFu - tempVal;
+ /* 1.15 with exp 1 */
+ out = (q15_t) (((q31_t) out * tempVal) >> 14);
+ /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */
+ }
+
+ /* write output */
+ *dst = out;
+
+ /* return num of signbits of out = 1/in value */
+ return (signBits + 1);
+ }
+
+
+/*
+ * @brief C custom defined intrinsic function for M3 and M0 processors
+ */
+#if !defined (ARM_MATH_DSP)
+
+ /*
+ * @brief C custom defined QADD8 for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __QADD8(
+ uint32_t x,
+ uint32_t y)
+ {
+ q31_t r, s, t, u;
+
+ r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
+ s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
+ t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
+ u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
+
+ return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
+ }
+
+
+ /*
+ * @brief C custom defined QSUB8 for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB8(
+ uint32_t x,
+ uint32_t y)
+ {
+ q31_t r, s, t, u;
+
+ r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
+ s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
+ t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
+ u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
+
+ return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
+ }
+
+
+ /*
+ * @brief C custom defined QADD16 for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __QADD16(
+ uint32_t x,
+ uint32_t y)
+ {
+/* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */
+ q31_t r = 0, s = 0;
+
+ r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
+ s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
+
+ return ((uint32_t)((s << 16) | (r )));
+ }
+
+
+ /*
+ * @brief C custom defined SHADD16 for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SHADD16(
+ uint32_t x,
+ uint32_t y)
+ {
+ q31_t r, s;
+
+ r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
+ s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
+
+ return ((uint32_t)((s << 16) | (r )));
+ }
+
+
+ /*
+ * @brief C custom defined QSUB16 for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB16(
+ uint32_t x,
+ uint32_t y)
+ {
+ q31_t r, s;
+
+ r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
+ s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
+
+ return ((uint32_t)((s << 16) | (r )));
+ }
+
+
+ /*
+ * @brief C custom defined SHSUB16 for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SHSUB16(
+ uint32_t x,
+ uint32_t y)
+ {
+ q31_t r, s;
+
+ r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
+ s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
+
+ return ((uint32_t)((s << 16) | (r )));
+ }
+
+
+ /*
+ * @brief C custom defined QASX for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __QASX(
+ uint32_t x,
+ uint32_t y)
+ {
+ q31_t r, s;
+
+ r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
+ s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
+
+ return ((uint32_t)((s << 16) | (r )));
+ }
+
+
+ /*
+ * @brief C custom defined SHASX for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SHASX(
+ uint32_t x,
+ uint32_t y)
+ {
+ q31_t r, s;
+
+ r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
+ s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
+
+ return ((uint32_t)((s << 16) | (r )));
+ }
+
+
+ /*
+ * @brief C custom defined QSAX for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __QSAX(
+ uint32_t x,
+ uint32_t y)
+ {
+ q31_t r, s;
+
+ r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
+ s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
+
+ return ((uint32_t)((s << 16) | (r )));
+ }
+
+
+ /*
+ * @brief C custom defined SHSAX for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SHSAX(
+ uint32_t x,
+ uint32_t y)
+ {
+ q31_t r, s;
+
+ r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
+ s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
+
+ return ((uint32_t)((s << 16) | (r )));
+ }
+
+
+ /*
+ * @brief C custom defined SMUSDX for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSDX(
+ uint32_t x,
+ uint32_t y)
+ {
+ return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
+ ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
+ }
+
+ /*
+ * @brief C custom defined SMUADX for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SMUADX(
+ uint32_t x,
+ uint32_t y)
+ {
+ return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
+ ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
+ }
+
+
+ /*
+ * @brief C custom defined QADD for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE int32_t __QADD(
+ int32_t x,
+ int32_t y)
+ {
+ return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y)));
+ }
+
+
+ /*
+ * @brief C custom defined QSUB for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE int32_t __QSUB(
+ int32_t x,
+ int32_t y)
+ {
+ return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y)));
+ }
+
+
+ /*
+ * @brief C custom defined SMLAD for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SMLAD(
+ uint32_t x,
+ uint32_t y,
+ uint32_t sum)
+ {
+ return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
+ ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
+ ( ((q31_t)sum ) ) ));
+ }
+
+
+ /*
+ * @brief C custom defined SMLADX for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SMLADX(
+ uint32_t x,
+ uint32_t y,
+ uint32_t sum)
+ {
+ return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
+ ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
+ ( ((q31_t)sum ) ) ));
+ }
+
+
+ /*
+ * @brief C custom defined SMLSDX for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SMLSDX(
+ uint32_t x,
+ uint32_t y,
+ uint32_t sum)
+ {
+ return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
+ ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
+ ( ((q31_t)sum ) ) ));
+ }
+
+
+ /*
+ * @brief C custom defined SMLALD for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALD(
+ uint32_t x,
+ uint32_t y,
+ uint64_t sum)
+ {
+/* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */
+ return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
+ ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
+ ( ((q63_t)sum ) ) ));
+ }
+
+
+ /*
+ * @brief C custom defined SMLALDX for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALDX(
+ uint32_t x,
+ uint32_t y,
+ uint64_t sum)
+ {
+/* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */
+ return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
+ ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
+ ( ((q63_t)sum ) ) ));
+ }
+
+
+ /*
+ * @brief C custom defined SMUAD for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SMUAD(
+ uint32_t x,
+ uint32_t y)
+ {
+ return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
+ ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
+ }
+
+
+ /*
+ * @brief C custom defined SMUSD for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSD(
+ uint32_t x,
+ uint32_t y)
+ {
+ return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) -
+ ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
+ }
+
+
+ /*
+ * @brief C custom defined SXTB16 for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE uint32_t __SXTB16(
+ uint32_t x)
+ {
+ return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) |
+ ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) ));
+ }
+
+ /*
+ * @brief C custom defined SMMLA for M3 and M0 processors
+ */
+ CMSIS_INLINE __STATIC_INLINE int32_t __SMMLA(
+ int32_t x,
+ int32_t y,
+ int32_t sum)
+ {
+ return (sum + (int32_t) (((int64_t) x * y) >> 32));
+ }
+
+#endif /* !defined (ARM_MATH_DSP) */
+
+
+ /**
+ * @brief Instance structure for the Q7 FIR filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of filter coefficients in the filter. */
+ q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
+ } arm_fir_instance_q7;
+
+ /**
+ * @brief Instance structure for the Q15 FIR filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of filter coefficients in the filter. */
+ q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
+ } arm_fir_instance_q15;
+
+ /**
+ * @brief Instance structure for the Q31 FIR filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of filter coefficients in the filter. */
+ q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
+ } arm_fir_instance_q31;
+
+ /**
+ * @brief Instance structure for the floating-point FIR filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of filter coefficients in the filter. */
+ float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
+ } arm_fir_instance_f32;
+
+
+ /**
+ * @brief Processing function for the Q7 FIR filter.
+ * @param[in] S points to an instance of the Q7 FIR filter structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_fir_q7(
+ const arm_fir_instance_q7 * S,
+ q7_t * pSrc,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q7 FIR filter.
+ * @param[in,out] S points to an instance of the Q7 FIR structure.
+ * @param[in] numTaps Number of filter coefficients in the filter.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] blockSize number of samples that are processed.
+ */
+ void arm_fir_init_q7(
+ arm_fir_instance_q7 * S,
+ uint16_t numTaps,
+ q7_t * pCoeffs,
+ q7_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q15 FIR filter.
+ * @param[in] S points to an instance of the Q15 FIR structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_fir_q15(
+ const arm_fir_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
+ * @param[in] S points to an instance of the Q15 FIR filter structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_fir_fast_q15(
+ const arm_fir_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q15 FIR filter.
+ * @param[in,out] S points to an instance of the Q15 FIR filter structure.
+ * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] blockSize number of samples that are processed at a time.
+ * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
+ * numTaps
is not a supported value.
+ */
+ arm_status arm_fir_init_q15(
+ arm_fir_instance_q15 * S,
+ uint16_t numTaps,
+ q15_t * pCoeffs,
+ q15_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q31 FIR filter.
+ * @param[in] S points to an instance of the Q31 FIR filter structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_fir_q31(
+ const arm_fir_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
+ * @param[in] S points to an instance of the Q31 FIR structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_fir_fast_q31(
+ const arm_fir_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q31 FIR filter.
+ * @param[in,out] S points to an instance of the Q31 FIR structure.
+ * @param[in] numTaps Number of filter coefficients in the filter.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] blockSize number of samples that are processed at a time.
+ */
+ void arm_fir_init_q31(
+ arm_fir_instance_q31 * S,
+ uint16_t numTaps,
+ q31_t * pCoeffs,
+ q31_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the floating-point FIR filter.
+ * @param[in] S points to an instance of the floating-point FIR structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_fir_f32(
+ const arm_fir_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the floating-point FIR filter.
+ * @param[in,out] S points to an instance of the floating-point FIR filter structure.
+ * @param[in] numTaps Number of filter coefficients in the filter.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] blockSize number of samples that are processed at a time.
+ */
+ void arm_fir_init_f32(
+ arm_fir_instance_f32 * S,
+ uint16_t numTaps,
+ float32_t * pCoeffs,
+ float32_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Instance structure for the Q15 Biquad cascade filter.
+ */
+ typedef struct
+ {
+ int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
+ q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
+ q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
+ int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
+ } arm_biquad_casd_df1_inst_q15;
+
+ /**
+ * @brief Instance structure for the Q31 Biquad cascade filter.
+ */
+ typedef struct
+ {
+ uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
+ q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
+ q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
+ uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
+ } arm_biquad_casd_df1_inst_q31;
+
+ /**
+ * @brief Instance structure for the floating-point Biquad cascade filter.
+ */
+ typedef struct
+ {
+ uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
+ float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
+ float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
+ } arm_biquad_casd_df1_inst_f32;
+
+
+ /**
+ * @brief Processing function for the Q15 Biquad cascade filter.
+ * @param[in] S points to an instance of the Q15 Biquad cascade structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_biquad_cascade_df1_q15(
+ const arm_biquad_casd_df1_inst_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q15 Biquad cascade filter.
+ * @param[in,out] S points to an instance of the Q15 Biquad cascade structure.
+ * @param[in] numStages number of 2nd order stages in the filter.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
+ */
+ void arm_biquad_cascade_df1_init_q15(
+ arm_biquad_casd_df1_inst_q15 * S,
+ uint8_t numStages,
+ q15_t * pCoeffs,
+ q15_t * pState,
+ int8_t postShift);
+
+
+ /**
+ * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
+ * @param[in] S points to an instance of the Q15 Biquad cascade structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_biquad_cascade_df1_fast_q15(
+ const arm_biquad_casd_df1_inst_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q31 Biquad cascade filter
+ * @param[in] S points to an instance of the Q31 Biquad cascade structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_biquad_cascade_df1_q31(
+ const arm_biquad_casd_df1_inst_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
+ * @param[in] S points to an instance of the Q31 Biquad cascade structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_biquad_cascade_df1_fast_q31(
+ const arm_biquad_casd_df1_inst_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q31 Biquad cascade filter.
+ * @param[in,out] S points to an instance of the Q31 Biquad cascade structure.
+ * @param[in] numStages number of 2nd order stages in the filter.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
+ */
+ void arm_biquad_cascade_df1_init_q31(
+ arm_biquad_casd_df1_inst_q31 * S,
+ uint8_t numStages,
+ q31_t * pCoeffs,
+ q31_t * pState,
+ int8_t postShift);
+
+
+ /**
+ * @brief Processing function for the floating-point Biquad cascade filter.
+ * @param[in] S points to an instance of the floating-point Biquad cascade structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_biquad_cascade_df1_f32(
+ const arm_biquad_casd_df1_inst_f32 * S,
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the floating-point Biquad cascade filter.
+ * @param[in,out] S points to an instance of the floating-point Biquad cascade structure.
+ * @param[in] numStages number of 2nd order stages in the filter.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ */
+ void arm_biquad_cascade_df1_init_f32(
+ arm_biquad_casd_df1_inst_f32 * S,
+ uint8_t numStages,
+ float32_t * pCoeffs,
+ float32_t * pState);
+
+
+ /**
+ * @brief Instance structure for the floating-point matrix structure.
+ */
+ typedef struct
+ {
+ uint16_t numRows; /**< number of rows of the matrix. */
+ uint16_t numCols; /**< number of columns of the matrix. */
+ float32_t *pData; /**< points to the data of the matrix. */
+ } arm_matrix_instance_f32;
+
+
+ /**
+ * @brief Instance structure for the floating-point matrix structure.
+ */
+ typedef struct
+ {
+ uint16_t numRows; /**< number of rows of the matrix. */
+ uint16_t numCols; /**< number of columns of the matrix. */
+ float64_t *pData; /**< points to the data of the matrix. */
+ } arm_matrix_instance_f64;
+
+ /**
+ * @brief Instance structure for the Q15 matrix structure.
+ */
+ typedef struct
+ {
+ uint16_t numRows; /**< number of rows of the matrix. */
+ uint16_t numCols; /**< number of columns of the matrix. */
+ q15_t *pData; /**< points to the data of the matrix. */
+ } arm_matrix_instance_q15;
+
+ /**
+ * @brief Instance structure for the Q31 matrix structure.
+ */
+ typedef struct
+ {
+ uint16_t numRows; /**< number of rows of the matrix. */
+ uint16_t numCols; /**< number of columns of the matrix. */
+ q31_t *pData; /**< points to the data of the matrix. */
+ } arm_matrix_instance_q31;
+
+
+ /**
+ * @brief Floating-point matrix addition.
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_add_f32(
+ const arm_matrix_instance_f32 * pSrcA,
+ const arm_matrix_instance_f32 * pSrcB,
+ arm_matrix_instance_f32 * pDst);
+
+
+ /**
+ * @brief Q15 matrix addition.
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_add_q15(
+ const arm_matrix_instance_q15 * pSrcA,
+ const arm_matrix_instance_q15 * pSrcB,
+ arm_matrix_instance_q15 * pDst);
+
+
+ /**
+ * @brief Q31 matrix addition.
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_add_q31(
+ const arm_matrix_instance_q31 * pSrcA,
+ const arm_matrix_instance_q31 * pSrcB,
+ arm_matrix_instance_q31 * pDst);
+
+
+ /**
+ * @brief Floating-point, complex, matrix multiplication.
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_cmplx_mult_f32(
+ const arm_matrix_instance_f32 * pSrcA,
+ const arm_matrix_instance_f32 * pSrcB,
+ arm_matrix_instance_f32 * pDst);
+
+
+ /**
+ * @brief Q15, complex, matrix multiplication.
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_cmplx_mult_q15(
+ const arm_matrix_instance_q15 * pSrcA,
+ const arm_matrix_instance_q15 * pSrcB,
+ arm_matrix_instance_q15 * pDst,
+ q15_t * pScratch);
+
+
+ /**
+ * @brief Q31, complex, matrix multiplication.
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_cmplx_mult_q31(
+ const arm_matrix_instance_q31 * pSrcA,
+ const arm_matrix_instance_q31 * pSrcB,
+ arm_matrix_instance_q31 * pDst);
+
+
+ /**
+ * @brief Floating-point matrix transpose.
+ * @param[in] pSrc points to the input matrix
+ * @param[out] pDst points to the output matrix
+ * @return The function returns either ARM_MATH_SIZE_MISMATCH
+ * or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_trans_f32(
+ const arm_matrix_instance_f32 * pSrc,
+ arm_matrix_instance_f32 * pDst);
+
+
+ /**
+ * @brief Q15 matrix transpose.
+ * @param[in] pSrc points to the input matrix
+ * @param[out] pDst points to the output matrix
+ * @return The function returns either ARM_MATH_SIZE_MISMATCH
+ * or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_trans_q15(
+ const arm_matrix_instance_q15 * pSrc,
+ arm_matrix_instance_q15 * pDst);
+
+
+ /**
+ * @brief Q31 matrix transpose.
+ * @param[in] pSrc points to the input matrix
+ * @param[out] pDst points to the output matrix
+ * @return The function returns either ARM_MATH_SIZE_MISMATCH
+ * or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_trans_q31(
+ const arm_matrix_instance_q31 * pSrc,
+ arm_matrix_instance_q31 * pDst);
+
+
+ /**
+ * @brief Floating-point matrix multiplication
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_mult_f32(
+ const arm_matrix_instance_f32 * pSrcA,
+ const arm_matrix_instance_f32 * pSrcB,
+ arm_matrix_instance_f32 * pDst);
+
+
+ /**
+ * @brief Q15 matrix multiplication
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @param[in] pState points to the array for storing intermediate results
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_mult_q15(
+ const arm_matrix_instance_q15 * pSrcA,
+ const arm_matrix_instance_q15 * pSrcB,
+ arm_matrix_instance_q15 * pDst,
+ q15_t * pState);
+
+
+ /**
+ * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @param[in] pState points to the array for storing intermediate results
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_mult_fast_q15(
+ const arm_matrix_instance_q15 * pSrcA,
+ const arm_matrix_instance_q15 * pSrcB,
+ arm_matrix_instance_q15 * pDst,
+ q15_t * pState);
+
+
+ /**
+ * @brief Q31 matrix multiplication
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_mult_q31(
+ const arm_matrix_instance_q31 * pSrcA,
+ const arm_matrix_instance_q31 * pSrcB,
+ arm_matrix_instance_q31 * pDst);
+
+
+ /**
+ * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_mult_fast_q31(
+ const arm_matrix_instance_q31 * pSrcA,
+ const arm_matrix_instance_q31 * pSrcB,
+ arm_matrix_instance_q31 * pDst);
+
+
+ /**
+ * @brief Floating-point matrix subtraction
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_sub_f32(
+ const arm_matrix_instance_f32 * pSrcA,
+ const arm_matrix_instance_f32 * pSrcB,
+ arm_matrix_instance_f32 * pDst);
+
+
+ /**
+ * @brief Q15 matrix subtraction
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_sub_q15(
+ const arm_matrix_instance_q15 * pSrcA,
+ const arm_matrix_instance_q15 * pSrcB,
+ arm_matrix_instance_q15 * pDst);
+
+
+ /**
+ * @brief Q31 matrix subtraction
+ * @param[in] pSrcA points to the first input matrix structure
+ * @param[in] pSrcB points to the second input matrix structure
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_sub_q31(
+ const arm_matrix_instance_q31 * pSrcA,
+ const arm_matrix_instance_q31 * pSrcB,
+ arm_matrix_instance_q31 * pDst);
+
+
+ /**
+ * @brief Floating-point matrix scaling.
+ * @param[in] pSrc points to the input matrix
+ * @param[in] scale scale factor
+ * @param[out] pDst points to the output matrix
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_scale_f32(
+ const arm_matrix_instance_f32 * pSrc,
+ float32_t scale,
+ arm_matrix_instance_f32 * pDst);
+
+
+ /**
+ * @brief Q15 matrix scaling.
+ * @param[in] pSrc points to input matrix
+ * @param[in] scaleFract fractional portion of the scale factor
+ * @param[in] shift number of bits to shift the result by
+ * @param[out] pDst points to output matrix
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_scale_q15(
+ const arm_matrix_instance_q15 * pSrc,
+ q15_t scaleFract,
+ int32_t shift,
+ arm_matrix_instance_q15 * pDst);
+
+
+ /**
+ * @brief Q31 matrix scaling.
+ * @param[in] pSrc points to input matrix
+ * @param[in] scaleFract fractional portion of the scale factor
+ * @param[in] shift number of bits to shift the result by
+ * @param[out] pDst points to output matrix structure
+ * @return The function returns either
+ * ARM_MATH_SIZE_MISMATCH
or ARM_MATH_SUCCESS
based on the outcome of size checking.
+ */
+ arm_status arm_mat_scale_q31(
+ const arm_matrix_instance_q31 * pSrc,
+ q31_t scaleFract,
+ int32_t shift,
+ arm_matrix_instance_q31 * pDst);
+
+
+ /**
+ * @brief Q31 matrix initialization.
+ * @param[in,out] S points to an instance of the floating-point matrix structure.
+ * @param[in] nRows number of rows in the matrix.
+ * @param[in] nColumns number of columns in the matrix.
+ * @param[in] pData points to the matrix data array.
+ */
+ void arm_mat_init_q31(
+ arm_matrix_instance_q31 * S,
+ uint16_t nRows,
+ uint16_t nColumns,
+ q31_t * pData);
+
+
+ /**
+ * @brief Q15 matrix initialization.
+ * @param[in,out] S points to an instance of the floating-point matrix structure.
+ * @param[in] nRows number of rows in the matrix.
+ * @param[in] nColumns number of columns in the matrix.
+ * @param[in] pData points to the matrix data array.
+ */
+ void arm_mat_init_q15(
+ arm_matrix_instance_q15 * S,
+ uint16_t nRows,
+ uint16_t nColumns,
+ q15_t * pData);
+
+
+ /**
+ * @brief Floating-point matrix initialization.
+ * @param[in,out] S points to an instance of the floating-point matrix structure.
+ * @param[in] nRows number of rows in the matrix.
+ * @param[in] nColumns number of columns in the matrix.
+ * @param[in] pData points to the matrix data array.
+ */
+ void arm_mat_init_f32(
+ arm_matrix_instance_f32 * S,
+ uint16_t nRows,
+ uint16_t nColumns,
+ float32_t * pData);
+
+
+
+ /**
+ * @brief Instance structure for the Q15 PID Control.
+ */
+ typedef struct
+ {
+ q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
+#if !defined (ARM_MATH_DSP)
+ q15_t A1;
+ q15_t A2;
+#else
+ q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
+#endif
+ q15_t state[3]; /**< The state array of length 3. */
+ q15_t Kp; /**< The proportional gain. */
+ q15_t Ki; /**< The integral gain. */
+ q15_t Kd; /**< The derivative gain. */
+ } arm_pid_instance_q15;
+
+ /**
+ * @brief Instance structure for the Q31 PID Control.
+ */
+ typedef struct
+ {
+ q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
+ q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
+ q31_t A2; /**< The derived gain, A2 = Kd . */
+ q31_t state[3]; /**< The state array of length 3. */
+ q31_t Kp; /**< The proportional gain. */
+ q31_t Ki; /**< The integral gain. */
+ q31_t Kd; /**< The derivative gain. */
+ } arm_pid_instance_q31;
+
+ /**
+ * @brief Instance structure for the floating-point PID Control.
+ */
+ typedef struct
+ {
+ float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
+ float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
+ float32_t A2; /**< The derived gain, A2 = Kd . */
+ float32_t state[3]; /**< The state array of length 3. */
+ float32_t Kp; /**< The proportional gain. */
+ float32_t Ki; /**< The integral gain. */
+ float32_t Kd; /**< The derivative gain. */
+ } arm_pid_instance_f32;
+
+
+
+ /**
+ * @brief Initialization function for the floating-point PID Control.
+ * @param[in,out] S points to an instance of the PID structure.
+ * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
+ */
+ void arm_pid_init_f32(
+ arm_pid_instance_f32 * S,
+ int32_t resetStateFlag);
+
+
+ /**
+ * @brief Reset function for the floating-point PID Control.
+ * @param[in,out] S is an instance of the floating-point PID Control structure
+ */
+ void arm_pid_reset_f32(
+ arm_pid_instance_f32 * S);
+
+
+ /**
+ * @brief Initialization function for the Q31 PID Control.
+ * @param[in,out] S points to an instance of the Q15 PID structure.
+ * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
+ */
+ void arm_pid_init_q31(
+ arm_pid_instance_q31 * S,
+ int32_t resetStateFlag);
+
+
+ /**
+ * @brief Reset function for the Q31 PID Control.
+ * @param[in,out] S points to an instance of the Q31 PID Control structure
+ */
+
+ void arm_pid_reset_q31(
+ arm_pid_instance_q31 * S);
+
+
+ /**
+ * @brief Initialization function for the Q15 PID Control.
+ * @param[in,out] S points to an instance of the Q15 PID structure.
+ * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
+ */
+ void arm_pid_init_q15(
+ arm_pid_instance_q15 * S,
+ int32_t resetStateFlag);
+
+
+ /**
+ * @brief Reset function for the Q15 PID Control.
+ * @param[in,out] S points to an instance of the q15 PID Control structure
+ */
+ void arm_pid_reset_q15(
+ arm_pid_instance_q15 * S);
+
+
+ /**
+ * @brief Instance structure for the floating-point Linear Interpolate function.
+ */
+ typedef struct
+ {
+ uint32_t nValues; /**< nValues */
+ float32_t x1; /**< x1 */
+ float32_t xSpacing; /**< xSpacing */
+ float32_t *pYData; /**< pointer to the table of Y values */
+ } arm_linear_interp_instance_f32;
+
+ /**
+ * @brief Instance structure for the floating-point bilinear interpolation function.
+ */
+ typedef struct
+ {
+ uint16_t numRows; /**< number of rows in the data table. */
+ uint16_t numCols; /**< number of columns in the data table. */
+ float32_t *pData; /**< points to the data table. */
+ } arm_bilinear_interp_instance_f32;
+
+ /**
+ * @brief Instance structure for the Q31 bilinear interpolation function.
+ */
+ typedef struct
+ {
+ uint16_t numRows; /**< number of rows in the data table. */
+ uint16_t numCols; /**< number of columns in the data table. */
+ q31_t *pData; /**< points to the data table. */
+ } arm_bilinear_interp_instance_q31;
+
+ /**
+ * @brief Instance structure for the Q15 bilinear interpolation function.
+ */
+ typedef struct
+ {
+ uint16_t numRows; /**< number of rows in the data table. */
+ uint16_t numCols; /**< number of columns in the data table. */
+ q15_t *pData; /**< points to the data table. */
+ } arm_bilinear_interp_instance_q15;
+
+ /**
+ * @brief Instance structure for the Q15 bilinear interpolation function.
+ */
+ typedef struct
+ {
+ uint16_t numRows; /**< number of rows in the data table. */
+ uint16_t numCols; /**< number of columns in the data table. */
+ q7_t *pData; /**< points to the data table. */
+ } arm_bilinear_interp_instance_q7;
+
+
+ /**
+ * @brief Q7 vector multiplication.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_mult_q7(
+ q7_t * pSrcA,
+ q7_t * pSrcB,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q15 vector multiplication.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_mult_q15(
+ q15_t * pSrcA,
+ q15_t * pSrcB,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q31 vector multiplication.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_mult_q31(
+ q31_t * pSrcA,
+ q31_t * pSrcB,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Floating-point vector multiplication.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_mult_f32(
+ float32_t * pSrcA,
+ float32_t * pSrcB,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Instance structure for the Q15 CFFT/CIFFT function.
+ */
+ typedef struct
+ {
+ uint16_t fftLen; /**< length of the FFT. */
+ uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+ uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+ q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
+ uint16_t *pBitRevTable; /**< points to the bit reversal table. */
+ uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+ uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+ } arm_cfft_radix2_instance_q15;
+
+/* Deprecated */
+ arm_status arm_cfft_radix2_init_q15(
+ arm_cfft_radix2_instance_q15 * S,
+ uint16_t fftLen,
+ uint8_t ifftFlag,
+ uint8_t bitReverseFlag);
+
+/* Deprecated */
+ void arm_cfft_radix2_q15(
+ const arm_cfft_radix2_instance_q15 * S,
+ q15_t * pSrc);
+
+
+ /**
+ * @brief Instance structure for the Q15 CFFT/CIFFT function.
+ */
+ typedef struct
+ {
+ uint16_t fftLen; /**< length of the FFT. */
+ uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+ uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+ q15_t *pTwiddle; /**< points to the twiddle factor table. */
+ uint16_t *pBitRevTable; /**< points to the bit reversal table. */
+ uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+ uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+ } arm_cfft_radix4_instance_q15;
+
+/* Deprecated */
+ arm_status arm_cfft_radix4_init_q15(
+ arm_cfft_radix4_instance_q15 * S,
+ uint16_t fftLen,
+ uint8_t ifftFlag,
+ uint8_t bitReverseFlag);
+
+/* Deprecated */
+ void arm_cfft_radix4_q15(
+ const arm_cfft_radix4_instance_q15 * S,
+ q15_t * pSrc);
+
+ /**
+ * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
+ */
+ typedef struct
+ {
+ uint16_t fftLen; /**< length of the FFT. */
+ uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+ uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+ q31_t *pTwiddle; /**< points to the Twiddle factor table. */
+ uint16_t *pBitRevTable; /**< points to the bit reversal table. */
+ uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+ uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+ } arm_cfft_radix2_instance_q31;
+
+/* Deprecated */
+ arm_status arm_cfft_radix2_init_q31(
+ arm_cfft_radix2_instance_q31 * S,
+ uint16_t fftLen,
+ uint8_t ifftFlag,
+ uint8_t bitReverseFlag);
+
+/* Deprecated */
+ void arm_cfft_radix2_q31(
+ const arm_cfft_radix2_instance_q31 * S,
+ q31_t * pSrc);
+
+ /**
+ * @brief Instance structure for the Q31 CFFT/CIFFT function.
+ */
+ typedef struct
+ {
+ uint16_t fftLen; /**< length of the FFT. */
+ uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+ uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+ q31_t *pTwiddle; /**< points to the twiddle factor table. */
+ uint16_t *pBitRevTable; /**< points to the bit reversal table. */
+ uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+ uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+ } arm_cfft_radix4_instance_q31;
+
+/* Deprecated */
+ void arm_cfft_radix4_q31(
+ const arm_cfft_radix4_instance_q31 * S,
+ q31_t * pSrc);
+
+/* Deprecated */
+ arm_status arm_cfft_radix4_init_q31(
+ arm_cfft_radix4_instance_q31 * S,
+ uint16_t fftLen,
+ uint8_t ifftFlag,
+ uint8_t bitReverseFlag);
+
+ /**
+ * @brief Instance structure for the floating-point CFFT/CIFFT function.
+ */
+ typedef struct
+ {
+ uint16_t fftLen; /**< length of the FFT. */
+ uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+ uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+ float32_t *pTwiddle; /**< points to the Twiddle factor table. */
+ uint16_t *pBitRevTable; /**< points to the bit reversal table. */
+ uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+ uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+ float32_t onebyfftLen; /**< value of 1/fftLen. */
+ } arm_cfft_radix2_instance_f32;
+
+/* Deprecated */
+ arm_status arm_cfft_radix2_init_f32(
+ arm_cfft_radix2_instance_f32 * S,
+ uint16_t fftLen,
+ uint8_t ifftFlag,
+ uint8_t bitReverseFlag);
+
+/* Deprecated */
+ void arm_cfft_radix2_f32(
+ const arm_cfft_radix2_instance_f32 * S,
+ float32_t * pSrc);
+
+ /**
+ * @brief Instance structure for the floating-point CFFT/CIFFT function.
+ */
+ typedef struct
+ {
+ uint16_t fftLen; /**< length of the FFT. */
+ uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
+ uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
+ float32_t *pTwiddle; /**< points to the Twiddle factor table. */
+ uint16_t *pBitRevTable; /**< points to the bit reversal table. */
+ uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+ uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
+ float32_t onebyfftLen; /**< value of 1/fftLen. */
+ } arm_cfft_radix4_instance_f32;
+
+/* Deprecated */
+ arm_status arm_cfft_radix4_init_f32(
+ arm_cfft_radix4_instance_f32 * S,
+ uint16_t fftLen,
+ uint8_t ifftFlag,
+ uint8_t bitReverseFlag);
+
+/* Deprecated */
+ void arm_cfft_radix4_f32(
+ const arm_cfft_radix4_instance_f32 * S,
+ float32_t * pSrc);
+
+ /**
+ * @brief Instance structure for the fixed-point CFFT/CIFFT function.
+ */
+ typedef struct
+ {
+ uint16_t fftLen; /**< length of the FFT. */
+ const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
+ const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
+ uint16_t bitRevLength; /**< bit reversal table length. */
+ } arm_cfft_instance_q15;
+
+void arm_cfft_q15(
+ const arm_cfft_instance_q15 * S,
+ q15_t * p1,
+ uint8_t ifftFlag,
+ uint8_t bitReverseFlag);
+
+ /**
+ * @brief Instance structure for the fixed-point CFFT/CIFFT function.
+ */
+ typedef struct
+ {
+ uint16_t fftLen; /**< length of the FFT. */
+ const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
+ const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
+ uint16_t bitRevLength; /**< bit reversal table length. */
+ } arm_cfft_instance_q31;
+
+void arm_cfft_q31(
+ const arm_cfft_instance_q31 * S,
+ q31_t * p1,
+ uint8_t ifftFlag,
+ uint8_t bitReverseFlag);
+
+ /**
+ * @brief Instance structure for the floating-point CFFT/CIFFT function.
+ */
+ typedef struct
+ {
+ uint16_t fftLen; /**< length of the FFT. */
+ const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
+ const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
+ uint16_t bitRevLength; /**< bit reversal table length. */
+ } arm_cfft_instance_f32;
+
+ void arm_cfft_f32(
+ const arm_cfft_instance_f32 * S,
+ float32_t * p1,
+ uint8_t ifftFlag,
+ uint8_t bitReverseFlag);
+
+ /**
+ * @brief Instance structure for the Q15 RFFT/RIFFT function.
+ */
+ typedef struct
+ {
+ uint32_t fftLenReal; /**< length of the real FFT. */
+ uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
+ uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
+ uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+ q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
+ q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
+ const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
+ } arm_rfft_instance_q15;
+
+ arm_status arm_rfft_init_q15(
+ arm_rfft_instance_q15 * S,
+ uint32_t fftLenReal,
+ uint32_t ifftFlagR,
+ uint32_t bitReverseFlag);
+
+ void arm_rfft_q15(
+ const arm_rfft_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst);
+
+ /**
+ * @brief Instance structure for the Q31 RFFT/RIFFT function.
+ */
+ typedef struct
+ {
+ uint32_t fftLenReal; /**< length of the real FFT. */
+ uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
+ uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
+ uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+ q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
+ q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
+ const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
+ } arm_rfft_instance_q31;
+
+ arm_status arm_rfft_init_q31(
+ arm_rfft_instance_q31 * S,
+ uint32_t fftLenReal,
+ uint32_t ifftFlagR,
+ uint32_t bitReverseFlag);
+
+ void arm_rfft_q31(
+ const arm_rfft_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst);
+
+ /**
+ * @brief Instance structure for the floating-point RFFT/RIFFT function.
+ */
+ typedef struct
+ {
+ uint32_t fftLenReal; /**< length of the real FFT. */
+ uint16_t fftLenBy2; /**< length of the complex FFT. */
+ uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
+ uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
+ uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
+ float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
+ float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
+ arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
+ } arm_rfft_instance_f32;
+
+ arm_status arm_rfft_init_f32(
+ arm_rfft_instance_f32 * S,
+ arm_cfft_radix4_instance_f32 * S_CFFT,
+ uint32_t fftLenReal,
+ uint32_t ifftFlagR,
+ uint32_t bitReverseFlag);
+
+ void arm_rfft_f32(
+ const arm_rfft_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pDst);
+
+ /**
+ * @brief Instance structure for the floating-point RFFT/RIFFT function.
+ */
+typedef struct
+ {
+ arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
+ uint16_t fftLenRFFT; /**< length of the real sequence */
+ float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
+ } arm_rfft_fast_instance_f32 ;
+
+arm_status arm_rfft_fast_init_f32 (
+ arm_rfft_fast_instance_f32 * S,
+ uint16_t fftLen);
+
+void arm_rfft_fast_f32(
+ arm_rfft_fast_instance_f32 * S,
+ float32_t * p, float32_t * pOut,
+ uint8_t ifftFlag);
+
+ /**
+ * @brief Instance structure for the floating-point DCT4/IDCT4 function.
+ */
+ typedef struct
+ {
+ uint16_t N; /**< length of the DCT4. */
+ uint16_t Nby2; /**< half of the length of the DCT4. */
+ float32_t normalize; /**< normalizing factor. */
+ float32_t *pTwiddle; /**< points to the twiddle factor table. */
+ float32_t *pCosFactor; /**< points to the cosFactor table. */
+ arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
+ arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
+ } arm_dct4_instance_f32;
+
+
+ /**
+ * @brief Initialization function for the floating-point DCT4/IDCT4.
+ * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure.
+ * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
+ * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
+ * @param[in] N length of the DCT4.
+ * @param[in] Nby2 half of the length of the DCT4.
+ * @param[in] normalize normalizing factor.
+ * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if fftLenReal
is not a supported transform length.
+ */
+ arm_status arm_dct4_init_f32(
+ arm_dct4_instance_f32 * S,
+ arm_rfft_instance_f32 * S_RFFT,
+ arm_cfft_radix4_instance_f32 * S_CFFT,
+ uint16_t N,
+ uint16_t Nby2,
+ float32_t normalize);
+
+
+ /**
+ * @brief Processing function for the floating-point DCT4/IDCT4.
+ * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure.
+ * @param[in] pState points to state buffer.
+ * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
+ */
+ void arm_dct4_f32(
+ const arm_dct4_instance_f32 * S,
+ float32_t * pState,
+ float32_t * pInlineBuffer);
+
+
+ /**
+ * @brief Instance structure for the Q31 DCT4/IDCT4 function.
+ */
+ typedef struct
+ {
+ uint16_t N; /**< length of the DCT4. */
+ uint16_t Nby2; /**< half of the length of the DCT4. */
+ q31_t normalize; /**< normalizing factor. */
+ q31_t *pTwiddle; /**< points to the twiddle factor table. */
+ q31_t *pCosFactor; /**< points to the cosFactor table. */
+ arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
+ arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
+ } arm_dct4_instance_q31;
+
+
+ /**
+ * @brief Initialization function for the Q31 DCT4/IDCT4.
+ * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
+ * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
+ * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
+ * @param[in] N length of the DCT4.
+ * @param[in] Nby2 half of the length of the DCT4.
+ * @param[in] normalize normalizing factor.
+ * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if N
is not a supported transform length.
+ */
+ arm_status arm_dct4_init_q31(
+ arm_dct4_instance_q31 * S,
+ arm_rfft_instance_q31 * S_RFFT,
+ arm_cfft_radix4_instance_q31 * S_CFFT,
+ uint16_t N,
+ uint16_t Nby2,
+ q31_t normalize);
+
+
+ /**
+ * @brief Processing function for the Q31 DCT4/IDCT4.
+ * @param[in] S points to an instance of the Q31 DCT4 structure.
+ * @param[in] pState points to state buffer.
+ * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
+ */
+ void arm_dct4_q31(
+ const arm_dct4_instance_q31 * S,
+ q31_t * pState,
+ q31_t * pInlineBuffer);
+
+
+ /**
+ * @brief Instance structure for the Q15 DCT4/IDCT4 function.
+ */
+ typedef struct
+ {
+ uint16_t N; /**< length of the DCT4. */
+ uint16_t Nby2; /**< half of the length of the DCT4. */
+ q15_t normalize; /**< normalizing factor. */
+ q15_t *pTwiddle; /**< points to the twiddle factor table. */
+ q15_t *pCosFactor; /**< points to the cosFactor table. */
+ arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
+ arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
+ } arm_dct4_instance_q15;
+
+
+ /**
+ * @brief Initialization function for the Q15 DCT4/IDCT4.
+ * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure.
+ * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
+ * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
+ * @param[in] N length of the DCT4.
+ * @param[in] Nby2 half of the length of the DCT4.
+ * @param[in] normalize normalizing factor.
+ * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if N
is not a supported transform length.
+ */
+ arm_status arm_dct4_init_q15(
+ arm_dct4_instance_q15 * S,
+ arm_rfft_instance_q15 * S_RFFT,
+ arm_cfft_radix4_instance_q15 * S_CFFT,
+ uint16_t N,
+ uint16_t Nby2,
+ q15_t normalize);
+
+
+ /**
+ * @brief Processing function for the Q15 DCT4/IDCT4.
+ * @param[in] S points to an instance of the Q15 DCT4 structure.
+ * @param[in] pState points to state buffer.
+ * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
+ */
+ void arm_dct4_q15(
+ const arm_dct4_instance_q15 * S,
+ q15_t * pState,
+ q15_t * pInlineBuffer);
+
+
+ /**
+ * @brief Floating-point vector addition.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_add_f32(
+ float32_t * pSrcA,
+ float32_t * pSrcB,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q7 vector addition.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_add_q7(
+ q7_t * pSrcA,
+ q7_t * pSrcB,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q15 vector addition.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_add_q15(
+ q15_t * pSrcA,
+ q15_t * pSrcB,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q31 vector addition.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_add_q31(
+ q31_t * pSrcA,
+ q31_t * pSrcB,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Floating-point vector subtraction.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_sub_f32(
+ float32_t * pSrcA,
+ float32_t * pSrcB,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q7 vector subtraction.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_sub_q7(
+ q7_t * pSrcA,
+ q7_t * pSrcB,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q15 vector subtraction.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_sub_q15(
+ q15_t * pSrcA,
+ q15_t * pSrcB,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q31 vector subtraction.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_sub_q31(
+ q31_t * pSrcA,
+ q31_t * pSrcB,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Multiplies a floating-point vector by a scalar.
+ * @param[in] pSrc points to the input vector
+ * @param[in] scale scale factor to be applied
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_scale_f32(
+ float32_t * pSrc,
+ float32_t scale,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Multiplies a Q7 vector by a scalar.
+ * @param[in] pSrc points to the input vector
+ * @param[in] scaleFract fractional portion of the scale value
+ * @param[in] shift number of bits to shift the result by
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_scale_q7(
+ q7_t * pSrc,
+ q7_t scaleFract,
+ int8_t shift,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Multiplies a Q15 vector by a scalar.
+ * @param[in] pSrc points to the input vector
+ * @param[in] scaleFract fractional portion of the scale value
+ * @param[in] shift number of bits to shift the result by
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_scale_q15(
+ q15_t * pSrc,
+ q15_t scaleFract,
+ int8_t shift,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Multiplies a Q31 vector by a scalar.
+ * @param[in] pSrc points to the input vector
+ * @param[in] scaleFract fractional portion of the scale value
+ * @param[in] shift number of bits to shift the result by
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_scale_q31(
+ q31_t * pSrc,
+ q31_t scaleFract,
+ int8_t shift,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q7 vector absolute value.
+ * @param[in] pSrc points to the input buffer
+ * @param[out] pDst points to the output buffer
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_abs_q7(
+ q7_t * pSrc,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Floating-point vector absolute value.
+ * @param[in] pSrc points to the input buffer
+ * @param[out] pDst points to the output buffer
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_abs_f32(
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q15 vector absolute value.
+ * @param[in] pSrc points to the input buffer
+ * @param[out] pDst points to the output buffer
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_abs_q15(
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Q31 vector absolute value.
+ * @param[in] pSrc points to the input buffer
+ * @param[out] pDst points to the output buffer
+ * @param[in] blockSize number of samples in each vector
+ */
+ void arm_abs_q31(
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Dot product of floating-point vectors.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[in] blockSize number of samples in each vector
+ * @param[out] result output result returned here
+ */
+ void arm_dot_prod_f32(
+ float32_t * pSrcA,
+ float32_t * pSrcB,
+ uint32_t blockSize,
+ float32_t * result);
+
+
+ /**
+ * @brief Dot product of Q7 vectors.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[in] blockSize number of samples in each vector
+ * @param[out] result output result returned here
+ */
+ void arm_dot_prod_q7(
+ q7_t * pSrcA,
+ q7_t * pSrcB,
+ uint32_t blockSize,
+ q31_t * result);
+
+
+ /**
+ * @brief Dot product of Q15 vectors.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[in] blockSize number of samples in each vector
+ * @param[out] result output result returned here
+ */
+ void arm_dot_prod_q15(
+ q15_t * pSrcA,
+ q15_t * pSrcB,
+ uint32_t blockSize,
+ q63_t * result);
+
+
+ /**
+ * @brief Dot product of Q31 vectors.
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[in] blockSize number of samples in each vector
+ * @param[out] result output result returned here
+ */
+ void arm_dot_prod_q31(
+ q31_t * pSrcA,
+ q31_t * pSrcB,
+ uint32_t blockSize,
+ q63_t * result);
+
+
+ /**
+ * @brief Shifts the elements of a Q7 vector a specified number of bits.
+ * @param[in] pSrc points to the input vector
+ * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_shift_q7(
+ q7_t * pSrc,
+ int8_t shiftBits,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Shifts the elements of a Q15 vector a specified number of bits.
+ * @param[in] pSrc points to the input vector
+ * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_shift_q15(
+ q15_t * pSrc,
+ int8_t shiftBits,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Shifts the elements of a Q31 vector a specified number of bits.
+ * @param[in] pSrc points to the input vector
+ * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_shift_q31(
+ q31_t * pSrc,
+ int8_t shiftBits,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Adds a constant offset to a floating-point vector.
+ * @param[in] pSrc points to the input vector
+ * @param[in] offset is the offset to be added
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_offset_f32(
+ float32_t * pSrc,
+ float32_t offset,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Adds a constant offset to a Q7 vector.
+ * @param[in] pSrc points to the input vector
+ * @param[in] offset is the offset to be added
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_offset_q7(
+ q7_t * pSrc,
+ q7_t offset,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Adds a constant offset to a Q15 vector.
+ * @param[in] pSrc points to the input vector
+ * @param[in] offset is the offset to be added
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_offset_q15(
+ q15_t * pSrc,
+ q15_t offset,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Adds a constant offset to a Q31 vector.
+ * @param[in] pSrc points to the input vector
+ * @param[in] offset is the offset to be added
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_offset_q31(
+ q31_t * pSrc,
+ q31_t offset,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Negates the elements of a floating-point vector.
+ * @param[in] pSrc points to the input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_negate_f32(
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Negates the elements of a Q7 vector.
+ * @param[in] pSrc points to the input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_negate_q7(
+ q7_t * pSrc,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Negates the elements of a Q15 vector.
+ * @param[in] pSrc points to the input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_negate_q15(
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Negates the elements of a Q31 vector.
+ * @param[in] pSrc points to the input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] blockSize number of samples in the vector
+ */
+ void arm_negate_q31(
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Copies the elements of a floating-point vector.
+ * @param[in] pSrc input pointer
+ * @param[out] pDst output pointer
+ * @param[in] blockSize number of samples to process
+ */
+ void arm_copy_f32(
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Copies the elements of a Q7 vector.
+ * @param[in] pSrc input pointer
+ * @param[out] pDst output pointer
+ * @param[in] blockSize number of samples to process
+ */
+ void arm_copy_q7(
+ q7_t * pSrc,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Copies the elements of a Q15 vector.
+ * @param[in] pSrc input pointer
+ * @param[out] pDst output pointer
+ * @param[in] blockSize number of samples to process
+ */
+ void arm_copy_q15(
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Copies the elements of a Q31 vector.
+ * @param[in] pSrc input pointer
+ * @param[out] pDst output pointer
+ * @param[in] blockSize number of samples to process
+ */
+ void arm_copy_q31(
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Fills a constant value into a floating-point vector.
+ * @param[in] value input value to be filled
+ * @param[out] pDst output pointer
+ * @param[in] blockSize number of samples to process
+ */
+ void arm_fill_f32(
+ float32_t value,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Fills a constant value into a Q7 vector.
+ * @param[in] value input value to be filled
+ * @param[out] pDst output pointer
+ * @param[in] blockSize number of samples to process
+ */
+ void arm_fill_q7(
+ q7_t value,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Fills a constant value into a Q15 vector.
+ * @param[in] value input value to be filled
+ * @param[out] pDst output pointer
+ * @param[in] blockSize number of samples to process
+ */
+ void arm_fill_q15(
+ q15_t value,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Fills a constant value into a Q31 vector.
+ * @param[in] value input value to be filled
+ * @param[out] pDst output pointer
+ * @param[in] blockSize number of samples to process
+ */
+ void arm_fill_q31(
+ q31_t value,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+/**
+ * @brief Convolution of floating-point sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
+ */
+ void arm_conv_f32(
+ float32_t * pSrcA,
+ uint32_t srcALen,
+ float32_t * pSrcB,
+ uint32_t srcBLen,
+ float32_t * pDst);
+
+
+ /**
+ * @brief Convolution of Q15 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
+ * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+ * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
+ */
+ void arm_conv_opt_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst,
+ q15_t * pScratch1,
+ q15_t * pScratch2);
+
+
+/**
+ * @brief Convolution of Q15 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
+ */
+ void arm_conv_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst);
+
+
+ /**
+ * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
+ */
+ void arm_conv_fast_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst);
+
+
+ /**
+ * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
+ * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+ * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
+ */
+ void arm_conv_fast_opt_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst,
+ q15_t * pScratch1,
+ q15_t * pScratch2);
+
+
+ /**
+ * @brief Convolution of Q31 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
+ */
+ void arm_conv_q31(
+ q31_t * pSrcA,
+ uint32_t srcALen,
+ q31_t * pSrcB,
+ uint32_t srcBLen,
+ q31_t * pDst);
+
+
+ /**
+ * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
+ */
+ void arm_conv_fast_q31(
+ q31_t * pSrcA,
+ uint32_t srcALen,
+ q31_t * pSrcB,
+ uint32_t srcBLen,
+ q31_t * pDst);
+
+
+ /**
+ * @brief Convolution of Q7 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
+ * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+ * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
+ */
+ void arm_conv_opt_q7(
+ q7_t * pSrcA,
+ uint32_t srcALen,
+ q7_t * pSrcB,
+ uint32_t srcBLen,
+ q7_t * pDst,
+ q15_t * pScratch1,
+ q15_t * pScratch2);
+
+
+ /**
+ * @brief Convolution of Q7 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
+ */
+ void arm_conv_q7(
+ q7_t * pSrcA,
+ uint32_t srcALen,
+ q7_t * pSrcB,
+ uint32_t srcBLen,
+ q7_t * pDst);
+
+
+ /**
+ * @brief Partial convolution of floating-point sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data
+ * @param[in] firstIndex is the first output sample to start with.
+ * @param[in] numPoints is the number of output points to be computed.
+ * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+ */
+ arm_status arm_conv_partial_f32(
+ float32_t * pSrcA,
+ uint32_t srcALen,
+ float32_t * pSrcB,
+ uint32_t srcBLen,
+ float32_t * pDst,
+ uint32_t firstIndex,
+ uint32_t numPoints);
+
+
+ /**
+ * @brief Partial convolution of Q15 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data
+ * @param[in] firstIndex is the first output sample to start with.
+ * @param[in] numPoints is the number of output points to be computed.
+ * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+ * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
+ * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+ */
+ arm_status arm_conv_partial_opt_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst,
+ uint32_t firstIndex,
+ uint32_t numPoints,
+ q15_t * pScratch1,
+ q15_t * pScratch2);
+
+
+ /**
+ * @brief Partial convolution of Q15 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data
+ * @param[in] firstIndex is the first output sample to start with.
+ * @param[in] numPoints is the number of output points to be computed.
+ * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+ */
+ arm_status arm_conv_partial_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst,
+ uint32_t firstIndex,
+ uint32_t numPoints);
+
+
+ /**
+ * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data
+ * @param[in] firstIndex is the first output sample to start with.
+ * @param[in] numPoints is the number of output points to be computed.
+ * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+ */
+ arm_status arm_conv_partial_fast_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst,
+ uint32_t firstIndex,
+ uint32_t numPoints);
+
+
+ /**
+ * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data
+ * @param[in] firstIndex is the first output sample to start with.
+ * @param[in] numPoints is the number of output points to be computed.
+ * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+ * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
+ * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+ */
+ arm_status arm_conv_partial_fast_opt_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst,
+ uint32_t firstIndex,
+ uint32_t numPoints,
+ q15_t * pScratch1,
+ q15_t * pScratch2);
+
+
+ /**
+ * @brief Partial convolution of Q31 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data
+ * @param[in] firstIndex is the first output sample to start with.
+ * @param[in] numPoints is the number of output points to be computed.
+ * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+ */
+ arm_status arm_conv_partial_q31(
+ q31_t * pSrcA,
+ uint32_t srcALen,
+ q31_t * pSrcB,
+ uint32_t srcBLen,
+ q31_t * pDst,
+ uint32_t firstIndex,
+ uint32_t numPoints);
+
+
+ /**
+ * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data
+ * @param[in] firstIndex is the first output sample to start with.
+ * @param[in] numPoints is the number of output points to be computed.
+ * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+ */
+ arm_status arm_conv_partial_fast_q31(
+ q31_t * pSrcA,
+ uint32_t srcALen,
+ q31_t * pSrcB,
+ uint32_t srcBLen,
+ q31_t * pDst,
+ uint32_t firstIndex,
+ uint32_t numPoints);
+
+
+ /**
+ * @brief Partial convolution of Q7 sequences
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data
+ * @param[in] firstIndex is the first output sample to start with.
+ * @param[in] numPoints is the number of output points to be computed.
+ * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+ * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
+ * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+ */
+ arm_status arm_conv_partial_opt_q7(
+ q7_t * pSrcA,
+ uint32_t srcALen,
+ q7_t * pSrcB,
+ uint32_t srcBLen,
+ q7_t * pDst,
+ uint32_t firstIndex,
+ uint32_t numPoints,
+ q15_t * pScratch1,
+ q15_t * pScratch2);
+
+
+/**
+ * @brief Partial convolution of Q7 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data
+ * @param[in] firstIndex is the first output sample to start with.
+ * @param[in] numPoints is the number of output points to be computed.
+ * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
+ */
+ arm_status arm_conv_partial_q7(
+ q7_t * pSrcA,
+ uint32_t srcALen,
+ q7_t * pSrcB,
+ uint32_t srcBLen,
+ q7_t * pDst,
+ uint32_t firstIndex,
+ uint32_t numPoints);
+
+
+ /**
+ * @brief Instance structure for the Q15 FIR decimator.
+ */
+ typedef struct
+ {
+ uint8_t M; /**< decimation factor. */
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
+ q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ } arm_fir_decimate_instance_q15;
+
+ /**
+ * @brief Instance structure for the Q31 FIR decimator.
+ */
+ typedef struct
+ {
+ uint8_t M; /**< decimation factor. */
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
+ q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ } arm_fir_decimate_instance_q31;
+
+ /**
+ * @brief Instance structure for the floating-point FIR decimator.
+ */
+ typedef struct
+ {
+ uint8_t M; /**< decimation factor. */
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
+ float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ } arm_fir_decimate_instance_f32;
+
+
+ /**
+ * @brief Processing function for the floating-point FIR decimator.
+ * @param[in] S points to an instance of the floating-point FIR decimator structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_decimate_f32(
+ const arm_fir_decimate_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the floating-point FIR decimator.
+ * @param[in,out] S points to an instance of the floating-point FIR decimator structure.
+ * @param[in] numTaps number of coefficients in the filter.
+ * @param[in] M decimation factor.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] blockSize number of input samples to process per call.
+ * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+ * blockSize
is not a multiple of M
.
+ */
+ arm_status arm_fir_decimate_init_f32(
+ arm_fir_decimate_instance_f32 * S,
+ uint16_t numTaps,
+ uint8_t M,
+ float32_t * pCoeffs,
+ float32_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q15 FIR decimator.
+ * @param[in] S points to an instance of the Q15 FIR decimator structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_decimate_q15(
+ const arm_fir_decimate_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
+ * @param[in] S points to an instance of the Q15 FIR decimator structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_decimate_fast_q15(
+ const arm_fir_decimate_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q15 FIR decimator.
+ * @param[in,out] S points to an instance of the Q15 FIR decimator structure.
+ * @param[in] numTaps number of coefficients in the filter.
+ * @param[in] M decimation factor.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] blockSize number of input samples to process per call.
+ * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+ * blockSize
is not a multiple of M
.
+ */
+ arm_status arm_fir_decimate_init_q15(
+ arm_fir_decimate_instance_q15 * S,
+ uint16_t numTaps,
+ uint8_t M,
+ q15_t * pCoeffs,
+ q15_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q31 FIR decimator.
+ * @param[in] S points to an instance of the Q31 FIR decimator structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_decimate_q31(
+ const arm_fir_decimate_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+ /**
+ * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
+ * @param[in] S points to an instance of the Q31 FIR decimator structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_decimate_fast_q31(
+ arm_fir_decimate_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q31 FIR decimator.
+ * @param[in,out] S points to an instance of the Q31 FIR decimator structure.
+ * @param[in] numTaps number of coefficients in the filter.
+ * @param[in] M decimation factor.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] blockSize number of input samples to process per call.
+ * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+ * blockSize
is not a multiple of M
.
+ */
+ arm_status arm_fir_decimate_init_q31(
+ arm_fir_decimate_instance_q31 * S,
+ uint16_t numTaps,
+ uint8_t M,
+ q31_t * pCoeffs,
+ q31_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Instance structure for the Q15 FIR interpolator.
+ */
+ typedef struct
+ {
+ uint8_t L; /**< upsample factor. */
+ uint16_t phaseLength; /**< length of each polyphase filter component. */
+ q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
+ q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
+ } arm_fir_interpolate_instance_q15;
+
+ /**
+ * @brief Instance structure for the Q31 FIR interpolator.
+ */
+ typedef struct
+ {
+ uint8_t L; /**< upsample factor. */
+ uint16_t phaseLength; /**< length of each polyphase filter component. */
+ q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
+ q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
+ } arm_fir_interpolate_instance_q31;
+
+ /**
+ * @brief Instance structure for the floating-point FIR interpolator.
+ */
+ typedef struct
+ {
+ uint8_t L; /**< upsample factor. */
+ uint16_t phaseLength; /**< length of each polyphase filter component. */
+ float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
+ float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
+ } arm_fir_interpolate_instance_f32;
+
+
+ /**
+ * @brief Processing function for the Q15 FIR interpolator.
+ * @param[in] S points to an instance of the Q15 FIR interpolator structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_interpolate_q15(
+ const arm_fir_interpolate_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q15 FIR interpolator.
+ * @param[in,out] S points to an instance of the Q15 FIR interpolator structure.
+ * @param[in] L upsample factor.
+ * @param[in] numTaps number of filter coefficients in the filter.
+ * @param[in] pCoeffs points to the filter coefficient buffer.
+ * @param[in] pState points to the state buffer.
+ * @param[in] blockSize number of input samples to process per call.
+ * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+ * the filter length numTaps
is not a multiple of the interpolation factor L
.
+ */
+ arm_status arm_fir_interpolate_init_q15(
+ arm_fir_interpolate_instance_q15 * S,
+ uint8_t L,
+ uint16_t numTaps,
+ q15_t * pCoeffs,
+ q15_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q31 FIR interpolator.
+ * @param[in] S points to an instance of the Q15 FIR interpolator structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_interpolate_q31(
+ const arm_fir_interpolate_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q31 FIR interpolator.
+ * @param[in,out] S points to an instance of the Q31 FIR interpolator structure.
+ * @param[in] L upsample factor.
+ * @param[in] numTaps number of filter coefficients in the filter.
+ * @param[in] pCoeffs points to the filter coefficient buffer.
+ * @param[in] pState points to the state buffer.
+ * @param[in] blockSize number of input samples to process per call.
+ * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+ * the filter length numTaps
is not a multiple of the interpolation factor L
.
+ */
+ arm_status arm_fir_interpolate_init_q31(
+ arm_fir_interpolate_instance_q31 * S,
+ uint8_t L,
+ uint16_t numTaps,
+ q31_t * pCoeffs,
+ q31_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the floating-point FIR interpolator.
+ * @param[in] S points to an instance of the floating-point FIR interpolator structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_interpolate_f32(
+ const arm_fir_interpolate_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the floating-point FIR interpolator.
+ * @param[in,out] S points to an instance of the floating-point FIR interpolator structure.
+ * @param[in] L upsample factor.
+ * @param[in] numTaps number of filter coefficients in the filter.
+ * @param[in] pCoeffs points to the filter coefficient buffer.
+ * @param[in] pState points to the state buffer.
+ * @param[in] blockSize number of input samples to process per call.
+ * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
+ * the filter length numTaps
is not a multiple of the interpolation factor L
.
+ */
+ arm_status arm_fir_interpolate_init_f32(
+ arm_fir_interpolate_instance_f32 * S,
+ uint8_t L,
+ uint16_t numTaps,
+ float32_t * pCoeffs,
+ float32_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Instance structure for the high precision Q31 Biquad cascade filter.
+ */
+ typedef struct
+ {
+ uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
+ q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
+ q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
+ uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
+ } arm_biquad_cas_df1_32x64_ins_q31;
+
+
+ /**
+ * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_biquad_cas_df1_32x64_q31(
+ const arm_biquad_cas_df1_32x64_ins_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure.
+ * @param[in] numStages number of 2nd order stages in the filter.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
+ */
+ void arm_biquad_cas_df1_32x64_init_q31(
+ arm_biquad_cas_df1_32x64_ins_q31 * S,
+ uint8_t numStages,
+ q31_t * pCoeffs,
+ q63_t * pState,
+ uint8_t postShift);
+
+
+ /**
+ * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
+ */
+ typedef struct
+ {
+ uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
+ float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
+ float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
+ } arm_biquad_cascade_df2T_instance_f32;
+
+ /**
+ * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
+ */
+ typedef struct
+ {
+ uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
+ float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
+ float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
+ } arm_biquad_cascade_stereo_df2T_instance_f32;
+
+ /**
+ * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
+ */
+ typedef struct
+ {
+ uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
+ float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
+ float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
+ } arm_biquad_cascade_df2T_instance_f64;
+
+
+ /**
+ * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
+ * @param[in] S points to an instance of the filter data structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_biquad_cascade_df2T_f32(
+ const arm_biquad_cascade_df2T_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
+ * @param[in] S points to an instance of the filter data structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_biquad_cascade_stereo_df2T_f32(
+ const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
+ * @param[in] S points to an instance of the filter data structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_biquad_cascade_df2T_f64(
+ const arm_biquad_cascade_df2T_instance_f64 * S,
+ float64_t * pSrc,
+ float64_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
+ * @param[in,out] S points to an instance of the filter data structure.
+ * @param[in] numStages number of 2nd order stages in the filter.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ */
+ void arm_biquad_cascade_df2T_init_f32(
+ arm_biquad_cascade_df2T_instance_f32 * S,
+ uint8_t numStages,
+ float32_t * pCoeffs,
+ float32_t * pState);
+
+
+ /**
+ * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
+ * @param[in,out] S points to an instance of the filter data structure.
+ * @param[in] numStages number of 2nd order stages in the filter.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ */
+ void arm_biquad_cascade_stereo_df2T_init_f32(
+ arm_biquad_cascade_stereo_df2T_instance_f32 * S,
+ uint8_t numStages,
+ float32_t * pCoeffs,
+ float32_t * pState);
+
+
+ /**
+ * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
+ * @param[in,out] S points to an instance of the filter data structure.
+ * @param[in] numStages number of 2nd order stages in the filter.
+ * @param[in] pCoeffs points to the filter coefficients.
+ * @param[in] pState points to the state buffer.
+ */
+ void arm_biquad_cascade_df2T_init_f64(
+ arm_biquad_cascade_df2T_instance_f64 * S,
+ uint8_t numStages,
+ float64_t * pCoeffs,
+ float64_t * pState);
+
+
+ /**
+ * @brief Instance structure for the Q15 FIR lattice filter.
+ */
+ typedef struct
+ {
+ uint16_t numStages; /**< number of filter stages. */
+ q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
+ q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
+ } arm_fir_lattice_instance_q15;
+
+ /**
+ * @brief Instance structure for the Q31 FIR lattice filter.
+ */
+ typedef struct
+ {
+ uint16_t numStages; /**< number of filter stages. */
+ q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
+ q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
+ } arm_fir_lattice_instance_q31;
+
+ /**
+ * @brief Instance structure for the floating-point FIR lattice filter.
+ */
+ typedef struct
+ {
+ uint16_t numStages; /**< number of filter stages. */
+ float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
+ float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
+ } arm_fir_lattice_instance_f32;
+
+
+ /**
+ * @brief Initialization function for the Q15 FIR lattice filter.
+ * @param[in] S points to an instance of the Q15 FIR lattice structure.
+ * @param[in] numStages number of filter stages.
+ * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
+ * @param[in] pState points to the state buffer. The array is of length numStages.
+ */
+ void arm_fir_lattice_init_q15(
+ arm_fir_lattice_instance_q15 * S,
+ uint16_t numStages,
+ q15_t * pCoeffs,
+ q15_t * pState);
+
+
+ /**
+ * @brief Processing function for the Q15 FIR lattice filter.
+ * @param[in] S points to an instance of the Q15 FIR lattice structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_fir_lattice_q15(
+ const arm_fir_lattice_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q31 FIR lattice filter.
+ * @param[in] S points to an instance of the Q31 FIR lattice structure.
+ * @param[in] numStages number of filter stages.
+ * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
+ * @param[in] pState points to the state buffer. The array is of length numStages.
+ */
+ void arm_fir_lattice_init_q31(
+ arm_fir_lattice_instance_q31 * S,
+ uint16_t numStages,
+ q31_t * pCoeffs,
+ q31_t * pState);
+
+
+ /**
+ * @brief Processing function for the Q31 FIR lattice filter.
+ * @param[in] S points to an instance of the Q31 FIR lattice structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_fir_lattice_q31(
+ const arm_fir_lattice_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+/**
+ * @brief Initialization function for the floating-point FIR lattice filter.
+ * @param[in] S points to an instance of the floating-point FIR lattice structure.
+ * @param[in] numStages number of filter stages.
+ * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
+ * @param[in] pState points to the state buffer. The array is of length numStages.
+ */
+ void arm_fir_lattice_init_f32(
+ arm_fir_lattice_instance_f32 * S,
+ uint16_t numStages,
+ float32_t * pCoeffs,
+ float32_t * pState);
+
+
+ /**
+ * @brief Processing function for the floating-point FIR lattice filter.
+ * @param[in] S points to an instance of the floating-point FIR lattice structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_fir_lattice_f32(
+ const arm_fir_lattice_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Instance structure for the Q15 IIR lattice filter.
+ */
+ typedef struct
+ {
+ uint16_t numStages; /**< number of stages in the filter. */
+ q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
+ q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
+ q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
+ } arm_iir_lattice_instance_q15;
+
+ /**
+ * @brief Instance structure for the Q31 IIR lattice filter.
+ */
+ typedef struct
+ {
+ uint16_t numStages; /**< number of stages in the filter. */
+ q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
+ q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
+ q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
+ } arm_iir_lattice_instance_q31;
+
+ /**
+ * @brief Instance structure for the floating-point IIR lattice filter.
+ */
+ typedef struct
+ {
+ uint16_t numStages; /**< number of stages in the filter. */
+ float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
+ float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
+ float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
+ } arm_iir_lattice_instance_f32;
+
+
+ /**
+ * @brief Processing function for the floating-point IIR lattice filter.
+ * @param[in] S points to an instance of the floating-point IIR lattice structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_iir_lattice_f32(
+ const arm_iir_lattice_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the floating-point IIR lattice filter.
+ * @param[in] S points to an instance of the floating-point IIR lattice structure.
+ * @param[in] numStages number of stages in the filter.
+ * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
+ * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
+ * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_iir_lattice_init_f32(
+ arm_iir_lattice_instance_f32 * S,
+ uint16_t numStages,
+ float32_t * pkCoeffs,
+ float32_t * pvCoeffs,
+ float32_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q31 IIR lattice filter.
+ * @param[in] S points to an instance of the Q31 IIR lattice structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_iir_lattice_q31(
+ const arm_iir_lattice_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q31 IIR lattice filter.
+ * @param[in] S points to an instance of the Q31 IIR lattice structure.
+ * @param[in] numStages number of stages in the filter.
+ * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
+ * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
+ * @param[in] pState points to the state buffer. The array is of length numStages+blockSize.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_iir_lattice_init_q31(
+ arm_iir_lattice_instance_q31 * S,
+ uint16_t numStages,
+ q31_t * pkCoeffs,
+ q31_t * pvCoeffs,
+ q31_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q15 IIR lattice filter.
+ * @param[in] S points to an instance of the Q15 IIR lattice structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_iir_lattice_q15(
+ const arm_iir_lattice_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+/**
+ * @brief Initialization function for the Q15 IIR lattice filter.
+ * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure.
+ * @param[in] numStages number of stages in the filter.
+ * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
+ * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
+ * @param[in] pState points to state buffer. The array is of length numStages+blockSize.
+ * @param[in] blockSize number of samples to process per call.
+ */
+ void arm_iir_lattice_init_q15(
+ arm_iir_lattice_instance_q15 * S,
+ uint16_t numStages,
+ q15_t * pkCoeffs,
+ q15_t * pvCoeffs,
+ q15_t * pState,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Instance structure for the floating-point LMS filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
+ float32_t mu; /**< step size that controls filter coefficient updates. */
+ } arm_lms_instance_f32;
+
+
+ /**
+ * @brief Processing function for floating-point LMS filter.
+ * @param[in] S points to an instance of the floating-point LMS filter structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[in] pRef points to the block of reference data.
+ * @param[out] pOut points to the block of output data.
+ * @param[out] pErr points to the block of error data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_lms_f32(
+ const arm_lms_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pRef,
+ float32_t * pOut,
+ float32_t * pErr,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for floating-point LMS filter.
+ * @param[in] S points to an instance of the floating-point LMS filter structure.
+ * @param[in] numTaps number of filter coefficients.
+ * @param[in] pCoeffs points to the coefficient buffer.
+ * @param[in] pState points to state buffer.
+ * @param[in] mu step size that controls filter coefficient updates.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_lms_init_f32(
+ arm_lms_instance_f32 * S,
+ uint16_t numTaps,
+ float32_t * pCoeffs,
+ float32_t * pState,
+ float32_t mu,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Instance structure for the Q15 LMS filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
+ q15_t mu; /**< step size that controls filter coefficient updates. */
+ uint32_t postShift; /**< bit shift applied to coefficients. */
+ } arm_lms_instance_q15;
+
+
+ /**
+ * @brief Initialization function for the Q15 LMS filter.
+ * @param[in] S points to an instance of the Q15 LMS filter structure.
+ * @param[in] numTaps number of filter coefficients.
+ * @param[in] pCoeffs points to the coefficient buffer.
+ * @param[in] pState points to the state buffer.
+ * @param[in] mu step size that controls filter coefficient updates.
+ * @param[in] blockSize number of samples to process.
+ * @param[in] postShift bit shift applied to coefficients.
+ */
+ void arm_lms_init_q15(
+ arm_lms_instance_q15 * S,
+ uint16_t numTaps,
+ q15_t * pCoeffs,
+ q15_t * pState,
+ q15_t mu,
+ uint32_t blockSize,
+ uint32_t postShift);
+
+
+ /**
+ * @brief Processing function for Q15 LMS filter.
+ * @param[in] S points to an instance of the Q15 LMS filter structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[in] pRef points to the block of reference data.
+ * @param[out] pOut points to the block of output data.
+ * @param[out] pErr points to the block of error data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_lms_q15(
+ const arm_lms_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pRef,
+ q15_t * pOut,
+ q15_t * pErr,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Instance structure for the Q31 LMS filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
+ q31_t mu; /**< step size that controls filter coefficient updates. */
+ uint32_t postShift; /**< bit shift applied to coefficients. */
+ } arm_lms_instance_q31;
+
+
+ /**
+ * @brief Processing function for Q31 LMS filter.
+ * @param[in] S points to an instance of the Q15 LMS filter structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[in] pRef points to the block of reference data.
+ * @param[out] pOut points to the block of output data.
+ * @param[out] pErr points to the block of error data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_lms_q31(
+ const arm_lms_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pRef,
+ q31_t * pOut,
+ q31_t * pErr,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for Q31 LMS filter.
+ * @param[in] S points to an instance of the Q31 LMS filter structure.
+ * @param[in] numTaps number of filter coefficients.
+ * @param[in] pCoeffs points to coefficient buffer.
+ * @param[in] pState points to state buffer.
+ * @param[in] mu step size that controls filter coefficient updates.
+ * @param[in] blockSize number of samples to process.
+ * @param[in] postShift bit shift applied to coefficients.
+ */
+ void arm_lms_init_q31(
+ arm_lms_instance_q31 * S,
+ uint16_t numTaps,
+ q31_t * pCoeffs,
+ q31_t * pState,
+ q31_t mu,
+ uint32_t blockSize,
+ uint32_t postShift);
+
+
+ /**
+ * @brief Instance structure for the floating-point normalized LMS filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
+ float32_t mu; /**< step size that control filter coefficient updates. */
+ float32_t energy; /**< saves previous frame energy. */
+ float32_t x0; /**< saves previous input sample. */
+ } arm_lms_norm_instance_f32;
+
+
+ /**
+ * @brief Processing function for floating-point normalized LMS filter.
+ * @param[in] S points to an instance of the floating-point normalized LMS filter structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[in] pRef points to the block of reference data.
+ * @param[out] pOut points to the block of output data.
+ * @param[out] pErr points to the block of error data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_lms_norm_f32(
+ arm_lms_norm_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pRef,
+ float32_t * pOut,
+ float32_t * pErr,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for floating-point normalized LMS filter.
+ * @param[in] S points to an instance of the floating-point LMS filter structure.
+ * @param[in] numTaps number of filter coefficients.
+ * @param[in] pCoeffs points to coefficient buffer.
+ * @param[in] pState points to state buffer.
+ * @param[in] mu step size that controls filter coefficient updates.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_lms_norm_init_f32(
+ arm_lms_norm_instance_f32 * S,
+ uint16_t numTaps,
+ float32_t * pCoeffs,
+ float32_t * pState,
+ float32_t mu,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Instance structure for the Q31 normalized LMS filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
+ q31_t mu; /**< step size that controls filter coefficient updates. */
+ uint8_t postShift; /**< bit shift applied to coefficients. */
+ q31_t *recipTable; /**< points to the reciprocal initial value table. */
+ q31_t energy; /**< saves previous frame energy. */
+ q31_t x0; /**< saves previous input sample. */
+ } arm_lms_norm_instance_q31;
+
+
+ /**
+ * @brief Processing function for Q31 normalized LMS filter.
+ * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[in] pRef points to the block of reference data.
+ * @param[out] pOut points to the block of output data.
+ * @param[out] pErr points to the block of error data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_lms_norm_q31(
+ arm_lms_norm_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pRef,
+ q31_t * pOut,
+ q31_t * pErr,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for Q31 normalized LMS filter.
+ * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
+ * @param[in] numTaps number of filter coefficients.
+ * @param[in] pCoeffs points to coefficient buffer.
+ * @param[in] pState points to state buffer.
+ * @param[in] mu step size that controls filter coefficient updates.
+ * @param[in] blockSize number of samples to process.
+ * @param[in] postShift bit shift applied to coefficients.
+ */
+ void arm_lms_norm_init_q31(
+ arm_lms_norm_instance_q31 * S,
+ uint16_t numTaps,
+ q31_t * pCoeffs,
+ q31_t * pState,
+ q31_t mu,
+ uint32_t blockSize,
+ uint8_t postShift);
+
+
+ /**
+ * @brief Instance structure for the Q15 normalized LMS filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< Number of coefficients in the filter. */
+ q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
+ q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
+ q15_t mu; /**< step size that controls filter coefficient updates. */
+ uint8_t postShift; /**< bit shift applied to coefficients. */
+ q15_t *recipTable; /**< Points to the reciprocal initial value table. */
+ q15_t energy; /**< saves previous frame energy. */
+ q15_t x0; /**< saves previous input sample. */
+ } arm_lms_norm_instance_q15;
+
+
+ /**
+ * @brief Processing function for Q15 normalized LMS filter.
+ * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[in] pRef points to the block of reference data.
+ * @param[out] pOut points to the block of output data.
+ * @param[out] pErr points to the block of error data.
+ * @param[in] blockSize number of samples to process.
+ */
+ void arm_lms_norm_q15(
+ arm_lms_norm_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pRef,
+ q15_t * pOut,
+ q15_t * pErr,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for Q15 normalized LMS filter.
+ * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
+ * @param[in] numTaps number of filter coefficients.
+ * @param[in] pCoeffs points to coefficient buffer.
+ * @param[in] pState points to state buffer.
+ * @param[in] mu step size that controls filter coefficient updates.
+ * @param[in] blockSize number of samples to process.
+ * @param[in] postShift bit shift applied to coefficients.
+ */
+ void arm_lms_norm_init_q15(
+ arm_lms_norm_instance_q15 * S,
+ uint16_t numTaps,
+ q15_t * pCoeffs,
+ q15_t * pState,
+ q15_t mu,
+ uint32_t blockSize,
+ uint8_t postShift);
+
+
+ /**
+ * @brief Correlation of floating-point sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
+ */
+ void arm_correlate_f32(
+ float32_t * pSrcA,
+ uint32_t srcALen,
+ float32_t * pSrcB,
+ uint32_t srcBLen,
+ float32_t * pDst);
+
+
+ /**
+ * @brief Correlation of Q15 sequences
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
+ * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+ */
+ void arm_correlate_opt_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst,
+ q15_t * pScratch);
+
+
+ /**
+ * @brief Correlation of Q15 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
+ */
+
+ void arm_correlate_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst);
+
+
+ /**
+ * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
+ */
+
+ void arm_correlate_fast_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst);
+
+
+ /**
+ * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
+ * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+ */
+ void arm_correlate_fast_opt_q15(
+ q15_t * pSrcA,
+ uint32_t srcALen,
+ q15_t * pSrcB,
+ uint32_t srcBLen,
+ q15_t * pDst,
+ q15_t * pScratch);
+
+
+ /**
+ * @brief Correlation of Q31 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
+ */
+ void arm_correlate_q31(
+ q31_t * pSrcA,
+ uint32_t srcALen,
+ q31_t * pSrcB,
+ uint32_t srcBLen,
+ q31_t * pDst);
+
+
+ /**
+ * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
+ */
+ void arm_correlate_fast_q31(
+ q31_t * pSrcA,
+ uint32_t srcALen,
+ q31_t * pSrcB,
+ uint32_t srcBLen,
+ q31_t * pDst);
+
+
+ /**
+ * @brief Correlation of Q7 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
+ * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
+ * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
+ */
+ void arm_correlate_opt_q7(
+ q7_t * pSrcA,
+ uint32_t srcALen,
+ q7_t * pSrcB,
+ uint32_t srcBLen,
+ q7_t * pDst,
+ q15_t * pScratch1,
+ q15_t * pScratch2);
+
+
+ /**
+ * @brief Correlation of Q7 sequences.
+ * @param[in] pSrcA points to the first input sequence.
+ * @param[in] srcALen length of the first input sequence.
+ * @param[in] pSrcB points to the second input sequence.
+ * @param[in] srcBLen length of the second input sequence.
+ * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
+ */
+ void arm_correlate_q7(
+ q7_t * pSrcA,
+ uint32_t srcALen,
+ q7_t * pSrcB,
+ uint32_t srcBLen,
+ q7_t * pDst);
+
+
+ /**
+ * @brief Instance structure for the floating-point sparse FIR filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
+ float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
+ float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
+ uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
+ int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
+ } arm_fir_sparse_instance_f32;
+
+ /**
+ * @brief Instance structure for the Q31 sparse FIR filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
+ q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
+ q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
+ uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
+ int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
+ } arm_fir_sparse_instance_q31;
+
+ /**
+ * @brief Instance structure for the Q15 sparse FIR filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
+ q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
+ q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
+ uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
+ int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
+ } arm_fir_sparse_instance_q15;
+
+ /**
+ * @brief Instance structure for the Q7 sparse FIR filter.
+ */
+ typedef struct
+ {
+ uint16_t numTaps; /**< number of coefficients in the filter. */
+ uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
+ q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
+ q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
+ uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
+ int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
+ } arm_fir_sparse_instance_q7;
+
+
+ /**
+ * @brief Processing function for the floating-point sparse FIR filter.
+ * @param[in] S points to an instance of the floating-point sparse FIR structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] pScratchIn points to a temporary buffer of size blockSize.
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_sparse_f32(
+ arm_fir_sparse_instance_f32 * S,
+ float32_t * pSrc,
+ float32_t * pDst,
+ float32_t * pScratchIn,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the floating-point sparse FIR filter.
+ * @param[in,out] S points to an instance of the floating-point sparse FIR structure.
+ * @param[in] numTaps number of nonzero coefficients in the filter.
+ * @param[in] pCoeffs points to the array of filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] pTapDelay points to the array of offset times.
+ * @param[in] maxDelay maximum offset time supported.
+ * @param[in] blockSize number of samples that will be processed per block.
+ */
+ void arm_fir_sparse_init_f32(
+ arm_fir_sparse_instance_f32 * S,
+ uint16_t numTaps,
+ float32_t * pCoeffs,
+ float32_t * pState,
+ int32_t * pTapDelay,
+ uint16_t maxDelay,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q31 sparse FIR filter.
+ * @param[in] S points to an instance of the Q31 sparse FIR structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] pScratchIn points to a temporary buffer of size blockSize.
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_sparse_q31(
+ arm_fir_sparse_instance_q31 * S,
+ q31_t * pSrc,
+ q31_t * pDst,
+ q31_t * pScratchIn,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q31 sparse FIR filter.
+ * @param[in,out] S points to an instance of the Q31 sparse FIR structure.
+ * @param[in] numTaps number of nonzero coefficients in the filter.
+ * @param[in] pCoeffs points to the array of filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] pTapDelay points to the array of offset times.
+ * @param[in] maxDelay maximum offset time supported.
+ * @param[in] blockSize number of samples that will be processed per block.
+ */
+ void arm_fir_sparse_init_q31(
+ arm_fir_sparse_instance_q31 * S,
+ uint16_t numTaps,
+ q31_t * pCoeffs,
+ q31_t * pState,
+ int32_t * pTapDelay,
+ uint16_t maxDelay,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q15 sparse FIR filter.
+ * @param[in] S points to an instance of the Q15 sparse FIR structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] pScratchIn points to a temporary buffer of size blockSize.
+ * @param[in] pScratchOut points to a temporary buffer of size blockSize.
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_sparse_q15(
+ arm_fir_sparse_instance_q15 * S,
+ q15_t * pSrc,
+ q15_t * pDst,
+ q15_t * pScratchIn,
+ q31_t * pScratchOut,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q15 sparse FIR filter.
+ * @param[in,out] S points to an instance of the Q15 sparse FIR structure.
+ * @param[in] numTaps number of nonzero coefficients in the filter.
+ * @param[in] pCoeffs points to the array of filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] pTapDelay points to the array of offset times.
+ * @param[in] maxDelay maximum offset time supported.
+ * @param[in] blockSize number of samples that will be processed per block.
+ */
+ void arm_fir_sparse_init_q15(
+ arm_fir_sparse_instance_q15 * S,
+ uint16_t numTaps,
+ q15_t * pCoeffs,
+ q15_t * pState,
+ int32_t * pTapDelay,
+ uint16_t maxDelay,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Processing function for the Q7 sparse FIR filter.
+ * @param[in] S points to an instance of the Q7 sparse FIR structure.
+ * @param[in] pSrc points to the block of input data.
+ * @param[out] pDst points to the block of output data
+ * @param[in] pScratchIn points to a temporary buffer of size blockSize.
+ * @param[in] pScratchOut points to a temporary buffer of size blockSize.
+ * @param[in] blockSize number of input samples to process per call.
+ */
+ void arm_fir_sparse_q7(
+ arm_fir_sparse_instance_q7 * S,
+ q7_t * pSrc,
+ q7_t * pDst,
+ q7_t * pScratchIn,
+ q31_t * pScratchOut,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Initialization function for the Q7 sparse FIR filter.
+ * @param[in,out] S points to an instance of the Q7 sparse FIR structure.
+ * @param[in] numTaps number of nonzero coefficients in the filter.
+ * @param[in] pCoeffs points to the array of filter coefficients.
+ * @param[in] pState points to the state buffer.
+ * @param[in] pTapDelay points to the array of offset times.
+ * @param[in] maxDelay maximum offset time supported.
+ * @param[in] blockSize number of samples that will be processed per block.
+ */
+ void arm_fir_sparse_init_q7(
+ arm_fir_sparse_instance_q7 * S,
+ uint16_t numTaps,
+ q7_t * pCoeffs,
+ q7_t * pState,
+ int32_t * pTapDelay,
+ uint16_t maxDelay,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Floating-point sin_cos function.
+ * @param[in] theta input value in degrees
+ * @param[out] pSinVal points to the processed sine output.
+ * @param[out] pCosVal points to the processed cos output.
+ */
+ void arm_sin_cos_f32(
+ float32_t theta,
+ float32_t * pSinVal,
+ float32_t * pCosVal);
+
+
+ /**
+ * @brief Q31 sin_cos function.
+ * @param[in] theta scaled input value in degrees
+ * @param[out] pSinVal points to the processed sine output.
+ * @param[out] pCosVal points to the processed cosine output.
+ */
+ void arm_sin_cos_q31(
+ q31_t theta,
+ q31_t * pSinVal,
+ q31_t * pCosVal);
+
+
+ /**
+ * @brief Floating-point complex conjugate.
+ * @param[in] pSrc points to the input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] numSamples number of complex samples in each vector
+ */
+ void arm_cmplx_conj_f32(
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t numSamples);
+
+ /**
+ * @brief Q31 complex conjugate.
+ * @param[in] pSrc points to the input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] numSamples number of complex samples in each vector
+ */
+ void arm_cmplx_conj_q31(
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Q15 complex conjugate.
+ * @param[in] pSrc points to the input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] numSamples number of complex samples in each vector
+ */
+ void arm_cmplx_conj_q15(
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Floating-point complex magnitude squared
+ * @param[in] pSrc points to the complex input vector
+ * @param[out] pDst points to the real output vector
+ * @param[in] numSamples number of complex samples in the input vector
+ */
+ void arm_cmplx_mag_squared_f32(
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Q31 complex magnitude squared
+ * @param[in] pSrc points to the complex input vector
+ * @param[out] pDst points to the real output vector
+ * @param[in] numSamples number of complex samples in the input vector
+ */
+ void arm_cmplx_mag_squared_q31(
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Q15 complex magnitude squared
+ * @param[in] pSrc points to the complex input vector
+ * @param[out] pDst points to the real output vector
+ * @param[in] numSamples number of complex samples in the input vector
+ */
+ void arm_cmplx_mag_squared_q15(
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @ingroup groupController
+ */
+
+ /**
+ * @defgroup PID PID Motor Control
+ *
+ * A Proportional Integral Derivative (PID) controller is a generic feedback control
+ * loop mechanism widely used in industrial control systems.
+ * A PID controller is the most commonly used type of feedback controller.
+ *
+ * This set of functions implements (PID) controllers
+ * for Q15, Q31, and floating-point data types. The functions operate on a single sample
+ * of data and each call to the function returns a single processed value.
+ * S
points to an instance of the PID control data structure. in
+ * is the input sample value. The functions return the output value.
+ *
+ * \par Algorithm:
+ *
+ * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
+ * A0 = Kp + Ki + Kd
+ * A1 = (-Kp ) - (2 * Kd )
+ * A2 = Kd
+ *
+ * \par
+ * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
+ *
+ * \par
+ * \image html PID.gif "Proportional Integral Derivative Controller"
+ *
+ * \par
+ * The PID controller calculates an "error" value as the difference between
+ * the measured output and the reference input.
+ * The controller attempts to minimize the error by adjusting the process control inputs.
+ * The proportional value determines the reaction to the current error,
+ * the integral value determines the reaction based on the sum of recent errors,
+ * and the derivative value determines the reaction based on the rate at which the error has been changing.
+ *
+ * \par Instance Structure
+ * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
+ * A separate instance structure must be defined for each PID Controller.
+ * There are separate instance structure declarations for each of the 3 supported data types.
+ *
+ * \par Reset Functions
+ * There is also an associated reset function for each data type which clears the state array.
+ *
+ * \par Initialization Functions
+ * There is also an associated initialization function for each data type.
+ * The initialization function performs the following operations:
+ * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
+ * - Zeros out the values in the state buffer.
+ *
+ * \par
+ * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
+ *
+ * \par Fixed-Point Behavior
+ * Care must be taken when using the fixed-point versions of the PID Controller functions.
+ * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
+ * Refer to the function specific documentation below for usage guidelines.
+ */
+
+ /**
+ * @addtogroup PID
+ * @{
+ */
+
+ /**
+ * @brief Process function for the floating-point PID Control.
+ * @param[in,out] S is an instance of the floating-point PID Control structure
+ * @param[in] in input sample to process
+ * @return out processed output sample.
+ */
+ CMSIS_INLINE __STATIC_INLINE float32_t arm_pid_f32(
+ arm_pid_instance_f32 * S,
+ float32_t in)
+ {
+ float32_t out;
+
+ /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
+ out = (S->A0 * in) +
+ (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
+
+ /* Update state */
+ S->state[1] = S->state[0];
+ S->state[0] = in;
+ S->state[2] = out;
+
+ /* return to application */
+ return (out);
+
+ }
+
+ /**
+ * @brief Process function for the Q31 PID Control.
+ * @param[in,out] S points to an instance of the Q31 PID Control structure
+ * @param[in] in input sample to process
+ * @return out processed output sample.
+ *
+ * Scaling and Overflow Behavior:
+ * \par
+ * The function is implemented using an internal 64-bit accumulator.
+ * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
+ * Thus, if the accumulator result overflows it wraps around rather than clip.
+ * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
+ * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
+ */
+ CMSIS_INLINE __STATIC_INLINE q31_t arm_pid_q31(
+ arm_pid_instance_q31 * S,
+ q31_t in)
+ {
+ q63_t acc;
+ q31_t out;
+
+ /* acc = A0 * x[n] */
+ acc = (q63_t) S->A0 * in;
+
+ /* acc += A1 * x[n-1] */
+ acc += (q63_t) S->A1 * S->state[0];
+
+ /* acc += A2 * x[n-2] */
+ acc += (q63_t) S->A2 * S->state[1];
+
+ /* convert output to 1.31 format to add y[n-1] */
+ out = (q31_t) (acc >> 31U);
+
+ /* out += y[n-1] */
+ out += S->state[2];
+
+ /* Update state */
+ S->state[1] = S->state[0];
+ S->state[0] = in;
+ S->state[2] = out;
+
+ /* return to application */
+ return (out);
+ }
+
+
+ /**
+ * @brief Process function for the Q15 PID Control.
+ * @param[in,out] S points to an instance of the Q15 PID Control structure
+ * @param[in] in input sample to process
+ * @return out processed output sample.
+ *
+ * Scaling and Overflow Behavior:
+ * \par
+ * The function is implemented using a 64-bit internal accumulator.
+ * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
+ * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
+ * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
+ * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
+ * Lastly, the accumulator is saturated to yield a result in 1.15 format.
+ */
+ CMSIS_INLINE __STATIC_INLINE q15_t arm_pid_q15(
+ arm_pid_instance_q15 * S,
+ q15_t in)
+ {
+ q63_t acc;
+ q15_t out;
+
+#if defined (ARM_MATH_DSP)
+ __SIMD32_TYPE *vstate;
+
+ /* Implementation of PID controller */
+
+ /* acc = A0 * x[n] */
+ acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in);
+
+ /* acc += A1 * x[n-1] + A2 * x[n-2] */
+ vstate = __SIMD32_CONST(S->state);
+ acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)*vstate, (uint64_t)acc);
+#else
+ /* acc = A0 * x[n] */
+ acc = ((q31_t) S->A0) * in;
+
+ /* acc += A1 * x[n-1] + A2 * x[n-2] */
+ acc += (q31_t) S->A1 * S->state[0];
+ acc += (q31_t) S->A2 * S->state[1];
+#endif
+
+ /* acc += y[n-1] */
+ acc += (q31_t) S->state[2] << 15;
+
+ /* saturate the output */
+ out = (q15_t) (__SSAT((acc >> 15), 16));
+
+ /* Update state */
+ S->state[1] = S->state[0];
+ S->state[0] = in;
+ S->state[2] = out;
+
+ /* return to application */
+ return (out);
+ }
+
+ /**
+ * @} end of PID group
+ */
+
+
+ /**
+ * @brief Floating-point matrix inverse.
+ * @param[in] src points to the instance of the input floating-point matrix structure.
+ * @param[out] dst points to the instance of the output floating-point matrix structure.
+ * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
+ * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
+ */
+ arm_status arm_mat_inverse_f32(
+ const arm_matrix_instance_f32 * src,
+ arm_matrix_instance_f32 * dst);
+
+
+ /**
+ * @brief Floating-point matrix inverse.
+ * @param[in] src points to the instance of the input floating-point matrix structure.
+ * @param[out] dst points to the instance of the output floating-point matrix structure.
+ * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
+ * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
+ */
+ arm_status arm_mat_inverse_f64(
+ const arm_matrix_instance_f64 * src,
+ arm_matrix_instance_f64 * dst);
+
+
+
+ /**
+ * @ingroup groupController
+ */
+
+ /**
+ * @defgroup clarke Vector Clarke Transform
+ * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
+ * Generally the Clarke transform uses three-phase currents Ia, Ib and Ic
to calculate currents
+ * in the two-phase orthogonal stator axis Ialpha
and Ibeta
.
+ * When Ialpha
is superposed with Ia
as shown in the figure below
+ * \image html clarke.gif Stator current space vector and its components in (a,b).
+ * and Ia + Ib + Ic = 0
, in this condition Ialpha
and Ibeta
+ * can be calculated using only Ia
and Ib
.
+ *
+ * The function operates on a single sample of data and each call to the function returns the processed output.
+ * The library provides separate functions for Q31 and floating-point data types.
+ * \par Algorithm
+ * \image html clarkeFormula.gif
+ * where Ia
and Ib
are the instantaneous stator phases and
+ * pIalpha
and pIbeta
are the two coordinates of time invariant vector.
+ * \par Fixed-Point Behavior
+ * Care must be taken when using the Q31 version of the Clarke transform.
+ * In particular, the overflow and saturation behavior of the accumulator used must be considered.
+ * Refer to the function specific documentation below for usage guidelines.
+ */
+
+ /**
+ * @addtogroup clarke
+ * @{
+ */
+
+ /**
+ *
+ * @brief Floating-point Clarke transform
+ * @param[in] Ia input three-phase coordinate a
+ * @param[in] Ib input three-phase coordinate b
+ * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
+ * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_clarke_f32(
+ float32_t Ia,
+ float32_t Ib,
+ float32_t * pIalpha,
+ float32_t * pIbeta)
+ {
+ /* Calculate pIalpha using the equation, pIalpha = Ia */
+ *pIalpha = Ia;
+
+ /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
+ *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
+ }
+
+
+ /**
+ * @brief Clarke transform for Q31 version
+ * @param[in] Ia input three-phase coordinate a
+ * @param[in] Ib input three-phase coordinate b
+ * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
+ * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
+ *
+ * Scaling and Overflow Behavior:
+ * \par
+ * The function is implemented using an internal 32-bit accumulator.
+ * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
+ * There is saturation on the addition, hence there is no risk of overflow.
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_clarke_q31(
+ q31_t Ia,
+ q31_t Ib,
+ q31_t * pIalpha,
+ q31_t * pIbeta)
+ {
+ q31_t product1, product2; /* Temporary variables used to store intermediate results */
+
+ /* Calculating pIalpha from Ia by equation pIalpha = Ia */
+ *pIalpha = Ia;
+
+ /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
+ product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
+
+ /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
+ product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
+
+ /* pIbeta is calculated by adding the intermediate products */
+ *pIbeta = __QADD(product1, product2);
+ }
+
+ /**
+ * @} end of clarke group
+ */
+
+ /**
+ * @brief Converts the elements of the Q7 vector to Q31 vector.
+ * @param[in] pSrc input pointer
+ * @param[out] pDst output pointer
+ * @param[in] blockSize number of samples to process
+ */
+ void arm_q7_to_q31(
+ q7_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+
+ /**
+ * @ingroup groupController
+ */
+
+ /**
+ * @defgroup inv_clarke Vector Inverse Clarke Transform
+ * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
+ *
+ * The function operates on a single sample of data and each call to the function returns the processed output.
+ * The library provides separate functions for Q31 and floating-point data types.
+ * \par Algorithm
+ * \image html clarkeInvFormula.gif
+ * where pIa
and pIb
are the instantaneous stator phases and
+ * Ialpha
and Ibeta
are the two coordinates of time invariant vector.
+ * \par Fixed-Point Behavior
+ * Care must be taken when using the Q31 version of the Clarke transform.
+ * In particular, the overflow and saturation behavior of the accumulator used must be considered.
+ * Refer to the function specific documentation below for usage guidelines.
+ */
+
+ /**
+ * @addtogroup inv_clarke
+ * @{
+ */
+
+ /**
+ * @brief Floating-point Inverse Clarke transform
+ * @param[in] Ialpha input two-phase orthogonal vector axis alpha
+ * @param[in] Ibeta input two-phase orthogonal vector axis beta
+ * @param[out] pIa points to output three-phase coordinate a
+ * @param[out] pIb points to output three-phase coordinate b
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_f32(
+ float32_t Ialpha,
+ float32_t Ibeta,
+ float32_t * pIa,
+ float32_t * pIb)
+ {
+ /* Calculating pIa from Ialpha by equation pIa = Ialpha */
+ *pIa = Ialpha;
+
+ /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
+ *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta;
+ }
+
+
+ /**
+ * @brief Inverse Clarke transform for Q31 version
+ * @param[in] Ialpha input two-phase orthogonal vector axis alpha
+ * @param[in] Ibeta input two-phase orthogonal vector axis beta
+ * @param[out] pIa points to output three-phase coordinate a
+ * @param[out] pIb points to output three-phase coordinate b
+ *
+ * Scaling and Overflow Behavior:
+ * \par
+ * The function is implemented using an internal 32-bit accumulator.
+ * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
+ * There is saturation on the subtraction, hence there is no risk of overflow.
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_q31(
+ q31_t Ialpha,
+ q31_t Ibeta,
+ q31_t * pIa,
+ q31_t * pIb)
+ {
+ q31_t product1, product2; /* Temporary variables used to store intermediate results */
+
+ /* Calculating pIa from Ialpha by equation pIa = Ialpha */
+ *pIa = Ialpha;
+
+ /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
+ product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
+
+ /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
+ product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
+
+ /* pIb is calculated by subtracting the products */
+ *pIb = __QSUB(product2, product1);
+ }
+
+ /**
+ * @} end of inv_clarke group
+ */
+
+ /**
+ * @brief Converts the elements of the Q7 vector to Q15 vector.
+ * @param[in] pSrc input pointer
+ * @param[out] pDst output pointer
+ * @param[in] blockSize number of samples to process
+ */
+ void arm_q7_to_q15(
+ q7_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+
+ /**
+ * @ingroup groupController
+ */
+
+ /**
+ * @defgroup park Vector Park Transform
+ *
+ * Forward Park transform converts the input two-coordinate vector to flux and torque components.
+ * The Park transform can be used to realize the transformation of the Ialpha
and the Ibeta
currents
+ * from the stationary to the moving reference frame and control the spatial relationship between
+ * the stator vector current and rotor flux vector.
+ * If we consider the d axis aligned with the rotor flux, the diagram below shows the
+ * current vector and the relationship from the two reference frames:
+ * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
+ *
+ * The function operates on a single sample of data and each call to the function returns the processed output.
+ * The library provides separate functions for Q31 and floating-point data types.
+ * \par Algorithm
+ * \image html parkFormula.gif
+ * where Ialpha
and Ibeta
are the stator vector components,
+ * pId
and pIq
are rotor vector components and cosVal
and sinVal
are the
+ * cosine and sine values of theta (rotor flux position).
+ * \par Fixed-Point Behavior
+ * Care must be taken when using the Q31 version of the Park transform.
+ * In particular, the overflow and saturation behavior of the accumulator used must be considered.
+ * Refer to the function specific documentation below for usage guidelines.
+ */
+
+ /**
+ * @addtogroup park
+ * @{
+ */
+
+ /**
+ * @brief Floating-point Park transform
+ * @param[in] Ialpha input two-phase vector coordinate alpha
+ * @param[in] Ibeta input two-phase vector coordinate beta
+ * @param[out] pId points to output rotor reference frame d
+ * @param[out] pIq points to output rotor reference frame q
+ * @param[in] sinVal sine value of rotation angle theta
+ * @param[in] cosVal cosine value of rotation angle theta
+ *
+ * The function implements the forward Park transform.
+ *
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_park_f32(
+ float32_t Ialpha,
+ float32_t Ibeta,
+ float32_t * pId,
+ float32_t * pIq,
+ float32_t sinVal,
+ float32_t cosVal)
+ {
+ /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
+ *pId = Ialpha * cosVal + Ibeta * sinVal;
+
+ /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
+ *pIq = -Ialpha * sinVal + Ibeta * cosVal;
+ }
+
+
+ /**
+ * @brief Park transform for Q31 version
+ * @param[in] Ialpha input two-phase vector coordinate alpha
+ * @param[in] Ibeta input two-phase vector coordinate beta
+ * @param[out] pId points to output rotor reference frame d
+ * @param[out] pIq points to output rotor reference frame q
+ * @param[in] sinVal sine value of rotation angle theta
+ * @param[in] cosVal cosine value of rotation angle theta
+ *
+ * Scaling and Overflow Behavior:
+ * \par
+ * The function is implemented using an internal 32-bit accumulator.
+ * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
+ * There is saturation on the addition and subtraction, hence there is no risk of overflow.
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_park_q31(
+ q31_t Ialpha,
+ q31_t Ibeta,
+ q31_t * pId,
+ q31_t * pIq,
+ q31_t sinVal,
+ q31_t cosVal)
+ {
+ q31_t product1, product2; /* Temporary variables used to store intermediate results */
+ q31_t product3, product4; /* Temporary variables used to store intermediate results */
+
+ /* Intermediate product is calculated by (Ialpha * cosVal) */
+ product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
+
+ /* Intermediate product is calculated by (Ibeta * sinVal) */
+ product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
+
+
+ /* Intermediate product is calculated by (Ialpha * sinVal) */
+ product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
+
+ /* Intermediate product is calculated by (Ibeta * cosVal) */
+ product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
+
+ /* Calculate pId by adding the two intermediate products 1 and 2 */
+ *pId = __QADD(product1, product2);
+
+ /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
+ *pIq = __QSUB(product4, product3);
+ }
+
+ /**
+ * @} end of park group
+ */
+
+ /**
+ * @brief Converts the elements of the Q7 vector to floating-point vector.
+ * @param[in] pSrc is input pointer
+ * @param[out] pDst is output pointer
+ * @param[in] blockSize is the number of samples to process
+ */
+ void arm_q7_to_float(
+ q7_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @ingroup groupController
+ */
+
+ /**
+ * @defgroup inv_park Vector Inverse Park transform
+ * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
+ *
+ * The function operates on a single sample of data and each call to the function returns the processed output.
+ * The library provides separate functions for Q31 and floating-point data types.
+ * \par Algorithm
+ * \image html parkInvFormula.gif
+ * where pIalpha
and pIbeta
are the stator vector components,
+ * Id
and Iq
are rotor vector components and cosVal
and sinVal
are the
+ * cosine and sine values of theta (rotor flux position).
+ * \par Fixed-Point Behavior
+ * Care must be taken when using the Q31 version of the Park transform.
+ * In particular, the overflow and saturation behavior of the accumulator used must be considered.
+ * Refer to the function specific documentation below for usage guidelines.
+ */
+
+ /**
+ * @addtogroup inv_park
+ * @{
+ */
+
+ /**
+ * @brief Floating-point Inverse Park transform
+ * @param[in] Id input coordinate of rotor reference frame d
+ * @param[in] Iq input coordinate of rotor reference frame q
+ * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
+ * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
+ * @param[in] sinVal sine value of rotation angle theta
+ * @param[in] cosVal cosine value of rotation angle theta
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_inv_park_f32(
+ float32_t Id,
+ float32_t Iq,
+ float32_t * pIalpha,
+ float32_t * pIbeta,
+ float32_t sinVal,
+ float32_t cosVal)
+ {
+ /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
+ *pIalpha = Id * cosVal - Iq * sinVal;
+
+ /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
+ *pIbeta = Id * sinVal + Iq * cosVal;
+ }
+
+
+ /**
+ * @brief Inverse Park transform for Q31 version
+ * @param[in] Id input coordinate of rotor reference frame d
+ * @param[in] Iq input coordinate of rotor reference frame q
+ * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha
+ * @param[out] pIbeta points to output two-phase orthogonal vector axis beta
+ * @param[in] sinVal sine value of rotation angle theta
+ * @param[in] cosVal cosine value of rotation angle theta
+ *
+ * Scaling and Overflow Behavior:
+ * \par
+ * The function is implemented using an internal 32-bit accumulator.
+ * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
+ * There is saturation on the addition, hence there is no risk of overflow.
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_inv_park_q31(
+ q31_t Id,
+ q31_t Iq,
+ q31_t * pIalpha,
+ q31_t * pIbeta,
+ q31_t sinVal,
+ q31_t cosVal)
+ {
+ q31_t product1, product2; /* Temporary variables used to store intermediate results */
+ q31_t product3, product4; /* Temporary variables used to store intermediate results */
+
+ /* Intermediate product is calculated by (Id * cosVal) */
+ product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
+
+ /* Intermediate product is calculated by (Iq * sinVal) */
+ product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
+
+
+ /* Intermediate product is calculated by (Id * sinVal) */
+ product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
+
+ /* Intermediate product is calculated by (Iq * cosVal) */
+ product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
+
+ /* Calculate pIalpha by using the two intermediate products 1 and 2 */
+ *pIalpha = __QSUB(product1, product2);
+
+ /* Calculate pIbeta by using the two intermediate products 3 and 4 */
+ *pIbeta = __QADD(product4, product3);
+ }
+
+ /**
+ * @} end of Inverse park group
+ */
+
+
+ /**
+ * @brief Converts the elements of the Q31 vector to floating-point vector.
+ * @param[in] pSrc is input pointer
+ * @param[out] pDst is output pointer
+ * @param[in] blockSize is the number of samples to process
+ */
+ void arm_q31_to_float(
+ q31_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+ /**
+ * @ingroup groupInterpolation
+ */
+
+ /**
+ * @defgroup LinearInterpolate Linear Interpolation
+ *
+ * Linear interpolation is a method of curve fitting using linear polynomials.
+ * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
+ *
+ * \par
+ * \image html LinearInterp.gif "Linear interpolation"
+ *
+ * \par
+ * A Linear Interpolate function calculates an output value(y), for the input(x)
+ * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
+ *
+ * \par Algorithm:
+ *
+ * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
+ * where x0, x1 are nearest values of input x
+ * y0, y1 are nearest values to output y
+ *
+ *
+ * \par
+ * This set of functions implements Linear interpolation process
+ * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
+ * sample of data and each call to the function returns a single processed value.
+ * S
points to an instance of the Linear Interpolate function data structure.
+ * x
is the input sample value. The functions returns the output value.
+ *
+ * \par
+ * if x is outside of the table boundary, Linear interpolation returns first value of the table
+ * if x is below input range and returns last value of table if x is above range.
+ */
+
+ /**
+ * @addtogroup LinearInterpolate
+ * @{
+ */
+
+ /**
+ * @brief Process function for the floating-point Linear Interpolation Function.
+ * @param[in,out] S is an instance of the floating-point Linear Interpolation structure
+ * @param[in] x input sample to process
+ * @return y processed output sample.
+ *
+ */
+ CMSIS_INLINE __STATIC_INLINE float32_t arm_linear_interp_f32(
+ arm_linear_interp_instance_f32 * S,
+ float32_t x)
+ {
+ float32_t y;
+ float32_t x0, x1; /* Nearest input values */
+ float32_t y0, y1; /* Nearest output values */
+ float32_t xSpacing = S->xSpacing; /* spacing between input values */
+ int32_t i; /* Index variable */
+ float32_t *pYData = S->pYData; /* pointer to output table */
+
+ /* Calculation of index */
+ i = (int32_t) ((x - S->x1) / xSpacing);
+
+ if (i < 0)
+ {
+ /* Iniatilize output for below specified range as least output value of table */
+ y = pYData[0];
+ }
+ else if ((uint32_t)i >= S->nValues)
+ {
+ /* Iniatilize output for above specified range as last output value of table */
+ y = pYData[S->nValues - 1];
+ }
+ else
+ {
+ /* Calculation of nearest input values */
+ x0 = S->x1 + i * xSpacing;
+ x1 = S->x1 + (i + 1) * xSpacing;
+
+ /* Read of nearest output values */
+ y0 = pYData[i];
+ y1 = pYData[i + 1];
+
+ /* Calculation of output */
+ y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
+
+ }
+
+ /* returns output value */
+ return (y);
+ }
+
+
+ /**
+ *
+ * @brief Process function for the Q31 Linear Interpolation Function.
+ * @param[in] pYData pointer to Q31 Linear Interpolation table
+ * @param[in] x input sample to process
+ * @param[in] nValues number of table values
+ * @return y processed output sample.
+ *
+ * \par
+ * Input sample x
is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
+ * This function can support maximum of table size 2^12.
+ *
+ */
+ CMSIS_INLINE __STATIC_INLINE q31_t arm_linear_interp_q31(
+ q31_t * pYData,
+ q31_t x,
+ uint32_t nValues)
+ {
+ q31_t y; /* output */
+ q31_t y0, y1; /* Nearest output values */
+ q31_t fract; /* fractional part */
+ int32_t index; /* Index to read nearest output values */
+
+ /* Input is in 12.20 format */
+ /* 12 bits for the table index */
+ /* Index value calculation */
+ index = ((x & (q31_t)0xFFF00000) >> 20);
+
+ if (index >= (int32_t)(nValues - 1))
+ {
+ return (pYData[nValues - 1]);
+ }
+ else if (index < 0)
+ {
+ return (pYData[0]);
+ }
+ else
+ {
+ /* 20 bits for the fractional part */
+ /* shift left by 11 to keep fract in 1.31 format */
+ fract = (x & 0x000FFFFF) << 11;
+
+ /* Read two nearest output values from the index in 1.31(q31) format */
+ y0 = pYData[index];
+ y1 = pYData[index + 1];
+
+ /* Calculation of y0 * (1-fract) and y is in 2.30 format */
+ y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
+
+ /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
+ y += ((q31_t) (((q63_t) y1 * fract) >> 32));
+
+ /* Convert y to 1.31 format */
+ return (y << 1U);
+ }
+ }
+
+
+ /**
+ *
+ * @brief Process function for the Q15 Linear Interpolation Function.
+ * @param[in] pYData pointer to Q15 Linear Interpolation table
+ * @param[in] x input sample to process
+ * @param[in] nValues number of table values
+ * @return y processed output sample.
+ *
+ * \par
+ * Input sample x
is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
+ * This function can support maximum of table size 2^12.
+ *
+ */
+ CMSIS_INLINE __STATIC_INLINE q15_t arm_linear_interp_q15(
+ q15_t * pYData,
+ q31_t x,
+ uint32_t nValues)
+ {
+ q63_t y; /* output */
+ q15_t y0, y1; /* Nearest output values */
+ q31_t fract; /* fractional part */
+ int32_t index; /* Index to read nearest output values */
+
+ /* Input is in 12.20 format */
+ /* 12 bits for the table index */
+ /* Index value calculation */
+ index = ((x & (int32_t)0xFFF00000) >> 20);
+
+ if (index >= (int32_t)(nValues - 1))
+ {
+ return (pYData[nValues - 1]);
+ }
+ else if (index < 0)
+ {
+ return (pYData[0]);
+ }
+ else
+ {
+ /* 20 bits for the fractional part */
+ /* fract is in 12.20 format */
+ fract = (x & 0x000FFFFF);
+
+ /* Read two nearest output values from the index */
+ y0 = pYData[index];
+ y1 = pYData[index + 1];
+
+ /* Calculation of y0 * (1-fract) and y is in 13.35 format */
+ y = ((q63_t) y0 * (0xFFFFF - fract));
+
+ /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
+ y += ((q63_t) y1 * (fract));
+
+ /* convert y to 1.15 format */
+ return (q15_t) (y >> 20);
+ }
+ }
+
+
+ /**
+ *
+ * @brief Process function for the Q7 Linear Interpolation Function.
+ * @param[in] pYData pointer to Q7 Linear Interpolation table
+ * @param[in] x input sample to process
+ * @param[in] nValues number of table values
+ * @return y processed output sample.
+ *
+ * \par
+ * Input sample x
is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
+ * This function can support maximum of table size 2^12.
+ */
+ CMSIS_INLINE __STATIC_INLINE q7_t arm_linear_interp_q7(
+ q7_t * pYData,
+ q31_t x,
+ uint32_t nValues)
+ {
+ q31_t y; /* output */
+ q7_t y0, y1; /* Nearest output values */
+ q31_t fract; /* fractional part */
+ uint32_t index; /* Index to read nearest output values */
+
+ /* Input is in 12.20 format */
+ /* 12 bits for the table index */
+ /* Index value calculation */
+ if (x < 0)
+ {
+ return (pYData[0]);
+ }
+ index = (x >> 20) & 0xfff;
+
+ if (index >= (nValues - 1))
+ {
+ return (pYData[nValues - 1]);
+ }
+ else
+ {
+ /* 20 bits for the fractional part */
+ /* fract is in 12.20 format */
+ fract = (x & 0x000FFFFF);
+
+ /* Read two nearest output values from the index and are in 1.7(q7) format */
+ y0 = pYData[index];
+ y1 = pYData[index + 1];
+
+ /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
+ y = ((y0 * (0xFFFFF - fract)));
+
+ /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
+ y += (y1 * fract);
+
+ /* convert y to 1.7(q7) format */
+ return (q7_t) (y >> 20);
+ }
+ }
+
+ /**
+ * @} end of LinearInterpolate group
+ */
+
+ /**
+ * @brief Fast approximation to the trigonometric sine function for floating-point data.
+ * @param[in] x input value in radians.
+ * @return sin(x).
+ */
+ float32_t arm_sin_f32(
+ float32_t x);
+
+
+ /**
+ * @brief Fast approximation to the trigonometric sine function for Q31 data.
+ * @param[in] x Scaled input value in radians.
+ * @return sin(x).
+ */
+ q31_t arm_sin_q31(
+ q31_t x);
+
+
+ /**
+ * @brief Fast approximation to the trigonometric sine function for Q15 data.
+ * @param[in] x Scaled input value in radians.
+ * @return sin(x).
+ */
+ q15_t arm_sin_q15(
+ q15_t x);
+
+
+ /**
+ * @brief Fast approximation to the trigonometric cosine function for floating-point data.
+ * @param[in] x input value in radians.
+ * @return cos(x).
+ */
+ float32_t arm_cos_f32(
+ float32_t x);
+
+
+ /**
+ * @brief Fast approximation to the trigonometric cosine function for Q31 data.
+ * @param[in] x Scaled input value in radians.
+ * @return cos(x).
+ */
+ q31_t arm_cos_q31(
+ q31_t x);
+
+
+ /**
+ * @brief Fast approximation to the trigonometric cosine function for Q15 data.
+ * @param[in] x Scaled input value in radians.
+ * @return cos(x).
+ */
+ q15_t arm_cos_q15(
+ q15_t x);
+
+
+ /**
+ * @ingroup groupFastMath
+ */
+
+
+ /**
+ * @defgroup SQRT Square Root
+ *
+ * Computes the square root of a number.
+ * There are separate functions for Q15, Q31, and floating-point data types.
+ * The square root function is computed using the Newton-Raphson algorithm.
+ * This is an iterative algorithm of the form:
+ *
+ * x1 = x0 - f(x0)/f'(x0)
+ *
+ * where x1
is the current estimate,
+ * x0
is the previous estimate, and
+ * f'(x0)
is the derivative of f()
evaluated at x0
.
+ * For the square root function, the algorithm reduces to:
+ *
+ * x0 = in/2 [initial guess]
+ * x1 = 1/2 * ( x0 + in / x0) [each iteration]
+ *
+ */
+
+
+ /**
+ * @addtogroup SQRT
+ * @{
+ */
+
+ /**
+ * @brief Floating-point square root function.
+ * @param[in] in input value.
+ * @param[out] pOut square root of input value.
+ * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
+ * in
is negative value and returns zero output for negative values.
+ */
+ CMSIS_INLINE __STATIC_INLINE arm_status arm_sqrt_f32(
+ float32_t in,
+ float32_t * pOut)
+ {
+ if (in >= 0.0f)
+ {
+
+#if (__FPU_USED == 1) && defined ( __CC_ARM )
+ *pOut = __sqrtf(in);
+#elif (__FPU_USED == 1) && (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
+ *pOut = __builtin_sqrtf(in);
+#elif (__FPU_USED == 1) && defined(__GNUC__)
+ *pOut = __builtin_sqrtf(in);
+#elif (__FPU_USED == 1) && defined ( __ICCARM__ ) && (__VER__ >= 6040000)
+ __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in));
+#else
+ *pOut = sqrtf(in);
+#endif
+
+ return (ARM_MATH_SUCCESS);
+ }
+ else
+ {
+ *pOut = 0.0f;
+ return (ARM_MATH_ARGUMENT_ERROR);
+ }
+ }
+
+
+ /**
+ * @brief Q31 square root function.
+ * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
+ * @param[out] pOut square root of input value.
+ * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
+ * in
is negative value and returns zero output for negative values.
+ */
+ arm_status arm_sqrt_q31(
+ q31_t in,
+ q31_t * pOut);
+
+
+ /**
+ * @brief Q15 square root function.
+ * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
+ * @param[out] pOut square root of input value.
+ * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
+ * in
is negative value and returns zero output for negative values.
+ */
+ arm_status arm_sqrt_q15(
+ q15_t in,
+ q15_t * pOut);
+
+ /**
+ * @} end of SQRT group
+ */
+
+
+ /**
+ * @brief floating-point Circular write function.
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_f32(
+ int32_t * circBuffer,
+ int32_t L,
+ uint16_t * writeOffset,
+ int32_t bufferInc,
+ const int32_t * src,
+ int32_t srcInc,
+ uint32_t blockSize)
+ {
+ uint32_t i = 0U;
+ int32_t wOffset;
+
+ /* Copy the value of Index pointer that points
+ * to the current location where the input samples to be copied */
+ wOffset = *writeOffset;
+
+ /* Loop over the blockSize */
+ i = blockSize;
+
+ while (i > 0U)
+ {
+ /* copy the input sample to the circular buffer */
+ circBuffer[wOffset] = *src;
+
+ /* Update the input pointer */
+ src += srcInc;
+
+ /* Circularly update wOffset. Watch out for positive and negative value */
+ wOffset += bufferInc;
+ if (wOffset >= L)
+ wOffset -= L;
+
+ /* Decrement the loop counter */
+ i--;
+ }
+
+ /* Update the index pointer */
+ *writeOffset = (uint16_t)wOffset;
+ }
+
+
+
+ /**
+ * @brief floating-point Circular Read function.
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_circularRead_f32(
+ int32_t * circBuffer,
+ int32_t L,
+ int32_t * readOffset,
+ int32_t bufferInc,
+ int32_t * dst,
+ int32_t * dst_base,
+ int32_t dst_length,
+ int32_t dstInc,
+ uint32_t blockSize)
+ {
+ uint32_t i = 0U;
+ int32_t rOffset, dst_end;
+
+ /* Copy the value of Index pointer that points
+ * to the current location from where the input samples to be read */
+ rOffset = *readOffset;
+ dst_end = (int32_t) (dst_base + dst_length);
+
+ /* Loop over the blockSize */
+ i = blockSize;
+
+ while (i > 0U)
+ {
+ /* copy the sample from the circular buffer to the destination buffer */
+ *dst = circBuffer[rOffset];
+
+ /* Update the input pointer */
+ dst += dstInc;
+
+ if (dst == (int32_t *) dst_end)
+ {
+ dst = dst_base;
+ }
+
+ /* Circularly update rOffset. Watch out for positive and negative value */
+ rOffset += bufferInc;
+
+ if (rOffset >= L)
+ {
+ rOffset -= L;
+ }
+
+ /* Decrement the loop counter */
+ i--;
+ }
+
+ /* Update the index pointer */
+ *readOffset = rOffset;
+ }
+
+
+ /**
+ * @brief Q15 Circular write function.
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q15(
+ q15_t * circBuffer,
+ int32_t L,
+ uint16_t * writeOffset,
+ int32_t bufferInc,
+ const q15_t * src,
+ int32_t srcInc,
+ uint32_t blockSize)
+ {
+ uint32_t i = 0U;
+ int32_t wOffset;
+
+ /* Copy the value of Index pointer that points
+ * to the current location where the input samples to be copied */
+ wOffset = *writeOffset;
+
+ /* Loop over the blockSize */
+ i = blockSize;
+
+ while (i > 0U)
+ {
+ /* copy the input sample to the circular buffer */
+ circBuffer[wOffset] = *src;
+
+ /* Update the input pointer */
+ src += srcInc;
+
+ /* Circularly update wOffset. Watch out for positive and negative value */
+ wOffset += bufferInc;
+ if (wOffset >= L)
+ wOffset -= L;
+
+ /* Decrement the loop counter */
+ i--;
+ }
+
+ /* Update the index pointer */
+ *writeOffset = (uint16_t)wOffset;
+ }
+
+
+ /**
+ * @brief Q15 Circular Read function.
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q15(
+ q15_t * circBuffer,
+ int32_t L,
+ int32_t * readOffset,
+ int32_t bufferInc,
+ q15_t * dst,
+ q15_t * dst_base,
+ int32_t dst_length,
+ int32_t dstInc,
+ uint32_t blockSize)
+ {
+ uint32_t i = 0;
+ int32_t rOffset, dst_end;
+
+ /* Copy the value of Index pointer that points
+ * to the current location from where the input samples to be read */
+ rOffset = *readOffset;
+
+ dst_end = (int32_t) (dst_base + dst_length);
+
+ /* Loop over the blockSize */
+ i = blockSize;
+
+ while (i > 0U)
+ {
+ /* copy the sample from the circular buffer to the destination buffer */
+ *dst = circBuffer[rOffset];
+
+ /* Update the input pointer */
+ dst += dstInc;
+
+ if (dst == (q15_t *) dst_end)
+ {
+ dst = dst_base;
+ }
+
+ /* Circularly update wOffset. Watch out for positive and negative value */
+ rOffset += bufferInc;
+
+ if (rOffset >= L)
+ {
+ rOffset -= L;
+ }
+
+ /* Decrement the loop counter */
+ i--;
+ }
+
+ /* Update the index pointer */
+ *readOffset = rOffset;
+ }
+
+
+ /**
+ * @brief Q7 Circular write function.
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q7(
+ q7_t * circBuffer,
+ int32_t L,
+ uint16_t * writeOffset,
+ int32_t bufferInc,
+ const q7_t * src,
+ int32_t srcInc,
+ uint32_t blockSize)
+ {
+ uint32_t i = 0U;
+ int32_t wOffset;
+
+ /* Copy the value of Index pointer that points
+ * to the current location where the input samples to be copied */
+ wOffset = *writeOffset;
+
+ /* Loop over the blockSize */
+ i = blockSize;
+
+ while (i > 0U)
+ {
+ /* copy the input sample to the circular buffer */
+ circBuffer[wOffset] = *src;
+
+ /* Update the input pointer */
+ src += srcInc;
+
+ /* Circularly update wOffset. Watch out for positive and negative value */
+ wOffset += bufferInc;
+ if (wOffset >= L)
+ wOffset -= L;
+
+ /* Decrement the loop counter */
+ i--;
+ }
+
+ /* Update the index pointer */
+ *writeOffset = (uint16_t)wOffset;
+ }
+
+
+ /**
+ * @brief Q7 Circular Read function.
+ */
+ CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q7(
+ q7_t * circBuffer,
+ int32_t L,
+ int32_t * readOffset,
+ int32_t bufferInc,
+ q7_t * dst,
+ q7_t * dst_base,
+ int32_t dst_length,
+ int32_t dstInc,
+ uint32_t blockSize)
+ {
+ uint32_t i = 0;
+ int32_t rOffset, dst_end;
+
+ /* Copy the value of Index pointer that points
+ * to the current location from where the input samples to be read */
+ rOffset = *readOffset;
+
+ dst_end = (int32_t) (dst_base + dst_length);
+
+ /* Loop over the blockSize */
+ i = blockSize;
+
+ while (i > 0U)
+ {
+ /* copy the sample from the circular buffer to the destination buffer */
+ *dst = circBuffer[rOffset];
+
+ /* Update the input pointer */
+ dst += dstInc;
+
+ if (dst == (q7_t *) dst_end)
+ {
+ dst = dst_base;
+ }
+
+ /* Circularly update rOffset. Watch out for positive and negative value */
+ rOffset += bufferInc;
+
+ if (rOffset >= L)
+ {
+ rOffset -= L;
+ }
+
+ /* Decrement the loop counter */
+ i--;
+ }
+
+ /* Update the index pointer */
+ *readOffset = rOffset;
+ }
+
+
+ /**
+ * @brief Sum of the squares of the elements of a Q31 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_power_q31(
+ q31_t * pSrc,
+ uint32_t blockSize,
+ q63_t * pResult);
+
+
+ /**
+ * @brief Sum of the squares of the elements of a floating-point vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_power_f32(
+ float32_t * pSrc,
+ uint32_t blockSize,
+ float32_t * pResult);
+
+
+ /**
+ * @brief Sum of the squares of the elements of a Q15 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_power_q15(
+ q15_t * pSrc,
+ uint32_t blockSize,
+ q63_t * pResult);
+
+
+ /**
+ * @brief Sum of the squares of the elements of a Q7 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_power_q7(
+ q7_t * pSrc,
+ uint32_t blockSize,
+ q31_t * pResult);
+
+
+ /**
+ * @brief Mean value of a Q7 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_mean_q7(
+ q7_t * pSrc,
+ uint32_t blockSize,
+ q7_t * pResult);
+
+
+ /**
+ * @brief Mean value of a Q15 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_mean_q15(
+ q15_t * pSrc,
+ uint32_t blockSize,
+ q15_t * pResult);
+
+
+ /**
+ * @brief Mean value of a Q31 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_mean_q31(
+ q31_t * pSrc,
+ uint32_t blockSize,
+ q31_t * pResult);
+
+
+ /**
+ * @brief Mean value of a floating-point vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_mean_f32(
+ float32_t * pSrc,
+ uint32_t blockSize,
+ float32_t * pResult);
+
+
+ /**
+ * @brief Variance of the elements of a floating-point vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_var_f32(
+ float32_t * pSrc,
+ uint32_t blockSize,
+ float32_t * pResult);
+
+
+ /**
+ * @brief Variance of the elements of a Q31 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_var_q31(
+ q31_t * pSrc,
+ uint32_t blockSize,
+ q31_t * pResult);
+
+
+ /**
+ * @brief Variance of the elements of a Q15 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_var_q15(
+ q15_t * pSrc,
+ uint32_t blockSize,
+ q15_t * pResult);
+
+
+ /**
+ * @brief Root Mean Square of the elements of a floating-point vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_rms_f32(
+ float32_t * pSrc,
+ uint32_t blockSize,
+ float32_t * pResult);
+
+
+ /**
+ * @brief Root Mean Square of the elements of a Q31 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_rms_q31(
+ q31_t * pSrc,
+ uint32_t blockSize,
+ q31_t * pResult);
+
+
+ /**
+ * @brief Root Mean Square of the elements of a Q15 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_rms_q15(
+ q15_t * pSrc,
+ uint32_t blockSize,
+ q15_t * pResult);
+
+
+ /**
+ * @brief Standard deviation of the elements of a floating-point vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_std_f32(
+ float32_t * pSrc,
+ uint32_t blockSize,
+ float32_t * pResult);
+
+
+ /**
+ * @brief Standard deviation of the elements of a Q31 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_std_q31(
+ q31_t * pSrc,
+ uint32_t blockSize,
+ q31_t * pResult);
+
+
+ /**
+ * @brief Standard deviation of the elements of a Q15 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output value.
+ */
+ void arm_std_q15(
+ q15_t * pSrc,
+ uint32_t blockSize,
+ q15_t * pResult);
+
+
+ /**
+ * @brief Floating-point complex magnitude
+ * @param[in] pSrc points to the complex input vector
+ * @param[out] pDst points to the real output vector
+ * @param[in] numSamples number of complex samples in the input vector
+ */
+ void arm_cmplx_mag_f32(
+ float32_t * pSrc,
+ float32_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Q31 complex magnitude
+ * @param[in] pSrc points to the complex input vector
+ * @param[out] pDst points to the real output vector
+ * @param[in] numSamples number of complex samples in the input vector
+ */
+ void arm_cmplx_mag_q31(
+ q31_t * pSrc,
+ q31_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Q15 complex magnitude
+ * @param[in] pSrc points to the complex input vector
+ * @param[out] pDst points to the real output vector
+ * @param[in] numSamples number of complex samples in the input vector
+ */
+ void arm_cmplx_mag_q15(
+ q15_t * pSrc,
+ q15_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Q15 complex dot product
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[in] numSamples number of complex samples in each vector
+ * @param[out] realResult real part of the result returned here
+ * @param[out] imagResult imaginary part of the result returned here
+ */
+ void arm_cmplx_dot_prod_q15(
+ q15_t * pSrcA,
+ q15_t * pSrcB,
+ uint32_t numSamples,
+ q31_t * realResult,
+ q31_t * imagResult);
+
+
+ /**
+ * @brief Q31 complex dot product
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[in] numSamples number of complex samples in each vector
+ * @param[out] realResult real part of the result returned here
+ * @param[out] imagResult imaginary part of the result returned here
+ */
+ void arm_cmplx_dot_prod_q31(
+ q31_t * pSrcA,
+ q31_t * pSrcB,
+ uint32_t numSamples,
+ q63_t * realResult,
+ q63_t * imagResult);
+
+
+ /**
+ * @brief Floating-point complex dot product
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[in] numSamples number of complex samples in each vector
+ * @param[out] realResult real part of the result returned here
+ * @param[out] imagResult imaginary part of the result returned here
+ */
+ void arm_cmplx_dot_prod_f32(
+ float32_t * pSrcA,
+ float32_t * pSrcB,
+ uint32_t numSamples,
+ float32_t * realResult,
+ float32_t * imagResult);
+
+
+ /**
+ * @brief Q15 complex-by-real multiplication
+ * @param[in] pSrcCmplx points to the complex input vector
+ * @param[in] pSrcReal points to the real input vector
+ * @param[out] pCmplxDst points to the complex output vector
+ * @param[in] numSamples number of samples in each vector
+ */
+ void arm_cmplx_mult_real_q15(
+ q15_t * pSrcCmplx,
+ q15_t * pSrcReal,
+ q15_t * pCmplxDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Q31 complex-by-real multiplication
+ * @param[in] pSrcCmplx points to the complex input vector
+ * @param[in] pSrcReal points to the real input vector
+ * @param[out] pCmplxDst points to the complex output vector
+ * @param[in] numSamples number of samples in each vector
+ */
+ void arm_cmplx_mult_real_q31(
+ q31_t * pSrcCmplx,
+ q31_t * pSrcReal,
+ q31_t * pCmplxDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Floating-point complex-by-real multiplication
+ * @param[in] pSrcCmplx points to the complex input vector
+ * @param[in] pSrcReal points to the real input vector
+ * @param[out] pCmplxDst points to the complex output vector
+ * @param[in] numSamples number of samples in each vector
+ */
+ void arm_cmplx_mult_real_f32(
+ float32_t * pSrcCmplx,
+ float32_t * pSrcReal,
+ float32_t * pCmplxDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Minimum value of a Q7 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] result is output pointer
+ * @param[in] index is the array index of the minimum value in the input buffer.
+ */
+ void arm_min_q7(
+ q7_t * pSrc,
+ uint32_t blockSize,
+ q7_t * result,
+ uint32_t * index);
+
+
+ /**
+ * @brief Minimum value of a Q15 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output pointer
+ * @param[in] pIndex is the array index of the minimum value in the input buffer.
+ */
+ void arm_min_q15(
+ q15_t * pSrc,
+ uint32_t blockSize,
+ q15_t * pResult,
+ uint32_t * pIndex);
+
+
+ /**
+ * @brief Minimum value of a Q31 vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output pointer
+ * @param[out] pIndex is the array index of the minimum value in the input buffer.
+ */
+ void arm_min_q31(
+ q31_t * pSrc,
+ uint32_t blockSize,
+ q31_t * pResult,
+ uint32_t * pIndex);
+
+
+ /**
+ * @brief Minimum value of a floating-point vector.
+ * @param[in] pSrc is input pointer
+ * @param[in] blockSize is the number of samples to process
+ * @param[out] pResult is output pointer
+ * @param[out] pIndex is the array index of the minimum value in the input buffer.
+ */
+ void arm_min_f32(
+ float32_t * pSrc,
+ uint32_t blockSize,
+ float32_t * pResult,
+ uint32_t * pIndex);
+
+
+/**
+ * @brief Maximum value of a Q7 vector.
+ * @param[in] pSrc points to the input buffer
+ * @param[in] blockSize length of the input vector
+ * @param[out] pResult maximum value returned here
+ * @param[out] pIndex index of maximum value returned here
+ */
+ void arm_max_q7(
+ q7_t * pSrc,
+ uint32_t blockSize,
+ q7_t * pResult,
+ uint32_t * pIndex);
+
+
+/**
+ * @brief Maximum value of a Q15 vector.
+ * @param[in] pSrc points to the input buffer
+ * @param[in] blockSize length of the input vector
+ * @param[out] pResult maximum value returned here
+ * @param[out] pIndex index of maximum value returned here
+ */
+ void arm_max_q15(
+ q15_t * pSrc,
+ uint32_t blockSize,
+ q15_t * pResult,
+ uint32_t * pIndex);
+
+
+/**
+ * @brief Maximum value of a Q31 vector.
+ * @param[in] pSrc points to the input buffer
+ * @param[in] blockSize length of the input vector
+ * @param[out] pResult maximum value returned here
+ * @param[out] pIndex index of maximum value returned here
+ */
+ void arm_max_q31(
+ q31_t * pSrc,
+ uint32_t blockSize,
+ q31_t * pResult,
+ uint32_t * pIndex);
+
+
+/**
+ * @brief Maximum value of a floating-point vector.
+ * @param[in] pSrc points to the input buffer
+ * @param[in] blockSize length of the input vector
+ * @param[out] pResult maximum value returned here
+ * @param[out] pIndex index of maximum value returned here
+ */
+ void arm_max_f32(
+ float32_t * pSrc,
+ uint32_t blockSize,
+ float32_t * pResult,
+ uint32_t * pIndex);
+
+
+ /**
+ * @brief Q15 complex-by-complex multiplication
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] numSamples number of complex samples in each vector
+ */
+ void arm_cmplx_mult_cmplx_q15(
+ q15_t * pSrcA,
+ q15_t * pSrcB,
+ q15_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Q31 complex-by-complex multiplication
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] numSamples number of complex samples in each vector
+ */
+ void arm_cmplx_mult_cmplx_q31(
+ q31_t * pSrcA,
+ q31_t * pSrcB,
+ q31_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Floating-point complex-by-complex multiplication
+ * @param[in] pSrcA points to the first input vector
+ * @param[in] pSrcB points to the second input vector
+ * @param[out] pDst points to the output vector
+ * @param[in] numSamples number of complex samples in each vector
+ */
+ void arm_cmplx_mult_cmplx_f32(
+ float32_t * pSrcA,
+ float32_t * pSrcB,
+ float32_t * pDst,
+ uint32_t numSamples);
+
+
+ /**
+ * @brief Converts the elements of the floating-point vector to Q31 vector.
+ * @param[in] pSrc points to the floating-point input vector
+ * @param[out] pDst points to the Q31 output vector
+ * @param[in] blockSize length of the input vector
+ */
+ void arm_float_to_q31(
+ float32_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Converts the elements of the floating-point vector to Q15 vector.
+ * @param[in] pSrc points to the floating-point input vector
+ * @param[out] pDst points to the Q15 output vector
+ * @param[in] blockSize length of the input vector
+ */
+ void arm_float_to_q15(
+ float32_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Converts the elements of the floating-point vector to Q7 vector.
+ * @param[in] pSrc points to the floating-point input vector
+ * @param[out] pDst points to the Q7 output vector
+ * @param[in] blockSize length of the input vector
+ */
+ void arm_float_to_q7(
+ float32_t * pSrc,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Converts the elements of the Q31 vector to Q15 vector.
+ * @param[in] pSrc is input pointer
+ * @param[out] pDst is output pointer
+ * @param[in] blockSize is the number of samples to process
+ */
+ void arm_q31_to_q15(
+ q31_t * pSrc,
+ q15_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Converts the elements of the Q31 vector to Q7 vector.
+ * @param[in] pSrc is input pointer
+ * @param[out] pDst is output pointer
+ * @param[in] blockSize is the number of samples to process
+ */
+ void arm_q31_to_q7(
+ q31_t * pSrc,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Converts the elements of the Q15 vector to floating-point vector.
+ * @param[in] pSrc is input pointer
+ * @param[out] pDst is output pointer
+ * @param[in] blockSize is the number of samples to process
+ */
+ void arm_q15_to_float(
+ q15_t * pSrc,
+ float32_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Converts the elements of the Q15 vector to Q31 vector.
+ * @param[in] pSrc is input pointer
+ * @param[out] pDst is output pointer
+ * @param[in] blockSize is the number of samples to process
+ */
+ void arm_q15_to_q31(
+ q15_t * pSrc,
+ q31_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @brief Converts the elements of the Q15 vector to Q7 vector.
+ * @param[in] pSrc is input pointer
+ * @param[out] pDst is output pointer
+ * @param[in] blockSize is the number of samples to process
+ */
+ void arm_q15_to_q7(
+ q15_t * pSrc,
+ q7_t * pDst,
+ uint32_t blockSize);
+
+
+ /**
+ * @ingroup groupInterpolation
+ */
+
+ /**
+ * @defgroup BilinearInterpolate Bilinear Interpolation
+ *
+ * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
+ * The underlying function f(x, y)
is sampled on a regular grid and the interpolation process
+ * determines values between the grid points.
+ * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
+ * Bilinear interpolation is often used in image processing to rescale images.
+ * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
+ *
+ * Algorithm
+ * \par
+ * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
+ * For floating-point, the instance structure is defined as:
+ *
+ * typedef struct
+ * {
+ * uint16_t numRows;
+ * uint16_t numCols;
+ * float32_t *pData;
+ * } arm_bilinear_interp_instance_f32;
+ *
+ *
+ * \par
+ * where numRows
specifies the number of rows in the table;
+ * numCols
specifies the number of columns in the table;
+ * and pData
points to an array of size numRows*numCols
values.
+ * The data table pTable
is organized in row order and the supplied data values fall on integer indexes.
+ * That is, table element (x,y) is located at pTable[x + y*numCols]
where x and y are integers.
+ *
+ * \par
+ * Let (x, y)
specify the desired interpolation point. Then define:
+ *
+ * XF = floor(x)
+ * YF = floor(y)
+ *
+ * \par
+ * The interpolated output point is computed as:
+ *
+ * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
+ * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
+ * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
+ * + f(XF+1, YF+1) * (x-XF)*(y-YF)
+ *
+ * Note that the coordinates (x, y) contain integer and fractional components.
+ * The integer components specify which portion of the table to use while the
+ * fractional components control the interpolation processor.
+ *
+ * \par
+ * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
+ */
+
+ /**
+ * @addtogroup BilinearInterpolate
+ * @{
+ */
+
+
+ /**
+ *
+ * @brief Floating-point bilinear interpolation.
+ * @param[in,out] S points to an instance of the interpolation structure.
+ * @param[in] X interpolation coordinate.
+ * @param[in] Y interpolation coordinate.
+ * @return out interpolated value.
+ */
+ CMSIS_INLINE __STATIC_INLINE float32_t arm_bilinear_interp_f32(
+ const arm_bilinear_interp_instance_f32 * S,
+ float32_t X,
+ float32_t Y)
+ {
+ float32_t out;
+ float32_t f00, f01, f10, f11;
+ float32_t *pData = S->pData;
+ int32_t xIndex, yIndex, index;
+ float32_t xdiff, ydiff;
+ float32_t b1, b2, b3, b4;
+
+ xIndex = (int32_t) X;
+ yIndex = (int32_t) Y;
+
+ /* Care taken for table outside boundary */
+ /* Returns zero output when values are outside table boundary */
+ if (xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 || yIndex > (S->numCols - 1))
+ {
+ return (0);
+ }
+
+ /* Calculation of index for two nearest points in X-direction */
+ index = (xIndex - 1) + (yIndex - 1) * S->numCols;
+
+
+ /* Read two nearest points in X-direction */
+ f00 = pData[index];
+ f01 = pData[index + 1];
+
+ /* Calculation of index for two nearest points in Y-direction */
+ index = (xIndex - 1) + (yIndex) * S->numCols;
+
+
+ /* Read two nearest points in Y-direction */
+ f10 = pData[index];
+ f11 = pData[index + 1];
+
+ /* Calculation of intermediate values */
+ b1 = f00;
+ b2 = f01 - f00;
+ b3 = f10 - f00;
+ b4 = f00 - f01 - f10 + f11;
+
+ /* Calculation of fractional part in X */
+ xdiff = X - xIndex;
+
+ /* Calculation of fractional part in Y */
+ ydiff = Y - yIndex;
+
+ /* Calculation of bi-linear interpolated output */
+ out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
+
+ /* return to application */
+ return (out);
+ }
+
+
+ /**
+ *
+ * @brief Q31 bilinear interpolation.
+ * @param[in,out] S points to an instance of the interpolation structure.
+ * @param[in] X interpolation coordinate in 12.20 format.
+ * @param[in] Y interpolation coordinate in 12.20 format.
+ * @return out interpolated value.
+ */
+ CMSIS_INLINE __STATIC_INLINE q31_t arm_bilinear_interp_q31(
+ arm_bilinear_interp_instance_q31 * S,
+ q31_t X,
+ q31_t Y)
+ {
+ q31_t out; /* Temporary output */
+ q31_t acc = 0; /* output */
+ q31_t xfract, yfract; /* X, Y fractional parts */
+ q31_t x1, x2, y1, y2; /* Nearest output values */
+ int32_t rI, cI; /* Row and column indices */
+ q31_t *pYData = S->pData; /* pointer to output table values */
+ uint32_t nCols = S->numCols; /* num of rows */
+
+ /* Input is in 12.20 format */
+ /* 12 bits for the table index */
+ /* Index value calculation */
+ rI = ((X & (q31_t)0xFFF00000) >> 20);
+
+ /* Input is in 12.20 format */
+ /* 12 bits for the table index */
+ /* Index value calculation */
+ cI = ((Y & (q31_t)0xFFF00000) >> 20);
+
+ /* Care taken for table outside boundary */
+ /* Returns zero output when values are outside table boundary */
+ if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
+ {
+ return (0);
+ }
+
+ /* 20 bits for the fractional part */
+ /* shift left xfract by 11 to keep 1.31 format */
+ xfract = (X & 0x000FFFFF) << 11U;
+
+ /* Read two nearest output values from the index */
+ x1 = pYData[(rI) + (int32_t)nCols * (cI) ];
+ x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1];
+
+ /* 20 bits for the fractional part */
+ /* shift left yfract by 11 to keep 1.31 format */
+ yfract = (Y & 0x000FFFFF) << 11U;
+
+ /* Read two nearest output values from the index */
+ y1 = pYData[(rI) + (int32_t)nCols * (cI + 1) ];
+ y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1];
+
+ /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
+ out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
+ acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
+
+ /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
+ out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
+ acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
+
+ /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
+ out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
+ acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
+
+ /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
+ out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
+ acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
+
+ /* Convert acc to 1.31(q31) format */
+ return ((q31_t)(acc << 2));
+ }
+
+
+ /**
+ * @brief Q15 bilinear interpolation.
+ * @param[in,out] S points to an instance of the interpolation structure.
+ * @param[in] X interpolation coordinate in 12.20 format.
+ * @param[in] Y interpolation coordinate in 12.20 format.
+ * @return out interpolated value.
+ */
+ CMSIS_INLINE __STATIC_INLINE q15_t arm_bilinear_interp_q15(
+ arm_bilinear_interp_instance_q15 * S,
+ q31_t X,
+ q31_t Y)
+ {
+ q63_t acc = 0; /* output */
+ q31_t out; /* Temporary output */
+ q15_t x1, x2, y1, y2; /* Nearest output values */
+ q31_t xfract, yfract; /* X, Y fractional parts */
+ int32_t rI, cI; /* Row and column indices */
+ q15_t *pYData = S->pData; /* pointer to output table values */
+ uint32_t nCols = S->numCols; /* num of rows */
+
+ /* Input is in 12.20 format */
+ /* 12 bits for the table index */
+ /* Index value calculation */
+ rI = ((X & (q31_t)0xFFF00000) >> 20);
+
+ /* Input is in 12.20 format */
+ /* 12 bits for the table index */
+ /* Index value calculation */
+ cI = ((Y & (q31_t)0xFFF00000) >> 20);
+
+ /* Care taken for table outside boundary */
+ /* Returns zero output when values are outside table boundary */
+ if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
+ {
+ return (0);
+ }
+
+ /* 20 bits for the fractional part */
+ /* xfract should be in 12.20 format */
+ xfract = (X & 0x000FFFFF);
+
+ /* Read two nearest output values from the index */
+ x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
+ x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
+
+ /* 20 bits for the fractional part */
+ /* yfract should be in 12.20 format */
+ yfract = (Y & 0x000FFFFF);
+
+ /* Read two nearest output values from the index */
+ y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
+ y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
+
+ /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
+
+ /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
+ /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
+ out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4U);
+ acc = ((q63_t) out * (0xFFFFF - yfract));
+
+ /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
+ out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4U);
+ acc += ((q63_t) out * (xfract));
+
+ /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
+ out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4U);
+ acc += ((q63_t) out * (yfract));
+
+ /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
+ out = (q31_t) (((q63_t) y2 * (xfract)) >> 4U);
+ acc += ((q63_t) out * (yfract));
+
+ /* acc is in 13.51 format and down shift acc by 36 times */
+ /* Convert out to 1.15 format */
+ return ((q15_t)(acc >> 36));
+ }
+
+
+ /**
+ * @brief Q7 bilinear interpolation.
+ * @param[in,out] S points to an instance of the interpolation structure.
+ * @param[in] X interpolation coordinate in 12.20 format.
+ * @param[in] Y interpolation coordinate in 12.20 format.
+ * @return out interpolated value.
+ */
+ CMSIS_INLINE __STATIC_INLINE q7_t arm_bilinear_interp_q7(
+ arm_bilinear_interp_instance_q7 * S,
+ q31_t X,
+ q31_t Y)
+ {
+ q63_t acc = 0; /* output */
+ q31_t out; /* Temporary output */
+ q31_t xfract, yfract; /* X, Y fractional parts */
+ q7_t x1, x2, y1, y2; /* Nearest output values */
+ int32_t rI, cI; /* Row and column indices */
+ q7_t *pYData = S->pData; /* pointer to output table values */
+ uint32_t nCols = S->numCols; /* num of rows */
+
+ /* Input is in 12.20 format */
+ /* 12 bits for the table index */
+ /* Index value calculation */
+ rI = ((X & (q31_t)0xFFF00000) >> 20);
+
+ /* Input is in 12.20 format */
+ /* 12 bits for the table index */
+ /* Index value calculation */
+ cI = ((Y & (q31_t)0xFFF00000) >> 20);
+
+ /* Care taken for table outside boundary */
+ /* Returns zero output when values are outside table boundary */
+ if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
+ {
+ return (0);
+ }
+
+ /* 20 bits for the fractional part */
+ /* xfract should be in 12.20 format */
+ xfract = (X & (q31_t)0x000FFFFF);
+
+ /* Read two nearest output values from the index */
+ x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ];
+ x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
+
+ /* 20 bits for the fractional part */
+ /* yfract should be in 12.20 format */
+ yfract = (Y & (q31_t)0x000FFFFF);
+
+ /* Read two nearest output values from the index */
+ y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ];
+ y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
+
+ /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
+ out = ((x1 * (0xFFFFF - xfract)));
+ acc = (((q63_t) out * (0xFFFFF - yfract)));
+
+ /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
+ out = ((x2 * (0xFFFFF - yfract)));
+ acc += (((q63_t) out * (xfract)));
+
+ /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
+ out = ((y1 * (0xFFFFF - xfract)));
+ acc += (((q63_t) out * (yfract)));
+
+ /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
+ out = ((y2 * (yfract)));
+ acc += (((q63_t) out * (xfract)));
+
+ /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
+ return ((q7_t)(acc >> 40));
+ }
+
+ /**
+ * @} end of BilinearInterpolate group
+ */
+
+
+/* SMMLAR */
+#define multAcc_32x32_keep32_R(a, x, y) \
+ a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
+
+/* SMMLSR */
+#define multSub_32x32_keep32_R(a, x, y) \
+ a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
+
+/* SMMULR */
+#define mult_32x32_keep32_R(a, x, y) \
+ a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
+
+/* SMMLA */
+#define multAcc_32x32_keep32(a, x, y) \
+ a += (q31_t) (((q63_t) x * y) >> 32)
+
+/* SMMLS */
+#define multSub_32x32_keep32(a, x, y) \
+ a -= (q31_t) (((q63_t) x * y) >> 32)
+
+/* SMMUL */
+#define mult_32x32_keep32(a, x, y) \
+ a = (q31_t) (((q63_t) x * y ) >> 32)
+
+
+#if defined ( __CC_ARM )
+ /* Enter low optimization region - place directly above function definition */
+ #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7)
+ #define LOW_OPTIMIZATION_ENTER \
+ _Pragma ("push") \
+ _Pragma ("O1")
+ #else
+ #define LOW_OPTIMIZATION_ENTER
+ #endif
+
+ /* Exit low optimization region - place directly after end of function definition */
+ #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
+ #define LOW_OPTIMIZATION_EXIT \
+ _Pragma ("pop")
+ #else
+ #define LOW_OPTIMIZATION_EXIT
+ #endif
+
+ /* Enter low optimization region - place directly above function definition */
+ #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
+
+ /* Exit low optimization region - place directly after end of function definition */
+ #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
+
+#elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
+ #define LOW_OPTIMIZATION_ENTER
+ #define LOW_OPTIMIZATION_EXIT
+ #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
+ #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
+
+#elif defined ( __GNUC__ )
+ #define LOW_OPTIMIZATION_ENTER \
+ __attribute__(( optimize("-O1") ))
+ #define LOW_OPTIMIZATION_EXIT
+ #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
+ #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
+
+#elif defined ( __ICCARM__ )
+ /* Enter low optimization region - place directly above function definition */
+ #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
+ #define LOW_OPTIMIZATION_ENTER \
+ _Pragma ("optimize=low")
+ #else
+ #define LOW_OPTIMIZATION_ENTER
+ #endif
+
+ /* Exit low optimization region - place directly after end of function definition */
+ #define LOW_OPTIMIZATION_EXIT
+
+ /* Enter low optimization region - place directly above function definition */
+ #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 )
+ #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
+ _Pragma ("optimize=low")
+ #else
+ #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
+ #endif
+
+ /* Exit low optimization region - place directly after end of function definition */
+ #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
+
+#elif defined ( __TI_ARM__ )
+ #define LOW_OPTIMIZATION_ENTER
+ #define LOW_OPTIMIZATION_EXIT
+ #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
+ #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
+
+#elif defined ( __CSMC__ )
+ #define LOW_OPTIMIZATION_ENTER
+ #define LOW_OPTIMIZATION_EXIT
+ #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
+ #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
+
+#elif defined ( __TASKING__ )
+ #define LOW_OPTIMIZATION_ENTER
+ #define LOW_OPTIMIZATION_EXIT
+ #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
+ #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Compiler specific diagnostic adjustment */
+#if defined ( __CC_ARM )
+
+#elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
+
+#elif defined ( __GNUC__ )
+#pragma GCC diagnostic pop
+
+#elif defined ( __ICCARM__ )
+
+#elif defined ( __TI_ARM__ )
+
+#elif defined ( __CSMC__ )
+
+#elif defined ( __TASKING__ )
+
+#else
+ #error Unknown compiler
+#endif
+
+#endif /* _ARM_MATH_H */
+
+/**
+ *
+ * End of file.
+ */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armcc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armcc.h
new file mode 100644
index 0000000000000000000000000000000000000000..093d35b9e5cfe6477ce7a71c842af5f35dabf5c8
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armcc.h
@@ -0,0 +1,870 @@
+/**************************************************************************//**
+ * @file cmsis_armcc.h
+ * @brief CMSIS compiler ARMCC (Arm Compiler 5) header file
+ * @version V5.0.4
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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 __CMSIS_ARMCC_H
+#define __CMSIS_ARMCC_H
+
+
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677)
+ #error "Please use Arm Compiler Toolchain V4.0.677 or later!"
+#endif
+
+/* CMSIS compiler control architecture macros */
+#if ((defined (__TARGET_ARCH_6_M ) && (__TARGET_ARCH_6_M == 1)) || \
+ (defined (__TARGET_ARCH_6S_M ) && (__TARGET_ARCH_6S_M == 1)) )
+ #define __ARM_ARCH_6M__ 1
+#endif
+
+#if (defined (__TARGET_ARCH_7_M ) && (__TARGET_ARCH_7_M == 1))
+ #define __ARM_ARCH_7M__ 1
+#endif
+
+#if (defined (__TARGET_ARCH_7E_M) && (__TARGET_ARCH_7E_M == 1))
+ #define __ARM_ARCH_7EM__ 1
+#endif
+
+ /* __ARM_ARCH_8M_BASE__ not applicable */
+ /* __ARM_ARCH_8M_MAIN__ not applicable */
+
+
+/* CMSIS compiler specific defines */
+#ifndef __ASM
+ #define __ASM __asm
+#endif
+#ifndef __INLINE
+ #define __INLINE __inline
+#endif
+#ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static __inline
+#endif
+#ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE static __forceinline
+#endif
+#ifndef __NO_RETURN
+ #define __NO_RETURN __declspec(noreturn)
+#endif
+#ifndef __USED
+ #define __USED __attribute__((used))
+#endif
+#ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+#endif
+#ifndef __PACKED
+ #define __PACKED __attribute__((packed))
+#endif
+#ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT __packed struct
+#endif
+#ifndef __PACKED_UNION
+ #define __PACKED_UNION __packed union
+#endif
+#ifndef __UNALIGNED_UINT32 /* deprecated */
+ #define __UNALIGNED_UINT32(x) (*((__packed uint32_t *)(x)))
+#endif
+#ifndef __UNALIGNED_UINT16_WRITE
+ #define __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val))
+#endif
+#ifndef __UNALIGNED_UINT16_READ
+ #define __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr)))
+#endif
+#ifndef __UNALIGNED_UINT32_WRITE
+ #define __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val))
+#endif
+#ifndef __UNALIGNED_UINT32_READ
+ #define __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr)))
+#endif
+#ifndef __ALIGNED
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+#endif
+#ifndef __RESTRICT
+ #define __RESTRICT __restrict
+#endif
+
+/* ########################### Core Function Access ########################### */
+/** \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
+ @{
+ */
+
+/**
+ \brief Enable IRQ Interrupts
+ \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+/* intrinsic void __enable_irq(); */
+
+
+/**
+ \brief Disable IRQ Interrupts
+ \details Disables IRQ interrupts by setting the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+/* intrinsic void __disable_irq(); */
+
+/**
+ \brief Get Control Register
+ \details Returns the content of the Control Register.
+ \return Control Register value
+ */
+__STATIC_INLINE uint32_t __get_CONTROL(void)
+{
+ register uint32_t __regControl __ASM("control");
+ return(__regControl);
+}
+
+
+/**
+ \brief Set Control Register
+ \details Writes the given value to the Control Register.
+ \param [in] control Control Register value to set
+ */
+__STATIC_INLINE void __set_CONTROL(uint32_t control)
+{
+ register uint32_t __regControl __ASM("control");
+ __regControl = control;
+}
+
+
+/**
+ \brief Get IPSR Register
+ \details Returns the content of the IPSR Register.
+ \return IPSR Register value
+ */
+__STATIC_INLINE uint32_t __get_IPSR(void)
+{
+ register uint32_t __regIPSR __ASM("ipsr");
+ return(__regIPSR);
+}
+
+
+/**
+ \brief Get APSR Register
+ \details Returns the content of the APSR Register.
+ \return APSR Register value
+ */
+__STATIC_INLINE uint32_t __get_APSR(void)
+{
+ register uint32_t __regAPSR __ASM("apsr");
+ return(__regAPSR);
+}
+
+
+/**
+ \brief Get xPSR Register
+ \details Returns the content of the xPSR Register.
+ \return xPSR Register value
+ */
+__STATIC_INLINE uint32_t __get_xPSR(void)
+{
+ register uint32_t __regXPSR __ASM("xpsr");
+ return(__regXPSR);
+}
+
+
+/**
+ \brief Get Process Stack Pointer
+ \details Returns the current value of the Process Stack Pointer (PSP).
+ \return PSP Register value
+ */
+__STATIC_INLINE uint32_t __get_PSP(void)
+{
+ register uint32_t __regProcessStackPointer __ASM("psp");
+ return(__regProcessStackPointer);
+}
+
+
+/**
+ \brief Set Process Stack Pointer
+ \details Assigns the given value to the Process Stack Pointer (PSP).
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
+{
+ register uint32_t __regProcessStackPointer __ASM("psp");
+ __regProcessStackPointer = topOfProcStack;
+}
+
+
+/**
+ \brief Get Main Stack Pointer
+ \details Returns the current value of the Main Stack Pointer (MSP).
+ \return MSP Register value
+ */
+__STATIC_INLINE uint32_t __get_MSP(void)
+{
+ register uint32_t __regMainStackPointer __ASM("msp");
+ return(__regMainStackPointer);
+}
+
+
+/**
+ \brief Set Main Stack Pointer
+ \details Assigns the given value to the Main Stack Pointer (MSP).
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
+{
+ register uint32_t __regMainStackPointer __ASM("msp");
+ __regMainStackPointer = topOfMainStack;
+}
+
+
+/**
+ \brief Get Priority Mask
+ \details Returns the current state of the priority mask bit from the Priority Mask Register.
+ \return Priority Mask value
+ */
+__STATIC_INLINE uint32_t __get_PRIMASK(void)
+{
+ register uint32_t __regPriMask __ASM("primask");
+ return(__regPriMask);
+}
+
+
+/**
+ \brief Set Priority Mask
+ \details Assigns the given value to the Priority Mask Register.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
+{
+ register uint32_t __regPriMask __ASM("primask");
+ __regPriMask = (priMask);
+}
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
+
+/**
+ \brief Enable FIQ
+ \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __enable_fault_irq __enable_fiq
+
+
+/**
+ \brief Disable FIQ
+ \details Disables FIQ interrupts by setting the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __disable_fault_irq __disable_fiq
+
+
+/**
+ \brief Get Base Priority
+ \details Returns the current value of the Base Priority register.
+ \return Base Priority register value
+ */
+__STATIC_INLINE uint32_t __get_BASEPRI(void)
+{
+ register uint32_t __regBasePri __ASM("basepri");
+ return(__regBasePri);
+}
+
+
+/**
+ \brief Set Base Priority
+ \details Assigns the given value to the Base Priority register.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
+{
+ register uint32_t __regBasePri __ASM("basepri");
+ __regBasePri = (basePri & 0xFFU);
+}
+
+
+/**
+ \brief Set Base Priority with condition
+ \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
+ or the new value increases the BASEPRI priority level.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri)
+{
+ register uint32_t __regBasePriMax __ASM("basepri_max");
+ __regBasePriMax = (basePri & 0xFFU);
+}
+
+
+/**
+ \brief Get Fault Mask
+ \details Returns the current value of the Fault Mask register.
+ \return Fault Mask register value
+ */
+__STATIC_INLINE uint32_t __get_FAULTMASK(void)
+{
+ register uint32_t __regFaultMask __ASM("faultmask");
+ return(__regFaultMask);
+}
+
+
+/**
+ \brief Set Fault Mask
+ \details Assigns the given value to the Fault Mask register.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+ register uint32_t __regFaultMask __ASM("faultmask");
+ __regFaultMask = (faultMask & (uint32_t)1U);
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
+
+/**
+ \brief Get FPSCR
+ \details Returns the current value of the Floating Point Status/Control register.
+ \return Floating Point Status/Control register value
+ */
+__STATIC_INLINE uint32_t __get_FPSCR(void)
+{
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+ register uint32_t __regfpscr __ASM("fpscr");
+ return(__regfpscr);
+#else
+ return(0U);
+#endif
+}
+
+
+/**
+ \brief Set FPSCR
+ \details Assigns the given value to the Floating Point Status/Control register.
+ \param [in] fpscr Floating Point Status/Control value to set
+ */
+__STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
+{
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+ register uint32_t __regfpscr __ASM("fpscr");
+ __regfpscr = (fpscr);
+#else
+ (void)fpscr;
+#endif
+}
+
+#endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
+
+
+
+/*@} end of CMSIS_Core_RegAccFunctions */
+
+
+/* ########################## Core Instruction Access ######################### */
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
+ Access to dedicated instructions
+ @{
+*/
+
+/**
+ \brief No Operation
+ \details No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+#define __NOP __nop
+
+
+/**
+ \brief Wait For Interrupt
+ \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
+ */
+#define __WFI __wfi
+
+
+/**
+ \brief Wait For Event
+ \details Wait For Event is a hint instruction that permits the processor to enter
+ a low-power state until one of a number of events occurs.
+ */
+#define __WFE __wfe
+
+
+/**
+ \brief Send Event
+ \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+#define __SEV __sev
+
+
+/**
+ \brief Instruction Synchronization Barrier
+ \details Instruction Synchronization Barrier flushes the pipeline in the processor,
+ so that all instructions following the ISB are fetched from cache or memory,
+ after the instruction has been completed.
+ */
+#define __ISB() do {\
+ __schedule_barrier();\
+ __isb(0xF);\
+ __schedule_barrier();\
+ } while (0U)
+
+/**
+ \brief Data Synchronization Barrier
+ \details Acts as a special kind of Data Memory Barrier.
+ It completes when all explicit memory accesses before this instruction complete.
+ */
+#define __DSB() do {\
+ __schedule_barrier();\
+ __dsb(0xF);\
+ __schedule_barrier();\
+ } while (0U)
+
+/**
+ \brief Data Memory Barrier
+ \details Ensures the apparent order of the explicit memory operations before
+ and after the instruction, without ensuring their completion.
+ */
+#define __DMB() do {\
+ __schedule_barrier();\
+ __dmb(0xF);\
+ __schedule_barrier();\
+ } while (0U)
+
+
+/**
+ \brief Reverse byte order (32 bit)
+ \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REV __rev
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#ifndef __NO_EMBEDDED_ASM
+__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
+{
+ rev16 r0, r0
+ bx lr
+}
+#endif
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#ifndef __NO_EMBEDDED_ASM
+__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int16_t __REVSH(int16_t value)
+{
+ revsh r0, r0
+ bx lr
+}
+#endif
+
+
+/**
+ \brief Rotate Right in unsigned value (32 bit)
+ \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+ \param [in] op1 Value to rotate
+ \param [in] op2 Number of Bits to rotate
+ \return Rotated value
+ */
+#define __ROR __ror
+
+
+/**
+ \brief Breakpoint
+ \details Causes the processor to enter Debug state.
+ Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+ \param [in] value is ignored by the processor.
+ If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value) __breakpoint(value)
+
+
+/**
+ \brief Reverse bit order of value
+ \details Reverses the bit order of the given value.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
+ #define __RBIT __rbit
+#else
+__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
+{
+ uint32_t result;
+ uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */
+
+ result = value; /* r will be reversed bits of v; first get LSB of v */
+ for (value >>= 1U; value != 0U; value >>= 1U)
+ {
+ result <<= 1U;
+ result |= value & 1U;
+ s--;
+ }
+ result <<= s; /* shift when v's highest bits are zero */
+ return result;
+}
+#endif
+
+
+/**
+ \brief Count leading zeros
+ \details Counts the number of leading zeros of a data value.
+ \param [in] value Value to count the leading zeros
+ \return number of leading zeros in value
+ */
+#define __CLZ __clz
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
+
+/**
+ \brief LDR Exclusive (8 bit)
+ \details Executes a exclusive LDR instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
+#else
+ #define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop")
+#endif
+
+
+/**
+ \brief LDR Exclusive (16 bit)
+ \details Executes a exclusive LDR instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
+#else
+ #define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop")
+#endif
+
+
+/**
+ \brief LDR Exclusive (32 bit)
+ \details Executes a exclusive LDR instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
+#else
+ #define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop")
+#endif
+
+
+/**
+ \brief STR Exclusive (8 bit)
+ \details Executes a exclusive STR instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __STREXB(value, ptr) __strex(value, ptr)
+#else
+ #define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
+#endif
+
+
+/**
+ \brief STR Exclusive (16 bit)
+ \details Executes a exclusive STR instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __STREXH(value, ptr) __strex(value, ptr)
+#else
+ #define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
+#endif
+
+
+/**
+ \brief STR Exclusive (32 bit)
+ \details Executes a exclusive STR instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __STREXW(value, ptr) __strex(value, ptr)
+#else
+ #define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
+#endif
+
+
+/**
+ \brief Remove the exclusive lock
+ \details Removes the exclusive lock which is created by LDREX.
+ */
+#define __CLREX __clrex
+
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+#define __SSAT __ssat
+
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+#define __USAT __usat
+
+
+/**
+ \brief Rotate Right with Extend (32 bit)
+ \details Moves each bit of a bitstring right by one bit.
+ The carry input is shifted in at the left end of the bitstring.
+ \param [in] value Value to rotate
+ \return Rotated value
+ */
+#ifndef __NO_EMBEDDED_ASM
+__attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value)
+{
+ rrx r0, r0
+ bx lr
+}
+#endif
+
+
+/**
+ \brief LDRT Unprivileged (8 bit)
+ \details Executes a Unprivileged LDRT instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr))
+
+
+/**
+ \brief LDRT Unprivileged (16 bit)
+ \details Executes a Unprivileged LDRT instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#define __LDRHT(ptr) ((uint16_t) __ldrt(ptr))
+
+
+/**
+ \brief LDRT Unprivileged (32 bit)
+ \details Executes a Unprivileged LDRT instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#define __LDRT(ptr) ((uint32_t ) __ldrt(ptr))
+
+
+/**
+ \brief STRT Unprivileged (8 bit)
+ \details Executes a Unprivileged STRT instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+#define __STRBT(value, ptr) __strt(value, ptr)
+
+
+/**
+ \brief STRT Unprivileged (16 bit)
+ \details Executes a Unprivileged STRT instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+#define __STRHT(value, ptr) __strt(value, ptr)
+
+
+/**
+ \brief STRT Unprivileged (32 bit)
+ \details Executes a Unprivileged STRT instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+#define __STRT(value, ptr) __strt(value, ptr)
+
+#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+__attribute__((always_inline)) __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat)
+{
+ if ((sat >= 1U) && (sat <= 32U))
+ {
+ const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
+ const int32_t min = -1 - max ;
+ if (val > max)
+ {
+ return max;
+ }
+ else if (val < min)
+ {
+ return min;
+ }
+ }
+ return val;
+}
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat)
+{
+ if (sat <= 31U)
+ {
+ const uint32_t max = ((1U << sat) - 1U);
+ if (val > (int32_t)max)
+ {
+ return max;
+ }
+ else if (val < 0)
+ {
+ return 0U;
+ }
+ }
+ return (uint32_t)val;
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
+
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
+
+
+/* ################### Compiler specific Intrinsics ########################### */
+/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
+ Access to dedicated SIMD instructions
+ @{
+*/
+
+#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
+
+#define __SADD8 __sadd8
+#define __QADD8 __qadd8
+#define __SHADD8 __shadd8
+#define __UADD8 __uadd8
+#define __UQADD8 __uqadd8
+#define __UHADD8 __uhadd8
+#define __SSUB8 __ssub8
+#define __QSUB8 __qsub8
+#define __SHSUB8 __shsub8
+#define __USUB8 __usub8
+#define __UQSUB8 __uqsub8
+#define __UHSUB8 __uhsub8
+#define __SADD16 __sadd16
+#define __QADD16 __qadd16
+#define __SHADD16 __shadd16
+#define __UADD16 __uadd16
+#define __UQADD16 __uqadd16
+#define __UHADD16 __uhadd16
+#define __SSUB16 __ssub16
+#define __QSUB16 __qsub16
+#define __SHSUB16 __shsub16
+#define __USUB16 __usub16
+#define __UQSUB16 __uqsub16
+#define __UHSUB16 __uhsub16
+#define __SASX __sasx
+#define __QASX __qasx
+#define __SHASX __shasx
+#define __UASX __uasx
+#define __UQASX __uqasx
+#define __UHASX __uhasx
+#define __SSAX __ssax
+#define __QSAX __qsax
+#define __SHSAX __shsax
+#define __USAX __usax
+#define __UQSAX __uqsax
+#define __UHSAX __uhsax
+#define __USAD8 __usad8
+#define __USADA8 __usada8
+#define __SSAT16 __ssat16
+#define __USAT16 __usat16
+#define __UXTB16 __uxtb16
+#define __UXTAB16 __uxtab16
+#define __SXTB16 __sxtb16
+#define __SXTAB16 __sxtab16
+#define __SMUAD __smuad
+#define __SMUADX __smuadx
+#define __SMLAD __smlad
+#define __SMLADX __smladx
+#define __SMLALD __smlald
+#define __SMLALDX __smlaldx
+#define __SMUSD __smusd
+#define __SMUSDX __smusdx
+#define __SMLSD __smlsd
+#define __SMLSDX __smlsdx
+#define __SMLSLD __smlsld
+#define __SMLSLDX __smlsldx
+#define __SEL __sel
+#define __QADD __qadd
+#define __QSUB __qsub
+
+#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
+ ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
+
+#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
+ ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
+
+#define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \
+ ((int64_t)(ARG3) << 32U) ) >> 32U))
+
+#endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
+/*@} end of group CMSIS_SIMD_intrinsics */
+
+
+#endif /* __CMSIS_ARMCC_H */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armclang.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armclang.h
new file mode 100644
index 0000000000000000000000000000000000000000..5c4c20e8777bf1177e03acbb6fca4b80f9b61362
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armclang.h
@@ -0,0 +1,1877 @@
+/**************************************************************************//**
+ * @file cmsis_armclang.h
+ * @brief CMSIS compiler armclang (Arm Compiler 6) header file
+ * @version V5.0.4
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+/*lint -esym(9058, IRQn)*/ /* disable MISRA 2012 Rule 2.4 for IRQn */
+
+#ifndef __CMSIS_ARMCLANG_H
+#define __CMSIS_ARMCLANG_H
+
+#pragma clang system_header /* treat file as system include file */
+
+#ifndef __ARM_COMPAT_H
+#include /* Compatibility header for Arm Compiler 5 intrinsics */
+#endif
+
+/* CMSIS compiler specific defines */
+#ifndef __ASM
+ #define __ASM __asm
+#endif
+#ifndef __INLINE
+ #define __INLINE __inline
+#endif
+#ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static __inline
+#endif
+#ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __attribute__((always_inline)) static __inline
+#endif
+#ifndef __NO_RETURN
+ #define __NO_RETURN __attribute__((__noreturn__))
+#endif
+#ifndef __USED
+ #define __USED __attribute__((used))
+#endif
+#ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+#endif
+#ifndef __PACKED
+ #define __PACKED __attribute__((packed, aligned(1)))
+#endif
+#ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
+#endif
+#ifndef __PACKED_UNION
+ #define __PACKED_UNION union __attribute__((packed, aligned(1)))
+#endif
+#ifndef __UNALIGNED_UINT32 /* deprecated */
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT32)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32 */
+ struct __attribute__((packed)) T_UINT32 { uint32_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+#endif
+#ifndef __UNALIGNED_UINT16_WRITE
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT16_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_WRITE */
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
+#endif
+#ifndef __UNALIGNED_UINT16_READ
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT16_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_READ */
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+#endif
+#ifndef __UNALIGNED_UINT32_WRITE
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT32_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_WRITE */
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+#endif
+#ifndef __UNALIGNED_UINT32_READ
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT32_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_READ */
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+#endif
+#ifndef __ALIGNED
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+#endif
+#ifndef __RESTRICT
+ #define __RESTRICT __restrict
+#endif
+
+
+/* ########################### Core Function Access ########################### */
+/** \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
+ @{
+ */
+
+/**
+ \brief Enable IRQ Interrupts
+ \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+/* intrinsic void __enable_irq(); see arm_compat.h */
+
+
+/**
+ \brief Disable IRQ Interrupts
+ \details Disables IRQ interrupts by setting the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+/* intrinsic void __disable_irq(); see arm_compat.h */
+
+
+/**
+ \brief Get Control Register
+ \details Returns the content of the Control Register.
+ \return Control Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_CONTROL(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Control Register (non-secure)
+ \details Returns the content of the non-secure Control Register when in secure mode.
+ \return non-secure Control Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Control Register
+ \details Writes the given value to the Control Register.
+ \param [in] control Control Register value to set
+ */
+__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control)
+{
+ __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Control Register (non-secure)
+ \details Writes the given value to the non-secure Control Register when in secure state.
+ \param [in] control Control Register value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)
+{
+ __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory");
+}
+#endif
+
+
+/**
+ \brief Get IPSR Register
+ \details Returns the content of the IPSR Register.
+ \return IPSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_IPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get APSR Register
+ \details Returns the content of the APSR Register.
+ \return APSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_APSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, apsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get xPSR Register
+ \details Returns the content of the xPSR Register.
+ \return xPSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_xPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get Process Stack Pointer
+ \details Returns the current value of the Process Stack Pointer (PSP).
+ \return PSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PSP(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, psp" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Process Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
+ \return PSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, psp_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Process Stack Pointer
+ \details Assigns the given value to the Process Stack Pointer (PSP).
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : );
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Process Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : );
+}
+#endif
+
+
+/**
+ \brief Get Main Stack Pointer
+ \details Returns the current value of the Main Stack Pointer (MSP).
+ \return MSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_MSP(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, msp" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Main Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
+ \return MSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, msp_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Main Stack Pointer
+ \details Assigns the given value to the Main Stack Pointer (MSP).
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : );
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Main Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : );
+}
+#endif
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state.
+ \return SP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, sp_ns" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Set Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state.
+ \param [in] topOfStack Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack)
+{
+ __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : );
+}
+#endif
+
+
+/**
+ \brief Get Priority Mask
+ \details Returns the current state of the priority mask bit from the Priority Mask Register.
+ \return Priority Mask value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Priority Mask (non-secure)
+ \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state.
+ \return Priority Mask value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Priority Mask
+ \details Assigns the given value to the Priority Mask Register.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Priority Mask (non-secure)
+ \details Assigns the given value to the non-secure Priority Mask Register when in secure state.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory");
+}
+#endif
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+/**
+ \brief Enable FIQ
+ \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __enable_fault_irq __enable_fiq /* see arm_compat.h */
+
+
+/**
+ \brief Disable FIQ
+ \details Disables FIQ interrupts by setting the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __disable_fault_irq __disable_fiq /* see arm_compat.h */
+
+
+/**
+ \brief Get Base Priority
+ \details Returns the current value of the Base Priority register.
+ \return Base Priority register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Base Priority (non-secure)
+ \details Returns the current value of the non-secure Base Priority register when in secure state.
+ \return Base Priority register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Base Priority
+ \details Assigns the given value to the Base Priority register.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Base Priority (non-secure)
+ \details Assigns the given value to the non-secure Base Priority register when in secure state.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory");
+}
+#endif
+
+
+/**
+ \brief Set Base Priority with condition
+ \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
+ or the new value increases the BASEPRI priority level.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory");
+}
+
+
+/**
+ \brief Get Fault Mask
+ \details Returns the current value of the Fault Mask register.
+ \return Fault Mask register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Fault Mask (non-secure)
+ \details Returns the current value of the non-secure Fault Mask register when in secure state.
+ \return Fault Mask register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Fault Mask
+ \details Assigns the given value to the Fault Mask register.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Fault Mask (non-secure)
+ \details Assigns the given value to the non-secure Fault Mask register when in secure state.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory");
+}
+#endif
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+
+/**
+ \brief Get Process Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always in non-secure
+ mode.
+
+ \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).
+ \return PSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ return 0U;
+#else
+ register uint32_t result;
+ __ASM volatile ("MRS %0, psplim" : "=r" (result) );
+ return result;
+#endif
+}
+
+#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Process Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always in non-secure
+ mode.
+
+ \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
+ \return PSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ return 0U;
+#else
+ register uint32_t result;
+ __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) );
+ return result;
+#endif
+}
+#endif
+
+
+/**
+ \brief Set Process Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored in non-secure
+ mode.
+
+ \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).
+ \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)ProcStackPtrLimit;
+#else
+ __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit));
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Process Stack Pointer (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored in non-secure
+ mode.
+
+ \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
+ \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)ProcStackPtrLimit;
+#else
+ __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit));
+#endif
+}
+#endif
+
+
+/**
+ \brief Get Main Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always.
+
+ \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).
+ \return MSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ return 0U;
+#else
+ register uint32_t result;
+ __ASM volatile ("MRS %0, msplim" : "=r" (result) );
+ return result;
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Main Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always.
+
+ \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
+ \return MSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ return 0U;
+#else
+ register uint32_t result;
+ __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) );
+ return result;
+#endif
+}
+#endif
+
+
+/**
+ \brief Set Main Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored.
+
+ \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).
+ \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)MainStackPtrLimit;
+#else
+ __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit));
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Main Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored.
+
+ \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
+ \param [in] MainStackPtrLimit Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)MainStackPtrLimit;
+#else
+ __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit));
+#endif
+}
+#endif
+
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+
+/**
+ \brief Get FPSCR
+ \details Returns the current value of the Floating Point Status/Control register.
+ \return Floating Point Status/Control register value
+ */
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+#define __get_FPSCR (uint32_t)__builtin_arm_get_fpscr
+#else
+#define __get_FPSCR() ((uint32_t)0U)
+#endif
+
+/**
+ \brief Set FPSCR
+ \details Assigns the given value to the Floating Point Status/Control register.
+ \param [in] fpscr Floating Point Status/Control value to set
+ */
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+#define __set_FPSCR __builtin_arm_set_fpscr
+#else
+#define __set_FPSCR(x) ((void)(x))
+#endif
+
+#endif /* ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+
+/*@} end of CMSIS_Core_RegAccFunctions */
+
+
+/* ########################## Core Instruction Access ######################### */
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
+ Access to dedicated instructions
+ @{
+*/
+
+/* Define macros for porting to both thumb1 and thumb2.
+ * For thumb1, use low register (r0-r7), specified by constraint "l"
+ * Otherwise, use general registers, specified by constraint "r" */
+#if defined (__thumb__) && !defined (__thumb2__)
+#define __CMSIS_GCC_OUT_REG(r) "=l" (r)
+#define __CMSIS_GCC_USE_REG(r) "l" (r)
+#else
+#define __CMSIS_GCC_OUT_REG(r) "=r" (r)
+#define __CMSIS_GCC_USE_REG(r) "r" (r)
+#endif
+
+/**
+ \brief No Operation
+ \details No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+#define __NOP __builtin_arm_nop
+
+/**
+ \brief Wait For Interrupt
+ \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
+ */
+#define __WFI __builtin_arm_wfi
+
+
+/**
+ \brief Wait For Event
+ \details Wait For Event is a hint instruction that permits the processor to enter
+ a low-power state until one of a number of events occurs.
+ */
+#define __WFE __builtin_arm_wfe
+
+
+/**
+ \brief Send Event
+ \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+#define __SEV __builtin_arm_sev
+
+
+/**
+ \brief Instruction Synchronization Barrier
+ \details Instruction Synchronization Barrier flushes the pipeline in the processor,
+ so that all instructions following the ISB are fetched from cache or memory,
+ after the instruction has been completed.
+ */
+#define __ISB() __builtin_arm_isb(0xF);
+
+/**
+ \brief Data Synchronization Barrier
+ \details Acts as a special kind of Data Memory Barrier.
+ It completes when all explicit memory accesses before this instruction complete.
+ */
+#define __DSB() __builtin_arm_dsb(0xF);
+
+
+/**
+ \brief Data Memory Barrier
+ \details Ensures the apparent order of the explicit memory operations before
+ and after the instruction, without ensuring their completion.
+ */
+#define __DMB() __builtin_arm_dmb(0xF);
+
+
+/**
+ \brief Reverse byte order (32 bit)
+ \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REV(value) __builtin_bswap32(value)
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REV16(value) __ROR(__REV(value), 16)
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REVSH(value) (int16_t)__builtin_bswap16(value)
+
+
+/**
+ \brief Rotate Right in unsigned value (32 bit)
+ \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+ \param [in] op1 Value to rotate
+ \param [in] op2 Number of Bits to rotate
+ \return Rotated value
+ */
+__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
+{
+ op2 %= 32U;
+ if (op2 == 0U)
+ {
+ return op1;
+ }
+ return (op1 >> op2) | (op1 << (32U - op2));
+}
+
+
+/**
+ \brief Breakpoint
+ \details Causes the processor to enter Debug state.
+ Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+ \param [in] value is ignored by the processor.
+ If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value) __ASM volatile ("bkpt "#value)
+
+
+/**
+ \brief Reverse bit order of value
+ \details Reverses the bit order of the given value.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __RBIT __builtin_arm_rbit
+
+/**
+ \brief Count leading zeros
+ \details Counts the number of leading zeros of a data value.
+ \param [in] value Value to count the leading zeros
+ \return number of leading zeros in value
+ */
+#define __CLZ (uint8_t)__builtin_clz
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+/**
+ \brief LDR Exclusive (8 bit)
+ \details Executes a exclusive LDR instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#define __LDREXB (uint8_t)__builtin_arm_ldrex
+
+
+/**
+ \brief LDR Exclusive (16 bit)
+ \details Executes a exclusive LDR instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#define __LDREXH (uint16_t)__builtin_arm_ldrex
+
+
+/**
+ \brief LDR Exclusive (32 bit)
+ \details Executes a exclusive LDR instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#define __LDREXW (uint32_t)__builtin_arm_ldrex
+
+
+/**
+ \brief STR Exclusive (8 bit)
+ \details Executes a exclusive STR instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXB (uint32_t)__builtin_arm_strex
+
+
+/**
+ \brief STR Exclusive (16 bit)
+ \details Executes a exclusive STR instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXH (uint32_t)__builtin_arm_strex
+
+
+/**
+ \brief STR Exclusive (32 bit)
+ \details Executes a exclusive STR instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXW (uint32_t)__builtin_arm_strex
+
+
+/**
+ \brief Remove the exclusive lock
+ \details Removes the exclusive lock which is created by LDREX.
+ */
+#define __CLREX __builtin_arm_clrex
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+#define __SSAT __builtin_arm_ssat
+
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+#define __USAT __builtin_arm_usat
+
+
+/**
+ \brief Rotate Right with Extend (32 bit)
+ \details Moves each bit of a bitstring right by one bit.
+ The carry input is shifted in at the left end of the bitstring.
+ \param [in] value Value to rotate
+ \return Rotated value
+ */
+__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value)
+{
+ uint32_t result;
+
+ __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return(result);
+}
+
+
+/**
+ \brief LDRT Unprivileged (8 bit)
+ \details Executes a Unprivileged LDRT instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint8_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDRT Unprivileged (16 bit)
+ \details Executes a Unprivileged LDRT instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint16_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDRT Unprivileged (32 bit)
+ \details Executes a Unprivileged LDRT instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief STRT Unprivileged (8 bit)
+ \details Executes a Unprivileged STRT instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
+{
+ __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief STRT Unprivileged (16 bit)
+ \details Executes a Unprivileged STRT instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
+{
+ __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief STRT Unprivileged (32 bit)
+ \details Executes a Unprivileged STRT instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
+{
+ __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) );
+}
+
+#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
+{
+ if ((sat >= 1U) && (sat <= 32U))
+ {
+ const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
+ const int32_t min = -1 - max ;
+ if (val > max)
+ {
+ return max;
+ }
+ else if (val < min)
+ {
+ return min;
+ }
+ }
+ return val;
+}
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
+{
+ if (sat <= 31U)
+ {
+ const uint32_t max = ((1U << sat) - 1U);
+ if (val > (int32_t)max)
+ {
+ return max;
+ }
+ else if (val < 0)
+ {
+ return 0U;
+ }
+ }
+ return (uint32_t)val;
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+/**
+ \brief Load-Acquire (8 bit)
+ \details Executes a LDAB instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint8_t) result);
+}
+
+
+/**
+ \brief Load-Acquire (16 bit)
+ \details Executes a LDAH instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint16_t) result);
+}
+
+
+/**
+ \brief Load-Acquire (32 bit)
+ \details Executes a LDA instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release (8 bit)
+ \details Executes a STLB instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
+{
+ __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Store-Release (16 bit)
+ \details Executes a STLH instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
+{
+ __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Store-Release (32 bit)
+ \details Executes a STL instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr)
+{
+ __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Load-Acquire Exclusive (8 bit)
+ \details Executes a LDAB exclusive instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#define __LDAEXB (uint8_t)__builtin_arm_ldaex
+
+
+/**
+ \brief Load-Acquire Exclusive (16 bit)
+ \details Executes a LDAH exclusive instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#define __LDAEXH (uint16_t)__builtin_arm_ldaex
+
+
+/**
+ \brief Load-Acquire Exclusive (32 bit)
+ \details Executes a LDA exclusive instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#define __LDAEX (uint32_t)__builtin_arm_ldaex
+
+
+/**
+ \brief Store-Release Exclusive (8 bit)
+ \details Executes a STLB exclusive instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STLEXB (uint32_t)__builtin_arm_stlex
+
+
+/**
+ \brief Store-Release Exclusive (16 bit)
+ \details Executes a STLH exclusive instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STLEXH (uint32_t)__builtin_arm_stlex
+
+
+/**
+ \brief Store-Release Exclusive (32 bit)
+ \details Executes a STL exclusive instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STLEX (uint32_t)__builtin_arm_stlex
+
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
+
+
+/* ################### Compiler specific Intrinsics ########################### */
+/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
+ Access to dedicated SIMD instructions
+ @{
+*/
+
+#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
+
+__STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+
+__STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+
+__STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+#define __SSAT16(ARG1,ARG2) \
+({ \
+ int32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+#define __USAT16(ARG1,ARG2) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+__STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1)
+{
+ uint32_t result;
+
+ __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1)
+{
+ uint32_t result;
+
+ __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint32_t __SEL (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE int32_t __QADD( int32_t op1, int32_t op2)
+{
+ int32_t result;
+
+ __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE int32_t __QSUB( int32_t op1, int32_t op2)
+{
+ int32_t result;
+
+ __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+#if 0
+#define __PKHBT(ARG1,ARG2,ARG3) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
+ __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
+ __RES; \
+ })
+
+#define __PKHTB(ARG1,ARG2,ARG3) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
+ if (ARG3 == 0) \
+ __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \
+ else \
+ __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
+ __RES; \
+ })
+#endif
+
+#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
+ ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
+
+#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
+ ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
+
+__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
+{
+ int32_t result;
+
+ __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+#endif /* (__ARM_FEATURE_DSP == 1) */
+/*@} end of group CMSIS_SIMD_intrinsics */
+
+
+#endif /* __CMSIS_ARMCLANG_H */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_compiler.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_compiler.h
new file mode 100644
index 0000000000000000000000000000000000000000..94212eb87a94d11bb8346c6fff99d5fbf838c0ac
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_compiler.h
@@ -0,0 +1,266 @@
+/**************************************************************************//**
+ * @file cmsis_compiler.h
+ * @brief CMSIS compiler generic header file
+ * @version V5.0.4
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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 __CMSIS_COMPILER_H
+#define __CMSIS_COMPILER_H
+
+#include
+
+/*
+ * Arm Compiler 4/5
+ */
+#if defined ( __CC_ARM )
+ #include "cmsis_armcc.h"
+
+
+/*
+ * Arm Compiler 6 (armclang)
+ */
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #include "cmsis_armclang.h"
+
+
+/*
+ * GNU Compiler
+ */
+#elif defined ( __GNUC__ )
+ #include "cmsis_gcc.h"
+
+
+/*
+ * IAR Compiler
+ */
+#elif defined ( __ICCARM__ )
+ #include
+
+
+/*
+ * TI Arm Compiler
+ */
+#elif defined ( __TI_ARM__ )
+ #include
+
+ #ifndef __ASM
+ #define __ASM __asm
+ #endif
+ #ifndef __INLINE
+ #define __INLINE inline
+ #endif
+ #ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static inline
+ #endif
+ #ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __STATIC_INLINE
+ #endif
+ #ifndef __NO_RETURN
+ #define __NO_RETURN __attribute__((noreturn))
+ #endif
+ #ifndef __USED
+ #define __USED __attribute__((used))
+ #endif
+ #ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+ #endif
+ #ifndef __PACKED
+ #define __PACKED __attribute__((packed))
+ #endif
+ #ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT struct __attribute__((packed))
+ #endif
+ #ifndef __PACKED_UNION
+ #define __PACKED_UNION union __attribute__((packed))
+ #endif
+ #ifndef __UNALIGNED_UINT32 /* deprecated */
+ struct __attribute__((packed)) T_UINT32 { uint32_t v; };
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT16_WRITE
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT16_READ
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT32_WRITE
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT32_READ
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __ALIGNED
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+ #endif
+ #ifndef __RESTRICT
+ #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
+ #define __RESTRICT
+ #endif
+
+
+/*
+ * TASKING Compiler
+ */
+#elif defined ( __TASKING__ )
+ /*
+ * The CMSIS functions have been implemented as intrinsics in the compiler.
+ * Please use "carm -?i" to get an up to date list of all intrinsics,
+ * Including the CMSIS ones.
+ */
+
+ #ifndef __ASM
+ #define __ASM __asm
+ #endif
+ #ifndef __INLINE
+ #define __INLINE inline
+ #endif
+ #ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static inline
+ #endif
+ #ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __STATIC_INLINE
+ #endif
+ #ifndef __NO_RETURN
+ #define __NO_RETURN __attribute__((noreturn))
+ #endif
+ #ifndef __USED
+ #define __USED __attribute__((used))
+ #endif
+ #ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+ #endif
+ #ifndef __PACKED
+ #define __PACKED __packed__
+ #endif
+ #ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT struct __packed__
+ #endif
+ #ifndef __PACKED_UNION
+ #define __PACKED_UNION union __packed__
+ #endif
+ #ifndef __UNALIGNED_UINT32 /* deprecated */
+ struct __packed__ T_UINT32 { uint32_t v; };
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT16_WRITE
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT16_READ
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT32_WRITE
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT32_READ
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __ALIGNED
+ #define __ALIGNED(x) __align(x)
+ #endif
+ #ifndef __RESTRICT
+ #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
+ #define __RESTRICT
+ #endif
+
+
+/*
+ * COSMIC Compiler
+ */
+#elif defined ( __CSMC__ )
+ #include
+
+ #ifndef __ASM
+ #define __ASM _asm
+ #endif
+ #ifndef __INLINE
+ #define __INLINE inline
+ #endif
+ #ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static inline
+ #endif
+ #ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __STATIC_INLINE
+ #endif
+ #ifndef __NO_RETURN
+ // NO RETURN is automatically detected hence no warning here
+ #define __NO_RETURN
+ #endif
+ #ifndef __USED
+ #warning No compiler specific solution for __USED. __USED is ignored.
+ #define __USED
+ #endif
+ #ifndef __WEAK
+ #define __WEAK __weak
+ #endif
+ #ifndef __PACKED
+ #define __PACKED @packed
+ #endif
+ #ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT @packed struct
+ #endif
+ #ifndef __PACKED_UNION
+ #define __PACKED_UNION @packed union
+ #endif
+ #ifndef __UNALIGNED_UINT32 /* deprecated */
+ @packed struct T_UINT32 { uint32_t v; };
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT16_WRITE
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT16_READ
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT32_WRITE
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT32_READ
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __ALIGNED
+ #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
+ #define __ALIGNED(x)
+ #endif
+ #ifndef __RESTRICT
+ #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
+ #define __RESTRICT
+ #endif
+
+
+#else
+ #error Unknown compiler.
+#endif
+
+
+#endif /* __CMSIS_COMPILER_H */
+
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_gcc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_gcc.h
new file mode 100644
index 0000000000000000000000000000000000000000..5d0f07e8accbfdd00dbace8fdf02f98825cfb6f9
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_gcc.h
@@ -0,0 +1,2088 @@
+/**************************************************************************//**
+ * @file cmsis_gcc.h
+ * @brief CMSIS compiler GCC header file
+ * @version V5.0.3
+ * @date 16. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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 __CMSIS_GCC_H
+#define __CMSIS_GCC_H
+
+/* ignore some GCC warnings */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+
+/* Fallback for __has_builtin */
+#ifndef __has_builtin
+ #define __has_builtin(x) (0)
+#endif
+
+/* CMSIS compiler specific defines */
+#ifndef __ASM
+ #define __ASM __asm
+#endif
+#ifndef __INLINE
+ #define __INLINE inline
+#endif
+#ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static inline
+#endif
+#ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __attribute__((always_inline)) static inline
+#endif
+#ifndef __NO_RETURN
+ #define __NO_RETURN __attribute__((__noreturn__))
+#endif
+#ifndef __USED
+ #define __USED __attribute__((used))
+#endif
+#ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+#endif
+#ifndef __PACKED
+ #define __PACKED __attribute__((packed, aligned(1)))
+#endif
+#ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
+#endif
+#ifndef __PACKED_UNION
+ #define __PACKED_UNION union __attribute__((packed, aligned(1)))
+#endif
+#ifndef __UNALIGNED_UINT32 /* deprecated */
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpacked"
+ #pragma GCC diagnostic ignored "-Wattributes"
+ struct __attribute__((packed)) T_UINT32 { uint32_t v; };
+ #pragma GCC diagnostic pop
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+#endif
+#ifndef __UNALIGNED_UINT16_WRITE
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpacked"
+ #pragma GCC diagnostic ignored "-Wattributes"
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #pragma GCC diagnostic pop
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
+#endif
+#ifndef __UNALIGNED_UINT16_READ
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpacked"
+ #pragma GCC diagnostic ignored "-Wattributes"
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #pragma GCC diagnostic pop
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+#endif
+#ifndef __UNALIGNED_UINT32_WRITE
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpacked"
+ #pragma GCC diagnostic ignored "-Wattributes"
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #pragma GCC diagnostic pop
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+#endif
+#ifndef __UNALIGNED_UINT32_READ
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpacked"
+ #pragma GCC diagnostic ignored "-Wattributes"
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #pragma GCC diagnostic pop
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+#endif
+#ifndef __ALIGNED
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+#endif
+#ifndef __RESTRICT
+ #define __RESTRICT __restrict
+#endif
+
+
+/* ########################### Core Function Access ########################### */
+/** \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
+ @{
+ */
+
+/**
+ \brief Enable IRQ Interrupts
+ \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__STATIC_FORCEINLINE void __enable_irq(void)
+{
+ __ASM volatile ("cpsie i" : : : "memory");
+}
+
+
+/**
+ \brief Disable IRQ Interrupts
+ \details Disables IRQ interrupts by setting the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__STATIC_FORCEINLINE void __disable_irq(void)
+{
+ __ASM volatile ("cpsid i" : : : "memory");
+}
+
+
+/**
+ \brief Get Control Register
+ \details Returns the content of the Control Register.
+ \return Control Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_CONTROL(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Control Register (non-secure)
+ \details Returns the content of the non-secure Control Register when in secure mode.
+ \return non-secure Control Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Control Register
+ \details Writes the given value to the Control Register.
+ \param [in] control Control Register value to set
+ */
+__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control)
+{
+ __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Control Register (non-secure)
+ \details Writes the given value to the non-secure Control Register when in secure state.
+ \param [in] control Control Register value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)
+{
+ __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory");
+}
+#endif
+
+
+/**
+ \brief Get IPSR Register
+ \details Returns the content of the IPSR Register.
+ \return IPSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_IPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get APSR Register
+ \details Returns the content of the APSR Register.
+ \return APSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_APSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, apsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get xPSR Register
+ \details Returns the content of the xPSR Register.
+ \return xPSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_xPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get Process Stack Pointer
+ \details Returns the current value of the Process Stack Pointer (PSP).
+ \return PSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PSP(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, psp" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Process Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
+ \return PSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, psp_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Process Stack Pointer
+ \details Assigns the given value to the Process Stack Pointer (PSP).
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : );
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Process Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : );
+}
+#endif
+
+
+/**
+ \brief Get Main Stack Pointer
+ \details Returns the current value of the Main Stack Pointer (MSP).
+ \return MSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_MSP(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, msp" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Main Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
+ \return MSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, msp_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Main Stack Pointer
+ \details Assigns the given value to the Main Stack Pointer (MSP).
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : );
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Main Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : );
+}
+#endif
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state.
+ \return SP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, sp_ns" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Set Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state.
+ \param [in] topOfStack Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack)
+{
+ __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : );
+}
+#endif
+
+
+/**
+ \brief Get Priority Mask
+ \details Returns the current state of the priority mask bit from the Priority Mask Register.
+ \return Priority Mask value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask" : "=r" (result) :: "memory");
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Priority Mask (non-secure)
+ \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state.
+ \return Priority Mask value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask_ns" : "=r" (result) :: "memory");
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Priority Mask
+ \details Assigns the given value to the Priority Mask Register.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Priority Mask (non-secure)
+ \details Assigns the given value to the non-secure Priority Mask Register when in secure state.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory");
+}
+#endif
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+/**
+ \brief Enable FIQ
+ \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__STATIC_FORCEINLINE void __enable_fault_irq(void)
+{
+ __ASM volatile ("cpsie f" : : : "memory");
+}
+
+
+/**
+ \brief Disable FIQ
+ \details Disables FIQ interrupts by setting the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__STATIC_FORCEINLINE void __disable_fault_irq(void)
+{
+ __ASM volatile ("cpsid f" : : : "memory");
+}
+
+
+/**
+ \brief Get Base Priority
+ \details Returns the current value of the Base Priority register.
+ \return Base Priority register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Base Priority (non-secure)
+ \details Returns the current value of the non-secure Base Priority register when in secure state.
+ \return Base Priority register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Base Priority
+ \details Assigns the given value to the Base Priority register.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Base Priority (non-secure)
+ \details Assigns the given value to the non-secure Base Priority register when in secure state.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory");
+}
+#endif
+
+
+/**
+ \brief Set Base Priority with condition
+ \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
+ or the new value increases the BASEPRI priority level.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory");
+}
+
+
+/**
+ \brief Get Fault Mask
+ \details Returns the current value of the Fault Mask register.
+ \return Fault Mask register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Fault Mask (non-secure)
+ \details Returns the current value of the non-secure Fault Mask register when in secure state.
+ \return Fault Mask register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Fault Mask
+ \details Assigns the given value to the Fault Mask register.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Fault Mask (non-secure)
+ \details Assigns the given value to the non-secure Fault Mask register when in secure state.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory");
+}
+#endif
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+
+/**
+ \brief Get Process Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always in non-secure
+ mode.
+
+ \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).
+ \return PSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ return 0U;
+#else
+ register uint32_t result;
+ __ASM volatile ("MRS %0, psplim" : "=r" (result) );
+ return result;
+#endif
+}
+
+#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Process Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always.
+
+ \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
+ \return PSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ return 0U;
+#else
+ register uint32_t result;
+ __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) );
+ return result;
+#endif
+}
+#endif
+
+
+/**
+ \brief Set Process Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored in non-secure
+ mode.
+
+ \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).
+ \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)ProcStackPtrLimit;
+#else
+ __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit));
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Process Stack Pointer (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored.
+
+ \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
+ \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)ProcStackPtrLimit;
+#else
+ __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit));
+#endif
+}
+#endif
+
+
+/**
+ \brief Get Main Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always in non-secure
+ mode.
+
+ \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).
+ \return MSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ return 0U;
+#else
+ register uint32_t result;
+ __ASM volatile ("MRS %0, msplim" : "=r" (result) );
+ return result;
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Main Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always.
+
+ \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
+ \return MSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ return 0U;
+#else
+ register uint32_t result;
+ __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) );
+ return result;
+#endif
+}
+#endif
+
+
+/**
+ \brief Set Main Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored in non-secure
+ mode.
+
+ \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).
+ \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)MainStackPtrLimit;
+#else
+ __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit));
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Main Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored.
+
+ \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
+ \param [in] MainStackPtrLimit Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)MainStackPtrLimit;
+#else
+ __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit));
+#endif
+}
+#endif
+
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+
+/**
+ \brief Get FPSCR
+ \details Returns the current value of the Floating Point Status/Control register.
+ \return Floating Point Status/Control register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_FPSCR(void)
+{
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+#if __has_builtin(__builtin_arm_get_fpscr) || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2)
+ /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */
+ return __builtin_arm_get_fpscr();
+#else
+ uint32_t result;
+
+ __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
+ return(result);
+#endif
+#else
+ return(0U);
+#endif
+}
+
+
+/**
+ \brief Set FPSCR
+ \details Assigns the given value to the Floating Point Status/Control register.
+ \param [in] fpscr Floating Point Status/Control value to set
+ */
+__STATIC_FORCEINLINE void __set_FPSCR(uint32_t fpscr)
+{
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+#if __has_builtin(__builtin_arm_set_fpscr) || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2)
+ /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */
+ __builtin_arm_set_fpscr(fpscr);
+#else
+ __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory");
+#endif
+#else
+ (void)fpscr;
+#endif
+}
+
+#endif /* ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+
+/*@} end of CMSIS_Core_RegAccFunctions */
+
+
+/* ########################## Core Instruction Access ######################### */
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
+ Access to dedicated instructions
+ @{
+*/
+
+/* Define macros for porting to both thumb1 and thumb2.
+ * For thumb1, use low register (r0-r7), specified by constraint "l"
+ * Otherwise, use general registers, specified by constraint "r" */
+#if defined (__thumb__) && !defined (__thumb2__)
+#define __CMSIS_GCC_OUT_REG(r) "=l" (r)
+#define __CMSIS_GCC_RW_REG(r) "+l" (r)
+#define __CMSIS_GCC_USE_REG(r) "l" (r)
+#else
+#define __CMSIS_GCC_OUT_REG(r) "=r" (r)
+#define __CMSIS_GCC_RW_REG(r) "+r" (r)
+#define __CMSIS_GCC_USE_REG(r) "r" (r)
+#endif
+
+/**
+ \brief No Operation
+ \details No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+#define __NOP() __ASM volatile ("nop")
+
+/**
+ \brief Wait For Interrupt
+ \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
+ */
+#define __WFI() __ASM volatile ("wfi")
+
+
+/**
+ \brief Wait For Event
+ \details Wait For Event is a hint instruction that permits the processor to enter
+ a low-power state until one of a number of events occurs.
+ */
+#define __WFE() __ASM volatile ("wfe")
+
+
+/**
+ \brief Send Event
+ \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+#define __SEV() __ASM volatile ("sev")
+
+
+/**
+ \brief Instruction Synchronization Barrier
+ \details Instruction Synchronization Barrier flushes the pipeline in the processor,
+ so that all instructions following the ISB are fetched from cache or memory,
+ after the instruction has been completed.
+ */
+__STATIC_FORCEINLINE void __ISB(void)
+{
+ __ASM volatile ("isb 0xF":::"memory");
+}
+
+
+/**
+ \brief Data Synchronization Barrier
+ \details Acts as a special kind of Data Memory Barrier.
+ It completes when all explicit memory accesses before this instruction complete.
+ */
+__STATIC_FORCEINLINE void __DSB(void)
+{
+ __ASM volatile ("dsb 0xF":::"memory");
+}
+
+
+/**
+ \brief Data Memory Barrier
+ \details Ensures the apparent order of the explicit memory operations before
+ and after the instruction, without ensuring their completion.
+ */
+__STATIC_FORCEINLINE void __DMB(void)
+{
+ __ASM volatile ("dmb 0xF":::"memory");
+}
+
+
+/**
+ \brief Reverse byte order (32 bit)
+ \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__STATIC_FORCEINLINE uint32_t __REV(uint32_t value)
+{
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+ return __builtin_bswap32(value);
+#else
+ uint32_t result;
+
+ __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return result;
+#endif
+}
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__STATIC_FORCEINLINE uint32_t __REV16(uint32_t value)
+{
+ uint32_t result;
+
+ __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return result;
+}
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__STATIC_FORCEINLINE int16_t __REVSH(int16_t value)
+{
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ return (int16_t)__builtin_bswap16(value);
+#else
+ int16_t result;
+
+ __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return result;
+#endif
+}
+
+
+/**
+ \brief Rotate Right in unsigned value (32 bit)
+ \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+ \param [in] op1 Value to rotate
+ \param [in] op2 Number of Bits to rotate
+ \return Rotated value
+ */
+__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
+{
+ op2 %= 32U;
+ if (op2 == 0U)
+ {
+ return op1;
+ }
+ return (op1 >> op2) | (op1 << (32U - op2));
+}
+
+
+/**
+ \brief Breakpoint
+ \details Causes the processor to enter Debug state.
+ Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+ \param [in] value is ignored by the processor.
+ If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value) __ASM volatile ("bkpt "#value)
+
+
+/**
+ \brief Reverse bit order of value
+ \details Reverses the bit order of the given value.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__STATIC_FORCEINLINE uint32_t __RBIT(uint32_t value)
+{
+ uint32_t result;
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+ __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
+#else
+ uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */
+
+ result = value; /* r will be reversed bits of v; first get LSB of v */
+ for (value >>= 1U; value != 0U; value >>= 1U)
+ {
+ result <<= 1U;
+ result |= value & 1U;
+ s--;
+ }
+ result <<= s; /* shift when v's highest bits are zero */
+#endif
+ return result;
+}
+
+
+/**
+ \brief Count leading zeros
+ \details Counts the number of leading zeros of a data value.
+ \param [in] value Value to count the leading zeros
+ \return number of leading zeros in value
+ */
+#define __CLZ (uint8_t)__builtin_clz
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+/**
+ \brief LDR Exclusive (8 bit)
+ \details Executes a exclusive LDR instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDREXB(volatile uint8_t *addr)
+{
+ uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) );
+#else
+ /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+ accepted by assembler. So has to use following less efficient pattern.
+ */
+ __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+#endif
+ return ((uint8_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDR Exclusive (16 bit)
+ \details Executes a exclusive LDR instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDREXH(volatile uint16_t *addr)
+{
+ uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) );
+#else
+ /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+ accepted by assembler. So has to use following less efficient pattern.
+ */
+ __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+#endif
+ return ((uint16_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDR Exclusive (32 bit)
+ \details Executes a exclusive LDR instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDREXW(volatile uint32_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) );
+ return(result);
+}
+
+
+/**
+ \brief STR Exclusive (8 bit)
+ \details Executes a exclusive STR instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
+ return(result);
+}
+
+
+/**
+ \brief STR Exclusive (16 bit)
+ \details Executes a exclusive STR instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
+ return(result);
+}
+
+
+/**
+ \brief STR Exclusive (32 bit)
+ \details Executes a exclusive STR instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
+ return(result);
+}
+
+
+/**
+ \brief Remove the exclusive lock
+ \details Removes the exclusive lock which is created by LDREX.
+ */
+__STATIC_FORCEINLINE void __CLREX(void)
+{
+ __ASM volatile ("clrex" ::: "memory");
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] ARG1 Value to be saturated
+ \param [in] ARG2 Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+#define __SSAT(ARG1,ARG2) \
+__extension__ \
+({ \
+ int32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] ARG1 Value to be saturated
+ \param [in] ARG2 Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+#define __USAT(ARG1,ARG2) \
+ __extension__ \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+
+/**
+ \brief Rotate Right with Extend (32 bit)
+ \details Moves each bit of a bitstring right by one bit.
+ The carry input is shifted in at the left end of the bitstring.
+ \param [in] value Value to rotate
+ \return Rotated value
+ */
+__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value)
+{
+ uint32_t result;
+
+ __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return(result);
+}
+
+
+/**
+ \brief LDRT Unprivileged (8 bit)
+ \details Executes a Unprivileged LDRT instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) );
+#else
+ /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+ accepted by assembler. So has to use following less efficient pattern.
+ */
+ __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" );
+#endif
+ return ((uint8_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDRT Unprivileged (16 bit)
+ \details Executes a Unprivileged LDRT instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) );
+#else
+ /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+ accepted by assembler. So has to use following less efficient pattern.
+ */
+ __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" );
+#endif
+ return ((uint16_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDRT Unprivileged (32 bit)
+ \details Executes a Unprivileged LDRT instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief STRT Unprivileged (8 bit)
+ \details Executes a Unprivileged STRT instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
+{
+ __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief STRT Unprivileged (16 bit)
+ \details Executes a Unprivileged STRT instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
+{
+ __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief STRT Unprivileged (32 bit)
+ \details Executes a Unprivileged STRT instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
+{
+ __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) );
+}
+
+#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
+{
+ if ((sat >= 1U) && (sat <= 32U))
+ {
+ const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
+ const int32_t min = -1 - max ;
+ if (val > max)
+ {
+ return max;
+ }
+ else if (val < min)
+ {
+ return min;
+ }
+ }
+ return val;
+}
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
+{
+ if (sat <= 31U)
+ {
+ const uint32_t max = ((1U << sat) - 1U);
+ if (val > (int32_t)max)
+ {
+ return max;
+ }
+ else if (val < 0)
+ {
+ return 0U;
+ }
+ }
+ return (uint32_t)val;
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+/**
+ \brief Load-Acquire (8 bit)
+ \details Executes a LDAB instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint8_t) result);
+}
+
+
+/**
+ \brief Load-Acquire (16 bit)
+ \details Executes a LDAH instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint16_t) result);
+}
+
+
+/**
+ \brief Load-Acquire (32 bit)
+ \details Executes a LDA instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release (8 bit)
+ \details Executes a STLB instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
+{
+ __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Store-Release (16 bit)
+ \details Executes a STLH instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
+{
+ __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Store-Release (32 bit)
+ \details Executes a STL instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr)
+{
+ __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Load-Acquire Exclusive (8 bit)
+ \details Executes a LDAB exclusive instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDAEXB(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldaexb %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint8_t) result);
+}
+
+
+/**
+ \brief Load-Acquire Exclusive (16 bit)
+ \details Executes a LDAH exclusive instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDAEXH(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldaexh %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint16_t) result);
+}
+
+
+/**
+ \brief Load-Acquire Exclusive (32 bit)
+ \details Executes a LDA exclusive instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDAEX(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldaex %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release Exclusive (8 bit)
+ \details Executes a STLB exclusive instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("stlexb %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release Exclusive (16 bit)
+ \details Executes a STLH exclusive instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("stlexh %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release Exclusive (32 bit)
+ \details Executes a STL exclusive instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("stlex %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) );
+ return(result);
+}
+
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
+
+
+/* ################### Compiler specific Intrinsics ########################### */
+/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
+ Access to dedicated SIMD instructions
+ @{
+*/
+
+#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
+
+__STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+
+__STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+
+__STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+#define __SSAT16(ARG1,ARG2) \
+({ \
+ int32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+#define __USAT16(ARG1,ARG2) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+__STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1)
+{
+ uint32_t result;
+
+ __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1)
+{
+ uint32_t result;
+
+ __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint32_t __SEL (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE int32_t __QADD( int32_t op1, int32_t op2)
+{
+ int32_t result;
+
+ __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE int32_t __QSUB( int32_t op1, int32_t op2)
+{
+ int32_t result;
+
+ __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+#if 0
+#define __PKHBT(ARG1,ARG2,ARG3) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
+ __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
+ __RES; \
+ })
+
+#define __PKHTB(ARG1,ARG2,ARG3) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
+ if (ARG3 == 0) \
+ __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \
+ else \
+ __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
+ __RES; \
+ })
+#endif
+
+#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
+ ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
+
+#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
+ ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
+
+__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
+{
+ int32_t result;
+
+ __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+#endif /* (__ARM_FEATURE_DSP == 1) */
+/*@} end of group CMSIS_SIMD_intrinsics */
+
+
+#pragma GCC diagnostic pop
+
+#endif /* __CMSIS_GCC_H */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_iccarm.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_iccarm.h
new file mode 100644
index 0000000000000000000000000000000000000000..edcaee3d4ab1e4026b53858e06930dd53d71f038
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_iccarm.h
@@ -0,0 +1,913 @@
+/**************************************************************************//**
+ * @file cmsis_iccarm.h
+ * @brief CMSIS compiler ICCARM (IAR Compiler for Arm) header file
+ * @version V5.0.5
+ * @date 10. January 2018
+ ******************************************************************************/
+
+//------------------------------------------------------------------------------
+//
+// Copyright (c) 2017-2018 IAR Systems
+//
+// Licensed 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 __CMSIS_ICCARM_H__
+#define __CMSIS_ICCARM_H__
+
+#ifndef __ICCARM__
+ #error This file should only be compiled by ICCARM
+#endif
+
+#pragma system_include
+
+#define __IAR_FT _Pragma("inline=forced") __intrinsic
+
+#if (__VER__ >= 8000000)
+ #define __ICCARM_V8 1
+#else
+ #define __ICCARM_V8 0
+#endif
+
+#ifndef __ALIGNED
+ #if __ICCARM_V8
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+ #elif (__VER__ >= 7080000)
+ /* Needs IAR language extensions */
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+ #else
+ #warning No compiler specific solution for __ALIGNED.__ALIGNED is ignored.
+ #define __ALIGNED(x)
+ #endif
+#endif
+
+
+/* Define compiler macros for CPU architecture, used in CMSIS 5.
+ */
+#if __ARM_ARCH_6M__ || __ARM_ARCH_7M__ || __ARM_ARCH_7EM__ || __ARM_ARCH_8M_BASE__ || __ARM_ARCH_8M_MAIN__
+/* Macros already defined */
+#else
+ #if defined(__ARM8M_MAINLINE__) || defined(__ARM8EM_MAINLINE__)
+ #define __ARM_ARCH_8M_MAIN__ 1
+ #elif defined(__ARM8M_BASELINE__)
+ #define __ARM_ARCH_8M_BASE__ 1
+ #elif defined(__ARM_ARCH_PROFILE) && __ARM_ARCH_PROFILE == 'M'
+ #if __ARM_ARCH == 6
+ #define __ARM_ARCH_6M__ 1
+ #elif __ARM_ARCH == 7
+ #if __ARM_FEATURE_DSP
+ #define __ARM_ARCH_7EM__ 1
+ #else
+ #define __ARM_ARCH_7M__ 1
+ #endif
+ #endif /* __ARM_ARCH */
+ #endif /* __ARM_ARCH_PROFILE == 'M' */
+#endif
+
+/* Alternativ core deduction for older ICCARM's */
+#if !defined(__ARM_ARCH_6M__) && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__) && \
+ !defined(__ARM_ARCH_8M_BASE__) && !defined(__ARM_ARCH_8M_MAIN__)
+ #if defined(__ARM6M__) && (__CORE__ == __ARM6M__)
+ #define __ARM_ARCH_6M__ 1
+ #elif defined(__ARM7M__) && (__CORE__ == __ARM7M__)
+ #define __ARM_ARCH_7M__ 1
+ #elif defined(__ARM7EM__) && (__CORE__ == __ARM7EM__)
+ #define __ARM_ARCH_7EM__ 1
+ #elif defined(__ARM8M_BASELINE__) && (__CORE == __ARM8M_BASELINE__)
+ #define __ARM_ARCH_8M_BASE__ 1
+ #elif defined(__ARM8M_MAINLINE__) && (__CORE == __ARM8M_MAINLINE__)
+ #define __ARM_ARCH_8M_MAIN__ 1
+ #elif defined(__ARM8EM_MAINLINE__) && (__CORE == __ARM8EM_MAINLINE__)
+ #define __ARM_ARCH_8M_MAIN__ 1
+ #else
+ #error "Unknown target."
+ #endif
+#endif
+
+
+
+#if defined(__ARM_ARCH_6M__) && __ARM_ARCH_6M__==1
+ #define __IAR_M0_FAMILY 1
+#elif defined(__ARM_ARCH_8M_BASE__) && __ARM_ARCH_8M_BASE__==1
+ #define __IAR_M0_FAMILY 1
+#else
+ #define __IAR_M0_FAMILY 0
+#endif
+
+
+#ifndef __ASM
+ #define __ASM __asm
+#endif
+
+#ifndef __INLINE
+ #define __INLINE inline
+#endif
+
+#ifndef __NO_RETURN
+ #if __ICCARM_V8
+ #define __NO_RETURN __attribute__((__noreturn__))
+ #else
+ #define __NO_RETURN _Pragma("object_attribute=__noreturn")
+ #endif
+#endif
+
+#ifndef __PACKED
+ #if __ICCARM_V8
+ #define __PACKED __attribute__((packed, aligned(1)))
+ #else
+ /* Needs IAR language extensions */
+ #define __PACKED __packed
+ #endif
+#endif
+
+#ifndef __PACKED_STRUCT
+ #if __ICCARM_V8
+ #define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
+ #else
+ /* Needs IAR language extensions */
+ #define __PACKED_STRUCT __packed struct
+ #endif
+#endif
+
+#ifndef __PACKED_UNION
+ #if __ICCARM_V8
+ #define __PACKED_UNION union __attribute__((packed, aligned(1)))
+ #else
+ /* Needs IAR language extensions */
+ #define __PACKED_UNION __packed union
+ #endif
+#endif
+
+#ifndef __RESTRICT
+ #define __RESTRICT restrict
+#endif
+
+#ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static inline
+#endif
+
+#ifndef __FORCEINLINE
+ #define __FORCEINLINE _Pragma("inline=forced")
+#endif
+
+#ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __FORCEINLINE __STATIC_INLINE
+#endif
+
+#ifndef __UNALIGNED_UINT16_READ
+#pragma language=save
+#pragma language=extended
+__IAR_FT uint16_t __iar_uint16_read(void const *ptr)
+{
+ return *(__packed uint16_t*)(ptr);
+}
+#pragma language=restore
+#define __UNALIGNED_UINT16_READ(PTR) __iar_uint16_read(PTR)
+#endif
+
+
+#ifndef __UNALIGNED_UINT16_WRITE
+#pragma language=save
+#pragma language=extended
+__IAR_FT void __iar_uint16_write(void const *ptr, uint16_t val)
+{
+ *(__packed uint16_t*)(ptr) = val;;
+}
+#pragma language=restore
+#define __UNALIGNED_UINT16_WRITE(PTR,VAL) __iar_uint16_write(PTR,VAL)
+#endif
+
+#ifndef __UNALIGNED_UINT32_READ
+#pragma language=save
+#pragma language=extended
+__IAR_FT uint32_t __iar_uint32_read(void const *ptr)
+{
+ return *(__packed uint32_t*)(ptr);
+}
+#pragma language=restore
+#define __UNALIGNED_UINT32_READ(PTR) __iar_uint32_read(PTR)
+#endif
+
+#ifndef __UNALIGNED_UINT32_WRITE
+#pragma language=save
+#pragma language=extended
+__IAR_FT void __iar_uint32_write(void const *ptr, uint32_t val)
+{
+ *(__packed uint32_t*)(ptr) = val;;
+}
+#pragma language=restore
+#define __UNALIGNED_UINT32_WRITE(PTR,VAL) __iar_uint32_write(PTR,VAL)
+#endif
+
+#ifndef __UNALIGNED_UINT32 /* deprecated */
+#pragma language=save
+#pragma language=extended
+__packed struct __iar_u32 { uint32_t v; };
+#pragma language=restore
+#define __UNALIGNED_UINT32(PTR) (((struct __iar_u32 *)(PTR))->v)
+#endif
+
+#ifndef __USED
+ #if __ICCARM_V8
+ #define __USED __attribute__((used))
+ #else
+ #define __USED _Pragma("__root")
+ #endif
+#endif
+
+#ifndef __WEAK
+ #if __ICCARM_V8
+ #define __WEAK __attribute__((weak))
+ #else
+ #define __WEAK _Pragma("__weak")
+ #endif
+#endif
+
+
+#ifndef __ICCARM_INTRINSICS_VERSION__
+ #define __ICCARM_INTRINSICS_VERSION__ 0
+#endif
+
+#if __ICCARM_INTRINSICS_VERSION__ == 2
+
+ #if defined(__CLZ)
+ #undef __CLZ
+ #endif
+ #if defined(__REVSH)
+ #undef __REVSH
+ #endif
+ #if defined(__RBIT)
+ #undef __RBIT
+ #endif
+ #if defined(__SSAT)
+ #undef __SSAT
+ #endif
+ #if defined(__USAT)
+ #undef __USAT
+ #endif
+
+ #include "iccarm_builtin.h"
+
+ #define __disable_fault_irq __iar_builtin_disable_fiq
+ #define __disable_irq __iar_builtin_disable_interrupt
+ #define __enable_fault_irq __iar_builtin_enable_fiq
+ #define __enable_irq __iar_builtin_enable_interrupt
+ #define __arm_rsr __iar_builtin_rsr
+ #define __arm_wsr __iar_builtin_wsr
+
+
+ #define __get_APSR() (__arm_rsr("APSR"))
+ #define __get_BASEPRI() (__arm_rsr("BASEPRI"))
+ #define __get_CONTROL() (__arm_rsr("CONTROL"))
+ #define __get_FAULTMASK() (__arm_rsr("FAULTMASK"))
+
+ #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+ #define __get_FPSCR() (__arm_rsr("FPSCR"))
+ #define __set_FPSCR(VALUE) (__arm_wsr("FPSCR", (VALUE)))
+ #else
+ #define __get_FPSCR() ( 0 )
+ #define __set_FPSCR(VALUE) ((void)VALUE)
+ #endif
+
+ #define __get_IPSR() (__arm_rsr("IPSR"))
+ #define __get_MSP() (__arm_rsr("MSP"))
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ #define __get_MSPLIM() (0U)
+ #else
+ #define __get_MSPLIM() (__arm_rsr("MSPLIM"))
+ #endif
+ #define __get_PRIMASK() (__arm_rsr("PRIMASK"))
+ #define __get_PSP() (__arm_rsr("PSP"))
+
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ #define __get_PSPLIM() (0U)
+ #else
+ #define __get_PSPLIM() (__arm_rsr("PSPLIM"))
+ #endif
+
+ #define __get_xPSR() (__arm_rsr("xPSR"))
+
+ #define __set_BASEPRI(VALUE) (__arm_wsr("BASEPRI", (VALUE)))
+ #define __set_BASEPRI_MAX(VALUE) (__arm_wsr("BASEPRI_MAX", (VALUE)))
+ #define __set_CONTROL(VALUE) (__arm_wsr("CONTROL", (VALUE)))
+ #define __set_FAULTMASK(VALUE) (__arm_wsr("FAULTMASK", (VALUE)))
+ #define __set_MSP(VALUE) (__arm_wsr("MSP", (VALUE)))
+
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ #define __set_MSPLIM(VALUE) ((void)(VALUE))
+ #else
+ #define __set_MSPLIM(VALUE) (__arm_wsr("MSPLIM", (VALUE)))
+ #endif
+ #define __set_PRIMASK(VALUE) (__arm_wsr("PRIMASK", (VALUE)))
+ #define __set_PSP(VALUE) (__arm_wsr("PSP", (VALUE)))
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ #define __set_PSPLIM(VALUE) ((void)(VALUE))
+ #else
+ #define __set_PSPLIM(VALUE) (__arm_wsr("PSPLIM", (VALUE)))
+ #endif
+
+ #define __TZ_get_CONTROL_NS() (__arm_rsr("CONTROL_NS"))
+ #define __TZ_set_CONTROL_NS(VALUE) (__arm_wsr("CONTROL_NS", (VALUE)))
+ #define __TZ_get_PSP_NS() (__arm_rsr("PSP_NS"))
+ #define __TZ_set_PSP_NS(VALUE) (__arm_wsr("PSP_NS", (VALUE)))
+ #define __TZ_get_MSP_NS() (__arm_rsr("MSP_NS"))
+ #define __TZ_set_MSP_NS(VALUE) (__arm_wsr("MSP_NS", (VALUE)))
+ #define __TZ_get_SP_NS() (__arm_rsr("SP_NS"))
+ #define __TZ_set_SP_NS(VALUE) (__arm_wsr("SP_NS", (VALUE)))
+ #define __TZ_get_PRIMASK_NS() (__arm_rsr("PRIMASK_NS"))
+ #define __TZ_set_PRIMASK_NS(VALUE) (__arm_wsr("PRIMASK_NS", (VALUE)))
+ #define __TZ_get_BASEPRI_NS() (__arm_rsr("BASEPRI_NS"))
+ #define __TZ_set_BASEPRI_NS(VALUE) (__arm_wsr("BASEPRI_NS", (VALUE)))
+ #define __TZ_get_FAULTMASK_NS() (__arm_rsr("FAULTMASK_NS"))
+ #define __TZ_set_FAULTMASK_NS(VALUE)(__arm_wsr("FAULTMASK_NS", (VALUE)))
+ #define __TZ_get_PSPLIM_NS() (__arm_rsr("PSPLIM_NS"))
+ #define __TZ_set_PSPLIM_NS(VALUE) (__arm_wsr("PSPLIM_NS", (VALUE)))
+ #define __TZ_get_MSPLIM_NS() (__arm_rsr("MSPLIM_NS"))
+ #define __TZ_set_MSPLIM_NS(VALUE) (__arm_wsr("MSPLIM_NS", (VALUE)))
+
+ #define __NOP __iar_builtin_no_operation
+
+ #define __CLZ __iar_builtin_CLZ
+ #define __CLREX __iar_builtin_CLREX
+
+ #define __DMB __iar_builtin_DMB
+ #define __DSB __iar_builtin_DSB
+ #define __ISB __iar_builtin_ISB
+
+ #define __LDREXB __iar_builtin_LDREXB
+ #define __LDREXH __iar_builtin_LDREXH
+ #define __LDREXW __iar_builtin_LDREX
+
+ #define __RBIT __iar_builtin_RBIT
+ #define __REV __iar_builtin_REV
+ #define __REV16 __iar_builtin_REV16
+
+ __IAR_FT int16_t __REVSH(int16_t val)
+ {
+ return (int16_t) __iar_builtin_REVSH(val);
+ }
+
+ #define __ROR __iar_builtin_ROR
+ #define __RRX __iar_builtin_RRX
+
+ #define __SEV __iar_builtin_SEV
+
+ #if !__IAR_M0_FAMILY
+ #define __SSAT __iar_builtin_SSAT
+ #endif
+
+ #define __STREXB __iar_builtin_STREXB
+ #define __STREXH __iar_builtin_STREXH
+ #define __STREXW __iar_builtin_STREX
+
+ #if !__IAR_M0_FAMILY
+ #define __USAT __iar_builtin_USAT
+ #endif
+
+ #define __WFE __iar_builtin_WFE
+ #define __WFI __iar_builtin_WFI
+
+ #if __ARM_MEDIA__
+ #define __SADD8 __iar_builtin_SADD8
+ #define __QADD8 __iar_builtin_QADD8
+ #define __SHADD8 __iar_builtin_SHADD8
+ #define __UADD8 __iar_builtin_UADD8
+ #define __UQADD8 __iar_builtin_UQADD8
+ #define __UHADD8 __iar_builtin_UHADD8
+ #define __SSUB8 __iar_builtin_SSUB8
+ #define __QSUB8 __iar_builtin_QSUB8
+ #define __SHSUB8 __iar_builtin_SHSUB8
+ #define __USUB8 __iar_builtin_USUB8
+ #define __UQSUB8 __iar_builtin_UQSUB8
+ #define __UHSUB8 __iar_builtin_UHSUB8
+ #define __SADD16 __iar_builtin_SADD16
+ #define __QADD16 __iar_builtin_QADD16
+ #define __SHADD16 __iar_builtin_SHADD16
+ #define __UADD16 __iar_builtin_UADD16
+ #define __UQADD16 __iar_builtin_UQADD16
+ #define __UHADD16 __iar_builtin_UHADD16
+ #define __SSUB16 __iar_builtin_SSUB16
+ #define __QSUB16 __iar_builtin_QSUB16
+ #define __SHSUB16 __iar_builtin_SHSUB16
+ #define __USUB16 __iar_builtin_USUB16
+ #define __UQSUB16 __iar_builtin_UQSUB16
+ #define __UHSUB16 __iar_builtin_UHSUB16
+ #define __SASX __iar_builtin_SASX
+ #define __QASX __iar_builtin_QASX
+ #define __SHASX __iar_builtin_SHASX
+ #define __UASX __iar_builtin_UASX
+ #define __UQASX __iar_builtin_UQASX
+ #define __UHASX __iar_builtin_UHASX
+ #define __SSAX __iar_builtin_SSAX
+ #define __QSAX __iar_builtin_QSAX
+ #define __SHSAX __iar_builtin_SHSAX
+ #define __USAX __iar_builtin_USAX
+ #define __UQSAX __iar_builtin_UQSAX
+ #define __UHSAX __iar_builtin_UHSAX
+ #define __USAD8 __iar_builtin_USAD8
+ #define __USADA8 __iar_builtin_USADA8
+ #define __SSAT16 __iar_builtin_SSAT16
+ #define __USAT16 __iar_builtin_USAT16
+ #define __UXTB16 __iar_builtin_UXTB16
+ #define __UXTAB16 __iar_builtin_UXTAB16
+ #define __SXTB16 __iar_builtin_SXTB16
+ #define __SXTAB16 __iar_builtin_SXTAB16
+ #define __SMUAD __iar_builtin_SMUAD
+ #define __SMUADX __iar_builtin_SMUADX
+ #define __SMMLA __iar_builtin_SMMLA
+ #define __SMLAD __iar_builtin_SMLAD
+ #define __SMLADX __iar_builtin_SMLADX
+ #define __SMLALD __iar_builtin_SMLALD
+ #define __SMLALDX __iar_builtin_SMLALDX
+ #define __SMUSD __iar_builtin_SMUSD
+ #define __SMUSDX __iar_builtin_SMUSDX
+ #define __SMLSD __iar_builtin_SMLSD
+ #define __SMLSDX __iar_builtin_SMLSDX
+ #define __SMLSLD __iar_builtin_SMLSLD
+ #define __SMLSLDX __iar_builtin_SMLSLDX
+ #define __SEL __iar_builtin_SEL
+ #define __QADD __iar_builtin_QADD
+ #define __QSUB __iar_builtin_QSUB
+ #define __PKHBT __iar_builtin_PKHBT
+ #define __PKHTB __iar_builtin_PKHTB
+ #endif
+
+#else /* __ICCARM_INTRINSICS_VERSION__ == 2 */
+
+ #if __IAR_M0_FAMILY
+ /* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */
+ #define __CLZ __cmsis_iar_clz_not_active
+ #define __SSAT __cmsis_iar_ssat_not_active
+ #define __USAT __cmsis_iar_usat_not_active
+ #define __RBIT __cmsis_iar_rbit_not_active
+ #define __get_APSR __cmsis_iar_get_APSR_not_active
+ #endif
+
+
+ #if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) ))
+ #define __get_FPSCR __cmsis_iar_get_FPSR_not_active
+ #define __set_FPSCR __cmsis_iar_set_FPSR_not_active
+ #endif
+
+ #ifdef __INTRINSICS_INCLUDED
+ #error intrinsics.h is already included previously!
+ #endif
+
+ #include
+
+ #if __IAR_M0_FAMILY
+ /* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */
+ #undef __CLZ
+ #undef __SSAT
+ #undef __USAT
+ #undef __RBIT
+ #undef __get_APSR
+
+ __STATIC_INLINE uint8_t __CLZ(uint32_t data)
+ {
+ if (data == 0U) { return 32U; }
+
+ uint32_t count = 0U;
+ uint32_t mask = 0x80000000U;
+
+ while ((data & mask) == 0U)
+ {
+ count += 1U;
+ mask = mask >> 1U;
+ }
+ return count;
+ }
+
+ __STATIC_INLINE uint32_t __RBIT(uint32_t v)
+ {
+ uint8_t sc = 31U;
+ uint32_t r = v;
+ for (v >>= 1U; v; v >>= 1U)
+ {
+ r <<= 1U;
+ r |= v & 1U;
+ sc--;
+ }
+ return (r << sc);
+ }
+
+ __STATIC_INLINE uint32_t __get_APSR(void)
+ {
+ uint32_t res;
+ __asm("MRS %0,APSR" : "=r" (res));
+ return res;
+ }
+
+ #endif
+
+ #if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) ))
+ #undef __get_FPSCR
+ #undef __set_FPSCR
+ #define __get_FPSCR() (0)
+ #define __set_FPSCR(VALUE) ((void)VALUE)
+ #endif
+
+ #pragma diag_suppress=Pe940
+ #pragma diag_suppress=Pe177
+
+ #define __enable_irq __enable_interrupt
+ #define __disable_irq __disable_interrupt
+ #define __NOP __no_operation
+
+ #define __get_xPSR __get_PSR
+
+ #if (!defined(__ARM_ARCH_6M__) || __ARM_ARCH_6M__==0)
+
+ __IAR_FT uint32_t __LDREXW(uint32_t volatile *ptr)
+ {
+ return __LDREX((unsigned long *)ptr);
+ }
+
+ __IAR_FT uint32_t __STREXW(uint32_t value, uint32_t volatile *ptr)
+ {
+ return __STREX(value, (unsigned long *)ptr);
+ }
+ #endif
+
+
+ /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */
+ #if (__CORTEX_M >= 0x03)
+
+ __IAR_FT uint32_t __RRX(uint32_t value)
+ {
+ uint32_t result;
+ __ASM("RRX %0, %1" : "=r"(result) : "r" (value) : "cc");
+ return(result);
+ }
+
+ __IAR_FT void __set_BASEPRI_MAX(uint32_t value)
+ {
+ __asm volatile("MSR BASEPRI_MAX,%0"::"r" (value));
+ }
+
+
+ #define __enable_fault_irq __enable_fiq
+ #define __disable_fault_irq __disable_fiq
+
+
+ #endif /* (__CORTEX_M >= 0x03) */
+
+ __IAR_FT uint32_t __ROR(uint32_t op1, uint32_t op2)
+ {
+ return (op1 >> op2) | (op1 << ((sizeof(op1)*8)-op2));
+ }
+
+ #if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+
+ __IAR_FT uint32_t __get_MSPLIM(void)
+ {
+ uint32_t res;
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ res = 0U;
+ #else
+ __asm volatile("MRS %0,MSPLIM" : "=r" (res));
+ #endif
+ return res;
+ }
+
+ __IAR_FT void __set_MSPLIM(uint32_t value)
+ {
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)value;
+ #else
+ __asm volatile("MSR MSPLIM,%0" :: "r" (value));
+ #endif
+ }
+
+ __IAR_FT uint32_t __get_PSPLIM(void)
+ {
+ uint32_t res;
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ res = 0U;
+ #else
+ __asm volatile("MRS %0,PSPLIM" : "=r" (res));
+ #endif
+ return res;
+ }
+
+ __IAR_FT void __set_PSPLIM(uint32_t value)
+ {
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)value;
+ #else
+ __asm volatile("MSR PSPLIM,%0" :: "r" (value));
+ #endif
+ }
+
+ __IAR_FT uint32_t __TZ_get_CONTROL_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,CONTROL_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_CONTROL_NS(uint32_t value)
+ {
+ __asm volatile("MSR CONTROL_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_PSP_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,PSP_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_PSP_NS(uint32_t value)
+ {
+ __asm volatile("MSR PSP_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_MSP_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,MSP_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_MSP_NS(uint32_t value)
+ {
+ __asm volatile("MSR MSP_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_SP_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,SP_NS" : "=r" (res));
+ return res;
+ }
+ __IAR_FT void __TZ_set_SP_NS(uint32_t value)
+ {
+ __asm volatile("MSR SP_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_PRIMASK_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,PRIMASK_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_PRIMASK_NS(uint32_t value)
+ {
+ __asm volatile("MSR PRIMASK_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_BASEPRI_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,BASEPRI_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_BASEPRI_NS(uint32_t value)
+ {
+ __asm volatile("MSR BASEPRI_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_FAULTMASK_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,FAULTMASK_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_FAULTMASK_NS(uint32_t value)
+ {
+ __asm volatile("MSR FAULTMASK_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_PSPLIM_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,PSPLIM_NS" : "=r" (res));
+ return res;
+ }
+ __IAR_FT void __TZ_set_PSPLIM_NS(uint32_t value)
+ {
+ __asm volatile("MSR PSPLIM_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_MSPLIM_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,MSPLIM_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_MSPLIM_NS(uint32_t value)
+ {
+ __asm volatile("MSR MSPLIM_NS,%0" :: "r" (value));
+ }
+
+ #endif /* __ARM_ARCH_8M_MAIN__ or __ARM_ARCH_8M_BASE__ */
+
+#endif /* __ICCARM_INTRINSICS_VERSION__ == 2 */
+
+#define __BKPT(value) __asm volatile ("BKPT %0" : : "i"(value))
+
+#if __IAR_M0_FAMILY
+ __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat)
+ {
+ if ((sat >= 1U) && (sat <= 32U))
+ {
+ const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
+ const int32_t min = -1 - max ;
+ if (val > max)
+ {
+ return max;
+ }
+ else if (val < min)
+ {
+ return min;
+ }
+ }
+ return val;
+ }
+
+ __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat)
+ {
+ if (sat <= 31U)
+ {
+ const uint32_t max = ((1U << sat) - 1U);
+ if (val > (int32_t)max)
+ {
+ return max;
+ }
+ else if (val < 0)
+ {
+ return 0U;
+ }
+ }
+ return (uint32_t)val;
+ }
+#endif
+
+#if (__CORTEX_M >= 0x03) /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */
+
+ __IAR_FT uint8_t __LDRBT(volatile uint8_t *addr)
+ {
+ uint32_t res;
+ __ASM("LDRBT %0, [%1]" : "=r" (res) : "r" (addr) : "memory");
+ return ((uint8_t)res);
+ }
+
+ __IAR_FT uint16_t __LDRHT(volatile uint16_t *addr)
+ {
+ uint32_t res;
+ __ASM("LDRHT %0, [%1]" : "=r" (res) : "r" (addr) : "memory");
+ return ((uint16_t)res);
+ }
+
+ __IAR_FT uint32_t __LDRT(volatile uint32_t *addr)
+ {
+ uint32_t res;
+ __ASM("LDRT %0, [%1]" : "=r" (res) : "r" (addr) : "memory");
+ return res;
+ }
+
+ __IAR_FT void __STRBT(uint8_t value, volatile uint8_t *addr)
+ {
+ __ASM("STRBT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory");
+ }
+
+ __IAR_FT void __STRHT(uint16_t value, volatile uint16_t *addr)
+ {
+ __ASM("STRHT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory");
+ }
+
+ __IAR_FT void __STRT(uint32_t value, volatile uint32_t *addr)
+ {
+ __ASM("STRT %1, [%0]" : : "r" (addr), "r" (value) : "memory");
+ }
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+
+
+ __IAR_FT uint8_t __LDAB(volatile uint8_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDAB %0, [%1]" : "=r" (res) : "r" (*ptr) : "memory");
+ return ((uint8_t)res);
+ }
+
+ __IAR_FT uint16_t __LDAH(volatile uint16_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDAH %0, [%1]" : "=r" (res) : "r" (*ptr) : "memory");
+ return ((uint16_t)res);
+ }
+
+ __IAR_FT uint32_t __LDA(volatile uint32_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDA %0, [%1]" : "=r" (res) : "r" (*ptr) : "memory");
+ return res;
+ }
+
+ __IAR_FT void __STLB(uint8_t value, volatile uint8_t *ptr)
+ {
+ __ASM volatile ("STLB %1, [%0]" :: "r" (*ptr), "r" (value) : "memory");
+ }
+
+ __IAR_FT void __STLH(uint16_t value, volatile uint16_t *ptr)
+ {
+ __ASM volatile ("STLH %1, [%0]" :: "r" (*ptr), "r" (value) : "memory");
+ }
+
+ __IAR_FT void __STL(uint32_t value, volatile uint32_t *ptr)
+ {
+ __ASM volatile ("STL %1, [%0]" :: "r" (*ptr), "r" (value) : "memory");
+ }
+
+ __IAR_FT uint8_t __LDAEXB(volatile uint8_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDAEXB %0, [%1]" : "=r" (res) : "r" (*ptr) : "memory");
+ return ((uint8_t)res);
+ }
+
+ __IAR_FT uint16_t __LDAEXH(volatile uint16_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDAEXH %0, [%1]" : "=r" (res) : "r" (*ptr) : "memory");
+ return ((uint16_t)res);
+ }
+
+ __IAR_FT uint32_t __LDAEX(volatile uint32_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDAEX %0, [%1]" : "=r" (res) : "r" (*ptr) : "memory");
+ return res;
+ }
+
+ __IAR_FT uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("STLEXB %0, %2, [%1]" : "=r" (res) : "r" (*ptr), "r" (value) : "memory");
+ return res;
+ }
+
+ __IAR_FT uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("STLEXH %0, %2, [%1]" : "=r" (res) : "r" (*ptr), "r" (value) : "memory");
+ return res;
+ }
+
+ __IAR_FT uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("STLEX %0, %2, [%1]" : "=r" (res) : "r" (*ptr), "r" (value) : "memory");
+ return res;
+ }
+
+#endif /* __ARM_ARCH_8M_MAIN__ or __ARM_ARCH_8M_BASE__ */
+
+#undef __IAR_FT
+#undef __IAR_M0_FAMILY
+#undef __ICCARM_V8
+
+#pragma diag_default=Pe940
+#pragma diag_default=Pe177
+
+#endif /* __CMSIS_ICCARM_H__ */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_version.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_version.h
new file mode 100644
index 0000000000000000000000000000000000000000..660f612aa31fe2a71cc786af5cac407e41fdd144
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_version.h
@@ -0,0 +1,39 @@
+/**************************************************************************//**
+ * @file cmsis_version.h
+ * @brief CMSIS Core(M) Version definitions
+ * @version V5.0.2
+ * @date 19. April 2017
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CMSIS_VERSION_H
+#define __CMSIS_VERSION_H
+
+/* CMSIS Version definitions */
+#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
+#define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */
+#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
+ __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
+#endif
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mbl.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mbl.h
new file mode 100644
index 0000000000000000000000000000000000000000..47a39893aced51da4790b504c92a3bde53204a19
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mbl.h
@@ -0,0 +1,1896 @@
+/**************************************************************************//**
+ * @file core_armv8mbl.h
+ * @brief CMSIS Armv8-M Baseline Core Peripheral Access Layer Header File
+ * @version V5.0.4
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_ARMV8MBL_H_GENERIC
+#define __CORE_ARMV8MBL_H_GENERIC
+
+#include
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_ARMv8MBL
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS definitions */
+#define __ARMv8MBL_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __ARMv8MBL_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __ARMv8MBL_CMSIS_VERSION ((__ARMv8MBL_CMSIS_VERSION_MAIN << 16U) | \
+ __ARMv8MBL_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M ( 2U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_PCS_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_ARMV8MBL_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_ARMV8MBL_H_DEPENDANT
+#define __CORE_ARMV8MBL_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __ARMv8MBL_REV
+ #define __ARMv8MBL_REV 0x0000U
+ #warning "__ARMv8MBL_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __SAUREGION_PRESENT
+ #define __SAUREGION_PRESENT 0U
+ #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __VTOR_PRESENT
+ #define __VTOR_PRESENT 0U
+ #warning "__VTOR_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+
+ #ifndef __ETM_PRESENT
+ #define __ETM_PRESENT 0U
+ #warning "__ETM_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MTB_PRESENT
+ #define __MTB_PRESENT 0U
+ #warning "__MTB_PRESENT not defined in device header file; using default!"
+ #endif
+
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ IO Type Qualifiers are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group ARMv8MBL */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core SAU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[16U];
+ __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[16U];
+ __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[16U];
+ __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[16U];
+ __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[16U];
+ __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
+ uint32_t RESERVED5[16U];
+ __IOM uint32_t IPR[124U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+#else
+ uint32_t RESERVED0;
+#endif
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED1;
+ __IOM uint32_t SHPR[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
+#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
+
+#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
+#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
+#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+#endif
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
+#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
+
+#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
+#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
+
+#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
+#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
+#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
+
+#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
+#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
+#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
+#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
+
+#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
+#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ uint32_t RESERVED0[6U];
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ uint32_t RESERVED3[1U];
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ uint32_t RESERVED5[1U];
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED6[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ uint32_t RESERVED7[1U];
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
+ uint32_t RESERVED9[1U];
+ __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
+ uint32_t RESERVED10[1U];
+ __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
+ uint32_t RESERVED11[1U];
+ __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
+ uint32_t RESERVED12[1U];
+ __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
+ uint32_t RESERVED13[1U];
+ __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
+ uint32_t RESERVED14[1U];
+ __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
+ uint32_t RESERVED15[1U];
+ __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
+ uint32_t RESERVED16[1U];
+ __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
+ uint32_t RESERVED17[1U];
+ __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
+ uint32_t RESERVED18[1U];
+ __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
+ uint32_t RESERVED19[1U];
+ __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
+ uint32_t RESERVED20[1U];
+ __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
+ uint32_t RESERVED21[1U];
+ __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
+ uint32_t RESERVED22[1U];
+ __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
+ uint32_t RESERVED23[1U];
+ __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
+ uint32_t RESERVED24[1U];
+ __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
+ uint32_t RESERVED25[1U];
+ __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
+ uint32_t RESERVED26[1U];
+ __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
+ uint32_t RESERVED27[1U];
+ __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
+ uint32_t RESERVED28[1U];
+ __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
+ uint32_t RESERVED29[1U];
+ __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
+ uint32_t RESERVED30[1U];
+ __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
+ uint32_t RESERVED31[1U];
+ __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
+#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
+
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
+#define DWT_FUNCTION_ACTION_Msk (0x3UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
+
+#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
+#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IOM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */
+ __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
+ __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
+ __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY_Pos 0U /*!< TPI ITATBCTR2: ATREADY Position */
+#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY_Pos 0U /*!< TPI ITATBCTR0: ATREADY Position */
+#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_MajorType_Pos 4U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+#define TPI_DEVTYPE_SubType_Pos 0U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
+ uint32_t RESERVED0[7U];
+ union {
+ __IOM uint32_t MAIR[2];
+ struct {
+ __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
+ __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
+ };
+ };
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 1U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */
+#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */
+
+#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
+#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
+
+#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
+#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
+
+#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
+#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
+
+/* MPU Region Limit Address Register Definitions */
+#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
+#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
+
+#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
+#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
+
+#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: EN Position */
+#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: EN Mask */
+
+/* MPU Memory Attribute Indirection Register 0 Definitions */
+#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
+#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
+
+#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
+#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
+
+#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
+#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
+
+#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
+#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
+
+/* MPU Memory Attribute Indirection Register 1 Definitions */
+#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
+#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
+
+#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
+#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
+
+#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
+#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
+
+#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
+#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SAU Security Attribution Unit (SAU)
+ \brief Type definitions for the Security Attribution Unit (SAU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Security Attribution Unit (SAU).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
+ __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
+#endif
+} SAU_Type;
+
+/* SAU Control Register Definitions */
+#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
+#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
+
+#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
+#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
+
+/* SAU Type Register Definitions */
+#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
+#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
+
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+/* SAU Region Number Register Definitions */
+#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
+#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
+
+/* SAU Region Base Address Register Definitions */
+#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
+#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
+
+/* SAU Region Limit Address Register Definitions */
+#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
+#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
+
+#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
+#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
+
+#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
+#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
+
+#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
+
+/*@} end of group CMSIS_SAU */
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
+ __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */
+#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register */
+#define CoreDebug_DEMCR_DWTENA_Pos 24U /*!< CoreDebug DEMCR: DWTENA Position */
+#define CoreDebug_DEMCR_DWTENA_Msk (1UL << CoreDebug_DEMCR_DWTENA_Pos) /*!< CoreDebug DEMCR: DWTENA Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/* Debug Authentication Control Register Definitions */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
+
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
+
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */
+
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */
+
+/* Debug Security Control and Status Register Definitions */
+#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */
+#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */
+
+#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */
+#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */
+
+#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */
+#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+ #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+ #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+ #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+ #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+
+ #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+ #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+ #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+ #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+ #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+ #endif
+
+ #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
+ #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
+ #endif
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
+ #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */
+ #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
+ #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
+ #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
+
+ #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
+ #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
+ #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
+ #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
+ #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
+ #endif
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Armv8-M Baseline */
+/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Armv8-M Baseline */
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Get Interrupt Target State
+ \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ \return 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Target State
+ \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Clear Interrupt Target State
+ \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ If VTOR is not present address 0 must be mapped to SRAM.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+#else
+ uint32_t *vectors = (uint32_t *)0x0U;
+#endif
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+#else
+ uint32_t *vectors = (uint32_t *)0x0U;
+#endif
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Enable Interrupt (non-secure)
+ \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status (non-secure)
+ \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt (non-secure)
+ \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt (non-secure)
+ \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt (non-secure)
+ \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt (non-secure)
+ \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt (non-secure)
+ \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority (non-secure)
+ \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every non-secure processor exception.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC_NS->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB_NS->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB_NS->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority (non-secure)
+ \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB_NS->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv8.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## SAU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SAUFunctions SAU Functions
+ \brief Functions that configure the SAU.
+ @{
+ */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+
+/**
+ \brief Enable SAU
+ \details Enables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Enable(void)
+{
+ SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
+}
+
+
+
+/**
+ \brief Disable SAU
+ \details Disables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Disable(void)
+{
+ SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
+}
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_SAUFunctions */
+
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function SysTick_Config is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief System Tick Configuration (non-secure)
+ \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function TZ_SysTick_Config_NS is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_ARMV8MBL_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mml.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mml.h
new file mode 100644
index 0000000000000000000000000000000000000000..0951a1f78126b48bf8279a71ecdafbbe4fc50f11
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mml.h
@@ -0,0 +1,2960 @@
+/**************************************************************************//**
+ * @file core_armv8mml.h
+ * @brief CMSIS Armv8-M Mainline Core Peripheral Access Layer Header File
+ * @version V5.0.4
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_ARMV8MML_H_GENERIC
+#define __CORE_ARMV8MML_H_GENERIC
+
+#include
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_ARMv8MML
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS Armv8MML definitions */
+#define __ARMv8MML_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __ARMv8MML_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __ARMv8MML_CMSIS_VERSION ((__ARMv8MML_CMSIS_VERSION_MAIN << 16U) | \
+ __ARMv8MML_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (81U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
+*/
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_PCS_VFP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_ARMV8MML_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_ARMV8MML_H_DEPENDANT
+#define __CORE_ARMV8MML_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __ARMv8MML_REV
+ #define __ARMv8MML_REV 0x0000U
+ #warning "__ARMv8MML_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __SAUREGION_PRESENT
+ #define __SAUREGION_PRESENT 0U
+ #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __DSP_PRESENT
+ #define __DSP_PRESENT 0U
+ #warning "__DSP_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ IO Type Qualifiers are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group ARMv8MML */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core SAU Register
+ - Core FPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+#define APSR_GE_Pos 16U /*!< APSR: GE Position */
+#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */
+#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */
+#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
+ uint32_t FPCA:1; /*!< bit: 2 Floating-point context active */
+ uint32_t SFPA:1; /*!< bit: 3 Secure floating-point active */
+ uint32_t _reserved1:28; /*!< bit: 4..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SFPA_Pos 3U /*!< CONTROL: SFPA Position */
+#define CONTROL_SFPA_Msk (1UL << CONTROL_SFPA_Pos) /*!< CONTROL: SFPA Mask */
+
+#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */
+#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */
+
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[16U];
+ __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[16U];
+ __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[16U];
+ __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[16U];
+ __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[16U];
+ __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
+ uint32_t RESERVED5[16U];
+ __IOM uint8_t IPR[496U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED6[580U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ID_ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t ID_MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ID_ISAR[6U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */
+ __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */
+ __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */
+ __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+ __IOM uint32_t NSACR; /*!< Offset: 0x08C (R/W) Non-Secure Access Control Register */
+ uint32_t RESERVED3[92U];
+ __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */
+ uint32_t RESERVED4[15U];
+ __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */
+ __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */
+ uint32_t RESERVED5[1U];
+ __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */
+ uint32_t RESERVED6[1U];
+ __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */
+ __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */
+ __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */
+ __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */
+ __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */
+ __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */
+ __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */
+ __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */
+ uint32_t RESERVED7[6U];
+ __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */
+ __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */
+ __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */
+ __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */
+ __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
+#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
+
+#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
+#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
+#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
+#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
+
+#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
+#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
+#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
+#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
+
+#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
+#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
+#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTPENDED_Pos 20U /*!< SCB SHCSR: SECUREFAULTPENDED Position */
+#define SCB_SHCSR_SECUREFAULTPENDED_Msk (1UL << SCB_SHCSR_SECUREFAULTPENDED_Pos) /*!< SCB SHCSR: SECUREFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTENA_Pos 19U /*!< SCB SHCSR: SECUREFAULTENA Position */
+#define SCB_SHCSR_SECUREFAULTENA_Msk (1UL << SCB_SHCSR_SECUREFAULTENA_Pos) /*!< SCB SHCSR: SECUREFAULTENA Mask */
+
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
+#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
+
+#define SCB_SHCSR_SECUREFAULTACT_Pos 4U /*!< SCB SHCSR: SECUREFAULTACT Position */
+#define SCB_SHCSR_SECUREFAULTACT_Msk (1UL << SCB_SHCSR_SECUREFAULTACT_Pos) /*!< SCB SHCSR: SECUREFAULTACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
+#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */
+#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */
+#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_STKOF_Pos (SCB_CFSR_USGFAULTSR_Pos + 4U) /*!< SCB CFSR (UFSR): STKOF Position */
+#define SCB_CFSR_STKOF_Msk (1UL << SCB_CFSR_STKOF_Pos) /*!< SCB CFSR (UFSR): STKOF Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/* SCB Non-Secure Access Control Register Definitions */
+#define SCB_NSACR_CP11_Pos 11U /*!< SCB NSACR: CP11 Position */
+#define SCB_NSACR_CP11_Msk (1UL << SCB_NSACR_CP11_Pos) /*!< SCB NSACR: CP11 Mask */
+
+#define SCB_NSACR_CP10_Pos 10U /*!< SCB NSACR: CP10 Position */
+#define SCB_NSACR_CP10_Msk (1UL << SCB_NSACR_CP10_Pos) /*!< SCB NSACR: CP10 Mask */
+
+#define SCB_NSACR_CPn_Pos 0U /*!< SCB NSACR: CPn Position */
+#define SCB_NSACR_CPn_Msk (1UL /*<< SCB_NSACR_CPn_Pos*/) /*!< SCB NSACR: CPn Mask */
+
+/* SCB Cache Level ID Register Definitions */
+#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */
+#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */
+
+#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */
+#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */
+
+/* SCB Cache Type Register Definitions */
+#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */
+#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */
+
+#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */
+#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */
+
+#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */
+#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */
+
+#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */
+#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */
+
+#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */
+#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */
+
+/* SCB Cache Size ID Register Definitions */
+#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */
+#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */
+
+#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */
+#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */
+
+#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */
+#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */
+
+#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */
+#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */
+
+#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */
+#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */
+
+#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */
+#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */
+
+#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */
+#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */
+
+/* SCB Cache Size Selection Register Definitions */
+#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */
+#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */
+
+#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */
+#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */
+
+/* SCB Software Triggered Interrupt Register Definitions */
+#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */
+#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */
+
+/* SCB D-Cache Invalidate by Set-way Register Definitions */
+#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */
+#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */
+
+#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */
+#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */
+
+/* SCB D-Cache Clean by Set-way Register Definitions */
+#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */
+#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */
+
+#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */
+#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */
+
+/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */
+#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */
+#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */
+
+#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */
+#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */
+
+/* Instruction Tightly-Coupled Memory Control Register Definitions */
+#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */
+#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */
+
+#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */
+#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */
+
+#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */
+#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */
+
+#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */
+#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */
+
+/* Data Tightly-Coupled Memory Control Register Definitions */
+#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */
+#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */
+
+#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */
+#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */
+
+#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */
+#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */
+
+#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */
+#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */
+
+/* AHBP Control Register Definitions */
+#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */
+#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */
+
+#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */
+#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */
+
+/* L1 Cache Control Register Definitions */
+#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */
+#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */
+
+#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */
+#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */
+
+#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */
+#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */
+
+/* AHBS Control Register Definitions */
+#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */
+#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */
+
+#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */
+#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */
+
+#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/
+#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */
+
+/* Auxiliary Bus Fault Status Register Definitions */
+#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/
+#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */
+
+#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/
+#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */
+
+#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/
+#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */
+
+#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/
+#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */
+
+#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/
+#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */
+
+#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/
+#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+ __IOM uint32_t CPPWR; /*!< Offset: 0x00C (R/W) Coprocessor Power Control Register */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[29U];
+ __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */
+ __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */
+ __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) ITM Device Architecture Register */
+ uint32_t RESERVED6[4U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Stimulus Port Register Definitions */
+#define ITM_STIM_DISABLED_Pos 1U /*!< ITM STIM: DISABLED Position */
+#define ITM_STIM_DISABLED_Msk (0x1UL << ITM_STIM_DISABLED_Pos) /*!< ITM STIM: DISABLED Mask */
+
+#define ITM_STIM_FIFOREADY_Pos 0U /*!< ITM STIM: FIFOREADY Position */
+#define ITM_STIM_FIFOREADY_Msk (0x1UL /*<< ITM_STIM_FIFOREADY_Pos*/) /*!< ITM STIM: FIFOREADY Mask */
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TRACEBUSID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPRESCALE_Pos 8U /*!< ITM TCR: TSPRESCALE Position */
+#define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos) /*!< ITM TCR: TSPRESCALE Mask */
+
+#define ITM_TCR_STALLENA_Pos 5U /*!< ITM TCR: STALLENA Position */
+#define ITM_TCR_STALLENA_Msk (1UL << ITM_TCR_STALLENA_Pos) /*!< ITM TCR: STALLENA Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Integration Write Register Definitions */
+#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */
+#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */
+
+/* ITM Integration Read Register Definitions */
+#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */
+#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */
+
+/* ITM Integration Mode Control Register Definitions */
+#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */
+#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ uint32_t RESERVED3[1U];
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ uint32_t RESERVED5[1U];
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED6[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ uint32_t RESERVED7[1U];
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
+ uint32_t RESERVED9[1U];
+ __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
+ uint32_t RESERVED10[1U];
+ __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
+ uint32_t RESERVED11[1U];
+ __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
+ uint32_t RESERVED12[1U];
+ __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
+ uint32_t RESERVED13[1U];
+ __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
+ uint32_t RESERVED14[1U];
+ __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
+ uint32_t RESERVED15[1U];
+ __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
+ uint32_t RESERVED16[1U];
+ __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
+ uint32_t RESERVED17[1U];
+ __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
+ uint32_t RESERVED18[1U];
+ __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
+ uint32_t RESERVED19[1U];
+ __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
+ uint32_t RESERVED20[1U];
+ __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
+ uint32_t RESERVED21[1U];
+ __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
+ uint32_t RESERVED22[1U];
+ __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
+ uint32_t RESERVED23[1U];
+ __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
+ uint32_t RESERVED24[1U];
+ __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
+ uint32_t RESERVED25[1U];
+ __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
+ uint32_t RESERVED26[1U];
+ __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
+ uint32_t RESERVED27[1U];
+ __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
+ uint32_t RESERVED28[1U];
+ __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
+ uint32_t RESERVED29[1U];
+ __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
+ uint32_t RESERVED30[1U];
+ __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
+ uint32_t RESERVED31[1U];
+ __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
+ uint32_t RESERVED32[934U];
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */
+ uint32_t RESERVED33[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) Device Architecture Register */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCDISS_Pos 23U /*!< DWT CTRL: CYCDISS Position */
+#define DWT_CTRL_CYCDISS_Msk (0x1UL << DWT_CTRL_CYCDISS_Pos) /*!< DWT CTRL: CYCDISS Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
+#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
+
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
+#define DWT_FUNCTION_ACTION_Msk (0x1UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
+
+#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
+#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IOM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */
+ __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
+ __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
+ __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY_Pos 0U /*!< TPI ITATBCTR2: ATREADY Position */
+#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY_Pos 0U /*!< TPI ITATBCTR0: ATREADY Position */
+#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_MajorType_Pos 4U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+#define TPI_DEVTYPE_SubType_Pos 0U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Region Base Address Register Alias 1 */
+ __IOM uint32_t RLAR_A1; /*!< Offset: 0x018 (R/W) MPU Region Limit Address Register Alias 1 */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Region Base Address Register Alias 2 */
+ __IOM uint32_t RLAR_A2; /*!< Offset: 0x020 (R/W) MPU Region Limit Address Register Alias 2 */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Region Base Address Register Alias 3 */
+ __IOM uint32_t RLAR_A3; /*!< Offset: 0x028 (R/W) MPU Region Limit Address Register Alias 3 */
+ uint32_t RESERVED0[1];
+ union {
+ __IOM uint32_t MAIR[2];
+ struct {
+ __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
+ __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
+ };
+ };
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 4U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
+#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
+
+#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
+#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
+
+#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
+#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
+
+/* MPU Region Limit Address Register Definitions */
+#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
+#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
+
+#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
+#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
+
+#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: Region enable bit Position */
+#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: Region enable bit Disable Mask */
+
+/* MPU Memory Attribute Indirection Register 0 Definitions */
+#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
+#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
+
+#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
+#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
+
+#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
+#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
+
+#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
+#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
+
+/* MPU Memory Attribute Indirection Register 1 Definitions */
+#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
+#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
+
+#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
+#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
+
+#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
+#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
+
+#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
+#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SAU Security Attribution Unit (SAU)
+ \brief Type definitions for the Security Attribution Unit (SAU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Security Attribution Unit (SAU).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
+ __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
+#else
+ uint32_t RESERVED0[3];
+#endif
+ __IOM uint32_t SFSR; /*!< Offset: 0x014 (R/W) Secure Fault Status Register */
+ __IOM uint32_t SFAR; /*!< Offset: 0x018 (R/W) Secure Fault Address Register */
+} SAU_Type;
+
+/* SAU Control Register Definitions */
+#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
+#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
+
+#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
+#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
+
+/* SAU Type Register Definitions */
+#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
+#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
+
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+/* SAU Region Number Register Definitions */
+#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
+#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
+
+/* SAU Region Base Address Register Definitions */
+#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
+#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
+
+/* SAU Region Limit Address Register Definitions */
+#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
+#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
+
+#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
+#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
+
+#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
+#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
+
+#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
+
+/* Secure Fault Status Register Definitions */
+#define SAU_SFSR_LSERR_Pos 7U /*!< SAU SFSR: LSERR Position */
+#define SAU_SFSR_LSERR_Msk (1UL << SAU_SFSR_LSERR_Pos) /*!< SAU SFSR: LSERR Mask */
+
+#define SAU_SFSR_SFARVALID_Pos 6U /*!< SAU SFSR: SFARVALID Position */
+#define SAU_SFSR_SFARVALID_Msk (1UL << SAU_SFSR_SFARVALID_Pos) /*!< SAU SFSR: SFARVALID Mask */
+
+#define SAU_SFSR_LSPERR_Pos 5U /*!< SAU SFSR: LSPERR Position */
+#define SAU_SFSR_LSPERR_Msk (1UL << SAU_SFSR_LSPERR_Pos) /*!< SAU SFSR: LSPERR Mask */
+
+#define SAU_SFSR_INVTRAN_Pos 4U /*!< SAU SFSR: INVTRAN Position */
+#define SAU_SFSR_INVTRAN_Msk (1UL << SAU_SFSR_INVTRAN_Pos) /*!< SAU SFSR: INVTRAN Mask */
+
+#define SAU_SFSR_AUVIOL_Pos 3U /*!< SAU SFSR: AUVIOL Position */
+#define SAU_SFSR_AUVIOL_Msk (1UL << SAU_SFSR_AUVIOL_Pos) /*!< SAU SFSR: AUVIOL Mask */
+
+#define SAU_SFSR_INVER_Pos 2U /*!< SAU SFSR: INVER Position */
+#define SAU_SFSR_INVER_Msk (1UL << SAU_SFSR_INVER_Pos) /*!< SAU SFSR: INVER Mask */
+
+#define SAU_SFSR_INVIS_Pos 1U /*!< SAU SFSR: INVIS Position */
+#define SAU_SFSR_INVIS_Msk (1UL << SAU_SFSR_INVIS_Pos) /*!< SAU SFSR: INVIS Mask */
+
+#define SAU_SFSR_INVEP_Pos 0U /*!< SAU SFSR: INVEP Position */
+#define SAU_SFSR_INVEP_Msk (1UL /*<< SAU_SFSR_INVEP_Pos*/) /*!< SAU SFSR: INVEP Mask */
+
+/*@} end of group CMSIS_SAU */
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_FPU Floating Point Unit (FPU)
+ \brief Type definitions for the Floating Point Unit (FPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Floating Point Unit (FPU).
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */
+ __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */
+ __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */
+ __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */
+} FPU_Type;
+
+/* Floating-Point Context Control Register Definitions */
+#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */
+#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */
+
+#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */
+#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */
+
+#define FPU_FPCCR_LSPENS_Pos 29U /*!< FPCCR: LSPENS Position */
+#define FPU_FPCCR_LSPENS_Msk (1UL << FPU_FPCCR_LSPENS_Pos) /*!< FPCCR: LSPENS bit Mask */
+
+#define FPU_FPCCR_CLRONRET_Pos 28U /*!< FPCCR: CLRONRET Position */
+#define FPU_FPCCR_CLRONRET_Msk (1UL << FPU_FPCCR_CLRONRET_Pos) /*!< FPCCR: CLRONRET bit Mask */
+
+#define FPU_FPCCR_CLRONRETS_Pos 27U /*!< FPCCR: CLRONRETS Position */
+#define FPU_FPCCR_CLRONRETS_Msk (1UL << FPU_FPCCR_CLRONRETS_Pos) /*!< FPCCR: CLRONRETS bit Mask */
+
+#define FPU_FPCCR_TS_Pos 26U /*!< FPCCR: TS Position */
+#define FPU_FPCCR_TS_Msk (1UL << FPU_FPCCR_TS_Pos) /*!< FPCCR: TS bit Mask */
+
+#define FPU_FPCCR_UFRDY_Pos 10U /*!< FPCCR: UFRDY Position */
+#define FPU_FPCCR_UFRDY_Msk (1UL << FPU_FPCCR_UFRDY_Pos) /*!< FPCCR: UFRDY bit Mask */
+
+#define FPU_FPCCR_SPLIMVIOL_Pos 9U /*!< FPCCR: SPLIMVIOL Position */
+#define FPU_FPCCR_SPLIMVIOL_Msk (1UL << FPU_FPCCR_SPLIMVIOL_Pos) /*!< FPCCR: SPLIMVIOL bit Mask */
+
+#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */
+#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */
+
+#define FPU_FPCCR_SFRDY_Pos 7U /*!< FPCCR: SFRDY Position */
+#define FPU_FPCCR_SFRDY_Msk (1UL << FPU_FPCCR_SFRDY_Pos) /*!< FPCCR: SFRDY bit Mask */
+
+#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */
+#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */
+
+#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */
+#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */
+
+#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */
+#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */
+
+#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */
+#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */
+
+#define FPU_FPCCR_S_Pos 2U /*!< FPCCR: Security status of the FP context bit Position */
+#define FPU_FPCCR_S_Msk (1UL << FPU_FPCCR_S_Pos) /*!< FPCCR: Security status of the FP context bit Mask */
+
+#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */
+#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */
+
+#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */
+#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */
+
+/* Floating-Point Context Address Register Definitions */
+#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */
+#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */
+
+/* Floating-Point Default Status Control Register Definitions */
+#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */
+#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */
+
+#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */
+#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */
+
+#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */
+#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */
+
+#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */
+#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */
+
+/* Media and FP Feature Register 0 Definitions */
+#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */
+#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */
+
+#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */
+#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */
+
+#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */
+#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */
+
+#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */
+#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */
+
+#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */
+#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */
+
+#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */
+#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */
+
+#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */
+#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */
+
+#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */
+#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */
+
+/* Media and FP Feature Register 1 Definitions */
+#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */
+#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */
+
+#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */
+#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */
+
+#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */
+#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */
+
+#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */
+#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */
+
+/*@} end of group CMSIS_FPU */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
+ __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */
+#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/* Debug Authentication Control Register Definitions */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
+
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
+
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */
+
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */
+
+/* Debug Security Control and Status Register Definitions */
+#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */
+#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */
+
+#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */
+#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */
+
+#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */
+#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+ #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+ #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+ #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+ #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+ #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+ #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+ #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+ #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+ #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+ #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+ #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+ #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+ #endif
+
+ #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
+ #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
+ #endif
+
+ #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
+ #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
+ #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */
+ #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
+ #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
+ #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
+
+ #define SCnSCB_NS ((SCnSCB_Type *) SCS_BASE_NS ) /*!< System control Register not in SCB(non-secure address space) */
+ #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
+ #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
+ #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
+ #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
+ #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
+ #endif
+
+ #define FPU_BASE_NS (SCS_BASE_NS + 0x0F30UL) /*!< Floating Point Unit (non-secure address space) */
+ #define FPU_NS ((FPU_Type *) FPU_BASE_NS ) /*!< Floating Point Unit (non-secure address space) */
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Get Interrupt Target State
+ \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ \return 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Target State
+ \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Clear Interrupt Target State
+ \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Set Priority Grouping (non-secure)
+ \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB_NS->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */
+ SCB_NS->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping (non-secure)
+ \details Reads the priority grouping field from the non-secure NVIC when in secure state.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriorityGrouping_NS(void)
+{
+ return ((uint32_t)((SCB_NS->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt (non-secure)
+ \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status (non-secure)
+ \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt (non-secure)
+ \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt (non-secure)
+ \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt (non-secure)
+ \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt (non-secure)
+ \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt (non-secure)
+ \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority (non-secure)
+ \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every non-secure processor exception.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority (non-secure)
+ \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC_NS->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv8.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ uint32_t mvfr0;
+
+ mvfr0 = FPU->MVFR0;
+ if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U)
+ {
+ return 2U; /* Double + Single precision FPU */
+ }
+ else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
+ {
+ return 1U; /* Single precision FPU */
+ }
+ else
+ {
+ return 0U; /* No FPU */
+ }
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## SAU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SAUFunctions SAU Functions
+ \brief Functions that configure the SAU.
+ @{
+ */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+
+/**
+ \brief Enable SAU
+ \details Enables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Enable(void)
+{
+ SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
+}
+
+
+
+/**
+ \brief Disable SAU
+ \details Disables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Disable(void)
+{
+ SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
+}
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_SAUFunctions */
+
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function SysTick_Config is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief System Tick Configuration (non-secure)
+ \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function TZ_SysTick_Config_NS is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_ARMV8MML_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm0.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm0.h
new file mode 100644
index 0000000000000000000000000000000000000000..a3f1b9ac33045732b0ccef9bf592fbc544ccfb10
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm0.h
@@ -0,0 +1,888 @@
+/**************************************************************************//**
+ * @file core_cm0.h
+ * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File
+ * @version V5.0.3
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM0_H_GENERIC
+#define __CORE_CM0_H_GENERIC
+
+#include
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M0
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM0 definitions */
+#define __CM0_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM0_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \
+ __CM0_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (0U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_PCS_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM0_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM0_H_DEPENDANT
+#define __CORE_CM0_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM0_REV
+ #define __CM0_REV 0x0000U
+ #warning "__CM0_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ IO Type Qualifiers are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M0 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:1; /*!< bit: 0 Reserved */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[31U];
+ __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[31U];
+ __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[31U];
+ __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[31U];
+ uint32_t RESERVED4[64U];
+ __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ uint32_t RESERVED0;
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED1;
+ __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
+ Therefore they are not covered by the Cortex-M0 header file.
+ @{
+ */
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Cortex-M0 */
+/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M0 */
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0 */
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ Address 0 must be mapped to SRAM.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)0x0U;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)0x0U;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function SysTick_Config is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM0_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm0plus.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm0plus.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8f30c3496a16d62409066e4ded26c404e7ae813
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm0plus.h
@@ -0,0 +1,1023 @@
+/**************************************************************************//**
+ * @file core_cm0plus.h
+ * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File
+ * @version V5.0.4
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM0PLUS_H_GENERIC
+#define __CORE_CM0PLUS_H_GENERIC
+
+#include
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex-M0+
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM0+ definitions */
+#define __CM0PLUS_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM0PLUS_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16U) | \
+ __CM0PLUS_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (0U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_PCS_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM0PLUS_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM0PLUS_H_DEPENDANT
+#define __CORE_CM0PLUS_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM0PLUS_REV
+ #define __CM0PLUS_REV 0x0000U
+ #warning "__CM0PLUS_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __VTOR_PRESENT
+ #define __VTOR_PRESENT 0U
+ #warning "__VTOR_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ IO Type Qualifiers are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex-M0+ */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core MPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[31U];
+ __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[31U];
+ __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[31U];
+ __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[31U];
+ uint32_t RESERVED4[64U];
+ __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+#else
+ uint32_t RESERVED0;
+#endif
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED1;
+ __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 8U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+#endif
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 1U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register Definitions */
+#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Cortex-M0+ Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
+ Therefore they are not covered by the Cortex-M0+ header file.
+ @{
+ */
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Cortex-M0+ */
+/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M0+ */
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0+ */
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ If VTOR is not present address 0 must be mapped to SRAM.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+#else
+ uint32_t *vectors = (uint32_t *)0x0U;
+#endif
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+#else
+ uint32_t *vectors = (uint32_t *)0x0U;
+#endif
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv7.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function SysTick_Config is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM0PLUS_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm23.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm23.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d1d478af2a958f21304ecc743b4ee6bd5a0eb02
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm23.h
@@ -0,0 +1,1899 @@
+/**************************************************************************//**
+ * @file core_cm23.h
+ * @brief CMSIS Cortex-M23 Core Peripheral Access Layer Header File
+ * @version V5.0.4
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM23_H_GENERIC
+#define __CORE_CM23_H_GENERIC
+
+#include
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M23
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS definitions */
+#define __CM23_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM23_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM23_CMSIS_VERSION ((__CM23_CMSIS_VERSION_MAIN << 16U) | \
+ __CM23_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (23U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_PCS_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM23_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM23_H_DEPENDANT
+#define __CORE_CM23_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM23_REV
+ #define __CM23_REV 0x0000U
+ #warning "__CM23_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __SAUREGION_PRESENT
+ #define __SAUREGION_PRESENT 0U
+ #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __VTOR_PRESENT
+ #define __VTOR_PRESENT 0U
+ #warning "__VTOR_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+
+ #ifndef __ETM_PRESENT
+ #define __ETM_PRESENT 0U
+ #warning "__ETM_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MTB_PRESENT
+ #define __MTB_PRESENT 0U
+ #warning "__MTB_PRESENT not defined in device header file; using default!"
+ #endif
+
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ IO Type Qualifiers are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M23 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core SAU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[16U];
+ __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[16U];
+ __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[16U];
+ __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[16U];
+ __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[16U];
+ __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
+ uint32_t RESERVED5[16U];
+ __IOM uint32_t IPR[124U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+#else
+ uint32_t RESERVED0;
+#endif
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED1;
+ __IOM uint32_t SHPR[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
+#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
+
+#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
+#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
+#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+#endif
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
+#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
+
+#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
+#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
+
+#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
+#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
+#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
+
+#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
+#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
+#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
+#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
+
+#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
+#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ uint32_t RESERVED0[6U];
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ uint32_t RESERVED3[1U];
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ uint32_t RESERVED5[1U];
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED6[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ uint32_t RESERVED7[1U];
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
+ uint32_t RESERVED9[1U];
+ __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
+ uint32_t RESERVED10[1U];
+ __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
+ uint32_t RESERVED11[1U];
+ __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
+ uint32_t RESERVED12[1U];
+ __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
+ uint32_t RESERVED13[1U];
+ __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
+ uint32_t RESERVED14[1U];
+ __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
+ uint32_t RESERVED15[1U];
+ __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
+ uint32_t RESERVED16[1U];
+ __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
+ uint32_t RESERVED17[1U];
+ __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
+ uint32_t RESERVED18[1U];
+ __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
+ uint32_t RESERVED19[1U];
+ __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
+ uint32_t RESERVED20[1U];
+ __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
+ uint32_t RESERVED21[1U];
+ __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
+ uint32_t RESERVED22[1U];
+ __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
+ uint32_t RESERVED23[1U];
+ __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
+ uint32_t RESERVED24[1U];
+ __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
+ uint32_t RESERVED25[1U];
+ __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
+ uint32_t RESERVED26[1U];
+ __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
+ uint32_t RESERVED27[1U];
+ __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
+ uint32_t RESERVED28[1U];
+ __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
+ uint32_t RESERVED29[1U];
+ __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
+ uint32_t RESERVED30[1U];
+ __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
+ uint32_t RESERVED31[1U];
+ __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
+#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
+
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
+#define DWT_FUNCTION_ACTION_Msk (0x3UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
+
+#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
+#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IOM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */
+ __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
+ __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
+ __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< @Deprecated TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< @Deprecated TPI ACPR: PRESCALER Mask */
+
+#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */
+#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY_Pos 0U /*!< TPI ITATBCTR2: ATREADY Position */
+#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY_Pos 0U /*!< TPI ITATBCTR0: ATREADY Position */
+#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_MajorType_Pos 4U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+#define TPI_DEVTYPE_SubType_Pos 0U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
+ uint32_t RESERVED0[7U];
+ union {
+ __IOM uint32_t MAIR[2];
+ struct {
+ __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
+ __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
+ };
+ };
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 1U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */
+#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */
+
+#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
+#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
+
+#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
+#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
+
+#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
+#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
+
+/* MPU Region Limit Address Register Definitions */
+#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
+#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
+
+#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
+#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
+
+#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: EN Position */
+#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: EN Mask */
+
+/* MPU Memory Attribute Indirection Register 0 Definitions */
+#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
+#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
+
+#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
+#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
+
+#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
+#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
+
+#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
+#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
+
+/* MPU Memory Attribute Indirection Register 1 Definitions */
+#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
+#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
+
+#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
+#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
+
+#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
+#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
+
+#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
+#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SAU Security Attribution Unit (SAU)
+ \brief Type definitions for the Security Attribution Unit (SAU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Security Attribution Unit (SAU).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
+ __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
+#endif
+} SAU_Type;
+
+/* SAU Control Register Definitions */
+#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
+#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
+
+#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
+#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
+
+/* SAU Type Register Definitions */
+#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
+#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
+
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+/* SAU Region Number Register Definitions */
+#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
+#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
+
+/* SAU Region Base Address Register Definitions */
+#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
+#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
+
+/* SAU Region Limit Address Register Definitions */
+#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
+#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
+
+#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
+#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
+
+#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
+#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
+
+#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
+
+/*@} end of group CMSIS_SAU */
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
+ __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */
+#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register */
+#define CoreDebug_DEMCR_DWTENA_Pos 24U /*!< CoreDebug DEMCR: DWTENA Position */
+#define CoreDebug_DEMCR_DWTENA_Msk (1UL << CoreDebug_DEMCR_DWTENA_Pos) /*!< CoreDebug DEMCR: DWTENA Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/* Debug Authentication Control Register Definitions */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
+
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
+
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */
+
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */
+
+/* Debug Security Control and Status Register Definitions */
+#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */
+#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */
+
+#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */
+#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */
+
+#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */
+#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+ #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+ #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+ #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+ #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+
+ #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+ #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+ #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+ #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+ #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+ #endif
+
+ #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
+ #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
+ #endif
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
+ #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */
+ #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
+ #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
+ #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
+
+ #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
+ #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
+ #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
+ #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
+ #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
+ #endif
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Cortex-M23 */
+/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M23 */
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Get Interrupt Target State
+ \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ \return 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Target State
+ \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Clear Interrupt Target State
+ \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ If VTOR is not present address 0 must be mapped to SRAM.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+#else
+ uint32_t *vectors = (uint32_t *)0x0U;
+#endif
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+#else
+ uint32_t *vectors = (uint32_t *)0x0U;
+#endif
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Enable Interrupt (non-secure)
+ \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status (non-secure)
+ \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt (non-secure)
+ \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt (non-secure)
+ \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt (non-secure)
+ \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt (non-secure)
+ \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt (non-secure)
+ \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority (non-secure)
+ \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every non-secure processor exception.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC_NS->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB_NS->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB_NS->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority (non-secure)
+ \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB_NS->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv8.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## SAU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SAUFunctions SAU Functions
+ \brief Functions that configure the SAU.
+ @{
+ */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+
+/**
+ \brief Enable SAU
+ \details Enables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Enable(void)
+{
+ SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
+}
+
+
+
+/**
+ \brief Disable SAU
+ \details Disables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Disable(void)
+{
+ SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
+}
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_SAUFunctions */
+
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function SysTick_Config is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief System Tick Configuration (non-secure)
+ \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function TZ_SysTick_Config_NS is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM23_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/es32f0654/libraries/CMSIS/Include/core_cm3.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm3.h
similarity index 85%
rename from bsp/es32f0654/libraries/CMSIS/Include/core_cm3.h
rename to bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm3.h
index b4ac4c7b05a799590575c0b5c8e24c51748ee20b..a2c0d0805729739413b170af6a47410f89d854de 100644
--- a/bsp/es32f0654/libraries/CMSIS/Include/core_cm3.h
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm3.h
@@ -1,40 +1,30 @@
/**************************************************************************//**
* @file core_cm3.h
* @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File
- * @version V4.30
- * @date 20. October 2015
+ * @version V5.0.5
+ * @date 08. January 2018
******************************************************************************/
-/* Copyright (c) 2009 - 2015 ARM LIMITED
-
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- - Neither the name of ARM nor the names of its contributors may be used
- to endorse or promote products derived from this software without
- specific prior written permission.
- *
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- ---------------------------------------------------------------------------*/
-
+/*
+ * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
#if defined ( __ICCARM__ )
- #pragma system_include /* treat file as system include file for MISRA check */
-#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
#pragma clang system_header /* treat file as system include file */
#endif
@@ -70,53 +60,15 @@
@{
*/
+#include "cmsis_version.h"
+
/* CMSIS CM3 definitions */
-#define __CM3_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */
-#define __CM3_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */
+#define __CM3_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM3_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
#define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16U) | \
- __CM3_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
-
-#define __CORTEX_M (0x03U) /*!< Cortex-M Core */
-
-
-#if defined ( __CC_ARM )
- #define __ASM __asm /*!< asm keyword for ARM Compiler */
- #define __INLINE __inline /*!< inline keyword for ARM Compiler */
- #define __STATIC_INLINE static __inline
-
-#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
- #define __ASM __asm /*!< asm keyword for ARM Compiler */
- #define __INLINE __inline /*!< inline keyword for ARM Compiler */
- #define __STATIC_INLINE static __inline
-
-#elif defined ( __GNUC__ )
- #define __ASM __asm /*!< asm keyword for GNU Compiler */
- #define __INLINE inline /*!< inline keyword for GNU Compiler */
- #define __STATIC_INLINE static inline
-
-#elif defined ( __ICCARM__ )
- #define __ASM __asm /*!< asm keyword for IAR Compiler */
- #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
- #define __STATIC_INLINE static inline
-
-#elif defined ( __TMS470__ )
- #define __ASM __asm /*!< asm keyword for TI CCS Compiler */
- #define __STATIC_INLINE static inline
+ __CM3_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
-#elif defined ( __TASKING__ )
- #define __ASM __asm /*!< asm keyword for TASKING Compiler */
- #define __INLINE inline /*!< inline keyword for TASKING Compiler */
- #define __STATIC_INLINE static inline
-
-#elif defined ( __CSMC__ )
- #define __packed
- #define __ASM _asm /*!< asm keyword for COSMIC Compiler */
- #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */
- #define __STATIC_INLINE static inline
-
-#else
- #error Unknown compiler
-#endif
+#define __CORTEX_M (3U) /*!< Cortex-M Core */
/** __FPU_USED indicates whether an FPU is used or not.
This core does not support an FPU at all
@@ -128,7 +80,7 @@
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif
-#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#if defined __ARM_PCS_VFP
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif
@@ -143,7 +95,7 @@
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif
-#elif defined ( __TMS470__ )
+#elif defined ( __TI_ARM__ )
#if defined __TI_VFP_SUPPORT__
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif
@@ -160,8 +112,8 @@
#endif
-#include "core_cmInstr.h" /* Core Instruction Access */
-#include "core_cmFunc.h" /* Core Function Access */
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
#ifdef __cplusplus
}
@@ -191,7 +143,7 @@
#endif
#ifndef __NVIC_PRIO_BITS
- #define __NVIC_PRIO_BITS 4U
+ #define __NVIC_PRIO_BITS 3U
#warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
#endif
@@ -308,9 +260,11 @@ typedef union
struct
{
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
- uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
- uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
- uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
+ uint32_t _reserved0:1; /*!< bit: 9 Reserved */
+ uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */
+ uint32_t _reserved1:8; /*!< bit: 16..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit */
+ uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */
uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
@@ -336,12 +290,15 @@ typedef union
#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
-#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */
-#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */
+#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */
+#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */
#define xPSR_T_Pos 24U /*!< xPSR: T Position */
#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */
+#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */
+
#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
@@ -487,7 +444,7 @@ typedef struct
#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
/* SCB Vector Table Offset Register Definitions */
-#if (__CM3_REV < 0x0201U) /* core r2p1 */
+#if defined (__CM3_REV) && (__CM3_REV < 0x0201U) /* core r2p1 */
#define SCB_VTOR_TBLBASE_Pos 29U /*!< SCB VTOR: TBLBASE Position */
#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */
@@ -602,6 +559,60 @@ typedef struct
#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
/* SCB Hard Fault Status Register Definitions */
#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
@@ -645,7 +656,7 @@ typedef struct
{
uint32_t RESERVED0[1U];
__IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
-#if ((defined __CM3_REV) && (__CM3_REV >= 0x200U))
+#if defined (__CM3_REV) && (__CM3_REV >= 0x200U)
__IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
#else
uint32_t RESERVED1[1U];
@@ -770,7 +781,7 @@ typedef struct
/* ITM Trace Privilege Register Definitions */
#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
-#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
/* ITM Trace Control Register Definitions */
#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
@@ -1011,8 +1022,11 @@ typedef struct
} TPI_Type;
/* TPI Asynchronous Clock Prescaler Register Definitions */
-#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
-#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< @Deprecated TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< @Deprecated TPI ACPR: PRESCALER Mask */
+
+#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */
+#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */
/* TPI Selected Pin Protocol Register Definitions */
#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
@@ -1127,7 +1141,7 @@ typedef struct
/*@}*/ /* end of group CMSIS_TPI */
-#if (__MPU_PRESENT == 1U)
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_MPU Memory Protection Unit (MPU)
@@ -1153,6 +1167,8 @@ typedef struct
__IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
} MPU_Type;
+#define MPU_TYPE_RALIASES 4U
+
/* MPU Type Register Definitions */
#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
@@ -1337,18 +1353,18 @@ typedef struct
/**
\brief Mask and shift a bit field value for use in a register bit range.
\param[in] field Name of the register bit field.
- \param[in] value Value of the bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
\return Masked and shifted value.
*/
-#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk)
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
/**
\brief Mask and shift a register value to extract a bit filed value.
\param[in] field Name of the register bit field.
- \param[in] value Value of register.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
\return Masked and shifted bit field value.
*/
-#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos)
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
/*@} end of group CMSIS_core_bitfield */
@@ -1360,7 +1376,7 @@ typedef struct
@{
*/
-/* Memory mapping of Cortex-M3 Hardware */
+/* Memory mapping of Core Hardware */
#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
@@ -1379,7 +1395,7 @@ typedef struct
#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
-#if (__MPU_PRESENT == 1U)
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
#define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
#define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
#endif
@@ -1410,6 +1426,40 @@ typedef struct
@{
*/
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+
/**
\brief Set Priority Grouping
\details Sets the priority grouping field using the required unlock sequence.
@@ -1419,7 +1469,7 @@ typedef struct
priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
\param [in] PriorityGroup Priority grouping field.
*/
-__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
{
uint32_t reg_value;
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
@@ -1428,7 +1478,7 @@ __STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
reg_value = (reg_value |
((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
- (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
SCB->AIRCR = reg_value;
}
@@ -1438,121 +1488,178 @@ __STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
\details Reads the priority grouping field from the NVIC Interrupt Controller.
\return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
*/
-__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
{
return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
}
/**
- \brief Enable External Interrupt
- \details Enables a device-specific interrupt in the NVIC interrupt controller.
- \param [in] IRQn External interrupt number. Value cannot be negative.
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
{
- NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
}
/**
- \brief Disable External Interrupt
- \details Disables a device-specific interrupt in the NVIC interrupt controller.
- \param [in] IRQn External interrupt number. Value cannot be negative.
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
{
- NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
}
/**
\brief Get Pending Interrupt
- \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.
- \param [in] IRQn Interrupt number.
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
\return 0 Interrupt status is not pending.
\return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
{
- return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
}
/**
\brief Set Pending Interrupt
- \details Sets the pending bit of an external interrupt.
- \param [in] IRQn Interrupt number. Value cannot be negative.
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
{
- NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
}
/**
\brief Clear Pending Interrupt
- \details Clears the pending bit of an external interrupt.
- \param [in] IRQn External interrupt number. Value cannot be negative.
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
{
- NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
}
/**
\brief Get Active Interrupt
- \details Reads the active register in NVIC and returns the active bit.
- \param [in] IRQn Interrupt number.
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
\return 0 Interrupt status is not active.
\return 1 Interrupt status is active.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
{
- return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
}
/**
\brief Set Interrupt Priority
- \details Sets the priority of an interrupt.
- \note The priority cannot be set for every core interrupt.
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
\param [in] IRQn Interrupt number.
\param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
*/
-__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
{
- if ((int32_t)(IRQn) < 0)
+ if ((int32_t)(IRQn) >= 0)
{
- SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
}
else
{
- NVIC->IP[((uint32_t)(int32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
}
}
/**
\brief Get Interrupt Priority
- \details Reads the priority of an interrupt.
- The interrupt number can be positive to specify an external (device specific) interrupt,
- or negative to specify an internal (core) interrupt.
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
\param [in] IRQn Interrupt number.
\return Interrupt Priority.
Value is aligned automatically to the implemented priority bits of the microcontroller.
*/
-__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
{
- if ((int32_t)(IRQn) < 0)
+ if ((int32_t)(IRQn) >= 0)
{
- return(((uint32_t)SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
}
else
{
- return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
}
}
@@ -1609,11 +1716,42 @@ __STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGr
}
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
/**
\brief System Reset
\details Initiates a system reset request to reset the MCU.
*/
-__STATIC_INLINE void NVIC_SystemReset(void)
+__STATIC_INLINE void __NVIC_SystemReset(void)
{
__DSB(); /* Ensure all outstanding memory accesses included
buffered write are completed before reset */
@@ -1630,6 +1768,38 @@ __STATIC_INLINE void NVIC_SystemReset(void)
/*@} end of CMSIS_Core_NVICFunctions */
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv7.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
/* ################################## SysTick function ############################################ */
@@ -1640,7 +1810,7 @@ __STATIC_INLINE void NVIC_SystemReset(void)
@{
*/
-#if (__Vendor_SysTickConfig == 0U)
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
/**
\brief System Tick Configuration
@@ -1683,8 +1853,8 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
@{
*/
-extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
-#define ITM_RXBUFFER_EMPTY 0x5AA55AA5U /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
/**
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm33.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm33.h
new file mode 100644
index 0000000000000000000000000000000000000000..b1efbcae7c733a636cfb4e043b6c4858e84ac6b6
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm33.h
@@ -0,0 +1,2963 @@
+/**************************************************************************//**
+ * @file core_cm33.h
+ * @brief CMSIS Cortex-M33 Core Peripheral Access Layer Header File
+ * @version V5.0.5
+ * @date 08. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM33_H_GENERIC
+#define __CORE_CM33_H_GENERIC
+
+#include
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M33
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM33 definitions */
+#define __CM33_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM33_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM33_CMSIS_VERSION ((__CM33_CMSIS_VERSION_MAIN << 16U) | \
+ __CM33_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (33U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
+*/
+#if defined ( __CC_ARM )
+ #if defined (__TARGET_FPU_VFP)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined (__ARM_PCS_VFP)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined (__ARMVFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined (__TI_VFP_SUPPORT__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined (__FPU_VFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM33_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM33_H_DEPENDANT
+#define __CORE_CM33_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM33_REV
+ #define __CM33_REV 0x0000U
+ #warning "__CM33_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __SAUREGION_PRESENT
+ #define __SAUREGION_PRESENT 0U
+ #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __DSP_PRESENT
+ #define __DSP_PRESENT 0U
+ #warning "__DSP_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ IO Type Qualifiers are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M33 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core SAU Register
+ - Core FPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+#define APSR_GE_Pos 16U /*!< APSR: GE Position */
+#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */
+#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */
+#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
+ uint32_t FPCA:1; /*!< bit: 2 Floating-point context active */
+ uint32_t SFPA:1; /*!< bit: 3 Secure floating-point active */
+ uint32_t _reserved1:28; /*!< bit: 4..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SFPA_Pos 3U /*!< CONTROL: SFPA Position */
+#define CONTROL_SFPA_Msk (1UL << CONTROL_SFPA_Pos) /*!< CONTROL: SFPA Mask */
+
+#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */
+#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */
+
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[16U];
+ __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[16U];
+ __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[16U];
+ __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[16U];
+ __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[16U];
+ __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
+ uint32_t RESERVED5[16U];
+ __IOM uint8_t IPR[496U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED6[580U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ID_ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t ID_MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ID_ISAR[6U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */
+ __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */
+ __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */
+ __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+ __IOM uint32_t NSACR; /*!< Offset: 0x08C (R/W) Non-Secure Access Control Register */
+ uint32_t RESERVED3[92U];
+ __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */
+ uint32_t RESERVED4[15U];
+ __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */
+ __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */
+ uint32_t RESERVED5[1U];
+ __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */
+ uint32_t RESERVED6[1U];
+ __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */
+ __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */
+ __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */
+ __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */
+ __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */
+ __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */
+ __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */
+ __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */
+ uint32_t RESERVED7[6U];
+ __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */
+ __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */
+ __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */
+ __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */
+ __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
+#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
+
+#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
+#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
+#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
+#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
+
+#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
+#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
+#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
+#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
+
+#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
+#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
+#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTPENDED_Pos 20U /*!< SCB SHCSR: SECUREFAULTPENDED Position */
+#define SCB_SHCSR_SECUREFAULTPENDED_Msk (1UL << SCB_SHCSR_SECUREFAULTPENDED_Pos) /*!< SCB SHCSR: SECUREFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTENA_Pos 19U /*!< SCB SHCSR: SECUREFAULTENA Position */
+#define SCB_SHCSR_SECUREFAULTENA_Msk (1UL << SCB_SHCSR_SECUREFAULTENA_Pos) /*!< SCB SHCSR: SECUREFAULTENA Mask */
+
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
+#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
+
+#define SCB_SHCSR_SECUREFAULTACT_Pos 4U /*!< SCB SHCSR: SECUREFAULTACT Position */
+#define SCB_SHCSR_SECUREFAULTACT_Msk (1UL << SCB_SHCSR_SECUREFAULTACT_Pos) /*!< SCB SHCSR: SECUREFAULTACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
+#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */
+#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */
+#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_STKOF_Pos (SCB_CFSR_USGFAULTSR_Pos + 4U) /*!< SCB CFSR (UFSR): STKOF Position */
+#define SCB_CFSR_STKOF_Msk (1UL << SCB_CFSR_STKOF_Pos) /*!< SCB CFSR (UFSR): STKOF Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/* SCB Non-Secure Access Control Register Definitions */
+#define SCB_NSACR_CP11_Pos 11U /*!< SCB NSACR: CP11 Position */
+#define SCB_NSACR_CP11_Msk (1UL << SCB_NSACR_CP11_Pos) /*!< SCB NSACR: CP11 Mask */
+
+#define SCB_NSACR_CP10_Pos 10U /*!< SCB NSACR: CP10 Position */
+#define SCB_NSACR_CP10_Msk (1UL << SCB_NSACR_CP10_Pos) /*!< SCB NSACR: CP10 Mask */
+
+#define SCB_NSACR_CPn_Pos 0U /*!< SCB NSACR: CPn Position */
+#define SCB_NSACR_CPn_Msk (1UL /*<< SCB_NSACR_CPn_Pos*/) /*!< SCB NSACR: CPn Mask */
+
+/* SCB Cache Level ID Register Definitions */
+#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */
+#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */
+
+#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */
+#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */
+
+/* SCB Cache Type Register Definitions */
+#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */
+#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */
+
+#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */
+#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */
+
+#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */
+#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */
+
+#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */
+#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */
+
+#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */
+#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */
+
+/* SCB Cache Size ID Register Definitions */
+#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */
+#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */
+
+#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */
+#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */
+
+#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */
+#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */
+
+#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */
+#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */
+
+#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */
+#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */
+
+#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */
+#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */
+
+#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */
+#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */
+
+/* SCB Cache Size Selection Register Definitions */
+#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */
+#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */
+
+#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */
+#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */
+
+/* SCB Software Triggered Interrupt Register Definitions */
+#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */
+#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */
+
+/* SCB D-Cache Invalidate by Set-way Register Definitions */
+#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */
+#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */
+
+#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */
+#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */
+
+/* SCB D-Cache Clean by Set-way Register Definitions */
+#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */
+#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */
+
+#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */
+#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */
+
+/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */
+#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */
+#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */
+
+#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */
+#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */
+
+/* Instruction Tightly-Coupled Memory Control Register Definitions */
+#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */
+#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */
+
+#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */
+#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */
+
+#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */
+#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */
+
+#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */
+#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */
+
+/* Data Tightly-Coupled Memory Control Register Definitions */
+#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */
+#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */
+
+#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */
+#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */
+
+#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */
+#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */
+
+#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */
+#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */
+
+/* AHBP Control Register Definitions */
+#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */
+#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */
+
+#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */
+#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */
+
+/* L1 Cache Control Register Definitions */
+#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */
+#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */
+
+#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */
+#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */
+
+#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */
+#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */
+
+/* AHBS Control Register Definitions */
+#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */
+#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */
+
+#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */
+#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */
+
+#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/
+#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */
+
+/* Auxiliary Bus Fault Status Register Definitions */
+#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/
+#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */
+
+#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/
+#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */
+
+#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/
+#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */
+
+#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/
+#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */
+
+#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/
+#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */
+
+#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/
+#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+ __IOM uint32_t CPPWR; /*!< Offset: 0x00C (R/W) Coprocessor Power Control Register */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[29U];
+ __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */
+ __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */
+ __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) ITM Device Architecture Register */
+ uint32_t RESERVED6[4U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Stimulus Port Register Definitions */
+#define ITM_STIM_DISABLED_Pos 1U /*!< ITM STIM: DISABLED Position */
+#define ITM_STIM_DISABLED_Msk (0x1UL << ITM_STIM_DISABLED_Pos) /*!< ITM STIM: DISABLED Mask */
+
+#define ITM_STIM_FIFOREADY_Pos 0U /*!< ITM STIM: FIFOREADY Position */
+#define ITM_STIM_FIFOREADY_Msk (0x1UL /*<< ITM_STIM_FIFOREADY_Pos*/) /*!< ITM STIM: FIFOREADY Mask */
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TRACEBUSID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPRESCALE_Pos 8U /*!< ITM TCR: TSPRESCALE Position */
+#define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos) /*!< ITM TCR: TSPRESCALE Mask */
+
+#define ITM_TCR_STALLENA_Pos 5U /*!< ITM TCR: STALLENA Position */
+#define ITM_TCR_STALLENA_Msk (1UL << ITM_TCR_STALLENA_Pos) /*!< ITM TCR: STALLENA Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Integration Write Register Definitions */
+#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */
+#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */
+
+/* ITM Integration Read Register Definitions */
+#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */
+#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */
+
+/* ITM Integration Mode Control Register Definitions */
+#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */
+#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ uint32_t RESERVED3[1U];
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ uint32_t RESERVED5[1U];
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED6[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ uint32_t RESERVED7[1U];
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
+ uint32_t RESERVED9[1U];
+ __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
+ uint32_t RESERVED10[1U];
+ __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
+ uint32_t RESERVED11[1U];
+ __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
+ uint32_t RESERVED12[1U];
+ __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
+ uint32_t RESERVED13[1U];
+ __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
+ uint32_t RESERVED14[1U];
+ __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
+ uint32_t RESERVED15[1U];
+ __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
+ uint32_t RESERVED16[1U];
+ __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
+ uint32_t RESERVED17[1U];
+ __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
+ uint32_t RESERVED18[1U];
+ __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
+ uint32_t RESERVED19[1U];
+ __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
+ uint32_t RESERVED20[1U];
+ __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
+ uint32_t RESERVED21[1U];
+ __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
+ uint32_t RESERVED22[1U];
+ __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
+ uint32_t RESERVED23[1U];
+ __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
+ uint32_t RESERVED24[1U];
+ __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
+ uint32_t RESERVED25[1U];
+ __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
+ uint32_t RESERVED26[1U];
+ __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
+ uint32_t RESERVED27[1U];
+ __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
+ uint32_t RESERVED28[1U];
+ __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
+ uint32_t RESERVED29[1U];
+ __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
+ uint32_t RESERVED30[1U];
+ __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
+ uint32_t RESERVED31[1U];
+ __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
+ uint32_t RESERVED32[934U];
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */
+ uint32_t RESERVED33[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) Device Architecture Register */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCDISS_Pos 23U /*!< DWT CTRL: CYCDISS Position */
+#define DWT_CTRL_CYCDISS_Msk (0x1UL << DWT_CTRL_CYCDISS_Pos) /*!< DWT CTRL: CYCDISS Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
+#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
+
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
+#define DWT_FUNCTION_ACTION_Msk (0x1UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
+
+#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
+#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IOM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */
+ __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
+ __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
+ __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< @Deprecated TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< @Deprecated TPI ACPR: PRESCALER Mask */
+
+#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */
+#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY_Pos 0U /*!< TPI ITATBCTR2: ATREADY Position */
+#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY_Pos 0U /*!< TPI ITATBCTR0: ATREADY Position */
+#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_MajorType_Pos 4U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+#define TPI_DEVTYPE_SubType_Pos 0U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Region Base Address Register Alias 1 */
+ __IOM uint32_t RLAR_A1; /*!< Offset: 0x018 (R/W) MPU Region Limit Address Register Alias 1 */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Region Base Address Register Alias 2 */
+ __IOM uint32_t RLAR_A2; /*!< Offset: 0x020 (R/W) MPU Region Limit Address Register Alias 2 */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Region Base Address Register Alias 3 */
+ __IOM uint32_t RLAR_A3; /*!< Offset: 0x028 (R/W) MPU Region Limit Address Register Alias 3 */
+ uint32_t RESERVED0[1];
+ union {
+ __IOM uint32_t MAIR[2];
+ struct {
+ __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
+ __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
+ };
+ };
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 4U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
+#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
+
+#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
+#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
+
+#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
+#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
+
+/* MPU Region Limit Address Register Definitions */
+#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
+#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
+
+#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
+#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
+
+#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: Region enable bit Position */
+#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: Region enable bit Disable Mask */
+
+/* MPU Memory Attribute Indirection Register 0 Definitions */
+#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
+#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
+
+#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
+#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
+
+#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
+#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
+
+#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
+#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
+
+/* MPU Memory Attribute Indirection Register 1 Definitions */
+#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
+#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
+
+#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
+#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
+
+#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
+#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
+
+#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
+#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SAU Security Attribution Unit (SAU)
+ \brief Type definitions for the Security Attribution Unit (SAU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Security Attribution Unit (SAU).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
+ __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
+#else
+ uint32_t RESERVED0[3];
+#endif
+ __IOM uint32_t SFSR; /*!< Offset: 0x014 (R/W) Secure Fault Status Register */
+ __IOM uint32_t SFAR; /*!< Offset: 0x018 (R/W) Secure Fault Address Register */
+} SAU_Type;
+
+/* SAU Control Register Definitions */
+#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
+#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
+
+#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
+#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
+
+/* SAU Type Register Definitions */
+#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
+#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
+
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+/* SAU Region Number Register Definitions */
+#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
+#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
+
+/* SAU Region Base Address Register Definitions */
+#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
+#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
+
+/* SAU Region Limit Address Register Definitions */
+#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
+#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
+
+#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
+#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
+
+#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
+#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
+
+#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
+
+/* Secure Fault Status Register Definitions */
+#define SAU_SFSR_LSERR_Pos 7U /*!< SAU SFSR: LSERR Position */
+#define SAU_SFSR_LSERR_Msk (1UL << SAU_SFSR_LSERR_Pos) /*!< SAU SFSR: LSERR Mask */
+
+#define SAU_SFSR_SFARVALID_Pos 6U /*!< SAU SFSR: SFARVALID Position */
+#define SAU_SFSR_SFARVALID_Msk (1UL << SAU_SFSR_SFARVALID_Pos) /*!< SAU SFSR: SFARVALID Mask */
+
+#define SAU_SFSR_LSPERR_Pos 5U /*!< SAU SFSR: LSPERR Position */
+#define SAU_SFSR_LSPERR_Msk (1UL << SAU_SFSR_LSPERR_Pos) /*!< SAU SFSR: LSPERR Mask */
+
+#define SAU_SFSR_INVTRAN_Pos 4U /*!< SAU SFSR: INVTRAN Position */
+#define SAU_SFSR_INVTRAN_Msk (1UL << SAU_SFSR_INVTRAN_Pos) /*!< SAU SFSR: INVTRAN Mask */
+
+#define SAU_SFSR_AUVIOL_Pos 3U /*!< SAU SFSR: AUVIOL Position */
+#define SAU_SFSR_AUVIOL_Msk (1UL << SAU_SFSR_AUVIOL_Pos) /*!< SAU SFSR: AUVIOL Mask */
+
+#define SAU_SFSR_INVER_Pos 2U /*!< SAU SFSR: INVER Position */
+#define SAU_SFSR_INVER_Msk (1UL << SAU_SFSR_INVER_Pos) /*!< SAU SFSR: INVER Mask */
+
+#define SAU_SFSR_INVIS_Pos 1U /*!< SAU SFSR: INVIS Position */
+#define SAU_SFSR_INVIS_Msk (1UL << SAU_SFSR_INVIS_Pos) /*!< SAU SFSR: INVIS Mask */
+
+#define SAU_SFSR_INVEP_Pos 0U /*!< SAU SFSR: INVEP Position */
+#define SAU_SFSR_INVEP_Msk (1UL /*<< SAU_SFSR_INVEP_Pos*/) /*!< SAU SFSR: INVEP Mask */
+
+/*@} end of group CMSIS_SAU */
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_FPU Floating Point Unit (FPU)
+ \brief Type definitions for the Floating Point Unit (FPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Floating Point Unit (FPU).
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */
+ __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */
+ __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */
+ __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */
+} FPU_Type;
+
+/* Floating-Point Context Control Register Definitions */
+#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */
+#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */
+
+#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */
+#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */
+
+#define FPU_FPCCR_LSPENS_Pos 29U /*!< FPCCR: LSPENS Position */
+#define FPU_FPCCR_LSPENS_Msk (1UL << FPU_FPCCR_LSPENS_Pos) /*!< FPCCR: LSPENS bit Mask */
+
+#define FPU_FPCCR_CLRONRET_Pos 28U /*!< FPCCR: CLRONRET Position */
+#define FPU_FPCCR_CLRONRET_Msk (1UL << FPU_FPCCR_CLRONRET_Pos) /*!< FPCCR: CLRONRET bit Mask */
+
+#define FPU_FPCCR_CLRONRETS_Pos 27U /*!< FPCCR: CLRONRETS Position */
+#define FPU_FPCCR_CLRONRETS_Msk (1UL << FPU_FPCCR_CLRONRETS_Pos) /*!< FPCCR: CLRONRETS bit Mask */
+
+#define FPU_FPCCR_TS_Pos 26U /*!< FPCCR: TS Position */
+#define FPU_FPCCR_TS_Msk (1UL << FPU_FPCCR_TS_Pos) /*!< FPCCR: TS bit Mask */
+
+#define FPU_FPCCR_UFRDY_Pos 10U /*!< FPCCR: UFRDY Position */
+#define FPU_FPCCR_UFRDY_Msk (1UL << FPU_FPCCR_UFRDY_Pos) /*!< FPCCR: UFRDY bit Mask */
+
+#define FPU_FPCCR_SPLIMVIOL_Pos 9U /*!< FPCCR: SPLIMVIOL Position */
+#define FPU_FPCCR_SPLIMVIOL_Msk (1UL << FPU_FPCCR_SPLIMVIOL_Pos) /*!< FPCCR: SPLIMVIOL bit Mask */
+
+#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */
+#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */
+
+#define FPU_FPCCR_SFRDY_Pos 7U /*!< FPCCR: SFRDY Position */
+#define FPU_FPCCR_SFRDY_Msk (1UL << FPU_FPCCR_SFRDY_Pos) /*!< FPCCR: SFRDY bit Mask */
+
+#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */
+#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */
+
+#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */
+#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */
+
+#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */
+#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */
+
+#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */
+#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */
+
+#define FPU_FPCCR_S_Pos 2U /*!< FPCCR: Security status of the FP context bit Position */
+#define FPU_FPCCR_S_Msk (1UL << FPU_FPCCR_S_Pos) /*!< FPCCR: Security status of the FP context bit Mask */
+
+#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */
+#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */
+
+#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */
+#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */
+
+/* Floating-Point Context Address Register Definitions */
+#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */
+#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */
+
+/* Floating-Point Default Status Control Register Definitions */
+#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */
+#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */
+
+#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */
+#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */
+
+#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */
+#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */
+
+#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */
+#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */
+
+/* Media and FP Feature Register 0 Definitions */
+#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */
+#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */
+
+#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */
+#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */
+
+#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */
+#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */
+
+#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */
+#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */
+
+#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */
+#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */
+
+#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */
+#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */
+
+#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */
+#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */
+
+#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */
+#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */
+
+/* Media and FP Feature Register 1 Definitions */
+#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */
+#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */
+
+#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */
+#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */
+
+#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */
+#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */
+
+#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */
+#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */
+
+/*@} end of group CMSIS_FPU */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
+ __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */
+#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/* Debug Authentication Control Register Definitions */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
+
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
+
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */
+
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */
+
+/* Debug Security Control and Status Register Definitions */
+#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */
+#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */
+
+#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */
+#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */
+
+#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */
+#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+ #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+ #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+ #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+ #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+ #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+ #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+ #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+ #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+ #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+ #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+ #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+ #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+ #endif
+
+ #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
+ #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
+ #endif
+
+ #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
+ #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
+ #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */
+ #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
+ #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
+ #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
+
+ #define SCnSCB_NS ((SCnSCB_Type *) SCS_BASE_NS ) /*!< System control Register not in SCB(non-secure address space) */
+ #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
+ #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
+ #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
+ #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
+ #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
+ #endif
+
+ #define FPU_BASE_NS (SCS_BASE_NS + 0x0F30UL) /*!< Floating Point Unit (non-secure address space) */
+ #define FPU_NS ((FPU_Type *) FPU_BASE_NS ) /*!< Floating Point Unit (non-secure address space) */
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << 8U) ); /* Insert write key and priority group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Get Interrupt Target State
+ \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ \return 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Target State
+ \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Clear Interrupt Target State
+ \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Set Priority Grouping (non-secure)
+ \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB_NS->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB_NS->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping (non-secure)
+ \details Reads the priority grouping field from the non-secure NVIC when in secure state.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriorityGrouping_NS(void)
+{
+ return ((uint32_t)((SCB_NS->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt (non-secure)
+ \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status (non-secure)
+ \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt (non-secure)
+ \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt (non-secure)
+ \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt (non-secure)
+ \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt (non-secure)
+ \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt (non-secure)
+ \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority (non-secure)
+ \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every non-secure processor exception.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority (non-secure)
+ \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC_NS->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv8.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ uint32_t mvfr0;
+
+ mvfr0 = FPU->MVFR0;
+ if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U)
+ {
+ return 2U; /* Double + Single precision FPU */
+ }
+ else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
+ {
+ return 1U; /* Single precision FPU */
+ }
+ else
+ {
+ return 0U; /* No FPU */
+ }
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## SAU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SAUFunctions SAU Functions
+ \brief Functions that configure the SAU.
+ @{
+ */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+
+/**
+ \brief Enable SAU
+ \details Enables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Enable(void)
+{
+ SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
+}
+
+
+
+/**
+ \brief Disable SAU
+ \details Disables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Disable(void)
+{
+ SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
+}
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_SAUFunctions */
+
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function SysTick_Config is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief System Tick Configuration (non-secure)
+ \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function TZ_SysTick_Config_NS is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM33_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm4.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm4.h
new file mode 100644
index 0000000000000000000000000000000000000000..a11a3817a23491db120b26564d07c7cb1257b59e
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm4.h
@@ -0,0 +1,2118 @@
+/**************************************************************************//**
+ * @file core_cm4.h
+ * @brief CMSIS Cortex-M4 Core Peripheral Access Layer Header File
+ * @version V5.0.5
+ * @date 08. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM4_H_GENERIC
+#define __CORE_CM4_H_GENERIC
+
+#include
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M4
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM4 definitions */
+#define __CM4_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM4_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM4_CMSIS_VERSION ((__CM4_CMSIS_VERSION_MAIN << 16U) | \
+ __CM4_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (4U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
+*/
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_PCS_VFP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM4_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM4_H_DEPENDANT
+#define __CORE_CM4_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM4_REV
+ #define __CM4_REV 0x0000U
+ #warning "__CM4_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ IO Type Qualifiers are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M4 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core FPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+#define APSR_GE_Pos 16U /*!< APSR: GE Position */
+#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:1; /*!< bit: 9 Reserved */
+ uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit */
+ uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */
+#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */
+#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
+
+#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */
+#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */
+ uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */
+#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */
+
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[24U];
+ __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[24U];
+ __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[24U];
+ __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[24U];
+ __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[56U];
+ __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED5[644U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ uint32_t RESERVED0[5U];
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */
+#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */
+#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */
+#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */
+#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/* Auxiliary Control Register Definitions */
+#define SCnSCB_ACTLR_DISOOFP_Pos 9U /*!< ACTLR: DISOOFP Position */
+#define SCnSCB_ACTLR_DISOOFP_Msk (1UL << SCnSCB_ACTLR_DISOOFP_Pos) /*!< ACTLR: DISOOFP Mask */
+
+#define SCnSCB_ACTLR_DISFPCA_Pos 8U /*!< ACTLR: DISFPCA Position */
+#define SCnSCB_ACTLR_DISFPCA_Msk (1UL << SCnSCB_ACTLR_DISFPCA_Pos) /*!< ACTLR: DISFPCA Mask */
+
+#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */
+#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */
+
+#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */
+#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */
+
+#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */
+#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[29U];
+ __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */
+ __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */
+ __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[6U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */
+#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Integration Write Register Definitions */
+#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */
+#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */
+
+/* ITM Integration Read Register Definitions */
+#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */
+#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */
+
+/* ITM Integration Mode Control Register Definitions */
+#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */
+#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Mask Register Definitions */
+#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */
+#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */
+#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */
+
+#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */
+#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */
+#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */
+
+#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */
+#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */
+
+#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */
+#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */
+
+#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */
+#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */
+
+#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */
+#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IOM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */
+ __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
+ __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
+ __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< @Deprecated TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< @Deprecated TPI ACPR: PRESCALER Mask */
+
+#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */
+#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY_Pos 0U /*!< TPI ITATBCTR2: ATREADY Position */
+#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY_Pos 0U /*!< TPI ITATBCTR0: ATREADY Position */
+#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_MajorType_Pos 4U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+#define TPI_DEVTYPE_SubType_Pos 0U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */
+ __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */
+ __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */
+ __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 4U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register Definitions */
+#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_FPU Floating Point Unit (FPU)
+ \brief Type definitions for the Floating Point Unit (FPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Floating Point Unit (FPU).
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */
+ __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */
+ __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */
+ __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */
+} FPU_Type;
+
+/* Floating-Point Context Control Register Definitions */
+#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */
+#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */
+
+#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */
+#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */
+
+#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */
+#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */
+
+#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */
+#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */
+
+#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */
+#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */
+
+#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */
+#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */
+
+#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */
+#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */
+
+#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */
+#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */
+
+#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */
+#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */
+
+/* Floating-Point Context Address Register Definitions */
+#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */
+#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */
+
+/* Floating-Point Default Status Control Register Definitions */
+#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */
+#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */
+
+#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */
+#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */
+
+#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */
+#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */
+
+#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */
+#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */
+
+/* Media and FP Feature Register 0 Definitions */
+#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */
+#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */
+
+#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */
+#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */
+
+#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */
+#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */
+
+#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */
+#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */
+
+#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */
+#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */
+
+#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */
+#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */
+
+#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */
+#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */
+
+#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */
+#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */
+
+/* Media and FP Feature Register 1 Definitions */
+#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */
+#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */
+
+#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */
+#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */
+
+#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */
+#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */
+
+#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */
+#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */
+
+/*@} end of group CMSIS_FPU */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+#endif
+
+#define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
+#define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv7.h"
+
+#endif
+
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ uint32_t mvfr0;
+
+ mvfr0 = FPU->MVFR0;
+ if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
+ {
+ return 1U; /* Single precision FPU */
+ }
+ else
+ {
+ return 0U; /* No FPU */
+ }
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function SysTick_Config is not included. In this case, the file device.h
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM4_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/es32f0654/libraries/CMSIS/Include/core_cm7.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm7.h
similarity index 87%
rename from bsp/es32f0654/libraries/CMSIS/Include/core_cm7.h
rename to bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm7.h
index 3b7530ad505b57d283cc6f07e7f51b9a54be9a0b..1fe53bf012f4345356dd119fa0f03162f4d04dc6 100644
--- a/bsp/es32f0654/libraries/CMSIS/Include/core_cm7.h
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm7.h
@@ -1,40 +1,30 @@
/**************************************************************************//**
* @file core_cm7.h
* @brief CMSIS Cortex-M7 Core Peripheral Access Layer Header File
- * @version V4.30
- * @date 20. October 2015
+ * @version V5.0.5
+ * @date 08. January 2018
******************************************************************************/
-/* Copyright (c) 2009 - 2015 ARM LIMITED
-
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- - Neither the name of ARM nor the names of its contributors may be used
- to endorse or promote products derived from this software without
- specific prior written permission.
- *
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- ---------------------------------------------------------------------------*/
-
+/*
+ * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
#if defined ( __ICCARM__ )
- #pragma system_include /* treat file as system include file for MISRA check */
-#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
#pragma clang system_header /* treat file as system include file */
#endif
@@ -70,60 +60,22 @@
@{
*/
+#include "cmsis_version.h"
+
/* CMSIS CM7 definitions */
-#define __CM7_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */
-#define __CM7_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */
+#define __CM7_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM7_CMSIS_VERSION_SUB ( __CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
#define __CM7_CMSIS_VERSION ((__CM7_CMSIS_VERSION_MAIN << 16U) | \
- __CM7_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
-
-#define __CORTEX_M (0x07U) /*!< Cortex-M Core */
-
-
-#if defined ( __CC_ARM )
- #define __ASM __asm /*!< asm keyword for ARM Compiler */
- #define __INLINE __inline /*!< inline keyword for ARM Compiler */
- #define __STATIC_INLINE static __inline
-
-#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
- #define __ASM __asm /*!< asm keyword for ARM Compiler */
- #define __INLINE __inline /*!< inline keyword for ARM Compiler */
- #define __STATIC_INLINE static __inline
-
-#elif defined ( __GNUC__ )
- #define __ASM __asm /*!< asm keyword for GNU Compiler */
- #define __INLINE inline /*!< inline keyword for GNU Compiler */
- #define __STATIC_INLINE static inline
-
-#elif defined ( __ICCARM__ )
- #define __ASM __asm /*!< asm keyword for IAR Compiler */
- #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
- #define __STATIC_INLINE static inline
-
-#elif defined ( __TMS470__ )
- #define __ASM __asm /*!< asm keyword for TI CCS Compiler */
- #define __STATIC_INLINE static inline
-
-#elif defined ( __TASKING__ )
- #define __ASM __asm /*!< asm keyword for TASKING Compiler */
- #define __INLINE inline /*!< inline keyword for TASKING Compiler */
- #define __STATIC_INLINE static inline
+ __CM7_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
-#elif defined ( __CSMC__ )
- #define __packed
- #define __ASM _asm /*!< asm keyword for COSMIC Compiler */
- #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */
- #define __STATIC_INLINE static inline
-
-#else
- #error Unknown compiler
-#endif
+#define __CORTEX_M (7U) /*!< Cortex-M Core */
/** __FPU_USED indicates whether an FPU is used or not.
For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
*/
#if defined ( __CC_ARM )
#if defined __TARGET_FPU_VFP
- #if (__FPU_PRESENT == 1U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
#define __FPU_USED 1U
#else
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
@@ -133,9 +85,9 @@
#define __FPU_USED 0U
#endif
-#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#if defined __ARM_PCS_VFP
- #if (__FPU_PRESENT == 1)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
#define __FPU_USED 1U
#else
#warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
@@ -147,7 +99,7 @@
#elif defined ( __GNUC__ )
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
- #if (__FPU_PRESENT == 1U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
#define __FPU_USED 1U
#else
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
@@ -159,7 +111,7 @@
#elif defined ( __ICCARM__ )
#if defined __ARMVFP__
- #if (__FPU_PRESENT == 1U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
#define __FPU_USED 1U
#else
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
@@ -169,9 +121,9 @@
#define __FPU_USED 0U
#endif
-#elif defined ( __TMS470__ )
+#elif defined ( __TI_ARM__ )
#if defined __TI_VFP_SUPPORT__
- #if (__FPU_PRESENT == 1U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
#define __FPU_USED 1U
#else
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
@@ -183,7 +135,7 @@
#elif defined ( __TASKING__ )
#if defined __FPU_VFP__
- #if (__FPU_PRESENT == 1U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
#define __FPU_USED 1U
#else
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
@@ -195,7 +147,7 @@
#elif defined ( __CSMC__ )
#if ( __CSMC__ & 0x400U)
- #if (__FPU_PRESENT == 1U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
#define __FPU_USED 1U
#else
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
@@ -207,9 +159,8 @@
#endif
-#include "core_cmInstr.h" /* Core Instruction Access */
-#include "core_cmFunc.h" /* Core Function Access */
-#include "core_cmSimd.h" /* Compiler specific SIMD Intrinsics */
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
#ifdef __cplusplus
}
@@ -382,11 +333,12 @@ typedef union
struct
{
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
- uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */
+ uint32_t _reserved0:1; /*!< bit: 9 Reserved */
+ uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */
uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
- uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
- uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
+ uint32_t T:1; /*!< bit: 24 Thumb bit */
+ uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */
uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
@@ -412,8 +364,8 @@ typedef union
#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
-#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */
-#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */
+#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */
+#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */
#define xPSR_T_Pos 24U /*!< xPSR: T Position */
#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
@@ -421,6 +373,9 @@ typedef union
#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */
#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
+#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */
+#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */
+
#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
@@ -529,7 +484,7 @@ typedef struct
uint32_t RESERVED4[15U];
__IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */
__IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */
- __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 1 */
+ __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */
uint32_t RESERVED5[1U];
__OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */
uint32_t RESERVED6[1U];
@@ -715,6 +670,66 @@ typedef struct
#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */
+#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */
+#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
/* SCB Hard Fault Status Register Definitions */
#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
@@ -1033,7 +1048,7 @@ typedef struct
/* ITM Trace Privilege Register Definitions */
#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
-#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
/* ITM Trace Control Register Definitions */
#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
@@ -1277,8 +1292,11 @@ typedef struct
} TPI_Type;
/* TPI Asynchronous Clock Prescaler Register Definitions */
-#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
-#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< @Deprecated TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< @Deprecated TPI ACPR: PRESCALER Mask */
+
+#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */
+#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */
/* TPI Selected Pin Protocol Register Definitions */
#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
@@ -1393,7 +1411,7 @@ typedef struct
/*@}*/ /* end of group CMSIS_TPI */
-#if (__MPU_PRESENT == 1U)
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_MPU Memory Protection Unit (MPU)
@@ -1419,6 +1437,8 @@ typedef struct
__IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
} MPU_Type;
+#define MPU_TYPE_RALIASES 4U
+
/* MPU Type Register Definitions */
#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
@@ -1485,10 +1505,9 @@ typedef struct
#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
/*@} end of group CMSIS_MPU */
-#endif
+#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */
-#if (__FPU_PRESENT == 1U)
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_FPU Floating Point Unit (FPU)
@@ -1596,7 +1615,6 @@ typedef struct
/* Media and FP Feature Register 2 Definitions */
/*@} end of group CMSIS_FPU */
-#endif
/**
@@ -1714,18 +1732,18 @@ typedef struct
/**
\brief Mask and shift a bit field value for use in a register bit range.
\param[in] field Name of the register bit field.
- \param[in] value Value of the bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
\return Masked and shifted value.
*/
-#define _VAL2FLD(field, value) ((value << field ## _Pos) & field ## _Msk)
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
/**
\brief Mask and shift a register value to extract a bit filed value.
\param[in] field Name of the register bit field.
- \param[in] value Value of register.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
\return Masked and shifted bit field value.
*/
-#define _FLD2VAL(field, value) ((value & field ## _Msk) >> field ## _Pos)
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
/*@} end of group CMSIS_core_bitfield */
@@ -1737,7 +1755,7 @@ typedef struct
@{
*/
-/* Memory mapping of Cortex-M4 Hardware */
+/* Memory mapping of Core Hardware */
#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
@@ -1756,15 +1774,13 @@ typedef struct
#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
-#if (__MPU_PRESENT == 1U)
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
#define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
#define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
#endif
-#if (__FPU_PRESENT == 1U)
- #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
- #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
-#endif
+#define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
+#define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
/*@} */
@@ -1792,6 +1808,40 @@ typedef struct
@{
*/
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+
/**
\brief Set Priority Grouping
\details Sets the priority grouping field using the required unlock sequence.
@@ -1801,7 +1851,7 @@ typedef struct
priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
\param [in] PriorityGroup Priority grouping field.
*/
-__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
{
uint32_t reg_value;
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
@@ -1810,7 +1860,7 @@ __STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
reg_value = (reg_value |
((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
- (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
SCB->AIRCR = reg_value;
}
@@ -1820,121 +1870,178 @@ __STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
\details Reads the priority grouping field from the NVIC Interrupt Controller.
\return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
*/
-__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
{
return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
}
/**
- \brief Enable External Interrupt
- \details Enables a device-specific interrupt in the NVIC interrupt controller.
- \param [in] IRQn External interrupt number. Value cannot be negative.
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
{
- NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
}
/**
- \brief Disable External Interrupt
- \details Disables a device-specific interrupt in the NVIC interrupt controller.
- \param [in] IRQn External interrupt number. Value cannot be negative.
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
{
- NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
}
/**
\brief Get Pending Interrupt
- \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.
- \param [in] IRQn Interrupt number.
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
\return 0 Interrupt status is not pending.
\return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
{
- return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
}
/**
\brief Set Pending Interrupt
- \details Sets the pending bit of an external interrupt.
- \param [in] IRQn Interrupt number. Value cannot be negative.
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
{
- NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
}
/**
\brief Clear Pending Interrupt
- \details Clears the pending bit of an external interrupt.
- \param [in] IRQn External interrupt number. Value cannot be negative.
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
{
- NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
}
/**
\brief Get Active Interrupt
- \details Reads the active register in NVIC and returns the active bit.
- \param [in] IRQn Interrupt number.
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
\return 0 Interrupt status is not active.
\return 1 Interrupt status is active.
+ \note IRQn must not be negative.
*/
-__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
{
- return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
}
/**
\brief Set Interrupt Priority
- \details Sets the priority of an interrupt.
- \note The priority cannot be set for every core interrupt.
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
\param [in] IRQn Interrupt number.
\param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
*/
-__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
{
- if ((int32_t)(IRQn) < 0)
+ if ((int32_t)(IRQn) >= 0)
{
- SCB->SHPR[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
}
else
{
- NVIC->IP[((uint32_t)(int32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
}
}
/**
\brief Get Interrupt Priority
- \details Reads the priority of an interrupt.
- The interrupt number can be positive to specify an external (device specific) interrupt,
- or negative to specify an internal (core) interrupt.
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
\param [in] IRQn Interrupt number.
\return Interrupt Priority.
Value is aligned automatically to the implemented priority bits of the microcontroller.
*/
-__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
{
- if ((int32_t)(IRQn) < 0)
+ if ((int32_t)(IRQn) >= 0)
{
- return(((uint32_t)SCB->SHPR[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
}
else
{
- return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
}
}
@@ -1991,11 +2098,42 @@ __STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGr
}
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
/**
\brief System Reset
\details Initiates a system reset request to reset the MCU.
*/
-__STATIC_INLINE void NVIC_SystemReset(void)
+__STATIC_INLINE void __NVIC_SystemReset(void)
{
__DSB(); /* Ensure all outstanding memory accesses included
buffered write are completed before reset */
@@ -2012,6 +2150,13 @@ __STATIC_INLINE void NVIC_SystemReset(void)
/*@} end of CMSIS_Core_NVICFunctions */
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv7.h"
+
+#endif
/* ########################## FPU functions #################################### */
/**
@@ -2034,17 +2179,17 @@ __STATIC_INLINE uint32_t SCB_GetFPUType(void)
uint32_t mvfr0;
mvfr0 = SCB->MVFR0;
- if ((mvfr0 & 0x00000FF0UL) == 0x220UL)
+ if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U)
{
- return 2UL; /* Double + Single precision FPU */
+ return 2U; /* Double + Single precision FPU */
}
- else if ((mvfr0 & 0x00000FF0UL) == 0x020UL)
+ else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
{
- return 1UL; /* Single precision FPU */
+ return 1U; /* Single precision FPU */
}
else
{
- return 0UL; /* No FPU */
+ return 0U; /* No FPU */
}
}
@@ -2072,10 +2217,12 @@ __STATIC_INLINE uint32_t SCB_GetFPUType(void)
*/
__STATIC_INLINE void SCB_EnableICache (void)
{
- #if (__ICACHE_PRESENT == 1U)
+ #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
__DSB();
__ISB();
SCB->ICIALLU = 0UL; /* invalidate I-Cache */
+ __DSB();
+ __ISB();
SCB->CCR |= (uint32_t)SCB_CCR_IC_Msk; /* enable I-Cache */
__DSB();
__ISB();
@@ -2089,7 +2236,7 @@ __STATIC_INLINE void SCB_EnableICache (void)
*/
__STATIC_INLINE void SCB_DisableICache (void)
{
- #if (__ICACHE_PRESENT == 1U)
+ #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
__DSB();
__ISB();
SCB->CCR &= ~(uint32_t)SCB_CCR_IC_Msk; /* disable I-Cache */
@@ -2106,7 +2253,7 @@ __STATIC_INLINE void SCB_DisableICache (void)
*/
__STATIC_INLINE void SCB_InvalidateICache (void)
{
- #if (__ICACHE_PRESENT == 1U)
+ #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
__DSB();
__ISB();
SCB->ICIALLU = 0UL;
@@ -2122,12 +2269,12 @@ __STATIC_INLINE void SCB_InvalidateICache (void)
*/
__STATIC_INLINE void SCB_EnableDCache (void)
{
- #if (__DCACHE_PRESENT == 1U)
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
uint32_t ccsidr;
uint32_t sets;
uint32_t ways;
- SCB->CSSELR = (0U << 1U) | 0U; /* Level 1 data cache */
+ SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */
__DSB();
ccsidr = SCB->CCSIDR;
@@ -2142,8 +2289,8 @@ __STATIC_INLINE void SCB_EnableDCache (void)
#if defined ( __CC_ARM )
__schedule_barrier();
#endif
- } while (ways--);
- } while(sets--);
+ } while (ways-- != 0U);
+ } while(sets-- != 0U);
__DSB();
SCB->CCR |= (uint32_t)SCB_CCR_DC_Msk; /* enable D-Cache */
@@ -2160,17 +2307,18 @@ __STATIC_INLINE void SCB_EnableDCache (void)
*/
__STATIC_INLINE void SCB_DisableDCache (void)
{
- #if (__DCACHE_PRESENT == 1U)
- uint32_t ccsidr;
- uint32_t sets;
- uint32_t ways;
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+ register uint32_t ccsidr;
+ register uint32_t sets;
+ register uint32_t ways;
- SCB->CSSELR = (0U << 1U) | 0U; /* Level 1 data cache */
+ SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */
__DSB();
- ccsidr = SCB->CCSIDR;
-
SCB->CCR &= ~(uint32_t)SCB_CCR_DC_Msk; /* disable D-Cache */
+ __DSB();
+
+ ccsidr = SCB->CCSIDR;
/* clean & invalidate D-Cache */
sets = (uint32_t)(CCSIDR_SETS(ccsidr));
@@ -2182,8 +2330,8 @@ __STATIC_INLINE void SCB_DisableDCache (void)
#if defined ( __CC_ARM )
__schedule_barrier();
#endif
- } while (ways--);
- } while(sets--);
+ } while (ways-- != 0U);
+ } while(sets-- != 0U);
__DSB();
__ISB();
@@ -2197,12 +2345,12 @@ __STATIC_INLINE void SCB_DisableDCache (void)
*/
__STATIC_INLINE void SCB_InvalidateDCache (void)
{
- #if (__DCACHE_PRESENT == 1U)
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
uint32_t ccsidr;
uint32_t sets;
uint32_t ways;
- SCB->CSSELR = (0U << 1U) | 0U; /* Level 1 data cache */
+ SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */
__DSB();
ccsidr = SCB->CCSIDR;
@@ -2217,8 +2365,8 @@ __STATIC_INLINE void SCB_InvalidateDCache (void)
#if defined ( __CC_ARM )
__schedule_barrier();
#endif
- } while (ways--);
- } while(sets--);
+ } while (ways-- != 0U);
+ } while(sets-- != 0U);
__DSB();
__ISB();
@@ -2232,13 +2380,13 @@ __STATIC_INLINE void SCB_InvalidateDCache (void)
*/
__STATIC_INLINE void SCB_CleanDCache (void)
{
- #if (__DCACHE_PRESENT == 1U)
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
uint32_t ccsidr;
uint32_t sets;
uint32_t ways;
- SCB->CSSELR = (0U << 1U) | 0U; /* Level 1 data cache */
- __DSB();
+ SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */
+ __DSB();
ccsidr = SCB->CCSIDR;
@@ -2252,8 +2400,8 @@ __STATIC_INLINE void SCB_CleanDCache (void)
#if defined ( __CC_ARM )
__schedule_barrier();
#endif
- } while (ways--);
- } while(sets--);
+ } while (ways-- != 0U);
+ } while(sets-- != 0U);
__DSB();
__ISB();
@@ -2267,12 +2415,12 @@ __STATIC_INLINE void SCB_CleanDCache (void)
*/
__STATIC_INLINE void SCB_CleanInvalidateDCache (void)
{
- #if (__DCACHE_PRESENT == 1U)
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
uint32_t ccsidr;
uint32_t sets;
uint32_t ways;
- SCB->CSSELR = (0U << 1U) | 0U; /* Level 1 data cache */
+ SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* Level 1 data cache */
__DSB();
ccsidr = SCB->CCSIDR;
@@ -2287,8 +2435,8 @@ __STATIC_INLINE void SCB_CleanInvalidateDCache (void)
#if defined ( __CC_ARM )
__schedule_barrier();
#endif
- } while (ways--);
- } while(sets--);
+ } while (ways-- != 0U);
+ } while(sets-- != 0U);
__DSB();
__ISB();
@@ -2304,17 +2452,17 @@ __STATIC_INLINE void SCB_CleanInvalidateDCache (void)
*/
__STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
{
- #if (__DCACHE_PRESENT == 1U)
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
int32_t op_size = dsize;
uint32_t op_addr = (uint32_t)addr;
- int32_t linesize = 32U; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
+ int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
__DSB();
while (op_size > 0) {
SCB->DCIMVAC = op_addr;
- op_addr += linesize;
- op_size -= linesize;
+ op_addr += (uint32_t)linesize;
+ op_size -= linesize;
}
__DSB();
@@ -2331,17 +2479,17 @@ __STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize
*/
__STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize)
{
- #if (__DCACHE_PRESENT == 1)
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
int32_t op_size = dsize;
uint32_t op_addr = (uint32_t) addr;
- int32_t linesize = 32U; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
+ int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
__DSB();
while (op_size > 0) {
SCB->DCCMVAC = op_addr;
- op_addr += linesize;
- op_size -= linesize;
+ op_addr += (uint32_t)linesize;
+ op_size -= linesize;
}
__DSB();
@@ -2358,17 +2506,17 @@ __STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize)
*/
__STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
{
- #if (__DCACHE_PRESENT == 1U)
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
int32_t op_size = dsize;
uint32_t op_addr = (uint32_t) addr;
- int32_t linesize = 32U; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
+ int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
__DSB();
while (op_size > 0) {
SCB->DCCIMVAC = op_addr;
- op_addr += linesize;
- op_size -= linesize;
+ op_addr += (uint32_t)linesize;
+ op_size -= linesize;
}
__DSB();
@@ -2389,7 +2537,7 @@ __STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t
@{
*/
-#if (__Vendor_SysTickConfig == 0U)
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
/**
\brief System Tick Configuration
@@ -2432,8 +2580,8 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
@{
*/
-extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
-#define ITM_RXBUFFER_EMPTY 0x5AA55AA5U /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
/**
diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_sc000.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_sc000.h
new file mode 100644
index 0000000000000000000000000000000000000000..9aab5e5b3ea5330bb524038aec36100126a59be5
--- /dev/null
+++ b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_sc000.h
@@ -0,0 +1,1016 @@
+/**************************************************************************//**
+ * @file core_sc000.h
+ * @brief CMSIS SC000 Core Peripheral Access Layer Header File
+ * @version V5.0.3
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_SC000_H_GENERIC
+#define __CORE_SC000_H_GENERIC
+
+#include
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup SC000
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS SC000 definitions */
+#define __SC000_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __SC000_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \
+ __SC000_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_SC (000U) /*!< Cortex secure core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_PCS_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_SC000_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_SC000_H_DEPENDANT
+#define __CORE_SC000_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __SC000_REV
+ #define __SC000_REV 0x0000U
+ #warning "__SC000_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ IO Type Qualifiers are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group SC000 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core MPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:1; /*!< bit: 0 Reserved */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[31U];
+ __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[31U];
+ __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[31U];
+ __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[31U];
+ uint32_t RESERVED4[64U];
+ __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ uint32_t RESERVED1[154U];
+ __IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+} SCnSCB_Type;
+
+/* Auxiliary Control Register Definitions */
+#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */
+#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
+} MPU_Type;
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register Definitions */
+#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief SC000 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
+ Therefore they are not covered by the SC000 header file.
+ @{
+ */
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for SC000 */
+/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for SC000 */
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+/*#define NVIC_GetActive __NVIC_GetActive not available for SC000 */
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable __Vendor_SysTickConfig is set to 1, then the
+ function SysTick_Config is not included. In this case, the file