mirror of https://github.com/ARMmbed/mbed-os.git
Merge branch 'master' into STM32F4
Conflicts: workspace_tools/build_api.py workspace_tools/data/support.py workspace_tools/libraries.py workspace_tools/paths.py workspace_tools/toolchains.pypull/8/head
commit
92a5e412bd
11
README.md
11
README.md
|
@ -1,5 +1,5 @@
|
|||
mbed
|
||||
====
|
||||
mbed SDK
|
||||
========
|
||||
|
||||
The mbed Software Development Kit (SDK) is a C/C++ microcontroller software platform relied upon by tens of thousands of
|
||||
developers to build projects fast.
|
||||
|
@ -12,8 +12,11 @@ to build complex projects. It is built on the low-level ARM CMSIS APIs, allowing
|
|||
In addition to RTOS, USB and Networking libraries, a cookbook of hundreds of reusable peripheral and module libraries
|
||||
have been built on top of the SDK by the mbed Developer Community.
|
||||
|
||||
* [Tools documentation](http://mbed.org/handbook/mbed-tools): how to setup and use the build system.
|
||||
* [mbed library internals](http://mbed.org/handbook/mbed-library-internals) documentation
|
||||
Documentation
|
||||
-------------
|
||||
* [Tools](http://mbed.org/handbook/mbed-tools): how to setup and use the build system.
|
||||
* [mbed library internals](http://mbed.org/handbook/mbed-library-internals)
|
||||
* [Adding a new target microcontroller](http://mbed.org/handbook/mbed-SDK-porting)
|
||||
|
||||
Supported Microcontrollers
|
||||
--------------------------
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef enum {
|
|||
} EP_STATUS;
|
||||
|
||||
/* Include configuration for specific target */
|
||||
#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
|
||||
#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088)
|
||||
#include "USBEndpoints_LPC17_LPC23.h"
|
||||
#elif defined(TARGET_LPC11U24)
|
||||
#include "USBEndpoints_LPC11U.h"
|
||||
|
|
|
@ -0,0 +1,625 @@
|
|||
/* Copyright (c) 2010-2011 mbed.org, MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
* and associated documentation files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(TARGET_LPC4088)
|
||||
|
||||
#include "USBHAL.h"
|
||||
|
||||
|
||||
// Get endpoint direction
|
||||
#define IN_EP(endpoint) ((endpoint) & 1U ? true : false)
|
||||
#define OUT_EP(endpoint) ((endpoint) & 1U ? false : true)
|
||||
|
||||
// Convert physical endpoint number to register bit
|
||||
#define EP(endpoint) (1UL<<endpoint)
|
||||
|
||||
// Power Control for Peripherals register
|
||||
#define PCUSB (1UL<<31)
|
||||
|
||||
// USB Clock Control register
|
||||
#define DEV_CLK_EN (1UL<<1)
|
||||
#define AHB_CLK_EN (1UL<<4)
|
||||
|
||||
// USB Clock Status register
|
||||
#define DEV_CLK_ON (1UL<<1)
|
||||
#define AHB_CLK_ON (1UL<<4)
|
||||
|
||||
// USB Device Interupt registers
|
||||
#define FRAME (1UL<<0)
|
||||
#define EP_FAST (1UL<<1)
|
||||
#define EP_SLOW (1UL<<2)
|
||||
#define DEV_STAT (1UL<<3)
|
||||
#define CCEMPTY (1UL<<4)
|
||||
#define CDFULL (1UL<<5)
|
||||
#define RxENDPKT (1UL<<6)
|
||||
#define TxENDPKT (1UL<<7)
|
||||
#define EP_RLZED (1UL<<8)
|
||||
#define ERR_INT (1UL<<9)
|
||||
|
||||
// USB Control register
|
||||
#define RD_EN (1<<0)
|
||||
#define WR_EN (1<<1)
|
||||
#define LOG_ENDPOINT(endpoint) ((endpoint>>1)<<2)
|
||||
|
||||
// USB Receive Packet Length register
|
||||
#define DV (1UL<<10)
|
||||
#define PKT_RDY (1UL<<11)
|
||||
#define PKT_LNGTH_MASK (0x3ff)
|
||||
|
||||
// Serial Interface Engine (SIE)
|
||||
#define SIE_WRITE (0x01)
|
||||
#define SIE_READ (0x02)
|
||||
#define SIE_COMMAND (0x05)
|
||||
#define SIE_CMD_CODE(phase, data) ((phase<<8)|(data<<16))
|
||||
|
||||
// SIE Command codes
|
||||
#define SIE_CMD_SET_ADDRESS (0xD0)
|
||||
#define SIE_CMD_CONFIGURE_DEVICE (0xD8)
|
||||
#define SIE_CMD_SET_MODE (0xF3)
|
||||
#define SIE_CMD_READ_FRAME_NUMBER (0xF5)
|
||||
#define SIE_CMD_READ_TEST_REGISTER (0xFD)
|
||||
#define SIE_CMD_SET_DEVICE_STATUS (0xFE)
|
||||
#define SIE_CMD_GET_DEVICE_STATUS (0xFE)
|
||||
#define SIE_CMD_GET_ERROR_CODE (0xFF)
|
||||
#define SIE_CMD_READ_ERROR_STATUS (0xFB)
|
||||
|
||||
#define SIE_CMD_SELECT_ENDPOINT(endpoint) (0x00+endpoint)
|
||||
#define SIE_CMD_SELECT_ENDPOINT_CLEAR_INTERRUPT(endpoint) (0x40+endpoint)
|
||||
#define SIE_CMD_SET_ENDPOINT_STATUS(endpoint) (0x40+endpoint)
|
||||
|
||||
#define SIE_CMD_CLEAR_BUFFER (0xF2)
|
||||
#define SIE_CMD_VALIDATE_BUFFER (0xFA)
|
||||
|
||||
// SIE Device Status register
|
||||
#define SIE_DS_CON (1<<0)
|
||||
#define SIE_DS_CON_CH (1<<1)
|
||||
#define SIE_DS_SUS (1<<2)
|
||||
#define SIE_DS_SUS_CH (1<<3)
|
||||
#define SIE_DS_RST (1<<4)
|
||||
|
||||
// SIE Device Set Address register
|
||||
#define SIE_DSA_DEV_EN (1<<7)
|
||||
|
||||
// SIE Configue Device register
|
||||
#define SIE_CONF_DEVICE (1<<0)
|
||||
|
||||
// Select Endpoint register
|
||||
#define SIE_SE_FE (1<<0)
|
||||
#define SIE_SE_ST (1<<1)
|
||||
#define SIE_SE_STP (1<<2)
|
||||
#define SIE_SE_PO (1<<3)
|
||||
#define SIE_SE_EPN (1<<4)
|
||||
#define SIE_SE_B_1_FULL (1<<5)
|
||||
#define SIE_SE_B_2_FULL (1<<6)
|
||||
|
||||
// Set Endpoint Status command
|
||||
#define SIE_SES_ST (1<<0)
|
||||
#define SIE_SES_DA (1<<5)
|
||||
#define SIE_SES_RF_MO (1<<6)
|
||||
#define SIE_SES_CND_ST (1<<7)
|
||||
|
||||
|
||||
USBHAL * USBHAL::instance;
|
||||
|
||||
static volatile int epComplete;
|
||||
static uint32_t endpointStallState;
|
||||
|
||||
static void SIECommand(uint32_t command) {
|
||||
// The command phase of a SIE transaction
|
||||
LPC_USB->DevIntClr = CCEMPTY;
|
||||
LPC_USB->CmdCode = SIE_CMD_CODE(SIE_COMMAND, command);
|
||||
while (!(LPC_USB->DevIntSt & CCEMPTY));
|
||||
}
|
||||
|
||||
static void SIEWriteData(uint8_t data) {
|
||||
// The data write phase of a SIE transaction
|
||||
LPC_USB->DevIntClr = CCEMPTY;
|
||||
LPC_USB->CmdCode = SIE_CMD_CODE(SIE_WRITE, data);
|
||||
while (!(LPC_USB->DevIntSt & CCEMPTY));
|
||||
}
|
||||
|
||||
static uint8_t SIEReadData(uint32_t command) {
|
||||
// The data read phase of a SIE transaction
|
||||
LPC_USB->DevIntClr = CDFULL;
|
||||
LPC_USB->CmdCode = SIE_CMD_CODE(SIE_READ, command);
|
||||
while (!(LPC_USB->DevIntSt & CDFULL));
|
||||
return (uint8_t)LPC_USB->CmdData;
|
||||
}
|
||||
|
||||
static void SIEsetDeviceStatus(uint8_t status) {
|
||||
// Write SIE device status register
|
||||
SIECommand(SIE_CMD_SET_DEVICE_STATUS);
|
||||
SIEWriteData(status);
|
||||
}
|
||||
|
||||
static uint8_t SIEgetDeviceStatus(void) {
|
||||
// Read SIE device status register
|
||||
SIECommand(SIE_CMD_GET_DEVICE_STATUS);
|
||||
return SIEReadData(SIE_CMD_GET_DEVICE_STATUS);
|
||||
}
|
||||
|
||||
void SIEsetAddress(uint8_t address) {
|
||||
// Write SIE device address register
|
||||
SIECommand(SIE_CMD_SET_ADDRESS);
|
||||
SIEWriteData((address & 0x7f) | SIE_DSA_DEV_EN);
|
||||
}
|
||||
|
||||
static uint8_t SIEselectEndpoint(uint8_t endpoint) {
|
||||
// SIE select endpoint command
|
||||
SIECommand(SIE_CMD_SELECT_ENDPOINT(endpoint));
|
||||
return SIEReadData(SIE_CMD_SELECT_ENDPOINT(endpoint));
|
||||
}
|
||||
|
||||
static uint8_t SIEclearBuffer(void) {
|
||||
// SIE clear buffer command
|
||||
SIECommand(SIE_CMD_CLEAR_BUFFER);
|
||||
return SIEReadData(SIE_CMD_CLEAR_BUFFER);
|
||||
}
|
||||
|
||||
static void SIEvalidateBuffer(void) {
|
||||
// SIE validate buffer command
|
||||
SIECommand(SIE_CMD_VALIDATE_BUFFER);
|
||||
}
|
||||
|
||||
static void SIEsetEndpointStatus(uint8_t endpoint, uint8_t status) {
|
||||
// SIE set endpoint status command
|
||||
SIECommand(SIE_CMD_SET_ENDPOINT_STATUS(endpoint));
|
||||
SIEWriteData(status);
|
||||
}
|
||||
|
||||
static uint16_t SIEgetFrameNumber(void) __attribute__ ((unused));
|
||||
static uint16_t SIEgetFrameNumber(void) {
|
||||
// Read current frame number
|
||||
uint16_t lowByte;
|
||||
uint16_t highByte;
|
||||
|
||||
SIECommand(SIE_CMD_READ_FRAME_NUMBER);
|
||||
lowByte = SIEReadData(SIE_CMD_READ_FRAME_NUMBER);
|
||||
highByte = SIEReadData(SIE_CMD_READ_FRAME_NUMBER);
|
||||
|
||||
return (highByte << 8) | lowByte;
|
||||
}
|
||||
|
||||
static void SIEconfigureDevice(void) {
|
||||
// SIE Configure device command
|
||||
SIECommand(SIE_CMD_CONFIGURE_DEVICE);
|
||||
SIEWriteData(SIE_CONF_DEVICE);
|
||||
}
|
||||
|
||||
static void SIEunconfigureDevice(void) {
|
||||
// SIE Configure device command
|
||||
SIECommand(SIE_CMD_CONFIGURE_DEVICE);
|
||||
SIEWriteData(0);
|
||||
}
|
||||
|
||||
static void SIEconnect(void) {
|
||||
// Connect USB device
|
||||
uint8_t status = SIEgetDeviceStatus();
|
||||
SIEsetDeviceStatus(status | SIE_DS_CON);
|
||||
}
|
||||
|
||||
|
||||
static void SIEdisconnect(void) {
|
||||
// Disconnect USB device
|
||||
uint8_t status = SIEgetDeviceStatus();
|
||||
SIEsetDeviceStatus(status & ~SIE_DS_CON);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t selectEndpointClearInterrupt(uint8_t endpoint) {
|
||||
// Implemented using using EP_INT_CLR.
|
||||
LPC_USB->EpIntClr = EP(endpoint);
|
||||
while (!(LPC_USB->DevIntSt & CDFULL));
|
||||
return (uint8_t)LPC_USB->CmdData;
|
||||
}
|
||||
|
||||
|
||||
static void enableEndpointEvent(uint8_t endpoint) {
|
||||
// Enable an endpoint interrupt
|
||||
LPC_USB->EpIntEn |= EP(endpoint);
|
||||
}
|
||||
|
||||
static void disableEndpointEvent(uint8_t endpoint) __attribute__ ((unused));
|
||||
static void disableEndpointEvent(uint8_t endpoint) {
|
||||
// Disable an endpoint interrupt
|
||||
LPC_USB->EpIntEn &= ~EP(endpoint);
|
||||
}
|
||||
|
||||
static volatile uint32_t __attribute__((used)) dummyRead;
|
||||
uint32_t USBHAL::endpointReadcore(uint8_t endpoint, uint8_t *buffer) {
|
||||
// Read from an OUT endpoint
|
||||
uint32_t size;
|
||||
uint32_t i;
|
||||
uint32_t data = 0;
|
||||
uint8_t offset;
|
||||
|
||||
LPC_USB->Ctrl = LOG_ENDPOINT(endpoint) | RD_EN;
|
||||
while (!(LPC_USB->RxPLen & PKT_RDY));
|
||||
|
||||
size = LPC_USB->RxPLen & PKT_LNGTH_MASK;
|
||||
|
||||
offset = 0;
|
||||
|
||||
if (size > 0) {
|
||||
for (i=0; i<size; i++) {
|
||||
if (offset==0) {
|
||||
// Fetch up to four bytes of data as a word
|
||||
data = LPC_USB->RxData;
|
||||
}
|
||||
|
||||
// extract a byte
|
||||
*buffer = (data>>offset) & 0xff;
|
||||
buffer++;
|
||||
|
||||
// move on to the next byte
|
||||
offset = (offset + 8) % 32;
|
||||
}
|
||||
} else {
|
||||
dummyRead = LPC_USB->RxData;
|
||||
}
|
||||
|
||||
LPC_USB->Ctrl = 0;
|
||||
|
||||
if ((endpoint >> 1) % 3 || (endpoint >> 1) == 0) {
|
||||
SIEselectEndpoint(endpoint);
|
||||
SIEclearBuffer();
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static void endpointWritecore(uint8_t endpoint, uint8_t *buffer, uint32_t size) {
|
||||
// Write to an IN endpoint
|
||||
uint32_t temp, data;
|
||||
uint8_t offset;
|
||||
|
||||
LPC_USB->Ctrl = LOG_ENDPOINT(endpoint) | WR_EN;
|
||||
|
||||
LPC_USB->TxPLen = size;
|
||||
offset = 0;
|
||||
data = 0;
|
||||
|
||||
if (size>0) {
|
||||
do {
|
||||
// Fetch next data byte into a word-sized temporary variable
|
||||
temp = *buffer++;
|
||||
|
||||
// Add to current data word
|
||||
temp = temp << offset;
|
||||
data = data | temp;
|
||||
|
||||
// move on to the next byte
|
||||
offset = (offset + 8) % 32;
|
||||
size--;
|
||||
|
||||
if ((offset==0) || (size==0)) {
|
||||
// Write the word to the endpoint
|
||||
LPC_USB->TxData = data;
|
||||
data = 0;
|
||||
}
|
||||
} while (size>0);
|
||||
} else {
|
||||
LPC_USB->TxData = 0;
|
||||
}
|
||||
|
||||
// Clear WR_EN to cover zero length packet case
|
||||
LPC_USB->Ctrl=0;
|
||||
|
||||
SIEselectEndpoint(endpoint);
|
||||
SIEvalidateBuffer();
|
||||
}
|
||||
|
||||
USBHAL::USBHAL(void) {
|
||||
// Disable IRQ
|
||||
NVIC_DisableIRQ(USB_IRQn);
|
||||
|
||||
// fill in callback array
|
||||
epCallback[0] = &USBHAL::EP1_OUT_callback;
|
||||
epCallback[1] = &USBHAL::EP1_IN_callback;
|
||||
epCallback[2] = &USBHAL::EP2_OUT_callback;
|
||||
epCallback[3] = &USBHAL::EP2_IN_callback;
|
||||
epCallback[4] = &USBHAL::EP3_OUT_callback;
|
||||
epCallback[5] = &USBHAL::EP3_IN_callback;
|
||||
epCallback[6] = &USBHAL::EP4_OUT_callback;
|
||||
epCallback[7] = &USBHAL::EP4_IN_callback;
|
||||
epCallback[8] = &USBHAL::EP5_OUT_callback;
|
||||
epCallback[9] = &USBHAL::EP5_IN_callback;
|
||||
epCallback[10] = &USBHAL::EP6_OUT_callback;
|
||||
epCallback[11] = &USBHAL::EP6_IN_callback;
|
||||
epCallback[12] = &USBHAL::EP7_OUT_callback;
|
||||
epCallback[13] = &USBHAL::EP7_IN_callback;
|
||||
epCallback[14] = &USBHAL::EP8_OUT_callback;
|
||||
epCallback[15] = &USBHAL::EP8_IN_callback;
|
||||
epCallback[16] = &USBHAL::EP9_OUT_callback;
|
||||
epCallback[17] = &USBHAL::EP9_IN_callback;
|
||||
epCallback[18] = &USBHAL::EP10_OUT_callback;
|
||||
epCallback[19] = &USBHAL::EP10_IN_callback;
|
||||
epCallback[20] = &USBHAL::EP11_OUT_callback;
|
||||
epCallback[21] = &USBHAL::EP11_IN_callback;
|
||||
epCallback[22] = &USBHAL::EP12_OUT_callback;
|
||||
epCallback[23] = &USBHAL::EP12_IN_callback;
|
||||
epCallback[24] = &USBHAL::EP13_OUT_callback;
|
||||
epCallback[25] = &USBHAL::EP13_IN_callback;
|
||||
epCallback[26] = &USBHAL::EP14_OUT_callback;
|
||||
epCallback[27] = &USBHAL::EP14_IN_callback;
|
||||
epCallback[28] = &USBHAL::EP15_OUT_callback;
|
||||
epCallback[29] = &USBHAL::EP15_IN_callback;
|
||||
|
||||
// Enable power to USB device controller
|
||||
LPC_SC->PCONP |= PCUSB;
|
||||
|
||||
// Enable USB clocks
|
||||
LPC_USB->USBClkCtrl |= DEV_CLK_EN | AHB_CLK_EN;
|
||||
while ((LPC_USB->USBClkSt & (DEV_CLK_EN | AHB_CLK_EN)) != (DEV_CLK_ON | AHB_CLK_ON));
|
||||
|
||||
// Configure pins P0.29 and P0.30 to be USB D+ and USB D-
|
||||
LPC_IOCON->P0_29 &= ~0x07;
|
||||
LPC_IOCON->P0_29 |= 0x01;
|
||||
LPC_IOCON->P0_30 &= ~0x07;
|
||||
LPC_IOCON->P0_30 |= 0x01;
|
||||
|
||||
// Disconnect USB device
|
||||
SIEdisconnect();
|
||||
|
||||
// Configure pin P2.9 to be Connect
|
||||
LPC_IOCON->P2_9 &= ~0x07;
|
||||
LPC_IOCON->P2_9 |= 0x01;
|
||||
|
||||
// Connect must be low for at least 2.5uS
|
||||
wait(0.3);
|
||||
|
||||
// Set the maximum packet size for the control endpoints
|
||||
realiseEndpoint(EP0IN, MAX_PACKET_SIZE_EP0, 0);
|
||||
realiseEndpoint(EP0OUT, MAX_PACKET_SIZE_EP0, 0);
|
||||
|
||||
// Attach IRQ
|
||||
instance = this;
|
||||
NVIC_SetVector(USB_IRQn, (uint32_t)&_usbisr);
|
||||
|
||||
// Enable interrupts for device events and EP0
|
||||
LPC_USB->DevIntEn = EP_SLOW | DEV_STAT | FRAME;
|
||||
enableEndpointEvent(EP0IN);
|
||||
enableEndpointEvent(EP0OUT);
|
||||
}
|
||||
|
||||
USBHAL::~USBHAL(void) {
|
||||
// Ensure device disconnected
|
||||
SIEdisconnect();
|
||||
// Disable USB interrupts
|
||||
NVIC_DisableIRQ(USB_IRQn);
|
||||
}
|
||||
|
||||
void USBHAL::connect(void) {
|
||||
NVIC_EnableIRQ(USB_IRQn);
|
||||
// Connect USB device
|
||||
SIEconnect();
|
||||
}
|
||||
|
||||
void USBHAL::disconnect(void) {
|
||||
NVIC_DisableIRQ(USB_IRQn);
|
||||
// Disconnect USB device
|
||||
SIEdisconnect();
|
||||
}
|
||||
|
||||
void USBHAL::configureDevice(void) {
|
||||
SIEconfigureDevice();
|
||||
}
|
||||
|
||||
void USBHAL::unconfigureDevice(void) {
|
||||
SIEunconfigureDevice();
|
||||
}
|
||||
|
||||
void USBHAL::setAddress(uint8_t address) {
|
||||
SIEsetAddress(address);
|
||||
}
|
||||
|
||||
void USBHAL::EP0setup(uint8_t *buffer) {
|
||||
endpointReadcore(EP0OUT, buffer);
|
||||
}
|
||||
|
||||
void USBHAL::EP0read(void) {
|
||||
// Not required
|
||||
}
|
||||
|
||||
void USBHAL::EP0readStage(void) {
|
||||
// Not required
|
||||
}
|
||||
|
||||
uint32_t USBHAL::EP0getReadResult(uint8_t *buffer) {
|
||||
return endpointReadcore(EP0OUT, buffer);
|
||||
}
|
||||
|
||||
void USBHAL::EP0write(uint8_t *buffer, uint32_t size) {
|
||||
endpointWritecore(EP0IN, buffer, size);
|
||||
}
|
||||
|
||||
void USBHAL::EP0getWriteResult(void) {
|
||||
// Not required
|
||||
}
|
||||
|
||||
void USBHAL::EP0stall(void) {
|
||||
// This will stall both control endpoints
|
||||
stallEndpoint(EP0OUT);
|
||||
}
|
||||
|
||||
EP_STATUS USBHAL::endpointRead(uint8_t endpoint, uint32_t maximumSize) {
|
||||
return EP_PENDING;
|
||||
}
|
||||
|
||||
EP_STATUS USBHAL::endpointReadResult(uint8_t endpoint, uint8_t * buffer, uint32_t *bytesRead) {
|
||||
|
||||
//for isochronous endpoint, we don't wait an interrupt
|
||||
if ((endpoint >> 1) % 3 || (endpoint >> 1) == 0) {
|
||||
if (!(epComplete & EP(endpoint)))
|
||||
return EP_PENDING;
|
||||
}
|
||||
|
||||
*bytesRead = endpointReadcore(endpoint, buffer);
|
||||
epComplete &= ~EP(endpoint);
|
||||
return EP_COMPLETED;
|
||||
}
|
||||
|
||||
EP_STATUS USBHAL::endpointWrite(uint8_t endpoint, uint8_t *data, uint32_t size) {
|
||||
if (getEndpointStallState(endpoint)) {
|
||||
return EP_STALLED;
|
||||
}
|
||||
|
||||
epComplete &= ~EP(endpoint);
|
||||
|
||||
endpointWritecore(endpoint, data, size);
|
||||
return EP_PENDING;
|
||||
}
|
||||
|
||||
EP_STATUS USBHAL::endpointWriteResult(uint8_t endpoint) {
|
||||
if (epComplete & EP(endpoint)) {
|
||||
epComplete &= ~EP(endpoint);
|
||||
return EP_COMPLETED;
|
||||
}
|
||||
|
||||
return EP_PENDING;
|
||||
}
|
||||
|
||||
bool USBHAL::realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t flags) {
|
||||
// Realise an endpoint
|
||||
LPC_USB->DevIntClr = EP_RLZED;
|
||||
LPC_USB->ReEp |= EP(endpoint);
|
||||
LPC_USB->EpInd = endpoint;
|
||||
LPC_USB->MaxPSize = maxPacket;
|
||||
|
||||
while (!(LPC_USB->DevIntSt & EP_RLZED));
|
||||
LPC_USB->DevIntClr = EP_RLZED;
|
||||
|
||||
// Clear stall state
|
||||
endpointStallState &= ~EP(endpoint);
|
||||
|
||||
enableEndpointEvent(endpoint);
|
||||
return true;
|
||||
}
|
||||
|
||||
void USBHAL::stallEndpoint(uint8_t endpoint) {
|
||||
// Stall an endpoint
|
||||
if ( (endpoint==EP0IN) || (endpoint==EP0OUT) ) {
|
||||
// Conditionally stall both control endpoints
|
||||
SIEsetEndpointStatus(EP0OUT, SIE_SES_CND_ST);
|
||||
} else {
|
||||
SIEsetEndpointStatus(endpoint, SIE_SES_ST);
|
||||
|
||||
// Update stall state
|
||||
endpointStallState |= EP(endpoint);
|
||||
}
|
||||
}
|
||||
|
||||
void USBHAL::unstallEndpoint(uint8_t endpoint) {
|
||||
// Unstall an endpoint. The endpoint will also be reinitialised
|
||||
SIEsetEndpointStatus(endpoint, 0);
|
||||
|
||||
// Update stall state
|
||||
endpointStallState &= ~EP(endpoint);
|
||||
}
|
||||
|
||||
bool USBHAL::getEndpointStallState(uint8_t endpoint) {
|
||||
// Returns true if endpoint stalled
|
||||
return endpointStallState & EP(endpoint);
|
||||
}
|
||||
|
||||
void USBHAL::remoteWakeup(void) {
|
||||
// Remote wakeup
|
||||
uint8_t status;
|
||||
|
||||
// Enable USB clocks
|
||||
LPC_USB->USBClkCtrl |= DEV_CLK_EN | AHB_CLK_EN;
|
||||
while (LPC_USB->USBClkSt != (DEV_CLK_ON | AHB_CLK_ON));
|
||||
|
||||
status = SIEgetDeviceStatus();
|
||||
SIEsetDeviceStatus(status & ~SIE_DS_SUS);
|
||||
}
|
||||
|
||||
void USBHAL::_usbisr(void) {
|
||||
instance->usbisr();
|
||||
}
|
||||
|
||||
|
||||
void USBHAL::usbisr(void) {
|
||||
uint8_t devStat;
|
||||
|
||||
if (LPC_USB->DevIntSt & FRAME) {
|
||||
// Start of frame event
|
||||
SOF(SIEgetFrameNumber());
|
||||
// Clear interrupt status flag
|
||||
LPC_USB->DevIntClr = FRAME;
|
||||
}
|
||||
|
||||
if (LPC_USB->DevIntSt & DEV_STAT) {
|
||||
// Device Status interrupt
|
||||
// Must clear the interrupt status flag before reading the device status from the SIE
|
||||
LPC_USB->DevIntClr = DEV_STAT;
|
||||
|
||||
// Read device status from SIE
|
||||
devStat = SIEgetDeviceStatus();
|
||||
//printf("devStat: %d\r\n", devStat);
|
||||
|
||||
if (devStat & SIE_DS_SUS_CH) {
|
||||
// Suspend status changed
|
||||
if((devStat & SIE_DS_SUS) != 0) {
|
||||
suspendStateChanged(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (devStat & SIE_DS_RST) {
|
||||
// Bus reset
|
||||
if((devStat & SIE_DS_SUS) == 0) {
|
||||
suspendStateChanged(1);
|
||||
}
|
||||
busReset();
|
||||
}
|
||||
}
|
||||
|
||||
if (LPC_USB->DevIntSt & EP_SLOW) {
|
||||
// (Slow) Endpoint Interrupt
|
||||
|
||||
// Process each endpoint interrupt
|
||||
if (LPC_USB->EpIntSt & EP(EP0OUT)) {
|
||||
if (selectEndpointClearInterrupt(EP0OUT) & SIE_SE_STP) {
|
||||
// this is a setup packet
|
||||
EP0setupCallback();
|
||||
} else {
|
||||
EP0out();
|
||||
}
|
||||
LPC_USB->DevIntClr = EP_SLOW;
|
||||
}
|
||||
|
||||
if (LPC_USB->EpIntSt & EP(EP0IN)) {
|
||||
selectEndpointClearInterrupt(EP0IN);
|
||||
LPC_USB->DevIntClr = EP_SLOW;
|
||||
EP0in();
|
||||
}
|
||||
|
||||
for (uint8_t num = 2; num < 16*2; num++) {
|
||||
if (LPC_USB->EpIntSt & EP(num)) {
|
||||
selectEndpointClearInterrupt(num);
|
||||
epComplete |= EP(num);
|
||||
LPC_USB->DevIntClr = EP_SLOW;
|
||||
if ((instance->*(epCallback[num - 2]))()) {
|
||||
epComplete &= ~EP(num);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -176,7 +176,7 @@ private:
|
|||
};
|
||||
|
||||
// Bulk-only CBW
|
||||
typedef __packed struct {
|
||||
typedef struct {
|
||||
uint32_t Signature;
|
||||
uint32_t Tag;
|
||||
uint32_t DataLength;
|
||||
|
@ -184,15 +184,15 @@ private:
|
|||
uint8_t LUN;
|
||||
uint8_t CBLength;
|
||||
uint8_t CB[16];
|
||||
} CBW;
|
||||
} __packed CBW;
|
||||
|
||||
// Bulk-only CSW
|
||||
typedef __packed struct {
|
||||
typedef struct {
|
||||
uint32_t Signature;
|
||||
uint32_t Tag;
|
||||
uint32_t DataResidue;
|
||||
uint8_t Status;
|
||||
} CSW;
|
||||
} __packed CSW;
|
||||
|
||||
//state of the bulk-only state machine
|
||||
Stage stage;
|
||||
|
|
|
@ -37,7 +37,7 @@ int Timer::read_us() {
|
|||
}
|
||||
|
||||
float Timer::read() {
|
||||
return (float)read_us() / 1000000.0;
|
||||
return (float)read_us() / 1000000.0f;
|
||||
}
|
||||
|
||||
int Timer::read_ms() {
|
|
@ -136,7 +136,13 @@ int semihost_powerdown(void) {
|
|||
return __semihost(USR_POWERDOWN, NULL);
|
||||
}
|
||||
|
||||
#if !(DEVICE_DEBUG_AWARENESS)
|
||||
#if DEVICE_DEBUG_AWARENESS
|
||||
|
||||
int semihost_connected(void) {
|
||||
return (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) ? 1 : 0;
|
||||
}
|
||||
|
||||
#else
|
||||
// These processors cannot know if the interface is connect, assume so:
|
||||
static int is_debugger_attached = 1;
|
||||
|
|
@ -46,9 +46,17 @@
|
|||
|
||||
using namespace mbed;
|
||||
|
||||
#if defined(__MICROLIB) && (__ARMCC_VERSION>5030000)
|
||||
// Before version 5.03, we were using a patched version of microlib with proper names
|
||||
extern const char __stdin_name[] = ":tt";
|
||||
extern const char __stdout_name[] = ":tt";
|
||||
extern const char __stderr_name[] = ":tt";
|
||||
|
||||
#else
|
||||
extern const char __stdin_name[] = "/stdin";
|
||||
extern const char __stdout_name[] = "/stdout";
|
||||
extern const char __stderr_name[] = "/stderr";
|
||||
#endif
|
||||
|
||||
/* newlib has the filehandle field in the FILE struct as a short, so
|
||||
* we can't just return a Filehandle* from _open and instead have to
|
||||
|
@ -120,7 +128,7 @@ extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) {
|
|||
} else if (std::strcmp(name, __stdout_name) == 0) {
|
||||
init_serial();
|
||||
return 1;
|
||||
} else if (std::strcmp(name,__stderr_name) == 0) {
|
||||
} else if (std::strcmp(name, __stderr_name) == 0) {
|
||||
init_serial();
|
||||
return 2;
|
||||
}
|
||||
|
@ -371,6 +379,3 @@ namespace __gnu_cxx {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Make sure we are pulling in the retargeting module at link time
|
||||
volatile int stdio_retargeting_module;
|
|
@ -17,7 +17,7 @@
|
|||
#include "us_ticker_api.h"
|
||||
|
||||
void wait(float s) {
|
||||
wait_us(s * 1000000.0);
|
||||
wait_us(s * 1000000.0f);
|
||||
}
|
||||
|
||||
void wait_ms(int ms) {
|
|
@ -0,0 +1,153 @@
|
|||
/* Linker script for mbed LPC1768 */
|
||||
|
||||
/* Linker script to configure memory regions. */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 128K
|
||||
RAM (rwx) : ORIGIN = 0x1FFFF0C0, LENGTH = 0x3F40
|
||||
}
|
||||
|
||||
/* 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
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text.Reset_Handler)
|
||||
*(.text.SystemInit)
|
||||
|
||||
/* Only vectors and code running at reset are safe to be in first 512
|
||||
bytes since RAM can be mapped into this area for RAM based interrupt
|
||||
vectors. */
|
||||
. = 0x00000200;
|
||||
*(.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 = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE (__fini_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.heap :
|
||||
{
|
||||
__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 :
|
||||
{
|
||||
*(.stack)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
226
libraries/mbed/vendor/Freescale/KL25Z/cmsis/GCC_CW_NEWLIB/startup_MKL25Z4.s
vendored
Normal file
226
libraries/mbed/vendor/Freescale/KL25Z/cmsis/GCC_CW_NEWLIB/startup_MKL25Z4.s
vendored
Normal file
|
@ -0,0 +1,226 @@
|
|||
/* File: startup_ARMCM0.S
|
||||
* Purpose: startup file for Cortex-M0 devices. Should use with
|
||||
* GCC for ARM Embedded Processors
|
||||
* Version: V1.2
|
||||
* Date: 15 Nov 2011
|
||||
*
|
||||
* Copyright (c) 2011, ARM Limited
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the ARM Limited 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 ARM LIMITED 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
|
||||
.arch armv6-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, 0x80
|
||||
#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, 0x80
|
||||
#endif
|
||||
.globl __HeapBase
|
||||
.globl __HeapLimit
|
||||
__HeapBase:
|
||||
.space Heap_Size
|
||||
.size __HeapBase, . - __HeapBase
|
||||
__HeapLimit:
|
||||
.size __HeapLimit, . - __HeapLimit
|
||||
|
||||
.section .isr_vector
|
||||
.align 2
|
||||
.globl __isr_vector
|
||||
__isr_vector:
|
||||
.long __StackTop /* Top of Stack */
|
||||
.long Reset_Handler /* Reset Handler */
|
||||
.long NMI_Handler /* NMI Handler */
|
||||
.long HardFault_Handler /* Hard Fault Handler */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long SVC_Handler /* SVCall Handler */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long PendSV_Handler /* PendSV Handler */
|
||||
.long SysTick_Handler /* SysTick Handler */
|
||||
|
||||
/* External interrupts */
|
||||
.long DMA0_IRQHandler /* DMA channel 0 transfer complete interrupt */
|
||||
.long DMA1_IRQHandler /* DMA channel 1 transfer complete interrupt */
|
||||
.long DMA2_IRQHandler /* DMA channel 2 transfer complete interrupt */
|
||||
.long DMA3_IRQHandler /* DMA channel 3 transfer complete interrupt */
|
||||
.long Reserved20_IRQHandler /* Reserved interrupt 20 */
|
||||
.long FTFA_IRQHandler /* FTFA interrupt */
|
||||
.long LVD_LVW_IRQHandler /* Low Voltage Detect, Low Voltage Warning */
|
||||
.long LLW_IRQHandler /* Low Leakage Wakeup */
|
||||
.long I2C0_IRQHandler /* I2C0 interrupt */
|
||||
.long I2C1_IRQHandler /* I2C0 interrupt 25 */
|
||||
.long SPI0_IRQHandler /* SPI0 interrupt */
|
||||
.long SPI1_IRQHandler /* SPI1 interrupt */
|
||||
.long UART0_IRQHandler /* UART0 status/error interrupt */
|
||||
.long UART1_IRQHandler /* UART1 status/error interrupt */
|
||||
.long UART2_IRQHandler /* UART2 status/error interrupt */
|
||||
.long ADC0_IRQHandler /* ADC0 interrupt */
|
||||
.long CMP0_IRQHandler /* CMP0 interrupt */
|
||||
.long TPM0_IRQHandler /* TPM0 fault, overflow and channels interrupt */
|
||||
.long TPM1_IRQHandler /* TPM1 fault, overflow and channels interrupt */
|
||||
.long TPM2_IRQHandler /* TPM2 fault, overflow and channels interrupt */
|
||||
.long RTC_IRQHandler /* RTC interrupt */
|
||||
.long RTC_Seconds_IRQHandler /* RTC seconds interrupt */
|
||||
.long PIT_IRQHandler /* PIT timer interrupt */
|
||||
.long Reserved39_IRQHandler /* Reserved interrupt 39 */
|
||||
.long USB0_IRQHandler /* USB0 interrupt */
|
||||
.long DAC0_IRQHandler /* DAC interrupt */
|
||||
.long TSI0_IRQHandler /* TSI0 interrupt */
|
||||
.long MCG_IRQHandler /* MCG interrupt */
|
||||
.long LPTimer_IRQHandler /* LPTimer interrupt */
|
||||
.long Reserved45_IRQHandler /* Reserved interrupt 45 */
|
||||
.long PORTA_IRQHandler /* Port A interrupt */
|
||||
.long PORTD_IRQHandler /* Port D interrupt */
|
||||
|
||||
.size __isr_vector, . - __isr_vector
|
||||
|
||||
.section .text.Reset_Handler
|
||||
.thumb
|
||||
.thumb_func
|
||||
.align 2
|
||||
.globl Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
/* Loop to copy data from read only memory to RAM. The ranges
|
||||
* of copy from/to are specified by following symbols evaluated in
|
||||
* linker script.
|
||||
* __etext: End of code section, i.e., begin of data sections to copy from.
|
||||
* __data_start__/__data_end__: RAM address range that data should be
|
||||
* copied to. Both must be aligned to 4 bytes boundary. */
|
||||
|
||||
ldr r1, =__etext
|
||||
ldr r2, =__data_start__
|
||||
ldr r3, =__data_end__
|
||||
|
||||
subs r3, r2
|
||||
ble .flash_to_ram_loop_end
|
||||
|
||||
movs r4, 0
|
||||
.flash_to_ram_loop:
|
||||
ldr r0, [r1,r4]
|
||||
str r0, [r2,r4]
|
||||
adds r4, 4
|
||||
cmp r4, r3
|
||||
blt .flash_to_ram_loop
|
||||
.flash_to_ram_loop_end:
|
||||
|
||||
ldr r0, =SystemInit
|
||||
blx r0
|
||||
ldr r0, =_start
|
||||
bx r0
|
||||
.pool
|
||||
.size Reset_Handler, . - Reset_Handler
|
||||
|
||||
.text
|
||||
/* Macro to define default handlers. Default handler
|
||||
* will be weak symbol and just dead loops. They can be
|
||||
* overwritten by other handlers */
|
||||
.macro def_default_handler handler_name
|
||||
.align 1
|
||||
.thumb_func
|
||||
.weak \handler_name
|
||||
.type \handler_name, %function
|
||||
\handler_name :
|
||||
b .
|
||||
.size \handler_name, . - \handler_name
|
||||
.endm
|
||||
|
||||
def_default_handler NMI_Handler
|
||||
def_default_handler HardFault_Handler
|
||||
def_default_handler SVC_Handler
|
||||
def_default_handler PendSV_Handler
|
||||
def_default_handler SysTick_Handler
|
||||
def_default_handler DMA0_IRQHandler
|
||||
def_default_handler DMA1_IRQHandler
|
||||
def_default_handler DMA2_IRQHandler
|
||||
def_default_handler DMA3_IRQHandler
|
||||
def_default_handler Reserved20_IRQHandler
|
||||
def_default_handler FTFA_IRQHandler
|
||||
def_default_handler LVD_LVW_IRQHandler
|
||||
def_default_handler LLW_IRQHandler
|
||||
def_default_handler I2C0_IRQHandler
|
||||
def_default_handler I2C1_IRQHandler
|
||||
def_default_handler SPI0_IRQHandler
|
||||
def_default_handler SPI1_IRQHandler
|
||||
def_default_handler UART0_IRQHandler
|
||||
def_default_handler UART1_IRQHandler
|
||||
def_default_handler UART2_IRQHandler
|
||||
def_default_handler ADC0_IRQHandler
|
||||
def_default_handler CMP0_IRQHandler
|
||||
def_default_handler TPM0_IRQHandler
|
||||
def_default_handler TPM1_IRQHandler
|
||||
def_default_handler TPM2_IRQHandler
|
||||
def_default_handler RTC_IRQHandler
|
||||
def_default_handler RTC_Seconds_IRQHandler
|
||||
def_default_handler PIT_IRQHandler
|
||||
def_default_handler Reserved39_IRQHandler
|
||||
def_default_handler USB0_IRQHandler
|
||||
def_default_handler DAC0_IRQHandler
|
||||
def_default_handler TSI0_IRQHandler
|
||||
def_default_handler MCG_IRQHandler
|
||||
def_default_handler LPTimer_IRQHandler
|
||||
def_default_handler Reserved45_IRQHandler
|
||||
def_default_handler PORTA_IRQHandler
|
||||
def_default_handler PORTD_IRQHandler
|
||||
|
||||
.weak DEF_IRQHandler
|
||||
.set DEF_IRQHandler, Default_Handler
|
||||
|
||||
.end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue