mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #2850 from ARMmbed/release-candidate
Release mbed-os-5.1.5 and mbed lib v127mbed-os-5.1 mbed-os-5.1.5
commit
a6f3fd1a60
|
@ -34,8 +34,6 @@ var
|
|||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
lib
|
||||
lib64
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
# Description
|
||||
This document is cheat sheet for everyone who wants to contribute to mbedmicro/mbed GitHub repository at GitHub.
|
||||
This document is cheat sheet for everyone who wants to contribute to [ARMmbed/mbed-os](https://github.com/ARMmbed/mbed-os) GitHub repository at GitHub.
|
||||
All changes in code base should originate from GitHub Issues and take advantage of existing GitHub flows. Goal is to attract contributors and allow them contribute to code and documentation at the same time.
|
||||
|
||||
Guidelines from this document are created to help new and existing contributors understand process workflow and align to project rules before pull request is submitted. It explains how a participant should do things like format code, test fixes, and submit patches.
|
||||
|
||||
## Where to get more information?
|
||||
You can for example read more in our ```docs``` section in [mbedmicro/mbed/doc](https://github.com/PrzemekWirkus/mbed/tree/docs/docs) directory.
|
||||
You can for example read more in our ```docs``` section in [ARMmbed/mbed-os/doc](https://github.com/ARMmbed/mbed-os/tree/master/docs) directory.
|
||||
|
||||
# How to contribute
|
||||
We really appreciate your contributions! We are Open Source project and we need your help. We want to keep it as easy as possible to contribute changes that get things working in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
|
||||
|
||||
Before a pull request will be merged, the [mbed Contributor Agreement](http://developer.mbed.org/contributor_agreement/) must be signed.
|
||||
|
||||
You can pick up existing [mbed GitHub Issue](https://github.com/mbedmicro/mbed/issues) and solve it or implement new feature you find important, attractive or just necessary. We will review your proposal via pull request mechanism, give you comments and merge your changes if we decide your contribution satisfy criteria such as quality.
|
||||
You can pick up existing [mbed-os GitHub Issue](https://github.com/ARMmbed/mbed-os/issues) and solve it or implement new feature you find important, attractive or just necessary. We will review your proposal via pull request mechanism, give you comments and merge your changes if we decide your contribution satisfy criteria such as quality.
|
||||
|
||||
# Enhancements vs Bugs
|
||||
Enhancements are:
|
||||
|
@ -23,7 +23,7 @@ Enhancements are:
|
|||
* Documentation work.
|
||||
|
||||
Bugs are:
|
||||
* Issues rose internally or externally by mbedmicro/mbed users.
|
||||
* Issues rose internally or externally by [ARMmbed/mbed-os](https://github.com/ARMmbed/mbed-os) users.
|
||||
* Internally (within mbed team) created issues from Continuous Integration pipeline and build servers.
|
||||
* Issues detected using automation tools such as compilers, sanitizers, static code analysis tools etc.
|
||||
|
||||
|
@ -39,7 +39,7 @@ Please be patient, digest Gate Keeper's feedback and respond promptly :)
|
|||
* Before starting the mbed SDK porting, you might want to familiarize with the [mbed SDK library internals](http://developer.mbed.org/handbook/mbed-library-internals) first.
|
||||
|
||||
# Glossary
|
||||
* Gate Keeper – persons responsible for overall code-base quality of mbedmicro/mbed project.
|
||||
* Gate Keeper – persons responsible for overall code-base quality of [ARMmbed/mbed-os](https://github.com/ARMmbed/mbed-os) project.
|
||||
* Enhancement – New feature deployment, code refactoring actions or existing code improvements.
|
||||
* Bugfix – Issues originated from GitHub Issues pool, raised internally within mbed classic team or issues from automated code validators like linters, static code analysis tools etc.
|
||||
* Mbed classic – mbed SDK 2.0 located in GitHub at mbedmicro/mbed.
|
||||
* Mbed classic – mbed SDK 2.0 located in GitHub at [ARMmbed/mbed-os](https://github.com/ARMmbed/mbed-os).
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
*/
|
||||
#if (defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8)) && defined(TOOLCHAIN_GCC)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/4
|
||||
#elif (defined(TARGET_STM32F030R8) || defined(TARGET_STM32F070RB)) && defined(TOOLCHAIN_GCC)
|
||||
#elif defined(TARGET_STM32F030R8) && defined(TOOLCHAIN_GCC)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/4
|
||||
#elif defined(TARGET_STM32F334R8) && defined(TOOLCHAIN_IAR)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/4
|
||||
#elif defined(TARGET_STM32F030R8) && defined(TOOLCHAIN_IAR)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/4
|
||||
#elif defined(TARGET_STM32F070RB) && defined(TOOLCHAIN_IAR)
|
||||
#elif defined(TARGET_STM32F070RB)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/2
|
||||
#elif defined(TARGET_STM32F072RB) && defined(TOOLCHAIN_IAR)
|
||||
#elif defined(TARGET_STM32F072RB)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/2
|
||||
#elif defined(TARGET_STM32F302R8) && defined(TOOLCHAIN_IAR)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/2
|
||||
|
|
|
@ -17,17 +17,17 @@
|
|||
*/
|
||||
#if (defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8)) && defined(TOOLCHAIN_GCC)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/16
|
||||
#elif (defined(TARGET_STM32F030R8) || defined(TARGET_STM32F070RB)) && defined(TOOLCHAIN_GCC)
|
||||
#elif defined(TARGET_STM32F030R8) && defined(TOOLCHAIN_GCC)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/8
|
||||
#elif defined(TARGET_STM32F334R8) && (defined(TOOLCHAIN_GCC) || defined(TOOLCHAIN_IAR))
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/4
|
||||
#elif defined(TARGET_STM32F103RB) && defined(TOOLCHAIN_IAR)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/4
|
||||
#elif defined(TARGET_STM32F103RB)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/2
|
||||
#elif defined(TARGET_STM32F030R8) && defined(TOOLCHAIN_IAR)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/4
|
||||
#elif defined(TARGET_STM32F070RB) && defined(TOOLCHAIN_IAR)
|
||||
#elif defined(TARGET_STM32F070RB)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/2
|
||||
#elif defined(TARGET_STM32F072RB) && defined(TOOLCHAIN_IAR)
|
||||
#elif defined(TARGET_STM32F072RB)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/2
|
||||
#elif defined(TARGET_STM32F302R8) && defined(TOOLCHAIN_IAR)
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE/2
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
*/
|
||||
#if defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832)
|
||||
#define STACK_SIZE 512
|
||||
#elif (defined(TARGET_STM32F070RB) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F103RB))
|
||||
#define STACK_SIZE 512
|
||||
#else
|
||||
#define STACK_SIZE DEFAULT_STACK_SIZE
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,7 @@ The way tests are run and compiled in mbed OS 5 is substantially different from
|
|||
- [Test names](#test-names)
|
||||
- [Building tests](#building-tests)
|
||||
- [Building process](#building-process)
|
||||
- [App config](#app-config)
|
||||
- [Running tests](#running-tests)
|
||||
- [Writing tests](#writing-tests)
|
||||
- [Debugging tests](#debugging-tests)
|
||||
|
@ -73,6 +74,12 @@ The full build process is:
|
|||
1. For each discovered test, build all of its source files and link it with the non-test code that was built in step 1.
|
||||
1. If specified, create a test specification file and place it in the given directory for use by testing tools. This is placed in the build directory by default when using mbed CLI.
|
||||
|
||||
#### App config
|
||||
|
||||
When building an mbed application, the presence of a `mbed_app.json` file allows you to set or override different config settings from libraries and targets. However, because the tests share a common build, this can cause issues when tests have different configurations that affect the OS.
|
||||
|
||||
If you need to use app config, this must be set via the `--app-config` option when calling `mbed test`. **If this option is not specified, the build system will ignore all `mbed_app.json` files and use the default config values.**
|
||||
|
||||
### Running tests
|
||||
|
||||
Automated tests can be run easily through mbed CLI. For information on using mbed CLI, please see its documentation.
|
||||
|
|
|
@ -16,7 +16,7 @@ static osThreadId timer_thread_id;
|
|||
static Timer timer;
|
||||
static Timeout timeout;
|
||||
static uint32_t due;
|
||||
static void (*callback)(void);
|
||||
static void (*arm_hal_callback)(void);
|
||||
|
||||
static void timer_thread(const void *)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ static void timer_thread(const void *)
|
|||
// !!! We don't do our own enter/exit critical - we rely on callback
|
||||
// doing it (ns_timer_interrupt_handler does)
|
||||
//platform_enter_critical();
|
||||
callback();
|
||||
arm_hal_callback();
|
||||
//platform_exit_critical();
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void platform_timer_disable(void)
|
|||
// Not called while running, fortunately
|
||||
void platform_timer_set_cb(void (*new_fp)(void))
|
||||
{
|
||||
callback = new_fp;
|
||||
arm_hal_callback = new_fp;
|
||||
}
|
||||
|
||||
static void timer_callback(void)
|
||||
|
|
|
@ -23,7 +23,7 @@ GDB:=$(PREFIX)gdb
|
|||
OBJDUMP:=$(PREFIX)objdump
|
||||
|
||||
# Translate between uVisor namespace and mbed namespace
|
||||
TARGET_TRANSLATION:=MCU_K64F.kinetis EFM32.efm32 STM32F4.stm32
|
||||
TARGET_TRANSLATION:=MCU_K64F.kinetis EFM32.efm32 STM32F4.stm32 ARM_BEETLE_SOC.beetle
|
||||
TARGET_PREFIX:=../
|
||||
TARGET_SUPPORTED:=$(TARGET_PREFIX)targets/TARGET_UVISOR_SUPPORTED
|
||||
TARGET_UNSUPPORTED:=$(TARGET_PREFIX)targets/TARGET_UVISOR_UNSUPPORTED
|
||||
|
|
|
@ -35,15 +35,16 @@ bool find_substring(const char *first, const char *last, const char *s_first, co
|
|||
int main() {
|
||||
GREENTEA_SETUP(20, "default_auto");
|
||||
|
||||
bool result = true;
|
||||
bool result = false;
|
||||
EthernetInterface eth;
|
||||
//eth.init(); //Use DHCP
|
||||
eth.connect();
|
||||
printf("TCP client IP Address is %s\r\n", eth.get_ip_address());
|
||||
|
||||
TCPSocket sock(ð);
|
||||
printf("HTTP: Connection to %s:%d\r\n", HTTP_SERVER_NAME, HTTP_SERVER_PORT);
|
||||
if (sock.connect(HTTP_SERVER_NAME, HTTP_SERVER_PORT) == 0) {
|
||||
printf("HTTP: Connected to %s:%d\r\n", HTTP_SERVER_NAME, HTTP_SERVER_PORT);
|
||||
printf("HTTP: OK\r\n");
|
||||
|
||||
// We are constructing GET command like this:
|
||||
// GET http://developer.mbed.org/media/uploads/mbed_official/hello.txt HTTP/1.0\n\n
|
||||
|
@ -66,17 +67,18 @@ int main() {
|
|||
TEST_ASSERT_TRUE(found_200_ok);
|
||||
TEST_ASSERT_TRUE(found_hello);
|
||||
|
||||
if (!found_200_ok) result = false;
|
||||
if (!found_hello) result = false;
|
||||
if (found_200_ok && found_hello) result = true;
|
||||
|
||||
printf("HTTP: Received %d chars from server\r\n", ret);
|
||||
printf("HTTP: Received 200 OK status ... %s\r\n", found_200_ok ? "[OK]" : "[FAIL]");
|
||||
printf("HTTP: Received '%s' status ... %s\r\n", HTTP_HELLO_STR, found_hello ? "[OK]" : "[FAIL]");
|
||||
printf("HTTP: Received massage:\r\n\r\n");
|
||||
printf("HTTP: Received message:\r\n");
|
||||
printf("%s", buffer);
|
||||
sock.close();
|
||||
} else {
|
||||
printf("HTTP: ERROR\r\n");
|
||||
}
|
||||
|
||||
sock.close();
|
||||
eth.disconnect();
|
||||
GREENTEA_TESTSUITE_RESULT(result);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ int main() {
|
|||
|
||||
greentea_send_kv("target_ip", eth.get_ip_address());
|
||||
|
||||
bool result = true;
|
||||
bool result = false;
|
||||
|
||||
char recv_key[] = "host_port";
|
||||
char ipbuf[60] = {0};
|
||||
|
@ -66,6 +66,8 @@ int main() {
|
|||
result = false;
|
||||
break;
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
sock.close();
|
||||
|
|
|
@ -26,8 +26,7 @@ int EthernetInterface::connect()
|
|||
|
||||
int EthernetInterface::disconnect()
|
||||
{
|
||||
lwip_bringdown();
|
||||
return 0;
|
||||
return lwip_bringdown();
|
||||
}
|
||||
|
||||
const char *EthernetInterface::get_ip_address()
|
||||
|
|
|
@ -1,452 +0,0 @@
|
|||
#include "stm32f2xx_hal.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/timers.h"
|
||||
#include "netif/etharp.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include <string.h>
|
||||
#include "cmsis_os.h"
|
||||
#include "mbed_interface.h"
|
||||
|
||||
#define RECV_TASK_PRI (osPriorityHigh)
|
||||
#define PHY_TASK_PRI (osPriorityLow)
|
||||
#define PHY_TASK_WAIT (200)
|
||||
#define ETH_ARCH_PHY_ADDRESS (0x00)
|
||||
|
||||
ETH_HandleTypeDef EthHandle;
|
||||
|
||||
#if defined (__ICCARM__) /*!< IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
__ALIGN_BEGIN ETH_DMADescTypeDef DMARxDscrTab[ETH_RXBUFNB] __ALIGN_END; /* Ethernet Rx DMA Descriptor */
|
||||
|
||||
#if defined (__ICCARM__) /*!< IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
__ALIGN_BEGIN ETH_DMADescTypeDef DMATxDscrTab[ETH_TXBUFNB] __ALIGN_END; /* Ethernet Tx DMA Descriptor */
|
||||
|
||||
#if defined (__ICCARM__) /*!< IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
__ALIGN_BEGIN uint8_t Rx_Buff[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __ALIGN_END; /* Ethernet Receive Buffer */
|
||||
|
||||
#if defined (__ICCARM__) /*!< IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
__ALIGN_BEGIN uint8_t Tx_Buff[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __ALIGN_END; /* Ethernet Transmit Buffer */
|
||||
|
||||
static sys_sem_t rx_ready_sem; /* receive ready semaphore */
|
||||
static sys_mutex_t tx_lock_mutex;
|
||||
|
||||
/* function */
|
||||
static void _eth_arch_rx_task(void *arg);
|
||||
static void _eth_arch_phy_task(void *arg);
|
||||
static err_t _eth_arch_netif_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr);
|
||||
static err_t _eth_arch_low_level_output(struct netif *netif, struct pbuf *p);
|
||||
static struct pbuf * _eth_arch_low_level_input(struct netif *netif);
|
||||
|
||||
/**
|
||||
* Ethernet Rx Transfer completed callback
|
||||
*
|
||||
* @param heth: ETH handle
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *heth)
|
||||
{
|
||||
sys_sem_signal(&rx_ready_sem);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ethernet IRQ Handler
|
||||
*
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ETH_IRQHandler(void)
|
||||
{
|
||||
HAL_ETH_IRQHandler(&EthHandle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* In this function, the hardware should be initialized.
|
||||
* Called from eth_arch_enetif_init().
|
||||
*
|
||||
* @param netif the already initialized lwip network interface structure
|
||||
* for this ethernetif
|
||||
*/
|
||||
static void _eth_arch_low_level_init(struct netif *netif)
|
||||
{
|
||||
uint32_t regvalue = 0;
|
||||
HAL_StatusTypeDef hal_eth_init_status;
|
||||
|
||||
/* Init ETH */
|
||||
uint8_t MACAddr[6];
|
||||
EthHandle.Instance = ETH;
|
||||
EthHandle.Init.AutoNegotiation = ETH_AUTONEGOTIATION_ENABLE;
|
||||
EthHandle.Init.Speed = ETH_SPEED_100M;
|
||||
EthHandle.Init.DuplexMode = ETH_MODE_FULLDUPLEX;
|
||||
EthHandle.Init.PhyAddress = ETH_ARCH_PHY_ADDRESS;
|
||||
#if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
|
||||
MACAddr[0] = MBED_MAC_ADDR_0;
|
||||
MACAddr[1] = MBED_MAC_ADDR_1;
|
||||
MACAddr[2] = MBED_MAC_ADDR_2;
|
||||
MACAddr[3] = MBED_MAC_ADDR_3;
|
||||
MACAddr[4] = MBED_MAC_ADDR_4;
|
||||
MACAddr[5] = MBED_MAC_ADDR_5;
|
||||
#else
|
||||
mbed_mac_address((char *)MACAddr);
|
||||
#endif
|
||||
EthHandle.Init.MACAddr = &MACAddr[0];
|
||||
EthHandle.Init.RxMode = ETH_RXINTERRUPT_MODE;
|
||||
EthHandle.Init.ChecksumMode = ETH_CHECKSUM_BY_HARDWARE;
|
||||
EthHandle.Init.MediaInterface = ETH_MEDIA_INTERFACE_RMII;
|
||||
hal_eth_init_status = HAL_ETH_Init(&EthHandle);
|
||||
|
||||
/* Initialize Tx Descriptors list: Chain Mode */
|
||||
HAL_ETH_DMATxDescListInit(&EthHandle, DMATxDscrTab, &Tx_Buff[0][0], ETH_TXBUFNB);
|
||||
|
||||
/* Initialize Rx Descriptors list: Chain Mode */
|
||||
HAL_ETH_DMARxDescListInit(&EthHandle, DMARxDscrTab, &Rx_Buff[0][0], ETH_RXBUFNB);
|
||||
|
||||
#if LWIP_ARP || LWIP_ETHERNET
|
||||
/* set MAC hardware address length */
|
||||
netif->hwaddr_len = ETHARP_HWADDR_LEN;
|
||||
|
||||
/* set MAC hardware address */
|
||||
netif->hwaddr[0] = EthHandle.Init.MACAddr[0];
|
||||
netif->hwaddr[1] = EthHandle.Init.MACAddr[1];
|
||||
netif->hwaddr[2] = EthHandle.Init.MACAddr[2];
|
||||
netif->hwaddr[3] = EthHandle.Init.MACAddr[3];
|
||||
netif->hwaddr[4] = EthHandle.Init.MACAddr[4];
|
||||
netif->hwaddr[5] = EthHandle.Init.MACAddr[5];
|
||||
|
||||
/* maximum transfer unit */
|
||||
netif->mtu = 1500;
|
||||
|
||||
/* device capabilities */
|
||||
/* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */
|
||||
netif->flags |= NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP;
|
||||
|
||||
/* Enable MAC and DMA transmission and reception */
|
||||
HAL_ETH_Start(&EthHandle);
|
||||
|
||||
/**** Configure PHY to generate an interrupt when Eth Link state changes ****/
|
||||
/* Read Register Configuration */
|
||||
HAL_ETH_ReadPHYRegister(&EthHandle, PHY_MICR, ®value);
|
||||
|
||||
regvalue |= (PHY_MICR_INT_EN | PHY_MICR_INT_OE);
|
||||
|
||||
/* Enable Interrupts */
|
||||
HAL_ETH_WritePHYRegister(&EthHandle, PHY_MICR, regvalue);
|
||||
|
||||
/* Read Register Configuration */
|
||||
HAL_ETH_ReadPHYRegister(&EthHandle, PHY_MISR, ®value);
|
||||
|
||||
regvalue |= PHY_MISR_LINK_INT_EN;
|
||||
|
||||
/* Enable Interrupt on change of link status */
|
||||
HAL_ETH_WritePHYRegister(&EthHandle, PHY_MISR, regvalue);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* This function should do the actual transmission of the packet. The packet is
|
||||
* contained in the pbuf that is passed to the function. This pbuf
|
||||
* might be chained.
|
||||
*
|
||||
* @param netif the lwip network interface structure for this ethernetif
|
||||
* @param p the MAC packet to send (e.g. IP packet including MAC addresses and type)
|
||||
* @return ERR_OK if the packet could be sent
|
||||
* an err_t value if the packet couldn't be sent
|
||||
*
|
||||
* @note Returning ERR_MEM here if a DMA queue of your MAC is full can lead to
|
||||
* strange results. You might consider waiting for space in the DMA queue
|
||||
* to become availale since the stack doesn't retry to send a packet
|
||||
* dropped because of memory failure (except for the TCP timers).
|
||||
*/
|
||||
|
||||
static err_t _eth_arch_low_level_output(struct netif *netif, struct pbuf *p)
|
||||
{
|
||||
err_t errval;
|
||||
struct pbuf *q;
|
||||
uint8_t *buffer = (uint8_t*)(EthHandle.TxDesc->Buffer1Addr);
|
||||
__IO ETH_DMADescTypeDef *DmaTxDesc;
|
||||
uint32_t framelength = 0;
|
||||
uint32_t bufferoffset = 0;
|
||||
uint32_t byteslefttocopy = 0;
|
||||
uint32_t payloadoffset = 0;
|
||||
DmaTxDesc = EthHandle.TxDesc;
|
||||
bufferoffset = 0;
|
||||
|
||||
|
||||
sys_mutex_lock(&tx_lock_mutex);
|
||||
|
||||
/* copy frame from pbufs to driver buffers */
|
||||
for (q = p; q != NULL; q = q->next) {
|
||||
/* Is this buffer available? If not, goto error */
|
||||
if ((DmaTxDesc->Status & ETH_DMATXDESC_OWN) != (uint32_t)RESET) {
|
||||
errval = ERR_USE;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Get bytes in current lwIP buffer */
|
||||
byteslefttocopy = q->len;
|
||||
payloadoffset = 0;
|
||||
|
||||
/* Check if the length of data to copy is bigger than Tx buffer size*/
|
||||
while ((byteslefttocopy + bufferoffset) > ETH_TX_BUF_SIZE) {
|
||||
/* Copy data to Tx buffer*/
|
||||
memcpy((uint8_t*)((uint8_t*)buffer + bufferoffset), (uint8_t*)((uint8_t*)q->payload + payloadoffset), (ETH_TX_BUF_SIZE - bufferoffset));
|
||||
|
||||
/* Point to next descriptor */
|
||||
DmaTxDesc = (ETH_DMADescTypeDef*)(DmaTxDesc->Buffer2NextDescAddr);
|
||||
|
||||
/* Check if the buffer is available */
|
||||
if ((DmaTxDesc->Status & ETH_DMATXDESC_OWN) != (uint32_t)RESET) {
|
||||
errval = ERR_USE;
|
||||
goto error;
|
||||
}
|
||||
|
||||
buffer = (uint8_t*)(DmaTxDesc->Buffer1Addr);
|
||||
|
||||
byteslefttocopy = byteslefttocopy - (ETH_TX_BUF_SIZE - bufferoffset);
|
||||
payloadoffset = payloadoffset + (ETH_TX_BUF_SIZE - bufferoffset);
|
||||
framelength = framelength + (ETH_TX_BUF_SIZE - bufferoffset);
|
||||
bufferoffset = 0;
|
||||
}
|
||||
|
||||
/* Copy the remaining bytes */
|
||||
memcpy((uint8_t*)((uint8_t*)buffer + bufferoffset), (uint8_t*)((uint8_t*)q->payload + payloadoffset), byteslefttocopy);
|
||||
bufferoffset = bufferoffset + byteslefttocopy;
|
||||
framelength = framelength + byteslefttocopy;
|
||||
}
|
||||
|
||||
/* Prepare transmit descriptors to give to DMA */
|
||||
HAL_ETH_TransmitFrame(&EthHandle, framelength);
|
||||
|
||||
errval = ERR_OK;
|
||||
|
||||
error:
|
||||
|
||||
/* When Transmit Underflow flag is set, clear it and issue a Transmit Poll Demand to resume transmission */
|
||||
if ((EthHandle.Instance->DMASR & ETH_DMASR_TUS) != (uint32_t)RESET) {
|
||||
/* Clear TUS ETHERNET DMA flag */
|
||||
EthHandle.Instance->DMASR = ETH_DMASR_TUS;
|
||||
|
||||
/* Resume DMA transmission*/
|
||||
EthHandle.Instance->DMATPDR = 0;
|
||||
}
|
||||
|
||||
sys_mutex_unlock(&tx_lock_mutex);
|
||||
|
||||
return errval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Should allocate a pbuf and transfer the bytes of the incoming
|
||||
* packet from the interface into the pbuf.
|
||||
*
|
||||
* @param netif the lwip network interface structure for this ethernetif
|
||||
* @return a pbuf filled with the received packet (including MAC header)
|
||||
* NULL on memory error
|
||||
*/
|
||||
static struct pbuf * _eth_arch_low_level_input(struct netif *netif)
|
||||
{
|
||||
struct pbuf *p = NULL;
|
||||
struct pbuf *q;
|
||||
uint16_t len = 0;
|
||||
uint8_t *buffer;
|
||||
__IO ETH_DMADescTypeDef *dmarxdesc;
|
||||
uint32_t bufferoffset = 0;
|
||||
uint32_t payloadoffset = 0;
|
||||
uint32_t byteslefttocopy = 0;
|
||||
uint32_t i = 0;
|
||||
|
||||
|
||||
/* get received frame */
|
||||
if (HAL_ETH_GetReceivedFrame(&EthHandle) != HAL_OK)
|
||||
return NULL;
|
||||
|
||||
/* Obtain the size of the packet and put it into the "len" variable. */
|
||||
len = EthHandle.RxFrameInfos.length;
|
||||
buffer = (uint8_t*)EthHandle.RxFrameInfos.buffer;
|
||||
|
||||
if (len > 0) {
|
||||
/* We allocate a pbuf chain of pbufs from the Lwip buffer pool */
|
||||
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
|
||||
}
|
||||
|
||||
if (p != NULL) {
|
||||
dmarxdesc = EthHandle.RxFrameInfos.FSRxDesc;
|
||||
bufferoffset = 0;
|
||||
for (q = p; q != NULL; q = q->next) {
|
||||
byteslefttocopy = q->len;
|
||||
payloadoffset = 0;
|
||||
|
||||
/* Check if the length of bytes to copy in current pbuf is bigger than Rx buffer size*/
|
||||
while ((byteslefttocopy + bufferoffset) > ETH_RX_BUF_SIZE) {
|
||||
/* Copy data to pbuf */
|
||||
memcpy((uint8_t*)((uint8_t*)q->payload + payloadoffset), (uint8_t*)((uint8_t*)buffer + bufferoffset), (ETH_RX_BUF_SIZE - bufferoffset));
|
||||
|
||||
/* Point to next descriptor */
|
||||
dmarxdesc = (ETH_DMADescTypeDef*)(dmarxdesc->Buffer2NextDescAddr);
|
||||
buffer = (uint8_t*)(dmarxdesc->Buffer1Addr);
|
||||
|
||||
byteslefttocopy = byteslefttocopy - (ETH_RX_BUF_SIZE - bufferoffset);
|
||||
payloadoffset = payloadoffset + (ETH_RX_BUF_SIZE - bufferoffset);
|
||||
bufferoffset = 0;
|
||||
}
|
||||
/* Copy remaining data in pbuf */
|
||||
memcpy((uint8_t*)((uint8_t*)q->payload + payloadoffset), (uint8_t*)((uint8_t*)buffer + bufferoffset), byteslefttocopy);
|
||||
bufferoffset = bufferoffset + byteslefttocopy;
|
||||
}
|
||||
|
||||
/* Release descriptors to DMA */
|
||||
/* Point to first descriptor */
|
||||
dmarxdesc = EthHandle.RxFrameInfos.FSRxDesc;
|
||||
/* Set Own bit in Rx descriptors: gives the buffers back to DMA */
|
||||
for (i = 0; i < EthHandle.RxFrameInfos.SegCount; i++) {
|
||||
dmarxdesc->Status |= ETH_DMARXDESC_OWN;
|
||||
dmarxdesc = (ETH_DMADescTypeDef*)(dmarxdesc->Buffer2NextDescAddr);
|
||||
}
|
||||
|
||||
/* Clear Segment_Count */
|
||||
EthHandle.RxFrameInfos.SegCount = 0;
|
||||
}
|
||||
|
||||
/* When Rx Buffer unavailable flag is set: clear it and resume reception */
|
||||
if ((EthHandle.Instance->DMASR & ETH_DMASR_RBUS) != (uint32_t)RESET) {
|
||||
/* Clear RBUS ETHERNET DMA flag */
|
||||
EthHandle.Instance->DMASR = ETH_DMASR_RBUS;
|
||||
/* Resume DMA reception */
|
||||
EthHandle.Instance->DMARPDR = 0;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* This task receives input data
|
||||
*
|
||||
* \param[in] netif the lwip network interface structure
|
||||
*/
|
||||
static void _eth_arch_rx_task(void *arg)
|
||||
{
|
||||
struct netif *netif = (struct netif*)arg;
|
||||
struct pbuf *p;
|
||||
|
||||
while (1) {
|
||||
sys_arch_sem_wait(&rx_ready_sem, 0);
|
||||
p = _eth_arch_low_level_input(netif);
|
||||
if (p != NULL) {
|
||||
if (netif->input(p, netif) != ERR_OK) {
|
||||
pbuf_free(p);
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This task checks phy link status and updates net status
|
||||
*
|
||||
* \param[in] netif the lwip network interface structure
|
||||
*/
|
||||
static void _eth_arch_phy_task(void *arg)
|
||||
{
|
||||
struct netif *netif = (struct netif*)arg;
|
||||
uint32_t phy_status = 0;
|
||||
|
||||
while (1) {
|
||||
uint32_t status;
|
||||
if (HAL_ETH_ReadPHYRegister(&EthHandle, PHY_SR, &status) == HAL_OK) {
|
||||
if ((status & PHY_LINK_STATUS) && !(phy_status & PHY_LINK_STATUS)) {
|
||||
tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_up, (void*) netif, 1);
|
||||
} else if (!(status & PHY_LINK_STATUS) && (phy_status & PHY_LINK_STATUS)) {
|
||||
tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_down, (void*) netif, 1);
|
||||
}
|
||||
phy_status = status;
|
||||
}
|
||||
osDelay(PHY_TASK_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is the ethernet packet send function. It calls
|
||||
* etharp_output after checking link status.
|
||||
*
|
||||
* \param[in] netif the lwip network interface structure for this lpc_enetif
|
||||
* \param[in] q Pointer to pbug to send
|
||||
* \param[in] ipaddr IP address
|
||||
* \return ERR_OK or error code
|
||||
*/
|
||||
static err_t _eth_arch_netif_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
|
||||
{
|
||||
/* Only send packet is link is up */
|
||||
if (netif->flags & NETIF_FLAG_LINK_UP) {
|
||||
return etharp_output(netif, q, ipaddr);
|
||||
}
|
||||
return ERR_CONN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called at the beginning of the program to set up the
|
||||
* network interface.
|
||||
*
|
||||
* This function should be passed as a parameter to netif_add().
|
||||
*
|
||||
* @param[in] netif the lwip network interface structure for this lpc_enetif
|
||||
* @return ERR_OK if the loopif is initialized
|
||||
* ERR_MEM if private data couldn't be allocated
|
||||
* any other err_t on error
|
||||
*/
|
||||
err_t eth_arch_enetif_init(struct netif *netif)
|
||||
{
|
||||
/* set MAC hardware address */
|
||||
netif->hwaddr_len = ETHARP_HWADDR_LEN;
|
||||
|
||||
/* maximum transfer unit */
|
||||
netif->mtu = 1500;
|
||||
|
||||
/* device capabilities */
|
||||
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET | NETIF_FLAG_IGMP;
|
||||
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
/* Initialize interface hostname */
|
||||
netif->hostname = "lwipstm32";
|
||||
#endif /* LWIP_NETIF_HOSTNAME */
|
||||
|
||||
netif->name[0] = 'e';
|
||||
netif->name[1] = 'n';
|
||||
|
||||
netif->output = _eth_arch_netif_output;
|
||||
netif->linkoutput = _eth_arch_low_level_output;
|
||||
|
||||
/* semaphore */
|
||||
sys_sem_new(&rx_ready_sem, 0);
|
||||
|
||||
sys_mutex_new(&tx_lock_mutex);
|
||||
|
||||
/* task */
|
||||
sys_thread_new("_eth_arch_rx_task", _eth_arch_rx_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI);
|
||||
sys_thread_new("_eth_arch_phy_task", _eth_arch_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI);
|
||||
|
||||
/* initialize the hardware */
|
||||
_eth_arch_low_level_init(netif);
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void eth_arch_enable_interrupts(void)
|
||||
{
|
||||
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
|
||||
HAL_NVIC_EnableIRQ(ETH_IRQn);
|
||||
}
|
||||
|
||||
void eth_arch_disable_interrupts(void)
|
||||
{
|
||||
NVIC_DisableIRQ(ETH_IRQn);
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
#include <string.h>
|
||||
#include "stm32f4xx_hal.h"
|
||||
#include "toolchain.h"
|
||||
|
||||
#define C029_OTP_START_ADDRESS (0x1FFF7800U)
|
||||
#define C029_OTP_END_ADDRESS (C029_OTP_START_ADDRESS + (16*32))
|
||||
#define C029_MAC_ETHERNET_ID (3)
|
||||
|
||||
typedef MBED_PACKED(struct) C029_OTP_Header {
|
||||
uint8_t id;
|
||||
uint8_t len;
|
||||
uint8_t data[];
|
||||
} C029_OTP_Header;
|
||||
|
||||
static int _macRetrieved = 0;
|
||||
static char _macAddr[6] = { 0x02, 0x02, 0xF7, 0xF0, 0x00, 0x00 };
|
||||
|
||||
static C029_OTP_Header *increment(C029_OTP_Header *pTemp)
|
||||
{
|
||||
uint8_t len = 0;
|
||||
uint8_t id = 0;
|
||||
uint8_t *p = (uint8_t*)pTemp;
|
||||
|
||||
memcpy((void*)&id, (void*)pTemp, 1);
|
||||
|
||||
if (id == 0xFF){
|
||||
p++;
|
||||
}
|
||||
else {
|
||||
p++;
|
||||
memcpy((void*)&len, (void*)p++, 1);
|
||||
p += len;
|
||||
}
|
||||
return (C029_OTP_Header*)p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override HAL Eth Init function
|
||||
*/
|
||||
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
if (heth->Instance == ETH) {
|
||||
|
||||
/* Enable GPIOs clocks */
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
|
||||
/** ETH GPIO Configuration
|
||||
RMII_REF_CLK ----------------------> PA1
|
||||
RMII_MDIO -------------------------> PA2
|
||||
RMII_MDC --------------------------> PC1
|
||||
RMII_MII_CRS_DV -------------------> PA7
|
||||
RMII_MII_RXD0 ---------------------> PC4
|
||||
RMII_MII_RXD1 ---------------------> PC5
|
||||
RMII_MII_RXER ---------------------> PG2
|
||||
RMII_MII_TX_EN --------------------> PB11
|
||||
RMII_MII_TXD0 ---------------------> PB12
|
||||
RMII_MII_TXD1 ---------------------> PB13
|
||||
*/
|
||||
/* Configure PA1, PA2 and PA7 */
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStructure.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_2 | GPIO_PIN_7;
|
||||
GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_1;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
/* Configure PB13 */
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_13 | GPIO_PIN_11 | GPIO_PIN_12;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
|
||||
/* Configure PC1, PC4 and PC5 */
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
|
||||
|
||||
/* Enable the Ethernet global Interrupt */
|
||||
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
|
||||
HAL_NVIC_EnableIRQ(ETH_IRQn);
|
||||
|
||||
/* Enable ETHERNET clock */
|
||||
__HAL_RCC_ETH_CLK_ENABLE();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override HAL Eth DeInit function
|
||||
*/
|
||||
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
|
||||
{
|
||||
if (heth->Instance == ETH) {
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_ETH_CLK_DISABLE();
|
||||
|
||||
/** ETH GPIO Configuration
|
||||
RMII_REF_CLK ----------------------> PA1
|
||||
RMII_MDIO -------------------------> PA2
|
||||
RMII_MDC --------------------------> PC1
|
||||
RMII_MII_CRS_DV -------------------> PA7
|
||||
RMII_MII_RXD0 ---------------------> PC4
|
||||
RMII_MII_RXD1 ---------------------> PC5
|
||||
RMII_MII_RXER ---------------------> PG2
|
||||
RMII_MII_TX_EN --------------------> PB11
|
||||
RMII_MII_TXD0 ---------------------> PB12
|
||||
RMII_MII_TXD1 ---------------------> PB13
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7);
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13 | GPIO_PIN_11 | GPIO_PIN_12);
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5);
|
||||
|
||||
/* Disable the Ethernet global Interrupt */
|
||||
NVIC_DisableIRQ(ETH_IRQn);
|
||||
}
|
||||
}
|
||||
|
||||
void mbed_mac_address(char *mac)
|
||||
{
|
||||
C029_OTP_Header *pFound = NULL;
|
||||
C029_OTP_Header *pTemp = (C029_OTP_Header*)C029_OTP_START_ADDRESS;
|
||||
C029_OTP_Header temp;
|
||||
|
||||
if (_macRetrieved == 0) {
|
||||
while ((pTemp >= (C029_OTP_Header*)C029_OTP_START_ADDRESS) && (pTemp < (C029_OTP_Header*)C029_OTP_END_ADDRESS)){
|
||||
memcpy((void*)&temp, (void*)pTemp, sizeof(temp));
|
||||
if (temp.id == C029_MAC_ETHERNET_ID){
|
||||
pFound = pTemp;
|
||||
break;
|
||||
}
|
||||
pTemp = increment(pTemp);
|
||||
}
|
||||
if (pFound != NULL) {
|
||||
memcpy(_macAddr, pFound->data, 6);
|
||||
_macRetrieved = 1;
|
||||
}
|
||||
}
|
||||
memcpy(mac, _macAddr, 6);
|
||||
}
|
|
@ -1,452 +0,0 @@
|
|||
#include "stm32f7xx_hal.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/timers.h"
|
||||
#include "netif/etharp.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include <string.h>
|
||||
#include "cmsis_os.h"
|
||||
#include "mbed_interface.h"
|
||||
|
||||
#define RECV_TASK_PRI (osPriorityHigh)
|
||||
#define PHY_TASK_PRI (osPriorityLow)
|
||||
#define PHY_TASK_WAIT (200)
|
||||
#define ETH_ARCH_PHY_ADDRESS (0x00)
|
||||
|
||||
ETH_HandleTypeDef EthHandle;
|
||||
|
||||
#if defined (__ICCARM__) /*!< IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
__ALIGN_BEGIN ETH_DMADescTypeDef DMARxDscrTab[ETH_RXBUFNB] __ALIGN_END; /* Ethernet Rx DMA Descriptor */
|
||||
|
||||
#if defined (__ICCARM__) /*!< IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
__ALIGN_BEGIN ETH_DMADescTypeDef DMATxDscrTab[ETH_TXBUFNB] __ALIGN_END; /* Ethernet Tx DMA Descriptor */
|
||||
|
||||
#if defined (__ICCARM__) /*!< IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
__ALIGN_BEGIN uint8_t Rx_Buff[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __ALIGN_END; /* Ethernet Receive Buffer */
|
||||
|
||||
#if defined (__ICCARM__) /*!< IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
__ALIGN_BEGIN uint8_t Tx_Buff[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __ALIGN_END; /* Ethernet Transmit Buffer */
|
||||
|
||||
static sys_sem_t rx_ready_sem; /* receive ready semaphore */
|
||||
static sys_mutex_t tx_lock_mutex;
|
||||
|
||||
/* function */
|
||||
static void _eth_arch_rx_task(void *arg);
|
||||
static void _eth_arch_phy_task(void *arg);
|
||||
static err_t _eth_arch_netif_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr);
|
||||
static err_t _eth_arch_low_level_output(struct netif *netif, struct pbuf *p);
|
||||
static struct pbuf * _eth_arch_low_level_input(struct netif *netif);
|
||||
|
||||
/**
|
||||
* Ethernet Rx Transfer completed callback
|
||||
*
|
||||
* @param heth: ETH handle
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *heth)
|
||||
{
|
||||
sys_sem_signal(&rx_ready_sem);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ethernet IRQ Handler
|
||||
*
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void ETH_IRQHandler(void)
|
||||
{
|
||||
HAL_ETH_IRQHandler(&EthHandle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* In this function, the hardware should be initialized.
|
||||
* Called from eth_arch_enetif_init().
|
||||
*
|
||||
* @param netif the already initialized lwip network interface structure
|
||||
* for this ethernetif
|
||||
*/
|
||||
static void _eth_arch_low_level_init(struct netif *netif)
|
||||
{
|
||||
uint32_t regvalue = 0;
|
||||
HAL_StatusTypeDef hal_eth_init_status;
|
||||
|
||||
/* Init ETH */
|
||||
uint8_t MACAddr[6];
|
||||
EthHandle.Instance = ETH;
|
||||
EthHandle.Init.AutoNegotiation = ETH_AUTONEGOTIATION_ENABLE;
|
||||
EthHandle.Init.Speed = ETH_SPEED_100M;
|
||||
EthHandle.Init.DuplexMode = ETH_MODE_FULLDUPLEX;
|
||||
EthHandle.Init.PhyAddress = ETH_ARCH_PHY_ADDRESS;
|
||||
#if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
|
||||
MACAddr[0] = MBED_MAC_ADDR_0;
|
||||
MACAddr[1] = MBED_MAC_ADDR_1;
|
||||
MACAddr[2] = MBED_MAC_ADDR_2;
|
||||
MACAddr[3] = MBED_MAC_ADDR_3;
|
||||
MACAddr[4] = MBED_MAC_ADDR_4;
|
||||
MACAddr[5] = MBED_MAC_ADDR_5;
|
||||
#else
|
||||
mbed_mac_address((char *)MACAddr);
|
||||
#endif
|
||||
EthHandle.Init.MACAddr = &MACAddr[0];
|
||||
EthHandle.Init.RxMode = ETH_RXINTERRUPT_MODE;
|
||||
EthHandle.Init.ChecksumMode = ETH_CHECKSUM_BY_HARDWARE;
|
||||
EthHandle.Init.MediaInterface = ETH_MEDIA_INTERFACE_RMII;
|
||||
hal_eth_init_status = HAL_ETH_Init(&EthHandle);
|
||||
|
||||
/* Initialize Tx Descriptors list: Chain Mode */
|
||||
HAL_ETH_DMATxDescListInit(&EthHandle, DMATxDscrTab, &Tx_Buff[0][0], ETH_TXBUFNB);
|
||||
|
||||
/* Initialize Rx Descriptors list: Chain Mode */
|
||||
HAL_ETH_DMARxDescListInit(&EthHandle, DMARxDscrTab, &Rx_Buff[0][0], ETH_RXBUFNB);
|
||||
|
||||
#if LWIP_ARP || LWIP_ETHERNET
|
||||
/* set MAC hardware address length */
|
||||
netif->hwaddr_len = ETHARP_HWADDR_LEN;
|
||||
|
||||
/* set MAC hardware address */
|
||||
netif->hwaddr[0] = EthHandle.Init.MACAddr[0];
|
||||
netif->hwaddr[1] = EthHandle.Init.MACAddr[1];
|
||||
netif->hwaddr[2] = EthHandle.Init.MACAddr[2];
|
||||
netif->hwaddr[3] = EthHandle.Init.MACAddr[3];
|
||||
netif->hwaddr[4] = EthHandle.Init.MACAddr[4];
|
||||
netif->hwaddr[5] = EthHandle.Init.MACAddr[5];
|
||||
|
||||
/* maximum transfer unit */
|
||||
netif->mtu = 1500;
|
||||
|
||||
/* device capabilities */
|
||||
/* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */
|
||||
netif->flags |= NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP;
|
||||
|
||||
/* Enable MAC and DMA transmission and reception */
|
||||
HAL_ETH_Start(&EthHandle);
|
||||
|
||||
/**** Configure PHY to generate an interrupt when Eth Link state changes ****/
|
||||
/* Read Register Configuration */
|
||||
HAL_ETH_ReadPHYRegister(&EthHandle, PHY_MICR, ®value);
|
||||
|
||||
regvalue |= (PHY_MICR_INT_EN | PHY_MICR_INT_OE);
|
||||
|
||||
/* Enable Interrupts */
|
||||
HAL_ETH_WritePHYRegister(&EthHandle, PHY_MICR, regvalue);
|
||||
|
||||
/* Read Register Configuration */
|
||||
HAL_ETH_ReadPHYRegister(&EthHandle, PHY_MISR, ®value);
|
||||
|
||||
regvalue |= PHY_MISR_LINK_INT_EN;
|
||||
|
||||
/* Enable Interrupt on change of link status */
|
||||
HAL_ETH_WritePHYRegister(&EthHandle, PHY_MISR, regvalue);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* This function should do the actual transmission of the packet. The packet is
|
||||
* contained in the pbuf that is passed to the function. This pbuf
|
||||
* might be chained.
|
||||
*
|
||||
* @param netif the lwip network interface structure for this ethernetif
|
||||
* @param p the MAC packet to send (e.g. IP packet including MAC addresses and type)
|
||||
* @return ERR_OK if the packet could be sent
|
||||
* an err_t value if the packet couldn't be sent
|
||||
*
|
||||
* @note Returning ERR_MEM here if a DMA queue of your MAC is full can lead to
|
||||
* strange results. You might consider waiting for space in the DMA queue
|
||||
* to become availale since the stack doesn't retry to send a packet
|
||||
* dropped because of memory failure (except for the TCP timers).
|
||||
*/
|
||||
|
||||
static err_t _eth_arch_low_level_output(struct netif *netif, struct pbuf *p)
|
||||
{
|
||||
err_t errval;
|
||||
struct pbuf *q;
|
||||
uint8_t *buffer = (uint8_t*)(EthHandle.TxDesc->Buffer1Addr);
|
||||
__IO ETH_DMADescTypeDef *DmaTxDesc;
|
||||
uint32_t framelength = 0;
|
||||
uint32_t bufferoffset = 0;
|
||||
uint32_t byteslefttocopy = 0;
|
||||
uint32_t payloadoffset = 0;
|
||||
DmaTxDesc = EthHandle.TxDesc;
|
||||
bufferoffset = 0;
|
||||
|
||||
|
||||
sys_mutex_lock(&tx_lock_mutex);
|
||||
|
||||
/* copy frame from pbufs to driver buffers */
|
||||
for (q = p; q != NULL; q = q->next) {
|
||||
/* Is this buffer available? If not, goto error */
|
||||
if ((DmaTxDesc->Status & ETH_DMATXDESC_OWN) != (uint32_t)RESET) {
|
||||
errval = ERR_USE;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Get bytes in current lwIP buffer */
|
||||
byteslefttocopy = q->len;
|
||||
payloadoffset = 0;
|
||||
|
||||
/* Check if the length of data to copy is bigger than Tx buffer size*/
|
||||
while ((byteslefttocopy + bufferoffset) > ETH_TX_BUF_SIZE) {
|
||||
/* Copy data to Tx buffer*/
|
||||
memcpy((uint8_t*)((uint8_t*)buffer + bufferoffset), (uint8_t*)((uint8_t*)q->payload + payloadoffset), (ETH_TX_BUF_SIZE - bufferoffset));
|
||||
|
||||
/* Point to next descriptor */
|
||||
DmaTxDesc = (ETH_DMADescTypeDef*)(DmaTxDesc->Buffer2NextDescAddr);
|
||||
|
||||
/* Check if the buffer is available */
|
||||
if ((DmaTxDesc->Status & ETH_DMATXDESC_OWN) != (uint32_t)RESET) {
|
||||
errval = ERR_USE;
|
||||
goto error;
|
||||
}
|
||||
|
||||
buffer = (uint8_t*)(DmaTxDesc->Buffer1Addr);
|
||||
|
||||
byteslefttocopy = byteslefttocopy - (ETH_TX_BUF_SIZE - bufferoffset);
|
||||
payloadoffset = payloadoffset + (ETH_TX_BUF_SIZE - bufferoffset);
|
||||
framelength = framelength + (ETH_TX_BUF_SIZE - bufferoffset);
|
||||
bufferoffset = 0;
|
||||
}
|
||||
|
||||
/* Copy the remaining bytes */
|
||||
memcpy((uint8_t*)((uint8_t*)buffer + bufferoffset), (uint8_t*)((uint8_t*)q->payload + payloadoffset), byteslefttocopy);
|
||||
bufferoffset = bufferoffset + byteslefttocopy;
|
||||
framelength = framelength + byteslefttocopy;
|
||||
}
|
||||
|
||||
/* Prepare transmit descriptors to give to DMA */
|
||||
HAL_ETH_TransmitFrame(&EthHandle, framelength);
|
||||
|
||||
errval = ERR_OK;
|
||||
|
||||
error:
|
||||
|
||||
/* When Transmit Underflow flag is set, clear it and issue a Transmit Poll Demand to resume transmission */
|
||||
if ((EthHandle.Instance->DMASR & ETH_DMASR_TUS) != (uint32_t)RESET) {
|
||||
/* Clear TUS ETHERNET DMA flag */
|
||||
EthHandle.Instance->DMASR = ETH_DMASR_TUS;
|
||||
|
||||
/* Resume DMA transmission*/
|
||||
EthHandle.Instance->DMATPDR = 0;
|
||||
}
|
||||
|
||||
sys_mutex_unlock(&tx_lock_mutex);
|
||||
|
||||
return errval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Should allocate a pbuf and transfer the bytes of the incoming
|
||||
* packet from the interface into the pbuf.
|
||||
*
|
||||
* @param netif the lwip network interface structure for this ethernetif
|
||||
* @return a pbuf filled with the received packet (including MAC header)
|
||||
* NULL on memory error
|
||||
*/
|
||||
static struct pbuf * _eth_arch_low_level_input(struct netif *netif)
|
||||
{
|
||||
struct pbuf *p = NULL;
|
||||
struct pbuf *q;
|
||||
uint16_t len = 0;
|
||||
uint8_t *buffer;
|
||||
__IO ETH_DMADescTypeDef *dmarxdesc;
|
||||
uint32_t bufferoffset = 0;
|
||||
uint32_t payloadoffset = 0;
|
||||
uint32_t byteslefttocopy = 0;
|
||||
uint32_t i = 0;
|
||||
|
||||
|
||||
/* get received frame */
|
||||
if (HAL_ETH_GetReceivedFrame(&EthHandle) != HAL_OK)
|
||||
return NULL;
|
||||
|
||||
/* Obtain the size of the packet and put it into the "len" variable. */
|
||||
len = EthHandle.RxFrameInfos.length;
|
||||
buffer = (uint8_t*)EthHandle.RxFrameInfos.buffer;
|
||||
|
||||
if (len > 0) {
|
||||
/* We allocate a pbuf chain of pbufs from the Lwip buffer pool */
|
||||
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
|
||||
}
|
||||
|
||||
if (p != NULL) {
|
||||
dmarxdesc = EthHandle.RxFrameInfos.FSRxDesc;
|
||||
bufferoffset = 0;
|
||||
for (q = p; q != NULL; q = q->next) {
|
||||
byteslefttocopy = q->len;
|
||||
payloadoffset = 0;
|
||||
|
||||
/* Check if the length of bytes to copy in current pbuf is bigger than Rx buffer size*/
|
||||
while ((byteslefttocopy + bufferoffset) > ETH_RX_BUF_SIZE) {
|
||||
/* Copy data to pbuf */
|
||||
memcpy((uint8_t*)((uint8_t*)q->payload + payloadoffset), (uint8_t*)((uint8_t*)buffer + bufferoffset), (ETH_RX_BUF_SIZE - bufferoffset));
|
||||
|
||||
/* Point to next descriptor */
|
||||
dmarxdesc = (ETH_DMADescTypeDef*)(dmarxdesc->Buffer2NextDescAddr);
|
||||
buffer = (uint8_t*)(dmarxdesc->Buffer1Addr);
|
||||
|
||||
byteslefttocopy = byteslefttocopy - (ETH_RX_BUF_SIZE - bufferoffset);
|
||||
payloadoffset = payloadoffset + (ETH_RX_BUF_SIZE - bufferoffset);
|
||||
bufferoffset = 0;
|
||||
}
|
||||
/* Copy remaining data in pbuf */
|
||||
memcpy((uint8_t*)((uint8_t*)q->payload + payloadoffset), (uint8_t*)((uint8_t*)buffer + bufferoffset), byteslefttocopy);
|
||||
bufferoffset = bufferoffset + byteslefttocopy;
|
||||
}
|
||||
|
||||
/* Release descriptors to DMA */
|
||||
/* Point to first descriptor */
|
||||
dmarxdesc = EthHandle.RxFrameInfos.FSRxDesc;
|
||||
/* Set Own bit in Rx descriptors: gives the buffers back to DMA */
|
||||
for (i = 0; i < EthHandle.RxFrameInfos.SegCount; i++) {
|
||||
dmarxdesc->Status |= ETH_DMARXDESC_OWN;
|
||||
dmarxdesc = (ETH_DMADescTypeDef*)(dmarxdesc->Buffer2NextDescAddr);
|
||||
}
|
||||
|
||||
/* Clear Segment_Count */
|
||||
EthHandle.RxFrameInfos.SegCount = 0;
|
||||
}
|
||||
|
||||
/* When Rx Buffer unavailable flag is set: clear it and resume reception */
|
||||
if ((EthHandle.Instance->DMASR & ETH_DMASR_RBUS) != (uint32_t)RESET) {
|
||||
/* Clear RBUS ETHERNET DMA flag */
|
||||
EthHandle.Instance->DMASR = ETH_DMASR_RBUS;
|
||||
/* Resume DMA reception */
|
||||
EthHandle.Instance->DMARPDR = 0;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* This task receives input data
|
||||
*
|
||||
* \param[in] netif the lwip network interface structure
|
||||
*/
|
||||
static void _eth_arch_rx_task(void *arg)
|
||||
{
|
||||
struct netif *netif = (struct netif*)arg;
|
||||
struct pbuf *p;
|
||||
|
||||
while (1) {
|
||||
sys_arch_sem_wait(&rx_ready_sem, 0);
|
||||
p = _eth_arch_low_level_input(netif);
|
||||
if (p != NULL) {
|
||||
if (netif->input(p, netif) != ERR_OK) {
|
||||
pbuf_free(p);
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This task checks phy link status and updates net status
|
||||
*
|
||||
* \param[in] netif the lwip network interface structure
|
||||
*/
|
||||
static void _eth_arch_phy_task(void *arg)
|
||||
{
|
||||
struct netif *netif = (struct netif*)arg;
|
||||
uint32_t phy_status = 0;
|
||||
|
||||
while (1) {
|
||||
uint32_t status;
|
||||
if (HAL_ETH_ReadPHYRegister(&EthHandle, PHY_SR, &status) == HAL_OK) {
|
||||
if ((status & PHY_LINK_STATUS) && !(phy_status & PHY_LINK_STATUS)) {
|
||||
tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_up, (void*) netif, 1);
|
||||
} else if (!(status & PHY_LINK_STATUS) && (phy_status & PHY_LINK_STATUS)) {
|
||||
tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_down, (void*) netif, 1);
|
||||
}
|
||||
phy_status = status;
|
||||
}
|
||||
osDelay(PHY_TASK_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is the ethernet packet send function. It calls
|
||||
* etharp_output after checking link status.
|
||||
*
|
||||
* \param[in] netif the lwip network interface structure for this lpc_enetif
|
||||
* \param[in] q Pointer to pbug to send
|
||||
* \param[in] ipaddr IP address
|
||||
* \return ERR_OK or error code
|
||||
*/
|
||||
static err_t _eth_arch_netif_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
|
||||
{
|
||||
/* Only send packet is link is up */
|
||||
if (netif->flags & NETIF_FLAG_LINK_UP) {
|
||||
return etharp_output(netif, q, ipaddr);
|
||||
}
|
||||
return ERR_CONN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called at the beginning of the program to set up the
|
||||
* network interface.
|
||||
*
|
||||
* This function should be passed as a parameter to netif_add().
|
||||
*
|
||||
* @param[in] netif the lwip network interface structure for this lpc_enetif
|
||||
* @return ERR_OK if the loopif is initialized
|
||||
* ERR_MEM if private data couldn't be allocated
|
||||
* any other err_t on error
|
||||
*/
|
||||
err_t eth_arch_enetif_init(struct netif *netif)
|
||||
{
|
||||
/* set MAC hardware address */
|
||||
netif->hwaddr_len = ETHARP_HWADDR_LEN;
|
||||
|
||||
/* maximum transfer unit */
|
||||
netif->mtu = 1500;
|
||||
|
||||
/* device capabilities */
|
||||
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET | NETIF_FLAG_IGMP;
|
||||
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
/* Initialize interface hostname */
|
||||
netif->hostname = "lwipstm32";
|
||||
#endif /* LWIP_NETIF_HOSTNAME */
|
||||
|
||||
netif->name[0] = 'e';
|
||||
netif->name[1] = 'n';
|
||||
|
||||
netif->output = _eth_arch_netif_output;
|
||||
netif->linkoutput = _eth_arch_low_level_output;
|
||||
|
||||
/* semaphore */
|
||||
sys_sem_new(&rx_ready_sem, 0);
|
||||
|
||||
sys_mutex_new(&tx_lock_mutex);
|
||||
|
||||
/* task */
|
||||
sys_thread_new("_eth_arch_rx_task", _eth_arch_rx_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI);
|
||||
sys_thread_new("_eth_arch_phy_task", _eth_arch_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI);
|
||||
|
||||
/* initialize the hardware */
|
||||
_eth_arch_low_level_init(netif);
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void eth_arch_enable_interrupts(void)
|
||||
{
|
||||
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
|
||||
HAL_NVIC_EnableIRQ(ETH_IRQn);
|
||||
}
|
||||
|
||||
void eth_arch_disable_interrupts(void)
|
||||
{
|
||||
NVIC_DisableIRQ(ETH_IRQn);
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
#include "stm32f4xx_hal.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/timers.h"
|
||||
|
@ -26,7 +25,7 @@ __ALIGN_BEGIN ETH_DMADescTypeDef DMARxDscrTab[ETH_RXBUFNB] __ALIGN_END; /* Ether
|
|||
__ALIGN_BEGIN ETH_DMADescTypeDef DMATxDscrTab[ETH_TXBUFNB] __ALIGN_END; /* Ethernet Tx DMA Descriptor */
|
||||
|
||||
#if defined (__ICCARM__) /*!< IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
__ALIGN_BEGIN uint8_t Rx_Buff[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __ALIGN_END; /* Ethernet Receive Buffer */
|
||||
|
||||
|
@ -132,23 +131,6 @@ static void _eth_arch_low_level_init(struct netif *netif)
|
|||
|
||||
/* Enable MAC and DMA transmission and reception */
|
||||
HAL_ETH_Start(&EthHandle);
|
||||
|
||||
/**** Configure PHY to generate an interrupt when Eth Link state changes ****/
|
||||
/* Read Register Configuration */
|
||||
HAL_ETH_ReadPHYRegister(&EthHandle, PHY_MICR, ®value);
|
||||
|
||||
regvalue |= (PHY_MICR_INT_EN | PHY_MICR_INT_OE);
|
||||
|
||||
/* Enable Interrupts */
|
||||
HAL_ETH_WritePHYRegister(&EthHandle, PHY_MICR, regvalue);
|
||||
|
||||
/* Read Register Configuration */
|
||||
HAL_ETH_ReadPHYRegister(&EthHandle, PHY_MISR, ®value);
|
||||
|
||||
regvalue |= PHY_MISR_LINK_INT_EN;
|
||||
|
||||
/* Enable Interrupt on change of link status */
|
||||
HAL_ETH_WritePHYRegister(&EthHandle, PHY_MISR, regvalue);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -180,8 +162,7 @@ static err_t _eth_arch_low_level_output(struct netif *netif, struct pbuf *p)
|
|||
uint32_t payloadoffset = 0;
|
||||
DmaTxDesc = EthHandle.TxDesc;
|
||||
bufferoffset = 0;
|
||||
|
||||
|
||||
|
||||
sys_mutex_lock(&tx_lock_mutex);
|
||||
|
||||
/* copy frame from pbufs to driver buffers */
|
||||
|
@ -239,9 +220,9 @@ error:
|
|||
/* Resume DMA transmission*/
|
||||
EthHandle.Instance->DMATPDR = 0;
|
||||
}
|
||||
|
||||
|
||||
sys_mutex_unlock(&tx_lock_mutex);
|
||||
|
||||
|
||||
return errval;
|
||||
}
|
||||
|
||||
|
@ -345,7 +326,7 @@ static void _eth_arch_rx_task(void *arg)
|
|||
if (netif->input(p, netif) != ERR_OK) {
|
||||
pbuf_free(p);
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -359,13 +340,13 @@ static void _eth_arch_phy_task(void *arg)
|
|||
{
|
||||
struct netif *netif = (struct netif*)arg;
|
||||
uint32_t phy_status = 0;
|
||||
|
||||
|
||||
while (1) {
|
||||
uint32_t status;
|
||||
if (HAL_ETH_ReadPHYRegister(&EthHandle, PHY_SR, &status) == HAL_OK) {
|
||||
if ((status & PHY_LINK_STATUS) && !(phy_status & PHY_LINK_STATUS)) {
|
||||
if (HAL_ETH_ReadPHYRegister(&EthHandle, PHY_BSR, &status) == HAL_OK) {
|
||||
if ((status & PHY_LINKED_STATUS) && !(phy_status & PHY_LINKED_STATUS)) {
|
||||
tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_up, (void*) netif, 1);
|
||||
} else if (!(status & PHY_LINK_STATUS) && (phy_status & PHY_LINK_STATUS)) {
|
||||
} else if (!(status & PHY_LINKED_STATUS) && (phy_status & PHY_LINKED_STATUS)) {
|
||||
tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_down, (void*) netif, 1);
|
||||
}
|
||||
phy_status = status;
|
||||
|
@ -427,16 +408,16 @@ err_t eth_arch_enetif_init(struct netif *netif)
|
|||
|
||||
/* semaphore */
|
||||
sys_sem_new(&rx_ready_sem, 0);
|
||||
|
||||
|
||||
sys_mutex_new(&tx_lock_mutex);
|
||||
|
||||
/* task */
|
||||
sys_thread_new("_eth_arch_rx_task", _eth_arch_rx_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI);
|
||||
sys_thread_new("_eth_arch_phy_task", _eth_arch_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI);
|
||||
|
||||
|
||||
/* initialize the hardware */
|
||||
_eth_arch_low_level_init(netif);
|
||||
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
|
@ -145,6 +145,11 @@ const char *lwip_get_ip_address(void)
|
|||
int lwip_bringup(void)
|
||||
{
|
||||
// Check if we've already connected
|
||||
if (lwip_get_ip_address()) {
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
|
||||
// Check if we've already brought up lwip
|
||||
if (!lwip_get_mac_address()) {
|
||||
// Set up network
|
||||
lwip_set_mac_address();
|
||||
|
@ -181,12 +186,19 @@ int lwip_bringup(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void lwip_bringdown(void)
|
||||
int lwip_bringdown(void)
|
||||
{
|
||||
// Check if we've connected
|
||||
if (!lwip_get_ip_address()) {
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
|
||||
// Disconnect from the network
|
||||
dhcp_release(&lwip_netif);
|
||||
dhcp_stop(&lwip_netif);
|
||||
lwip_ip_addr[0] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,11 +206,12 @@ void lwip_bringdown(void)
|
|||
static int lwip_err_remap(err_t err) {
|
||||
switch (err) {
|
||||
case ERR_OK:
|
||||
case ERR_CLSD:
|
||||
case ERR_RST:
|
||||
return 0;
|
||||
case ERR_MEM:
|
||||
return NSAPI_ERROR_NO_MEMORY;
|
||||
case ERR_CONN:
|
||||
case ERR_CLSD:
|
||||
return NSAPI_ERROR_NO_CONNECTION;
|
||||
case ERR_TIMEOUT:
|
||||
case ERR_RTE:
|
||||
|
@ -242,6 +255,12 @@ static int lwip_gethostbyname(nsapi_stack_t *stack, nsapi_addr_t *addr, const ch
|
|||
|
||||
static int lwip_socket_open(nsapi_stack_t *stack, nsapi_socket_t *handle, nsapi_protocol_t proto)
|
||||
{
|
||||
// check if network is connected
|
||||
if (!lwip_get_ip_address()) {
|
||||
return NSAPI_ERROR_NO_CONNECTION;
|
||||
}
|
||||
|
||||
// allocate a socket
|
||||
struct lwip_socket *s = lwip_arena_alloc();
|
||||
if (!s) {
|
||||
return NSAPI_ERROR_NO_SOCKET;
|
||||
|
@ -349,7 +368,7 @@ static int lwip_socket_recv(nsapi_stack_t *stack, nsapi_socket_t handle, void *d
|
|||
s->offset = 0;
|
||||
|
||||
if (err != ERR_OK) {
|
||||
return (err == ERR_CLSD) ? 0 : lwip_err_remap(err);
|
||||
return lwip_err_remap(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ extern "C" {
|
|||
|
||||
// Access to lwip through the nsapi
|
||||
int lwip_bringup(void);
|
||||
void lwip_bringdown(void);
|
||||
int lwip_bringdown(void);
|
||||
|
||||
extern nsapi_stack_t lwip_stack;
|
||||
|
||||
|
|
|
@ -258,6 +258,25 @@ SocketAddress::operator bool() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool operator==(const SocketAddress &a, const SocketAddress &b)
|
||||
{
|
||||
int count = 0;
|
||||
if (a._addr.version == NSAPI_IPv4 && b._addr.version == NSAPI_IPv4) {
|
||||
count = NSAPI_IPv4_BYTES;
|
||||
} else if (a._addr.version == NSAPI_IPv6 && b._addr.version == NSAPI_IPv6) {
|
||||
count = NSAPI_IPv6_BYTES;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (memcmp(a._addr.bytes, b._addr.bytes, count) == 0);
|
||||
}
|
||||
|
||||
bool operator!=(const SocketAddress &a, const SocketAddress &b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
void SocketAddress::_SocketAddress(NetworkStack *iface, const char *host, uint16_t port)
|
||||
{
|
||||
_ip_address[0] = '\0';
|
||||
|
|
|
@ -137,6 +137,18 @@ public:
|
|||
*/
|
||||
operator bool() const;
|
||||
|
||||
/** Compare two addresses for equality
|
||||
*
|
||||
* @return True if both addresses are equal
|
||||
*/
|
||||
friend bool operator==(const SocketAddress &a, const SocketAddress &b);
|
||||
|
||||
/** Compare two addresses for equality
|
||||
*
|
||||
* @return True if both addresses are not equal
|
||||
*/
|
||||
friend bool operator!=(const SocketAddress &a, const SocketAddress &b);
|
||||
|
||||
private:
|
||||
void _SocketAddress(NetworkStack *iface, const char *host, uint16_t port);
|
||||
|
||||
|
|
|
@ -32,12 +32,13 @@
|
|||
#define __CTHUNK_H__
|
||||
|
||||
#define CTHUNK_ADDRESS 1
|
||||
#define CTHUNK_VARIABLES volatile uint32_t code[2]
|
||||
|
||||
#if (defined(__CORTEX_M3) || defined(__CORTEX_M4) || defined(__thumb2__)) && ! defined(__CORTEX_A9)
|
||||
#define CTHUNK_VARIABLES volatile uint32_t code[1]
|
||||
#if (defined(__CORTEX_M3) || defined(__CORTEX_M4) || defined(__CORTEX_M7) || defined(__CORTEX_A9))
|
||||
/**
|
||||
* CTHUNK disassembly for Cortex-M3/M4 (thumb2):
|
||||
* * ldm.w pc,{r0,r1,r2,pc}
|
||||
* CTHUNK disassembly for Cortex-M3/M4/M7/A9 (thumb2):
|
||||
* * adr r0, #4
|
||||
* * ldm r0, {r0, r1, r2, pc}
|
||||
*
|
||||
* This instruction loads the arguments for the static thunking function to r0-r2, and
|
||||
* branches to that function by loading its address into PC.
|
||||
|
@ -45,23 +46,21 @@
|
|||
* This is safe for both regular calling and interrupt calling, since it only touches scratch registers
|
||||
* which should be saved by the caller, and are automatically saved as part of the IRQ context switch.
|
||||
*/
|
||||
#define CTHUNK_ASSIGMENT m_thunk.code[0] = 0x8007E89F
|
||||
|
||||
#elif defined(__CORTEX_M0PLUS) || defined(__CORTEX_M0) || defined(__CORTEX_A9)
|
||||
/*
|
||||
* CTHUNK disassembly for Cortex M0 (thumb):
|
||||
* * push {r0,r1,r2,r3,r4,lr} save touched registers and return address
|
||||
* * movs r4,#4 set up address to load arguments from (immediately following this code block) (1)
|
||||
* * add r4,pc set up address to load arguments from (immediately following this code block) (2)
|
||||
* * ldm r4!,{r0,r1,r2,r3} load arguments for static thunk function
|
||||
* * blx r3 call static thunk function
|
||||
* * pop {r0,r1,r2,r3,r4,pc} restore scratch registers and return from function
|
||||
*/
|
||||
#define CTHUNK_VARIABLES volatile uint32_t code[3]
|
||||
#define CTHUNK_ASSIGMENT do { \
|
||||
m_thunk.code[0] = 0x2404B51F; \
|
||||
m_thunk.code[1] = 0xCC0F447C; \
|
||||
m_thunk.code[2] = 0xBD1F4798; \
|
||||
m_thunk.code[0] = 0xE890A001; \
|
||||
m_thunk.code[1] = 0x00008007; \
|
||||
} while (0)
|
||||
|
||||
#elif (defined(__CORTEX_M0PLUS) || defined(__CORTEX_M0))
|
||||
/*
|
||||
* CTHUNK disassembly for Cortex M0/M0+ (thumb):
|
||||
* * adr r0, #4
|
||||
* * ldm r0, {r0, r1, r2, r3}
|
||||
* * bx r3
|
||||
*/
|
||||
#define CTHUNK_ASSIGMENT do { \
|
||||
m_thunk.code[0] = 0xC80FA001; \
|
||||
m_thunk.code[1] = 0x00004718; \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
@ -225,6 +224,13 @@ class CThunk
|
|||
__ca9u_inv_tlb_all();
|
||||
__v7_inv_btac();
|
||||
}
|
||||
#endif
|
||||
#if defined(__CORTEX_M7)
|
||||
/* Data cache clean and invalid */
|
||||
SCB_CleanInvalidateDCache();
|
||||
|
||||
/* Instruction cache invalid */
|
||||
SCB_InvalidateICache();
|
||||
#endif
|
||||
__ISB();
|
||||
__DSB();
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#ifndef MBED_H
|
||||
#define MBED_H
|
||||
|
||||
#define MBED_LIBRARY_VERSION 126
|
||||
#define MBED_LIBRARY_VERSION 127
|
||||
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
#include "rtos/rtos.h"
|
||||
|
|
206
hal/targets.json
206
hal/targets.json
|
@ -615,8 +615,8 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f030r8"},
|
||||
"detect_code": ["0725"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_lib": "small",
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "small",
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"NUCLEO_F031K6": {
|
||||
|
@ -656,7 +656,7 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f070rb"},
|
||||
"detect_code": ["0755"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_F072RB": {
|
||||
|
@ -668,7 +668,7 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f072rb"},
|
||||
"detect_code": ["0730"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_F091RC": {
|
||||
|
@ -680,7 +680,7 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f091rc"},
|
||||
"detect_code": ["0750"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_F103RB": {
|
||||
|
@ -717,8 +717,8 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f302r8"},
|
||||
"detect_code": ["0705"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_lib": "small",
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "small",
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"NUCLEO_F303K8": {
|
||||
|
@ -731,8 +731,8 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f303k8"},
|
||||
"detect_code": ["0775"],
|
||||
"default_lib": "small",
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "small",
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"NUCLEO_F303RE": {
|
||||
|
@ -744,21 +744,20 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f303re"},
|
||||
"detect_code": ["0745"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_F303ZE": {
|
||||
"supported_form_factors": ["ARDUINO", "MORPHO"],
|
||||
"core": "Cortex-M4F",
|
||||
"fpu": "single",
|
||||
"default_toolchain": "uARM",
|
||||
"default_toolchain": "ARM",
|
||||
"extra_labels": ["STM", "STM32F3", "STM32F303ZE"],
|
||||
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
||||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f303ze"},
|
||||
"detect_code": ["0745"],
|
||||
"detect_code": ["0747"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2"]
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_F334R8": {
|
||||
"supported_form_factors": ["ARDUINO", "MORPHO"],
|
||||
|
@ -769,8 +768,8 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f334r8"},
|
||||
"detect_code": ["0735"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_lib": "small",
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "small",
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"NUCLEO_F401RE": {
|
||||
|
@ -782,7 +781,8 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f401re"},
|
||||
"detect_code": ["0720"],
|
||||
"device_has": ["ANALOGIN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_F410RB": {
|
||||
|
@ -793,9 +793,9 @@
|
|||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f410rb"},
|
||||
"macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT"],
|
||||
"macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT", "TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"detect_code": ["0740"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_F411RE": {
|
||||
|
@ -807,7 +807,8 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f411re"},
|
||||
"detect_code": ["0740"],
|
||||
"device_has": ["ANALOGIN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"ELMO_F411RE": {
|
||||
|
@ -818,7 +819,8 @@
|
|||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM"],
|
||||
"inherits": ["Target"],
|
||||
"detect_code": ["----"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"default_build": "small",
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
|
@ -830,8 +832,8 @@
|
|||
"extra_labels": ["STM", "STM32F4", "STM32F429", "STM32F429ZI", "STM32F429xx"],
|
||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"progen": {"target": "nucleo-f429zi"},
|
||||
"macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT", "DEVICE_RTC_LSI=1"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT", "DEVICE_RTC_LSI=1", "TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "RTC_LSI", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"detect_code": ["0796"],
|
||||
"features": ["IPV4"],
|
||||
"release_versions": ["2", "5"]
|
||||
|
@ -845,7 +847,8 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f446re"},
|
||||
"detect_code": ["0777"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_F446ZE": {
|
||||
|
@ -857,7 +860,8 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f446ze"},
|
||||
"detect_code": ["0778"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
|
||||
|
@ -869,7 +873,8 @@
|
|||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"inherits": ["Target"],
|
||||
"detect_code": ["0840"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_F746ZG": {
|
||||
|
@ -887,7 +892,7 @@
|
|||
},
|
||||
"supported_form_factors": ["ARDUINO"],
|
||||
"detect_code": ["0816"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"features": ["IPV4"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
|
@ -900,7 +905,7 @@
|
|||
"macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT"],
|
||||
"progen": {"target": "nucleo-f767zi"},
|
||||
"detect_code": ["0818"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"features": ["IPV4"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
|
@ -913,7 +918,7 @@
|
|||
"supported_form_factors": ["ARDUINO"],
|
||||
"detect_code": ["0780"],
|
||||
"progen": {"target":"nucleo-l011k4"},
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "small",
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
|
@ -927,7 +932,7 @@
|
|||
"supported_form_factors": ["ARDUINO"],
|
||||
"detect_code": ["0790"],
|
||||
"progen": {"target": "nucleo-l031k6"},
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "small",
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
|
@ -940,8 +945,8 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-l053r8"},
|
||||
"detect_code": ["0715"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_lib": "small",
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "small",
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"NUCLEO_L073RZ": {
|
||||
|
@ -953,7 +958,7 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-l073rz"},
|
||||
"detect_code": ["0760"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_L152RE": {
|
||||
|
@ -965,7 +970,7 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-l152re"},
|
||||
"detect_code": ["0710"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_L432KC": {
|
||||
|
@ -977,7 +982,7 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-l432kc"},
|
||||
"detect_code": ["0770"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "CAN", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "CAN", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"NUCLEO_L476RG": {
|
||||
|
@ -989,7 +994,7 @@
|
|||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-l476rg"},
|
||||
"detect_code": ["0765"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"STM32F3XX": {
|
||||
|
@ -1040,7 +1045,7 @@
|
|||
"extra_labels": ["STM", "STM32F3", "STM32F303", "STM32F303VC"],
|
||||
"macros": ["DEVICE_RTC_LSI=1"],
|
||||
"supported_toolchains": ["GCC_ARM"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"]
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "RTC_LSI", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"]
|
||||
},
|
||||
"DISCO_F334C8": {
|
||||
"inherits": ["Target"],
|
||||
|
@ -1051,9 +1056,9 @@
|
|||
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
||||
"progen": {"target": "disco-f334c8"},
|
||||
"detect_code": ["0810"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_lib": "small",
|
||||
"release_versions": ["2"]
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "RTC_LSI", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "small",
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"DISCO_F407VG": {
|
||||
"inherits": ["Target"],
|
||||
|
@ -1061,17 +1066,18 @@
|
|||
"progen": {"target": "disco-f407vg"},
|
||||
"extra_labels": ["STM", "STM32F4", "STM32F407", "STM32F407VG"],
|
||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"]
|
||||
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"]
|
||||
},
|
||||
"DISCO_F429ZI": {
|
||||
"inherits": ["Target"],
|
||||
"core": "Cortex-M4F",
|
||||
"default_toolchain": "ARM",
|
||||
"extra_labels": ["STM", "STM32F4", "STM32F429", "STM32F429ZI", "STM32F429xx"],
|
||||
"macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT", "DEVICE_RTC_LSI=1"],
|
||||
"macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT","DEVICE_RTC_LSI=1","TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"progen": {"target": "disco-f429zi"},
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"DISCO_F469NI": {
|
||||
|
@ -1081,7 +1087,7 @@
|
|||
"extra_labels": ["STM", "STM32F4", "STM32F469", "STM32F469NI", "STM32F469xx"],
|
||||
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
||||
"inherits": ["Target"],
|
||||
"macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT"],
|
||||
"macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT","TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"progen": {"target": "disco-f469ni"},
|
||||
"detect_code": ["0788"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
|
@ -1094,8 +1100,8 @@
|
|||
"extra_labels": ["STM", "STM32L0", "STM32L053C8"],
|
||||
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
||||
"progen": {"target": "disco-l053c8"},
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_lib": "small",
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "small",
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"DISCO_F746NG": {
|
||||
|
@ -1107,7 +1113,7 @@
|
|||
"macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT"],
|
||||
"progen": {"target": "disco-f746ng"},
|
||||
"detect_code": ["0815"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"features": ["IPV4"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
|
@ -1119,7 +1125,7 @@
|
|||
"default_toolchain": "ARM",
|
||||
"progen": {"target": "disco-f769ni"},
|
||||
"detect_code": ["0817"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"features": ["IPV4"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
|
@ -1131,7 +1137,7 @@
|
|||
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
||||
"progen": {"target": "disco-l476vg"},
|
||||
"detect_code": ["0820"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"MTS_MDOT_F405RG": {
|
||||
|
@ -1140,9 +1146,9 @@
|
|||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"extra_labels": ["STM", "STM32F4", "STM32F405RG"],
|
||||
"is_disk_virtual": true,
|
||||
"macros": ["HSE_VALUE=26000000", "OS_CLOCK=48000000"],
|
||||
"macros": ["HSE_VALUE=26000000", "OS_CLOCK=48000000", "TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"progen": {"target": "mts-mdot-f405rg"},
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"MTS_MDOT_F411RE": {
|
||||
|
@ -1150,13 +1156,13 @@
|
|||
"core": "Cortex-M4F",
|
||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"extra_labels": ["STM", "STM32F4", "STM32F411RE"],
|
||||
"macros": ["HSE_VALUE=26000000", "OS_CLOCK=96000000", "USE_PLL_HSE_EXTC=0", "VECT_TAB_OFFSET=0x00010000"],
|
||||
"macros": ["HSE_VALUE=26000000", "OS_CLOCK=96000000", "USE_PLL_HSE_EXTC=0", "VECT_TAB_OFFSET=0x00010000","TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"post_binary_hook": {
|
||||
"function": "MTSCode.combine_bins_mts_dot",
|
||||
"toolchains": ["GCC_ARM", "ARM_STD", "ARM_MICRO"]
|
||||
},
|
||||
"progen": {"target": "mts-mdot-f411re"},
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"MTS_DRAGONFLY_F411RE": {
|
||||
|
@ -1164,15 +1170,26 @@
|
|||
"core": "Cortex-M4F",
|
||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"extra_labels": ["STM", "STM32F4", "STM32F411RE"],
|
||||
"macros": ["HSE_VALUE=26000000", "VECT_TAB_OFFSET=0x08010000"],
|
||||
"macros": ["HSE_VALUE=26000000", "VECT_TAB_OFFSET=0x08010000","TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"post_binary_hook": {
|
||||
"function": "MTSCode.combine_bins_mts_dragonfly",
|
||||
"toolchains": ["GCC_ARM", "ARM_STD", "ARM_MICRO"]
|
||||
},
|
||||
"progen": {"target": "mts-dragonfly-f411re"},
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"XDOT_L151CC": {
|
||||
"inherits": ["Target"],
|
||||
"core": "Cortex-M3",
|
||||
"default_toolchain": "ARM",
|
||||
"extra_labels": ["STM", "STM32L1", "STM32L151CC"],
|
||||
"supported_toolchains": ["ARM", "GCC_ARM", "IAR"],
|
||||
"progen": {"target": "xdot-l151cc"},
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "standard",
|
||||
"release_versions": ["5"]
|
||||
},
|
||||
"MOTE_L152RC": {
|
||||
"inherits": ["Target"],
|
||||
"core": "Cortex-M3",
|
||||
|
@ -1192,18 +1209,20 @@
|
|||
"default_toolchain": "GCC_ARM",
|
||||
"extra_labels": ["STM", "STM32F4", "STM32F401", "STM32F401VC"],
|
||||
"supported_toolchains": ["GCC_ARM"],
|
||||
"device_has": ["ANALOGIN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"]
|
||||
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "ERROR_RED", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"]
|
||||
},
|
||||
"UBLOX_C029": {
|
||||
"supported_form_factors": ["ARDUINO"],
|
||||
"core": "Cortex-M4F",
|
||||
"default_toolchain": "uARM",
|
||||
"default_toolchain": "ARM",
|
||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"extra_labels": ["STM", "STM32F4", "STM32F439", "STM32F439ZI"],
|
||||
"macros": ["HSE_VALUE=24000000", "HSE_STARTUP_TIMEOUT=5000"],
|
||||
"macros": ["HSE_VALUE=24000000", "HSE_STARTUP_TIMEOUT=5000", "CB_INTERFACE_SDIO","CB_CHIP_WL18XX","SUPPORT_80211D_ALWAYS","WLAN_ENABLED"],
|
||||
"inherits": ["Target"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"default_build": "small"
|
||||
"device_has": ["ANALOGIN", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
"features": ["IPV4"],
|
||||
"release_versions": ["5"]
|
||||
},
|
||||
"NZ32_SC151": {
|
||||
"inherits": ["Target"],
|
||||
|
@ -1262,7 +1281,8 @@
|
|||
"toolchains": ["ARM_STD", "GCC_ARM"]
|
||||
},
|
||||
"program_cycle_s": 6,
|
||||
"features": ["BLE"]
|
||||
"features": ["BLE"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"]
|
||||
},
|
||||
"MCU_NRF51_16K_BASE": {
|
||||
"inherits": ["MCU_NRF51"],
|
||||
|
@ -1357,26 +1377,22 @@
|
|||
"progen": {"target": "mkit"},
|
||||
"extra_labels_add": ["NRF51822", "NRF51822_MKIT"],
|
||||
"macros_add": ["TARGET_NRF51822_MKIT"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"NRF51822_BOOT": {
|
||||
"inherits": ["MCU_NRF51_16K_BOOT"],
|
||||
"extra_labels_add": ["NRF51822", "NRF51822_MKIT"],
|
||||
"macros_add": ["TARGET_NRF51822_MKIT"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"]
|
||||
"macros_add": ["TARGET_NRF51822_MKIT"]
|
||||
},
|
||||
"NRF51822_OTA": {
|
||||
"inherits": ["MCU_NRF51_16K_OTA"],
|
||||
"extra_labels_add": ["NRF51822", "NRF51822_MKIT"],
|
||||
"macros_add": ["TARGET_NRF51822_MKIT"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"]
|
||||
"macros_add": ["TARGET_NRF51822_MKIT"]
|
||||
},
|
||||
"ARCH_BLE": {
|
||||
"supported_form_factors": ["ARDUINO"],
|
||||
"inherits": ["MCU_NRF51_16K"],
|
||||
"progen": {"target": "arch-ble"},
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"ARCH_BLE_BOOT": {
|
||||
|
@ -1412,7 +1428,6 @@
|
|||
"SEEED_TINY_BLE": {
|
||||
"inherits": ["MCU_NRF51_16K"],
|
||||
"progen": {"target": "seed-tinyble"},
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"SEEED_TINY_BLE_BOOT": {
|
||||
|
@ -1429,7 +1444,6 @@
|
|||
"inherits": ["MCU_NRF51_16K"],
|
||||
"progen": {"target": "hrm1017"},
|
||||
"macros_add": ["TARGET_NRF_LFCLK_RC"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"HRM1017_BOOT": {
|
||||
|
@ -1446,7 +1460,6 @@
|
|||
"supported_form_factors": ["ARDUINO"],
|
||||
"inherits": ["MCU_NRF51_16K"],
|
||||
"progen": {"target": "rblab-nrf51822"},
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"RBLAB_NRF51822_BOOT": {
|
||||
|
@ -1463,7 +1476,6 @@
|
|||
},
|
||||
"RBLAB_BLENANO": {
|
||||
"inherits": ["MCU_NRF51_16K"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"RBLAB_BLENANO_BOOT": {
|
||||
|
@ -1477,12 +1489,10 @@
|
|||
"macros_add": ["TARGET_RBLAB_BLENANO"]
|
||||
},
|
||||
"NRF51822_Y5_MBUG": {
|
||||
"inherits": ["MCU_NRF51_16K"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"]
|
||||
"inherits": ["MCU_NRF51_16K"]
|
||||
},
|
||||
"WALLBOT_BLE": {
|
||||
"inherits": ["MCU_NRF51_16K"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"WALLBOT_BLE_BOOT": {
|
||||
|
@ -1518,8 +1528,7 @@
|
|||
"NRF51_DK_LEGACY": {
|
||||
"supported_form_factors": ["ARDUINO"],
|
||||
"inherits": ["MCU_NRF51_32K"],
|
||||
"progen": {"target": "nrf51-dk"},
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"]
|
||||
"progen": {"target": "nrf51-dk"}
|
||||
},
|
||||
"NRF51_DK_BOOT": {
|
||||
"supported_form_factors": ["ARDUINO"],
|
||||
|
@ -1536,7 +1545,6 @@
|
|||
"NRF51_DONGLE": {
|
||||
"inherits": ["MCU_NRF51_32K"],
|
||||
"progen": {"target": "nrf51-dongle"},
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"NRF51_DONGLE_BOOT": {
|
||||
|
@ -1552,7 +1560,6 @@
|
|||
"NRF51_MICROBIT": {
|
||||
"inherits": ["MCU_NRF51_16K_S110"],
|
||||
"macros_add": ["TARGET_NRF_LFCLK_RC"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"NRF51_MICROBIT_BOOT": {
|
||||
|
@ -1569,7 +1576,6 @@
|
|||
"inherits": ["MCU_NRF51_16K"],
|
||||
"extra_labels_add": ["NRF51_MICROBIT"],
|
||||
"macros_add": ["TARGET_NRF51_MICROBIT", "TARGET_NRF_LFCLK_RC"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"NRF51_MICROBIT_B_BOOT": {
|
||||
|
@ -1585,7 +1591,6 @@
|
|||
"MTM_MTCONNECT04S": {
|
||||
"inherits": ["MCU_NRF51_32K"],
|
||||
"progen": {"target": "mtm-mtconnect04s"},
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"],
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
"MTM_MTCONNECT04S_BOOT": {
|
||||
|
@ -1776,39 +1781,39 @@
|
|||
"core": "Cortex-M3",
|
||||
"macros": ["EFM32GG990F1024"],
|
||||
"extra_labels": ["Silicon_Labs", "EFM32"],
|
||||
"supported_toolchains": ["GCC_ARM", "ARM", "uARM"],
|
||||
"supported_toolchains": ["GCC_ARM", "ARM", "uARM", "IAR"],
|
||||
"progen": {"target": "efm32gg-stk"},
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_PATTERN", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"forced_reset_timeout": 2,
|
||||
"release_versions": ["2"]
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"EFM32LG_STK3600": {
|
||||
"inherits": ["Target"],
|
||||
"core": "Cortex-M3",
|
||||
"macros": ["EFM32LG990F256"],
|
||||
"extra_labels": ["Silicon_Labs", "EFM32"],
|
||||
"supported_toolchains": ["GCC_ARM", "ARM", "uARM"],
|
||||
"supported_toolchains": ["GCC_ARM", "ARM", "uARM", "IAR"],
|
||||
"progen": {"target": "efm32lg-stk"},
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_PATTERN", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"forced_reset_timeout": 2,
|
||||
"release_versions": ["2"]
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"EFM32WG_STK3800": {
|
||||
"inherits": ["Target"],
|
||||
"core": "Cortex-M4F",
|
||||
"macros": ["EFM32WG990F256"],
|
||||
"extra_labels": ["Silicon_Labs", "EFM32"],
|
||||
"supported_toolchains": ["GCC_ARM", "ARM", "uARM"],
|
||||
"supported_toolchains": ["GCC_ARM", "ARM", "uARM", "IAR"],
|
||||
"progen": {"target": "efm32wg-stk"},
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "ERROR_PATTERN", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
|
||||
"forced_reset_timeout": 2,
|
||||
"release_versions": ["2"]
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
"EFM32ZG_STK3200": {
|
||||
"inherits": ["Target"],
|
||||
"core": "Cortex-M0+",
|
||||
"default_toolchain": "uARM",
|
||||
"supported_toolchains": ["GCC_ARM", "uARM"],
|
||||
"supported_toolchains": ["GCC_ARM", "uARM", "IAR"],
|
||||
"extra_labels": ["Silicon_Labs", "EFM32"],
|
||||
"macros": ["EFM32ZG222F32"],
|
||||
"progen": {
|
||||
|
@ -1823,7 +1828,7 @@
|
|||
"inherits": ["Target"],
|
||||
"core": "Cortex-M0+",
|
||||
"default_toolchain": "uARM",
|
||||
"supported_toolchains": ["GCC_ARM", "uARM"],
|
||||
"supported_toolchains": ["GCC_ARM", "uARM", "IAR"],
|
||||
"extra_labels": ["Silicon_Labs", "EFM32"],
|
||||
"macros": ["EFM32HG322F64"],
|
||||
"progen": {
|
||||
|
@ -1969,7 +1974,8 @@
|
|||
"value": 1,
|
||||
"macro_name": "MBED_CONF_NORDIC_UART_HWFC"
|
||||
}
|
||||
}
|
||||
},
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SLEEP", "SPI", "SPISLAVE"]
|
||||
},
|
||||
"MCU_NRF51_32K_UNIFIED": {
|
||||
"inherits": ["MCU_NRF51_UNIFIED"],
|
||||
|
@ -2053,27 +2059,7 @@
|
|||
"supported_form_factors": ["ARDUINO"],
|
||||
"inherits": ["MCU_NRF52"],
|
||||
"progen": {"target": "dfbm-nq620"},
|
||||
"macros_add": [
|
||||
"BOARD_PCA10040",
|
||||
"NRF52_PAN_12",
|
||||
"NRF52_PAN_15",
|
||||
"NRF52_PAN_58",
|
||||
"NRF52_PAN_55",
|
||||
"NRF52_PAN_54",
|
||||
"NRF52_PAN_31",
|
||||
"NRF52_PAN_30",
|
||||
"NRF52_PAN_51",
|
||||
"NRF52_PAN_36",
|
||||
"NRF52_PAN_53",
|
||||
"S132",
|
||||
"CONFIG_GPIO_AS_PINRESET",
|
||||
"BLE_STACK_SUPPORT_REQD",
|
||||
"SWI_DISABLE0",
|
||||
"NRF52_PAN_20",
|
||||
"NRF52_PAN_64",
|
||||
"NRF52_PAN_62",
|
||||
"NRF52_PAN_63"
|
||||
],
|
||||
"macros_add": ["BOARD_PCA10040", "NRF52_PAN_12", "NRF52_PAN_15", "NRF52_PAN_58", "NRF52_PAN_55", "NRF52_PAN_54", "NRF52_PAN_31", "NRF52_PAN_30", "NRF52_PAN_51", "NRF52_PAN_36", "NRF52_PAN_53", "S132", "CONFIG_GPIO_AS_PINRESET", "BLE_STACK_SUPPORT_REQD", "SWI_DISABLE0", "NRF52_PAN_20", "NRF52_PAN_64", "NRF52_PAN_62", "NRF52_PAN_63"],
|
||||
"device_has": ["ANALOGIN", "ERROR_PATTERN", "I2C", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE"],
|
||||
"release_versions": ["2", "5"]
|
||||
},
|
||||
|
|
|
@ -28,7 +28,7 @@ MEMORY
|
|||
{
|
||||
VECTORS (rx) : ORIGIN = 0x00000000, LENGTH = 0x00000400
|
||||
FLASH (rx) : ORIGIN = 0x00000400, LENGTH = 0x00040000 - 0x00000400
|
||||
RAM (rwx) : ORIGIN = 0x20000140, LENGTH = 0x00020000 - 0x00000140
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
|
@ -59,25 +59,37 @@ MEMORY
|
|||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Heap 1/4 of ram and stack 1/8 */
|
||||
__stack_size__ = 0x4000;
|
||||
__heap_size__ = 0x8000;
|
||||
|
||||
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
|
||||
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
|
||||
|
||||
/* Size of the vector table in SRAM */
|
||||
M_VECTOR_RAM_SIZE = 0x140;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.isr_vector :
|
||||
{
|
||||
__vector_table = .;
|
||||
KEEP(*(.vector_table))
|
||||
*(.text.Reset_Handler)
|
||||
*(.text.System_Init)
|
||||
. = ALIGN(4);
|
||||
} > VECTORS
|
||||
|
||||
.cordio :
|
||||
/* Note: The uVisor expects this section at a fixed location, as specified
|
||||
by the porting process configuration parameter: FLASH_OFFSET. */
|
||||
__UVISOR_TEXT_OFFSET = 0x0;
|
||||
__UVISOR_TEXT_START = ORIGIN(FLASH) + __UVISOR_TEXT_OFFSET;
|
||||
.text __UVISOR_TEXT_START :
|
||||
{
|
||||
*CORDIO_RO_2.1.o
|
||||
*TRIM_2.1.o
|
||||
} > FLASH
|
||||
/* uVisor code and data */
|
||||
. = ALIGN(4);
|
||||
__uvisor_main_start = .;
|
||||
*(.uvisor.main)
|
||||
__uvisor_main_end = .;
|
||||
|
||||
.text :
|
||||
{
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
|
@ -114,12 +126,67 @@ SECTIONS
|
|||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
__etext = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
.cordio :
|
||||
{
|
||||
*CORDIO_RO_2.1.o
|
||||
*TRIM_2.1.o
|
||||
} > FLASH
|
||||
|
||||
.interrupts_ram :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__VECTOR_RAM__ = .;
|
||||
__interrupts_ram_start__ = .; /* Create a global symbol at data start */
|
||||
. += M_VECTOR_RAM_SIZE;
|
||||
. = ALIGN(4);
|
||||
__interrupts_ram_end__ = .; /* Define a global symbol at data end */
|
||||
} > RAM
|
||||
|
||||
/* ensure that uvisor bss is at the beginning of memory */
|
||||
/* Note: The uVisor expects this section at a fixed location, as specified by
|
||||
* the porting process configuration parameter: SRAM_OFFSET. */
|
||||
__UVISOR_SRAM_OFFSET = 0x140;
|
||||
__UVISOR_BSS_START = ORIGIN(RAM) + __UVISOR_SRAM_OFFSET;
|
||||
.uvisor.bss __UVISOR_BSS_START (NOLOAD):
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_start = .;
|
||||
|
||||
/* protected uvisor main bss */
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_main_start = .;
|
||||
KEEP(*(.keep.uvisor.bss.main))
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_main_end = .;
|
||||
|
||||
/* protected uvisor secure boxes bss */
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_boxes_start = .;
|
||||
KEEP(*(.keep.uvisor.bss.boxes))
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_boxes_end = .;
|
||||
|
||||
. = ALIGN((1 << LOG2CEIL(LENGTH(RAM))) / 8);
|
||||
__uvisor_bss_end = .;
|
||||
} > RAM
|
||||
|
||||
/* Heap space for the page allocator */
|
||||
.page_heap (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uvisor_page_start = .;
|
||||
KEEP(*(.keep.uvisor.page_heap))
|
||||
. = ALIGN(32);
|
||||
__uvisor_page_end = .;
|
||||
} > RAM
|
||||
|
||||
.data :
|
||||
{
|
||||
PROVIDE(__etext = LOADADDR(.data));
|
||||
. = ALIGN(4);
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
|
@ -147,41 +214,89 @@ SECTIONS
|
|||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM AT > FLASH
|
||||
|
||||
/* uvisor configuration data */
|
||||
.uvisor.secure :
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uvisor_secure_start = .;
|
||||
|
||||
/* uvisor secure boxes configuration tables */
|
||||
. = ALIGN(32);
|
||||
__uvisor_cfgtbl_start = .;
|
||||
KEEP(*(.keep.uvisor.cfgtbl))
|
||||
. = ALIGN(32);
|
||||
__uvisor_cfgtbl_end = .;
|
||||
|
||||
__uvisor_cfgtbl_ptr_start = .;
|
||||
KEEP(*(.keep.uvisor.cfgtbl_ptr_first))
|
||||
KEEP(*(.keep.uvisor.cfgtbl_ptr))
|
||||
__uvisor_cfgtbl_ptr_end = .;
|
||||
|
||||
/* Pointers to all boxes register gateways. These are grouped here to allow
|
||||
* discoverability and firmware verification. */
|
||||
__uvisor_register_gateway_ptr_start = .;
|
||||
KEEP(*(.keep.uvisor.register_gateway_ptr))
|
||||
__uvisor_register_gateway_ptr_end = .;
|
||||
|
||||
. = ALIGN(32);
|
||||
__uvisor_secure_end = .;
|
||||
} > FLASH
|
||||
|
||||
/* From now on you can insert any other SRAM region. */
|
||||
|
||||
.uninitialized (NOLOAD):
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uninitialized_start = .;
|
||||
*(.uninitialized)
|
||||
KEEP(*(.keep.uninitialized))
|
||||
. = ALIGN(32);
|
||||
__uninitialized_end = .;
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__START_BSS = .;
|
||||
__bss_start__ = .;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
__END_BSS = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
bss_size = __bss_end__ - __bss_start__;
|
||||
|
||||
.heap :
|
||||
{
|
||||
. = ALIGN(8);
|
||||
__uvisor_heap_start = .;
|
||||
__end__ = .;
|
||||
end = __end__;
|
||||
*(.heap*)
|
||||
PROVIDE(end = .);
|
||||
__HeapBase = .;
|
||||
. += HEAP_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 :
|
||||
{
|
||||
*(.stack)
|
||||
__heap_limit = .; /* Add for _sbrk */
|
||||
__uvisor_heap_end = .;
|
||||
} > 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);
|
||||
__StackLimit = __StackTop - STACK_SIZE;
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
/* Provide physical memory boundaries for uVisor. */
|
||||
__uvisor_flash_start = ORIGIN(VECTORS);
|
||||
__uvisor_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
|
||||
__uvisor_sram_start = ORIGIN(RAM);
|
||||
__uvisor_sram_end = ORIGIN(RAM) + LENGTH(RAM);
|
||||
|
||||
} /* End of sections */
|
||||
|
|
|
@ -24,48 +24,6 @@
|
|||
.syntax unified
|
||||
.arch armv7-m
|
||||
|
||||
/* Memory Model
|
||||
The HEAP starts at the end of the DATA section and grows upward.
|
||||
|
||||
The STACK starts at the end of the RAM and grows downward.
|
||||
|
||||
The HEAP and stack STACK are only checked at compile time:
|
||||
(DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE
|
||||
|
||||
This is just a check for the bare minimum for the Heap+Stack area before
|
||||
aborting compilation, it is not the run time limit:
|
||||
Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100
|
||||
*/
|
||||
.section .stack
|
||||
.align 3
|
||||
#ifdef __STACK_SIZE
|
||||
.equ Stack_Size, __STACK_SIZE
|
||||
#else
|
||||
.equ Stack_Size, 0x400
|
||||
#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, 0xC00
|
||||
#endif
|
||||
.globl __HeapBase
|
||||
.globl __HeapLimit
|
||||
__HeapBase:
|
||||
.space Heap_Size
|
||||
.size __HeapBase, . - __HeapBase
|
||||
__HeapLimit:
|
||||
.size __HeapLimit, . - __HeapLimit
|
||||
|
||||
.section .vector_table,"a",%progbits
|
||||
.align 2
|
||||
.globl __isr_vector
|
||||
|
@ -143,6 +101,15 @@ __isr_vector:
|
|||
.globl Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
ldr r0, =SystemInit
|
||||
blx r0
|
||||
/* The call to uvisor_init() happens independently of uVisor being enabled or
|
||||
* not, so it is conditionally compiled only based on FEATURE_UVISOR. */
|
||||
#if defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)
|
||||
/* Call uvisor_init() */
|
||||
ldr r0, =uvisor_init
|
||||
blx r0
|
||||
#endif /* FEATURE_UVISOR && TARGET_UVISOR_SUPPORTED */
|
||||
/*
|
||||
* Loop to copy data from read only memory to RAM. The ranges
|
||||
* of copy from/to are specified by following symbols evaluated in
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) //Location of vectors in RAM
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x00000000) //Initial vector position in flash
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
uint32_t *vectors = (uint32_t*)SCB->VTOR;
|
||||
uint32_t i;
|
||||
|
||||
|
@ -37,7 +37,7 @@ void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
|||
vectors[IRQn + NVIC_USER_IRQ_OFFSET] = vector;
|
||||
}
|
||||
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
|
||||
uint32_t __NVIC_GetVector(IRQn_Type IRQn) {
|
||||
uint32_t *vectors = (uint32_t*)SCB->VTOR;
|
||||
return vectors[IRQn + NVIC_USER_IRQ_OFFSET];
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn);
|
||||
void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
|
||||
uint32_t __NVIC_GetVector(IRQn_Type IRQn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -3,19 +3,20 @@
|
|||
** ###################################################################
|
||||
** Processors: MK22FN512CAP12
|
||||
** MK22FN512VDC12
|
||||
** MK22FN512VFX12
|
||||
** MK22FN512VLH12
|
||||
** MK22FN512VLL12
|
||||
** MK22FN512VMP12
|
||||
**
|
||||
** Compiler: Keil ARM C/C++ Compiler
|
||||
** Reference manual: K22P121M120SF7RM, Rev. 1, March 24, 2014
|
||||
** Version: rev. 2.8, 2015-02-19
|
||||
** Build: b151009
|
||||
** Version: rev. 2.9, 2016-03-21
|
||||
** Build: b160406
|
||||
**
|
||||
** Abstract:
|
||||
** Linker file for the Keil ARM C/C++ Compiler
|
||||
**
|
||||
** Copyright (c) 2015 Freescale Semiconductor, Inc.
|
||||
** Copyright (c) 2016 Freescale Semiconductor, Inc.
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -50,6 +51,10 @@
|
|||
*/
|
||||
#define __ram_vector_table__ 1
|
||||
|
||||
/* Heap 1/4 of ram and stack 1/8 */
|
||||
#define __stack_size__ 0x4000
|
||||
#define __heap_size__ 0x8000
|
||||
|
||||
#if (defined(__ram_vector_table__))
|
||||
#define __ram_vector_table_size__ 0x00000400
|
||||
#else
|
||||
|
@ -74,25 +79,45 @@
|
|||
#define m_data_2_start 0x20000000
|
||||
#define m_data_2_size 0x00010000
|
||||
|
||||
/* Sizes */
|
||||
#if (defined(__stack_size__))
|
||||
#define Stack_Size __stack_size__
|
||||
#else
|
||||
#define Stack_Size 0x0400
|
||||
#endif
|
||||
|
||||
LR_m_text m_interrupts_start m_text_size+m_interrupts_size+m_flash_config_size { ; load region size_region
|
||||
#if (defined(__heap_size__))
|
||||
#define Heap_Size __heap_size__
|
||||
#else
|
||||
#define Heap_Size 0x0400
|
||||
#endif
|
||||
|
||||
LR_m_text m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; load region size_region
|
||||
VECTOR_ROM m_interrupts_start m_interrupts_size { ; load address = execution address
|
||||
* (RESET,+FIRST)
|
||||
}
|
||||
ER_m_flash_config m_flash_config_start m_flash_config_size { ; load address = execution address
|
||||
ER_m_flash_config m_flash_config_start FIXED m_flash_config_size { ; load address = execution address
|
||||
* (FlashConfig)
|
||||
}
|
||||
ER_m_text m_text_start m_text_size { ; load address = execution address
|
||||
* (InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
|
||||
#if (defined(__ram_vector_table__))
|
||||
VECTOR_RAM m_interrupts_ram_start EMPTY m_interrupts_ram_size {
|
||||
}
|
||||
#else
|
||||
VECTOR_RAM m_interrupts_start EMPTY 0 {
|
||||
}
|
||||
#endif
|
||||
RW_m_data m_data_start m_data_size { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
RW_IRAM1 m_data_2_start m_data_2_size { ; RW data
|
||||
RW_m_data_2 m_data_2_start m_data_2_size-Stack_Size-Heap_Size { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
VECTOR_RAM m_interrupts_ram_start EMPTY m_interrupts_ram_size {
|
||||
RW_IRAM1 ImageLimit(RW_m_data_2) { ; Heap region growing up
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
** Compiler: Keil ARM C/C++ Compiler
|
||||
** Reference manual: K66P144M180SF5RMV2, Rev. 1, Mar 2015
|
||||
** Version: rev. 3.0, 2015-03-25
|
||||
** Build: b151009
|
||||
** Build: b160406
|
||||
**
|
||||
** Abstract:
|
||||
** Linker file for the Keil ARM C/C++ Compiler
|
||||
**
|
||||
** Copyright (c) 2015 Freescale Semiconductor, Inc.
|
||||
** Copyright (c) 2016 Freescale Semiconductor, Inc.
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -47,6 +47,10 @@
|
|||
*/
|
||||
#define __ram_vector_table__ 1
|
||||
|
||||
/* Heap 1/4 of ram and stack 1/8 */
|
||||
#define __stack_size__ 0x8000
|
||||
#define __heap_size__ 0x10000
|
||||
|
||||
#if (defined(__ram_vector_table__))
|
||||
#define __ram_vector_table_size__ 0x00000400
|
||||
#else
|
||||
|
@ -71,24 +75,44 @@
|
|||
#define m_data_2_start 0x20000000
|
||||
#define m_data_2_size 0x00030000
|
||||
|
||||
/* Sizes */
|
||||
#if (defined(__stack_size__))
|
||||
#define Stack_Size __stack_size__
|
||||
#else
|
||||
#define Stack_Size 0x0400
|
||||
#endif
|
||||
|
||||
LR_m_text m_interrupts_start m_text_size+m_interrupts_size+m_flash_config_size { ; load region size_region
|
||||
#if (defined(__heap_size__))
|
||||
#define Heap_Size __heap_size__
|
||||
#else
|
||||
#define Heap_Size 0x0400
|
||||
#endif
|
||||
|
||||
LR_m_text m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; load region size_region
|
||||
VECTOR_ROM m_interrupts_start m_interrupts_size { ; load address = execution address
|
||||
* (RESET,+FIRST)
|
||||
}
|
||||
ER_m_flash_config m_flash_config_start m_flash_config_size { ; load address = execution address
|
||||
ER_m_flash_config m_flash_config_start FIXED m_flash_config_size { ; load address = execution address
|
||||
* (FlashConfig)
|
||||
}
|
||||
ER_m_text m_text_start m_text_size { ; load address = execution address
|
||||
* (InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
|
||||
#if (defined(__ram_vector_table__))
|
||||
VECTOR_RAM m_interrupts_ram_start EMPTY m_interrupts_ram_size {
|
||||
}
|
||||
#else
|
||||
VECTOR_RAM m_interrupts_start EMPTY 0 {
|
||||
}
|
||||
#endif
|
||||
RW_m_data m_data_start m_data_size { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
RW_IRAM1 m_data_2_start m_data_2_size { ; RW data
|
||||
RW_m_data_2 m_data_2_start m_data_2_size-Stack_Size-Heap_Size { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
VECTOR_RAM m_interrupts_ram_start EMPTY m_interrupts_ram_size {
|
||||
RW_IRAM1 ImageLimit(RW_m_data_2) { ; Heap region growing up
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ LR_m_text m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; l
|
|||
RW_m_data m_data_start m_data_size-Stack_Size-Heap_Size { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
RW_IRAM1 +0 EMPTY Heap_Size { ; RW data
|
||||
RW_IRAM1 +0 { ; Heap region growing up
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ LR_m_text m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; loa
|
|||
RW_m_data m_data_start m_data_size-Stack_Size-Heap_Size { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
RW_IRAM1 +0 EMPTY Heap_Size { ; Heap region growing up
|
||||
RW_IRAM1 +0 { ; Heap region growing up
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
#! armcc -E
|
||||
/*
|
||||
** ###################################################################
|
||||
** Processors: MK64FN1M0VDC12
|
||||
** Processors: MK64FN1M0CAJ12
|
||||
** MK64FN1M0VDC12
|
||||
** MK64FN1M0VLL12
|
||||
** MK64FN1M0VLQ12
|
||||
** MK64FN1M0VMD12
|
||||
**
|
||||
** Compiler: Keil ARM C/C++ Compiler
|
||||
** Reference manual: K64P144M120SF5RM, Rev.2, January 2014
|
||||
** Version: rev. 2.8, 2015-02-19
|
||||
** Build: b151009
|
||||
** Version: rev. 2.9, 2016-03-21
|
||||
** Build: b160406
|
||||
**
|
||||
** Abstract:
|
||||
** Linker file for the Keil ARM C/C++ Compiler
|
||||
**
|
||||
** Copyright (c) 2015 Freescale Semiconductor, Inc.
|
||||
** Copyright (c) 2016 Freescale Semiconductor, Inc.
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -49,6 +50,10 @@
|
|||
*/
|
||||
#define __ram_vector_table__ 1
|
||||
|
||||
/* Heap 1/4 of ram and stack 1/8 */
|
||||
#define __stack_size__ 0x8000
|
||||
#define __heap_size__ 0x10000
|
||||
|
||||
#if (defined(__ram_vector_table__))
|
||||
#define __ram_vector_table_size__ 0x00000400
|
||||
#else
|
||||
|
@ -73,24 +78,44 @@
|
|||
#define m_data_2_start 0x20000000
|
||||
#define m_data_2_size 0x00030000
|
||||
|
||||
/* Sizes */
|
||||
#if (defined(__stack_size__))
|
||||
#define Stack_Size __stack_size__
|
||||
#else
|
||||
#define Stack_Size 0x0400
|
||||
#endif
|
||||
|
||||
LR_m_text m_interrupts_start m_text_size+m_interrupts_size+m_flash_config_size { ; load region size_region
|
||||
#if (defined(__heap_size__))
|
||||
#define Heap_Size __heap_size__
|
||||
#else
|
||||
#define Heap_Size 0x0400
|
||||
#endif
|
||||
|
||||
LR_m_text m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; load region size_region
|
||||
VECTOR_ROM m_interrupts_start m_interrupts_size { ; load address = execution address
|
||||
* (RESET,+FIRST)
|
||||
}
|
||||
ER_m_flash_config m_flash_config_start m_flash_config_size { ; load address = execution address
|
||||
ER_m_flash_config m_flash_config_start FIXED m_flash_config_size { ; load address = execution address
|
||||
* (FlashConfig)
|
||||
}
|
||||
ER_m_text m_text_start m_text_size { ; load address = execution address
|
||||
* (InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
|
||||
#if (defined(__ram_vector_table__))
|
||||
VECTOR_RAM m_interrupts_ram_start EMPTY m_interrupts_ram_size {
|
||||
}
|
||||
#else
|
||||
VECTOR_RAM m_interrupts_start EMPTY 0 {
|
||||
}
|
||||
#endif
|
||||
RW_m_data m_data_start m_data_size { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
RW_IRAM1 m_data_2_start m_data_2_size { ; RW data
|
||||
RW_m_data_2 m_data_2_start m_data_2_size-Stack_Size-Heap_Size { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
VECTOR_RAM m_interrupts_ram_start EMPTY m_interrupts_ram_size {
|
||||
RW_IRAM1 ImageLimit(RW_m_data_2) { ; Heap region growing up
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,6 +107,11 @@ SECTIONS
|
|||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
PROVIDE(__start_fs_data = .);
|
||||
KEEP(*(.fs_data))
|
||||
PROVIDE(__stop_fs_data = .);
|
||||
|
||||
*(.jcr)
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
|
@ -116,13 +121,6 @@ SECTIONS
|
|||
|
||||
__edata = .;
|
||||
|
||||
.fs_data :
|
||||
{
|
||||
PROVIDE(__start_fs_data = .);
|
||||
KEEP(*(.fs_data))
|
||||
PROVIDE(__stop_fs_data = .);
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
|
|
|
@ -106,6 +106,11 @@ SECTIONS
|
|||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
PROVIDE(__start_fs_data = .);
|
||||
KEEP(*(.fs_data))
|
||||
PROVIDE(__stop_fs_data = .);
|
||||
|
||||
*(.jcr)
|
||||
. = ALIGN(4);
|
||||
|
|
|
@ -126,6 +126,11 @@ SECTIONS
|
|||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
PROVIDE(__start_fs_data = .);
|
||||
KEEP(*(.fs_data))
|
||||
PROVIDE(__stop_fs_data = .);
|
||||
|
||||
*(.jcr)
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
|
@ -135,13 +140,6 @@ SECTIONS
|
|||
|
||||
__edata = .;
|
||||
|
||||
.fs_data :
|
||||
{
|
||||
PROVIDE(__start_fs_data = .);
|
||||
KEEP(*(.fs_data))
|
||||
PROVIDE(__stop_fs_data = .);
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
|
|
|
@ -171,11 +171,3 @@ AFTER_VECTORS void IntDefaultHandler (void) {}
|
|||
|
||||
int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {return 0;}
|
||||
}
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void *operator new(size_t size) {return malloc(size);}
|
||||
void *operator new[](size_t size){return malloc(size);}
|
||||
|
||||
void operator delete(void *p) {free(p);}
|
||||
void operator delete[](void *p) {free(p);}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
;
|
||||
;*******************************************************************************
|
||||
|
||||
__initial_sp EQU 0x20004000 ; Top of RAM
|
||||
__initial_sp EQU 0x20010000 ; Top of RAM
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
;******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
|
||||
;******************** (C) COPYRIGHT 2015 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32f439xx.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V2.1.0
|
||||
;* Date : 19-June-2014
|
||||
;* Description : STM32F439x devices vector table for MDK-ARM toolchain.
|
||||
;* Version : V2.4.0
|
||||
;* Date : 14-August-2015
|
||||
;* Description : STM32F439x devices vector table for MDK-ARM_STD toolchain.
|
||||
;* This module performs:
|
||||
;* - Set the initial SP
|
||||
;* - Set the initial PC == Reset_Handler
|
||||
|
@ -39,29 +39,7 @@
|
|||
;
|
||||
;*******************************************************************************
|
||||
|
||||
; Amount of memory (in bytes) allocated for Stack
|
||||
; Tailor this value to your application needs
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x00000400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
|
||||
; <h> Heap Configuration
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x00000200
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
__initial_sp EQU 0x20020000 ; Top of RAM
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
@ -326,7 +304,7 @@ Default_Handler PROC
|
|||
EXPORT OTG_HS_WKUP_IRQHandler [WEAK]
|
||||
EXPORT OTG_HS_IRQHandler [WEAK]
|
||||
EXPORT DCMI_IRQHandler [WEAK]
|
||||
EXPORT CRYP_IRQHandler [WEAK]
|
||||
EXPORT CRYP_IRQHandler [WEAK]
|
||||
EXPORT HASH_RNG_IRQHandler [WEAK]
|
||||
EXPORT FPU_IRQHandler [WEAK]
|
||||
EXPORT UART7_IRQHandler [WEAK]
|
||||
|
@ -435,33 +413,6 @@ DMA2D_IRQHandler
|
|||
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
|
||||
END
|
||||
|
||||
;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
|
|
@ -1,6 +1,6 @@
|
|||
; Scatter-Loading Description File
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Copyright (c) 2014, STMicroelectronics
|
||||
; Copyright (c) 2015, STMicroelectronics
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
|
@ -27,10 +27,10 @@
|
|||
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; STM32F439ZI: 512 KB FLASH (0x80000) + 256 KB SRAM (0x30000 + 0x10000)
|
||||
LR_IROM1 0x08000000 0x80000 { ; load region size_region
|
||||
; 2 MB FLASH (0x200000) + 256 KB SRAM (0x30000 + 0x10000)
|
||||
LR_IROM1 0x08000000 0x200000 { ; load region size_region
|
||||
|
||||
ER_IROM1 0x08000000 0x80000 { ; load address = execution address
|
||||
ER_IROM1 0x08000000 0x200000 { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
|
@ -41,7 +41,7 @@ LR_IROM1 0x08000000 0x80000 { ; load region size_region
|
|||
.ANY (+RW +ZI)
|
||||
}
|
||||
|
||||
RW_IRAM1 (0x10000000) (0x10000) { ; RW data
|
||||
RW_IRAM2 (0x10000000) (0x10000) { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/* Linker script to configure memory regions. */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
|
||||
RAM (rwx) : ORIGIN = 0x200001AC, LENGTH = 192k - 0x1AC
|
||||
RAM2 (rwx) : ORIGIN = 0x10000000, LENGTH = 64k
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048k
|
||||
CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
|
||||
RAM (rwx) : ORIGIN = 0x200001AC, LENGTH = 192k - 0x1AC
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
|
|
|
@ -110,9 +110,14 @@ LoopFillZerobss:
|
|||
/* Call the clock system intitialization function.*/
|
||||
bl SystemInit
|
||||
/* Call static constructors */
|
||||
bl __libc_init_array
|
||||
//bl __libc_init_array
|
||||
/* Call the application's entry point.*/
|
||||
bl main
|
||||
//bl main
|
||||
// Calling the crt0 'cold-start' entry point. There __libc_init_array is called
|
||||
// and when existing hardware_init_hook() and software_init_hook() before
|
||||
// starting main(). software_init_hook() is available and has to be called due
|
||||
// to initializsation when using rtos.
|
||||
bl _start
|
||||
bx lr
|
||||
.size Reset_Handler, .-Reset_Handler
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@ define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
|||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x081FFFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_NVIC_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_NVIC_end__ = 0x200001AF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x200001B0;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x2002FFFF;
|
||||
define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000;
|
||||
define symbol __ICFEDIT_region_CCMRAM_end__ = 0x1000FFFF;
|
||||
|
|
|
@ -69,6 +69,16 @@ void timer_irq_handler(void) {
|
|||
|
||||
// Reconfigure the HAL tick using a standard timer instead of systick.
|
||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
uint32_t PclkFreq;
|
||||
|
||||
// Get clock configuration
|
||||
// Note: PclkFreq contains here the Latency (not used after)
|
||||
HAL_RCC_GetClockConfig(&RCC_ClkInitStruct, &PclkFreq);
|
||||
|
||||
// Get TIM5 clock value
|
||||
PclkFreq = HAL_RCC_GetPCLK1Freq();
|
||||
|
||||
// Enable timer clock
|
||||
TIM_MST_RCC;
|
||||
|
||||
|
@ -79,8 +89,14 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
|||
// Configure time base
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
TimMasterHandle.Init.Period = 0xFFFFFFFF;
|
||||
TimMasterHandle.Init.Prescaler = (uint32_t)( SystemCoreClock / 1000000) - 1; // 1 us tick
|
||||
TimMasterHandle.Init.ClockDivision = 0;
|
||||
|
||||
// TIMxCLK = PCLKx when the APB prescaler = 1 else TIMxCLK = 2 * PCLKx
|
||||
if (RCC_ClkInitStruct.APB1CLKDivider == RCC_HCLK_DIV1)
|
||||
TimMasterHandle.Init.Prescaler = (uint16_t)((PclkFreq) / 1000000) - 1; // 1 us tick
|
||||
else
|
||||
TimMasterHandle.Init.Prescaler = (uint16_t)((PclkFreq * 2) / 1000000) - 1; // 1 us tick
|
||||
|
||||
TimMasterHandle.Init.ClockDivision = 0;
|
||||
TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
TimMasterHandle.Init.RepetitionCounter = 0;
|
||||
HAL_TIM_OC_Init(&TimMasterHandle);
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
|
||||
#define HAL_TICK_DELAY (1000) // 1 ms
|
||||
|
||||
void HAL_SuspendTick(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -21,22 +21,20 @@
|
|||
* during program execution.
|
||||
*
|
||||
* This file configures the system clock as follows:
|
||||
*-----------------------------------------------------------------------------
|
||||
* System clock source | 1- PLL_HSE_EXTC | 3- PLL_HSI
|
||||
* | (external 8 MHz clock) | (internal 16 MHz)
|
||||
* | 2- PLL_HSE_XTAL |
|
||||
* | (external 8 MHz xtal) |
|
||||
*-----------------------------------------------------------------------------
|
||||
* SYSCLK(MHz) | 100 | 100
|
||||
*-----------------------------------------------------------------------------
|
||||
* AHBCLK (MHz) | 100 | 100
|
||||
*-----------------------------------------------------------------------------
|
||||
* APB1CLK (MHz) | 50 | 50
|
||||
*-----------------------------------------------------------------------------
|
||||
* APB2CLK (MHz) | 100 | 100
|
||||
*-----------------------------------------------------------------------------
|
||||
* USB capable (48 MHz precise clock) | NO | NO
|
||||
*-----------------------------------------------------------------------------
|
||||
*--------------------------------------------------------------------------------------
|
||||
* System clock source | PLL_HSE_XTAL | PLL_HSE_XTAL
|
||||
* | (external 8 MHz clock) | (external 8 MHz clock)
|
||||
*--------------------------------------------------------------------------------------
|
||||
* SYSCLK(MHz) | 168 | 180
|
||||
*--------------------------------------------------------------------------------------
|
||||
* AHBCLK (MHz) | 168 | 180
|
||||
*--------------------------------------------------------------------------------------
|
||||
* APB1CLK (MHz) | 42 | 45
|
||||
*--------------------------------------------------------------------------------------
|
||||
* APB2CLK (MHz) | 84 | 90
|
||||
*--------------------------------------------------------------------------------------
|
||||
* USB capable (48 MHz precise clock) | YES | NO
|
||||
*--------------------------------------------------------------------------------------
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
|
@ -137,9 +135,9 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/* Select the clock sources (other than HSI) to start with (0=OFF, 1=ON) */
|
||||
#define USE_PLL_HSE_EXTC (0) /* Use external clock */
|
||||
#define USE_PLL_HSE_XTAL (1) /* Use external xtal */
|
||||
/* Select the SYSCLOCK to start with (0=OFF, 1=ON) */
|
||||
#define USE_SYSCLOCK_168 (1) /* Use external 8MHz xtal and sets SYSCLK to 168MHz */
|
||||
#define USE_SYSCLOCK_180 (0) /* Use external 8MHz xtal and sets SYSCLK to 180MHz */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -156,7 +154,7 @@
|
|||
is no need to call the 2 first functions listed above, since SystemCoreClock
|
||||
variable is updated automatically.
|
||||
*/
|
||||
uint32_t SystemCoreClock = 16000000;
|
||||
uint32_t SystemCoreClock = 168000000;
|
||||
const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||
|
||||
/**
|
||||
|
@ -171,12 +169,7 @@ const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8,
|
|||
static void SystemInit_ExtMemCtl(void);
|
||||
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
|
||||
|
||||
#if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0)
|
||||
uint8_t SetSysClock_PLL_HSE(uint8_t bypass);
|
||||
#endif
|
||||
|
||||
uint8_t SetSysClock_PLL_HSI(void);
|
||||
|
||||
void SetSysClock(void);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -235,6 +228,7 @@ void SystemInit(void)
|
|||
/* Configure the System clock source, PLL Multiplier and Divider factors,
|
||||
AHB/APBx prescalers and Flash settings */
|
||||
SetSysClock();
|
||||
SystemCoreClockUpdate();
|
||||
|
||||
/* Reset the timer to avoid issues after the RAM initialization */
|
||||
TIM_MST_RESET_ON;
|
||||
|
@ -752,13 +746,11 @@ void SystemInit_ExtMemCtl(void)
|
|||
/* No pull-up, pull-down for PGx pins */
|
||||
GPIOG->PUPDR = 0x00000000;
|
||||
|
||||
/*-- FMC/FSMC Configuration --------------------------------------------------*/
|
||||
/*-- FMC/FSMC Configuration --------------------------------------------------*/
|
||||
/* Enable the FMC/FSMC interface clock */
|
||||
RCC->AHB3ENR |= 0x00000001;
|
||||
|
||||
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
|
||||
/* Delay after an RCC peripheral clock enabling */
|
||||
tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);
|
||||
|
||||
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
|
||||
/* Configure and enable Bank1_SRAM2 */
|
||||
FMC_Bank1->BTCR[2] = 0x00001011;
|
||||
FMC_Bank1->BTCR[3] = 0x00000201;
|
||||
|
@ -789,153 +781,86 @@ void SystemInit_ExtMemCtl(void)
|
|||
}
|
||||
#endif /* DATA_IN_ExtSRAM && DATA_IN_ExtSDRAM */
|
||||
|
||||
/**
|
||||
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
|
||||
* AHB/APBx prescalers and Flash settings
|
||||
* @note This function should be called only once the RCC clock configuration
|
||||
* is reset to the default reset state (done in SystemInit() function).
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
/** System Clock Configuration
|
||||
*/
|
||||
#if USE_SYSCLOCK_168 != 0
|
||||
/*
|
||||
* generated code by STM32CubeMX 4.4.0 for board 32F429Discovery
|
||||
* and SYSCLK=168MHZ
|
||||
*/
|
||||
void SetSysClock(void)
|
||||
{
|
||||
/* 1- Try to start with HSE and external clock */
|
||||
#if USE_PLL_HSE_EXTC != 0
|
||||
if (SetSysClock_PLL_HSE(1) == 0)
|
||||
#endif
|
||||
{
|
||||
/* 2- If fail try to start with HSE and external xtal */
|
||||
#if USE_PLL_HSE_XTAL != 0
|
||||
if (SetSysClock_PLL_HSE(0) == 0)
|
||||
#endif
|
||||
{
|
||||
/* 3- If fail start with HSI clock */
|
||||
if (SetSysClock_PLL_HSI() == 0)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
// [TODO] Put something here to tell the user that a problem occured...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
|
||||
__PWR_CLK_ENABLE();
|
||||
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 24;
|
||||
RCC_OscInitStruct.PLL.PLLN = 336;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 7;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1
|
||||
|RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
|
||||
|
||||
/* Output clock on MCO2 pin(PC9) for debugging purpose */
|
||||
//HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_4); // 100 MHz / 4 = 25 MHz
|
||||
// HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_3);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0)
|
||||
/******************************************************************************/
|
||||
/* PLL (clocked by HSE) used as System clock source */
|
||||
/******************************************************************************/
|
||||
uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||
#elif USE_SYSCLOCK_180 != 0
|
||||
/*
|
||||
* generated code by STM32CubeMX 4.4.0 for board 32F429Discovery
|
||||
* and SYSCLK=180MHZ
|
||||
*/
|
||||
void SetSysClock(void)
|
||||
{
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
|
||||
/* The voltage scaling allows optimizing the power consumption when the device is
|
||||
clocked below the maximum system frequency, to update the voltage scaling value
|
||||
regarding system frequency refer to product datasheet. */
|
||||
__PWR_CLK_ENABLE();
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
|
||||
|
||||
/* Enable HSE oscillator and activate PLL with HSE as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
if (bypass == 0)
|
||||
{
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; /* External 8 MHz xtal on OSC_IN/OSC_OUT */
|
||||
}
|
||||
else
|
||||
{
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; /* External 8 MHz clock on OSC_IN */
|
||||
}
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
//RCC_OscInitStruct.PLL.PLLM = 8; // VCO input clock = 1 MHz (8 MHz / 8)
|
||||
//RCC_OscInitStruct.PLL.PLLN = 400; // VCO output clock = 400 MHz (1 MHz * 400)
|
||||
//RCC_OscInitStruct.PLL.PLLM = 4; // VCO input clock = 2 MHz (8 MHz / 4)
|
||||
//RCC_OscInitStruct.PLL.PLLN = 200; // VCO output clock = 400 MHz (2 MHz * 200)
|
||||
#define VCO_IN_FREQ 2000000
|
||||
RCC_OscInitStruct.PLL.PLLM = (HSE_VALUE / VCO_IN_FREQ); // VCO input clock = 2 MHz = (24 MHz / 12)
|
||||
RCC_OscInitStruct.PLL.PLLN = (400000000 / VCO_IN_FREQ); // VCO output clock = 400 MHz = (2 MHz * 200)
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; // PLLCLK = 100 MHz (400 MHz / 4)
|
||||
RCC_OscInitStruct.PLL.PLLQ = 9; // USB clock = 44.44 MHz (400 MHz / 9) --> Not good for USB
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
|
||||
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 100 MHz
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 100 MHz
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; // 50 MHz
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 100 MHz
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK)
|
||||
{
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
/* Output clock on MCO1 pin(PA8) for debugging purpose */
|
||||
|
||||
//if (bypass == 0)
|
||||
// HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_2); // 4 MHz with xtal
|
||||
//else
|
||||
// HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1); // 8 MHz with external clock
|
||||
|
||||
return 1; // OK
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 8;
|
||||
RCC_OscInitStruct.PLL.PLLN = 360;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 7;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
|
||||
HAL_PWREx_ActivateOverDrive();
|
||||
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1
|
||||
|RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
|
||||
|
||||
// HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_3);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/* PLL (clocked by HSI) used as System clock source */
|
||||
/******************************************************************************/
|
||||
uint8_t SetSysClock_PLL_HSI(void)
|
||||
{
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
|
||||
/* The voltage scaling allows optimizing the power consumption when the device is
|
||||
clocked below the maximum system frequency, to update the voltage scaling value
|
||||
regarding system frequency refer to product datasheet. */
|
||||
__PWR_CLK_ENABLE();
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
|
||||
|
||||
/* Enable HSI oscillator and activate PLL with HSI as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
||||
RCC_OscInitStruct.HSICalibrationValue = 16;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
|
||||
//RCC_OscInitStruct.PLL.PLLM = 16; // VCO input clock = 1 MHz (16 MHz / 16)
|
||||
//RCC_OscInitStruct.PLL.PLLN = 400; // VCO output clock = 400 MHz (1 MHz * 400)
|
||||
RCC_OscInitStruct.PLL.PLLM = 8; // VCO input clock = 2 MHz (16 MHz / 8)
|
||||
RCC_OscInitStruct.PLL.PLLN = 200; // VCO output clock = 400 MHz (2 MHz * 200)
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; // PLLCLK = 100 MHz (400 MHz / 4)
|
||||
RCC_OscInitStruct.PLL.PLLQ = 9; // USB clock = 44.44 MHz (400 MHz / 9) --> Not good for USB
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
|
||||
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 100 MHz
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 100 MHz
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; // 50 MHz
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 100 MHz
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK)
|
||||
{
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
/* Output clock on MCO1 pin(PA8) for debugging purpose */
|
||||
//HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); // 16 MHz
|
||||
|
||||
return 1; // OK
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -943,8 +868,8 @@ uint8_t SetSysClock_PLL_HSI(void)
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -1297,7 +1297,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hi2c);
|
||||
|
||||
|
||||
return HAL_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
@ -1321,7 +1321,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
hi2c->Devaddress = DevAddress;
|
||||
|
||||
Prev_State = hi2c->PreviousState;
|
||||
|
||||
|
||||
/* Generate Start */
|
||||
if((Prev_State == I2C_STATE_MASTER_BUSY_RX) || (Prev_State == I2C_STATE_NONE))
|
||||
{
|
||||
|
@ -3689,7 +3689,7 @@ static HAL_StatusTypeDef I2C_MasterTransmit_TXE(I2C_HandleTypeDef *hi2c)
|
|||
|
||||
/* Generate Stop */
|
||||
hi2c->Instance->CR1 |= I2C_CR1_STOP;
|
||||
|
||||
|
||||
hi2c->PreviousState = I2C_STATE_NONE;
|
||||
hi2c->State = HAL_I2C_STATE_READY;
|
||||
|
||||
|
@ -3840,6 +3840,7 @@ static HAL_StatusTypeDef I2C_MasterTransmit_BTF(I2C_HandleTypeDef *hi2c)
|
|||
*/
|
||||
static HAL_StatusTypeDef I2C_MasterReceive_RXNE(I2C_HandleTypeDef *hi2c)
|
||||
{
|
||||
|
||||
if(hi2c->State == HAL_I2C_STATE_BUSY_RX)
|
||||
{
|
||||
uint32_t tmp = 0U;
|
||||
|
@ -3853,34 +3854,24 @@ static HAL_StatusTypeDef I2C_MasterReceive_RXNE(I2C_HandleTypeDef *hi2c)
|
|||
}
|
||||
else if((tmp == 2U) || (tmp == 3U))
|
||||
{
|
||||
if(hi2c->XferOptions != I2C_NEXT_FRAME)
|
||||
{
|
||||
/* Disable Acknowledge */
|
||||
hi2c->Instance->CR1 &= ~I2C_CR1_ACK;
|
||||
|
||||
/* Enable Pos */
|
||||
hi2c->Instance->CR1 |= I2C_CR1_POS;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Enable Acknowledge */
|
||||
hi2c->Instance->CR1 |= I2C_CR1_ACK;
|
||||
}
|
||||
/* Disable Acknowledge */
|
||||
hi2c->Instance->CR1 &= ~I2C_CR1_ACK;
|
||||
|
||||
/* Enable Pos */
|
||||
hi2c->Instance->CR1 |= I2C_CR1_POS;
|
||||
|
||||
/* Disable BUF interrupt */
|
||||
__HAL_I2C_DISABLE_IT(hi2c, I2C_IT_BUF);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(hi2c->XferOptions != I2C_NEXT_FRAME)
|
||||
/* Disable Acknowledge */
|
||||
hi2c->Instance->CR1 &= ~I2C_CR1_ACK;
|
||||
|
||||
if(hi2c->XferOptions == I2C_NEXT_FRAME)
|
||||
{
|
||||
/* Disable Acknowledge */
|
||||
hi2c->Instance->CR1 &= ~I2C_CR1_ACK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Enable Acknowledge */
|
||||
hi2c->Instance->CR1 |= I2C_CR1_ACK;
|
||||
/* Enable Pos */
|
||||
hi2c->Instance->CR1 |= I2C_CR1_POS;
|
||||
}
|
||||
|
||||
/* Disable EVT, BUF and ERR interrupt */
|
||||
|
@ -3938,15 +3929,13 @@ static HAL_StatusTypeDef I2C_MasterReceive_BTF(I2C_HandleTypeDef *hi2c)
|
|||
/* Prepare next transfer or stop current transfer */
|
||||
if((CurrentXferOptions != I2C_FIRST_AND_LAST_FRAME) && (CurrentXferOptions != I2C_LAST_FRAME) && (CurrentXferOptions != I2C_NO_OPTION_FRAME))
|
||||
{
|
||||
if(CurrentXferOptions != I2C_NEXT_FRAME)
|
||||
/* Disable Acknowledge */
|
||||
hi2c->Instance->CR1 &= ~I2C_CR1_ACK;
|
||||
|
||||
if((CurrentXferOptions == I2C_NEXT_FRAME) || (CurrentXferOptions == I2C_FIRST_FRAME))
|
||||
{
|
||||
/* Disable Acknowledge */
|
||||
hi2c->Instance->CR1 &= ~I2C_CR1_ACK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Enable Acknowledge */
|
||||
hi2c->Instance->CR1 |= I2C_CR1_ACK;
|
||||
/* Generate Start */
|
||||
hi2c->Instance->CR1 |= I2C_CR1_START;
|
||||
}
|
||||
tmp = (uint32_t)(hi2c->State) & I2C_STATE_MSK;
|
||||
hi2c->PreviousState = tmp | (uint32_t)(hi2c->Mode);
|
||||
|
|
|
@ -2450,6 +2450,7 @@ static void SPI_TxISR_8BIT(struct __SPI_HandleTypeDef *hspi)
|
|||
SET_BIT(hspi->Instance->CR1, SPI_CR1_CRCNEXT);
|
||||
}
|
||||
#endif /* USE_SPI_CRC */
|
||||
__HAL_SPI_DISABLE_IT(hspi, (SPI_IT_TXE));
|
||||
SPI_CloseTx_ISR(hspi);
|
||||
}
|
||||
}
|
||||
|
@ -2476,6 +2477,7 @@ static void SPI_TxISR_16BIT(struct __SPI_HandleTypeDef *hspi)
|
|||
SET_BIT(hspi->Instance->CR1, SPI_CR1_CRCNEXT);
|
||||
}
|
||||
#endif /* USE_SPI_CRC */
|
||||
__HAL_SPI_DISABLE_IT(hspi, (SPI_IT_TXE));
|
||||
SPI_CloseTx_ISR(hspi);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,334 @@
|
|||
;******************** (C) COPYRIGHT 2016 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32l151xc.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V2.2.0
|
||||
;* Date : 01-July-2016
|
||||
;* Description : STM32L151XC Devices vector for MDK-ARM 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 system clock
|
||||
;* - Branches to __main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the Cortex-M3 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;********************************************************************************
|
||||
;*
|
||||
;* COPYRIGHT(c) 2016 STMicroelectronics
|
||||
;*
|
||||
;* Redistribution and use in source and binary forms, with or without modification,
|
||||
;* are permitted provided that the following conditions are met:
|
||||
;* 1. Redistributions of source code must retain the above copyright notice,
|
||||
;* this list of conditions and the following disclaimer.
|
||||
;* 2. 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.
|
||||
;* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
;
|
||||
;*******************************************************************************
|
||||
;
|
||||
; Amount of memory (in bytes) allocated for Stack
|
||||
; Tailor this value to your application needs
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x00000400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
EXPORT __initial_sp
|
||||
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp EQU 0x20008000 ; Top of RAM (32 KB)
|
||||
|
||||
|
||||
; <h> Heap Configuration
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x00000200
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit EQU (__initial_sp - Stack_Size)
|
||||
|
||||
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_STAMP_IRQHandler ; Tamper and Time Stamp
|
||||
DCD RTC_WKUP_IRQHandler ; RTC Wakeup
|
||||
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_IRQHandler ; ADC1
|
||||
DCD USB_HP_IRQHandler ; USB High Priority
|
||||
DCD USB_LP_IRQHandler ; USB Low Priority
|
||||
DCD DAC_IRQHandler ; DAC
|
||||
DCD COMP_IRQHandler ; COMP through EXTI Line
|
||||
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
|
||||
DCD 0 ; Reserved
|
||||
DCD TIM9_IRQHandler ; TIM9
|
||||
DCD TIM10_IRQHandler ; TIM10
|
||||
DCD TIM11_IRQHandler ; TIM11
|
||||
DCD TIM2_IRQHandler ; TIM2
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM4_IRQHandler ; TIM4
|
||||
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 RTC_Alarm_IRQHandler ; RTC Alarm through EXTI Line
|
||||
DCD USB_FS_WKUP_IRQHandler ; USB FS Wakeup from suspend
|
||||
DCD TIM6_IRQHandler ; TIM6
|
||||
DCD TIM7_IRQHandler ; TIM7
|
||||
DCD 0 ; Reserved
|
||||
DCD TIM5_IRQHandler ; TIM5
|
||||
DCD SPI3_IRQHandler ; SPI3
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD DMA2_Channel1_IRQHandler ; DMA2 Channel 1
|
||||
DCD DMA2_Channel2_IRQHandler ; DMA2 Channel 2
|
||||
DCD DMA2_Channel3_IRQHandler ; DMA2 Channel 3
|
||||
DCD DMA2_Channel4_IRQHandler ; DMA2 Channel 4
|
||||
DCD DMA2_Channel5_IRQHandler ; DMA2 Channel 5
|
||||
DCD 0 ; Reserved
|
||||
DCD COMP_ACQ_IRQHandler ; Comparator Channel Acquisition
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset handler routine
|
||||
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_STAMP_IRQHandler [WEAK]
|
||||
EXPORT RTC_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_IRQHandler [WEAK]
|
||||
EXPORT USB_HP_IRQHandler [WEAK]
|
||||
EXPORT USB_LP_IRQHandler [WEAK]
|
||||
EXPORT DAC_IRQHandler [WEAK]
|
||||
EXPORT COMP_IRQHandler [WEAK]
|
||||
EXPORT EXTI9_5_IRQHandler [WEAK]
|
||||
EXPORT TIM9_IRQHandler [WEAK]
|
||||
EXPORT TIM10_IRQHandler [WEAK]
|
||||
EXPORT TIM11_IRQHandler [WEAK]
|
||||
EXPORT TIM2_IRQHandler [WEAK]
|
||||
EXPORT TIM3_IRQHandler [WEAK]
|
||||
EXPORT TIM4_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 RTC_Alarm_IRQHandler [WEAK]
|
||||
EXPORT USB_FS_WKUP_IRQHandler [WEAK]
|
||||
EXPORT TIM6_IRQHandler [WEAK]
|
||||
EXPORT TIM7_IRQHandler [WEAK]
|
||||
EXPORT TIM5_IRQHandler [WEAK]
|
||||
EXPORT SPI3_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel2_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel3_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel4_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel5_IRQHandler [WEAK]
|
||||
EXPORT COMP_ACQ_IRQHandler [WEAK]
|
||||
|
||||
WWDG_IRQHandler
|
||||
PVD_IRQHandler
|
||||
TAMPER_STAMP_IRQHandler
|
||||
RTC_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_IRQHandler
|
||||
USB_HP_IRQHandler
|
||||
USB_LP_IRQHandler
|
||||
DAC_IRQHandler
|
||||
COMP_IRQHandler
|
||||
EXTI9_5_IRQHandler
|
||||
TIM9_IRQHandler
|
||||
TIM10_IRQHandler
|
||||
TIM11_IRQHandler
|
||||
TIM2_IRQHandler
|
||||
TIM3_IRQHandler
|
||||
TIM4_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
|
||||
RTC_Alarm_IRQHandler
|
||||
USB_FS_WKUP_IRQHandler
|
||||
TIM6_IRQHandler
|
||||
TIM7_IRQHandler
|
||||
TIM5_IRQHandler
|
||||
SPI3_IRQHandler
|
||||
DMA2_Channel1_IRQHandler
|
||||
DMA2_Channel2_IRQHandler
|
||||
DMA2_Channel3_IRQHandler
|
||||
DMA2_Channel4_IRQHandler
|
||||
DMA2_Channel5_IRQHandler
|
||||
COMP_ACQ_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
END
|
|
@ -0,0 +1,45 @@
|
|||
; Scatter-Loading Description File
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Copyright (c) 2015, STMicroelectronics
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright notice,
|
||||
; this list of conditions and the following disclaimer.
|
||||
; 2. 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.
|
||||
; 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; STM32L151RC: 256KB FLASH + 32KB SRAM
|
||||
LR_IROM1 0x08000000 0x40000 { ; load region size_region
|
||||
|
||||
ER_IROM1 0x08000000 0x40000 { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
|
||||
; 73 vectors = 292 bytes (0x124) to be reserved in RAM
|
||||
RW_IRAM1 (0x20000000+0x124) (0x8000-0x124) { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,313 @@
|
|||
;******************** (C) COPYRIGHT 2016 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32l151xc.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V2.2.0
|
||||
;* Date : 01-July-2016
|
||||
;* Description : STM32L151XC Devices vector for MDK-ARM 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 system clock
|
||||
;* - Branches to __main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the Cortex-M3 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;********************************************************************************
|
||||
;*
|
||||
;* COPYRIGHT(c) 2016 STMicroelectronics
|
||||
;*
|
||||
;* Redistribution and use in source and binary forms, with or without modification,
|
||||
;* are permitted provided that the following conditions are met:
|
||||
;* 1. Redistributions of source code must retain the above copyright notice,
|
||||
;* this list of conditions and the following disclaimer.
|
||||
;* 2. 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.
|
||||
;* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
;
|
||||
;*******************************************************************************
|
||||
;
|
||||
; Amount of memory (in bytes) allocated for Stack
|
||||
; Tailor this value to your application needs
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
__initial_sp EQU 0x20008000 ; Top of RAM (32 KB)
|
||||
|
||||
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_STAMP_IRQHandler ; Tamper and Time Stamp
|
||||
DCD RTC_WKUP_IRQHandler ; RTC Wakeup
|
||||
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_IRQHandler ; ADC1
|
||||
DCD USB_HP_IRQHandler ; USB High Priority
|
||||
DCD USB_LP_IRQHandler ; USB Low Priority
|
||||
DCD DAC_IRQHandler ; DAC
|
||||
DCD COMP_IRQHandler ; COMP through EXTI Line
|
||||
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
|
||||
DCD 0 ; Reserved
|
||||
DCD TIM9_IRQHandler ; TIM9
|
||||
DCD TIM10_IRQHandler ; TIM10
|
||||
DCD TIM11_IRQHandler ; TIM11
|
||||
DCD TIM2_IRQHandler ; TIM2
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM4_IRQHandler ; TIM4
|
||||
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 RTC_Alarm_IRQHandler ; RTC Alarm through EXTI Line
|
||||
DCD USB_FS_WKUP_IRQHandler ; USB FS Wakeup from suspend
|
||||
DCD TIM6_IRQHandler ; TIM6
|
||||
DCD TIM7_IRQHandler ; TIM7
|
||||
DCD 0 ; Reserved
|
||||
DCD TIM5_IRQHandler ; TIM5
|
||||
DCD SPI3_IRQHandler ; SPI3
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD DMA2_Channel1_IRQHandler ; DMA2 Channel 1
|
||||
DCD DMA2_Channel2_IRQHandler ; DMA2 Channel 2
|
||||
DCD DMA2_Channel3_IRQHandler ; DMA2 Channel 3
|
||||
DCD DMA2_Channel4_IRQHandler ; DMA2 Channel 4
|
||||
DCD DMA2_Channel5_IRQHandler ; DMA2 Channel 5
|
||||
DCD 0 ; Reserved
|
||||
DCD COMP_ACQ_IRQHandler ; Comparator Channel Acquisition
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset handler routine
|
||||
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_STAMP_IRQHandler [WEAK]
|
||||
EXPORT RTC_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_IRQHandler [WEAK]
|
||||
EXPORT USB_HP_IRQHandler [WEAK]
|
||||
EXPORT USB_LP_IRQHandler [WEAK]
|
||||
EXPORT DAC_IRQHandler [WEAK]
|
||||
EXPORT COMP_IRQHandler [WEAK]
|
||||
EXPORT EXTI9_5_IRQHandler [WEAK]
|
||||
EXPORT TIM9_IRQHandler [WEAK]
|
||||
EXPORT TIM10_IRQHandler [WEAK]
|
||||
EXPORT TIM11_IRQHandler [WEAK]
|
||||
EXPORT TIM2_IRQHandler [WEAK]
|
||||
EXPORT TIM3_IRQHandler [WEAK]
|
||||
EXPORT TIM4_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 RTC_Alarm_IRQHandler [WEAK]
|
||||
EXPORT USB_FS_WKUP_IRQHandler [WEAK]
|
||||
EXPORT TIM6_IRQHandler [WEAK]
|
||||
EXPORT TIM7_IRQHandler [WEAK]
|
||||
EXPORT TIM5_IRQHandler [WEAK]
|
||||
EXPORT SPI3_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel2_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel3_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel4_IRQHandler [WEAK]
|
||||
EXPORT DMA2_Channel5_IRQHandler [WEAK]
|
||||
EXPORT COMP_ACQ_IRQHandler [WEAK]
|
||||
|
||||
WWDG_IRQHandler
|
||||
PVD_IRQHandler
|
||||
TAMPER_STAMP_IRQHandler
|
||||
RTC_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_IRQHandler
|
||||
USB_HP_IRQHandler
|
||||
USB_LP_IRQHandler
|
||||
DAC_IRQHandler
|
||||
COMP_IRQHandler
|
||||
EXTI9_5_IRQHandler
|
||||
TIM9_IRQHandler
|
||||
TIM10_IRQHandler
|
||||
TIM11_IRQHandler
|
||||
TIM2_IRQHandler
|
||||
TIM3_IRQHandler
|
||||
TIM4_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
|
||||
RTC_Alarm_IRQHandler
|
||||
USB_FS_WKUP_IRQHandler
|
||||
TIM6_IRQHandler
|
||||
TIM7_IRQHandler
|
||||
TIM5_IRQHandler
|
||||
SPI3_IRQHandler
|
||||
DMA2_Channel1_IRQHandler
|
||||
DMA2_Channel2_IRQHandler
|
||||
DMA2_Channel3_IRQHandler
|
||||
DMA2_Channel4_IRQHandler
|
||||
DMA2_Channel5_IRQHandler
|
||||
COMP_ACQ_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
END
|
|
@ -0,0 +1,45 @@
|
|||
; Scatter-Loading Description File
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Copyright (c) 2015, STMicroelectronics
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
;
|
||||
; 1. Redistributions of source code must retain the above copyright notice,
|
||||
; this list of conditions and the following disclaimer.
|
||||
; 2. 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.
|
||||
; 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; STM32L151RC: 256KB FLASH + 32KB SRAM
|
||||
LR_IROM1 0x08000000 0x40000 { ; load region size_region
|
||||
|
||||
ER_IROM1 0x08000000 0x40000 { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
|
||||
; 73 vectors = 292 bytes (0x124) to be reserved in RAM
|
||||
RW_IRAM1 (0x20000000+0x124) (0x8000-0x124) { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
/* mbed Microcontroller Library - stackheap
|
||||
* Setup a fixed single stack/heap memory model,
|
||||
* between the top of the RW/ZI region and the stackpointer
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2015, STMicroelectronics
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rt_misc.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern char Image$$RW_IRAM1$$ZI$$Limit[];
|
||||
|
||||
extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
|
||||
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
|
||||
uint32_t sp_limit = __current_sp();
|
||||
|
||||
zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
|
||||
|
||||
struct __initial_stackheap r;
|
||||
r.heap_base = zi_limit;
|
||||
r.heap_limit = sp_limit;
|
||||
return r;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,157 @@
|
|||
/* Linker script to configure memory regions. */
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* 256KB FLASH, 32KB RAM, Reserve up till 0x13C. There are 0x73 vectors = 292
|
||||
* bytes (0x124) in RAM. But all GCC scripts seem to require BootRAM @0x138
|
||||
*/
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256k
|
||||
RAM (rwx) : ORIGIN = 0x2000013C, LENGTH = 0x8000-0x13C
|
||||
}
|
||||
|
||||
/* 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
|
||||
* __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
|
||||
* _estack
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.isr_vector))
|
||||
*(.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)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
__etext = .;
|
||||
_sidata = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
_sdata = .;
|
||||
*(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);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
_edata = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
_sbss = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
_ebss = .;
|
||||
} > RAM
|
||||
|
||||
.heap (COPY):
|
||||
{
|
||||
__end__ = .;
|
||||
end = __end__;
|
||||
*(.heap*)
|
||||
__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 (COPY):
|
||||
{
|
||||
*(.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);
|
||||
_estack = __StackTop;
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
|
@ -0,0 +1,418 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file startup_stm32l151xc.s
|
||||
* @author MCD Application Team
|
||||
* @version V2.2.0
|
||||
* @date 01-July-2016
|
||||
* @brief STM32L151XC Devices vector table for
|
||||
* Atollic 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
|
||||
* - Branches to main in the C library (which eventually
|
||||
* calls main()).
|
||||
* After Reset the Cortex-M3 processor is in Thread mode,
|
||||
* priority is Privileged, and the Stack is set to Main.
|
||||
******************************************************************************
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
.syntax unified
|
||||
.cpu cortex-m3
|
||||
.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
|
||||
|
||||
.equ BootRAM, 0xF108F85F
|
||||
/**
|
||||
* @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 static constructors */
|
||||
//bl __libc_init_array
|
||||
/* Call the application's entry point.*/
|
||||
//bl main
|
||||
bl _start
|
||||
.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
|
||||
.word WWDG_IRQHandler
|
||||
.word PVD_IRQHandler
|
||||
.word TAMPER_STAMP_IRQHandler
|
||||
.word RTC_WKUP_IRQHandler
|
||||
.word FLASH_IRQHandler
|
||||
.word RCC_IRQHandler
|
||||
.word EXTI0_IRQHandler
|
||||
.word EXTI1_IRQHandler
|
||||
.word EXTI2_IRQHandler
|
||||
.word EXTI3_IRQHandler
|
||||
.word EXTI4_IRQHandler
|
||||
.word DMA1_Channel1_IRQHandler
|
||||
.word DMA1_Channel2_IRQHandler
|
||||
.word DMA1_Channel3_IRQHandler
|
||||
.word DMA1_Channel4_IRQHandler
|
||||
.word DMA1_Channel5_IRQHandler
|
||||
.word DMA1_Channel6_IRQHandler
|
||||
.word DMA1_Channel7_IRQHandler
|
||||
.word ADC1_IRQHandler
|
||||
.word USB_HP_IRQHandler
|
||||
.word USB_LP_IRQHandler
|
||||
.word DAC_IRQHandler
|
||||
.word COMP_IRQHandler
|
||||
.word EXTI9_5_IRQHandler
|
||||
.word 0
|
||||
.word TIM9_IRQHandler
|
||||
.word TIM10_IRQHandler
|
||||
.word TIM11_IRQHandler
|
||||
.word TIM2_IRQHandler
|
||||
.word TIM3_IRQHandler
|
||||
.word TIM4_IRQHandler
|
||||
.word I2C1_EV_IRQHandler
|
||||
.word I2C1_ER_IRQHandler
|
||||
.word I2C2_EV_IRQHandler
|
||||
.word I2C2_ER_IRQHandler
|
||||
.word SPI1_IRQHandler
|
||||
.word SPI2_IRQHandler
|
||||
.word USART1_IRQHandler
|
||||
.word USART2_IRQHandler
|
||||
.word USART3_IRQHandler
|
||||
.word EXTI15_10_IRQHandler
|
||||
.word RTC_Alarm_IRQHandler
|
||||
.word USB_FS_WKUP_IRQHandler
|
||||
.word TIM6_IRQHandler
|
||||
.word TIM7_IRQHandler
|
||||
.word 0
|
||||
.word TIM5_IRQHandler
|
||||
.word SPI3_IRQHandler
|
||||
.word 0
|
||||
.word 0
|
||||
.word DMA2_Channel1_IRQHandler
|
||||
.word DMA2_Channel2_IRQHandler
|
||||
.word DMA2_Channel3_IRQHandler
|
||||
.word DMA2_Channel4_IRQHandler
|
||||
.word DMA2_Channel5_IRQHandler
|
||||
.word 0
|
||||
.word COMP_ACQ_IRQHandler
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word BootRAM /* @0x108. This is for boot in RAM mode for
|
||||
STM32L151XC devices. */
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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_STAMP_IRQHandler
|
||||
.thumb_set TAMPER_STAMP_IRQHandler,Default_Handler
|
||||
|
||||
.weak RTC_WKUP_IRQHandler
|
||||
.thumb_set RTC_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_IRQHandler
|
||||
.thumb_set ADC1_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 DAC_IRQHandler
|
||||
.thumb_set DAC_IRQHandler,Default_Handler
|
||||
|
||||
.weak COMP_IRQHandler
|
||||
.thumb_set COMP_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI9_5_IRQHandler
|
||||
.thumb_set EXTI9_5_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM9_IRQHandler
|
||||
.thumb_set TIM9_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM10_IRQHandler
|
||||
.thumb_set TIM10_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM11_IRQHandler
|
||||
.thumb_set TIM11_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM2_IRQHandler
|
||||
.thumb_set TIM2_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM3_IRQHandler
|
||||
.thumb_set TIM3_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM4_IRQHandler
|
||||
.thumb_set TIM4_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 RTC_Alarm_IRQHandler
|
||||
.thumb_set RTC_Alarm_IRQHandler,Default_Handler
|
||||
|
||||
.weak USB_FS_WKUP_IRQHandler
|
||||
.thumb_set USB_FS_WKUP_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM6_IRQHandler
|
||||
.thumb_set TIM6_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM7_IRQHandler
|
||||
.thumb_set TIM7_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM5_IRQHandler
|
||||
.thumb_set TIM5_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI3_IRQHandler
|
||||
.thumb_set SPI3_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_IRQHandler
|
||||
.thumb_set DMA2_Channel4_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA2_Channel5_IRQHandler
|
||||
.thumb_set DMA2_Channel5_IRQHandler,Default_Handler
|
||||
|
||||
.weak COMP_ACQ_IRQHandler
|
||||
.thumb_set COMP_ACQ_IRQHandler,Default_Handler
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,536 @@
|
|||
;/******************** (C) COPYRIGHT 2016 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32l152xc.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V2.2.0
|
||||
;* Date : 01-July-2016
|
||||
;* Description : STM32L152XC Devices vector for EWARM toolchain.
|
||||
;* This module performs:
|
||||
;* - Set the initial SP
|
||||
;* - Set the initial PC == __iar_program_start,
|
||||
;* - Set the vector table entries with the exceptions ISR
|
||||
;* address.
|
||||
;* - Configure the system clock
|
||||
;* - Branches to main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the Cortex-M3 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;********************************************************************************
|
||||
;*
|
||||
;* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
||||
;*
|
||||
;* Redistribution and use in source and binary forms, with or without modification,
|
||||
;* are permitted provided that the following conditions are met:
|
||||
;* 1. Redistributions of source code must retain the above copyright notice,
|
||||
;* this list of conditions and the following disclaimer.
|
||||
;* 2. 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.
|
||||
;* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
;*
|
||||
;*******************************************************************************
|
||||
;
|
||||
;
|
||||
; 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: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_STAMP_IRQHandler ; Tamper and Time Stamp
|
||||
DCD RTC_WKUP_IRQHandler ; RTC Wakeup
|
||||
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_IRQHandler ; ADC1
|
||||
DCD USB_HP_IRQHandler ; USB High Priority
|
||||
DCD USB_LP_IRQHandler ; USB Low Priority
|
||||
DCD DAC_IRQHandler ; DAC
|
||||
DCD COMP_IRQHandler ; COMP through EXTI Line
|
||||
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
|
||||
DCD LCD_IRQHandler ; LCD
|
||||
DCD TIM9_IRQHandler ; TIM9
|
||||
DCD TIM10_IRQHandler ; TIM10
|
||||
DCD TIM11_IRQHandler ; TIM11
|
||||
DCD TIM2_IRQHandler ; TIM2
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM4_IRQHandler ; TIM4
|
||||
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 RTC_Alarm_IRQHandler ; RTC Alarm through EXTI Line
|
||||
DCD USB_FS_WKUP_IRQHandler ; USB FS Wakeup from suspend
|
||||
DCD TIM6_IRQHandler ; TIM6
|
||||
DCD TIM7_IRQHandler ; TIM7
|
||||
DCD 0 ; Reserved
|
||||
DCD TIM5_IRQHandler ; TIM5
|
||||
DCD SPI3_IRQHandler ; SPI3
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD DMA2_Channel1_IRQHandler ; DMA2 Channel 1
|
||||
DCD DMA2_Channel2_IRQHandler ; DMA2 Channel 2
|
||||
DCD DMA2_Channel3_IRQHandler ; DMA2 Channel 3
|
||||
DCD DMA2_Channel4_IRQHandler ; DMA2 Channel 4
|
||||
DCD DMA2_Channel5_IRQHandler ; DMA2 Channel 5
|
||||
DCD 0 ; Reserved
|
||||
DCD COMP_ACQ_IRQHandler ; Comparator Channel Acquisition
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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_STAMP_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TAMPER_STAMP_IRQHandler
|
||||
B TAMPER_STAMP_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK RTC_WKUP_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
RTC_WKUP_IRQHandler
|
||||
B RTC_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_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ADC1_IRQHandler
|
||||
B ADC1_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 DAC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DAC_IRQHandler
|
||||
B DAC_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK COMP_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
COMP_IRQHandler
|
||||
B COMP_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK EXTI9_5_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
EXTI9_5_IRQHandler
|
||||
B EXTI9_5_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK LCD_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LCD_IRQHandler
|
||||
B LCD_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK TIM9_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIM9_IRQHandler
|
||||
B TIM9_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK TIM10_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIM10_IRQHandler
|
||||
B TIM10_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK TIM11_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIM11_IRQHandler
|
||||
B TIM11_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK TIM2_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIM2_IRQHandler
|
||||
B TIM2_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK TIM3_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIM3_IRQHandler
|
||||
B TIM3_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK TIM4_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIM4_IRQHandler
|
||||
B TIM4_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 RTC_Alarm_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
RTC_Alarm_IRQHandler
|
||||
B RTC_Alarm_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK USB_FS_WKUP_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USB_FS_WKUP_IRQHandler
|
||||
B USB_FS_WKUP_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK TIM6_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIM6_IRQHandler
|
||||
B TIM6_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK TIM7_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIM7_IRQHandler
|
||||
B TIM7_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK TIM5_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIM5_IRQHandler
|
||||
B TIM5_IRQHandler
|
||||
|
||||
PUBWEAK SPI3_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
SPI3_IRQHandler
|
||||
B SPI3_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_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DMA2_Channel4_IRQHandler
|
||||
B DMA2_Channel4_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK DMA2_Channel5_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DMA2_Channel5_IRQHandler
|
||||
B DMA2_Channel5_IRQHandler
|
||||
|
||||
|
||||
PUBWEAK COMP_ACQ_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
COMP_ACQ_IRQHandler
|
||||
B COMP_ACQ_IRQHandler
|
||||
|
||||
END
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,30 @@
|
|||
/* [ROM = 256kb = 0x40000] */
|
||||
define symbol __intvec_start__ = 0x08000000;
|
||||
define symbol __region_ROM_start__ = 0x08000000;
|
||||
define symbol __region_ROM_end__ = 0x0803FFFF;
|
||||
|
||||
/* [RAM = 32kb = 0x8000] Vector table dynamic copy: 73 vectors = 292 bytes (0x124) to be reserved in RAM */
|
||||
define symbol __NVIC_start__ = 0x20000000;
|
||||
define symbol __NVIC_end__ = 0x20000127; /* Add 4 more bytes to be aligned on 8 bytes */
|
||||
define symbol __region_RAM_start__ = 0x20000128;
|
||||
define symbol __region_RAM_end__ = 0x20007FFF;
|
||||
|
||||
/* Memory regions */
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __region_ROM_start__ to __region_ROM_end__];
|
||||
define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM_end__];
|
||||
|
||||
/* Stack and Heap */
|
||||
define symbol __size_cstack__ = 0x800;
|
||||
define symbol __size_heap__ = 0x800;
|
||||
define block CSTACK with alignment = 8, size = __size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __size_heap__ { };
|
||||
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
|
||||
|
||||
initialize by copy with packing = zeros { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite, block STACKHEAP };
|
|
@ -0,0 +1,38 @@
|
|||
/* mbed Microcontroller Library
|
||||
* A generic CMSIS include header
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2015, STMicroelectronics
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef MBED_CMSIS_H
|
||||
#define MBED_CMSIS_H
|
||||
|
||||
#include "stm32l1xx.h"
|
||||
#include "cmsis_nvic.h"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,55 @@
|
|||
/* mbed Microcontroller Library
|
||||
* CMSIS-style functionality to support dynamic vectors
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2015, STMicroelectronics
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*******************************************************************************
|
||||
*/
|
||||
#include "cmsis_nvic.h"
|
||||
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
uint32_t *vectors = (uint32_t *)SCB->VTOR;
|
||||
uint32_t i;
|
||||
|
||||
// Copy and switch to dynamic vectors if the first time called
|
||||
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
|
||||
uint32_t *old_vectors = vectors;
|
||||
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
||||
for (i=0; i<NVIC_NUM_VECTORS; i++) {
|
||||
vectors[i] = old_vectors[i];
|
||||
}
|
||||
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
|
||||
}
|
||||
vectors[IRQn + NVIC_USER_IRQ_OFFSET] = vector;
|
||||
}
|
||||
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
|
||||
uint32_t *vectors = (uint32_t*)SCB->VTOR;
|
||||
return vectors[IRQn + NVIC_USER_IRQ_OFFSET];
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/* mbed Microcontroller Library
|
||||
* CMSIS-style functionality to support dynamic vectors
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2015, STMicroelectronics
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef MBED_CMSIS_NVIC_H
|
||||
#define MBED_CMSIS_NVIC_H
|
||||
|
||||
// STM32L151CC
|
||||
// CORE: 16 vectors = 64 bytes from 0x00 to 0x3F
|
||||
// MCU Peripherals: 57 vectors = 228 bytes from 0x40 to 0x123
|
||||
// Total: 73 vectors = 292 bytes (0x124) to be reserved in RAM
|
||||
#define NVIC_NUM_VECTORS 73
|
||||
#define NVIC_USER_IRQ_OFFSET 16
|
||||
|
||||
#include "cmsis.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,141 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file hal_tick.c
|
||||
* @author MCD Application Team
|
||||
* @brief Initialization of HAL tick
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
#include "hal_tick.h"
|
||||
|
||||
TIM_HandleTypeDef TimMasterHandle;
|
||||
uint32_t PreviousVal = 0;
|
||||
|
||||
void us_ticker_irq_handler(void);
|
||||
|
||||
void timer_irq_handler(void) {
|
||||
// Channel 1 for mbed timeout
|
||||
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) {
|
||||
if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC1) == SET) {
|
||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
|
||||
us_ticker_irq_handler();
|
||||
}
|
||||
}
|
||||
|
||||
// Channel 2 for HAL tick
|
||||
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC2) == SET) {
|
||||
if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC2) == SET) {
|
||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2);
|
||||
uint32_t val = __HAL_TIM_GetCounter(&TimMasterHandle);
|
||||
if ((val - PreviousVal) >= HAL_TICK_DELAY) {
|
||||
// Increment HAL variable
|
||||
HAL_IncTick();
|
||||
// Prepare next interrupt
|
||||
__HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_2, val + HAL_TICK_DELAY);
|
||||
PreviousVal = val;
|
||||
#if 0 // For DEBUG only
|
||||
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_6);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reconfigure the HAL tick using a standard timer instead of systick.
|
||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
||||
// Enable timer clock
|
||||
TIM_MST_RCC;
|
||||
|
||||
// Reset timer
|
||||
TIM_MST_RESET_ON;
|
||||
TIM_MST_RESET_OFF;
|
||||
|
||||
// Update the SystemCoreClock variable
|
||||
SystemCoreClockUpdate();
|
||||
|
||||
// Configure time base
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
TimMasterHandle.Init.Period = 0xFFFFFFFF;
|
||||
TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 us tick
|
||||
TimMasterHandle.Init.ClockDivision = 0;
|
||||
TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
HAL_TIM_OC_Init(&TimMasterHandle);
|
||||
|
||||
NVIC_SetVector(TIM_MST_IRQ, (uint32_t)timer_irq_handler);
|
||||
NVIC_EnableIRQ(TIM_MST_IRQ);
|
||||
|
||||
// Channel 1 for mbed timeout
|
||||
HAL_TIM_OC_Start(&TimMasterHandle, TIM_CHANNEL_1);
|
||||
|
||||
// Channel 2 for HAL tick
|
||||
HAL_TIM_OC_Start(&TimMasterHandle, TIM_CHANNEL_2);
|
||||
PreviousVal = __HAL_TIM_GetCounter(&TimMasterHandle);
|
||||
__HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_2, PreviousVal + HAL_TICK_DELAY);
|
||||
__HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC2);
|
||||
|
||||
#if 0 // For DEBUG only
|
||||
__GPIOB_CLK_ENABLE();
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_6;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
#endif
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
void HAL_SuspendTick(void)
|
||||
{
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
|
||||
// Disable HAL tick and us_ticker update interrupts (used for 32 bit counter)
|
||||
__HAL_TIM_DISABLE_IT(&TimMasterHandle, TIM_IT_CC2);
|
||||
}
|
||||
|
||||
void HAL_ResumeTick(void)
|
||||
{
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
|
||||
// Enable HAL tick and us_ticker update interrupts (used for 32 bit counter)
|
||||
__HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC2);
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file hal_tick.h
|
||||
* @author MCD Application Team
|
||||
* @brief Initialization of HAL tick
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef __HAL_TICK_H
|
||||
#define __HAL_TICK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "stm32l1xx.h"
|
||||
#include "cmsis_nvic.h"
|
||||
|
||||
#define TIM_MST TIM5
|
||||
#define TIM_MST_IRQ TIM5_IRQn
|
||||
#define TIM_MST_RCC __TIM5_CLK_ENABLE()
|
||||
|
||||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define HAL_TICK_DELAY (1000) // 1 ms
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __HAL_TICK_H
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,263 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l1xx.h
|
||||
* @author MCD Application Team
|
||||
* @version V2.2.0
|
||||
* @date 01-July-2016
|
||||
* @brief CMSIS STM32L1xx Device Peripheral Access Layer Header File.
|
||||
*
|
||||
* The file is the unique include file that the application programmer
|
||||
* is using in the C source code, usually in main.c. This file contains:
|
||||
* - Configuration section that allows to select:
|
||||
* - The STM32L1xx device used in the target application
|
||||
* - To use or not the peripheral’s drivers in application code(i.e.
|
||||
* code will be based on direct access to peripheral’s registers
|
||||
* rather than drivers API), this option is controlled by
|
||||
* "#define USE_HAL_DRIVER"
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/** @addtogroup CMSIS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup stm32l1xx
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __STM32L1XX_H
|
||||
#define __STM32L1XX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** @addtogroup Library_configuration_section
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief STM32 Family
|
||||
*/
|
||||
#if !defined (STM32L1)
|
||||
#define STM32L1
|
||||
#endif /* STM32L1 */
|
||||
|
||||
/* Uncomment the line below according to the target STM32L device used in your
|
||||
application
|
||||
*/
|
||||
|
||||
#if !defined (STM32L100xB) && !defined (STM32L100xBA) && !defined (STM32L100xC) && \
|
||||
!defined (STM32L151xB) && !defined (STM32L151xBA) && !defined (STM32L151xC) && !defined (STM32L151xCA) && !defined (STM32L151xD) && !defined (STM32L151xDX) && !defined (STM32L151xE) && \
|
||||
!defined (STM32L152xB) && !defined (STM32L152xBA) && !defined (STM32L152xC) && !defined (STM32L152xCA) && !defined (STM32L152xD) && !defined (STM32L152xDX) && !defined (STM32L152xE) && \
|
||||
!defined (STM32L162xC) && !defined (STM32L162xCA) && !defined (STM32L162xD) && !defined (STM32L162xDX) && !defined (STM32L162xE)
|
||||
/* #define STM32L100xB */ /*!< STM32L100C6, STM32L100R and STM32L100RB Devices */
|
||||
/* #define STM32L100xBA */ /*!< STM32L100C6-A, STM32L100R8-A and STM32L100RB-A Devices */
|
||||
/* #define STM32L100xC */ /*!< STM32L100RC Devices */
|
||||
/* #define STM32L151xB */ /*!< STM32L151C6, STM32L151R6, STM32L151C8, STM32L151R8, STM32L151V8, STM32L151CB, STM32L151RB and STM32L151VB */
|
||||
/* #define STM32L151xBA */ /*!< STM32L151C6-A, STM32L151R6-A, STM32L151C8-A, STM32L151R8-A, STM32L151V8-A, STM32L151CB-A, STM32L151RB-A and STM32L151VB-A */
|
||||
#define STM32L151xC /*!< STM32L151CC, STM32L151UC, STM32L151RC and STM32L151VC */
|
||||
/* #define STM32L151xCA */ /*!< STM32L151RC-A, STM32L151VC-A, STM32L151QC and STM32L151ZC */
|
||||
/* #define STM32L151xD */ /*!< STM32L151QD, STM32L151RD, STM32L151VD & STM32L151ZD */
|
||||
/* #define STM32L151xDX */ /*!< STM32L151VD-X Devices */
|
||||
/* #define STM32L151xE */ /*!< STM32L151QE, STM32L151RE, STM32L151VE and STM32L151ZE */
|
||||
/* #define STM32L152xB */ /*!< STM32L152C6, STM32L152R6, STM32L152C8, STM32L152R8, STM32L152V8, STM32L152CB, STM32L152RB and STM32L152VB */
|
||||
/* #define STM32L152xBA */ /*!< STM32L152C6-A, STM32L152R6-A, STM32L152C8-A, STM32L152R8-A, STM32L152V8-A, STM32L152CB-A, STM32L152RB-A and STM32L152VB-A */
|
||||
/* #define STM32L152xC */ /*!< STM32L152CC, STM32L152UC, STM32L152RC and STM32L152VC */
|
||||
/* #define STM32L152xCA */ /*!< STM32L152RC-A, STM32L152VC-A, STM32L152QC and STM32L152ZC */
|
||||
/* #define STM32L152xD */ /*!< STM32L152QD, STM32L152RD, STM32L152VD and STM32L152ZD */
|
||||
/* #define STM32L152xDX */ /*!< STM32L152VD-X Devices */
|
||||
/* #define STM32L152xE */ /*!< STM32L152QE, STM32L152RE, STM32L152VE and STM32L152ZE */
|
||||
/* #define STM32L162xC */ /*!< STM32L162RC and STM32L162VC */
|
||||
/* #define STM32L162xCA */ /*!< STM32L162RC-A, STM32L162VC-A, STM32L162QC and STM32L162ZC */
|
||||
/* #define STM32L162xD */ /*!< STM32L162QD, STM32L162RD, STM32L162VD and STM32L162ZD */
|
||||
/* #define STM32L162xDX */ /*!< STM32L162VD-X Devices */
|
||||
/* #define STM32L162xE */ /*!< STM32L162RE, STM32L162VE and STM32L162ZE */
|
||||
#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.
|
||||
*/
|
||||
|
||||
#if !defined (USE_HAL_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
|
||||
*/
|
||||
#define USE_HAL_DRIVER
|
||||
#endif /* USE_HAL_DRIVER */
|
||||
|
||||
/**
|
||||
* @brief CMSIS Device version number
|
||||
*/
|
||||
#define __STM32L1xx_CMSIS_VERSION_MAIN (0x02) /*!< [31:24] main version */
|
||||
#define __STM32L1xx_CMSIS_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
|
||||
#define __STM32L1xx_CMSIS_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
|
||||
#define __STM32L1xx_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
|
||||
#define __STM32L1xx_CMSIS_VERSION ((__STM32L1xx_CMSIS_VERSION_MAIN << 24)\
|
||||
|(__STM32L1xx_CMSIS_VERSION_SUB1 << 16)\
|
||||
|(__STM32L1xx_CMSIS_VERSION_SUB2 << 8 )\
|
||||
|(__STM32L1xx_CMSIS_VERSION_RC))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup Device_Included
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined(STM32L100xB)
|
||||
#include "stm32l100xb.h"
|
||||
#elif defined(STM32L100xBA)
|
||||
#include "stm32l100xba.h"
|
||||
#elif defined(STM32L100xC)
|
||||
#include "stm32l100xc.h"
|
||||
#elif defined(STM32L151xB)
|
||||
#include "stm32l151xb.h"
|
||||
#elif defined(STM32L151xBA)
|
||||
#include "stm32l151xba.h"
|
||||
#elif defined(STM32L151xC)
|
||||
#include "stm32l151xc.h"
|
||||
#elif defined(STM32L151xCA)
|
||||
#include "stm32l151xca.h"
|
||||
#elif defined(STM32L151xD)
|
||||
#include "stm32l151xd.h"
|
||||
#elif defined(STM32L151xDX)
|
||||
#include "stm32l151xdx.h"
|
||||
#elif defined(STM32L151xE)
|
||||
#include "stm32l151xe.h"
|
||||
#elif defined(STM32L152xB)
|
||||
#include "stm32l152xb.h"
|
||||
#elif defined(STM32L152xBA)
|
||||
#include "stm32l152xba.h"
|
||||
#elif defined(STM32L152xC)
|
||||
#include "stm32l152xc.h"
|
||||
#elif defined(STM32L152xCA)
|
||||
#include "stm32l152xca.h"
|
||||
#elif defined(STM32L152xD)
|
||||
#include "stm32l152xd.h"
|
||||
#elif defined(STM32L152xDX)
|
||||
#include "stm32l152xdx.h"
|
||||
#elif defined(STM32L152xE)
|
||||
#include "stm32l152xe.h"
|
||||
#elif defined(STM32L162xC)
|
||||
#include "stm32l162xc.h"
|
||||
#elif defined(STM32L162xCA)
|
||||
#include "stm32l162xca.h"
|
||||
#elif defined(STM32L162xD)
|
||||
#include "stm32l162xd.h"
|
||||
#elif defined(STM32L162xDX)
|
||||
#include "stm32l162xdx.h"
|
||||
#elif defined(STM32L162xE)
|
||||
#include "stm32l162xe.h"
|
||||
#else
|
||||
#error "Please select first the target STM32L1xx device used in your application (in stm32l1xx.h file)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup Exported_types
|
||||
* @{
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup Exported_macros
|
||||
* @{
|
||||
*/
|
||||
#define SET_BIT(REG, BIT) ((REG) |= (BIT))
|
||||
|
||||
#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
|
||||
|
||||
#define READ_BIT(REG, BIT) ((REG) & (BIT))
|
||||
|
||||
#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)))
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined (USE_HAL_DRIVER)
|
||||
#include "stm32l1xx_hal.h"
|
||||
#endif /* USE_HAL_DRIVER */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __STM32L1xx_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,291 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l1xx_hal_conf.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.2.0
|
||||
* @date 01-July-2016
|
||||
* @brief HAL configuration template file.
|
||||
* This file should be copied to the application folder and renamed
|
||||
* to stm32l1xx_hal_conf.h.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32L1xx_HAL_CONF_H
|
||||
#define __STM32L1xx_HAL_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* ########################## Module Selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
*/
|
||||
#define HAL_MODULE_ENABLED
|
||||
#define HAL_ADC_MODULE_ENABLED
|
||||
#define HAL_COMP_MODULE_ENABLED
|
||||
#define HAL_CORTEX_MODULE_ENABLED
|
||||
#define HAL_CRC_MODULE_ENABLED
|
||||
#define HAL_CRYP_MODULE_ENABLED
|
||||
#define HAL_DAC_MODULE_ENABLED
|
||||
#define HAL_DMA_MODULE_ENABLED
|
||||
#define HAL_FLASH_MODULE_ENABLED
|
||||
#define HAL_GPIO_MODULE_ENABLED
|
||||
#define HAL_I2C_MODULE_ENABLED
|
||||
#define HAL_I2S_MODULE_ENABLED
|
||||
#define HAL_IRDA_MODULE_ENABLED
|
||||
#define HAL_IWDG_MODULE_ENABLED
|
||||
#define HAL_LCD_MODULE_ENABLED
|
||||
#define HAL_NOR_MODULE_ENABLED
|
||||
#define HAL_OPAMP_MODULE_ENABLED
|
||||
#define HAL_PCD_MODULE_ENABLED
|
||||
#define HAL_PWR_MODULE_ENABLED
|
||||
#define HAL_RCC_MODULE_ENABLED
|
||||
#define HAL_RTC_MODULE_ENABLED
|
||||
#define HAL_SD_MODULE_ENABLED
|
||||
#define HAL_SMARTCARD_MODULE_ENABLED
|
||||
#define HAL_SPI_MODULE_ENABLED
|
||||
#define HAL_SRAM_MODULE_ENABLED
|
||||
#define HAL_TIM_MODULE_ENABLED
|
||||
#define HAL_UART_MODULE_ENABLED
|
||||
#define HAL_USART_MODULE_ENABLED
|
||||
#define HAL_WWDG_MODULE_ENABLED
|
||||
|
||||
/* ########################## Oscillator Values adaptation ####################*/
|
||||
/**
|
||||
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSE is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE ((uint32_t)24000000) /*!< XDOT-L151CC has a 24MHz External crystal */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (HSE_STARTUP_TIMEOUT)
|
||||
#define HSE_STARTUP_TIMEOUT ((uint32_t)200) /*!< Time out for HSE start up, in ms */
|
||||
#endif /* HSE_STARTUP_TIMEOUT */
|
||||
|
||||
/**
|
||||
* @brief Internal Multiple Speed oscillator (MSI) default value.
|
||||
* This value is the default MSI range value after Reset.
|
||||
*/
|
||||
#if !defined (MSI_VALUE)
|
||||
#define MSI_VALUE ((uint32_t)2097000) /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* MSI_VALUE */
|
||||
/**
|
||||
* @brief Internal High Speed oscillator (HSI) value.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSI is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
/**
|
||||
* @brief External Low Speed oscillator (LSE) value.
|
||||
* This value is used by the UART, RTC HAL module to compute the system frequency
|
||||
*/
|
||||
#if !defined (LSE_VALUE)
|
||||
#define LSE_VALUE ((uint32_t)32768) /*!< Value of the External oscillator in Hz*/
|
||||
#endif /* LSE_VALUE */
|
||||
|
||||
|
||||
#if !defined (LSE_STARTUP_TIMEOUT)
|
||||
#define LSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for LSE start up, in ms */
|
||||
#endif /* HSE_STARTUP_TIMEOUT */
|
||||
|
||||
|
||||
/* 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. */
|
||||
|
||||
/* ########################### System Configuration ######################### */
|
||||
/**
|
||||
* @brief This is the HAL system configuration section
|
||||
*/
|
||||
#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY ((uint32_t)0x000F) /*!< tick interrupt priority */
|
||||
#define USE_RTOS 0
|
||||
#define PREFETCH_ENABLE 1
|
||||
#define INSTRUCTION_CACHE_ENABLE 0
|
||||
#define DATA_CACHE_ENABLE 0
|
||||
|
||||
/* ########################## Assert Selection ############################## */
|
||||
/**
|
||||
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||
* HAL drivers code
|
||||
*/
|
||||
/*#define USE_FULL_ASSERT 1*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Include module's header file
|
||||
*/
|
||||
|
||||
#ifdef HAL_RCC_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_rcc.h"
|
||||
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_gpio.h"
|
||||
#endif /* HAL_GPIO_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DMA_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_dma.h"
|
||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CORTEX_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_cortex.h"
|
||||
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ADC_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_adc.h"
|
||||
#endif /* HAL_ADC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_COMP_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_comp.h"
|
||||
#endif /* HAL_COMP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRC_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_crc.h"
|
||||
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRYP_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_cryp.h"
|
||||
#endif /* HAL_CRYP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DAC_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_dac.h"
|
||||
#endif /* HAL_DAC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_FLASH_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_flash.h"
|
||||
#endif /* HAL_FLASH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SRAM_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_sram.h"
|
||||
#endif /* HAL_SRAM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_NOR_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_nor.h"
|
||||
#endif /* HAL_NOR_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2C_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_i2c.h"
|
||||
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2S_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_i2s.h"
|
||||
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IWDG_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_iwdg.h"
|
||||
#endif /* HAL_IWDG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_LCD_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_lcd.h"
|
||||
#endif /* HAL_LCD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_OPAMP_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_opamp.h"
|
||||
#endif /* HAL_OPAMP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PWR_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_pwr.h"
|
||||
#endif /* HAL_PWR_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RTC_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_rtc.h"
|
||||
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SD_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_sd.h"
|
||||
#endif /* HAL_SD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SPI_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_spi.h"
|
||||
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_TIM_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_tim.h"
|
||||
#endif /* HAL_TIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_UART_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_uart.h"
|
||||
#endif /* HAL_UART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_USART_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_usart.h"
|
||||
#endif /* HAL_USART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_irda.h"
|
||||
#endif /* HAL_IRDA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_smartcard.h"
|
||||
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_WWDG_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_wwdg.h"
|
||||
#endif /* HAL_WWDG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PCD_MODULE_ENABLED
|
||||
#include "stm32l1xx_hal_pcd.h"
|
||||
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||
|
||||
/* 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)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(uint8_t* file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0U)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L1xx_HAL_CONF_H */
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,643 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file system_stm32l1xx.c
|
||||
* @author MCD Application Team
|
||||
* @version V2.2.0
|
||||
* @date 01-July-2016
|
||||
* @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Source File.
|
||||
*
|
||||
* This file provides two functions and one global variable to be called from
|
||||
* user application:
|
||||
* - SystemInit(): This function is called at startup just after reset and
|
||||
* before branch to main program. This call is made inside
|
||||
* the "startup_stm32l1xx.s" file.
|
||||
*
|
||||
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
|
||||
* by the user application to setup the SysTick
|
||||
* timer or configure other parameters.
|
||||
*
|
||||
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
|
||||
* be called whenever the core clock is changed
|
||||
* during program execution.
|
||||
*
|
||||
* This file configures the system clock as follows:
|
||||
*-----------------------------------------------------------------------------
|
||||
* System clock source | 1- PLL_HSE_EXTC | 3- PLL_HSI
|
||||
* | (external 24 MHz clock) | (internal 16 MHz)
|
||||
* | 2- PLL_HSE_XTAL |
|
||||
* | (external 24 MHz xtal) |
|
||||
*-----------------------------------------------------------------------------
|
||||
* SYSCLK(MHz) | 32 | 32
|
||||
*-----------------------------------------------------------------------------
|
||||
* AHBCLK (MHz) | 32 | 32
|
||||
*-----------------------------------------------------------------------------
|
||||
* APB1CLK (MHz) | 32 | 32
|
||||
*-----------------------------------------------------------------------------
|
||||
* APB2CLK (MHz) | 32 | 32
|
||||
*-----------------------------------------------------------------------------
|
||||
* USB capable (48 MHz precise clock) | YES | NO
|
||||
*-----------------------------------------------------------------------------
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/** @addtogroup CMSIS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup stm32l1xx_system
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Private_Includes
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "stm32l1xx.h"
|
||||
#include "hal_tick.h"
|
||||
#include "stdio.h"
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE ((uint32_t)24000000) /*!< Default value of the External oscillator in Hz.
|
||||
This value can be provided and adapted by the user application. */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE ((uint32_t)16000000) /*!< Default value of the Internal oscillator in Hz.
|
||||
This value can be provided and adapted by the user application. */
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
/*!< Uncomment the following line if you need to use external SRAM mounted
|
||||
on STM32L152D_EVAL board 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 STM32L1xx_System_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Select the clock sources (other than HSI) to start with (0=OFF, 1=ON) */
|
||||
#define USE_PLL_HSE_EXTC (0) /* Use external clock */
|
||||
#define USE_PLL_HSE_XTAL (1) /* Use external xtal */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
/* This variable is updated in three ways:
|
||||
1) by calling CMSIS function SystemCoreClockUpdate()
|
||||
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
|
||||
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||
Note: If you use this function to configure the system clock; then there
|
||||
is no need to call the 2 first functions listed above, since SystemCoreClock
|
||||
variable is updated automatically.
|
||||
*/
|
||||
uint32_t SystemCoreClock = 32000000; /* Default with HSI. Will be updated if HSE is used */
|
||||
const uint8_t PLLMulTable[9] = {3, 4, 6, 8, 12, 16, 24, 32, 48};
|
||||
const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||
const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD)
|
||||
#ifdef DATA_IN_ExtSRAM
|
||||
static void SystemInit_ExtMemCtl(void);
|
||||
#endif /* DATA_IN_ExtSRAM */
|
||||
#endif /* STM32L151xD || STM32L152xD || STM32L162xD */
|
||||
|
||||
#if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0)
|
||||
uint8_t SetSysClock_PLL_HSE(uint8_t bypass);
|
||||
#endif
|
||||
|
||||
uint8_t SetSysClock_PLL_HSI(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Setup the microcontroller system.
|
||||
* Initialize the Embedded Flash Interface, the PLL and update the
|
||||
* SystemCoreClock variable.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SystemInit (void)
|
||||
{
|
||||
/*!< Set MSION bit */
|
||||
RCC->CR |= (uint32_t)0x00000100;
|
||||
|
||||
/*!< Reset SW[1:0], HPRE[3:0], PPRE1[2:0], PPRE2[2:0], MCOSEL[2:0] and MCOPRE[2:0] bits */
|
||||
RCC->CFGR &= (uint32_t)0x88FFC00C;
|
||||
|
||||
/*!< Reset HSION, HSEON, CSSON and PLLON bits */
|
||||
RCC->CR &= (uint32_t)0xEEFEFFFE;
|
||||
|
||||
/*!< Reset HSEBYP bit */
|
||||
RCC->CR &= (uint32_t)0xFFFBFFFF;
|
||||
|
||||
/*!< Reset PLLSRC, PLLMUL[3:0] and PLLDIV[1:0] bits */
|
||||
RCC->CFGR &= (uint32_t)0xFF02FFFF;
|
||||
|
||||
/*!< Disable all interrupts */
|
||||
RCC->CIR = 0x00000000;
|
||||
|
||||
#ifdef DATA_IN_ExtSRAM
|
||||
SystemInit_ExtMemCtl();
|
||||
#endif /* DATA_IN_ExtSRAM */
|
||||
|
||||
#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
|
||||
|
||||
/* Configure the Cube driver */
|
||||
SystemCoreClock = 16000000; // At this stage the HSI is used as system clock
|
||||
HAL_Init();
|
||||
|
||||
/* Configure the System clock source, PLL Multiplier and Divider factors,
|
||||
AHB/APBx prescalers and Flash settings */
|
||||
SetSysClock();
|
||||
|
||||
/* Reset the timer to avoid issues after the RAM initialization */
|
||||
TIM_MST_RESET_ON;
|
||||
TIM_MST_RESET_OFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update SystemCoreClock 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 MSI, SystemCoreClock will contain the MSI
|
||||
* value as defined by the MSI range.
|
||||
*
|
||||
* - 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/divided by the PLL factors.
|
||||
*
|
||||
* (*) HSI_VALUE is a constant defined in stm32l1xx.h file (default value
|
||||
* 16 MHz) but the real value may vary depending on the variations
|
||||
* in voltage and temperature.
|
||||
*
|
||||
* (**) HSE_VALUE is a constant defined in stm32l1xx.h file (default value
|
||||
* 8 MHz), 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, pllmul = 0, plldiv = 0, pllsource = 0, msirange = 0;
|
||||
|
||||
/* Get SYSCLK source -------------------------------------------------------*/
|
||||
tmp = RCC->CFGR & RCC_CFGR_SWS;
|
||||
|
||||
switch (tmp)
|
||||
{
|
||||
case 0x00: /* MSI used as system clock */
|
||||
msirange = (RCC->ICSCR & RCC_ICSCR_MSIRANGE) >> 13;
|
||||
SystemCoreClock = (32768 * (1 << (msirange + 1)));
|
||||
break;
|
||||
case 0x04: /* HSI used as system clock */
|
||||
SystemCoreClock = HSI_VALUE;
|
||||
break;
|
||||
case 0x08: /* HSE used as system clock */
|
||||
SystemCoreClock = HSE_VALUE;
|
||||
break;
|
||||
case 0x0C: /* PLL used as system clock */
|
||||
/* Get PLL clock source and multiplication factor ----------------------*/
|
||||
pllmul = RCC->CFGR & RCC_CFGR_PLLMUL;
|
||||
plldiv = RCC->CFGR & RCC_CFGR_PLLDIV;
|
||||
pllmul = PLLMulTable[(pllmul >> 18)];
|
||||
plldiv = (plldiv >> 22) + 1;
|
||||
|
||||
pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
|
||||
|
||||
if (pllsource == 0x00)
|
||||
{
|
||||
/* HSI oscillator clock selected as PLL clock entry */
|
||||
SystemCoreClock = (((HSI_VALUE) * pllmul) / plldiv);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* HSE selected as PLL clock entry */
|
||||
SystemCoreClock = (((HSE_VALUE) * pllmul) / plldiv);
|
||||
}
|
||||
break;
|
||||
default: /* MSI used as system clock */
|
||||
msirange = (RCC->ICSCR & RCC_ICSCR_MSIRANGE) >> 13;
|
||||
SystemCoreClock = (32768 * (1 << (msirange + 1)));
|
||||
break;
|
||||
}
|
||||
/* Compute HCLK clock frequency --------------------------------------------*/
|
||||
/* Get HCLK prescaler */
|
||||
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
|
||||
/* HCLK clock frequency */
|
||||
SystemCoreClock >>= tmp;
|
||||
}
|
||||
|
||||
#if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD)
|
||||
#ifdef DATA_IN_ExtSRAM
|
||||
/**
|
||||
* @brief Setup the external memory controller.
|
||||
* Called in SystemInit() function before jump to main.
|
||||
* This function configures the external SRAM mounted on STM32L152D_EVAL board
|
||||
* This SRAM will be used as program data memory (including heap and stack).
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SystemInit_ExtMemCtl(void)
|
||||
{
|
||||
__IO uint32_t tmpreg = 0;
|
||||
|
||||
/* Flash 1 wait state */
|
||||
FLASH->ACR |= FLASH_ACR_LATENCY;
|
||||
|
||||
/* Power enable */
|
||||
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
|
||||
|
||||
/* Delay after an RCC peripheral clock enabling */
|
||||
tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);
|
||||
|
||||
/* Select the Voltage Range 1 (1.8 V) */
|
||||
PWR->CR = PWR_CR_VOS_0;
|
||||
|
||||
/* Wait Until the Voltage Regulator is ready */
|
||||
while((PWR->CSR & PWR_CSR_VOSF) != RESET)
|
||||
{
|
||||
}
|
||||
|
||||
/*-- GPIOs Configuration -----------------------------------------------------*/
|
||||
/*
|
||||
+-------------------+--------------------+------------------+------------------+
|
||||
+ SRAM pins assignment +
|
||||
+-------------------+--------------------+------------------+------------------+
|
||||
| PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 |
|
||||
| PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 |
|
||||
| PD4 <-> FSMC_NOE | PE7 <-> FSMC_D4 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 |
|
||||
| PD5 <-> FSMC_NWE | PE8 <-> FSMC_D5 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 |
|
||||
| PD8 <-> FSMC_D13 | PE9 <-> FSMC_D6 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 |
|
||||
| PD9 <-> FSMC_D14 | PE10 <-> FSMC_D7 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 |
|
||||
| PD10 <-> FSMC_D15 | PE11 <-> FSMC_D8 | PF12 <-> FSMC_A6 | PG10<-> FSMC_NE2 |
|
||||
| PD11 <-> FSMC_A16 | PE12 <-> FSMC_D9 | PF13 <-> FSMC_A7 |------------------+
|
||||
| PD12 <-> FSMC_A17 | PE13 <-> FSMC_D10 | PF14 <-> FSMC_A8 |
|
||||
| PD13 <-> FSMC_A18 | PE14 <-> FSMC_D11 | PF15 <-> FSMC_A9 |
|
||||
| PD14 <-> FSMC_D0 | PE15 <-> FSMC_D12 |------------------+
|
||||
| PD15 <-> FSMC_D1 |--------------------+
|
||||
+-------------------+
|
||||
*/
|
||||
|
||||
/* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
|
||||
RCC->AHBENR = 0x000080D8;
|
||||
|
||||
/* Delay after an RCC peripheral clock enabling */
|
||||
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIODEN);
|
||||
|
||||
/* Connect PDx pins to FSMC Alternate function */
|
||||
GPIOD->AFR[0] = 0x00CC00CC;
|
||||
GPIOD->AFR[1] = 0xCCCCCCCC;
|
||||
/* Configure PDx pins in Alternate function mode */
|
||||
GPIOD->MODER = 0xAAAA0A0A;
|
||||
/* Configure PDx pins speed to 40 MHz */
|
||||
GPIOD->OSPEEDR = 0xFFFF0F0F;
|
||||
/* Configure PDx pins Output type to push-pull */
|
||||
GPIOD->OTYPER = 0x00000000;
|
||||
/* No pull-up, pull-down for PDx pins */
|
||||
GPIOD->PUPDR = 0x00000000;
|
||||
|
||||
/* Connect PEx pins to FSMC Alternate function */
|
||||
GPIOE->AFR[0] = 0xC00000CC;
|
||||
GPIOE->AFR[1] = 0xCCCCCCCC;
|
||||
/* Configure PEx pins in Alternate function mode */
|
||||
GPIOE->MODER = 0xAAAA800A;
|
||||
/* Configure PEx pins speed to 40 MHz */
|
||||
GPIOE->OSPEEDR = 0xFFFFC00F;
|
||||
/* Configure PEx pins Output type to push-pull */
|
||||
GPIOE->OTYPER = 0x00000000;
|
||||
/* No pull-up, pull-down for PEx pins */
|
||||
GPIOE->PUPDR = 0x00000000;
|
||||
|
||||
/* Connect PFx pins to FSMC Alternate function */
|
||||
GPIOF->AFR[0] = 0x00CCCCCC;
|
||||
GPIOF->AFR[1] = 0xCCCC0000;
|
||||
/* Configure PFx pins in Alternate function mode */
|
||||
GPIOF->MODER = 0xAA000AAA;
|
||||
/* Configure PFx pins speed to 40 MHz */
|
||||
GPIOF->OSPEEDR = 0xFF000FFF;
|
||||
/* Configure PFx pins Output type to push-pull */
|
||||
GPIOF->OTYPER = 0x00000000;
|
||||
/* No pull-up, pull-down for PFx pins */
|
||||
GPIOF->PUPDR = 0x00000000;
|
||||
|
||||
/* Connect PGx pins to FSMC Alternate function */
|
||||
GPIOG->AFR[0] = 0x00CCCCCC;
|
||||
GPIOG->AFR[1] = 0x00000C00;
|
||||
/* Configure PGx pins in Alternate function mode */
|
||||
GPIOG->MODER = 0x00200AAA;
|
||||
/* Configure PGx pins speed to 40 MHz */
|
||||
GPIOG->OSPEEDR = 0x00300FFF;
|
||||
/* Configure PGx pins Output type to push-pull */
|
||||
GPIOG->OTYPER = 0x00000000;
|
||||
/* No pull-up, pull-down for PGx pins */
|
||||
GPIOG->PUPDR = 0x00000000;
|
||||
|
||||
/*-- FSMC Configuration ------------------------------------------------------*/
|
||||
/* Enable the FSMC interface clock */
|
||||
RCC->AHBENR = 0x400080D8;
|
||||
|
||||
/* Delay after an RCC peripheral clock enabling */
|
||||
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN);
|
||||
|
||||
(void)(tmpreg);
|
||||
|
||||
/* Configure and enable Bank1_SRAM3 */
|
||||
FSMC_Bank1->BTCR[4] = 0x00001011;
|
||||
FSMC_Bank1->BTCR[5] = 0x00000300;
|
||||
FSMC_Bank1E->BWTR[4] = 0x0FFFFFFF;
|
||||
/*
|
||||
Bank1_SRAM3 is configured as follow:
|
||||
|
||||
p.FSMC_AddressSetupTime = 0;
|
||||
p.FSMC_AddressHoldTime = 0;
|
||||
p.FSMC_DataSetupTime = 3;
|
||||
p.FSMC_BusTurnAroundDuration = 0;
|
||||
p.FSMC_CLKDivision = 0;
|
||||
p.FSMC_DataLatency = 0;
|
||||
p.FSMC_AccessMode = FSMC_AccessMode_A;
|
||||
|
||||
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM3;
|
||||
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
|
||||
FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
|
||||
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
|
||||
FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
|
||||
FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
|
||||
FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
|
||||
FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
|
||||
FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
|
||||
FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
|
||||
FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
|
||||
FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
|
||||
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
|
||||
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
|
||||
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
|
||||
|
||||
FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
|
||||
|
||||
FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE);
|
||||
*/
|
||||
|
||||
}
|
||||
#endif /* DATA_IN_ExtSRAM */
|
||||
#endif /* STM32L151xD || STM32L152xD || STM32L162xD */
|
||||
|
||||
/**
|
||||
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
|
||||
* AHB/APBx prescalers and Flash settings
|
||||
* @note This function should be called only once the RCC clock configuration
|
||||
* is reset to the default reset state (done in SystemInit() function).
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SetSysClock(void)
|
||||
{
|
||||
/* 1- Try to start with HSE and external clock */
|
||||
#if USE_PLL_HSE_EXTC != 0
|
||||
if (SetSysClock_PLL_HSE(1) == 0)
|
||||
#endif
|
||||
{
|
||||
/* 2- If fail try to start with HSE and external xtal */
|
||||
#if USE_PLL_HSE_XTAL != 0
|
||||
if (SetSysClock_PLL_HSE(0) == 0)
|
||||
#endif
|
||||
{
|
||||
/* 3- If fail start with HSI clock */
|
||||
if (SetSysClock_PLL_HSI() == 0)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
// [TODO] Put something here to tell the user that a problem occured...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Output clock on MCO1 pin(PA8) for debugging purpose */
|
||||
//HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_SYSCLK, RCC_MCODIV_1);
|
||||
}
|
||||
|
||||
#if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0)
|
||||
/******************************************************************************/
|
||||
/* PLL (clocked by HSE) used as System clock source */
|
||||
/******************************************************************************/
|
||||
uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||
{
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
|
||||
/* Used to gain time after DeepSleep in case HSI is used */
|
||||
if (__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) != RESET)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The voltage scaling allows optimizing the power consumption when the device is
|
||||
clocked below the maximum system frequency, to update the voltage scaling value
|
||||
regarding system frequency refer to product datasheet. */
|
||||
__PWR_CLK_ENABLE();
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/* Enable HSE and HSI48 oscillators and activate PLL with HSE as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI;
|
||||
if (bypass == 0)
|
||||
{
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; /* External 24 MHz xtal on OSC_IN/OSC_OUT */
|
||||
}
|
||||
else
|
||||
{
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; /* External 24 MHz clock on OSC_IN */
|
||||
}
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
|
||||
// SYSCLK = 32 MHz ((24 MHz * 4) / 3)
|
||||
// USBCLK = 48 MHz ((24 MHz * 4) / 2) --> USB OK
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL4;
|
||||
RCC_OscInitStruct.PLL.PLLDIV = RCC_PLL_DIV3;
|
||||
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
|
||||
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 32 MHz
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 32 MHz
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; // 32 MHz
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 32 MHz
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
|
||||
{
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
/* Output clock on MCO1 pin(PA8) for debugging purpose */
|
||||
//if (bypass == 0)
|
||||
//HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_2); // 4 MHz
|
||||
//else
|
||||
//HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1); // 8 MHz
|
||||
|
||||
return 1; // OK
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/* PLL (clocked by HSI) used as System clock source */
|
||||
/******************************************************************************/
|
||||
uint8_t SetSysClock_PLL_HSI(void)
|
||||
{
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
|
||||
/* The voltage scaling allows optimizing the power consumption when the device is
|
||||
clocked below the maximum system frequency, to update the voltage scaling value
|
||||
regarding system frequency refer to product datasheet. */
|
||||
__PWR_CLK_ENABLE();
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/* Enable HSI oscillator and activate PLL with HSI as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
// SYSCLK = 32 MHz ((16 MHz * 4) / 2)
|
||||
// USBCLK = 64 MHz (16 MHz * 4) --> USB not possible
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL4;
|
||||
RCC_OscInitStruct.PLL.PLLDIV = RCC_PLL_DIV2;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
/* Poll VOSF bit of in PWR_CSR. Wait until it is reset to 0 */
|
||||
while (__HAL_PWR_GET_FLAG(PWR_FLAG_VOS) != RESET) {};
|
||||
|
||||
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
|
||||
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 32 MHz
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 32 MHz
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; // 32 MHz
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 32 MHz
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
|
||||
{
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
/* Output clock on MCO1 pin(PA8) for debugging purpose */
|
||||
//HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); // 16 MHz
|
||||
|
||||
return 1; // OK
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* Hard Fault Handler */
|
||||
/******************************************************************************/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
printf("Hard Fault\n");
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,128 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file system_stm32l1xx.h
|
||||
* @author MCD Application Team
|
||||
* @version V2.2.0
|
||||
* @date 01-July-2016
|
||||
* @brief CMSIS Cortex-M3 Device System Source File for STM32L1xx devices.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of STMicroelectronics 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 THE COPYRIGHT HOLDER OR 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/** @addtogroup CMSIS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup stm32l1xx_system
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Define to prevent recursive inclusion
|
||||
*/
|
||||
#ifndef __SYSTEM_STM32L1XX_H
|
||||
#define __SYSTEM_STM32L1XX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Includes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Exported_types
|
||||
* @{
|
||||
*/
|
||||
/* This variable is updated in three ways:
|
||||
1) by calling CMSIS function SystemCoreClockUpdate()
|
||||
2) by calling HAL API function HAL_RCC_GetSysClockFreq()
|
||||
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||
Note: If you use this function to configure the system clock; then there
|
||||
is no need to call the 2 first functions listed above, since SystemCoreClock
|
||||
variable is updated automatically.
|
||||
*/
|
||||
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
|
||||
/*
|
||||
*/
|
||||
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
|
||||
extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
|
||||
extern const uint8_t PLLMulTable[9]; /*!< PLL multipiers table values */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32L1xx_System_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern void SystemInit(void);
|
||||
extern void SystemCoreClockUpdate(void);
|
||||
extern void SetSysClock(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__SYSTEM_STM32L1XX_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,33 @@
|
|||
/*###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__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x000FFFFF;
|
||||
define symbol __NVIC_start__ = 0x20000000;
|
||||
define symbol __NVIC_end__ = 0x200000DB;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x200000DC;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x2001FFFF;
|
||||
/*-Sizes-*/
|
||||
/*Heap 1/4 of ram and stack 1/8*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x4000;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x8000;
|
||||
/**** 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 };
|
||||
|
||||
keep { section .intvec };
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite, block CSTACK, block HEAP };
|
||||
|
|
@ -0,0 +1,385 @@
|
|||
;/**************************************************************************//**
|
||||
; * @file startup_efm32gg.s
|
||||
; * @brief CMSIS Core Device Startup File
|
||||
; * Silicon Labs EFM32GG Device Series
|
||||
; * @version 5.0.0
|
||||
; * @date 30. January 2012
|
||||
; *
|
||||
; * @note
|
||||
; * Copyright (C) 2012 ARM Limited. All rights reserved.
|
||||
; *
|
||||
; * @par
|
||||
; * ARM Limited (ARM) is supplying this software for use with Cortex-M
|
||||
; * processor based microcontrollers. This file can be freely distributed
|
||||
; * within development tools that are supporting such ARM based processors.
|
||||
; *
|
||||
; * @par
|
||||
; * 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.
|
||||
; *
|
||||
; ******************************************************************************/
|
||||
|
||||
;
|
||||
; 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 with at least a 128 byte
|
||||
; alignment, 256 byte alignment is requied if all interrupt vectors are in use.
|
||||
;
|
||||
; 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:CODE:NOROOT(8)
|
||||
|
||||
EXTERN __iar_program_start
|
||||
EXTERN SystemInit
|
||||
PUBLIC __vector_table
|
||||
PUBLIC __vector_table_0x1c
|
||||
PUBLIC __Vectors
|
||||
PUBLIC __Vectors_End
|
||||
PUBLIC __Vectors_Size
|
||||
|
||||
DATA
|
||||
|
||||
__vector_table
|
||||
DCD sfe(CSTACK)
|
||||
DCD Reset_Handler
|
||||
|
||||
DCD NMI_Handler
|
||||
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
|
||||
|
||||
DCD DMA_IRQHandler ; 0: DMA Interrupt
|
||||
DCD GPIO_EVEN_IRQHandler ; 1: GPIO_EVEN Interrupt
|
||||
DCD TIMER0_IRQHandler ; 2: TIMER0 Interrupt
|
||||
DCD USART0_RX_IRQHandler ; 3: USART0_RX Interrupt
|
||||
DCD USART0_TX_IRQHandler ; 4: USART0_TX Interrupt
|
||||
DCD USB_IRQHandler ; 5: USB Interrupt
|
||||
DCD ACMP0_IRQHandler ; 6: ACMP0 Interrupt
|
||||
DCD ADC0_IRQHandler ; 7: ADC0 Interrupt
|
||||
DCD DAC0_IRQHandler ; 8: DAC0 Interrupt
|
||||
DCD I2C0_IRQHandler ; 9: I2C0 Interrupt
|
||||
DCD I2C1_IRQHandler ; 10: I2C1 Interrupt
|
||||
DCD GPIO_ODD_IRQHandler ; 11: GPIO_ODD Interrupt
|
||||
DCD TIMER1_IRQHandler ; 12: TIMER1 Interrupt
|
||||
DCD TIMER2_IRQHandler ; 13: TIMER2 Interrupt
|
||||
DCD TIMER3_IRQHandler ; 14: TIMER3 Interrupt
|
||||
DCD USART1_RX_IRQHandler ; 15: USART1_RX Interrupt
|
||||
DCD USART1_TX_IRQHandler ; 16: USART1_TX Interrupt
|
||||
DCD LESENSE_IRQHandler ; 17: LESENSE Interrupt
|
||||
DCD USART2_RX_IRQHandler ; 18: USART2_RX Interrupt
|
||||
DCD USART2_TX_IRQHandler ; 19: USART2_TX Interrupt
|
||||
DCD UART0_RX_IRQHandler ; 20: UART0_RX Interrupt
|
||||
DCD UART0_TX_IRQHandler ; 21: UART0_TX Interrupt
|
||||
DCD UART1_RX_IRQHandler ; 22: UART1_RX Interrupt
|
||||
DCD UART1_TX_IRQHandler ; 23: UART1_TX Interrupt
|
||||
DCD LEUART0_IRQHandler ; 24: LEUART0 Interrupt
|
||||
DCD LEUART1_IRQHandler ; 25: LEUART1 Interrupt
|
||||
DCD LETIMER0_IRQHandler ; 26: LETIMER0 Interrupt
|
||||
DCD PCNT0_IRQHandler ; 27: PCNT0 Interrupt
|
||||
DCD PCNT1_IRQHandler ; 28: PCNT1 Interrupt
|
||||
DCD PCNT2_IRQHandler ; 29: PCNT2 Interrupt
|
||||
DCD RTC_IRQHandler ; 30: RTC Interrupt
|
||||
DCD BURTC_IRQHandler ; 31: BURTC Interrupt
|
||||
DCD CMU_IRQHandler ; 32: CMU Interrupt
|
||||
DCD VCMP_IRQHandler ; 33: VCMP Interrupt
|
||||
DCD LCD_IRQHandler ; 34: LCD Interrupt
|
||||
DCD MSC_IRQHandler ; 35: MSC Interrupt
|
||||
DCD AES_IRQHandler ; 36: AES Interrupt
|
||||
DCD EBI_IRQHandler ; 37: EBI Interrupt
|
||||
DCD EMU_IRQHandler ; 38: EMU Interrupt
|
||||
|
||||
|
||||
__Vectors_End
|
||||
__Vectors EQU __vector_table
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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
|
||||
|
||||
; Device specific interrupt handlers
|
||||
|
||||
PUBWEAK DMA_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DMA_IRQHandler
|
||||
B DMA_IRQHandler
|
||||
|
||||
PUBWEAK GPIO_EVEN_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
GPIO_EVEN_IRQHandler
|
||||
B GPIO_EVEN_IRQHandler
|
||||
|
||||
PUBWEAK TIMER0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER0_IRQHandler
|
||||
B TIMER0_IRQHandler
|
||||
|
||||
PUBWEAK USART0_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART0_RX_IRQHandler
|
||||
B USART0_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART0_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART0_TX_IRQHandler
|
||||
B USART0_TX_IRQHandler
|
||||
|
||||
PUBWEAK USB_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USB_IRQHandler
|
||||
B USB_IRQHandler
|
||||
|
||||
PUBWEAK ACMP0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ACMP0_IRQHandler
|
||||
B ACMP0_IRQHandler
|
||||
|
||||
PUBWEAK ADC0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ADC0_IRQHandler
|
||||
B ADC0_IRQHandler
|
||||
|
||||
PUBWEAK DAC0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DAC0_IRQHandler
|
||||
B DAC0_IRQHandler
|
||||
|
||||
PUBWEAK I2C0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
I2C0_IRQHandler
|
||||
B I2C0_IRQHandler
|
||||
|
||||
PUBWEAK I2C1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
I2C1_IRQHandler
|
||||
B I2C1_IRQHandler
|
||||
|
||||
PUBWEAK GPIO_ODD_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
GPIO_ODD_IRQHandler
|
||||
B GPIO_ODD_IRQHandler
|
||||
|
||||
PUBWEAK TIMER1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER1_IRQHandler
|
||||
B TIMER1_IRQHandler
|
||||
|
||||
PUBWEAK TIMER2_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER2_IRQHandler
|
||||
B TIMER2_IRQHandler
|
||||
|
||||
PUBWEAK TIMER3_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER3_IRQHandler
|
||||
B TIMER3_IRQHandler
|
||||
|
||||
PUBWEAK USART1_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART1_RX_IRQHandler
|
||||
B USART1_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART1_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART1_TX_IRQHandler
|
||||
B USART1_TX_IRQHandler
|
||||
|
||||
PUBWEAK LESENSE_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LESENSE_IRQHandler
|
||||
B LESENSE_IRQHandler
|
||||
|
||||
PUBWEAK USART2_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART2_RX_IRQHandler
|
||||
B USART2_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART2_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART2_TX_IRQHandler
|
||||
B USART2_TX_IRQHandler
|
||||
|
||||
PUBWEAK UART0_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART0_RX_IRQHandler
|
||||
B UART0_RX_IRQHandler
|
||||
|
||||
PUBWEAK UART0_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART0_TX_IRQHandler
|
||||
B UART0_TX_IRQHandler
|
||||
|
||||
PUBWEAK UART1_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART1_RX_IRQHandler
|
||||
B UART1_RX_IRQHandler
|
||||
|
||||
PUBWEAK UART1_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART1_TX_IRQHandler
|
||||
B UART1_TX_IRQHandler
|
||||
|
||||
PUBWEAK LEUART0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LEUART0_IRQHandler
|
||||
B LEUART0_IRQHandler
|
||||
|
||||
PUBWEAK LEUART1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LEUART1_IRQHandler
|
||||
B LEUART1_IRQHandler
|
||||
|
||||
PUBWEAK LETIMER0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LETIMER0_IRQHandler
|
||||
B LETIMER0_IRQHandler
|
||||
|
||||
PUBWEAK PCNT0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT0_IRQHandler
|
||||
B PCNT0_IRQHandler
|
||||
|
||||
PUBWEAK PCNT1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT1_IRQHandler
|
||||
B PCNT1_IRQHandler
|
||||
|
||||
PUBWEAK PCNT2_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT2_IRQHandler
|
||||
B PCNT2_IRQHandler
|
||||
|
||||
PUBWEAK RTC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
RTC_IRQHandler
|
||||
B RTC_IRQHandler
|
||||
|
||||
PUBWEAK BURTC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
BURTC_IRQHandler
|
||||
B BURTC_IRQHandler
|
||||
|
||||
PUBWEAK CMU_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
CMU_IRQHandler
|
||||
B CMU_IRQHandler
|
||||
|
||||
PUBWEAK VCMP_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
VCMP_IRQHandler
|
||||
B VCMP_IRQHandler
|
||||
|
||||
PUBWEAK LCD_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LCD_IRQHandler
|
||||
B LCD_IRQHandler
|
||||
|
||||
PUBWEAK MSC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
MSC_IRQHandler
|
||||
B MSC_IRQHandler
|
||||
|
||||
PUBWEAK AES_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
AES_IRQHandler
|
||||
B AES_IRQHandler
|
||||
|
||||
PUBWEAK EBI_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
EBI_IRQHandler
|
||||
B EBI_IRQHandler
|
||||
|
||||
PUBWEAK EMU_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
EMU_IRQHandler
|
||||
B EMU_IRQHandler
|
||||
|
||||
|
||||
END
|
|
@ -0,0 +1,33 @@
|
|||
/*###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__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0000FFFF;
|
||||
define symbol __NVIC_start__ = 0x20000000;
|
||||
define symbol __NVIC_end__ = 0x20000093;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000094;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20001FFF;
|
||||
/*-Sizes-*/
|
||||
/*Heap 1/4 of ram and stack 1/8*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x800;
|
||||
/**** 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 };
|
||||
|
||||
keep { section .intvec };
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite, block CSTACK, block HEAP };
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
;/**************************************************************************//**
|
||||
; * @file startup_efm32hg.s
|
||||
; * @brief CMSIS Core Device Startup File
|
||||
; * Silicon Labs EFM32HG Device Series
|
||||
; * @version 5.0.0
|
||||
; * @date 30. January 2012
|
||||
; *
|
||||
; * @note
|
||||
; * Copyright (C) 2012 ARM Limited. All rights reserved.
|
||||
; *
|
||||
; * @par
|
||||
; * ARM Limited (ARM) is supplying this software for use with Cortex-M
|
||||
; * processor based microcontrollers. This file can be freely distributed
|
||||
; * within development tools that are supporting such ARM based processors.
|
||||
; *
|
||||
; * @par
|
||||
; * 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.
|
||||
; *
|
||||
; ******************************************************************************/
|
||||
|
||||
;
|
||||
; 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 with at least a 128 byte
|
||||
; alignment, 256 byte alignment is requied if all interrupt vectors are in use.
|
||||
;
|
||||
; 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:CODE:NOROOT(8)
|
||||
|
||||
EXTERN __iar_program_start
|
||||
EXTERN SystemInit
|
||||
PUBLIC __vector_table
|
||||
PUBLIC __vector_table_0x1c
|
||||
PUBLIC __Vectors
|
||||
PUBLIC __Vectors_End
|
||||
PUBLIC __Vectors_Size
|
||||
|
||||
DATA
|
||||
|
||||
__vector_table
|
||||
DCD sfe(CSTACK)
|
||||
DCD Reset_Handler
|
||||
|
||||
DCD NMI_Handler
|
||||
DCD HardFault_Handler
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
__vector_table_0x1c
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD SVC_Handler
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD PendSV_Handler
|
||||
DCD SysTick_Handler
|
||||
|
||||
; External Interrupts
|
||||
|
||||
DCD DMA_IRQHandler ; 0: DMA Interrupt
|
||||
DCD GPIO_EVEN_IRQHandler ; 1: GPIO_EVEN Interrupt
|
||||
DCD TIMER0_IRQHandler ; 2: TIMER0 Interrupt
|
||||
DCD ACMP0_IRQHandler ; 3: ACMP0 Interrupt
|
||||
DCD ADC0_IRQHandler ; 4: ADC0 Interrupt
|
||||
DCD I2C0_IRQHandler ; 5: I2C0 Interrupt
|
||||
DCD GPIO_ODD_IRQHandler ; 6: GPIO_ODD Interrupt
|
||||
DCD TIMER1_IRQHandler ; 7: TIMER1 Interrupt
|
||||
DCD USART1_RX_IRQHandler ; 8: USART1_RX Interrupt
|
||||
DCD USART1_TX_IRQHandler ; 9: USART1_TX Interrupt
|
||||
DCD LEUART0_IRQHandler ; 10: LEUART0 Interrupt
|
||||
DCD PCNT0_IRQHandler ; 11: PCNT0 Interrupt
|
||||
DCD RTC_IRQHandler ; 12: RTC Interrupt
|
||||
DCD CMU_IRQHandler ; 13: CMU Interrupt
|
||||
DCD VCMP_IRQHandler ; 14: VCMP Interrupt
|
||||
DCD MSC_IRQHandler ; 15: MSC Interrupt
|
||||
DCD AES_IRQHandler ; 16: AES Interrupt
|
||||
DCD USART0_RX_IRQHandler ; 17: USART0_RX Interrupt
|
||||
DCD USART0_TX_IRQHandler ; 18: USART0_TX Interrupt
|
||||
DCD USB_IRQHandler ; 19: USB Interrupt
|
||||
DCD TIMER2_IRQHandler ; 20: TIMER2 Interrupt
|
||||
|
||||
|
||||
__Vectors_End
|
||||
__Vectors EQU __vector_table
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 SVC_Handler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
SVC_Handler
|
||||
B SVC_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
|
||||
|
||||
; Device specific interrupt handlers
|
||||
|
||||
PUBWEAK DMA_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DMA_IRQHandler
|
||||
B DMA_IRQHandler
|
||||
|
||||
PUBWEAK GPIO_EVEN_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
GPIO_EVEN_IRQHandler
|
||||
B GPIO_EVEN_IRQHandler
|
||||
|
||||
PUBWEAK TIMER0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER0_IRQHandler
|
||||
B TIMER0_IRQHandler
|
||||
|
||||
PUBWEAK ACMP0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ACMP0_IRQHandler
|
||||
B ACMP0_IRQHandler
|
||||
|
||||
PUBWEAK ADC0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ADC0_IRQHandler
|
||||
B ADC0_IRQHandler
|
||||
|
||||
PUBWEAK I2C0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
I2C0_IRQHandler
|
||||
B I2C0_IRQHandler
|
||||
|
||||
PUBWEAK GPIO_ODD_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
GPIO_ODD_IRQHandler
|
||||
B GPIO_ODD_IRQHandler
|
||||
|
||||
PUBWEAK TIMER1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER1_IRQHandler
|
||||
B TIMER1_IRQHandler
|
||||
|
||||
PUBWEAK USART1_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART1_RX_IRQHandler
|
||||
B USART1_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART1_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART1_TX_IRQHandler
|
||||
B USART1_TX_IRQHandler
|
||||
|
||||
PUBWEAK LEUART0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LEUART0_IRQHandler
|
||||
B LEUART0_IRQHandler
|
||||
|
||||
PUBWEAK PCNT0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT0_IRQHandler
|
||||
B PCNT0_IRQHandler
|
||||
|
||||
PUBWEAK RTC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
RTC_IRQHandler
|
||||
B RTC_IRQHandler
|
||||
|
||||
PUBWEAK CMU_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
CMU_IRQHandler
|
||||
B CMU_IRQHandler
|
||||
|
||||
PUBWEAK VCMP_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
VCMP_IRQHandler
|
||||
B VCMP_IRQHandler
|
||||
|
||||
PUBWEAK MSC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
MSC_IRQHandler
|
||||
B MSC_IRQHandler
|
||||
|
||||
PUBWEAK AES_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
AES_IRQHandler
|
||||
B AES_IRQHandler
|
||||
|
||||
PUBWEAK USART0_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART0_RX_IRQHandler
|
||||
B USART0_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART0_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART0_TX_IRQHandler
|
||||
B USART0_TX_IRQHandler
|
||||
|
||||
PUBWEAK USB_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USB_IRQHandler
|
||||
B USB_IRQHandler
|
||||
|
||||
PUBWEAK TIMER2_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER2_IRQHandler
|
||||
B TIMER2_IRQHandler
|
||||
|
||||
|
||||
END
|
|
@ -0,0 +1,33 @@
|
|||
/*###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__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
|
||||
define symbol __NVIC_start__ = 0x20000000;
|
||||
define symbol __NVIC_end__ = 0x200000DF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x200000E0;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
|
||||
/*-Sizes-*/
|
||||
/*Heap 1/4 of ram and stack 1/8*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x1000;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x2000;
|
||||
/**** 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 };
|
||||
|
||||
keep { section .intvec };
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite, block CSTACK, block HEAP };
|
||||
|
|
@ -0,0 +1,386 @@
|
|||
;/**************************************************************************//**
|
||||
; * @file startup_efm32lg.s
|
||||
; * @brief CMSIS Core Device Startup File
|
||||
; * Silicon Labs EFM32LG Device Series
|
||||
; * @version 5.0.0
|
||||
; * @date 30. January 2012
|
||||
; *
|
||||
; * @note
|
||||
; * Copyright (C) 2012 ARM Limited. All rights reserved.
|
||||
; *
|
||||
; * @par
|
||||
; * ARM Limited (ARM) is supplying this software for use with Cortex-M
|
||||
; * processor based microcontrollers. This file can be freely distributed
|
||||
; * within development tools that are supporting such ARM based processors.
|
||||
; *
|
||||
; * @par
|
||||
; * 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.
|
||||
; *
|
||||
; ******************************************************************************/
|
||||
|
||||
;
|
||||
; 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 with at least a 128 byte
|
||||
; alignment, 256 byte alignment is requied if all interrupt vectors are in use.
|
||||
;
|
||||
; 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:CODE:NOROOT(8)
|
||||
|
||||
EXTERN __iar_program_start
|
||||
EXTERN SystemInit
|
||||
PUBLIC __vector_table
|
||||
PUBLIC __vector_table_0x1c
|
||||
PUBLIC __Vectors
|
||||
PUBLIC __Vectors_End
|
||||
PUBLIC __Vectors_Size
|
||||
|
||||
DATA
|
||||
|
||||
__vector_table
|
||||
DCD sfe(CSTACK)
|
||||
DCD Reset_Handler
|
||||
|
||||
DCD NMI_Handler
|
||||
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
|
||||
|
||||
DCD DMA_IRQHandler ; 0: DMA Interrupt
|
||||
DCD GPIO_EVEN_IRQHandler ; 1: GPIO_EVEN Interrupt
|
||||
DCD TIMER0_IRQHandler ; 2: TIMER0 Interrupt
|
||||
DCD USART0_RX_IRQHandler ; 3: USART0_RX Interrupt
|
||||
DCD USART0_TX_IRQHandler ; 4: USART0_TX Interrupt
|
||||
DCD USB_IRQHandler ; 5: USB Interrupt
|
||||
DCD ACMP0_IRQHandler ; 6: ACMP0 Interrupt
|
||||
DCD ADC0_IRQHandler ; 7: ADC0 Interrupt
|
||||
DCD DAC0_IRQHandler ; 8: DAC0 Interrupt
|
||||
DCD I2C0_IRQHandler ; 9: I2C0 Interrupt
|
||||
DCD I2C1_IRQHandler ; 10: I2C1 Interrupt
|
||||
DCD GPIO_ODD_IRQHandler ; 11: GPIO_ODD Interrupt
|
||||
DCD TIMER1_IRQHandler ; 12: TIMER1 Interrupt
|
||||
DCD TIMER2_IRQHandler ; 13: TIMER2 Interrupt
|
||||
DCD TIMER3_IRQHandler ; 14: TIMER3 Interrupt
|
||||
DCD USART1_RX_IRQHandler ; 15: USART1_RX Interrupt
|
||||
DCD USART1_TX_IRQHandler ; 16: USART1_TX Interrupt
|
||||
DCD LESENSE_IRQHandler ; 17: LESENSE Interrupt
|
||||
DCD USART2_RX_IRQHandler ; 18: USART2_RX Interrupt
|
||||
DCD USART2_TX_IRQHandler ; 19: USART2_TX Interrupt
|
||||
DCD UART0_RX_IRQHandler ; 20: UART0_RX Interrupt
|
||||
DCD UART0_TX_IRQHandler ; 21: UART0_TX Interrupt
|
||||
DCD UART1_RX_IRQHandler ; 22: UART1_RX Interrupt
|
||||
DCD UART1_TX_IRQHandler ; 23: UART1_TX Interrupt
|
||||
DCD LEUART0_IRQHandler ; 24: LEUART0 Interrupt
|
||||
DCD LEUART1_IRQHandler ; 25: LEUART1 Interrupt
|
||||
DCD LETIMER0_IRQHandler ; 26: LETIMER0 Interrupt
|
||||
DCD PCNT0_IRQHandler ; 27: PCNT0 Interrupt
|
||||
DCD PCNT1_IRQHandler ; 28: PCNT1 Interrupt
|
||||
DCD PCNT2_IRQHandler ; 29: PCNT2 Interrupt
|
||||
DCD RTC_IRQHandler ; 30: RTC Interrupt
|
||||
DCD BURTC_IRQHandler ; 31: BURTC Interrupt
|
||||
DCD CMU_IRQHandler ; 32: CMU Interrupt
|
||||
DCD VCMP_IRQHandler ; 33: VCMP Interrupt
|
||||
DCD LCD_IRQHandler ; 34: LCD Interrupt
|
||||
DCD MSC_IRQHandler ; 35: MSC Interrupt
|
||||
DCD AES_IRQHandler ; 36: AES Interrupt
|
||||
DCD EBI_IRQHandler ; 37: EBI Interrupt
|
||||
DCD EMU_IRQHandler ; 38: EMU Interrupt
|
||||
DCD 0 ; 39: Reserved Interrupt
|
||||
|
||||
|
||||
__Vectors_End
|
||||
__Vectors EQU __vector_table
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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
|
||||
|
||||
; Device specific interrupt handlers
|
||||
|
||||
PUBWEAK DMA_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DMA_IRQHandler
|
||||
B DMA_IRQHandler
|
||||
|
||||
PUBWEAK GPIO_EVEN_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
GPIO_EVEN_IRQHandler
|
||||
B GPIO_EVEN_IRQHandler
|
||||
|
||||
PUBWEAK TIMER0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER0_IRQHandler
|
||||
B TIMER0_IRQHandler
|
||||
|
||||
PUBWEAK USART0_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART0_RX_IRQHandler
|
||||
B USART0_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART0_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART0_TX_IRQHandler
|
||||
B USART0_TX_IRQHandler
|
||||
|
||||
PUBWEAK USB_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USB_IRQHandler
|
||||
B USB_IRQHandler
|
||||
|
||||
PUBWEAK ACMP0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ACMP0_IRQHandler
|
||||
B ACMP0_IRQHandler
|
||||
|
||||
PUBWEAK ADC0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ADC0_IRQHandler
|
||||
B ADC0_IRQHandler
|
||||
|
||||
PUBWEAK DAC0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DAC0_IRQHandler
|
||||
B DAC0_IRQHandler
|
||||
|
||||
PUBWEAK I2C0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
I2C0_IRQHandler
|
||||
B I2C0_IRQHandler
|
||||
|
||||
PUBWEAK I2C1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
I2C1_IRQHandler
|
||||
B I2C1_IRQHandler
|
||||
|
||||
PUBWEAK GPIO_ODD_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
GPIO_ODD_IRQHandler
|
||||
B GPIO_ODD_IRQHandler
|
||||
|
||||
PUBWEAK TIMER1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER1_IRQHandler
|
||||
B TIMER1_IRQHandler
|
||||
|
||||
PUBWEAK TIMER2_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER2_IRQHandler
|
||||
B TIMER2_IRQHandler
|
||||
|
||||
PUBWEAK TIMER3_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER3_IRQHandler
|
||||
B TIMER3_IRQHandler
|
||||
|
||||
PUBWEAK USART1_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART1_RX_IRQHandler
|
||||
B USART1_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART1_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART1_TX_IRQHandler
|
||||
B USART1_TX_IRQHandler
|
||||
|
||||
PUBWEAK LESENSE_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LESENSE_IRQHandler
|
||||
B LESENSE_IRQHandler
|
||||
|
||||
PUBWEAK USART2_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART2_RX_IRQHandler
|
||||
B USART2_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART2_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART2_TX_IRQHandler
|
||||
B USART2_TX_IRQHandler
|
||||
|
||||
PUBWEAK UART0_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART0_RX_IRQHandler
|
||||
B UART0_RX_IRQHandler
|
||||
|
||||
PUBWEAK UART0_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART0_TX_IRQHandler
|
||||
B UART0_TX_IRQHandler
|
||||
|
||||
PUBWEAK UART1_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART1_RX_IRQHandler
|
||||
B UART1_RX_IRQHandler
|
||||
|
||||
PUBWEAK UART1_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART1_TX_IRQHandler
|
||||
B UART1_TX_IRQHandler
|
||||
|
||||
PUBWEAK LEUART0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LEUART0_IRQHandler
|
||||
B LEUART0_IRQHandler
|
||||
|
||||
PUBWEAK LEUART1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LEUART1_IRQHandler
|
||||
B LEUART1_IRQHandler
|
||||
|
||||
PUBWEAK LETIMER0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LETIMER0_IRQHandler
|
||||
B LETIMER0_IRQHandler
|
||||
|
||||
PUBWEAK PCNT0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT0_IRQHandler
|
||||
B PCNT0_IRQHandler
|
||||
|
||||
PUBWEAK PCNT1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT1_IRQHandler
|
||||
B PCNT1_IRQHandler
|
||||
|
||||
PUBWEAK PCNT2_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT2_IRQHandler
|
||||
B PCNT2_IRQHandler
|
||||
|
||||
PUBWEAK RTC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
RTC_IRQHandler
|
||||
B RTC_IRQHandler
|
||||
|
||||
PUBWEAK BURTC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
BURTC_IRQHandler
|
||||
B BURTC_IRQHandler
|
||||
|
||||
PUBWEAK CMU_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
CMU_IRQHandler
|
||||
B CMU_IRQHandler
|
||||
|
||||
PUBWEAK VCMP_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
VCMP_IRQHandler
|
||||
B VCMP_IRQHandler
|
||||
|
||||
PUBWEAK LCD_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LCD_IRQHandler
|
||||
B LCD_IRQHandler
|
||||
|
||||
PUBWEAK MSC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
MSC_IRQHandler
|
||||
B MSC_IRQHandler
|
||||
|
||||
PUBWEAK AES_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
AES_IRQHandler
|
||||
B AES_IRQHandler
|
||||
|
||||
PUBWEAK EBI_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
EBI_IRQHandler
|
||||
B EBI_IRQHandler
|
||||
|
||||
PUBWEAK EMU_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
EMU_IRQHandler
|
||||
B EMU_IRQHandler
|
||||
|
||||
|
||||
END
|
|
@ -0,0 +1,33 @@
|
|||
/*###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__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
|
||||
define symbol __NVIC_start__ = 0x20000000;
|
||||
define symbol __NVIC_end__ = 0x200000DF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x200000E0;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
|
||||
/*-Sizes-*/
|
||||
/*Heap 1/4 of ram and stack 1/8*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x1000;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x2000;
|
||||
/**** 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 };
|
||||
|
||||
keep { section .intvec };
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite, block CSTACK, block HEAP };
|
||||
|
|
@ -0,0 +1,391 @@
|
|||
;/**************************************************************************//**
|
||||
; * @file startup_efm32wg.s
|
||||
; * @brief CMSIS Core Device Startup File
|
||||
; * Silicon Labs EFM32WG Device Series
|
||||
; * @version 5.0.0
|
||||
; * @date 30. January 2012
|
||||
; *
|
||||
; * @note
|
||||
; * Copyright (C) 2012 ARM Limited. All rights reserved.
|
||||
; *
|
||||
; * @par
|
||||
; * ARM Limited (ARM) is supplying this software for use with Cortex-M
|
||||
; * processor based microcontrollers. This file can be freely distributed
|
||||
; * within development tools that are supporting such ARM based processors.
|
||||
; *
|
||||
; * @par
|
||||
; * 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.
|
||||
; *
|
||||
; ******************************************************************************/
|
||||
|
||||
;
|
||||
; 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 with at least a 128 byte
|
||||
; alignment, 256 byte alignment is requied if all interrupt vectors are in use.
|
||||
;
|
||||
; 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:CODE:NOROOT(8)
|
||||
|
||||
EXTERN __iar_program_start
|
||||
EXTERN SystemInit
|
||||
PUBLIC __vector_table
|
||||
PUBLIC __vector_table_0x1c
|
||||
PUBLIC __Vectors
|
||||
PUBLIC __Vectors_End
|
||||
PUBLIC __Vectors_Size
|
||||
|
||||
DATA
|
||||
|
||||
__vector_table
|
||||
DCD sfe(CSTACK)
|
||||
DCD Reset_Handler
|
||||
|
||||
DCD NMI_Handler
|
||||
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
|
||||
|
||||
DCD DMA_IRQHandler ; 0: DMA Interrupt
|
||||
DCD GPIO_EVEN_IRQHandler ; 1: GPIO_EVEN Interrupt
|
||||
DCD TIMER0_IRQHandler ; 2: TIMER0 Interrupt
|
||||
DCD USART0_RX_IRQHandler ; 3: USART0_RX Interrupt
|
||||
DCD USART0_TX_IRQHandler ; 4: USART0_TX Interrupt
|
||||
DCD USB_IRQHandler ; 5: USB Interrupt
|
||||
DCD ACMP0_IRQHandler ; 6: ACMP0 Interrupt
|
||||
DCD ADC0_IRQHandler ; 7: ADC0 Interrupt
|
||||
DCD DAC0_IRQHandler ; 8: DAC0 Interrupt
|
||||
DCD I2C0_IRQHandler ; 9: I2C0 Interrupt
|
||||
DCD I2C1_IRQHandler ; 10: I2C1 Interrupt
|
||||
DCD GPIO_ODD_IRQHandler ; 11: GPIO_ODD Interrupt
|
||||
DCD TIMER1_IRQHandler ; 12: TIMER1 Interrupt
|
||||
DCD TIMER2_IRQHandler ; 13: TIMER2 Interrupt
|
||||
DCD TIMER3_IRQHandler ; 14: TIMER3 Interrupt
|
||||
DCD USART1_RX_IRQHandler ; 15: USART1_RX Interrupt
|
||||
DCD USART1_TX_IRQHandler ; 16: USART1_TX Interrupt
|
||||
DCD LESENSE_IRQHandler ; 17: LESENSE Interrupt
|
||||
DCD USART2_RX_IRQHandler ; 18: USART2_RX Interrupt
|
||||
DCD USART2_TX_IRQHandler ; 19: USART2_TX Interrupt
|
||||
DCD UART0_RX_IRQHandler ; 20: UART0_RX Interrupt
|
||||
DCD UART0_TX_IRQHandler ; 21: UART0_TX Interrupt
|
||||
DCD UART1_RX_IRQHandler ; 22: UART1_RX Interrupt
|
||||
DCD UART1_TX_IRQHandler ; 23: UART1_TX Interrupt
|
||||
DCD LEUART0_IRQHandler ; 24: LEUART0 Interrupt
|
||||
DCD LEUART1_IRQHandler ; 25: LEUART1 Interrupt
|
||||
DCD LETIMER0_IRQHandler ; 26: LETIMER0 Interrupt
|
||||
DCD PCNT0_IRQHandler ; 27: PCNT0 Interrupt
|
||||
DCD PCNT1_IRQHandler ; 28: PCNT1 Interrupt
|
||||
DCD PCNT2_IRQHandler ; 29: PCNT2 Interrupt
|
||||
DCD RTC_IRQHandler ; 30: RTC Interrupt
|
||||
DCD BURTC_IRQHandler ; 31: BURTC Interrupt
|
||||
DCD CMU_IRQHandler ; 32: CMU Interrupt
|
||||
DCD VCMP_IRQHandler ; 33: VCMP Interrupt
|
||||
DCD LCD_IRQHandler ; 34: LCD Interrupt
|
||||
DCD MSC_IRQHandler ; 35: MSC Interrupt
|
||||
DCD AES_IRQHandler ; 36: AES Interrupt
|
||||
DCD EBI_IRQHandler ; 37: EBI Interrupt
|
||||
DCD EMU_IRQHandler ; 38: EMU Interrupt
|
||||
DCD FPUEH_IRQHandler ; 39: FPUEH Interrupt
|
||||
|
||||
|
||||
__Vectors_End
|
||||
__Vectors EQU __vector_table
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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
|
||||
|
||||
; Device specific interrupt handlers
|
||||
|
||||
PUBWEAK DMA_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DMA_IRQHandler
|
||||
B DMA_IRQHandler
|
||||
|
||||
PUBWEAK GPIO_EVEN_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
GPIO_EVEN_IRQHandler
|
||||
B GPIO_EVEN_IRQHandler
|
||||
|
||||
PUBWEAK TIMER0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER0_IRQHandler
|
||||
B TIMER0_IRQHandler
|
||||
|
||||
PUBWEAK USART0_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART0_RX_IRQHandler
|
||||
B USART0_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART0_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART0_TX_IRQHandler
|
||||
B USART0_TX_IRQHandler
|
||||
|
||||
PUBWEAK USB_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USB_IRQHandler
|
||||
B USB_IRQHandler
|
||||
|
||||
PUBWEAK ACMP0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ACMP0_IRQHandler
|
||||
B ACMP0_IRQHandler
|
||||
|
||||
PUBWEAK ADC0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ADC0_IRQHandler
|
||||
B ADC0_IRQHandler
|
||||
|
||||
PUBWEAK DAC0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DAC0_IRQHandler
|
||||
B DAC0_IRQHandler
|
||||
|
||||
PUBWEAK I2C0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
I2C0_IRQHandler
|
||||
B I2C0_IRQHandler
|
||||
|
||||
PUBWEAK I2C1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
I2C1_IRQHandler
|
||||
B I2C1_IRQHandler
|
||||
|
||||
PUBWEAK GPIO_ODD_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
GPIO_ODD_IRQHandler
|
||||
B GPIO_ODD_IRQHandler
|
||||
|
||||
PUBWEAK TIMER1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER1_IRQHandler
|
||||
B TIMER1_IRQHandler
|
||||
|
||||
PUBWEAK TIMER2_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER2_IRQHandler
|
||||
B TIMER2_IRQHandler
|
||||
|
||||
PUBWEAK TIMER3_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER3_IRQHandler
|
||||
B TIMER3_IRQHandler
|
||||
|
||||
PUBWEAK USART1_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART1_RX_IRQHandler
|
||||
B USART1_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART1_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART1_TX_IRQHandler
|
||||
B USART1_TX_IRQHandler
|
||||
|
||||
PUBWEAK LESENSE_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LESENSE_IRQHandler
|
||||
B LESENSE_IRQHandler
|
||||
|
||||
PUBWEAK USART2_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART2_RX_IRQHandler
|
||||
B USART2_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART2_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART2_TX_IRQHandler
|
||||
B USART2_TX_IRQHandler
|
||||
|
||||
PUBWEAK UART0_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART0_RX_IRQHandler
|
||||
B UART0_RX_IRQHandler
|
||||
|
||||
PUBWEAK UART0_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART0_TX_IRQHandler
|
||||
B UART0_TX_IRQHandler
|
||||
|
||||
PUBWEAK UART1_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART1_RX_IRQHandler
|
||||
B UART1_RX_IRQHandler
|
||||
|
||||
PUBWEAK UART1_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
UART1_TX_IRQHandler
|
||||
B UART1_TX_IRQHandler
|
||||
|
||||
PUBWEAK LEUART0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LEUART0_IRQHandler
|
||||
B LEUART0_IRQHandler
|
||||
|
||||
PUBWEAK LEUART1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LEUART1_IRQHandler
|
||||
B LEUART1_IRQHandler
|
||||
|
||||
PUBWEAK LETIMER0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LETIMER0_IRQHandler
|
||||
B LETIMER0_IRQHandler
|
||||
|
||||
PUBWEAK PCNT0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT0_IRQHandler
|
||||
B PCNT0_IRQHandler
|
||||
|
||||
PUBWEAK PCNT1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT1_IRQHandler
|
||||
B PCNT1_IRQHandler
|
||||
|
||||
PUBWEAK PCNT2_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT2_IRQHandler
|
||||
B PCNT2_IRQHandler
|
||||
|
||||
PUBWEAK RTC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
RTC_IRQHandler
|
||||
B RTC_IRQHandler
|
||||
|
||||
PUBWEAK BURTC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
BURTC_IRQHandler
|
||||
B BURTC_IRQHandler
|
||||
|
||||
PUBWEAK CMU_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
CMU_IRQHandler
|
||||
B CMU_IRQHandler
|
||||
|
||||
PUBWEAK VCMP_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
VCMP_IRQHandler
|
||||
B VCMP_IRQHandler
|
||||
|
||||
PUBWEAK LCD_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LCD_IRQHandler
|
||||
B LCD_IRQHandler
|
||||
|
||||
PUBWEAK MSC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
MSC_IRQHandler
|
||||
B MSC_IRQHandler
|
||||
|
||||
PUBWEAK AES_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
AES_IRQHandler
|
||||
B AES_IRQHandler
|
||||
|
||||
PUBWEAK EBI_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
EBI_IRQHandler
|
||||
B EBI_IRQHandler
|
||||
|
||||
PUBWEAK EMU_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
EMU_IRQHandler
|
||||
B EMU_IRQHandler
|
||||
|
||||
PUBWEAK FPUEH_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
FPUEH_IRQHandler
|
||||
B FPUEH_IRQHandler
|
||||
|
||||
|
||||
END
|
|
@ -0,0 +1,33 @@
|
|||
/*###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__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x00007FFF;
|
||||
define symbol __NVIC_start__ = 0x20000000;
|
||||
define symbol __NVIC_end__ = 0x2000008B;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x2000008C;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20000FFF;
|
||||
/*-Sizes-*/
|
||||
/*Heap 1/4 of ram and stack 1/8*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x200;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x400;
|
||||
/**** 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 };
|
||||
|
||||
keep { section .intvec };
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite, block CSTACK, block HEAP };
|
||||
|
|
@ -0,0 +1,235 @@
|
|||
;/**************************************************************************//**
|
||||
; * @file startup_efm32zg.s
|
||||
; * @brief CMSIS Core Device Startup File
|
||||
; * Silicon Labs EFM32ZG Device Series
|
||||
; * @version 5.0.0
|
||||
; * @date 30. January 2012
|
||||
; *
|
||||
; * @note
|
||||
; * Copyright (C) 2012 ARM Limited. All rights reserved.
|
||||
; *
|
||||
; * @par
|
||||
; * ARM Limited (ARM) is supplying this software for use with Cortex-M
|
||||
; * processor based microcontrollers. This file can be freely distributed
|
||||
; * within development tools that are supporting such ARM based processors.
|
||||
; *
|
||||
; * @par
|
||||
; * 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.
|
||||
; *
|
||||
; ******************************************************************************/
|
||||
|
||||
;
|
||||
; 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 with at least a 128 byte
|
||||
; alignment, 256 byte alignment is requied if all interrupt vectors are in use.
|
||||
;
|
||||
; 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:CODE:NOROOT(8)
|
||||
|
||||
EXTERN __iar_program_start
|
||||
EXTERN SystemInit
|
||||
PUBLIC __vector_table
|
||||
PUBLIC __vector_table_0x1c
|
||||
PUBLIC __Vectors
|
||||
PUBLIC __Vectors_End
|
||||
PUBLIC __Vectors_Size
|
||||
|
||||
DATA
|
||||
|
||||
__vector_table
|
||||
DCD sfe(CSTACK)
|
||||
DCD Reset_Handler
|
||||
|
||||
DCD NMI_Handler
|
||||
DCD HardFault_Handler
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
__vector_table_0x1c
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD SVC_Handler
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD PendSV_Handler
|
||||
DCD SysTick_Handler
|
||||
|
||||
; External Interrupts
|
||||
|
||||
DCD DMA_IRQHandler ; 0: DMA Interrupt
|
||||
DCD GPIO_EVEN_IRQHandler ; 1: GPIO_EVEN Interrupt
|
||||
DCD TIMER0_IRQHandler ; 2: TIMER0 Interrupt
|
||||
DCD ACMP0_IRQHandler ; 3: ACMP0 Interrupt
|
||||
DCD ADC0_IRQHandler ; 4: ADC0 Interrupt
|
||||
DCD I2C0_IRQHandler ; 5: I2C0 Interrupt
|
||||
DCD GPIO_ODD_IRQHandler ; 6: GPIO_ODD Interrupt
|
||||
DCD TIMER1_IRQHandler ; 7: TIMER1 Interrupt
|
||||
DCD USART1_RX_IRQHandler ; 8: USART1_RX Interrupt
|
||||
DCD USART1_TX_IRQHandler ; 9: USART1_TX Interrupt
|
||||
DCD LEUART0_IRQHandler ; 10: LEUART0 Interrupt
|
||||
DCD PCNT0_IRQHandler ; 11: PCNT0 Interrupt
|
||||
DCD RTC_IRQHandler ; 12: RTC Interrupt
|
||||
DCD CMU_IRQHandler ; 13: CMU Interrupt
|
||||
DCD VCMP_IRQHandler ; 14: VCMP Interrupt
|
||||
DCD MSC_IRQHandler ; 15: MSC Interrupt
|
||||
DCD AES_IRQHandler ; 16: AES Interrupt
|
||||
DCD 0 ; 17: Reserved Interrupt
|
||||
DCD 0 ; 18: Reserved Interrupt
|
||||
|
||||
|
||||
__Vectors_End
|
||||
__Vectors EQU __vector_table
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 SVC_Handler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
SVC_Handler
|
||||
B SVC_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
|
||||
|
||||
; Device specific interrupt handlers
|
||||
|
||||
PUBWEAK DMA_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
DMA_IRQHandler
|
||||
B DMA_IRQHandler
|
||||
|
||||
PUBWEAK GPIO_EVEN_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
GPIO_EVEN_IRQHandler
|
||||
B GPIO_EVEN_IRQHandler
|
||||
|
||||
PUBWEAK TIMER0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER0_IRQHandler
|
||||
B TIMER0_IRQHandler
|
||||
|
||||
PUBWEAK ACMP0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ACMP0_IRQHandler
|
||||
B ACMP0_IRQHandler
|
||||
|
||||
PUBWEAK ADC0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
ADC0_IRQHandler
|
||||
B ADC0_IRQHandler
|
||||
|
||||
PUBWEAK I2C0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
I2C0_IRQHandler
|
||||
B I2C0_IRQHandler
|
||||
|
||||
PUBWEAK GPIO_ODD_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
GPIO_ODD_IRQHandler
|
||||
B GPIO_ODD_IRQHandler
|
||||
|
||||
PUBWEAK TIMER1_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
TIMER1_IRQHandler
|
||||
B TIMER1_IRQHandler
|
||||
|
||||
PUBWEAK USART1_RX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART1_RX_IRQHandler
|
||||
B USART1_RX_IRQHandler
|
||||
|
||||
PUBWEAK USART1_TX_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
USART1_TX_IRQHandler
|
||||
B USART1_TX_IRQHandler
|
||||
|
||||
PUBWEAK LEUART0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
LEUART0_IRQHandler
|
||||
B LEUART0_IRQHandler
|
||||
|
||||
PUBWEAK PCNT0_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
PCNT0_IRQHandler
|
||||
B PCNT0_IRQHandler
|
||||
|
||||
PUBWEAK RTC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
RTC_IRQHandler
|
||||
B RTC_IRQHandler
|
||||
|
||||
PUBWEAK CMU_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
CMU_IRQHandler
|
||||
B CMU_IRQHandler
|
||||
|
||||
PUBWEAK VCMP_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
VCMP_IRQHandler
|
||||
B VCMP_IRQHandler
|
||||
|
||||
PUBWEAK MSC_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
MSC_IRQHandler
|
||||
B MSC_IRQHandler
|
||||
|
||||
PUBWEAK AES_IRQHandler
|
||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
||||
AES_IRQHandler
|
||||
B AES_IRQHandler
|
||||
|
||||
|
||||
END
|
|
@ -1337,6 +1337,34 @@ 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_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
|
||||
#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 */
|
||||
|
||||
/** \brief Set Priority Grouping
|
||||
|
||||
The function sets the priority grouping field using the required unlock sequence.
|
||||
|
@ -1347,7 +1375,7 @@ typedef struct
|
|||
|
||||
\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 */
|
||||
|
@ -1367,7 +1395,7 @@ __STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
|
|||
|
||||
\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));
|
||||
}
|
||||
|
@ -1379,7 +1407,7 @@ __STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
|
|||
|
||||
\param [in] IRQn External interrupt number. Value cannot be negative.
|
||||
*/
|
||||
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
|
||||
__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
|
||||
{
|
||||
NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
|
||||
}
|
||||
|
@ -1391,7 +1419,7 @@ __STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
|
|||
|
||||
\param [in] IRQn External interrupt number. Value cannot 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));
|
||||
}
|
||||
|
@ -1407,7 +1435,7 @@ __STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
|
|||
\return 0 Interrupt status is not pending.
|
||||
\return 1 Interrupt status is pending.
|
||||
*/
|
||||
__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));
|
||||
}
|
||||
|
@ -1419,7 +1447,7 @@ __STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
|
|||
|
||||
\param [in] IRQn Interrupt number. Value cannot 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));
|
||||
}
|
||||
|
@ -1431,7 +1459,7 @@ __STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
|
|||
|
||||
\param [in] IRQn External interrupt number. Value cannot 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));
|
||||
}
|
||||
|
@ -1446,7 +1474,7 @@ __STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
|
|||
\return 0 Interrupt status is not active.
|
||||
\return 1 Interrupt status is active.
|
||||
*/
|
||||
__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));
|
||||
}
|
||||
|
@ -1461,7 +1489,7 @@ __STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
|
|||
\param [in] IRQn Interrupt number.
|
||||
\param [in] priority Priority to set.
|
||||
*/
|
||||
__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) {
|
||||
SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8 - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
|
||||
|
@ -1483,7 +1511,7 @@ __STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
|
|||
\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) {
|
||||
|
|
|
@ -23,8 +23,10 @@ void mbed_sdk_init(void) {
|
|||
EFlash_DriverInitialize();
|
||||
EFlash_ClockConfig();
|
||||
|
||||
#if !defined(FEATURE_UVISOR) || !defined(TARGET_UVISOR_SUPPORTED)
|
||||
/* Enable Flash Cache Stats */
|
||||
FCache_DriverInitialize();
|
||||
FCache_Enable(1);
|
||||
FCache_Invalidate();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -98,6 +98,8 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
|||
temp |= (UART_C1_PE_MASK | UART_C1_M_MASK);
|
||||
if (parity == ParityOdd) {
|
||||
temp |= UART_C1_PT_MASK;
|
||||
} else if (parity == ParityEven) {
|
||||
// PT=0 so nothing more to do
|
||||
} else {
|
||||
// Hardware does not support forced parity
|
||||
MBED_ASSERT(0);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Freescale Semiconductor, Inc.
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -50,6 +50,9 @@
|
|||
#define SDHC_NEXT_CLKFS(x) ((x) <<= 1U)
|
||||
#define SDHC_PREV_CLKFS(x) ((x) >>= 1U)
|
||||
|
||||
/* Typedef for interrupt handler. */
|
||||
typedef void (*sdhc_isr_t)(SDHC_Type *base, sdhc_handle_t *handle);
|
||||
|
||||
/*! @brief ADMA table configuration */
|
||||
typedef struct _sdhc_adma_table_config
|
||||
{
|
||||
|
@ -230,6 +233,9 @@ static const IRQn_Type s_sdhcIRQ[] = SDHC_IRQS;
|
|||
/*! @brief SDHC clock array name */
|
||||
static const clock_ip_name_t s_sdhcClock[] = SDHC_CLOCKS;
|
||||
|
||||
/* SDHC ISR for transactional APIs. */
|
||||
static sdhc_isr_t s_sdhcIsr;
|
||||
|
||||
/*******************************************************************************
|
||||
* Code
|
||||
******************************************************************************/
|
||||
|
@ -288,10 +294,8 @@ static void SDHC_SetTransferInterrupt(SDHC_Type *base, bool usingInterruptSignal
|
|||
|
||||
static void SDHC_StartTransfer(SDHC_Type *base, sdhc_command_t *command, sdhc_data_t *data)
|
||||
{
|
||||
assert(command);
|
||||
|
||||
uint32_t flags = 0U;
|
||||
sdhc_transfer_config_t sdhcTransferConfig;
|
||||
sdhc_transfer_config_t sdhcTransferConfig = {0};
|
||||
sdhc_dma_mode_t dmaMode;
|
||||
|
||||
/* Define the flag corresponding to each response type. */
|
||||
|
@ -315,7 +319,7 @@ static void SDHC_StartTransfer(SDHC_Type *base, sdhc_command_t *command, sdhc_da
|
|||
flags |= (kSDHC_ResponseLength48Flag);
|
||||
break;
|
||||
case kSDHC_ResponseTypeR5: /* Response 5 */
|
||||
flags |= (kSDHC_ResponseLength48Flag | kSDHC_EnableCrcCheckFlag);
|
||||
flags |= (kSDHC_ResponseLength48Flag | kSDHC_EnableCrcCheckFlag | kSDHC_EnableIndexCheckFlag);
|
||||
break;
|
||||
case kSDHC_ResponseTypeR5b: /* Response 5 with busy */
|
||||
flags |= (kSDHC_ResponseLength48BusyFlag | kSDHC_EnableCrcCheckFlag | kSDHC_EnableIndexCheckFlag);
|
||||
|
@ -355,18 +359,9 @@ static void SDHC_StartTransfer(SDHC_Type *base, sdhc_command_t *command, sdhc_da
|
|||
flags |= kSDHC_EnableAutoCommand12Flag;
|
||||
}
|
||||
}
|
||||
if (data->blockCount > SDHC_MAX_BLOCK_COUNT)
|
||||
{
|
||||
sdhcTransferConfig.dataBlockSize = data->blockSize;
|
||||
sdhcTransferConfig.dataBlockCount = SDHC_MAX_BLOCK_COUNT;
|
||||
|
||||
flags &= ~(uint32_t)kSDHC_EnableBlockCountFlag;
|
||||
}
|
||||
else
|
||||
{
|
||||
sdhcTransferConfig.dataBlockSize = data->blockSize;
|
||||
sdhcTransferConfig.dataBlockCount = data->blockCount;
|
||||
}
|
||||
sdhcTransferConfig.dataBlockSize = data->blockSize;
|
||||
sdhcTransferConfig.dataBlockCount = data->blockCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -382,8 +377,6 @@ static void SDHC_StartTransfer(SDHC_Type *base, sdhc_command_t *command, sdhc_da
|
|||
|
||||
static void SDHC_ReceiveCommandResponse(SDHC_Type *base, sdhc_command_t *command)
|
||||
{
|
||||
assert(command);
|
||||
|
||||
uint32_t i;
|
||||
|
||||
if (command->responseType != kSDHC_ResponseTypeNone)
|
||||
|
@ -412,13 +405,22 @@ static void SDHC_ReceiveCommandResponse(SDHC_Type *base, sdhc_command_t *command
|
|||
|
||||
static uint32_t SDHC_ReadDataPort(SDHC_Type *base, sdhc_data_t *data, uint32_t transferredWords)
|
||||
{
|
||||
assert(data);
|
||||
|
||||
uint32_t i;
|
||||
uint32_t totalWords;
|
||||
uint32_t wordsCanBeRead; /* The words can be read at this time. */
|
||||
uint32_t readWatermark = ((base->WML & SDHC_WML_RDWML_MASK) >> SDHC_WML_RDWML_SHIFT);
|
||||
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (data->blockSize % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
data->blockSize +=
|
||||
sizeof(uint32_t) - (data->blockSize % sizeof(uint32_t)); /* make the block size as word-aligned */
|
||||
}
|
||||
|
||||
totalWords = ((data->blockCount * data->blockSize) / sizeof(uint32_t));
|
||||
|
||||
/* If watermark level is equal or bigger than totalWords, transfers totalWords data. */
|
||||
|
@ -451,12 +453,21 @@ static uint32_t SDHC_ReadDataPort(SDHC_Type *base, sdhc_data_t *data, uint32_t t
|
|||
|
||||
static status_t SDHC_ReadByDataPortBlocking(SDHC_Type *base, sdhc_data_t *data)
|
||||
{
|
||||
assert(data);
|
||||
|
||||
uint32_t totalWords;
|
||||
uint32_t transferredWords = 0U;
|
||||
status_t error = kStatus_Success;
|
||||
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (data->blockSize % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
data->blockSize +=
|
||||
sizeof(uint32_t) - (data->blockSize % sizeof(uint32_t)); /* make the block size as word-aligned */
|
||||
}
|
||||
|
||||
totalWords = ((data->blockCount * data->blockSize) / sizeof(uint32_t));
|
||||
|
||||
while ((error == kStatus_Success) && (transferredWords < totalWords))
|
||||
|
@ -489,13 +500,22 @@ static status_t SDHC_ReadByDataPortBlocking(SDHC_Type *base, sdhc_data_t *data)
|
|||
|
||||
static uint32_t SDHC_WriteDataPort(SDHC_Type *base, sdhc_data_t *data, uint32_t transferredWords)
|
||||
{
|
||||
assert(data);
|
||||
|
||||
uint32_t i;
|
||||
uint32_t totalWords;
|
||||
uint32_t wordsCanBeWrote; /* Words can be wrote at this time. */
|
||||
uint32_t writeWatermark = ((base->WML & SDHC_WML_WRWML_MASK) >> SDHC_WML_WRWML_SHIFT);
|
||||
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (data->blockSize % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
data->blockSize +=
|
||||
sizeof(uint32_t) - (data->blockSize % sizeof(uint32_t)); /* make the block size as word-aligned */
|
||||
}
|
||||
|
||||
totalWords = ((data->blockCount * data->blockSize) / sizeof(uint32_t));
|
||||
|
||||
/* If watermark level is equal or bigger than totalWords, transfers totalWords data.*/
|
||||
|
@ -528,12 +548,21 @@ static uint32_t SDHC_WriteDataPort(SDHC_Type *base, sdhc_data_t *data, uint32_t
|
|||
|
||||
static status_t SDHC_WriteByDataPortBlocking(SDHC_Type *base, sdhc_data_t *data)
|
||||
{
|
||||
assert(data);
|
||||
|
||||
uint32_t totalWords;
|
||||
uint32_t transferredWords = 0U;
|
||||
status_t error = kStatus_Success;
|
||||
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (data->blockSize % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
data->blockSize +=
|
||||
sizeof(uint32_t) - (data->blockSize % sizeof(uint32_t)); /* make the block size as word-aligned */
|
||||
}
|
||||
|
||||
totalWords = (data->blockCount * data->blockSize) / sizeof(uint32_t);
|
||||
|
||||
while ((error == kStatus_Success) && (transferredWords < totalWords))
|
||||
|
@ -576,8 +605,6 @@ static status_t SDHC_WriteByDataPortBlocking(SDHC_Type *base, sdhc_data_t *data)
|
|||
|
||||
static status_t SDHC_SendCommandBlocking(SDHC_Type *base, sdhc_command_t *command)
|
||||
{
|
||||
assert(command);
|
||||
|
||||
status_t error = kStatus_Success;
|
||||
|
||||
/* Wait command complete or SDHC encounters error. */
|
||||
|
@ -602,8 +629,6 @@ static status_t SDHC_SendCommandBlocking(SDHC_Type *base, sdhc_command_t *comman
|
|||
|
||||
static status_t SDHC_TransferByDataPortBlocking(SDHC_Type *base, sdhc_data_t *data)
|
||||
{
|
||||
assert(data);
|
||||
|
||||
status_t error = kStatus_Success;
|
||||
|
||||
if (data->rxData)
|
||||
|
@ -669,8 +694,6 @@ static status_t SDHC_TransferDataBlocking(sdhc_dma_mode_t dmaMode, SDHC_Type *ba
|
|||
|
||||
static void SDHC_TransferHandleCardDetect(sdhc_handle_t *handle, uint32_t interruptFlags)
|
||||
{
|
||||
assert(interruptFlags & kSDHC_CardDetectFlag);
|
||||
|
||||
if (interruptFlags & kSDHC_CardInsertionFlag)
|
||||
{
|
||||
if (handle->callback.CardInserted)
|
||||
|
@ -689,7 +712,7 @@ static void SDHC_TransferHandleCardDetect(sdhc_handle_t *handle, uint32_t interr
|
|||
|
||||
static void SDHC_TransferHandleCommand(SDHC_Type *base, sdhc_handle_t *handle, uint32_t interruptFlags)
|
||||
{
|
||||
assert(interruptFlags & kSDHC_CommandFlag);
|
||||
assert(handle->command);
|
||||
|
||||
if ((interruptFlags & kSDHC_CommandErrorFlag) && (!(handle->data)) && (handle->callback.TransferComplete))
|
||||
{
|
||||
|
@ -709,7 +732,6 @@ static void SDHC_TransferHandleCommand(SDHC_Type *base, sdhc_handle_t *handle, u
|
|||
static void SDHC_TransferHandleData(SDHC_Type *base, sdhc_handle_t *handle, uint32_t interruptFlags)
|
||||
{
|
||||
assert(handle->data);
|
||||
assert(interruptFlags & kSDHC_DataFlag);
|
||||
|
||||
if ((!(handle->data->enableIgnoreError)) && (interruptFlags & (kSDHC_DataErrorFlag | kSDHC_DmaErrorFlag)) &&
|
||||
(handle->callback.TransferComplete))
|
||||
|
@ -759,6 +781,8 @@ void SDHC_Init(SDHC_Type *base, const sdhc_config_t *config)
|
|||
#if !defined FSL_SDHC_ENABLE_ADMA1
|
||||
assert(config->dmaMode != kSDHC_DmaModeAdma1);
|
||||
#endif /* FSL_SDHC_ENABLE_ADMA1 */
|
||||
assert((config->writeWatermarkLevel >= 1U) && (config->writeWatermarkLevel <= 128U));
|
||||
assert((config->readWatermarkLevel >= 1U) && (config->readWatermarkLevel <= 128U));
|
||||
|
||||
uint32_t proctl;
|
||||
uint32_t wml;
|
||||
|
@ -850,7 +874,8 @@ void SDHC_GetCapability(SDHC_Type *base, sdhc_capability_t *capability)
|
|||
|
||||
uint32_t SDHC_SetSdClock(SDHC_Type *base, uint32_t srcClock_Hz, uint32_t busClock_Hz)
|
||||
{
|
||||
assert(busClock_Hz && (busClock_Hz < srcClock_Hz));
|
||||
assert(srcClock_Hz != 0U);
|
||||
assert((busClock_Hz != 0U) && (busClock_Hz <= srcClock_Hz));
|
||||
|
||||
uint32_t divisor;
|
||||
uint32_t prescaler;
|
||||
|
@ -898,7 +923,7 @@ bool SDHC_SetCardActive(SDHC_Type *base, uint32_t timeout)
|
|||
{
|
||||
base->SYSCTL |= SDHC_SYSCTL_INITA_MASK;
|
||||
/* Delay some time to wait card become active state. */
|
||||
while (!(base->SYSCTL & SDHC_SYSCTL_INITA_MASK))
|
||||
while (base->SYSCTL & SDHC_SYSCTL_INITA_MASK)
|
||||
{
|
||||
if (!timeout)
|
||||
{
|
||||
|
@ -913,6 +938,8 @@ bool SDHC_SetCardActive(SDHC_Type *base, uint32_t timeout)
|
|||
void SDHC_SetTransferConfig(SDHC_Type *base, const sdhc_transfer_config_t *config)
|
||||
{
|
||||
assert(config);
|
||||
assert(config->dataBlockSize <= (SDHC_BLKATTR_BLKSIZE_MASK >> SDHC_BLKATTR_BLKSIZE_SHIFT));
|
||||
assert(config->dataBlockCount <= (SDHC_BLKATTR_BLKCNT_MASK >> SDHC_BLKATTR_BLKCNT_SHIFT));
|
||||
|
||||
base->BLKATTR = ((base->BLKATTR & ~(SDHC_BLKATTR_BLKSIZE_MASK | SDHC_BLKATTR_BLKCNT_MASK)) |
|
||||
(SDHC_BLKATTR_BLKSIZE(config->dataBlockSize) | SDHC_BLKATTR_BLKCNT(config->dataBlockCount)));
|
||||
|
@ -975,12 +1002,13 @@ void SDHC_EnableSdioControl(SDHC_Type *base, uint32_t mask, bool enable)
|
|||
void SDHC_SetMmcBootConfig(SDHC_Type *base, const sdhc_boot_config_t *config)
|
||||
{
|
||||
assert(config);
|
||||
assert(config->ackTimeoutCount <= (SDHC_MMCBOOT_DTOCVACK_MASK >> SDHC_MMCBOOT_DTOCVACK_SHIFT));
|
||||
assert(config->blockCount <= (SDHC_MMCBOOT_BOOTBLKCNT_MASK >> SDHC_MMCBOOT_BOOTBLKCNT_SHIFT));
|
||||
|
||||
uint32_t mmcboot;
|
||||
uint32_t mmcboot = 0U;
|
||||
|
||||
mmcboot = base->MMCBOOT;
|
||||
mmcboot |= (SDHC_MMCBOOT_DTOCVACK(config->ackTimeoutCount) | SDHC_MMCBOOT_BOOTMODE(config->bootMode) |
|
||||
SDHC_MMCBOOT_BOOTBLKCNT(config->blockCount));
|
||||
mmcboot = (SDHC_MMCBOOT_DTOCVACK(config->ackTimeoutCount) | SDHC_MMCBOOT_BOOTMODE(config->bootMode) |
|
||||
SDHC_MMCBOOT_BOOTBLKCNT(config->blockCount));
|
||||
if (config->enableBootAck)
|
||||
{
|
||||
mmcboot |= SDHC_MMCBOOT_BOOTACK_MASK;
|
||||
|
@ -1016,6 +1044,9 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
(!data) || (!dataBytes)
|
||||
#if !defined FSL_SDHC_ENABLE_ADMA1
|
||||
|| (dmaMode == kSDHC_DmaModeAdma1)
|
||||
#else
|
||||
/* Buffer address configured in ADMA1 descriptor must be 4KB aligned. */
|
||||
|| ((dmaMode == kSDHC_DmaModeAdma1) && (((uint32_t)data % SDHC_ADMA1_LENGTH_ALIGN) != 0U))
|
||||
#endif /* FSL_SDHC_ENABLE_ADMA1 */
|
||||
)
|
||||
{
|
||||
|
@ -1029,6 +1060,17 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
break;
|
||||
#if defined FSL_SDHC_ENABLE_ADMA1
|
||||
case kSDHC_DmaModeAdma1:
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (dataBytes % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
dataBytes +=
|
||||
sizeof(uint32_t) - (dataBytes % sizeof(uint32_t)); /* make the data length as word-aligned */
|
||||
}
|
||||
|
||||
startAddress = data;
|
||||
/* Check if ADMA descriptor's number is enough. */
|
||||
entries = ((dataBytes / SDHC_ADMA1_DESCRIPTOR_MAX_LENGTH_PER_ENTRY) + 1U);
|
||||
|
@ -1054,7 +1096,7 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
adma1EntryAddress[i + 1U] =
|
||||
((uint32_t)(startAddress) << SDHC_ADMA1_DESCRIPTOR_ADDRESS_SHIFT);
|
||||
adma1EntryAddress[i + 1U] |=
|
||||
(SDHC_ADMA1_DESCRIPTOR_TYPE_TRANSFER | SDHC_ADMA1_DESCRIPTOR_END_MASK);
|
||||
(kSDHC_Adma1DescriptorTypeTransfer | kSDHC_Adma1DescriptorEndFlag);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1075,6 +1117,17 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
break;
|
||||
#endif /* FSL_SDHC_ENABLE_ADMA1 */
|
||||
case kSDHC_DmaModeAdma2:
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (dataBytes % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
dataBytes +=
|
||||
sizeof(uint32_t) - (dataBytes % sizeof(uint32_t)); /* make the data length as word-aligned */
|
||||
}
|
||||
|
||||
startAddress = data;
|
||||
/* Check if ADMA descriptor's number is enough. */
|
||||
entries = ((dataBytes / SDHC_ADMA2_DESCRIPTOR_MAX_LENGTH_PER_ENTRY) + 1U);
|
||||
|
@ -1125,15 +1178,14 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
status_t SDHC_TransferBlocking(SDHC_Type *base, uint32_t *admaTable, uint32_t admaTableWords, sdhc_transfer_t *transfer)
|
||||
{
|
||||
assert(transfer);
|
||||
assert(transfer->command); /* Command must not be NULL, data can be NULL. */
|
||||
|
||||
status_t error = kStatus_Success;
|
||||
sdhc_dma_mode_t dmaMode = (sdhc_dma_mode_t)((base->PROCTL & SDHC_PROCTL_DMAS_MASK) >> SDHC_PROCTL_DMAS_SHIFT);
|
||||
sdhc_command_t *command = transfer->command;
|
||||
sdhc_data_t *data = transfer->data;
|
||||
|
||||
/* DATA-PORT is 32-bit align, ADMA2 4 bytes align, ADMA1 is 4096 bytes align */
|
||||
if ((!command) || (data && (data->blockSize % 4U)))
|
||||
/* make sure the cmd/block count is valid */
|
||||
if ((!command) || (data && (data->blockCount > SDHC_MAX_BLOCK_COUNT)))
|
||||
{
|
||||
error = kStatus_InvalidArgument;
|
||||
}
|
||||
|
@ -1147,7 +1199,7 @@ status_t SDHC_TransferBlocking(SDHC_Type *base, uint32_t *admaTable, uint32_t ad
|
|||
{
|
||||
}
|
||||
|
||||
/* Update ADMA descriptor table if data isn't NULL. */
|
||||
/* Update ADMA descriptor table according to different DMA mode(no DMA, ADMA1, ADMA2).*/
|
||||
if (data && (kStatus_Success != SDHC_SetAdmaTableConfig(base, dmaMode, admaTable, admaTableWords,
|
||||
(data->rxData ? data->rxData : data->txData),
|
||||
(data->blockCount * data->blockSize))))
|
||||
|
@ -1156,9 +1208,8 @@ status_t SDHC_TransferBlocking(SDHC_Type *base, uint32_t *admaTable, uint32_t ad
|
|||
}
|
||||
else
|
||||
{
|
||||
SDHC_StartTransfer(base, command, data);
|
||||
|
||||
/* Send command and receive data. */
|
||||
SDHC_StartTransfer(base, command, data);
|
||||
if (kStatus_Success != SDHC_SendCommandBlocking(base, command))
|
||||
{
|
||||
error = kStatus_SDHC_SendCommandFailed;
|
||||
|
@ -1200,6 +1251,10 @@ void SDHC_TransferCreateHandle(SDHC_Type *base,
|
|||
|
||||
/* Enable interrupt in NVIC. */
|
||||
SDHC_SetTransferInterrupt(base, true);
|
||||
|
||||
/* save IRQ handler */
|
||||
s_sdhcIsr = SDHC_TransferHandleIRQ;
|
||||
|
||||
EnableIRQ(s_sdhcIRQ[SDHC_GetInstance(base)]);
|
||||
}
|
||||
|
||||
|
@ -1213,8 +1268,8 @@ status_t SDHC_TransferNonBlocking(
|
|||
sdhc_command_t *command = transfer->command;
|
||||
sdhc_data_t *data = transfer->data;
|
||||
|
||||
/* DATA-PORT is 32-bit align, ADMA2 4 bytes align, ADMA1 is 4096 bytes align */
|
||||
if ((!(transfer->command)) || ((transfer->data) && (transfer->data->blockSize % 4U)))
|
||||
/* make sure cmd/block count is valid */
|
||||
if ((!command) || (data && (data->blockCount > SDHC_MAX_BLOCK_COUNT)))
|
||||
{
|
||||
error = kStatus_InvalidArgument;
|
||||
}
|
||||
|
@ -1228,7 +1283,7 @@ status_t SDHC_TransferNonBlocking(
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Update ADMA descriptor table and reset transferred words if data isn't NULL. */
|
||||
/* Update ADMA descriptor table according to different DMA mode(no DMA, ADMA1, ADMA2).*/
|
||||
if (data && (kStatus_Success != SDHC_SetAdmaTableConfig(base, dmaMode, admaTable, admaTableWords,
|
||||
(data->rxData ? data->rxData : data->txData),
|
||||
(data->blockCount * data->blockSize))))
|
||||
|
@ -1243,6 +1298,7 @@ status_t SDHC_TransferNonBlocking(
|
|||
handle->interruptFlags = 0U;
|
||||
/* transferredWords will only be updated in ISR when transfer way is DATAPORT. */
|
||||
handle->transferredWords = 0U;
|
||||
|
||||
SDHC_StartTransfer(base, command, data);
|
||||
}
|
||||
}
|
||||
|
@ -1289,6 +1345,6 @@ void SDHC_DriverIRQHandler(void)
|
|||
{
|
||||
assert(s_sdhcHandle[0]);
|
||||
|
||||
SDHC_TransferHandleIRQ(SDHC, s_sdhcHandle[0]);
|
||||
s_sdhcIsr(SDHC, s_sdhcHandle[0]);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -37,16 +37,14 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/*! @file */
|
||||
|
||||
/******************************************************************************
|
||||
* Definitions.
|
||||
*****************************************************************************/
|
||||
|
||||
/*! @name Driver version */
|
||||
/*@{*/
|
||||
/*! @brief Driver version 2.0.0. */
|
||||
#define FSL_SDHC_DRIVER_VERSION (MAKE_VERSION(2U, 0U, 0U))
|
||||
/*! @brief Driver version 2.1.2. */
|
||||
#define FSL_SDHC_DRIVER_VERSION (MAKE_VERSION(2U, 1U, 2U))
|
||||
/*@}*/
|
||||
|
||||
/*! @brief Maximum block count can be set one time */
|
||||
|
@ -350,7 +348,7 @@ typedef enum _sdhc_response_type
|
|||
#define SDHC_ADMA1_DESCRIPTOR_LENGTH_SHIFT (12U)
|
||||
/*! @brief The mask for LENGTH field in ADMA1's descriptor */
|
||||
#define SDHC_ADMA1_DESCRIPTOR_LENGTH_MASK (0xFFFFU)
|
||||
/*! @brief The max value of LENGTH filed in ADMA1's descriptor */
|
||||
/*! @brief The maximum value of LENGTH filed in ADMA1's descriptor */
|
||||
#define SDHC_ADMA1_DESCRIPTOR_MAX_LENGTH_PER_ENTRY (SDHC_ADMA1_DESCRIPTOR_LENGTH_MASK + 1U)
|
||||
|
||||
/*! @brief The mask for the control/status field in ADMA1 descriptor */
|
||||
|
@ -395,7 +393,7 @@ enum _sdhc_adma1_descriptor_flag
|
|||
#define SDHC_ADMA2_DESCRIPTOR_LENGTH_SHIFT (16U)
|
||||
/*! @brief The bit mask for LENGTH field in ADMA2's descriptor */
|
||||
#define SDHC_ADMA2_DESCRIPTOR_LENGTH_MASK (0xFFFFU)
|
||||
/*! @brief The max value of LENGTH field in ADMA2's descriptor */
|
||||
/*! @brief The maximum value of LENGTH field in ADMA2's descriptor */
|
||||
#define SDHC_ADMA2_DESCRIPTOR_MAX_LENGTH_PER_ENTRY (SDHC_ADMA2_DESCRIPTOR_LENGTH_MASK)
|
||||
|
||||
/*! @brief ADMA1 descriptor control and status mask */
|
||||
|
@ -416,10 +414,10 @@ enum _sdhc_adma2_descriptor_flag
|
|||
kSDHC_Adma2DescriptorValidFlag), /*!< Link type */
|
||||
};
|
||||
|
||||
/*! @brief Define the adma1 descriptor structure. */
|
||||
/*! @brief Defines the adma1 descriptor structure. */
|
||||
typedef uint32_t sdhc_adma1_descriptor_t;
|
||||
|
||||
/*! @brief Define the ADMA2 descriptor structure. */
|
||||
/*! @brief Defines the ADMA2 descriptor structure. */
|
||||
typedef struct _sdhc_adma2_descriptor
|
||||
{
|
||||
uint32_t attribute; /*!< The control and status field */
|
||||
|
@ -429,7 +427,7 @@ typedef struct _sdhc_adma2_descriptor
|
|||
/*!
|
||||
* @brief SDHC capability information.
|
||||
*
|
||||
* Define structure to save the capability information of SDHC.
|
||||
* Defines a structure to save the capability information of SDHC.
|
||||
*/
|
||||
typedef struct _sdhc_capability
|
||||
{
|
||||
|
@ -457,9 +455,9 @@ typedef struct _sdhc_transfer_config
|
|||
/*! @brief Data structure to configure the MMC boot feature */
|
||||
typedef struct _sdhc_boot_config
|
||||
{
|
||||
uint32_t ackTimeoutCount; /*!< Timeout value for the boot ACK */
|
||||
uint32_t ackTimeoutCount; /*!< Timeout value for the boot ACK. The available range is 0 ~ 15. */
|
||||
sdhc_boot_mode_t bootMode; /*!< Boot mode selection. */
|
||||
uint32_t blockCount; /*!< Stop at block gap value of automatic mode */
|
||||
uint32_t blockCount; /*!< Stop at block gap value of automatic mode. Available range is 0 ~ 65535. */
|
||||
bool enableBootAck; /*!< Enable or disable boot ACK */
|
||||
bool enableBoot; /*!< Enable or disable fast boot */
|
||||
bool enableAutoStopAtBlockGap; /*!< Enable or disable auto stop at block gap function in boot period */
|
||||
|
@ -471,15 +469,15 @@ typedef struct _sdhc_config
|
|||
bool cardDetectDat3; /*!< Enable DAT3 as card detection pin */
|
||||
sdhc_endian_mode_t endianMode; /*!< Endian mode */
|
||||
sdhc_dma_mode_t dmaMode; /*!< DMA mode */
|
||||
uint32_t readWatermarkLevel; /*!< Watermark level for DMA read operation */
|
||||
uint32_t writeWatermarkLevel; /*!< Watermark level for DMA write operation */
|
||||
uint32_t readWatermarkLevel; /*!< Watermark level for DMA read operation. Available range is 1 ~ 128. */
|
||||
uint32_t writeWatermarkLevel; /*!< Watermark level for DMA write operation. Available range is 1 ~ 128. */
|
||||
} sdhc_config_t;
|
||||
|
||||
/*!
|
||||
* @brief Card data descriptor
|
||||
*
|
||||
* Define structure to contain data-related attribute. 'enableIgnoreError' is used for the case that upper card driver
|
||||
* want to ignore the error event to read/write all the data not to stop read/write immediately when error event
|
||||
* Defines a structure to contain data-related attribute. 'enableIgnoreError' is used for the case that upper card
|
||||
* driver want to ignore the error event to read/write all the data not to stop read/write immediately when error event
|
||||
* happen for example bus testing procedure for MMC card.
|
||||
*/
|
||||
typedef struct _sdhc_data
|
||||
|
@ -530,10 +528,11 @@ typedef struct _sdhc_transfer_callback
|
|||
} sdhc_transfer_callback_t;
|
||||
|
||||
/*!
|
||||
* @brief Host descriptor
|
||||
* @brief SDHC handle
|
||||
*
|
||||
* Define the structure to save the SDHC state information and callback function. The detail interrupt status when
|
||||
* send command or transfer data can be got from interruptFlags field by using mask defined in sdhc_interrupt_flag_t;
|
||||
* Defines the structure to save the SDHC state information and callback function. The detailed interrupt status when
|
||||
* sending a command or transfering data can be obtained from the interruptFlags field by using the mask defined in
|
||||
* sdhc_interrupt_flag_t.
|
||||
*
|
||||
* @note All the fields except interruptFlags and transferredWords must be allocated by the user.
|
||||
*/
|
||||
|
@ -580,16 +579,16 @@ extern "C" {
|
|||
/*!
|
||||
* @brief SDHC module initialization function.
|
||||
*
|
||||
* Configure the SDHC according to the user configuration.
|
||||
* Configures the SDHC according to the user configuration.
|
||||
*
|
||||
* Example:
|
||||
@code
|
||||
sdhc_config_t config;
|
||||
config.enableDat3AsCDPin = false;
|
||||
config.cardDetectDat3 = false;
|
||||
config.endianMode = kSDHC_EndianModeLittle;
|
||||
config.dmaMode = kSDHC_DmaModeAdma2;
|
||||
config.readWatermarkLevel = 512U;
|
||||
config.writeWatermarkLevel = 512U;
|
||||
config.readWatermarkLevel = 128U;
|
||||
config.writeWatermarkLevel = 128U;
|
||||
SDHC_Init(SDHC, &config);
|
||||
@endcode
|
||||
*
|
||||
|
@ -600,14 +599,14 @@ extern "C" {
|
|||
void SDHC_Init(SDHC_Type *base, const sdhc_config_t *config);
|
||||
|
||||
/*!
|
||||
* @brief Deinitialize the SDHC.
|
||||
* @brief Deinitializes the SDHC.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
*/
|
||||
void SDHC_Deinit(SDHC_Type *base);
|
||||
|
||||
/*!
|
||||
* @brief Reset the SDHC.
|
||||
* @brief Resets the SDHC.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The reset type mask(_sdhc_reset).
|
||||
|
@ -625,7 +624,7 @@ bool SDHC_Reset(SDHC_Type *base, uint32_t mask, uint32_t timeout);
|
|||
*/
|
||||
|
||||
/*!
|
||||
* @brief Set ADMA descriptor table configuration.
|
||||
* @brief Sets the ADMA descriptor table configuration.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param dmaMode DMA mode.
|
||||
|
@ -651,7 +650,7 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
*/
|
||||
|
||||
/*!
|
||||
* @brief Enable interrupt status
|
||||
* @brief Enables the interrupt status.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask Interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -662,7 +661,7 @@ static inline void SDHC_EnableInterruptStatus(SDHC_Type *base, uint32_t mask)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Disable interrupt status.
|
||||
* @brief Disables the interrupt status.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -673,7 +672,7 @@ static inline void SDHC_DisableInterruptStatus(SDHC_Type *base, uint32_t mask)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Enable interrupts signal corresponding to the interrupt status flag.
|
||||
* @brief Enables the interrupt signal corresponding to the interrupt status flag.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -684,7 +683,7 @@ static inline void SDHC_EnableInterruptSignal(SDHC_Type *base, uint32_t mask)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Disable interrupts signal corresponding to the interrupt status flag.
|
||||
* @brief Disables the interrupt signal corresponding to the interrupt status flag.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -702,7 +701,7 @@ static inline void SDHC_DisableInterruptSignal(SDHC_Type *base, uint32_t mask)
|
|||
*/
|
||||
|
||||
/*!
|
||||
* @brief Get current interrupt status.
|
||||
* @brief Gets the current interrupt status.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @return Current interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -713,7 +712,7 @@ static inline uint32_t SDHC_GetInterruptStatusFlags(SDHC_Type *base)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Clear specified interrupt status.
|
||||
* @brief Clears a specified interrupt status.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -724,7 +723,7 @@ static inline void SDHC_ClearInterruptStatusFlags(SDHC_Type *base, uint32_t mask
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the status of auto command 12 error.
|
||||
* @brief Gets the status of auto command 12 error.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @return Auto command 12 error status flags mask(_sdhc_auto_command12_error_status_flag).
|
||||
|
@ -735,7 +734,7 @@ static inline uint32_t SDHC_GetAutoCommand12ErrorStatusFlags(SDHC_Type *base)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the status of ADMA error.
|
||||
* @brief Gets the status of the ADMA error.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @return ADMA error status flags mask(_sdhc_adma_error_status_flag).
|
||||
|
@ -746,9 +745,9 @@ static inline uint32_t SDHC_GetAdmaErrorStatusFlags(SDHC_Type *base)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Get present status.
|
||||
* @brief Gets a present status.
|
||||
*
|
||||
* This function gets the present SDHC's status except for interrupt status and error status.
|
||||
* This function gets the present SDHC's status except for an interrupt status and an error status.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @return Present SDHC's status flags mask(_sdhc_present_status_flag).
|
||||
|
@ -766,7 +765,7 @@ static inline uint32_t SDHC_GetPresentStatusFlags(SDHC_Type *base)
|
|||
*/
|
||||
|
||||
/*!
|
||||
* @brief Get the capability information
|
||||
* @brief Gets the capability information.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param capability Structure to save capability information.
|
||||
|
@ -774,7 +773,7 @@ static inline uint32_t SDHC_GetPresentStatusFlags(SDHC_Type *base)
|
|||
void SDHC_GetCapability(SDHC_Type *base, sdhc_capability_t *capability);
|
||||
|
||||
/*!
|
||||
* @brief Enable or disable SD bus clock.
|
||||
* @brief Enables or disables the SD bus clock.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param enable True to enable, false to disable.
|
||||
|
@ -792,7 +791,7 @@ static inline void SDHC_EnableSdClock(SDHC_Type *base, bool enable)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Set SD bus clock frequency.
|
||||
* @brief Sets the SD bus clock frequency.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param srcClock_Hz SDHC source clock frequency united in Hz.
|
||||
|
@ -803,9 +802,10 @@ static inline void SDHC_EnableSdClock(SDHC_Type *base, bool enable)
|
|||
uint32_t SDHC_SetSdClock(SDHC_Type *base, uint32_t srcClock_Hz, uint32_t busClock_Hz);
|
||||
|
||||
/*!
|
||||
* @brief Send 80 clocks to the card to set it to be active state.
|
||||
* @brief Sends 80 clocks to the card to set it to the active state.
|
||||
*
|
||||
* This function must be called after each time the card is inserted to make card can receive command correctly.
|
||||
* This function must be called each time the card is inserted to ensure that the card can receive the command
|
||||
* correctly.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param timeout Timeout to initialize card.
|
||||
|
@ -815,7 +815,7 @@ uint32_t SDHC_SetSdClock(SDHC_Type *base, uint32_t srcClock_Hz, uint32_t busCloc
|
|||
bool SDHC_SetCardActive(SDHC_Type *base, uint32_t timeout);
|
||||
|
||||
/*!
|
||||
* @brief Set the data transfer width.
|
||||
* @brief Sets the data transfer width.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param width Data transfer width.
|
||||
|
@ -826,10 +826,10 @@ static inline void SDHC_SetDataBusWidth(SDHC_Type *base, sdhc_data_bus_width_t w
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Set card transfer-related configuration.
|
||||
* @brief Sets the card transfer-related configuration.
|
||||
*
|
||||
* This function fills card transfer-related command argument/transfer flag/data size. Command and data will be sent by
|
||||
* SDHC after calling this function.
|
||||
* This function fills the card transfer-related command argument/transfer flag/data size. The command and data are sent
|
||||
* by SDHC after calling this function.
|
||||
*
|
||||
* Example:
|
||||
@code
|
||||
|
@ -848,7 +848,7 @@ static inline void SDHC_SetDataBusWidth(SDHC_Type *base, sdhc_data_bus_width_t w
|
|||
void SDHC_SetTransferConfig(SDHC_Type *base, const sdhc_transfer_config_t *config);
|
||||
|
||||
/*!
|
||||
* @brief Get the command response.
|
||||
* @brief Gets the command response.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param index The index of response register, range from 0 to 3.
|
||||
|
@ -862,9 +862,9 @@ static inline uint32_t SDHC_GetCommandResponse(SDHC_Type *base, uint32_t index)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Fill the the data port.
|
||||
* @brief Fills the the data port.
|
||||
*
|
||||
* This function is mainly used to implement the data transfer by Data Port instead of DMA.
|
||||
* This function is used to implement the data transfer by Data Port instead of DMA.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param data The data about to be sent.
|
||||
|
@ -875,9 +875,9 @@ static inline void SDHC_WriteData(SDHC_Type *base, uint32_t data)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Retrieve the data from the data port.
|
||||
* @brief Retrieves the data from the data port.
|
||||
*
|
||||
* This function is mainly used to implement the data transfer by Data Port instead of DMA.
|
||||
* This function is used to implement the data transfer by Data Port instead of DMA.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @return The data has been read.
|
||||
|
@ -888,7 +888,7 @@ static inline uint32_t SDHC_ReadData(SDHC_Type *base)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Enable or disable wakeup event in low power mode
|
||||
* @brief Enables or disables a wakeup event in low-power mode.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask Wakeup events mask(_sdhc_wakeup_event).
|
||||
|
@ -907,7 +907,7 @@ static inline void SDHC_EnableWakeupEvent(SDHC_Type *base, uint32_t mask, bool e
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Enable or disable card detection level for test.
|
||||
* @brief Enables or disables the card detection level for testing.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param enable True to enable, false to disable.
|
||||
|
@ -925,11 +925,11 @@ static inline void SDHC_EnableCardDetectTest(SDHC_Type *base, bool enable)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Set card detection test level.
|
||||
* @brief Sets the card detection test level.
|
||||
*
|
||||
* This function set the card detection test level to indicate whether the card is inserted into SDHC when DAT[3]/
|
||||
* CD pin is selected as card detection pin. This function can also assert the pin logic when DAT[3]/CD pin is select
|
||||
* as the card detection pin.
|
||||
* This function sets the card detection test level to indicate whether the card is inserted into the SDHC when DAT[3]/
|
||||
* CD pin is selected as a card detection pin. This function can also assert the pin logic when DAT[3]/CD pin is
|
||||
* selected as the card detection pin.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param high True to set the card detect level to high.
|
||||
|
@ -947,7 +947,7 @@ static inline void SDHC_SetCardDetectTestLevel(SDHC_Type *base, bool high)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Enable or disable SDIO card control.
|
||||
* @brief Enables or disables the SDIO card control.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask SDIO card control flags mask(_sdhc_sdio_control_flag).
|
||||
|
@ -956,7 +956,7 @@ static inline void SDHC_SetCardDetectTestLevel(SDHC_Type *base, bool high)
|
|||
void SDHC_EnableSdioControl(SDHC_Type *base, uint32_t mask, bool enable);
|
||||
|
||||
/*!
|
||||
* @brief Restart a transaction which has stopped at the block gap for SDIO card.
|
||||
* @brief Restarts a transaction which has stopped at the block GAP for the SDIO card.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
*/
|
||||
|
@ -966,18 +966,18 @@ static inline void SDHC_SetContinueRequest(SDHC_Type *base)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Configure the MMC boot feature.
|
||||
* @brief Configures the MMC boot feature.
|
||||
*
|
||||
* Example:
|
||||
@code
|
||||
sdhc_boot_config_t bootConfig;
|
||||
bootConfig.ackTimeoutCount = 4;
|
||||
bootConfig.bootMode = kSDHC_BootModeNormal;
|
||||
bootConfig.blockCount = 5;
|
||||
bootConfig.enableBootAck = true;
|
||||
bootConfig.enableBoot = true;
|
||||
enableBoot.enableAutoStopAtBlockGap = true;
|
||||
SDHC_SetMmcBootConfig(SDHC, &bootConfig);
|
||||
sdhc_boot_config_t config;
|
||||
config.ackTimeoutCount = 4;
|
||||
config.bootMode = kSDHC_BootModeNormal;
|
||||
config.blockCount = 5;
|
||||
config.enableBootAck = true;
|
||||
config.enableBoot = true;
|
||||
config.enableAutoStopAtBlockGap = true;
|
||||
SDHC_SetMmcBootConfig(SDHC, &config);
|
||||
@endcode
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
|
@ -986,7 +986,7 @@ static inline void SDHC_SetContinueRequest(SDHC_Type *base)
|
|||
void SDHC_SetMmcBootConfig(SDHC_Type *base, const sdhc_boot_config_t *config);
|
||||
|
||||
/*!
|
||||
* @brief Force to generate events according to the given mask.
|
||||
* @brief Forces generating events according to the given mask.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The force events mask(_sdhc_force_event).
|
||||
|
@ -1004,13 +1004,13 @@ static inline void SDHC_SetForceEvent(SDHC_Type *base, uint32_t mask)
|
|||
*/
|
||||
|
||||
/*!
|
||||
* @brief Transfer command/data using blocking way.
|
||||
* @brief Transfers the command/data using a blocking method.
|
||||
*
|
||||
* This function waits until the command response/data is got or SDHC encounters error by polling the status flag.
|
||||
* Application must not call this API in multiple threads at the same time because of that this API doesn't support
|
||||
* reentry mechanism.
|
||||
* This function waits until the command response/data is received or the SDHC encounters an error by polling the status
|
||||
* flag. The application must not call this API in multiple threads at the same time. Because of that this API doesn't support
|
||||
* the re-entry mechanism.
|
||||
*
|
||||
* @note Needn't to call the API 'SDHC_TransferCreateHandle' when calling this API.
|
||||
* @note There is no need to call the API 'SDHC_TransferCreateHandle' when calling this API.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param admaTable ADMA table address, can't be null if transfer way is ADMA1/ADMA2.
|
||||
|
@ -1028,7 +1028,7 @@ status_t SDHC_TransferBlocking(SDHC_Type *base,
|
|||
sdhc_transfer_t *transfer);
|
||||
|
||||
/*!
|
||||
* @brief Create the SDHC handle.
|
||||
* @brief Creates the SDHC handle.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param handle SDHC handle pointer.
|
||||
|
@ -1041,13 +1041,13 @@ void SDHC_TransferCreateHandle(SDHC_Type *base,
|
|||
void *userData);
|
||||
|
||||
/*!
|
||||
* @brief Transfer command/data using interrupt and asynchronous way.
|
||||
* @brief Transfers the command/data using an interrupt and an asynchronous method.
|
||||
*
|
||||
* This function send command and data and return immediately. It doesn't wait the transfer complete or encounter error.
|
||||
* Application must not call this API in multiple threads at the same time because of that this API doesn't support
|
||||
* reentry mechanism.
|
||||
* This function sends a command and data and returns immediately. It doesn't wait the transfer complete or encounter an
|
||||
* error. The application must not call this API in multiple threads at the same time. Because of that this API doesn't support
|
||||
* the re-entry mechanism.
|
||||
*
|
||||
* @note Must call the API 'SDHC_TransferCreateHandle' when calling this API.
|
||||
* @note Call the API 'SDHC_TransferCreateHandle' when calling this API.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param handle SDHC handle.
|
||||
|
@ -1063,9 +1063,9 @@ status_t SDHC_TransferNonBlocking(
|
|||
SDHC_Type *base, sdhc_handle_t *handle, uint32_t *admaTable, uint32_t admaTableWords, sdhc_transfer_t *transfer);
|
||||
|
||||
/*!
|
||||
* @brief IRQ handler for SDHC
|
||||
* @brief IRQ handler for the SDHC.
|
||||
*
|
||||
* This function deals with IRQs on the given host controller.
|
||||
* This function deals with the IRQs on the given host controller.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param handle SDHC handle.
|
||||
|
|
|
@ -103,6 +103,8 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
|||
temp |= (LPUART_CTRL_PE_MASK | LPUART_CTRL_M_MASK);
|
||||
if (parity == ParityOdd) {
|
||||
temp |= LPUART_CTRL_PT_MASK;
|
||||
} else if (parity == ParityEven) {
|
||||
// PT=0 so nothing more to do
|
||||
} else {
|
||||
// Hardware does not support forced parity
|
||||
MBED_ASSERT(0);
|
||||
|
|
|
@ -103,6 +103,8 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
|||
temp |= (LPUART_CTRL_PE_MASK | LPUART_CTRL_M_MASK);
|
||||
if (parity == ParityOdd) {
|
||||
temp |= LPUART_CTRL_PT_MASK;
|
||||
} else if (parity == ParityEven) {
|
||||
// PT=0 so nothing more to do
|
||||
} else {
|
||||
// Hardware does not support forced parity
|
||||
MBED_ASSERT(0);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Freescale Semiconductor, Inc.
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -50,6 +50,9 @@
|
|||
#define SDHC_NEXT_CLKFS(x) ((x) <<= 1U)
|
||||
#define SDHC_PREV_CLKFS(x) ((x) >>= 1U)
|
||||
|
||||
/* Typedef for interrupt handler. */
|
||||
typedef void (*sdhc_isr_t)(SDHC_Type *base, sdhc_handle_t *handle);
|
||||
|
||||
/*! @brief ADMA table configuration */
|
||||
typedef struct _sdhc_adma_table_config
|
||||
{
|
||||
|
@ -230,6 +233,9 @@ static const IRQn_Type s_sdhcIRQ[] = SDHC_IRQS;
|
|||
/*! @brief SDHC clock array name */
|
||||
static const clock_ip_name_t s_sdhcClock[] = SDHC_CLOCKS;
|
||||
|
||||
/* SDHC ISR for transactional APIs. */
|
||||
static sdhc_isr_t s_sdhcIsr;
|
||||
|
||||
/*******************************************************************************
|
||||
* Code
|
||||
******************************************************************************/
|
||||
|
@ -288,10 +294,8 @@ static void SDHC_SetTransferInterrupt(SDHC_Type *base, bool usingInterruptSignal
|
|||
|
||||
static void SDHC_StartTransfer(SDHC_Type *base, sdhc_command_t *command, sdhc_data_t *data)
|
||||
{
|
||||
assert(command);
|
||||
|
||||
uint32_t flags = 0U;
|
||||
sdhc_transfer_config_t sdhcTransferConfig;
|
||||
sdhc_transfer_config_t sdhcTransferConfig = {0};
|
||||
sdhc_dma_mode_t dmaMode;
|
||||
|
||||
/* Define the flag corresponding to each response type. */
|
||||
|
@ -315,7 +319,7 @@ static void SDHC_StartTransfer(SDHC_Type *base, sdhc_command_t *command, sdhc_da
|
|||
flags |= (kSDHC_ResponseLength48Flag);
|
||||
break;
|
||||
case kSDHC_ResponseTypeR5: /* Response 5 */
|
||||
flags |= (kSDHC_ResponseLength48Flag | kSDHC_EnableCrcCheckFlag);
|
||||
flags |= (kSDHC_ResponseLength48Flag | kSDHC_EnableCrcCheckFlag | kSDHC_EnableIndexCheckFlag);
|
||||
break;
|
||||
case kSDHC_ResponseTypeR5b: /* Response 5 with busy */
|
||||
flags |= (kSDHC_ResponseLength48BusyFlag | kSDHC_EnableCrcCheckFlag | kSDHC_EnableIndexCheckFlag);
|
||||
|
@ -355,18 +359,9 @@ static void SDHC_StartTransfer(SDHC_Type *base, sdhc_command_t *command, sdhc_da
|
|||
flags |= kSDHC_EnableAutoCommand12Flag;
|
||||
}
|
||||
}
|
||||
if (data->blockCount > SDHC_MAX_BLOCK_COUNT)
|
||||
{
|
||||
sdhcTransferConfig.dataBlockSize = data->blockSize;
|
||||
sdhcTransferConfig.dataBlockCount = SDHC_MAX_BLOCK_COUNT;
|
||||
|
||||
flags &= ~(uint32_t)kSDHC_EnableBlockCountFlag;
|
||||
}
|
||||
else
|
||||
{
|
||||
sdhcTransferConfig.dataBlockSize = data->blockSize;
|
||||
sdhcTransferConfig.dataBlockCount = data->blockCount;
|
||||
}
|
||||
sdhcTransferConfig.dataBlockSize = data->blockSize;
|
||||
sdhcTransferConfig.dataBlockCount = data->blockCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -382,8 +377,6 @@ static void SDHC_StartTransfer(SDHC_Type *base, sdhc_command_t *command, sdhc_da
|
|||
|
||||
static void SDHC_ReceiveCommandResponse(SDHC_Type *base, sdhc_command_t *command)
|
||||
{
|
||||
assert(command);
|
||||
|
||||
uint32_t i;
|
||||
|
||||
if (command->responseType != kSDHC_ResponseTypeNone)
|
||||
|
@ -412,13 +405,22 @@ static void SDHC_ReceiveCommandResponse(SDHC_Type *base, sdhc_command_t *command
|
|||
|
||||
static uint32_t SDHC_ReadDataPort(SDHC_Type *base, sdhc_data_t *data, uint32_t transferredWords)
|
||||
{
|
||||
assert(data);
|
||||
|
||||
uint32_t i;
|
||||
uint32_t totalWords;
|
||||
uint32_t wordsCanBeRead; /* The words can be read at this time. */
|
||||
uint32_t readWatermark = ((base->WML & SDHC_WML_RDWML_MASK) >> SDHC_WML_RDWML_SHIFT);
|
||||
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (data->blockSize % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
data->blockSize +=
|
||||
sizeof(uint32_t) - (data->blockSize % sizeof(uint32_t)); /* make the block size as word-aligned */
|
||||
}
|
||||
|
||||
totalWords = ((data->blockCount * data->blockSize) / sizeof(uint32_t));
|
||||
|
||||
/* If watermark level is equal or bigger than totalWords, transfers totalWords data. */
|
||||
|
@ -451,12 +453,21 @@ static uint32_t SDHC_ReadDataPort(SDHC_Type *base, sdhc_data_t *data, uint32_t t
|
|||
|
||||
static status_t SDHC_ReadByDataPortBlocking(SDHC_Type *base, sdhc_data_t *data)
|
||||
{
|
||||
assert(data);
|
||||
|
||||
uint32_t totalWords;
|
||||
uint32_t transferredWords = 0U;
|
||||
status_t error = kStatus_Success;
|
||||
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (data->blockSize % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
data->blockSize +=
|
||||
sizeof(uint32_t) - (data->blockSize % sizeof(uint32_t)); /* make the block size as word-aligned */
|
||||
}
|
||||
|
||||
totalWords = ((data->blockCount * data->blockSize) / sizeof(uint32_t));
|
||||
|
||||
while ((error == kStatus_Success) && (transferredWords < totalWords))
|
||||
|
@ -489,13 +500,22 @@ static status_t SDHC_ReadByDataPortBlocking(SDHC_Type *base, sdhc_data_t *data)
|
|||
|
||||
static uint32_t SDHC_WriteDataPort(SDHC_Type *base, sdhc_data_t *data, uint32_t transferredWords)
|
||||
{
|
||||
assert(data);
|
||||
|
||||
uint32_t i;
|
||||
uint32_t totalWords;
|
||||
uint32_t wordsCanBeWrote; /* Words can be wrote at this time. */
|
||||
uint32_t writeWatermark = ((base->WML & SDHC_WML_WRWML_MASK) >> SDHC_WML_WRWML_SHIFT);
|
||||
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (data->blockSize % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
data->blockSize +=
|
||||
sizeof(uint32_t) - (data->blockSize % sizeof(uint32_t)); /* make the block size as word-aligned */
|
||||
}
|
||||
|
||||
totalWords = ((data->blockCount * data->blockSize) / sizeof(uint32_t));
|
||||
|
||||
/* If watermark level is equal or bigger than totalWords, transfers totalWords data.*/
|
||||
|
@ -528,12 +548,21 @@ static uint32_t SDHC_WriteDataPort(SDHC_Type *base, sdhc_data_t *data, uint32_t
|
|||
|
||||
static status_t SDHC_WriteByDataPortBlocking(SDHC_Type *base, sdhc_data_t *data)
|
||||
{
|
||||
assert(data);
|
||||
|
||||
uint32_t totalWords;
|
||||
uint32_t transferredWords = 0U;
|
||||
status_t error = kStatus_Success;
|
||||
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (data->blockSize % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
data->blockSize +=
|
||||
sizeof(uint32_t) - (data->blockSize % sizeof(uint32_t)); /* make the block size as word-aligned */
|
||||
}
|
||||
|
||||
totalWords = (data->blockCount * data->blockSize) / sizeof(uint32_t);
|
||||
|
||||
while ((error == kStatus_Success) && (transferredWords < totalWords))
|
||||
|
@ -576,8 +605,6 @@ static status_t SDHC_WriteByDataPortBlocking(SDHC_Type *base, sdhc_data_t *data)
|
|||
|
||||
static status_t SDHC_SendCommandBlocking(SDHC_Type *base, sdhc_command_t *command)
|
||||
{
|
||||
assert(command);
|
||||
|
||||
status_t error = kStatus_Success;
|
||||
|
||||
/* Wait command complete or SDHC encounters error. */
|
||||
|
@ -602,8 +629,6 @@ static status_t SDHC_SendCommandBlocking(SDHC_Type *base, sdhc_command_t *comman
|
|||
|
||||
static status_t SDHC_TransferByDataPortBlocking(SDHC_Type *base, sdhc_data_t *data)
|
||||
{
|
||||
assert(data);
|
||||
|
||||
status_t error = kStatus_Success;
|
||||
|
||||
if (data->rxData)
|
||||
|
@ -669,8 +694,6 @@ static status_t SDHC_TransferDataBlocking(sdhc_dma_mode_t dmaMode, SDHC_Type *ba
|
|||
|
||||
static void SDHC_TransferHandleCardDetect(sdhc_handle_t *handle, uint32_t interruptFlags)
|
||||
{
|
||||
assert(interruptFlags & kSDHC_CardDetectFlag);
|
||||
|
||||
if (interruptFlags & kSDHC_CardInsertionFlag)
|
||||
{
|
||||
if (handle->callback.CardInserted)
|
||||
|
@ -689,7 +712,7 @@ static void SDHC_TransferHandleCardDetect(sdhc_handle_t *handle, uint32_t interr
|
|||
|
||||
static void SDHC_TransferHandleCommand(SDHC_Type *base, sdhc_handle_t *handle, uint32_t interruptFlags)
|
||||
{
|
||||
assert(interruptFlags & kSDHC_CommandFlag);
|
||||
assert(handle->command);
|
||||
|
||||
if ((interruptFlags & kSDHC_CommandErrorFlag) && (!(handle->data)) && (handle->callback.TransferComplete))
|
||||
{
|
||||
|
@ -709,7 +732,6 @@ static void SDHC_TransferHandleCommand(SDHC_Type *base, sdhc_handle_t *handle, u
|
|||
static void SDHC_TransferHandleData(SDHC_Type *base, sdhc_handle_t *handle, uint32_t interruptFlags)
|
||||
{
|
||||
assert(handle->data);
|
||||
assert(interruptFlags & kSDHC_DataFlag);
|
||||
|
||||
if ((!(handle->data->enableIgnoreError)) && (interruptFlags & (kSDHC_DataErrorFlag | kSDHC_DmaErrorFlag)) &&
|
||||
(handle->callback.TransferComplete))
|
||||
|
@ -759,6 +781,8 @@ void SDHC_Init(SDHC_Type *base, const sdhc_config_t *config)
|
|||
#if !defined FSL_SDHC_ENABLE_ADMA1
|
||||
assert(config->dmaMode != kSDHC_DmaModeAdma1);
|
||||
#endif /* FSL_SDHC_ENABLE_ADMA1 */
|
||||
assert((config->writeWatermarkLevel >= 1U) && (config->writeWatermarkLevel <= 128U));
|
||||
assert((config->readWatermarkLevel >= 1U) && (config->readWatermarkLevel <= 128U));
|
||||
|
||||
uint32_t proctl;
|
||||
uint32_t wml;
|
||||
|
@ -850,7 +874,8 @@ void SDHC_GetCapability(SDHC_Type *base, sdhc_capability_t *capability)
|
|||
|
||||
uint32_t SDHC_SetSdClock(SDHC_Type *base, uint32_t srcClock_Hz, uint32_t busClock_Hz)
|
||||
{
|
||||
assert(busClock_Hz && (busClock_Hz < srcClock_Hz));
|
||||
assert(srcClock_Hz != 0U);
|
||||
assert((busClock_Hz != 0U) && (busClock_Hz <= srcClock_Hz));
|
||||
|
||||
uint32_t divisor;
|
||||
uint32_t prescaler;
|
||||
|
@ -898,7 +923,7 @@ bool SDHC_SetCardActive(SDHC_Type *base, uint32_t timeout)
|
|||
{
|
||||
base->SYSCTL |= SDHC_SYSCTL_INITA_MASK;
|
||||
/* Delay some time to wait card become active state. */
|
||||
while (!(base->SYSCTL & SDHC_SYSCTL_INITA_MASK))
|
||||
while (base->SYSCTL & SDHC_SYSCTL_INITA_MASK)
|
||||
{
|
||||
if (!timeout)
|
||||
{
|
||||
|
@ -913,6 +938,8 @@ bool SDHC_SetCardActive(SDHC_Type *base, uint32_t timeout)
|
|||
void SDHC_SetTransferConfig(SDHC_Type *base, const sdhc_transfer_config_t *config)
|
||||
{
|
||||
assert(config);
|
||||
assert(config->dataBlockSize <= (SDHC_BLKATTR_BLKSIZE_MASK >> SDHC_BLKATTR_BLKSIZE_SHIFT));
|
||||
assert(config->dataBlockCount <= (SDHC_BLKATTR_BLKCNT_MASK >> SDHC_BLKATTR_BLKCNT_SHIFT));
|
||||
|
||||
base->BLKATTR = ((base->BLKATTR & ~(SDHC_BLKATTR_BLKSIZE_MASK | SDHC_BLKATTR_BLKCNT_MASK)) |
|
||||
(SDHC_BLKATTR_BLKSIZE(config->dataBlockSize) | SDHC_BLKATTR_BLKCNT(config->dataBlockCount)));
|
||||
|
@ -975,12 +1002,13 @@ void SDHC_EnableSdioControl(SDHC_Type *base, uint32_t mask, bool enable)
|
|||
void SDHC_SetMmcBootConfig(SDHC_Type *base, const sdhc_boot_config_t *config)
|
||||
{
|
||||
assert(config);
|
||||
assert(config->ackTimeoutCount <= (SDHC_MMCBOOT_DTOCVACK_MASK >> SDHC_MMCBOOT_DTOCVACK_SHIFT));
|
||||
assert(config->blockCount <= (SDHC_MMCBOOT_BOOTBLKCNT_MASK >> SDHC_MMCBOOT_BOOTBLKCNT_SHIFT));
|
||||
|
||||
uint32_t mmcboot;
|
||||
uint32_t mmcboot = 0U;
|
||||
|
||||
mmcboot = base->MMCBOOT;
|
||||
mmcboot |= (SDHC_MMCBOOT_DTOCVACK(config->ackTimeoutCount) | SDHC_MMCBOOT_BOOTMODE(config->bootMode) |
|
||||
SDHC_MMCBOOT_BOOTBLKCNT(config->blockCount));
|
||||
mmcboot = (SDHC_MMCBOOT_DTOCVACK(config->ackTimeoutCount) | SDHC_MMCBOOT_BOOTMODE(config->bootMode) |
|
||||
SDHC_MMCBOOT_BOOTBLKCNT(config->blockCount));
|
||||
if (config->enableBootAck)
|
||||
{
|
||||
mmcboot |= SDHC_MMCBOOT_BOOTACK_MASK;
|
||||
|
@ -1016,6 +1044,9 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
(!data) || (!dataBytes)
|
||||
#if !defined FSL_SDHC_ENABLE_ADMA1
|
||||
|| (dmaMode == kSDHC_DmaModeAdma1)
|
||||
#else
|
||||
/* Buffer address configured in ADMA1 descriptor must be 4KB aligned. */
|
||||
|| ((dmaMode == kSDHC_DmaModeAdma1) && (((uint32_t)data % SDHC_ADMA1_LENGTH_ALIGN) != 0U))
|
||||
#endif /* FSL_SDHC_ENABLE_ADMA1 */
|
||||
)
|
||||
{
|
||||
|
@ -1029,6 +1060,17 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
break;
|
||||
#if defined FSL_SDHC_ENABLE_ADMA1
|
||||
case kSDHC_DmaModeAdma1:
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (dataBytes % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
dataBytes +=
|
||||
sizeof(uint32_t) - (dataBytes % sizeof(uint32_t)); /* make the data length as word-aligned */
|
||||
}
|
||||
|
||||
startAddress = data;
|
||||
/* Check if ADMA descriptor's number is enough. */
|
||||
entries = ((dataBytes / SDHC_ADMA1_DESCRIPTOR_MAX_LENGTH_PER_ENTRY) + 1U);
|
||||
|
@ -1054,7 +1096,7 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
adma1EntryAddress[i + 1U] =
|
||||
((uint32_t)(startAddress) << SDHC_ADMA1_DESCRIPTOR_ADDRESS_SHIFT);
|
||||
adma1EntryAddress[i + 1U] |=
|
||||
(SDHC_ADMA1_DESCRIPTOR_TYPE_TRANSFER | SDHC_ADMA1_DESCRIPTOR_END_MASK);
|
||||
(kSDHC_Adma1DescriptorTypeTransfer | kSDHC_Adma1DescriptorEndFlag);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1075,6 +1117,17 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
break;
|
||||
#endif /* FSL_SDHC_ENABLE_ADMA1 */
|
||||
case kSDHC_DmaModeAdma2:
|
||||
/*
|
||||
* Add non aligned access support ,user need make sure your buffer size is big
|
||||
* enough to hold the data,in other words,user need make sure the buffer size
|
||||
* is 4 byte aligned
|
||||
*/
|
||||
if (dataBytes % sizeof(uint32_t) != 0U)
|
||||
{
|
||||
dataBytes +=
|
||||
sizeof(uint32_t) - (dataBytes % sizeof(uint32_t)); /* make the data length as word-aligned */
|
||||
}
|
||||
|
||||
startAddress = data;
|
||||
/* Check if ADMA descriptor's number is enough. */
|
||||
entries = ((dataBytes / SDHC_ADMA2_DESCRIPTOR_MAX_LENGTH_PER_ENTRY) + 1U);
|
||||
|
@ -1125,15 +1178,14 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
status_t SDHC_TransferBlocking(SDHC_Type *base, uint32_t *admaTable, uint32_t admaTableWords, sdhc_transfer_t *transfer)
|
||||
{
|
||||
assert(transfer);
|
||||
assert(transfer->command); /* Command must not be NULL, data can be NULL. */
|
||||
|
||||
status_t error = kStatus_Success;
|
||||
sdhc_dma_mode_t dmaMode = (sdhc_dma_mode_t)((base->PROCTL & SDHC_PROCTL_DMAS_MASK) >> SDHC_PROCTL_DMAS_SHIFT);
|
||||
sdhc_command_t *command = transfer->command;
|
||||
sdhc_data_t *data = transfer->data;
|
||||
|
||||
/* DATA-PORT is 32-bit align, ADMA2 4 bytes align, ADMA1 is 4096 bytes align */
|
||||
if ((!command) || (data && (data->blockSize % 4U)))
|
||||
/* make sure the cmd/block count is valid */
|
||||
if ((!command) || (data && (data->blockCount > SDHC_MAX_BLOCK_COUNT)))
|
||||
{
|
||||
error = kStatus_InvalidArgument;
|
||||
}
|
||||
|
@ -1147,7 +1199,7 @@ status_t SDHC_TransferBlocking(SDHC_Type *base, uint32_t *admaTable, uint32_t ad
|
|||
{
|
||||
}
|
||||
|
||||
/* Update ADMA descriptor table if data isn't NULL. */
|
||||
/* Update ADMA descriptor table according to different DMA mode(no DMA, ADMA1, ADMA2).*/
|
||||
if (data && (kStatus_Success != SDHC_SetAdmaTableConfig(base, dmaMode, admaTable, admaTableWords,
|
||||
(data->rxData ? data->rxData : data->txData),
|
||||
(data->blockCount * data->blockSize))))
|
||||
|
@ -1156,9 +1208,8 @@ status_t SDHC_TransferBlocking(SDHC_Type *base, uint32_t *admaTable, uint32_t ad
|
|||
}
|
||||
else
|
||||
{
|
||||
SDHC_StartTransfer(base, command, data);
|
||||
|
||||
/* Send command and receive data. */
|
||||
SDHC_StartTransfer(base, command, data);
|
||||
if (kStatus_Success != SDHC_SendCommandBlocking(base, command))
|
||||
{
|
||||
error = kStatus_SDHC_SendCommandFailed;
|
||||
|
@ -1200,6 +1251,10 @@ void SDHC_TransferCreateHandle(SDHC_Type *base,
|
|||
|
||||
/* Enable interrupt in NVIC. */
|
||||
SDHC_SetTransferInterrupt(base, true);
|
||||
|
||||
/* save IRQ handler */
|
||||
s_sdhcIsr = SDHC_TransferHandleIRQ;
|
||||
|
||||
EnableIRQ(s_sdhcIRQ[SDHC_GetInstance(base)]);
|
||||
}
|
||||
|
||||
|
@ -1213,8 +1268,8 @@ status_t SDHC_TransferNonBlocking(
|
|||
sdhc_command_t *command = transfer->command;
|
||||
sdhc_data_t *data = transfer->data;
|
||||
|
||||
/* DATA-PORT is 32-bit align, ADMA2 4 bytes align, ADMA1 is 4096 bytes align */
|
||||
if ((!(transfer->command)) || ((transfer->data) && (transfer->data->blockSize % 4U)))
|
||||
/* make sure cmd/block count is valid */
|
||||
if ((!command) || (data && (data->blockCount > SDHC_MAX_BLOCK_COUNT)))
|
||||
{
|
||||
error = kStatus_InvalidArgument;
|
||||
}
|
||||
|
@ -1228,7 +1283,7 @@ status_t SDHC_TransferNonBlocking(
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Update ADMA descriptor table and reset transferred words if data isn't NULL. */
|
||||
/* Update ADMA descriptor table according to different DMA mode(no DMA, ADMA1, ADMA2).*/
|
||||
if (data && (kStatus_Success != SDHC_SetAdmaTableConfig(base, dmaMode, admaTable, admaTableWords,
|
||||
(data->rxData ? data->rxData : data->txData),
|
||||
(data->blockCount * data->blockSize))))
|
||||
|
@ -1243,6 +1298,7 @@ status_t SDHC_TransferNonBlocking(
|
|||
handle->interruptFlags = 0U;
|
||||
/* transferredWords will only be updated in ISR when transfer way is DATAPORT. */
|
||||
handle->transferredWords = 0U;
|
||||
|
||||
SDHC_StartTransfer(base, command, data);
|
||||
}
|
||||
}
|
||||
|
@ -1289,6 +1345,6 @@ void SDHC_DriverIRQHandler(void)
|
|||
{
|
||||
assert(s_sdhcHandle[0]);
|
||||
|
||||
SDHC_TransferHandleIRQ(SDHC, s_sdhcHandle[0]);
|
||||
s_sdhcIsr(SDHC, s_sdhcHandle[0]);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -37,16 +37,14 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/*! @file */
|
||||
|
||||
/******************************************************************************
|
||||
* Definitions.
|
||||
*****************************************************************************/
|
||||
|
||||
/*! @name Driver version */
|
||||
/*@{*/
|
||||
/*! @brief Driver version 2.0.0. */
|
||||
#define FSL_SDHC_DRIVER_VERSION (MAKE_VERSION(2U, 0U, 0U))
|
||||
/*! @brief Driver version 2.1.2. */
|
||||
#define FSL_SDHC_DRIVER_VERSION (MAKE_VERSION(2U, 1U, 2U))
|
||||
/*@}*/
|
||||
|
||||
/*! @brief Maximum block count can be set one time */
|
||||
|
@ -350,7 +348,7 @@ typedef enum _sdhc_response_type
|
|||
#define SDHC_ADMA1_DESCRIPTOR_LENGTH_SHIFT (12U)
|
||||
/*! @brief The mask for LENGTH field in ADMA1's descriptor */
|
||||
#define SDHC_ADMA1_DESCRIPTOR_LENGTH_MASK (0xFFFFU)
|
||||
/*! @brief The max value of LENGTH filed in ADMA1's descriptor */
|
||||
/*! @brief The maximum value of LENGTH filed in ADMA1's descriptor */
|
||||
#define SDHC_ADMA1_DESCRIPTOR_MAX_LENGTH_PER_ENTRY (SDHC_ADMA1_DESCRIPTOR_LENGTH_MASK + 1U)
|
||||
|
||||
/*! @brief The mask for the control/status field in ADMA1 descriptor */
|
||||
|
@ -395,7 +393,7 @@ enum _sdhc_adma1_descriptor_flag
|
|||
#define SDHC_ADMA2_DESCRIPTOR_LENGTH_SHIFT (16U)
|
||||
/*! @brief The bit mask for LENGTH field in ADMA2's descriptor */
|
||||
#define SDHC_ADMA2_DESCRIPTOR_LENGTH_MASK (0xFFFFU)
|
||||
/*! @brief The max value of LENGTH field in ADMA2's descriptor */
|
||||
/*! @brief The maximum value of LENGTH field in ADMA2's descriptor */
|
||||
#define SDHC_ADMA2_DESCRIPTOR_MAX_LENGTH_PER_ENTRY (SDHC_ADMA2_DESCRIPTOR_LENGTH_MASK)
|
||||
|
||||
/*! @brief ADMA1 descriptor control and status mask */
|
||||
|
@ -416,10 +414,10 @@ enum _sdhc_adma2_descriptor_flag
|
|||
kSDHC_Adma2DescriptorValidFlag), /*!< Link type */
|
||||
};
|
||||
|
||||
/*! @brief Define the adma1 descriptor structure. */
|
||||
/*! @brief Defines the adma1 descriptor structure. */
|
||||
typedef uint32_t sdhc_adma1_descriptor_t;
|
||||
|
||||
/*! @brief Define the ADMA2 descriptor structure. */
|
||||
/*! @brief Defines the ADMA2 descriptor structure. */
|
||||
typedef struct _sdhc_adma2_descriptor
|
||||
{
|
||||
uint32_t attribute; /*!< The control and status field */
|
||||
|
@ -429,7 +427,7 @@ typedef struct _sdhc_adma2_descriptor
|
|||
/*!
|
||||
* @brief SDHC capability information.
|
||||
*
|
||||
* Define structure to save the capability information of SDHC.
|
||||
* Defines a structure to save the capability information of SDHC.
|
||||
*/
|
||||
typedef struct _sdhc_capability
|
||||
{
|
||||
|
@ -457,9 +455,9 @@ typedef struct _sdhc_transfer_config
|
|||
/*! @brief Data structure to configure the MMC boot feature */
|
||||
typedef struct _sdhc_boot_config
|
||||
{
|
||||
uint32_t ackTimeoutCount; /*!< Timeout value for the boot ACK */
|
||||
uint32_t ackTimeoutCount; /*!< Timeout value for the boot ACK. The available range is 0 ~ 15. */
|
||||
sdhc_boot_mode_t bootMode; /*!< Boot mode selection. */
|
||||
uint32_t blockCount; /*!< Stop at block gap value of automatic mode */
|
||||
uint32_t blockCount; /*!< Stop at block gap value of automatic mode. Available range is 0 ~ 65535. */
|
||||
bool enableBootAck; /*!< Enable or disable boot ACK */
|
||||
bool enableBoot; /*!< Enable or disable fast boot */
|
||||
bool enableAutoStopAtBlockGap; /*!< Enable or disable auto stop at block gap function in boot period */
|
||||
|
@ -471,15 +469,15 @@ typedef struct _sdhc_config
|
|||
bool cardDetectDat3; /*!< Enable DAT3 as card detection pin */
|
||||
sdhc_endian_mode_t endianMode; /*!< Endian mode */
|
||||
sdhc_dma_mode_t dmaMode; /*!< DMA mode */
|
||||
uint32_t readWatermarkLevel; /*!< Watermark level for DMA read operation */
|
||||
uint32_t writeWatermarkLevel; /*!< Watermark level for DMA write operation */
|
||||
uint32_t readWatermarkLevel; /*!< Watermark level for DMA read operation. Available range is 1 ~ 128. */
|
||||
uint32_t writeWatermarkLevel; /*!< Watermark level for DMA write operation. Available range is 1 ~ 128. */
|
||||
} sdhc_config_t;
|
||||
|
||||
/*!
|
||||
* @brief Card data descriptor
|
||||
*
|
||||
* Define structure to contain data-related attribute. 'enableIgnoreError' is used for the case that upper card driver
|
||||
* want to ignore the error event to read/write all the data not to stop read/write immediately when error event
|
||||
* Defines a structure to contain data-related attribute. 'enableIgnoreError' is used for the case that upper card
|
||||
* driver want to ignore the error event to read/write all the data not to stop read/write immediately when error event
|
||||
* happen for example bus testing procedure for MMC card.
|
||||
*/
|
||||
typedef struct _sdhc_data
|
||||
|
@ -530,10 +528,11 @@ typedef struct _sdhc_transfer_callback
|
|||
} sdhc_transfer_callback_t;
|
||||
|
||||
/*!
|
||||
* @brief Host descriptor
|
||||
* @brief SDHC handle
|
||||
*
|
||||
* Define the structure to save the SDHC state information and callback function. The detail interrupt status when
|
||||
* send command or transfer data can be obtained from interruptFlags field by using mask defined in sdhc_interrupt_flag_t;
|
||||
* Defines the structure to save the SDHC state information and callback function. The detailed interrupt status when
|
||||
* sending a command or transfering data can be obtained from the interruptFlags field by using the mask defined in
|
||||
* sdhc_interrupt_flag_t.
|
||||
*
|
||||
* @note All the fields except interruptFlags and transferredWords must be allocated by the user.
|
||||
*/
|
||||
|
@ -580,16 +579,16 @@ extern "C" {
|
|||
/*!
|
||||
* @brief SDHC module initialization function.
|
||||
*
|
||||
* Configure the SDHC according to the user configuration.
|
||||
* Configures the SDHC according to the user configuration.
|
||||
*
|
||||
* Example:
|
||||
@code
|
||||
sdhc_config_t config;
|
||||
config.enableDat3AsCDPin = false;
|
||||
config.cardDetectDat3 = false;
|
||||
config.endianMode = kSDHC_EndianModeLittle;
|
||||
config.dmaMode = kSDHC_DmaModeAdma2;
|
||||
config.readWatermarkLevel = 512U;
|
||||
config.writeWatermarkLevel = 512U;
|
||||
config.readWatermarkLevel = 128U;
|
||||
config.writeWatermarkLevel = 128U;
|
||||
SDHC_Init(SDHC, &config);
|
||||
@endcode
|
||||
*
|
||||
|
@ -600,14 +599,14 @@ extern "C" {
|
|||
void SDHC_Init(SDHC_Type *base, const sdhc_config_t *config);
|
||||
|
||||
/*!
|
||||
* @brief Deinitialize the SDHC.
|
||||
* @brief Deinitializes the SDHC.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
*/
|
||||
void SDHC_Deinit(SDHC_Type *base);
|
||||
|
||||
/*!
|
||||
* @brief Reset the SDHC.
|
||||
* @brief Resets the SDHC.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The reset type mask(_sdhc_reset).
|
||||
|
@ -625,7 +624,7 @@ bool SDHC_Reset(SDHC_Type *base, uint32_t mask, uint32_t timeout);
|
|||
*/
|
||||
|
||||
/*!
|
||||
* @brief Set ADMA descriptor table configuration.
|
||||
* @brief Sets the ADMA descriptor table configuration.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param dmaMode DMA mode.
|
||||
|
@ -651,7 +650,7 @@ status_t SDHC_SetAdmaTableConfig(SDHC_Type *base,
|
|||
*/
|
||||
|
||||
/*!
|
||||
* @brief Enable interrupt status
|
||||
* @brief Enables the interrupt status.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask Interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -662,7 +661,7 @@ static inline void SDHC_EnableInterruptStatus(SDHC_Type *base, uint32_t mask)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Disable interrupt status.
|
||||
* @brief Disables the interrupt status.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -673,7 +672,7 @@ static inline void SDHC_DisableInterruptStatus(SDHC_Type *base, uint32_t mask)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Enable interrupts signal corresponding to the interrupt status flag.
|
||||
* @brief Enables the interrupt signal corresponding to the interrupt status flag.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -684,7 +683,7 @@ static inline void SDHC_EnableInterruptSignal(SDHC_Type *base, uint32_t mask)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Disable interrupts signal corresponding to the interrupt status flag.
|
||||
* @brief Disables the interrupt signal corresponding to the interrupt status flag.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -702,7 +701,7 @@ static inline void SDHC_DisableInterruptSignal(SDHC_Type *base, uint32_t mask)
|
|||
*/
|
||||
|
||||
/*!
|
||||
* @brief Get current interrupt status.
|
||||
* @brief Gets the current interrupt status.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @return Current interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -713,7 +712,7 @@ static inline uint32_t SDHC_GetInterruptStatusFlags(SDHC_Type *base)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Clear specified interrupt status.
|
||||
* @brief Clears a specified interrupt status.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The interrupt status flags mask(_sdhc_interrupt_status_flag).
|
||||
|
@ -724,7 +723,7 @@ static inline void SDHC_ClearInterruptStatusFlags(SDHC_Type *base, uint32_t mask
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the status of auto command 12 error.
|
||||
* @brief Gets the status of auto command 12 error.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @return Auto command 12 error status flags mask(_sdhc_auto_command12_error_status_flag).
|
||||
|
@ -735,7 +734,7 @@ static inline uint32_t SDHC_GetAutoCommand12ErrorStatusFlags(SDHC_Type *base)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Get the status of ADMA error.
|
||||
* @brief Gets the status of the ADMA error.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @return ADMA error status flags mask(_sdhc_adma_error_status_flag).
|
||||
|
@ -746,9 +745,9 @@ static inline uint32_t SDHC_GetAdmaErrorStatusFlags(SDHC_Type *base)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Get present status.
|
||||
* @brief Gets a present status.
|
||||
*
|
||||
* This function gets the present SDHC's status except for interrupt status and error status.
|
||||
* This function gets the present SDHC's status except for an interrupt status and an error status.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @return Present SDHC's status flags mask(_sdhc_present_status_flag).
|
||||
|
@ -766,7 +765,7 @@ static inline uint32_t SDHC_GetPresentStatusFlags(SDHC_Type *base)
|
|||
*/
|
||||
|
||||
/*!
|
||||
* @brief Get the capability information
|
||||
* @brief Gets the capability information.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param capability Structure to save capability information.
|
||||
|
@ -774,7 +773,7 @@ static inline uint32_t SDHC_GetPresentStatusFlags(SDHC_Type *base)
|
|||
void SDHC_GetCapability(SDHC_Type *base, sdhc_capability_t *capability);
|
||||
|
||||
/*!
|
||||
* @brief Enable or disable SD bus clock.
|
||||
* @brief Enables or disables the SD bus clock.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param enable True to enable, false to disable.
|
||||
|
@ -792,7 +791,7 @@ static inline void SDHC_EnableSdClock(SDHC_Type *base, bool enable)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Set SD bus clock frequency.
|
||||
* @brief Sets the SD bus clock frequency.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param srcClock_Hz SDHC source clock frequency united in Hz.
|
||||
|
@ -803,9 +802,10 @@ static inline void SDHC_EnableSdClock(SDHC_Type *base, bool enable)
|
|||
uint32_t SDHC_SetSdClock(SDHC_Type *base, uint32_t srcClock_Hz, uint32_t busClock_Hz);
|
||||
|
||||
/*!
|
||||
* @brief Send 80 clocks to the card to set it to be active state.
|
||||
* @brief Sends 80 clocks to the card to set it to the active state.
|
||||
*
|
||||
* This function must be called after each time the card is inserted to make card can receive command correctly.
|
||||
* This function must be called each time the card is inserted to ensure that the card can receive the command
|
||||
* correctly.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param timeout Timeout to initialize card.
|
||||
|
@ -815,7 +815,7 @@ uint32_t SDHC_SetSdClock(SDHC_Type *base, uint32_t srcClock_Hz, uint32_t busCloc
|
|||
bool SDHC_SetCardActive(SDHC_Type *base, uint32_t timeout);
|
||||
|
||||
/*!
|
||||
* @brief Set the data transfer width.
|
||||
* @brief Sets the data transfer width.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param width Data transfer width.
|
||||
|
@ -826,10 +826,10 @@ static inline void SDHC_SetDataBusWidth(SDHC_Type *base, sdhc_data_bus_width_t w
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Set card transfer-related configuration.
|
||||
* @brief Sets the card transfer-related configuration.
|
||||
*
|
||||
* This function fills card transfer-related command argument/transfer flag/data size. Command and data will be sent by
|
||||
* SDHC after calling this function.
|
||||
* This function fills the card transfer-related command argument/transfer flag/data size. The command and data are sent
|
||||
* by SDHC after calling this function.
|
||||
*
|
||||
* Example:
|
||||
@code
|
||||
|
@ -848,7 +848,7 @@ static inline void SDHC_SetDataBusWidth(SDHC_Type *base, sdhc_data_bus_width_t w
|
|||
void SDHC_SetTransferConfig(SDHC_Type *base, const sdhc_transfer_config_t *config);
|
||||
|
||||
/*!
|
||||
* @brief Get the command response.
|
||||
* @brief Gets the command response.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param index The index of response register, range from 0 to 3.
|
||||
|
@ -862,9 +862,9 @@ static inline uint32_t SDHC_GetCommandResponse(SDHC_Type *base, uint32_t index)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Fill the the data port.
|
||||
* @brief Fills the the data port.
|
||||
*
|
||||
* This function is mainly used to implement the data transfer by Data Port instead of DMA.
|
||||
* This function is used to implement the data transfer by Data Port instead of DMA.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param data The data about to be sent.
|
||||
|
@ -875,9 +875,9 @@ static inline void SDHC_WriteData(SDHC_Type *base, uint32_t data)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Retrieve the data from the data port.
|
||||
* @brief Retrieves the data from the data port.
|
||||
*
|
||||
* This function is mainly used to implement the data transfer by Data Port instead of DMA.
|
||||
* This function is used to implement the data transfer by Data Port instead of DMA.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @return The data has been read.
|
||||
|
@ -888,7 +888,7 @@ static inline uint32_t SDHC_ReadData(SDHC_Type *base)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Enable or disable wakeup event in low power mode
|
||||
* @brief Enables or disables a wakeup event in low-power mode.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask Wakeup events mask(_sdhc_wakeup_event).
|
||||
|
@ -907,7 +907,7 @@ static inline void SDHC_EnableWakeupEvent(SDHC_Type *base, uint32_t mask, bool e
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Enable or disable card detection level for test.
|
||||
* @brief Enables or disables the card detection level for testing.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param enable True to enable, false to disable.
|
||||
|
@ -925,11 +925,11 @@ static inline void SDHC_EnableCardDetectTest(SDHC_Type *base, bool enable)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Set card detection test level.
|
||||
* @brief Sets the card detection test level.
|
||||
*
|
||||
* This function set the card detection test level to indicate whether the card is inserted into SDHC when DAT[3]/
|
||||
* CD pin is selected as card detection pin. This function can also assert the pin logic when DAT[3]/CD pin is select
|
||||
* as the card detection pin.
|
||||
* This function sets the card detection test level to indicate whether the card is inserted into the SDHC when DAT[3]/
|
||||
* CD pin is selected as a card detection pin. This function can also assert the pin logic when DAT[3]/CD pin is
|
||||
* selected as the card detection pin.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param high True to set the card detect level to high.
|
||||
|
@ -947,7 +947,7 @@ static inline void SDHC_SetCardDetectTestLevel(SDHC_Type *base, bool high)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Enable or disable SDIO card control.
|
||||
* @brief Enables or disables the SDIO card control.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask SDIO card control flags mask(_sdhc_sdio_control_flag).
|
||||
|
@ -956,7 +956,7 @@ static inline void SDHC_SetCardDetectTestLevel(SDHC_Type *base, bool high)
|
|||
void SDHC_EnableSdioControl(SDHC_Type *base, uint32_t mask, bool enable);
|
||||
|
||||
/*!
|
||||
* @brief Restart a transaction which has stopped at the block gap for SDIO card.
|
||||
* @brief Restarts a transaction which has stopped at the block GAP for the SDIO card.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
*/
|
||||
|
@ -966,18 +966,18 @@ static inline void SDHC_SetContinueRequest(SDHC_Type *base)
|
|||
}
|
||||
|
||||
/*!
|
||||
* @brief Configure the MMC boot feature.
|
||||
* @brief Configures the MMC boot feature.
|
||||
*
|
||||
* Example:
|
||||
@code
|
||||
sdhc_boot_config_t bootConfig;
|
||||
bootConfig.ackTimeoutCount = 4;
|
||||
bootConfig.bootMode = kSDHC_BootModeNormal;
|
||||
bootConfig.blockCount = 5;
|
||||
bootConfig.enableBootAck = true;
|
||||
bootConfig.enableBoot = true;
|
||||
enableBoot.enableAutoStopAtBlockGap = true;
|
||||
SDHC_SetMmcBootConfig(SDHC, &bootConfig);
|
||||
sdhc_boot_config_t config;
|
||||
config.ackTimeoutCount = 4;
|
||||
config.bootMode = kSDHC_BootModeNormal;
|
||||
config.blockCount = 5;
|
||||
config.enableBootAck = true;
|
||||
config.enableBoot = true;
|
||||
config.enableAutoStopAtBlockGap = true;
|
||||
SDHC_SetMmcBootConfig(SDHC, &config);
|
||||
@endcode
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
|
@ -986,7 +986,7 @@ static inline void SDHC_SetContinueRequest(SDHC_Type *base)
|
|||
void SDHC_SetMmcBootConfig(SDHC_Type *base, const sdhc_boot_config_t *config);
|
||||
|
||||
/*!
|
||||
* @brief Force to generate events according to the given mask.
|
||||
* @brief Forces generating events according to the given mask.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param mask The force events mask(_sdhc_force_event).
|
||||
|
@ -1004,13 +1004,13 @@ static inline void SDHC_SetForceEvent(SDHC_Type *base, uint32_t mask)
|
|||
*/
|
||||
|
||||
/*!
|
||||
* @brief Transfer command/data using blocking way.
|
||||
* @brief Transfers the command/data using a blocking method.
|
||||
*
|
||||
* This function waits until the command response/data is got or SDHC encounters error by polling the status flag.
|
||||
* Application must not call this API in multiple threads at the same time because of that this API doesn't support
|
||||
* reentry mechanism.
|
||||
* This function waits until the command response/data is received or the SDHC encounters an error by polling the status
|
||||
* flag. The application must not call this API in multiple threads at the same time. Because of that this API doesn't support
|
||||
* the re-entry mechanism.
|
||||
*
|
||||
* @note Needn't to call the API 'SDHC_TransferCreateHandle' when calling this API.
|
||||
* @note There is no need to call the API 'SDHC_TransferCreateHandle' when calling this API.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param admaTable ADMA table address, can't be null if transfer way is ADMA1/ADMA2.
|
||||
|
@ -1028,7 +1028,7 @@ status_t SDHC_TransferBlocking(SDHC_Type *base,
|
|||
sdhc_transfer_t *transfer);
|
||||
|
||||
/*!
|
||||
* @brief Create the SDHC handle.
|
||||
* @brief Creates the SDHC handle.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param handle SDHC handle pointer.
|
||||
|
@ -1041,13 +1041,13 @@ void SDHC_TransferCreateHandle(SDHC_Type *base,
|
|||
void *userData);
|
||||
|
||||
/*!
|
||||
* @brief Transfer command/data using interrupt and asynchronous way.
|
||||
* @brief Transfers the command/data using an interrupt and an asynchronous method.
|
||||
*
|
||||
* This function send command and data and return immediately. It doesn't wait the transfer complete or encounter error.
|
||||
* Application must not call this API in multiple threads at the same time because of that this API doesn't support
|
||||
* reentry mechanism.
|
||||
* This function sends a command and data and returns immediately. It doesn't wait the transfer complete or encounter an
|
||||
* error. The application must not call this API in multiple threads at the same time. Because of that this API doesn't support
|
||||
* the re-entry mechanism.
|
||||
*
|
||||
* @note Must call the API 'SDHC_TransferCreateHandle' when calling this API.
|
||||
* @note Call the API 'SDHC_TransferCreateHandle' when calling this API.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param handle SDHC handle.
|
||||
|
@ -1063,9 +1063,9 @@ status_t SDHC_TransferNonBlocking(
|
|||
SDHC_Type *base, sdhc_handle_t *handle, uint32_t *admaTable, uint32_t admaTableWords, sdhc_transfer_t *transfer);
|
||||
|
||||
/*!
|
||||
* @brief IRQ handler for SDHC
|
||||
* @brief IRQ handler for the SDHC.
|
||||
*
|
||||
* This function deals with IRQs on the given host controller.
|
||||
* This function deals with the IRQs on the given host controller.
|
||||
*
|
||||
* @param base SDHC peripheral base address.
|
||||
* @param handle SDHC handle.
|
||||
|
|
|
@ -344,64 +344,47 @@ void serial_free(serial_t *obj)
|
|||
}
|
||||
}
|
||||
|
||||
static nrf_uart_baudrate_t baud_translate(int rate)
|
||||
{
|
||||
nrf_uart_baudrate_t baud;
|
||||
|
||||
if (rate < 57600) {
|
||||
if (rate < 14400) {
|
||||
if (rate < 2400) {
|
||||
baud = NRF_UART_BAUDRATE_1200;
|
||||
} else if (rate < 4800) {
|
||||
baud = NRF_UART_BAUDRATE_2400;
|
||||
} else if (rate < 9600) {
|
||||
baud = NRF_UART_BAUDRATE_4800;
|
||||
} else {
|
||||
baud = NRF_UART_BAUDRATE_9600;
|
||||
}
|
||||
} else {
|
||||
if (rate < 19200) {
|
||||
baud = NRF_UART_BAUDRATE_14400;
|
||||
} else if (rate < 28800) {
|
||||
baud = NRF_UART_BAUDRATE_19200;
|
||||
} else if (rate < 38400) {
|
||||
baud = NRF_UART_BAUDRATE_28800;
|
||||
} else {
|
||||
baud = NRF_UART_BAUDRATE_38400;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (rate < 250000) {
|
||||
if (rate < 76800) {
|
||||
baud = NRF_UART_BAUDRATE_57600;
|
||||
} else if (rate < 115200) {
|
||||
baud = NRF_UART_BAUDRATE_76800;
|
||||
} else if (rate < 230400) {
|
||||
baud = NRF_UART_BAUDRATE_115200;
|
||||
} else {
|
||||
baud = NRF_UART_BAUDRATE_230400;
|
||||
}
|
||||
} else {
|
||||
if (rate < 460800) {
|
||||
baud = NRF_UART_BAUDRATE_250000;
|
||||
} else if (rate < 921600) {
|
||||
baud = NRF_UART_BAUDRATE_460800;
|
||||
} else if (rate < 1000000) {
|
||||
baud = NRF_UART_BAUDRATE_921600;
|
||||
} else {
|
||||
baud = NRF_UART_BAUDRATE_1000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
return baud;
|
||||
}
|
||||
void serial_baud(serial_t *obj, int baudrate)
|
||||
{
|
||||
(void)obj;
|
||||
UART_CB.baudrate = baud_translate(baudrate);
|
||||
// nrf_uart_baudrate_set() is not used here (registers are accessed
|
||||
// directly) to make it possible to set special baud rates like 56000
|
||||
// or 31250.
|
||||
|
||||
// Reconfigure UART peripheral.
|
||||
nrf_uart_baudrate_set(UART_INSTANCE, UART_CB.baudrate);
|
||||
static uint32_t const acceptedSpeeds[][2] = {
|
||||
{ 1200, UART_BAUDRATE_BAUDRATE_Baud1200 },
|
||||
{ 2400, UART_BAUDRATE_BAUDRATE_Baud2400 },
|
||||
{ 4800, UART_BAUDRATE_BAUDRATE_Baud4800 },
|
||||
{ 9600, UART_BAUDRATE_BAUDRATE_Baud9600 },
|
||||
{ 14400, UART_BAUDRATE_BAUDRATE_Baud14400 },
|
||||
{ 19200, UART_BAUDRATE_BAUDRATE_Baud19200 },
|
||||
{ 28800, UART_BAUDRATE_BAUDRATE_Baud28800 },
|
||||
{ 31250, (0x00800000UL) /* 31250 baud */ },
|
||||
{ 38400, UART_BAUDRATE_BAUDRATE_Baud38400 },
|
||||
{ 56000, (0x00E51000UL) /* 56000 baud */ },
|
||||
{ 57600, UART_BAUDRATE_BAUDRATE_Baud57600 },
|
||||
{ 76800, UART_BAUDRATE_BAUDRATE_Baud76800 },
|
||||
{ 115200, UART_BAUDRATE_BAUDRATE_Baud115200 },
|
||||
{ 230400, UART_BAUDRATE_BAUDRATE_Baud230400 },
|
||||
{ 250000, UART_BAUDRATE_BAUDRATE_Baud250000 },
|
||||
{ 460800, UART_BAUDRATE_BAUDRATE_Baud460800 },
|
||||
{ 921600, UART_BAUDRATE_BAUDRATE_Baud921600 },
|
||||
{ 1000000, UART_BAUDRATE_BAUDRATE_Baud1M }
|
||||
};
|
||||
|
||||
if (baudrate <= 1200) {
|
||||
UART_INSTANCE->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud1200;
|
||||
return;
|
||||
}
|
||||
|
||||
int const item_cnt = sizeof(acceptedSpeeds)/sizeof(acceptedSpeeds[0]);
|
||||
for (int i = 1; i < item_cnt; i++) {
|
||||
if ((uint32_t)baudrate < acceptedSpeeds[i][0]) {
|
||||
UART_INSTANCE->BAUDRATE = acceptedSpeeds[i - 1][1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
UART_INSTANCE->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud1M;
|
||||
}
|
||||
|
||||
void serial_format(serial_t *obj,
|
||||
|
|
|
@ -59,7 +59,7 @@ void gpio_irq6(void) {handle_interrupt_in(6);}
|
|||
void gpio_irq7(void) {handle_interrupt_in(7);}
|
||||
|
||||
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
|
||||
// PINT only supprt PIO0_*, PIO1_* and from PIO2_0 to PIO0_7 interrupt
|
||||
// PINT only supprt PIO0_*, PIO1_* and from PIO2_0 to PIO2_7 interrupt
|
||||
if (pin >= P2_8) return -1;
|
||||
|
||||
irq_handler = handler;
|
||||
|
@ -79,7 +79,18 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
|
|||
/* Enable AHB clock to the PIN, GPIO and IOCON domain. */
|
||||
LPC_SYSCON->SYSAHBCLKCTRL |= ((1 << 19) | (1 << 16) | (1 << 7));
|
||||
|
||||
LPC_SYSCON->PINTSEL[obj->ch] = ((((pin >> PORT_SHIFT) & 0x3) * 24) + ((pin >> PIN_SHIFT) & 0x1F));
|
||||
/* Gets offset value for each port */
|
||||
uint32_t offset;
|
||||
switch ((pin >> PORT_SHIFT) & 0x3) {
|
||||
case 0: offset = 0; // PIO0[23:0]
|
||||
break;
|
||||
case 1: offset = 24; // PIO1[31:0]
|
||||
break;
|
||||
case 2: offset = 56; // PIO2[7:0]
|
||||
break;
|
||||
}
|
||||
/* Set the INTPIN number : offset + pin_number */
|
||||
LPC_SYSCON->PINTSEL[obj->ch] = (offset + ((pin >> PIN_SHIFT) & 0x1F));
|
||||
|
||||
// Interrupt Wake-Up Enable
|
||||
LPC_SYSCON->STARTERP0 |= (1 << obj->ch);
|
||||
|
@ -88,14 +99,22 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
|
|||
|
||||
void (*channels_irq)(void) = NULL;
|
||||
switch (obj->ch) {
|
||||
case 0: channels_irq = &gpio_irq0; break;
|
||||
case 1: channels_irq = &gpio_irq1; break;
|
||||
case 2: channels_irq = &gpio_irq2; break;
|
||||
case 3: channels_irq = &gpio_irq3; break;
|
||||
case 4: channels_irq = &gpio_irq4; break;
|
||||
case 5: channels_irq = &gpio_irq5; break;
|
||||
case 6: channels_irq = &gpio_irq6; break;
|
||||
case 7: channels_irq = &gpio_irq7; break;
|
||||
case 0: channels_irq = &gpio_irq0;
|
||||
break;
|
||||
case 1: channels_irq = &gpio_irq1;
|
||||
break;
|
||||
case 2: channels_irq = &gpio_irq2;
|
||||
break;
|
||||
case 3: channels_irq = &gpio_irq3;
|
||||
break;
|
||||
case 4: channels_irq = &gpio_irq4;
|
||||
break;
|
||||
case 5: channels_irq = &gpio_irq5;
|
||||
break;
|
||||
case 6: channels_irq = &gpio_irq6;
|
||||
break;
|
||||
case 7: channels_irq = &gpio_irq7;
|
||||
break;
|
||||
}
|
||||
NVIC_SetVector((IRQn_Type)(PININT_IRQ + obj->ch), (uint32_t)channels_irq);
|
||||
NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
|
||||
|
|
|
@ -45,7 +45,23 @@ typedef enum {
|
|||
ADC1_4,
|
||||
ADC1_5,
|
||||
ADC1_6,
|
||||
ADC1_7
|
||||
ADC1_7,
|
||||
ADC_pin0_0,
|
||||
ADC_pin0_1,
|
||||
ADC_pin0_2,
|
||||
ADC_pin0_3,
|
||||
ADC_pin0_4,
|
||||
ADC_pin0_5,
|
||||
ADC_pin0_6,
|
||||
ADC_pin0_7,
|
||||
ADC_pin1_0,
|
||||
ADC_pin1_1,
|
||||
ADC_pin1_2,
|
||||
ADC_pin1_3,
|
||||
ADC_pin1_4,
|
||||
ADC_pin1_5,
|
||||
ADC_pin1_6,
|
||||
ADC_pin1_7
|
||||
} ADCName;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -29,6 +29,8 @@ typedef enum {
|
|||
|
||||
#define PORT_SHIFT 5
|
||||
#define NO_GPIO 15
|
||||
#define NO_PORT 0xFF
|
||||
|
||||
|
||||
// On the LPC43xx the MCU pin name and the GPIO pin name are not the same.
|
||||
// Encode SCU and GPIO offsets as a pin identifier
|
||||
|
@ -664,6 +666,24 @@ typedef enum {
|
|||
// (*) if DAC0 is configured, ADC4 is not available
|
||||
// (**) ADC5 requires JP2 mod
|
||||
|
||||
// Analog Only Pins
|
||||
adc0_0 = MBED_PIN(NO_PORT, 0, NO_GPIO, 0),
|
||||
adc0_1 = MBED_PIN(NO_PORT, 1, NO_GPIO, 0),
|
||||
adc0_2 = MBED_PIN(NO_PORT, 2, NO_GPIO, 0),
|
||||
adc0_3 = MBED_PIN(NO_PORT, 3, NO_GPIO, 0),
|
||||
adc0_4 = MBED_PIN(NO_PORT, 4, NO_GPIO, 0),
|
||||
adc0_5 = MBED_PIN(NO_PORT, 5, NO_GPIO, 0),
|
||||
adc0_6 = MBED_PIN(NO_PORT, 6, NO_GPIO, 0),
|
||||
adc0_7 = MBED_PIN(NO_PORT, 7, NO_GPIO, 0),
|
||||
adc1_0 = MBED_PIN(NO_PORT, 8, NO_GPIO, 0),
|
||||
adc1_1 = MBED_PIN(NO_PORT, 9, NO_GPIO, 0),
|
||||
adc1_2 = MBED_PIN(NO_PORT, 10, NO_GPIO, 0),
|
||||
adc1_3 = MBED_PIN(NO_PORT, 11, NO_GPIO, 0),
|
||||
adc1_4 = MBED_PIN(NO_PORT, 12, NO_GPIO, 0),
|
||||
adc1_5 = MBED_PIN(NO_PORT, 13, NO_GPIO, 0),
|
||||
adc1_6 = MBED_PIN(NO_PORT, 14, NO_GPIO, 0),
|
||||
adc1_7 = MBED_PIN(NO_PORT, 15, NO_GPIO, 0),
|
||||
|
||||
// USB pins
|
||||
// 210E 210 200E 200
|
||||
// ---- ---- ---- ----
|
||||
|
|
|
@ -45,7 +45,23 @@ typedef enum {
|
|||
ADC1_4,
|
||||
ADC1_5,
|
||||
ADC1_6,
|
||||
ADC1_7
|
||||
ADC1_7,
|
||||
ADC_pin0_0,
|
||||
ADC_pin0_1,
|
||||
ADC_pin0_2,
|
||||
ADC_pin0_3,
|
||||
ADC_pin0_4,
|
||||
ADC_pin0_5,
|
||||
ADC_pin0_6,
|
||||
ADC_pin0_7,
|
||||
ADC_pin1_0,
|
||||
ADC_pin1_1,
|
||||
ADC_pin1_2,
|
||||
ADC_pin1_3,
|
||||
ADC_pin1_4,
|
||||
ADC_pin1_5,
|
||||
ADC_pin1_6,
|
||||
ADC_pin1_7
|
||||
} ADCName;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -30,6 +30,7 @@ typedef enum {
|
|||
|
||||
#define PORT_SHIFT 5
|
||||
#define NO_GPIO 15
|
||||
#define NO_PORT 0xFF
|
||||
|
||||
// On the LPC43xx the MCU pin name and the GPIO pin name are not the same.
|
||||
// Encode SCU and GPIO offsets as a pin identifier
|
||||
|
@ -504,6 +505,24 @@ typedef enum {
|
|||
LED3 = LED_GREEN,
|
||||
LED4 = LED_RED,
|
||||
|
||||
// Analog Only pins
|
||||
adc0_0 = MBED_PIN(NO_PORT, 0, NO_GPIO, 0),
|
||||
adc0_1 = MBED_PIN(NO_PORT, 1, NO_GPIO, 0),
|
||||
adc0_2 = MBED_PIN(NO_PORT, 2, NO_GPIO, 0),
|
||||
adc0_3 = MBED_PIN(NO_PORT, 3, NO_GPIO, 0),
|
||||
adc0_4 = MBED_PIN(NO_PORT, 4, NO_GPIO, 0),
|
||||
adc0_5 = MBED_PIN(NO_PORT, 5, NO_GPIO, 0),
|
||||
adc0_6 = MBED_PIN(NO_PORT, 6, NO_GPIO, 0),
|
||||
adc0_7 = MBED_PIN(NO_PORT, 7, NO_GPIO, 0),
|
||||
adc1_0 = MBED_PIN(NO_PORT, 8, NO_GPIO, 0),
|
||||
adc1_1 = MBED_PIN(NO_PORT, 9, NO_GPIO, 0),
|
||||
adc1_2 = MBED_PIN(NO_PORT, 10, NO_GPIO, 0),
|
||||
adc1_3 = MBED_PIN(NO_PORT, 11, NO_GPIO, 0),
|
||||
adc1_4 = MBED_PIN(NO_PORT, 12, NO_GPIO, 0),
|
||||
adc1_5 = MBED_PIN(NO_PORT, 13, NO_GPIO, 0),
|
||||
adc1_6 = MBED_PIN(NO_PORT, 14, NO_GPIO, 0),
|
||||
adc1_7 = MBED_PIN(NO_PORT, 15, NO_GPIO, 0),
|
||||
|
||||
// ---------- End of LPCXpresso 4337 pins ----------
|
||||
} PinName;
|
||||
|
||||
|
|
|
@ -44,6 +44,22 @@ static const PinMap PinMap_ADC[] = {
|
|||
{PF_11, ADC1_5, 0},
|
||||
{P7_7, ADC1_6, 0},
|
||||
{PF_7, ADC1_7, 0},
|
||||
{adc0_0, ADC_pin0_0, 0},
|
||||
{adc0_1, ADC_pin0_1, 0},
|
||||
{adc0_2, ADC_pin0_2, 0},
|
||||
{adc0_3, ADC_pin0_3, 0},
|
||||
{adc0_4, ADC_pin0_4, 0},
|
||||
{adc0_5, ADC_pin0_5, 0},
|
||||
{adc0_6, ADC_pin0_6, 0},
|
||||
{adc0_7, ADC_pin0_7, 0},
|
||||
{adc1_0, ADC_pin1_0, 0},
|
||||
{adc1_1, ADC_pin1_1, 0},
|
||||
{adc1_2, ADC_pin1_2, 0},
|
||||
{adc1_3, ADC_pin1_3, 0},
|
||||
{adc1_4, ADC_pin1_4, 0},
|
||||
{adc1_5, ADC_pin1_5, 0},
|
||||
{adc1_6, ADC_pin1_6, 0},
|
||||
{adc1_7, ADC_pin1_7, 0},
|
||||
{NC, NC, 0 }
|
||||
};
|
||||
|
||||
|
@ -52,16 +68,30 @@ void analogin_init(analogin_t *obj, PinName pin) {
|
|||
|
||||
name = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
|
||||
MBED_ASSERT(obj->adc != (LPC_ADC_T *)NC);
|
||||
|
||||
// Set ADC number
|
||||
if(name < ADC1_0) {
|
||||
obj->num = 0;
|
||||
} else if(name < ADC_pin0_0 && name > ADC0_6) {
|
||||
obj->num = 1;
|
||||
} else if(name < ADC_pin1_1 && name > ADC1_7) {
|
||||
obj->num = 0;
|
||||
} else if(name > ADC_pin0_7) {
|
||||
obj->num = 1;
|
||||
}
|
||||
|
||||
// Set ADC register, number and channel
|
||||
obj->num = (name >> ADC0_7) ? 1 : 0;
|
||||
//ADC register and channel
|
||||
obj->ch = name % (ADC0_7 + 1);
|
||||
obj->adc = (LPC_ADC_T *) (obj->num > 0) ? LPC_ADC1 : LPC_ADC0;
|
||||
|
||||
// Reset pin function to GPIO
|
||||
gpio_set(pin);
|
||||
// Select ADC on analog function select register in SCU
|
||||
LPC_SCU->ENAIO[obj->num] |= (1 << obj->ch);
|
||||
// Reset pin function to GPIO if it is a GPIO pin. for adc only pins it is not necessary
|
||||
if(name < ADC_pin0_0) {
|
||||
gpio_set(pin);
|
||||
// Select ADC on analog function select register in SCU
|
||||
LPC_SCU->ENAIO[obj->num] |= (1 << obj->ch);
|
||||
} else {
|
||||
LPC_SCU->ENAIO[obj->num] &= ~(1 << obj->ch);
|
||||
}
|
||||
|
||||
// Calculate minimum clock divider
|
||||
// clkdiv = divider - 1
|
||||
|
|
|
@ -55,6 +55,9 @@ const PinMap PinMap_ADC[] = {
|
|||
{PC_3, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC_IN13
|
||||
{PC_4, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC_IN14
|
||||
{PC_5, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC_IN15
|
||||
{ADC_TEMP, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC_IN16
|
||||
{ADC_VREF, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC_IN17
|
||||
{ADC_VBAT, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC_IN18
|
||||
{NC, NC, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -43,14 +43,14 @@ extern "C" {
|
|||
#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\
|
||||
((PUPD & 0x07) << 4) |\
|
||||
((AFNUM & 0x0F) << 7) |\
|
||||
((CHANNEL & 0x0F) << 11) |\
|
||||
((INVERTED & 0x01) << 15)))
|
||||
((CHANNEL & 0x1F) << 11) |\
|
||||
((INVERTED & 0x01) << 16)))
|
||||
|
||||
#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F)
|
||||
#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07)
|
||||
#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F)
|
||||
#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x0F)
|
||||
#define STM_PIN_INVERTED(X) (((X) >> 15) & 0x01)
|
||||
#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F)
|
||||
#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01)
|
||||
|
||||
#define STM_MODE_INPUT (0)
|
||||
#define STM_MODE_OUTPUT_PP (1)
|
||||
|
@ -137,6 +137,10 @@ typedef enum {
|
|||
PF_6 = 0x56,
|
||||
PF_7 = 0x57,
|
||||
|
||||
// ADC internal channels
|
||||
ADC_TEMP = 0xF0,
|
||||
ADC_VREF = 0xF1,
|
||||
ADC_VBAT = 0xF2,
|
||||
|
||||
// Arduino connector namings
|
||||
A0 = PC_0,
|
||||
|
|
|
@ -66,17 +66,6 @@ struct dac_s {
|
|||
uint32_t channel;
|
||||
};
|
||||
|
||||
struct serial_s {
|
||||
UARTName uart;
|
||||
int index; // Used by irq
|
||||
uint32_t baudrate;
|
||||
uint32_t databits;
|
||||
uint32_t stopbits;
|
||||
uint32_t parity;
|
||||
PinName pin_tx;
|
||||
PinName pin_rx;
|
||||
};
|
||||
|
||||
struct spi_s {
|
||||
SPIName spi;
|
||||
uint32_t bits;
|
||||
|
|
|
@ -55,6 +55,9 @@ const PinMap PinMap_ADC[] = {
|
|||
{PC_3, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC_IN13
|
||||
{PC_4, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC_IN14
|
||||
{PC_5, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC_IN15
|
||||
{ADC_TEMP, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC_IN16
|
||||
{ADC_VREF, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC_IN17
|
||||
// {ADC_VBAT, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC_IN18 - Not present
|
||||
{NC, NC, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -43,14 +43,14 @@ extern "C" {
|
|||
#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\
|
||||
((PUPD & 0x07) << 4) |\
|
||||
((AFNUM & 0x0F) << 7) |\
|
||||
((CHANNEL & 0x0F) << 11) |\
|
||||
((INVERTED & 0x01) << 15)))
|
||||
((CHANNEL & 0x1F) << 11) |\
|
||||
((INVERTED & 0x01) << 16)))
|
||||
|
||||
#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F)
|
||||
#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07)
|
||||
#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F)
|
||||
#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x0F)
|
||||
#define STM_PIN_INVERTED(X) (((X) >> 15) & 0x01)
|
||||
#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F)
|
||||
#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01)
|
||||
|
||||
#define STM_MODE_INPUT (0)
|
||||
#define STM_MODE_OUTPUT_PP (1)
|
||||
|
@ -137,6 +137,10 @@ typedef enum {
|
|||
PF_6 = 0x56,
|
||||
PF_7 = 0x57,
|
||||
|
||||
// ADC internal channels
|
||||
ADC_TEMP = 0xF0,
|
||||
ADC_VREF = 0xF1,
|
||||
ADC_VBAT = 0xF2,
|
||||
|
||||
// Arduino connector namings
|
||||
A0 = PA_0,
|
||||
|
|
|
@ -60,17 +60,6 @@ struct analogin_s {
|
|||
uint32_t channel;
|
||||
};
|
||||
|
||||
struct serial_s {
|
||||
UARTName uart;
|
||||
int index; // Used by irq
|
||||
uint32_t baudrate;
|
||||
uint32_t databits;
|
||||
uint32_t stopbits;
|
||||
uint32_t parity;
|
||||
PinName pin_tx;
|
||||
PinName pin_rx;
|
||||
};
|
||||
|
||||
struct spi_s {
|
||||
SPIName spi;
|
||||
uint32_t bits;
|
||||
|
|
|
@ -49,6 +49,9 @@ const PinMap PinMap_ADC[] = {
|
|||
{PA_7, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC_IN7
|
||||
{PB_0, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC_IN8
|
||||
{PB_1, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC_IN9
|
||||
{ADC_TEMP, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC_IN16
|
||||
{ADC_VREF, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC_IN17
|
||||
{ADC_VBAT, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC_IN18
|
||||
{NC, NC, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -43,14 +43,14 @@ extern "C" {
|
|||
#define STM_PIN_DATA_EXT(MODE, PUPD, AFNUM, CHANNEL, INVERTED) ((int)(((MODE & 0x0F) << 0) |\
|
||||
((PUPD & 0x07) << 4) |\
|
||||
((AFNUM & 0x0F) << 7) |\
|
||||
((CHANNEL & 0x0F) << 11) |\
|
||||
((INVERTED & 0x01) << 15)))
|
||||
((CHANNEL & 0x1F) << 11) |\
|
||||
((INVERTED & 0x01) << 16)))
|
||||
|
||||
#define STM_PIN_MODE(X) (((X) >> 0) & 0x0F)
|
||||
#define STM_PIN_PUPD(X) (((X) >> 4) & 0x07)
|
||||
#define STM_PIN_AFNUM(X) (((X) >> 7) & 0x0F)
|
||||
#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x0F)
|
||||
#define STM_PIN_INVERTED(X) (((X) >> 15) & 0x01)
|
||||
#define STM_PIN_CHANNEL(X) (((X) >> 11) & 0x1F)
|
||||
#define STM_PIN_INVERTED(X) (((X) >> 16) & 0x01)
|
||||
|
||||
#define STM_MODE_INPUT (0)
|
||||
#define STM_MODE_OUTPUT_PP (1)
|
||||
|
@ -107,6 +107,11 @@ typedef enum {
|
|||
PF_0 = 0x50,
|
||||
PF_1 = 0x51,
|
||||
|
||||
// ADC internal channels
|
||||
ADC_TEMP = 0xF0,
|
||||
ADC_VREF = 0xF1,
|
||||
ADC_VBAT = 0xF2,
|
||||
|
||||
// Arduino connector namings
|
||||
A0 = PA_0,
|
||||
A1 = PA_1,
|
||||
|
|
|
@ -60,17 +60,6 @@ struct analogin_s {
|
|||
uint32_t channel;
|
||||
};
|
||||
|
||||
struct serial_s {
|
||||
UARTName uart;
|
||||
int index; // Used by irq
|
||||
uint32_t baudrate;
|
||||
uint32_t databits;
|
||||
uint32_t stopbits;
|
||||
uint32_t parity;
|
||||
PinName pin_tx;
|
||||
PinName pin_rx;
|
||||
};
|
||||
|
||||
struct spi_s {
|
||||
SPIName spi;
|
||||
uint32_t bits;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue