Skip to content

EFR32FG support #5271

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 2 commits into from
Closed

Conversation

ryankurte
Copy link
Contributor

@ryankurte ryankurte commented Oct 8, 2017

Description

MBed OS support for the EFR32FG chip family, based on existing EFR32MG support.

Status

READY

Related PRs

This PR depends on #5270 fix to Nanostack Efr32 driver.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 9, 2017

@ryankurte Can you please clean-up the history (lot of merge commits there, also commits that should not be mainlined) ?

cc @stevew817 @akselsm

@ryankurte ryankurte force-pushed the feature/efm32fg-support branch 3 times, most recently from df52436 to b818d9d Compare October 9, 2017 11:23
@ryankurte
Copy link
Contributor Author

Better? Only just discovered the magic of git rebase -i master ^_^

@mbed-ci
Copy link

mbed-ci commented Oct 10, 2017

Build : SUCCESS

Build number : 33
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5271/

Triggering tests

/test mbed-os

@mbed-ci
Copy link

mbed-ci commented Oct 10, 2017

@mbed-ci
Copy link

mbed-ci commented Oct 10, 2017

@mbed-ci
Copy link

mbed-ci commented Oct 10, 2017

Build : FAILURE

Build number : 57
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5271/

@@ -243,6 +243,7 @@ osMutexAttr_t singleton_mutex_attr;
#define HEAP_START ((unsigned char*)__end__)
#define HEAP_SIZE ((uint32_t)((uint32_t)INITIAL_SP - (uint32_t)HEAP_START))
#endif
#else
Copy link
Contributor

Choose a reason for hiding this comment

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

@0xc0170 This seems to be out of place?


MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1024k
Copy link
Contributor

Choose a reason for hiding this comment

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

EFR32FG1 has 256k of flash and 32k of ram...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, didn't notice the switch between the PG1B and PG12B.

"public": false,
"bootloader_supported": true
},
"EFR32FG12_SLWRB4254A": {
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 called EFR32FG12_BRD4254A to keep in line with the naming scheme. The OPN for the standalone radio board is SLWRB*, but the board's part number is BRD*, which is what we are using here on mbed.

@@ -30,6 +30,10 @@
"EFR32MG1_BRD4150": {
"sl-rail.has-2p4": true,
"sl-rail.has-subgig": true
},
"EFR32FG12_SLWRB4254A": {
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 called EFR32FG12_BRD4254A

@@ -30,6 +30,10 @@
"EFR32MG1_BRD4150": {
"sl-rail.has-2p4": true,
"sl-rail.has-subgig": true
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need to add EFR32FG1_BRD4250B as well?

@stevew817
Copy link
Contributor

I'm assuming you copied the device header files from your SDK install in Simplicity Studio?

@ryankurte
Copy link
Contributor Author

Yep, headers are all copied from the SDK version 5.1.3 from Simplicity Studio.

@mbed-ci
Copy link

mbed-ci commented Oct 11, 2017

Build : SUCCESS

Build number : 134
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5271/

Triggering tests

/test mbed-os

@mbed-ci
Copy link

mbed-ci commented Oct 11, 2017

Build : SUCCESS

Build number : 136
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5271/

Triggering tests

/test mbed-os

@mbed-ci
Copy link

mbed-ci commented Oct 11, 2017

Build : SUCCESS

Build number : 138
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5271/

Triggering tests

/test mbed-os

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 19, 2017

@ryankurte What is the status of this PR after the update?

@ryankurte
Copy link
Contributor Author

ryankurte commented Oct 20, 2017

Made the fixes proposed by @stevew817, so provided they're happy I think it's good to go?

Tested running mbed client stack all ok, though I am having some wacky issues with mbed-trace and haven't got an EFR32MG to test whether it's broken on both.

@theotherjimmy
Copy link
Contributor

/test mbed-os

@theotherjimmy
Copy link
Contributor

@stevew817 Could you take another look?

Copy link
Contributor

@stevew817 stevew817 left a comment

Choose a reason for hiding this comment

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

LGTM!

@adbridge
Copy link
Contributor

/morph test

@mbed-ci
Copy link

mbed-ci commented Nov 29, 2017

Automatic CI verification build not done, please verify manually.

Cleaned up changes to mbed_boot.c

Rename SLWRB4254A -> BRD4254A
@ryankurte ryankurte force-pushed the feature/efm32fg-support branch from c15ee12 to 8d145e4 Compare December 20, 2017 23:53
Cleaned up changes to mbed_boot.c

Rename SLWRB4254A -> BRD4254A

Fixed (Removed) INITIAL_SP override in target.json

Reordered target definitions

Fix INITIAL_SP override

Removed incorrect radio configs
@ryankurte ryankurte force-pushed the feature/efm32fg-support branch from 8d145e4 to d74d7af Compare December 21, 2017 00:01
@@ -2951,7 +2951,7 @@
},
"EFR32MG12P332F1024GL125": {
"inherits": ["EFM32"],
"extra_labels_add": ["EFR32MG12", "EFR32_12", "1024K", "SL_RAIL", "SL_CRYPTO"],
"extra_labels_add": ["EFR32_12", "EFR32MG12", "EFR32_12", "1024K", "SL_RAIL", "SL_CRYPTO"],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added EFR32_12 and EFR32_1 labels missing from PR #5579

@ryankurte
Copy link
Contributor Author

@0xc0170 @stevew817 updated against #5579 with new RAIL. This PR now /only/ introduces the device and board support for the FG device family.

Note that PR #5742 (parameter error) and issue #5735 (missing configs) will need to be resolved for correct radio operation.

@adbridge
Copy link
Contributor

@ryankurte Does this now support all 3 compile chains?

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 8, 2018

I'm going to mark this as 'changes requested', pending the merge of #5579.

It was integrated, this is ow ready for review?

@cmonr
Copy link
Contributor

cmonr commented Jan 12, 2018

@stevew817 ^^^

@ryankurte
Copy link
Contributor Author

AFAIK the new RAIL should work with all platforms (@stevew817). I don't know what executes those tests, or where from, or have the other toolchains to personally test with.

I need to refactor out the library duplication I seem to have caused (see #5735), but the the RAIL cross platform issue applies to all targets with RAIL, not just this one, and could become a separate issue along with the fixes in #5742?

Also as a related aside, would y'all be open to a PR of some intrinsically safe single producer/consumer queues and memory pools? Because it seems critical for driver development, and we seem to keep having to implement them because the OS ones don't work in an interrupt context.

@theotherjimmy
Copy link
Contributor

@ryankurte

would y'all be open to a PR of some intrinsically safe single producer/consumer queues and memory pools?

Yes, I think so. @geky @c1728p9

@cmonr
Copy link
Contributor

cmonr commented Feb 5, 2018

@ryankurte @stevew817 is this PR still dependent on #5735 and #5742 ?

@geky
Copy link
Contributor

geky commented Feb 5, 2018

would y'all be open to a PR of some intrinsically safe single producer/consumer queues and memory pools?

Oh, I thought the rtos was irq safe where useful. For example you can put/get to queues in irq:
https://github.com/ARMmbed/mbed-os/blob/master/rtos/Queue.h#L107
https://github.com/ARMmbed/mbed-os/blob/master/rtos/Queue.h#L122

Which parts fall apart in irq context?

Does the event queue work in this case? It's irq safe and rtos agnostic:
C++ api: https://github.com/ARMmbed/mbed-os/tree/master/events
C api: https://github.com/ARMmbed/mbed-os/tree/master/events/equeue

I'd be curious to know what we're missing for irq context, in which case new prs are always welcome.

@ryankurte
Copy link
Contributor Author

@geky the main problem with the queue is that you can't allocate memory or use a memory pool (because of the stats events) from the ISR. So while you can enqueue things, you can't make anything to enqueue without a custom memory pool anyway.

@cmonr depending on the result of #5735 I may no longer be able to work on this. It's only an interdependence in that the both need to be fixed, either way (without changes, or with either set of changes) the current state is broken ¯\(ツ)

@geky
Copy link
Contributor

geky commented Feb 6, 2018

I believe the alloc and dealloc are irq safe:
https://github.com/ARMmbed/mbed-os/blob/master/rtos/Mail.h#L84-L92

What do you mean by stats events?

@ryankurte
Copy link
Contributor Author

ryankurte commented Feb 6, 2018

The memory pool by default causes RTX events that as best I can tell are for collection of pool statistics, which afaik require a syscall and results in an error in rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_evr.c#L1633. I might be wrong / it might be something else, but this is where I got by stepping out of error with the debugger.

It's stated here that malloc is not officially thread safe (and there's a bunch more discussion around the pool etc.). Unfortunately I didn't document the failure, but as far as I remember malloc uses a global mutex, and mutexes don't work in ISRs for the same reason.

@geky
Copy link
Contributor

geky commented Feb 6, 2018

Ah, if it is that specific line that is failing, that's actually due to creating the Mail object in irq, different from allocating from the Mail object. Allocating from the Mail object should end up here, though I'm not sure what goes on in the event recorder calls. If EvtRtxMemoryPoolAlloc results in a memory allocation or mutex, that's definitely a bug on our side.

@ryankurte
Copy link
Contributor Author

Yeah it ends up at the line you mentioned, I meant to point out that it does a whole lot of "event recording" in a whole lot of cases which is not good (tm) from an ISR.

In summary:

  1. memory pools don't like ISRs because they use events for collecting stats (which can be turned off from the look of it, but whaat)
  2. malloc isn't really ISR safe (and realloc is bad practice in predictable embedded firmware anyway)
  3. Mail etc. fail poorly because they're constructed from 1
  4. All of this is completely insane to debug because the error() trap is in the os thread which means you have no easy access to context for what actually caused the problem

That said, it is all more related to the #5742 stuff RAIL than this.

@cmonr
Copy link
Contributor

cmonr commented Feb 12, 2018

@ryankurte Are you still working on this PR?

@cmonr
Copy link
Contributor

cmonr commented Feb 27, 2018

Closing due to inactivity. @ryankurte feel free to reopen if this is a mistake or further activity is still planned or in progress.

@cmonr cmonr closed this Feb 27, 2018
@cmonr cmonr removed the needs: work label Feb 27, 2018
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.

8 participants