Skip to content

Commit d537c51

Browse files
committed
Merge pull request #245 from 0xc0170/dev_k64f_squash
target K64F
2 parents be141ac + a0f8bd9 commit d537c51

File tree

160 files changed

+171595
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+171595
-24
lines changed

libraries/USBDevice/USBDevice/USBEndpoints.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ typedef enum {
4141
#include "USBEndpoints_LPC17_LPC23.h"
4242
#elif defined(TARGET_LPC11UXX) || defined(TARGET_LPC1347)
4343
#include "USBEndpoints_LPC11U.h"
44-
#elif defined(TARGET_KL25Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D5M)
44+
#elif defined(TARGET_KL25Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D5M) | defined(TARGET_K64F)
4545
#include "USBEndpoints_KL25Z.h"
4646
#elif defined (TARGET_STM32F4XX)
4747
#include "USBEndpoints_STM32F4.h"

libraries/USBDevice/USBDevice/USBHAL_KL25Z.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1717
*/
1818

19-
#if defined(TARGET_KL25Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D5M)
19+
#if defined(TARGET_KL25Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D5M) | defined(TARGET_K64F)
2020

2121
#include "USBHAL.h"
2222

@@ -86,6 +86,9 @@ USBHAL::USBHAL(void) {
8686
// Disable IRQ
8787
NVIC_DisableIRQ(USB0_IRQn);
8888

89+
#if defined(TARGET_K64F)
90+
MPU->CESR=0;
91+
#endif
8992
// fill in callback array
9093
epCallback[0] = &USBHAL::EP1_OUT_callback;
9194
epCallback[1] = &USBHAL::EP1_IN_callback;
@@ -136,9 +139,9 @@ USBHAL::USBHAL(void) {
136139
while(USB0->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
137140

138141
// Set BDT Base Register
139-
USB0->BDTPAGE1=(uint8_t)((uint32_t)bdt>>8);
140-
USB0->BDTPAGE2=(uint8_t)((uint32_t)bdt>>16);
141-
USB0->BDTPAGE3=(uint8_t)((uint32_t)bdt>>24);
142+
USB0->BDTPAGE1 = (uint8_t)((uint32_t)bdt>>8);
143+
USB0->BDTPAGE2 = (uint8_t)((uint32_t)bdt>>16);
144+
USB0->BDTPAGE3 = (uint8_t)((uint32_t)bdt>>24);
142145

143146
// Clear interrupt flag
144147
USB0->ISTAT = 0xff;

libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K64F/MK64F12.h

Lines changed: 13416 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
LR_IROM1 0x00000000 0x100000 { ; load region size_region (1000k)
3+
ER_IROM1 0x00000000 0x100000 { ; load address = execution address
4+
*.o (RESET, +First)
5+
*(InRoot$$Sections)
6+
.ANY (+RO)
7+
}
8+
; 8_byte_aligned(62 vect * 4 bytes) = 8_byte_aligned(0x194) = 0x198
9+
; 0x40000 - 0x198 = 0x3FE68
10+
RW_IRAM1 0x1FFF0198 0x3FE68 {
11+
.ANY (+RW +ZI)
12+
}
13+
}
14+

libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K64F/TOOLCHAIN_ARM_STD/startup_MK64F12.s

Lines changed: 685 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* mbed Microcontroller Library - stackheap
2+
* Copyright (C) 2009-2011 ARM Limited. All rights reserved.
3+
*
4+
* Setup a fixed single stack/heap memory model,
5+
* between the top of the RW/ZI region and the stackpointer
6+
*/
7+
8+
#ifdef __cplusplus
9+
extern "C" {
10+
#endif
11+
12+
#include <rt_misc.h>
13+
#include <stdint.h>
14+
15+
extern char Image$$RW_IRAM1$$ZI$$Limit[];
16+
17+
extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
18+
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
19+
uint32_t sp_limit = __current_sp();
20+
21+
zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
22+
23+
struct __initial_stackheap r;
24+
r.heap_base = zi_limit;
25+
r.heap_limit = sp_limit;
26+
return r;
27+
}
28+
29+
#ifdef __cplusplus
30+
}
31+
#endif
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* mbed Microcontroller Library - CMSIS
2+
* Copyright (C) 2009-2011 ARM Limited. All rights reserved.
3+
*
4+
* A generic CMSIS include header, pulling in LPC11U24 specifics
5+
*/
6+
7+
#ifndef MBED_CMSIS_H
8+
#define MBED_CMSIS_H
9+
10+
#include "MK64F12.h"
11+
#include "cmsis_nvic.h"
12+
13+
#endif
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* mbed Microcontroller Library - cmsis_nvic for LPC11U24
2+
* Copyright (c) 2011 ARM Limited. All rights reserved.
3+
*
4+
* CMSIS-style functionality to support dynamic vectors
5+
*/
6+
#include "cmsis_nvic.h"
7+
8+
#define NVIC_RAM_VECTOR_ADDRESS (0x1FFF0000) // Vectors positioned at start of RAM
9+
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
10+
11+
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
12+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
13+
uint32_t i;
14+
15+
// Copy and switch to dynamic vectors if the first time called
16+
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
17+
uint32_t *old_vectors = vectors;
18+
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
19+
for (i=0; i<NVIC_NUM_VECTORS; i++) {
20+
vectors[i] = old_vectors[i];
21+
}
22+
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
23+
}
24+
vectors[IRQn + 16] = vector;
25+
}
26+
27+
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
28+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
29+
return vectors[IRQn + 16];
30+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* mbed Microcontroller Library - cmsis_nvic
2+
* Copyright (c) 2009-2011 ARM Limited. All rights reserved.
3+
*
4+
* CMSIS-style functionality to support dynamic vectors
5+
*/
6+
7+
#ifndef MBED_CMSIS_NVIC_H
8+
#define MBED_CMSIS_NVIC_H
9+
10+
#define NVIC_NUM_VECTORS (16 + 85) // CORE + MCU Peripherals
11+
#define NVIC_USER_IRQ_OFFSET 16
12+
13+
#include "cmsis.h"
14+
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
19+
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
20+
uint32_t NVIC_GetVector(IRQn_Type IRQn);
21+
22+
#ifdef __cplusplus
23+
}
24+
#endif
25+
26+
#endif

0 commit comments

Comments
 (0)