-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
@Wenn0101, thank you for your changes. |
@Wenn0101 Thank you for creating a new pull request. I'll review later today |
@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) 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). |
What's the error? I suspect this is only on this branch (tests are passing on other PRs) |
There was a problem hiding this 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.
This comment was marked as resolved.
Sorry, something went wrong.
#include "AP3CordioHCIDriver.h" | ||
#include "AP3CordioHCITransportDriver.h" | ||
#include "am_mcu_apollo.h" | ||
#include "stdio.h" |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -0,0 +1,104 @@ | |||
//***************************************************************************** |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
targets/targets.json
Outdated
"default_toolchain": "GCC_ARM", | ||
"supported_toolchains": ["GCC_ARM", "ARMC6"], | ||
"public": false, | ||
"extra_labels": ["Ambiq_Micro", "Apollo3", "CORDIO"], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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()); } |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
I forgot to comment to earlier questions:
Yes, no IAR support currently, all good.
Serial issue as I read the logs above - HAL issue? |
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. |
In regards to the tests when using the gcc toolchain
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. |
@0xc0170 On my list of things do is:
Once I am done with these things I will merge my working branches into this feature branch and re-consolidate back into 1 commit. |
it should be simple, install, run astyle with |
@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? |
I'll review now again. The license should be without any problems to new files (Mbed OS related files like this one 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 ? |
9f27b6f
to
68d59d3
Compare
Pull request has been modified.
@0xc0170 |
@Wenn0101 Thank you very much, I am reviewing now |
There was a problem hiding this 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" |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also SPDX here
There was a problem hiding this comment.
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 */ | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
targets/targets.json
Outdated
"components": [ | ||
"FLASHIAP" | ||
], | ||
"macros": ["CORDIO_ZERO_COPY_HCI", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code? please remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
I started CI to get the results meanwhile |
Jenkins CI Test : ❌ FAILEDBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
…g spdx identifiers, fix style
Pull request has been modified.
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. |
CI restarted |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
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. |
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
Test results
Reviewers