Skip to content
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

Enable uvisor on Beetle #2518

Merged
merged 5 commits into from
Sep 15, 2016
Merged

Enable uvisor on Beetle #2518

merged 5 commits into from
Sep 15, 2016

Conversation

fvincenzo
Copy link
Contributor

@fvincenzo fvincenzo commented Aug 23, 2016

This pull request contains the set of patches that enable uvisor on Beetle.

It required some adaptation of the CMSIS file for the Cortex M3 covered in the patch "Backport virtual NVIC mechanism from CMSIS 5 on CM3". This change impacts even the other platforms that implement cmsis_nvic.c/h.

I extensively tested it on beetle and the results are attached.

@fvincenzo
Copy link
Contributor Author

Test results:

mbedgt: test suite report:
+------------------------+----------------+--------------------------------------------------------------------------------------+--------+--------------------+-------------+
| target                 | platform_name  | test suite                                                                           | result | elapsed_time (sec) | copy_method |
+------------------------+----------------+--------------------------------------------------------------------------------------+--------+--------------------+-------------+
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-basic_test                        | OK     | 20.9               | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-basic_test_default                | OK     | 20.92              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-case_async_validate               | OK     | 22.76              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-case_control_async                | OK     | 28.9               | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-case_control_repeat               | OK     | 22.92              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-case_selection                    | OK     | 20.78              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-case_setup_failure                | OK     | 21.41              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-case_teardown_failure             | OK     | 21.52              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-control_type                      | OK     | 21.95              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-minimal_async_scheduler           | OK     | 21.68              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-minimal_scheduler                 | OK     | 22.41              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-test_assertion_failure_test_setup | OK     | 20.57              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-test_setup_case_selection_failure | OK     | 20.72              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-features-frameworks-utest-tests-unit_tests-test_setup_failure                | OK     | 20.72              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-rtos-rtx-target_cortex_m-tests-memory-heap_and_stack                         | OK     | 20.66              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-integration-basic                                                      | OK     | 19.87              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-integration-threaded_blinky                                            | OK     | 39.96              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbed_drivers-c_strings                                                 | OK     | 22.77              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbed_drivers-callback                                                  | OK     | 27.6               | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbed_drivers-dev_null                                                  | OK     | 23.84              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbed_drivers-echo                                                      | OK     | 31.8               | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbed_drivers-generic_tests                                             | OK     | 21.82              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbed_drivers-rtc                                                       | OK     | 32.13              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbed_drivers-stl_features                                              | OK     | 22.34              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbed_drivers-ticker                                                    | OK     | 52.02              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbed_drivers-timeout                                                   | OK     | 32.23              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbed_drivers-wait_us                                                   | OK     | 30.46              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-mbed-attributes                                              | OK     | 22.62              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-mbed-call_before_main                                        | OK     | 20.55              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-mbed-cpp                                                     | OK     | 20.65              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-mbed-div                                                     | OK     | 20.65              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-rtos-mbed-basic                                              | OK     | 35.09              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-rtos-mbed-isr                                                | OK     | 25.74              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-rtos-mbed-mail                                               | OK     | 22.24              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-rtos-mbed-malloc                                             | OK     | 35.05              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-rtos-mbed-mutex                                              | OK     | 30.88              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-rtos-mbed-queue                                              | OK     | 22.33              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-rtos-mbed-semaphore                                          | OK     | 28.06              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-rtos-mbed-signals                                            | OK     | 25.84              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-rtos-mbed-threads                                            | OK     | 26.19              | shell       |
| ARM_BEETLE_SOC-GCC_ARM | ARM_BEETLE_SOC | mbed-os-tests-mbedmicro-rtos-mbed-timer                                              | OK     | 34.88              | shell       |
+------------------------+----------------+--------------------------------------------------------------------------------------+--------+--------------------+-------------+
mbedgt: test suite results: 41 OK

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 23, 2016

cc @AlessandroA @meriac

@fvincenzo
Copy link
Contributor Author

@AlessandroA Could you please review?

blx r0
/* The call to uvisor_init() happens independently of uVisor being enabled or
* not, so it is conditionally compiled only based on FEATURE_UVISOR. */
#ifdef FEATURE_UVISOR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change this to #if defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do in the next iteration, thanks.

This patch modifies:
* the Beetle GCC ARM linker script
* the Beetle startup code
in order to define the memory regions that enable uvisor.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
@fvincenzo fvincenzo force-pushed the master branch 2 times, most recently from 3f09307 to f44bff5 Compare September 5, 2016 13:55
@fvincenzo
Copy link
Contributor Author

@AlessandroA I made the changes as per review. Could you please let me know if my code is OK to go now? 😄

@AlessandroA
Copy link
Contributor

LGTM! 👍

@sg-
Copy link
Contributor

sg- commented Sep 9, 2016

@mbed-bot: TEST

HOST_OSES=ALL
BUILD_TOOLCHAINS=ALL
TARGETS=ALL

@sg-
Copy link
Contributor

sg- commented Sep 9, 2016

/morph test

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 805

Build failed!

@mbed-bot
Copy link

[Build 891]
FAILURE: Something went wrong when building and testing.

@sg-
Copy link
Contributor

sg- commented Sep 10, 2016

@fvincenzo Some CI test failures. Could you rebase on master and run mbed test for these boards / compiler combinitions?

Building project stats (NUCLEO_F103RB, ARM)
Scan: ARM
Scan: stats
Compile: main.cpp
[Warning] greentea_serial.h@13,0:  #1-D: last line of file ends without a newline
Link: stats
Error: L6218E: Undefined symbol NVIC_DecodePriority (referred from stm32f1xx_hal_cortex.o).
Error: L6218E: Undefined symbol NVIC_EncodePriority (referred from stm32f1xx_hal_cortex.o).
Error: L6218E: Undefined symbol NVIC_SystemReset (referred from stm32f1xx_hal_cortex.o).
Finished: 0 information, 0 warning and 3 error messages.


Building project stats (NUCLEO_L152RE, ARM)
Scan: ARM
Scan: stats
Compile: main.cpp
[Warning] greentea_serial.h@13,0:  #1-D: last line of file ends without a newline
Link: stats
Error: L6218E: Undefined symbol NVIC_DecodePriority (referred from stm32l1xx_hal_cortex.o).
Error: L6218E: Undefined symbol NVIC_EncodePriority (referred from stm32l1xx_hal_cortex.o).
Error: L6218E: Undefined symbol NVIC_SystemReset (referred from stm32l1xx_hal_cortex.o).
Finished: 0 information, 0 warning and 3 error messages.


Building project stats (NUCLEO_F207ZG, ARM)
Scan: ARM
Scan: FEATURE_IPV4
Scan: stats
Compile: main.cpp
[Warning] greentea_serial.h@13,0:  #1-D: last line of file ends without a newline
Link: stats
Error: L6218E: Undefined symbol NVIC_DecodePriority (referred from stm32f2xx_hal_cortex.o).
Error: L6218E: Undefined symbol NVIC_EncodePriority (referred from stm32f2xx_hal_cortex.o).
Error: L6218E: Undefined symbol NVIC_SystemReset (referred from stm32f2xx_hal_cortex.o).
Finished: 0 information, 0 warning and 3 error messages.

Building project udp_echo_client (NUCLEO_F207ZG, GCC_ARM)
Scan: GCC_ARM
Scan: FEATURE_IPV4
Scan: udp_echo_client
Compile: main.cpp
Link: udp_echo_client
C:/Jenkins/workspace/bm_wrap/475/.build/tests/NUCLEO_F207ZG/GCC_ARM/hal/targets/cmsis/TARGET_STM/TARGET_STM32F2/stm32f2xx_hal_cortex.o: In function `HAL_NVIC_SetPriority':
stm32f2xx_hal_cortex.c:(.text.HAL_NVIC_SetPriority+0xc): undefined reference to `NVIC_EncodePriority'
collect2.exe: error: ld returned 1 exit status


Building project udp_echo_client (NUCLEO_F207ZG, IAR)
Scan: IAR
Scan: FEATURE_IPV4
Scan: udp_echo_client
Compile: main.cpp
Link: udp_echo_client
Error[Li005]: no definition for "NVIC_EncodePriority" [referenced from C:\Jenki
          ns\workspace\bm_wrap\475\.build\tests\NUCLEO_F207ZG\IAR\hal\targets\c
          msis\TARGET_STM\TARGET_STM32F2\stm32f2xx_hal_cortex.o]

@sg- sg- added needs: work and removed needs: CI labels Sep 10, 2016
This patch backports the virtual NVIC mechanish from CMSIS 5 for the
Cortex M3 architecture in order to support uvisor in this MCU class.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
This patch adds CMSIS 5 virtual NVIC compliancy in order to support
uvisor.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
This patch disables the fcache stats into mbed_sdk_init if uvisor is
defined in order to prevent MEMMANAGEMENT faults during boot.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
This patch adds Beetle platform to uvisor importer.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
@fvincenzo
Copy link
Contributor Author

@sg @0xc0170 I rebased the code. The patch set requires changes in the platforms that are using CM3 because it contains a backport of virtual NVIC from cmsis 5 (as explained in the patchset cover). Without the backport uvisor will not work.

