Skip to content

Commit 883a6e7

Browse files
stevew817adbridge
authored andcommitted
Bugfix for EFM32PG12 and EFR32MG12
* Off by one error in the linker scripts reserved one word too little for the vector table * Re-apply uvisor changes to emlib. To allow uvisor to run, we should make accesses to the romtable through uvisor's secure read gateway * Copypasta in target name (EFM32PG12, not EFR32PG12) * Copypasta in the pin definitions (thanks @akselsm) * Forgot to update PortName for extra ports on MG/PG12
1 parent 7f8384c commit 883a6e7

File tree

73 files changed

+48
-33
lines changed

Some content is hidden

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

73 files changed

+48
-33
lines changed

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32PG12/device/TOOLCHAIN_ARM_STD/efr32pg12b.sct renamed to targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/device/TOOLCHAIN_ARM_STD/efr32pg12b.sct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LR_IROM1 0x00000000 0x00100000 { ; load region size_region
88
*(InRoot$$Sections)
99
.ANY (+RO)
1010
}
11-
RW_IRAM1 0x20000108 0x0003FEF8 { ; RW data
11+
RW_IRAM1 0x2000010C 0x0003FEF4 { ; RW data
1212
.ANY (+RW +ZI)
1313
}
1414
}

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32PG12/device/TOOLCHAIN_GCC_ARM/efm32pg12b.ld renamed to targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/device/TOOLCHAIN_GCC_ARM/efm32pg12b.ld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ MEMORY
1717

1818
/* MBED: mbed needs to be able to dynamically set the interrupt vector table.
1919
* We make room for the table at the very beginning of RAM, i.e. at
20-
* 0x20000000. We need (16+50 * sizeof(uint32_t) = 264 bytes for EFM32PG */
21-
__vector_size = 0x108;
20+
* 0x20000000. We need (16+51 * sizeof(uint32_t) = 268 bytes for EFM32PG */
21+
__vector_size = 0x10C;
2222

2323
/* Linker script to place sections and symbol values. Should be used together
2424
* with other linker script that defines memory regions FLASH and RAM.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ define symbol __ICFEDIT_intvec_start__ = 0x00000000;
1010
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
1111
define symbol __ICFEDIT_region_ROM_end__ = (0x00000000+0x00100000-1);
1212
define symbol __NVIC_start__ = 0x20000000;
13-
define symbol __NVIC_end__ = 0x20000107;
14-
define symbol __ICFEDIT_region_RAM_start__ = 0x20000108;
13+
define symbol __NVIC_end__ = 0x2000010B;
14+
define symbol __ICFEDIT_region_RAM_start__ = 0x2000010C;
1515
define symbol __ICFEDIT_region_RAM_end__ = (0x20000000+0x00040000-1);
1616

1717
/*-Sizes-*/

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/device/TOOLCHAIN_ARM_STD/efr32mg12p.sct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LR_IROM1 0x00000000 0x00100000 { ; load region size_region
88
*(InRoot$$Sections)
99
.ANY (+RO)
1010
}
11-
RW_IRAM1 0x20000108 0x0003FEF8 { ; RW data
11+
RW_IRAM1 0x2000010C 0x0003FEF4 { ; RW data
1212
.ANY (+RW +ZI)
1313
}
1414
}

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/device/TOOLCHAIN_GCC_ARM/efr32mg12p.ld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ MEMORY
1717

1818
/* MBED: mbed needs to be able to dynamically set the interrupt vector table.
1919
* We make room for the table at the very beginning of RAM, i.e. at
20-
* 0x20000000. We need (16+50 * sizeof(uint32_t) = 264 bytes for EFM32PG */
21-
__vector_size = 0x108;
20+
* 0x20000000. We need (16+51 * sizeof(uint32_t) = 268 bytes for EFM32PG */
21+
__vector_size = 0x10C;
2222

2323
/* Linker script to place sections and symbol values. Should be used together
2424
* with other linker script that defines memory regions FLASH and RAM.

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/device/TOOLCHAIN_IAR/efr32mg12p332f1024gl125.icf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ define symbol __ICFEDIT_intvec_start__ = 0x00000000;
77
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
88
define symbol __ICFEDIT_region_ROM_end__ = 0x000FFFFF;
99
define symbol __NVIC_start__ = 0x20000000;
10-
define symbol __NVIC_end__ = 0x20000107;
11-
define symbol __ICFEDIT_region_RAM_start__ = 0x20000108;
10+
define symbol __NVIC_end__ = 0x2000010B;
11+
define symbol __ICFEDIT_region_RAM_start__ = 0x2000010C;
1212
define symbol __ICFEDIT_region_RAM_end__ = 0x2003FFFF;
1313
/*-Sizes-*/
1414
/*Heap 1/4 of ram and stack 1/8*/

targets/TARGET_Silicon_Labs/TARGET_EFM32/common/CommonPinNames.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@
3030
* bits represent port number (A = 0, B = 1, ...)
3131
*/
3232
#define EFM32_STANDARD_PIN_DEFINITIONS \
33-
PA0 = 0 << 4, PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10, PA11, PA12, PA13, PA14, PA15, \
34-
PB0 = 1 << 4, PB1, PB2, PB3, PB4, PB5, PB6, PB7, PB8, PB9, PB10, PB11, PB12, PB13, PB14, PB15, \
35-
PC0 = 2 << 4, PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9, PC10, PC11, PC12, PC13, PC14, PC15, \
36-
PD0 = 3 << 4, PD1, PD2, PD3, PD4, PD5, PD6, PD7, PD8, PD9, PD10, PD11, PD12, PD13, PD14, PD15, \
37-
PE0 = 4 << 4, PE1, PE2, PE3, PE4, PE5, PE6, PE7, PE8, PE9, PE10, PE11, PE12, PE13, PE14, PE15, \
38-
PF0 = 5 << 4, PF1, PF2, PF3, PF4, PF5, PF6, PF7, PF8, PF9, PF10, PF11, PF12, PF13, PF14, PF15, \
39-
PG0 = 6 << 4, PG1, PG2, PG3, PG4, PG5, PG6, PG7, PG8, PG9, PG10, PG11, PG12, PG13, PG14, PG15, \
40-
PH0 = 7 << 4, PH1, PH2, PH3, PH4, PH5, PH6, PH7, PH8, PH9, PH10, PH11, PH12, PH13, PH14, PH15, \
41-
PI0 = 7 << 4, PI1, PI2, PI3, PI4, PI5, PI6, PI7, PI8, PI9, PI10, PI11, PI12, PI13, PI14, PI15, \
42-
PJ0 = 7 << 4, PJ1, PJ2, PJ3, PJ4, PJ5, PJ6, PJ7, PJ8, PJ9, PJ10, PJ11, PJ12, PJ13, PJ14, PJ15, \
43-
PK0 = 7 << 4, PK1, PK2, PK3, PK4, PK5, PK6, PK7, PK8, PK9, PK10, PK11, PK12, PK13, PK14, PK15, \
33+
PA0 = 0 << 4, PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10, PA11, PA12, PA13, PA14, PA15, \
34+
PB0 = 1 << 4, PB1, PB2, PB3, PB4, PB5, PB6, PB7, PB8, PB9, PB10, PB11, PB12, PB13, PB14, PB15, \
35+
PC0 = 2 << 4, PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9, PC10, PC11, PC12, PC13, PC14, PC15, \
36+
PD0 = 3 << 4, PD1, PD2, PD3, PD4, PD5, PD6, PD7, PD8, PD9, PD10, PD11, PD12, PD13, PD14, PD15, \
37+
PE0 = 4 << 4, PE1, PE2, PE3, PE4, PE5, PE6, PE7, PE8, PE9, PE10, PE11, PE12, PE13, PE14, PE15, \
38+
PF0 = 5 << 4, PF1, PF2, PF3, PF4, PF5, PF6, PF7, PF8, PF9, PF10, PF11, PF12, PF13, PF14, PF15, \
39+
PG0 = 6 << 4, PG1, PG2, PG3, PG4, PG5, PG6, PG7, PG8, PG9, PG10, PG11, PG12, PG13, PG14, PG15, \
40+
PH0 = 7 << 4, PH1, PH2, PH3, PH4, PH5, PH6, PH7, PH8, PH9, PH10, PH11, PH12, PH13, PH14, PH15, \
41+
PI0 = 8 << 4, PI1, PI2, PI3, PI4, PI5, PI6, PI7, PI8, PI9, PI10, PI11, PI12, PI13, PI14, PI15, \
42+
PJ0 = 9 << 4, PJ1, PJ2, PJ3, PJ4, PJ5, PJ6, PJ7, PJ8, PJ9, PJ10, PJ11, PJ12, PJ13, PJ14, PJ15, \
43+
PK0 = 10 << 4, PK1, PK2, PK3, PK4, PK5, PK6, PK7, PK8, PK9, PK10, PK11, PK12, PK13, PK14, PK15, \
4444
NC = (int) 0xFFFFFFFF
4545

4646
#ifdef __cplusplus

targets/TARGET_Silicon_Labs/TARGET_EFM32/common/PortNames.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,22 @@ typedef enum {
4646
PortE = gpioPortE, /**< Port E */
4747
#endif
4848
#if ( _GPIO_PORT_F_PIN_COUNT > 0 )
49-
PortF = gpioPortF /**< Port F */
49+
PortF = gpioPortF, /**< Port F */
5050
#endif
5151
#if defined( _GPIO_PORT_G_PIN_COUNT ) && ( _GPIO_PORT_G_PIN_COUNT > 0 )
52-
PortG = gpioPortG /**< Port F */
52+
PortG = gpioPortG, /**< Port G */
5353
#endif
5454
#if defined( _GPIO_PORT_H_PIN_COUNT ) && ( _GPIO_PORT_H_PIN_COUNT > 0 )
55-
PortH = gpioPortH /**< Port F */
55+
PortH = gpioPortH, /**< Port H */
56+
#endif
57+
#if defined( _GPIO_PORT_I_PIN_COUNT ) && ( _GPIO_PORT_I_PIN_COUNT > 0 )
58+
PortI = gpioPortI, /**< Port I */
59+
#endif
60+
#if defined( _GPIO_PORT_J_PIN_COUNT ) && ( _GPIO_PORT_J_PIN_COUNT > 0 )
61+
PortJ = gpioPortJ, /**< Port J */
62+
#endif
63+
#if defined( _GPIO_PORT_K_PIN_COUNT ) && ( _GPIO_PORT_K_PIN_COUNT > 0 )
64+
PortK = gpioPortK, /**< Port K */
5665
#endif
5766
} PortName;
5867

targets/TARGET_Silicon_Labs/TARGET_EFM32/emlib/src/em_system.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "em_system.h"
3434
#include "em_assert.h"
3535
#include <stddef.h>
36+
#include "core_cmSecureAccess.h"
3637

3738
/***************************************************************************//**
3839
* @addtogroup emlib
@@ -60,20 +61,25 @@ void SYSTEM_ChipRevisionGet(SYSTEM_ChipRevision_TypeDef *rev)
6061
uint8_t tmp;
6162

6263
EFM_ASSERT(rev);
64+
65+
uint32_t pid0 = SECURE_READ(&(ROMTABLE->PID0));
66+
uint32_t pid1 = SECURE_READ(&(ROMTABLE->PID1));
67+
uint32_t pid2 = SECURE_READ(&(ROMTABLE->PID2));
68+
uint32_t pid3 = SECURE_READ(&(ROMTABLE->PID3));
6369

6470
/* CHIP FAMILY bit [5:2] */
65-
tmp = (((ROMTABLE->PID1 & _ROMTABLE_PID1_FAMILYMSB_MASK) >> _ROMTABLE_PID1_FAMILYMSB_SHIFT) << 2);
71+
tmp = (((pid1 & _ROMTABLE_PID1_FAMILYMSB_MASK) >> _ROMTABLE_PID1_FAMILYMSB_SHIFT) << 2);
6672
/* CHIP FAMILY bit [1:0] */
67-
tmp |= ((ROMTABLE->PID0 & _ROMTABLE_PID0_FAMILYLSB_MASK) >> _ROMTABLE_PID0_FAMILYLSB_SHIFT);
73+
tmp |= ((pid0 & _ROMTABLE_PID0_FAMILYLSB_MASK) >> _ROMTABLE_PID0_FAMILYLSB_SHIFT);
6874
rev->family = tmp;
6975

7076
/* CHIP MAJOR bit [3:0] */
71-
rev->major = (ROMTABLE->PID0 & _ROMTABLE_PID0_REVMAJOR_MASK) >> _ROMTABLE_PID0_REVMAJOR_SHIFT;
77+
rev->major = (pid0 & _ROMTABLE_PID0_REVMAJOR_MASK) >> _ROMTABLE_PID0_REVMAJOR_SHIFT;
7278

7379
/* CHIP MINOR bit [7:4] */
74-
tmp = (((ROMTABLE->PID2 & _ROMTABLE_PID2_REVMINORMSB_MASK) >> _ROMTABLE_PID2_REVMINORMSB_SHIFT) << 4);
80+
tmp = (((pid2 & _ROMTABLE_PID2_REVMINORMSB_MASK) >> _ROMTABLE_PID2_REVMINORMSB_SHIFT) << 4);
7581
/* CHIP MINOR bit [3:0] */
76-
tmp |= ((ROMTABLE->PID3 & _ROMTABLE_PID3_REVMINORLSB_MASK) >> _ROMTABLE_PID3_REVMINORLSB_SHIFT);
82+
tmp |= ((pid3 & _ROMTABLE_PID3_REVMINORLSB_MASK) >> _ROMTABLE_PID3_REVMINORLSB_SHIFT);
7783
rev->minor = tmp;
7884
}
7985

targets/targets.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,18 +2336,18 @@
23362336
}
23372337
}
23382338
},
2339-
"EFM32PG12B500F1024": {
2339+
"EFM32PG12B500F1024GL125": {
23402340
"inherits": ["EFM32"],
23412341
"extra_labels_add": ["EFM32PG12", "1024K"],
23422342
"core": "Cortex-M4F",
2343-
"macros": ["EFM32PG12B500F1024", "TRANSACTION_QUEUE_SIZE_SPI=4"],
2343+
"macros": ["EFM32PG12B500F1024GL125", "TRANSACTION_QUEUE_SIZE_SPI=4"],
23442344
"supported_toolchains": ["GCC_ARM", "ARM", "uARM", "IAR"],
23452345
"release_versions": ["2", "5"],
2346-
"device_name": "EFM32PG12B500F1024",
2346+
"device_name": "EFM32PG12B500F1024GL125",
23472347
"public": false
23482348
},
23492349
"EFM32PG12_STK3402": {
2350-
"inherits": ["EFM32PG12B500F1024"],
2350+
"inherits": ["EFM32PG12B500F1024GL125"],
23512351
"device_has": ["AES", "SHA", "ECC", "ANALOGIN", "ERROR_PATTERN", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES"],
23522352
"forced_reset_timeout": 2,
23532353
"config": {

0 commit comments

Comments
 (0)