Skip to content

Commit 15745a0

Browse files
committed
[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 <[email protected]>
1 parent 55216f1 commit 15745a0

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

hal/targets/cmsis/TARGET_ARM_SSG/TARGET_BEETLE/TOOLCHAIN_ARM_STD/BEETLE.sct

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ LR_IROM1 0x00000000 0x00040000 { ; load region size_region
2727
*.o (RESET, +FIRST)
2828
*(InRoot$$Sections)
2929
.ANY (+RO)
30+
CORDIO_RO_2.1.o (*)
3031
}
3132
; Total: 80 vectors = 320 bytes (0x140) to be reserved in RAM
3233
RW_IRAM1 (0x20000000+0x140) (0x20000-0x140) { ; RW data

hal/targets/cmsis/TARGET_ARM_SSG/TARGET_BEETLE/TOOLCHAIN_GCC_ARM/BEETLE.ld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ SECTIONS
7070
. = ALIGN(4);
7171
} > VECTORS
7272

73+
.cordio :
74+
{
75+
*CORDIO_RO_2.1.o
76+
*TRIM_2.1.o
77+
} > FLASH
78+
7379
.text :
7480
{
7581
*(.text*)

hal/targets/cmsis/TARGET_ARM_SSG/TARGET_BEETLE/system_core_beetle.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,36 @@ void SystemPowerResume(power_mode_t mode)
119119
__DSB();
120120
}
121121
}
122+
123+
124+
/*
125+
* System config data storage functions
126+
* Reserved as the data is not strictly persistent
127+
*/
128+
129+
/*
130+
* __System_Config_GetBDAddr(): Address for the BLE device on the air.
131+
*/
132+
void __System_Config_GetBDAddr(uint8_t *addr, uint8_t byte_len)
133+
{
134+
SystemCoreConfigData *p;
135+
int bank1addr = EFlash_ReturnBank1BaseAddress();
136+
137+
if (byte_len > 6)
138+
{
139+
return;
140+
}
141+
142+
if (bank1addr < 0)
143+
{
144+
memset(addr, 0xFF, byte_len);
145+
}
146+
else
147+
{
148+
/* 2x bank1 address is the top as banks have to be symmetric sizes */
149+
/* The data is stored at the end.*/
150+
p = (SystemCoreConfigData *) ((2 * bank1addr) - SYSTEM_CORE_CONFIG_DATA_SIZE);
151+
152+
memcpy(addr, p->BD_ADDR, byte_len);
153+
}
154+
}

hal/targets/cmsis/TARGET_ARM_SSG/TARGET_BEETLE/system_core_beetle.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,29 @@ void SystemPowerSuspend(power_mode_t mode);
6565
*/
6666
void SystemPowerResume(power_mode_t mode);
6767

68+
/*
69+
* Definitions for storing static configuration data in Beetle
70+
* This is not strictly persistent data as it will get wiped out on chip erase.
71+
*
72+
* There are only read functions provided.
73+
* No Write function to prevent accidental writes resulting in
74+
* the system being non responsive.
75+
* Use the Flash manual before trying to write anything in the last 4k.
76+
*/
77+
#define SYSTEM_CORE_CONFIG_DATA_SIZE (0x200) /* 512 bytes*/
78+
79+
typedef struct {
80+
uint32_t BD_ADDR[2];
81+
82+
/*rest reserved*/
83+
uint32_t reserved[SYSTEM_CORE_CONFIG_DATA_SIZE - 2];
84+
} SystemCoreConfigData;
85+
86+
/*
87+
* __System_Config_GetBDAddr(): Address for the BLE device on the air.
88+
*/
89+
void __System_Config_GetBDAddr(uint8_t *addr, uint8_t len);
90+
6891
#ifdef __cplusplus
6992
}
7093
#endif

0 commit comments

Comments
 (0)