I opened an issue #2641 to track this since I do not have other boards except beetle to test it.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 12, 2016

/morph test

@sg-
Copy link
Contributor

sg- commented Sep 12, 2016

because it contains a backport of virtual NVIC from cmsis 5

If thats the case we should upgrade all CMSIS files to a newer version and patch the target code. Thanks for opening the issue.

@fvincenzo
Copy link
Contributor Author

@sg No problem. Based on this could you please merge my change once the tests are complete?

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 833

Test failed!

@bridadan
Copy link
Contributor

morph test looks ok, need to go over a timing test edge case to prevent this from happening in the future.

@mazimkhan
Copy link

retest

@fvincenzo
Copy link
Contributor Author

@sg @0xc0170 If there isn't anything blocking, could you please merge this?

@sg- sg- merged commit da14bce into ARMmbed:master Sep 15, 2016
aisair pushed a commit to aisair/mbed that referenced this pull request Apr 30, 2024
Ports for Upcoming Targets

2669: Added u-blox C029 target ARMmbed/mbed-os#2669
2707: [EFM32] Add IAR support for remaining Silicon Labs targets ARMmbed/mbed-os#2707
2819: MultiTech xDot platform support - 09.26.2016 ARMmbed/mbed-os#2819
2827: include MultiTech xDot in mbed 5 releases ARMmbed/mbed-os#2827

Fixes and Changes

2522: Add CThunk for CM7 ARMmbed/mbed-os#2522
2518: Enable uvisor on Beetle ARMmbed/mbed-os#2518
2571: STM32F7 - Add asynchronous serial ARMmbed/mbed-os#2571
2616: STM32F3xx - Add Serial Flow Control pins + enable it ARMmbed/mbed-os#2616
2619: NUCLEO_L152RE - Add Serial Flow Control ARMmbed/mbed-os#2619
2620: NUCLEO_F429ZI - Add SERIAL_FC macro ARMmbed/mbed-os#2620
2666: [EFM32] Microsecond ticker optimization ARMmbed/mbed-os#2666
2681: STM32F0xx - Add support of ADC internal channels ARMmbed/mbed-os#2681
2687: [NRF5] Add fs_data symbol in data secton for gcc ARMmbed/mbed-os#2687
2696: Add device_has to all nrf51 devices ARMmbed/mbed-os#2696
2703: TARGET_NRF5: Changed 'serial_baud' implementation to support special baud rates. ARMmbed/mbed-os#2703
2704: DISCO_L476VG: add SPI nicknames ARMmbed/mbed-os#2704
2723: KSDK serial_api.c: Fix assertion error for ParityEven ARMmbed/mbed-os#2723
2463: [STM32L0] Add asynchronous serial ARMmbed/mbed-os#2463
2572: Fix STM32F407VG target name and LPC11U6X linker errors ARMmbed/mbed-os#2572
2698: DELTA_DFBM_NQ620 target ARMmbed/mbed-os#2698
2542: Dev spi asynch stm32f4 ARMmbed/mbed-os#2542
2650: STM32F3 - Add low power timer ARMmbed/mbed-os#2650
2415: [STM32F0] Add asynchronous serial ARMmbed/mbed-os#2415
2585: Added support for ADC only pins in LPC43xx ARMmbed/mbed-os#2585
2622: [STM32F4] Add asynchronous I2C ARMmbed/mbed-os#2622
2719: Updated ARM linker scripts for Kinetis platforms that use SDK 2.0 ARMmbed/mbed-os#2719
2728: Added ethernet and enabled IPV4 feature for the EVK-ODIN-W2/C029 target ARMmbed/mbed-os#2728
2747: [LPC11U68] Fix pin interrupt select offset ARMmbed/mbed-os#2747
2751: STM32L0xx - Add Serial Flow Control ARMmbed/mbed-os#2751
2753: [NUCLEO_F767ZI] Add CAN capability ARMmbed/mbed-os#2753
2759: STM32F0 - Add low power timer ARMmbed/mbed-os#2759
2763: STM32L1 - Add low power timer ARMmbed/mbed-os#2763
2764: STM32L4 - Add low power timer ARMmbed/mbed-os#2764
2771: STM32L4 - Update deepsleep implementation ARMmbed/mbed-os#2771
2775: Update KSDK SDHC driver for K64F & K66F ARMmbed/mbed-os#2775
2792: [NUCLEO_F303ZE] MBED-OS5 capability ARMmbed/mbed-os#2792
2762: STM32L0 - Add low power timer ARMmbed/mbed-os#2762
2761: STM32F7 - Add low power timer ARMmbed/mbed-os#2761
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants