Skip to content

Ambiq AMA3B1KK and SparkFun Artemis Boards Target Update #13538

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

Merged
merged 3 commits into from
Sep 10, 2020

Conversation

Wenn0101
Copy link
Contributor

@Wenn0101 Wenn0101 commented Sep 3, 2020

Summary of changes

This is is a new PR from the pull request here. This PR comes from a branch where the changes are rebased and squashed into a single commit.

We would like to collect some feedback on the following changes we have been working on.

Add support for Ambiq Micro AMA3B1KK (Apollo3)
Add support for SparkFun Boards which use AMA3B1KK:
-SparkFun Artemis ATP
-SparkFun Artemis DK
-SparkFun Artemis Nano
-SparkFun Artemis Thing Plus
-SparkFun Edge
-SparkFun Edge2

We know that we aren't quite ready for approval, but we are looking for feedback now so that we can make changes. We have been working on this very independently and would appreciate any comments from the Arm Mbed Team.

Things we know we have to change/complete before approval:
-rewrite commit history to meet contribution standards
-troubleshoot 2 failed test cases

Open Questions:
Supported toolchains - Right now we only support GCC_ARM toolchain on this target, do other toolchains need to be added to complete PR?
Added armc6 support. No IAR support still. is this OK?

Impact of changes

Migration actions required

Documentation

MCU Datasheet - https://cdn.sparkfun.com/assets/d/a/7/c/d/Apollo3_Blue_MCU_Data_Sheet_v0_9_1.pdf
Sparkfun product information - https://www.sparkfun.com/artemis


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR
target platform_name test suite result elapsed_time (sec) copy_method
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-connectivity-feature_ble-libraries-target_cordio-tests-cordio_hci-driver OK 17.76 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-connectivity-feature_ble-libraries-target_cordio-tests-cordio_hci-transport OK 16.64 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-connectivity-mbedtls-tests-tests-mbedtls-multi OK 17.28 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-connectivity-mbedtls-tests-tests-mbedtls-selftest OK 28.37 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-connectivity-netsocket-tests-tests-network-l3ip OK 16.05 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-device_key-tests-tests-device_key-functionality OK 21.1 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-buffered_serial TIMEOUT 28.03 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-c_strings OK 16.99 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-crc OK 17.46 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-dev_null OK 17.32 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-echo OK 17.76 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-flashiap OK 18.09 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-generic_tests OK 16.44 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-lp_ticker OK 22.17 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-lp_timeout OK 33.83 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-lp_timer OK 21.16 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-race_test OK 17.14 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-stl_features OK 16.87 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-ticker OK 41.01 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-timeout OK 33.68 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-timer OK 23.19 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-timerevent OK 17.85 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-drivers-tests-tests-mbed_drivers-unbuffered_serial SYNC_FAILED 40.28 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-events-tests-tests-events-queue OK 25.09 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-events-tests-tests-events-timing OK 76.76 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-basic_test OK 16.27 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-basic_test_default OK 16.19 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-case_async_validate OK 17.76 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-case_control_async OK 23.51 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-case_control_repeat OK 18.12 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-case_selection OK 16.2 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-case_setup_failure OK 16.89 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-case_teardown_failure OK 16.74 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-control_type OK 16.92 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-minimal_async_scheduler OK 17.07 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-minimal_scheduler OK 17.68 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-test_assertion_failure_test_setup OK 15.92 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-test_setup_case_selection_failure OK 16.03 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-test_setup_failure OK 16.05 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-features-frameworks-utest-tests-unit_tests-test_skip OK 16.4 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-common_tickers OK 21.48 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-common_tickers_freq OK 35.13 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-critical_section OK 16.12 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-flash OK 18.19 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-gpio OK 15.74 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-lp_ticker OK 16.02 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-minimum_requirements OK 15.92 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-mpu OK 16.79 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-pinmap OK 16.14 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-rtc_time OK 20.14 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-rtc_time_conv OK 34.71 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-ticker OK 30.43 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-hal-tests-tests-mbed_hal-us_ticker OK 15.96 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_functional-callback OK 18.17 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_functional-callback_big OK 17.84 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_functional-callback_small OK 17.74 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-atomic OK 28.72 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-circularbuffer OK 22.45 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-critical_section OK 17.85 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-error_handling OK 16.59 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-filehandle OK 17.59 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-minimal-printf OK 21.69 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-sharedptr OK 16.55 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-singletonptr OK 16.07 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-stream OK 16.9 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-system_reset OK 16.55 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-transaction OK 16.76 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-platform-tests-tests-mbed_platform-wait_ns OK 18.42 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-basic OK 25.36 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-condition_variable OK 16.28 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-event_flags OK 19.95 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-heap_and_stack OK 17.2 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-kernel_tick_count OK 18.57 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-mail OK 20.85 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-malloc OK 38.2 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-memorypool OK 24.12 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-mutex OK 20.25 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-queue OK 18.83 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-semaphore OK 21.92 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-signals OK 28.48 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-systimer OK 17.02 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-rtos-tests-tests-mbedmicro-rtos-mbed-threads OK 27.84 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-storage-blockdevice-tests-tests-blockdevice-buffered_block_device OK 16.26 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-storage-blockdevice-tests-tests-blockdevice-flashsim_block_device OK 16.05 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-storage-blockdevice-tests-tests-blockdevice-general_block_device OK 26.79 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-storage-kvstore-tests-tests-kvstore-static_tests OK 29.99 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-storage-kvstore-tests-tests-kvstore-tdbstore_whitebox OK 20.83 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-tests-mbedmicro-mbed-attributes OK 18.16 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-tests-mbedmicro-mbed-call_before_main OK 15.92 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-tests-mbedmicro-mbed-cpp OK 16.2 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-tests-mbedmicro-mbed-div OK 16.08 default
SFE_ARTEMIS_DK-ARMC6 SFE_ARTEMIS_DK mbed-os-tests-mbedmicro-mbed-static_assert OK 15.91 default

