Skip to content

Rollup PR: Retest CI-troubled PRs targeted for 5.11 #8760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
66620a2
Merge commit '0ca91df5905111270a6ec1343be5c726c97fe571' into mbedos511
Nov 5, 2018
0ca91df
Squashed 'features/frameworks/nanostack-libservice/' changes from 5eb…
Nov 5, 2018
7fab5ab
Squashed 'features/frameworks/mbed-trace/' changes from 6df2572..9eaf0d1
Nov 5, 2018
d7e2bd3
Merge commit '7fab5abace6aa9d6fc6c335fa6fcab15a108d646' into mbedos511
Nov 5, 2018
3c37456
Merge commit '6a6dc452aa482a87421de660b3c57590cd43d6fa' into mbedos511
Nov 5, 2018
6a6dc45
Squashed 'features/nanostack/coap-service/' changes from cbe656a..bc3…
Nov 5, 2018
ef39a19
Merge commit '6dd01c679db4deb0a4a2c55832f3abe7b19bc51b' into mbedos511
Nov 5, 2018
6dd01c6
Squashed 'features/nanostack/sal-stack-nanostack/' changes from 2535a…
Nov 5, 2018
2457efc
Remove sal-stack-nanostack-eventloop
Nov 9, 2018
623607c
Squashed 'features/nanostack/sal-stack-nanostack-eventloop/' content …
Nov 9, 2018
9e661a9
Merge commit '623607c9da4ccd5cc1d3d75ff185b3f8d29a473b' as 'features/…
Nov 9, 2018
72fc5fa
Remove mbed-client-randlib
Nov 9, 2018
5d162a0
Squashed 'features/frameworks/mbed-client-randlib/' content from comm…
Nov 9, 2018
ce2ecd5
Merge commit '5d162a08ffd383c97b49e35f3065fcd4638ac87c' as 'features/…
Nov 9, 2018
1374a5e
Squashed 'features/frameworks/mbed-trace/' changes from 9eaf0d1..7a1bd34
Nov 9, 2018
9a13e9d
Merge commit '1374a5e5e6775dd6db9533075f25b3112c984b22' into mbedos511
Nov 9, 2018
e6a851f
Squashed 'features/nanostack/coap-service/' changes from bc331ca..c45…
Nov 9, 2018
e1ef0e4
Merge commit 'e6a851f0a7310462f5f65e9f7955f9fdc71b84f0' into mbedos511
Nov 9, 2018
661681f
Squashed 'features/frameworks/nanostack-libservice/' changes from bb5…
Nov 10, 2018
923ce13
Merge commit '661681f65c3fb61aec2e4605bef0fc075cc8cb0d' into mbedos511
Nov 10, 2018
7781856
Squashed 'features/nanostack/sal-stack-nanostack/' changes from ccd30…
Nov 10, 2018
d879422
Merge commit '77818568c6d9389ef1eb82e40ebfbbf26626c9d3' into mbedos511
Nov 10, 2018
cf53494
Compliance test errors fixed
Nov 14, 2018
1698978
Add an initial MPU API
c1728p9 Oct 5, 2018
787adfd
Add an MPU test
c1728p9 Oct 6, 2018
b09311f
Integrate MPU with mbed
c1728p9 Oct 6, 2018
1a21641
Add an RAII class for MPU execute never
c1728p9 Oct 29, 2018
b870427
Add design document for Execute Never
c1728p9 Oct 18, 2018
9b53ed1
Disable the MPU when flashing
c1728p9 Oct 18, 2018
7c36704
Rework MPU layout for future changes
c1728p9 Nov 1, 2018
b535dd0
Add MPU to device_has in targets.json
c1728p9 Nov 14, 2018
2db59b1
Add v8m MPU
c1728p9 Nov 1, 2018
274e996
Add a formal HAL specification for the MPU API
c1728p9 Nov 2, 2018
f5addad
Rename MpuXnLock
c1728p9 Nov 6, 2018
d52e594
Overhaul MPU for new requirements
c1728p9 Nov 6, 2018
a8eaa82
Correct ARMvX-M in design doc
c1728p9 Nov 6, 2018
e164d2f
Clear caches before RAM execution in MPU test
c1728p9 Nov 7, 2018
a02da19
Change MPU lock name for readability in FlashIAP
c1728p9 Nov 7, 2018
b3768c1
Fix MPU test when MemManage fault enabled
c1728p9 Nov 7, 2018
9157e5b
Skip MPU fault tests for ARMv8-M
c1728p9 Nov 7, 2018
41e4ece
Rename lock functions and classes
c1728p9 Nov 8, 2018
5cb922a
Remove MPU design doc
c1728p9 Nov 8, 2018
6bf7403
Define MPU_ROM_END for all targets
c1728p9 Nov 9, 2018
50836e7
Improve the efficiency of BufferedBlockDevice
Nov 8, 2018
3995779
Add a Unity macro to assert on platform error code difference
Nov 5, 2018
55c137a
Merge branch 'Lora_compliance' of ssh://github.com/AnttiKauppila/mbed…
Nov 15, 2018
3aff79c
Merge branch 'david_buffered_bd_perf' of ssh://github.com/davidsaada/…
Nov 15, 2018
e357f00
Merge branch 'prepare_for_mbedos511' of ssh://github.com/artokin/mbed…
Nov 15, 2018
20f1222
Merge branch 'david_unity_error_code' of ssh://github.com/davidsaada/…
Nov 15, 2018
f15efd1
Merge branch 'mpu' of ssh://github.com/c1728p9/mbed-os into rollup-b
Nov 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 13 additions & 1 deletion TESTS/mbed_hal/flash/functional_tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "utest/utest.h"
#include "unity/unity.h"
#include "greentea-client/test_env.h"
#include "platform/mbed_mpu_mgmt.h"

#include "mbed.h"
#include "flash_api.h"
Expand Down Expand Up @@ -251,11 +252,22 @@ Case cases[] = {

utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
{
mbed_mpu_manager_lock_ram_execution();
mbed_mpu_manager_lock_rom_write();

GREENTEA_SETUP(20, "default_auto");
return greentea_test_setup_handler(number_of_cases);
}

Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler);
void greentea_test_teardown(const size_t passed, const size_t failed, const failure_t failure)
{
mbed_mpu_manager_unlock_ram_execution();
mbed_mpu_manager_unlock_rom_write();

greentea_test_teardown_handler(passed, failed, failure);
}

Specification specification(greentea_test_setup, cases, greentea_test_teardown);

int main()
{
Expand Down
201 changes: 201 additions & 0 deletions TESTS/mbed_hal/mpu/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/

#include "utest/utest.h"
#include "unity/unity.h"
#include "greentea-client/test_env.h"

#include "cmsis.h"
#include <stdlib.h>

#include "mpu_api.h"
#include "mpu_test.h"

#if !DEVICE_MPU
#error [NOT_SUPPORTED] MPU API not supported for this target
#endif

using namespace utest::v1;

#define HARDFAULT_IRQn ((IRQn_Type)-13)
#define MEMFAULT_IRQn ((IRQn_Type)-12)

// Assembly return instruction: bx lr
#define ASM_BX_LR 0x4770

volatile uint32_t fault_count;
uint32_t real_hard_fault_handler;
uint32_t real_mem_fault_handler;

static volatile uint16_t data_function = ASM_BX_LR;
static volatile uint16_t bss_function;

static void clear_caches()
{
#if defined(__CORTEX_M7)
/* Data cache clean and invalid */
SCB_CleanInvalidateDCache();

/* Instruction cache invalid */
SCB_InvalidateICache();
#endif

__ISB();
__DSB();

}

static void call_mem(const volatile uint16_t *mem_function)
{
// or the address with 1 to ensure the thumb bit is set
((void (*)()) ((uint32_t)mem_function | 1))();
}

static void hard_fault_handler_test()
{
fault_count++;
mbed_mpu_enable_ram_xn(false);
}

static void mpu_fault_test(const volatile uint16_t *mem_function)
{
mbed_mpu_init();

// Verify that the mpu causes faults when executing ram
fault_count = 0;
mbed_mpu_enable_ram_xn(true);
call_mem(mem_function);
TEST_ASSERT_EQUAL(1, fault_count);

// Verify that the mpu can be turned off
fault_count = 0;
mbed_mpu_enable_ram_xn(false);
call_mem(mem_function);
TEST_ASSERT_EQUAL(0, fault_count);

// Verify that the mpu causes faults when executing ram
fault_count = 0;
mbed_mpu_enable_ram_xn(true);
call_mem(mem_function);
TEST_ASSERT_EQUAL(1, fault_count);

// Verify that free turns off the mpu
fault_count = 0;
mbed_mpu_free();
call_mem(mem_function);
TEST_ASSERT_EQUAL(0, fault_count);
}

void mpu_init_test()
{
for (int i = 0; i < 10; i++) {
mbed_mpu_init();
}

mbed_mpu_free();
}

void mpu_free_test()
{
mbed_mpu_init();

// Enable the MPU
mbed_mpu_enable_ram_xn(true);

// Free and ensure execution from RAM is allowed
mbed_mpu_free();

call_mem(&data_function);
}

void mpu_fault_test_data()
{
mpu_fault_test(&data_function);
}

void mpu_fault_test_bss()
{
bss_function = ASM_BX_LR;
clear_caches();
mpu_fault_test(&bss_function);
}

void mpu_fault_test_stack()
{
uint16_t stack_function;

stack_function = ASM_BX_LR;
clear_caches();
mpu_fault_test(&stack_function);
}

void mpu_fault_test_heap()
{
uint16_t *heap_function = (uint16_t*)malloc(2);

TEST_ASSERT_NOT_EQUAL(NULL, heap_function);
*heap_function = ASM_BX_LR;
clear_caches();
mpu_fault_test(heap_function);

free(heap_function);
}

utest::v1::status_t fault_override_setup(const Case *const source, const size_t index_of_case)
{
// Save old fault handlers and replace it with a new one
real_hard_fault_handler = NVIC_GetVector(HARDFAULT_IRQn);
real_mem_fault_handler = NVIC_GetVector(MEMFAULT_IRQn);
NVIC_SetVector(HARDFAULT_IRQn, (uint32_t)&hard_fault_handler_test);
NVIC_SetVector(MEMFAULT_IRQn, (uint32_t)&hard_fault_handler_test);

return greentea_case_setup_handler(source, index_of_case);
}

utest::v1::status_t fault_override_teardown(const Case *const source, const size_t passed, const size_t failed,
const failure_t reason)
{
// Restore real fault handlers
NVIC_SetVector(HARDFAULT_IRQn, real_hard_fault_handler);
NVIC_SetVector(MEMFAULT_IRQn, real_mem_fault_handler);

return greentea_case_teardown_handler(source, passed, failed, reason);
}

Case cases[] = {
Case("MPU - init", fault_override_setup, mpu_init_test, fault_override_teardown),
Case("MPU - free", fault_override_setup, mpu_free_test, fault_override_teardown),
#if !((__ARM_ARCH_8M_BASE__ == 1U) || (__ARM_ARCH_8M_MAIN__ == 1U))
// Skip fault tests for ARMv8-M until a fault handler hook is provided
Case("MPU - data fault", fault_override_setup, mpu_fault_test_data, fault_override_teardown),
Case("MPU - bss fault", fault_override_setup, mpu_fault_test_bss, fault_override_teardown),
Case("MPU - stack fault", fault_override_setup, mpu_fault_test_stack, fault_override_teardown),
Case("MPU - heap fault", fault_override_setup, mpu_fault_test_heap, fault_override_teardown)
#endif
};

utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(20, "default_auto");
return greentea_test_setup_handler(number_of_cases);
}

Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler);

int main()
{
Harness::run(specification);
}
94 changes: 94 additions & 0 deletions TESTS/mbed_hal/mpu/mpu_test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/* mbed Microcontroller Library
* Copyright (c) 2018-2018 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/

/** \addtogroup hal_mpu_tests
* @{
*/

#ifndef MBED_MPU_TEST_H
#define MBED_MPU_TEST_H

#if DEVICE_MPU

#ifdef __cplusplus
extern "C" {
#endif

/** Test that ::mbed_mpu_init can be called multiple times.
*
* Given board provides MPU.
* When ::mbed_mpu_init is called multiple times.
* Then ::mbed_mpu_init are successfully performed (no exception is generated).
*
*/
void mpu_init_test(void);

/** Test that ::mbed_mpu_free disables the MPU
*
* Given board provides MPU.
* When ::mbed_mpu_free is called.
* Then execution from RAM is allowed.
*
*/
void mpu_free_test(void);

/** Test that MPU protection works for global data
*
* Given board provides MPU.
* When RAM execution is disabled with a call to ::mbed_mpu_enable_ram_xn.
* Then execution from global initialized data results in a fault.
*
*/
void mpu_fault_test_data(void);

/** Test that MPU protection works for zero initialized data
*
* Given board provides MPU.
* When RAM execution is disabled with a call to ::mbed_mpu_enable_ram_xn.
* Then execution from global uninitialized data results in a fault.
*
*/
void mpu_fault_test_bss(void);

/** Test that MPU protection works for the stack
*
* Given board provides MPU.
* When RAM execution is disabled with a call to ::mbed_mpu_enable_ram_xn.
* Then execution from stack memory results in a fault.
*
*/
void mpu_fault_test_stack(void);

/** Test that MPU protection works for the heap
*
* Given board provides MPU.
* When RAM execution is disabled with a call to ::mbed_mpu_enable_ram_xn.
* Then execution from heap memory results in a fault.
*
*/
void mpu_fault_test_heap(void);

/**@}*/

#ifdef __cplusplus
}
#endif

#endif

#endif

/** @}*/
4 changes: 4 additions & 0 deletions UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ void exp_cb()
TEST_F(Test_LoRaMac, set_device_class)
{
object->set_device_class(CLASS_B, exp_cb);

my_phy phy;
object->bind_phy(phy);
object->set_device_class(CLASS_C, exp_cb);
}

TEST_F(Test_LoRaMac, setup_link_check_request)
Expand Down
1 change: 1 addition & 0 deletions doxyfile_options
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@ PREDEFINED = DOXYGEN_ONLY \
DEVICE_INTERRUPTIN \
DEVICE_ITM \
DEVICE_LPTICKER \
DEVICE_MPU \
DEVICE_PORTIN \
DEVICE_PORTINOUT \
DEVICE_PORTOUT \
Expand Down
2 changes: 1 addition & 1 deletion doxygen_options.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"SEARCH_INCLUDES": "YES",
"INCLUDE_PATH": "",
"INCLUDE_FILE_PATTERNS": "",
"PREDEFINED": "DOXYGEN_ONLY DEVICE_ANALOGIN DEVICE_ANALOGOUT DEVICE_CAN DEVICE_CRC DEVICE_ETHERNET DEVICE_EMAC DEVICE_FLASH DEVICE_I2C DEVICE_I2CSLAVE DEVICE_I2C_ASYNCH DEVICE_INTERRUPTIN DEVICE_ITM DEVICE_LPTICKER DEVICE_PORTIN DEVICE_PORTINOUT DEVICE_PORTOUT DEVICE_PWMOUT DEVICE_RTC DEVICE_TRNG DEVICE_SERIAL DEVICE_SERIAL_ASYNCH DEVICE_SERIAL_FC DEVICE_SLEEP DEVICE_SPI DEVICE_SPI_ASYNCH DEVICE_SPISLAVE DEVICE_QSPI DEVICE_STORAGE \"MBED_DEPRECATED_SINCE(f, g)=\" \"MBED_ENABLE_IF_CALLBACK_COMPATIBLE(F, M)=\" \"MBED_DEPRECATED(s)=\"",
"PREDEFINED": "DOXYGEN_ONLY DEVICE_ANALOGIN DEVICE_ANALOGOUT DEVICE_CAN DEVICE_CRC DEVICE_ETHERNET DEVICE_EMAC DEVICE_FLASH DEVICE_I2C DEVICE_I2CSLAVE DEVICE_I2C_ASYNCH DEVICE_INTERRUPTIN DEVICE_ITM DEVICE_LPTICKER DEVICE_MPU DEVICE_PORTIN DEVICE_PORTINOUT DEVICE_PORTOUT DEVICE_PWMOUT DEVICE_RTC DEVICE_TRNG DEVICE_SERIAL DEVICE_SERIAL_ASYNCH DEVICE_SERIAL_FC DEVICE_SLEEP DEVICE_SPI DEVICE_SPI_ASYNCH DEVICE_SPISLAVE DEVICE_QSPI DEVICE_STORAGE \"MBED_DEPRECATED_SINCE(f, g)=\" \"MBED_ENABLE_IF_CALLBACK_COMPATIBLE(F, M)=\" \"MBED_DEPRECATED(s)=\"",
"EXPAND_AS_DEFINED": "",
"SKIP_FUNCTION_MACROS": "NO",
"STRIP_CODE_COMMENTS": "NO",
Expand Down
Loading