[BEETLE] Add BLE Cordio support into CMSIS

This patch adds BLE Cordio support into CMSIS. It provides:
* A modification for the linker scripts for both ARMCC and GCC
  compilers that adds the cordio specific sections.
* A method to access the Flash stored MAC Address.

The CORDIO_RO_2.1.o and TRIM_2.1.o objects that rappresent the Cordio
firmware will be added by a future patch.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
pull/2079/head
Vincenzo Frascino 2016-07-01 15:21:55 +01:00
parent 55216f1245
commit 15745a063d
4 changed files with 63 additions and 0 deletions

View File

@ -27,6 +27,7 @@ LR_IROM1 0x00000000 0x00040000 { ; load region size_region
*.o (RESET, +FIRST)
*(InRoot$$Sections)
.ANY (+RO)
CORDIO_RO_2.1.o (*)
}
; Total: 80 vectors = 320 bytes (0x140) to be reserved in RAM
RW_IRAM1 (0x20000000+0x140) (0x20000-0x140) { ; RW data

View File

@ -70,6 +70,12 @@ SECTIONS
. = ALIGN(4);
} > VECTORS
.cordio :
{
*CORDIO_RO_2.1.o
*TRIM_2.1.o
} > FLASH
.text :
{
*(.text*)

View File

@ -119,3 +119,36 @@ void SystemPowerResume(power_mode_t mode)
__DSB();
}
}
/*
* System config data storage functions
* Reserved as the data is not strictly persistent
*/
/*
* __System_Config_GetBDAddr(): Address for the BLE device on the air.
*/
void __System_Config_GetBDAddr(uint8_t *addr, uint8_t byte_len)
{
SystemCoreConfigData *p;
int bank1addr = EFlash_ReturnBank1BaseAddress();
if (byte_len > 6)
{
return;
}
if (bank1addr < 0)
{
memset(addr, 0xFF, byte_len);
}
else
{
/* 2x bank1 address is the top as banks have to be symmetric sizes */
/* The data is stored at the end.*/
p = (SystemCoreConfigData *) ((2 * bank1addr) - SYSTEM_CORE_CONFIG_DATA_SIZE);
memcpy(addr, p->BD_ADDR, byte_len);
}
}

View File

@ -65,6 +65,29 @@ void SystemPowerSuspend(power_mode_t mode);
*/
void SystemPowerResume(power_mode_t mode);
/*
* Definitions for storing static configuration data in Beetle
* This is not strictly persistent data as it will get wiped out on chip erase.
*
* There are only read functions provided.
* No Write function to prevent accidental writes resulting in
* the system being non responsive.
* Use the Flash manual before trying to write anything in the last 4k.
*/
#define SYSTEM_CORE_CONFIG_DATA_SIZE (0x200) /* 512 bytes*/
typedef struct {
uint32_t BD_ADDR[2];
/*rest reserved*/
uint32_t reserved[SYSTEM_CORE_CONFIG_DATA_SIZE - 2];
} SystemCoreConfigData;
/*
* __System_Config_GetBDAddr(): Address for the BLE device on the air.
*/
void __System_Config_GetBDAddr(uint8_t *addr, uint8_t len);
#ifdef __cplusplus
}
#endif