Reviewers


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Sep 3, 2020
@ciarmcom ciarmcom requested a review from a team September 3, 2020 05:00
@ciarmcom
Copy link
Member

ciarmcom commented Sep 3, 2020

@Wenn0101, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 3, 2020

@Wenn0101 Thank you for creating a new pull request. I'll review later today

@Wenn0101
Copy link
Contributor Author

Wenn0101 commented Sep 3, 2020

@0xc0170 I have noticed that on my latest branch I am unable to run tests with the GCC_ARM toolchain, but the ARMC6 toolchain works fine (OS: Windows 10, GCC: 9 2019-q4-major)
Is this a problem that exists outside of our target? or is this something i should be looking into?

Also, we had previously stated that we may need help with the serial tests failing. We stuggled with this quiet a bit before putting it aside. Now that I am more familiar with Mbed, I have taken another look and it looks like it might be a somewhat simple fix. I'll go through an clean up the serial driver tomorrow (I am located in the US, GMT-6), along with addressing comments you leave tonight (today for you).

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 3, 2020

@0xc0170 I have noticed that on my latest branch I am unable to run tests with the GCC_ARM toolchain

What's the error? I suspect this is only on this branch (tests are passing on other PRs)

0xc0170
0xc0170 previously requested changes Sep 3, 2020
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

Please review license headers in the new files

@@ -0,0 +1,73 @@
#include "AP3CordioHCIDriver.h"

This comment was marked as resolved.

#include "AP3CordioHCIDriver.h"
#include "AP3CordioHCITransportDriver.h"
#include "am_mcu_apollo.h"
#include "stdio.h"

This comment was marked as resolved.

@@ -0,0 +1,104 @@
//*****************************************************************************

This comment was marked as outdated.

"default_toolchain": "GCC_ARM",
"supported_toolchains": ["GCC_ARM", "ARMC6"],
"public": false,
"extra_labels": ["Ambiq_Micro", "Apollo3", "CORDIO"],
Copy link
Contributor

Choose a reason for hiding this comment

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

please follow the style (all these should be on a new line) - same as device_has is below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

