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

USB fixes and improvements #5874

Merged
merged 3 commits into from Jan 26, 2018

Conversation

Projects
None yet
6 participants
@c1728p9
Contributor

c1728p9 commented Jan 17, 2018

  • Fix local static initialization in USB
  • Remove use of deprecated attach in USB
  • Fix clearing of ISTAT in Kinetis USB
@c1728p9

This comment has been minimized.

Contributor

c1728p9 commented Jan 17, 2018

CC @ashok-rao @Sissors

@c1728p9

This comment has been minimized.

Contributor

c1728p9 commented Jan 17, 2018

/morph build

@c1728p9

This comment has been minimized.

Contributor

c1728p9 commented Jan 17, 2018

@Sissors this doesn't fix the Kinetis USB issues discussed earlier. That will be in a separate PR. This is just general fixes and improvements.

@mbed-ci

This comment has been minimized.

mbed-ci commented Jan 17, 2018

Build : SUCCESS

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

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@@ -619,20 +621,27 @@ uint8_t * USBAudio::configurationDesc() {
// Terminator
0 // bLength
};
MBED_ASSERT(sizeof(configDescriptorTemp) == sizeof(deviceDescriptor));
memcpy(deviceDescriptor, configDescriptorTemp, sizeof(configDescriptor));

This comment has been minimized.

@c1728p9

c1728p9 Jan 17, 2018

Contributor

Wrong variable in memcpy

c1728p9 added some commits Dec 4, 2017

Fix local static initialization in USB
The local static initialization in USB was causing multiple problems:
-Configurable descriptor values are set only once
-USB descriptor initialization causes a trap in debug builds since
 this is acquiring a mutex in an interrupt handler
-Extra ram used since all descriptors  are in RAM

This patch fixes these problems by making fixed descriptors
static const so they are stored in flash and never need to be
initialized and by making descriptors that do change a member
of the class so they are always initialized when requested
rather than once though lazy static local initialization.
Remove use of deprecated attach in USB
Attach callbacks with the assignment operator rather than with the
deprecated attach function. This fixes deprecation warnings.

This patch also adds the ability to attach a Callback directly.
Fix clearing of ISTAT in Kinetis USB
The ISTAT register is write 1 to clear. Because of this ORing this
register with itself fill clear all bits that are set. This patch
updates the code to use plain assignment so only desired
bit is cleared.

@c1728p9 c1728p9 force-pushed the c1728p9:usb_fixes_and_improvements branch from fcd3f81 to beaac15 Jan 18, 2018

@c1728p9

This comment has been minimized.

Contributor

c1728p9 commented Jan 18, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Jan 18, 2018

Build : SUCCESS

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

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Jan 22, 2018

@c1728p9 Is this backward compatible changes? I would say it is not based on the diff here. Is this intentional?

@c1728p9

This comment has been minimized.

Contributor

c1728p9 commented Jan 22, 2018

@0xc0170 the intent was to be backwards compatible. What are you concerned with? The only place this may cause issues is with USB classes outside of mbed-os which override the descriptor functions (as the return value was changes to const). If this is the problem you are concerned with then I could remove that part of this PR.

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Jan 23, 2018

What are you concerned with? The only place this may cause issues is with USB classes outside of mbed-os which override the descriptor functions (as the return value was changes to const). If this is the problem you are concerned with then I could remove that part of this PR.

Yes, those changes I had on my mind as they are not binary compatible. Just concerned about breaking a user space. The rest looks good.

@cmonr cmonr merged commit fe87499 into ARMmbed:master Jan 26, 2018

19 checks passed

ARM mbed CI Verification build successful.
Details
AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Local events testing has passed
Details
travis-ci/littlefs Local littlefs testing has passed
Details
travis-ci/mbed2-ATMEL Local mbed2-ATMEL testing has passed
Details
travis-ci/mbed2-MAXIM Local mbed2-MAXIM testing has passed
Details
travis-ci/mbed2-NORDIC Local mbed2-NORDIC testing has passed
Details
travis-ci/mbed2-NUVOTON Local mbed2-NUVOTON testing has passed
Details
travis-ci/mbed2-NXP Local mbed2-NXP testing has passed
Details
travis-ci/mbed2-RENESAS Local mbed2-RENESAS testing has passed
Details
travis-ci/mbed2-SILICON_LABS Local mbed2-SILICON_LABS testing has passed
Details
travis-ci/mbed2-STM Local mbed2-STM testing has passed
Details
travis-ci/tools Local tools testing has passed
Details

@cmonr cmonr removed the ready for merge label Jan 26, 2018

@Sissors

This comment has been minimized.

Contributor

Sissors commented Jan 28, 2018

I tried to see if this solved my issues, however USBDevice lib is not linked to here apparently, and hasn't been updated in half a year (https://os.mbed.com/users/mbed_official/code/USBDevice/). It says it is legacy and refers to mbed-os, but as far as I can see mbed-os does not include USBDevice. Then again these days I don't understand mbed anymore anyway, so maybe just me.

@c1728p9

This comment has been minimized.

Contributor

c1728p9 commented Feb 1, 2018

@Sissors unfortunately, the changes are only in mbed-os right now. To try out the changes copy this directory from mbed-os:
https://github.com/ARMmbed/mbed-os/tree/master/features/unsupported/USBDevice

@Sissors

This comment has been minimized.

Contributor

Sissors commented Feb 1, 2018

Makes you wonder first why it is not synced to the USBDevice lib. But still. I got mbd-os imported in my project in the online compiler, and maybe I am missing something, but I can't find a USBDevice class, and the compiler also does not find it if I just include it.

Of course it could be setup in an offline compiler, but then I first needs to setup everything again.

Edit: Online compiler also cannot handle importing from sub-folders of a Github. I guess I'll try just importing all files via manual import, but still would be nice if USBDevice was actually get up to date.

@bmcdonnell-ionx

This comment has been minimized.

Contributor

bmcdonnell-ionx commented Aug 29, 2018

EDIT: moved to #7928.

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Aug 29, 2018

@bmcdonnell-ionx Thanks for the review, can you create a new issue please ? It improves the visibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment