Fix last issues

Imports working McuBoot for reset.
Updates microsec ticker driver.
Default baudrate is set to 115200 to see TF-M boot messages.
Stack top is set to scatter file dependent and not hard-coded.
pull/9221/head
Gabor Kertesz 2019-04-26 11:59:32 +02:00 committed by Oren Cohen
parent bde2557629
commit 40627a5220
6 changed files with 143 additions and 114 deletions

View File

@ -130,6 +130,12 @@
}
},
"target_overrides": {
"ARM_MUSCA_A1_NS": {
"stdio-baud-rate": 115200
},
"ARM_MUSCA_A1_S": {
"stdio-baud-rate": 115200
},
"EFM32": {
"stdio-baud-rate": 115200
},

View File

@ -23,8 +23,6 @@
;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
;*/
__initial_sp EQU 0x20020000 ; Top of RAM
; Vector Table Mapped to Address 0 at Reset
AREA VECTOR, DATA, READONLY
@ -32,8 +30,10 @@ __initial_sp EQU 0x20020000 ; Top of RAM
EXPORT __Vectors_End
EXPORT __Vectors_Size
IMPORT |Image$$ARM_LIB_STACK$$ZI$$Limit|
__Vectors ;Core Interrupts
DCD __initial_sp ; Top of Stack
DCD |Image$$ARM_LIB_STACK$$ZI$$Limit|; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler

View File

@ -6,6 +6,16 @@ Built by mbed-cli using GNU Arm Embedded - version 6.3.1
These images were compiled by the following command:
## mcuboot.bin
### Repository
https://git.trustedfirmware.org/trusted-firmware-m.git
### Commit SHA
8da7f102a6a6a1a99462f7f32edbd1565096c2f3
```sh
cmake ../ -G"Unix Makefiles" -DTARGET_PLATFORM=MUSCA_A -DCOMPILER=ARMCLANG -DCMAKE_BUILD_TYPE=Debug
make
```
## tfm.bin
```sh

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2019 Arm Limited
* Copyright (c) 2017-2019 Arm Limited
*
* SPDX-License-Identifier: Apache-2.0
*
@ -22,10 +22,15 @@
*/
#include "device.h"
#include "mbed_critical.h"
#include "timer_cmsdk_drv.h"
#include "us_ticker_api.h"
static uint64_t total_ticks = 0;
/* Stores the last reload value, or the last tick value read when a read API
* call occurs from the upper layer, needed to keep total_ticks
* accumulated properly.
*/
static uint32_t previous_ticks = 0;
static void restart_timer(uint32_t new_reload)
@ -39,6 +44,23 @@ static void restart_timer(uint32_t new_reload)
timer_cmsdk_enable(&USEC_TIMER_DEV);
}
static void update_ticker(void)
{
if (timer_cmsdk_is_interrupt_active(&USEC_TIMER_DEV)) {
total_ticks += previous_ticks;
previous_ticks = TIMER_CMSDK_MAX_RELOAD;
restart_timer(previous_ticks);
} else {
uint32_t tick = timer_cmsdk_get_current_value(&USEC_TIMER_DEV);
if (tick < previous_ticks) {
uint32_t delta = previous_ticks - tick;
total_ticks += delta;
previous_ticks = tick;
}
}
}
void us_ticker_init(void)
{
timer_cmsdk_init(&USEC_TIMER_DEV);
@ -54,20 +76,11 @@ void us_ticker_free(void)
uint32_t us_ticker_read(void)
{
if (timer_cmsdk_is_interrupt_active(&USEC_TIMER_DEV)) {
total_ticks += previous_ticks;
previous_ticks = TIMER_CMSDK_MAX_RELOAD;
restart_timer(previous_ticks);
}
uint32_t tick = timer_cmsdk_get_current_value(&USEC_TIMER_DEV);
core_util_critical_section_enter();
update_ticker();
core_util_critical_section_exit();
if (tick < previous_ticks) {
uint32_t delta = previous_ticks - tick;
total_ticks += delta;
previous_ticks = tick;
}
return (total_ticks >> USEC_REPORTED_SHIFT);
return (uint32_t)(total_ticks >> USEC_REPORTED_SHIFT);
}
void us_ticker_set_interrupt(timestamp_t timestamp)
@ -106,6 +119,6 @@ const ticker_info_t* us_ticker_get_info()
#endif
void usec_interval_irq_handler(void)
{
us_ticker_read();
update_ticker();
us_ticker_irq_handler();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2019 ARM Limited
* Copyright (c) 2009-2019 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@ -14,10 +14,10 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* This file is derivative of CMSIS V5.01 \Device\ARM\ARMCM33\Source\system_ARMCM33.c
* https://github.com/ARM-software/CMSIS_5/tree/5.0.1
* Git SHA: 8a1d9d6ee18b143ae5befefa14d89fb5b3f99c75
*/
#include "system_cmsdk_musca.h"