{
MBED_ASSERT(false);
return NULL;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

files should have a new line at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

obj->i2c.iom_obj.iom.cfg.ui32NBTxnBufLength = 0;

// pin configuration
if((int)sda != NC){ pinmap_config(sda, i2c_master_sda_pinmap()); }
Copy link
Contributor

@0xc0170 0xc0170 Sep 3, 2020

Choose a reason for hiding this comment

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

Can you run astyle on these files in TARGET_Apollo3/device ? There is HAL implementation and it should follow Mbed OS coding style (using configuration .astylerc in Mbed OS root)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


uint8_t serial_tx_active(serial_t *obj) {
// todo:
MBED_ASSERT(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

if async is not supported, lets remove these functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 4, 2020

I forgot to comment to earlier questions:

Added armc6 support. No IAR support still. is this OK?

Yes, no IAR support currently, all good.

-troubleshoot 2 failed test cases

Serial issue as I read the logs above - HAL issue?

@Wenn0101
Copy link
Contributor Author

Wenn0101 commented Sep 4, 2020

Yes, the serial issues are the 2 failed test cases.

I have been looking into it. I have fixed 1 of the test cases which was a problem with the serial driver being re-initialized.

I am working through the problem with buffered serial. The problem is in the HAL. The approach we took with these drivers was to try to utilize as much of the publicly available ambiq hal as possible, it looks like some of these functions are enabling and disabling interrupts because we arent utilizing the buffering available in the HAL layer. I will keep you up to date when i have a new commit that fixes these issues.

Thanks for the feedback. I will work on addressing your feedback next.

@Wenn0101
Copy link
Contributor Author

Wenn0101 commented Sep 4, 2020

In regards to the tests when using the gcc toolchain

What's the error? I suspect this is only on this branch (tests are passing on other PRs)

Compile: C:\Program Files (x86)\GNU Tools ARM Embedded\9 2019-q4-major\bin\arm-none-eabi-g++ -c -std=gnu++14 -fno-rtti -Wvla -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -ffunction-sections -fdata-sections -funsigned-char -MMD -fomit-frame-pointer -Os -g -DMBED_TRAP_ERRORS_ENABLED=1 -DMBED_MINIMAL_PRINTF -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -D__MBED__=1 -DTARGET_LIKE_MBED -DTARGET_RTOS_M4_M7 -DDEVICE_MPU=1 -DTARGET_NAME=SFE_ARTEMIS_DK -DMBED_BUILD_TIMESTAMP=1599210979.53 -D__CMSIS_RTOS -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTOOLCHAIN_GCC -DTARGET_CORTEX_M -DTARGET_LIKE_CORTEX_M4 -DTARGET_M4 -DCOMPONENT_hm01b0=1 -DFEATURE_BLE=1 -DDEVICE_LPTICKER=1 -DCOMPONENT_FLASHIAP=1 -DTARGET_Apollo3 -DDEVICE_INTERRUPTIN=1 -DTARGET_CORTEX -DDEVICE_I2C=1 -D__CORTEX_M4 -DDEVICE_STDIO_MESSAGES=1 -D__FPU_PRESENT=1 -DTARGET_RELEASE -DTARGET_CORDIO -DUSE_AMBIQ_DRIVER -DDEVICE_USTICKER=1 -D__MBED_CMSIS_RTOS_CM -DTOOLCHAIN_GCC_ARM -DTARGET_FAMILY_Apollo3 -DTARGET_SFE_ARTEMIS_DK -DDEVICE_SPI=1 -DCOMPONENT_lis2dh12=1 -DDEVICE_SERIAL=1 -DAM_PACKAGE_BGA -DDEVICE_FLASH=1 -DARM_MATH_CM4 @.\BUILD\tests\SFE_ARTEMIS_DK\GCC_ARM\.\mbed-os\drivers\tests\TESTS\mbed_drivers\buffered_serial\.includes_5d92315c88c37b82df7ce763f735a3e0.txt -include .\BUILD\tests\SFE_ARTEMIS_DK\GCC_ARM\.\mbed-os\drivers\tests\TESTS\mbed_drivers\buffered_serial\mbed_config.h -MD -MF BUILD\tests\SFE_ARTEMIS_DK\GCC_ARM\mbed-os\drivers\tests\TESTS\mbed_drivers\buffered_serial\mbed-os\drivers\tests\TESTS\mbed_drivers\buffered_serial\main.d -o BUILD\tests\SFE_ARTEMIS_DK\GCC_ARM\mbed-os\drivers\tests\TESTS\mbed_drivers\buffered_serial\mbed-os\drivers\tests\TESTS\mbed_drivers\buffered_serial\main.o .\mbed-os\drivers\tests\TESTS\mbed_drivers\buffered_serial\main.cpp
        [DEBUG] Return: 1
        [DEBUG] Output: arm-none-eabi-g++: fatal error: cannot execute 'c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/as.exe': CreateProcess: No such file or directory
        [DEBUG] Output: compilation terminated.

To clarify, mbed tests are working fine with the newly added armc6 toolchain. The GCC toolchain tests were working before I updated my branch. I'll see what else i can dig up about this issue.

@Wenn0101
Copy link
Contributor Author

Wenn0101 commented Sep 7, 2020

@0xc0170
I have my fix for serial here, and I am working on additional changes for the PR here.

On my list of things do is:

  • run astyle (I haven't used this tool before, still figuring it out)
  • update headers with license info (just double checking with higher ups at SFE to make sure I'm doing things to their satisfaction)
  • GCC tests. Figure out why they stopped working, get them working.

Once I am done with these things I will merge my working branches into this feature branch and re-consolidate back into 1 commit.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 7, 2020

run astyle (I haven't used this tool before, still figuring it out)

it should be simple, install, run astyle with astyle -n --options=.astylerc <file>, .astylerc is in the mbed-os root.

@Wenn0101
Copy link
Contributor Author

Wenn0101 commented Sep 8, 2020

@0xc0170 Thanks for simplifying that for me. I ran astyle on everything in the targets\TARGET_Ambiq_Micro\TARGET_Apollo3\device directory. Aside from the license headers(which I will change once I get some feedback from my leadership), I think I have addressed all your comments in my working branches (sorry it is a bit convoluted they are on separate branches right now). Today was a holiday in the states, tomorrow I am going to focus on what happened to the tests when running the GCC_ARM toolchain and getting them up and running again, aside from that I am satisfied with this branch. Do you have additional feedback?

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 8, 2020

I'll review now again.

The license should be without any problems to new files (Mbed OS related files like this one connectivity/drivers/ble/FEATURE_BLE/TARGET_Ambiq_Micro/TARGET_Apollo3/AP3CordioHCIDriver.cpp - these files in this pull request do not contain any license. It should be easily fixed by adding proper license).
If it is 3rd party, like the driver coming from external sources (this is external driver, correct? connectivity/drivers/ble/FEATURE_BLE/TARGET_Ambiq_Micro/hal/apollo3/hci_drv_apollo3.h, that is another story. As these external files contain already license text, adding SPDX identifier should be approved without any issue).

This pull request should be ready for integration by Thursday to be included in the next release.

The current state of tests - only one test is failing, correct ?

@Wenn0101 Wenn0101 force-pushed the ambiq-apollo3-dev-squash branch from 9f27b6f to 68d59d3 Compare September 9, 2020 07:34
@mergify mergify bot dismissed 0xc0170’s stale review September 9, 2020 07:34

Pull request has been modified.

@Wenn0101
Copy link
Contributor Author

Wenn0101 commented Sep 9, 2020

@0xc0170
I have updated the branch with a new squashed commit rebased to the latest commit of master.
I added license headers (MIT) to the new driver files created by us, and added the appropriate SPDX identifier to the ambiq files that we used (BSD-3-Clause).
I looked into the GCC toolchain problems I was having and it seems like it may have just been a file/path length problem on the windows machine I am using. We ran the command on a unix based machine and it works just fine.
I believe I have answered all of your concerns that you listed above. If you have additional feedback let me know and I can address it today.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 9, 2020

@Wenn0101 Thank you very much, I am reviewing now

0xc0170
0xc0170 previously requested changes Sep 9, 2020
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

Couple of comments, the rest looks fine to me

#define PRINT_DEBUG_HCI 0

#if PRINT_DEBUG_HCI
#include "mbed.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

please include what is needed for printing, instead of mbed.h (this should be failing in CI check for mbed.h, I'll check why not).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed. probably wasn't caught because it is not compiled in by default.

//*****************************************************************************
//
// Copyright (c) 2019, Ambiq Micro
// All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

this should have SPDX as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

also SPDX here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, done.

/* Check if data + heap + stack exceeds RAM limit*/
/*ASSERT(1, "region RAM overflowed with stack")*/
/* test test test */
}
Copy link
Contributor

Choose a reason for hiding this comment

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

new line at the end of the file missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

"components": [
"FLASHIAP"
],
"macros": ["CORDIO_ZERO_COPY_HCI",
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be on the new line as the rest of the them follow so [ and `"CORDIO..." on the new line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

void pin_mode(PinName pin, PinMode mode)
{
MBED_ASSERT(0);
// gpio_t obj = {
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this commented out, shall we remove it?
what should pin mode do ? being empty? It might be then worth adding a comment why is this function empty

Copy link
Contributor Author

@Wenn0101 Wenn0101 Sep 9, 2020

Choose a reason for hiding this comment

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

Hey, I am trying to remember the full story here. If I remember right, a lot of targets try to use the function pinmap_pinout when initializing different drivers. This calls pin_function, and pin_mode. At first we tried to implement this way, but ended up ditching it to match closer with the ambiq hal functionality, which should do both of these things in a single function. I think we had problems with how the settings from these 2 functions interacted with eachother, and wanted the error checking and validation provided by the ambiq functions we ended up utilizing. We left the MBED_ASSERT(0) in this function so that we would know if our approach had caused any problems and left the dead code as a starting point should we turn back. I've removed the dead code and left a comment in its place explaining what is above.

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 didn't like this answer after providing it. I feel like we are required to provide this function even if we don't use it ourselves. I have created an implementation of this function and pushed it up.

// Get the new values into their rightful bit positions.
ui32Padreg <<= ui32PadShft;

AM_CRITICAL_BEGIN
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this do? We provide critical section enter/exit , should in this hal implementation be used instead or they are both equal and all fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

replaced with core_util_citical_section_enter(), and core_util_citical_section_exit(),

These other functions are in some of the hal files provided by ambiq and made its way here. These functions save a state of and mask PRIMASK, and then restore it. They must be locally paired (a BEGIN and RESTORE in the same function), and should work inside the provided nested critical section. For this reason we did not replace them inside functions we used, but we shouldn't propagate them outside of them. I replaced them with the provided functions here.


void pin_function(PinName pin, int function)
{
// am_hal_gpio_pincfg_t cfg = {0};
Copy link
Contributor

Choose a reason for hiding this comment

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

dead code? please remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 9, 2020

I started CI to get the results meanwhile

@mbed-ci
Copy link

mbed-ci commented Sep 9, 2020

Jenkins CI Test : ❌ FAILED

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-ARM
jenkins-ci/mbed-os-ci_build-GCC_ARM

@mergify mergify bot dismissed 0xc0170’s stale review September 9, 2020 21:49

Pull request has been modified.

@Wenn0101
Copy link
Contributor Author

Wenn0101 commented Sep 9, 2020

Addressed all comments. Jenkins build failed from a comma missing in one of the targets that i hadn't tests in a bit, sorry about that. Should be working now.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 10, 2020

CI restarted

@mbed-ci
Copy link

mbed-ci commented Sep 10, 2020

Jenkins CI Test : ✔️ SUCCESS

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-ARM ✔️
jenkins-ci/mbed-os-ci_build-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_dynamic-memory-usage ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️
jenkins-ci/mbed-os-ci_cloud-client-pytest ✔️

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 10, 2020

File: /targets/TARGET_Ambiq_Micro/TARGET_Apollo3/sdk/mcu/apollo3/hal/am_hal_cachectrl.h reason: Missing SPDX license identifier
File: /targets/TARGET_Ambiq_Micro/TARGET_Apollo3/sdk/mcu/apollo3/hal/am_hal_clkgen.c reason: Missing SPDX license identifier
File: /targets/TARGET_Ambiq_Micro/TARGET_Apollo3/sdk/mcu/apollo3/hal/am_hal_uart.c reason: Missing SPDX license identifier

There are still 3 offenders for SPDX, I can merge this one now and please fix it via new pull request these 3 files. I've just noticed the report.

@0xc0170 0xc0170 merged commit 267a5ac into ARMmbed:master Sep 10, 2020
@mergify mergify bot removed the ready for merge label Sep 10, 2020
@mbedmain mbedmain added release-version: 6.3.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Sep 14, 2020
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.

5 participants