Skip to content

Fixed STM32 USB Device support for mbed Classic #4248

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 1 commit into from
May 5, 2017
Merged

Fixed STM32 USB Device support for mbed Classic #4248

merged 1 commit into from
May 5, 2017

Conversation

screamerbg
Copy link
Contributor

@screamerbg screamerbg commented Apr 28, 2017

Description

Fixed STM32 USB Device support for mbed 2 USB (backwards compatibility) by migrating all specific target headers to unsupported features where they belong until USB support is officially introduced in mbed OS 5

Status

READY

Migrations

NO

Note that without this PR the latest USB support for STM32 cannot be applied to the mbed Developer Site USBDevice library.

@adustm @bcostm @jeromecoutant @adbridge

CC @sg-

…rs to unsupported features where they belong until USB support is officially introduced in mbed OS 5
@screamerbg screamerbg changed the title Fixed STM32 USB Device support for mbed Classic USB by migrating all specific target heade… Fixed STM32 USB Device support for mbed Classic Apr 28, 2017
@screamerbg
Copy link
Contributor Author

screamerbg commented Apr 28, 2017

Steps to reproduce:

  1. Import USBMouse_HelloWorld https://developer.mbed.org/users/samux/code/USBMouse_HelloWorld/ (code dates back to 2013!)
  2. Remove USBDevice library
  3. Add/clone my fork at https://developer.mbed.org/users/screamer/code/USBDevice/ and switch to branch stm32-support, which is identical to mbed-os/features/unsupported/USBDevice
  4. Update mbed library
  5. Compile in the mbed Online IDE or mbed compile -t ARM -m NUCLEO_F429ZI
  6. Flash the board and then change USB connection from STLink to USB Device port
  7. Enjoy onscreen mouse circles!

@screamerbg
Copy link
Contributor Author

@adustm
Copy link
Member

adustm commented May 2, 2017

Hello @screamerbg
Could you explain more in details why

without this PR the latest USB support for STM32 cannot be applied to the mbed Developer Site USBDevice library
?

With your PR we must update the USB library each time we want to add USB support on a new platform. Our way of locating files was avoiding this dependency.

cc @jamike
Cheers
Armelle

@screamerbg
Copy link
Contributor Author

@adustm We are currently in a process of consolidating the differences of the USB Device on mbed.org and here in mbed-os on Github, after which we will start mirroring the mbed-os/unsupported/USBDevice to USBDevice on mbed.org and provide a way for regular updates of USBDevice.

Currently the STM32 USBDevice files are in mbed-os/targets/, which is not backwards compatible with the USBDevice library on mbed.org as it exists today, where all USBDevice support files live under mbed-os/features/unsupported/USBDevice, not under mbed-os/targets.

You may have also noticed that all USBDevice related PRs that were accepted in the past month are targeting mbed OS 5.0 (https://github.com/ARMmbed/mbed-os/pulls?utf8=%E2%9C%93&q=is%3Apr%20is%3Aclosed%20usb see release-version tag), which means the current STM32 USBDevice implementation/files won't be officially released before mbed OS 5.5 is out (and mbed library respectively).

Stitching all of the paragraphs above means that once we start the process of mirroring mbed-os/unsupported/USBDevice to mbed.org, and without this PR, then all ST platforms will end up with the current USBDevice support files under mbed-os/unsupported/USBDevice, but without the mbed-os/targets/ support files which will be landing in mbed OS 5 (see paragraph above), and therefore break the USBDevice support for STM32 targets.

Note that once USBDevice is officially introduced in mbed OS 5, then:

  • The USBDevice support files will be migrated back to the mbed-os/targets; and also
  • The USBDevice library on mbed.org will be deprecated as it will be natively provided as a feature of mbed-os.

@sg-

@sg-
Copy link
Contributor

sg- commented May 3, 2017

Couldn't have said it better myself! Thanks @screamerbg

@adustm
Copy link
Member

adustm commented May 4, 2017

Hello @screamerbg @sg-

If the mirroring is in place, then we don't mind having STM32 files inside the feature directory. You can go for this PR.
Thank you for the explanation Mihail.

Kind regards
Armelle

@screamerbg
Copy link
Contributor Author

@adustm Thanks!

@adbridge @0xc0170 can we get this in? There's another PR depending on this.

@adbridge
Copy link
Contributor

adbridge commented May 4, 2017

@screamerbg The only thing that's making me a bit nervous about this change is that we have significantly increased the path lengths for these files and whether that may cause issues with the compiler (specifically on windows...). Have you tried compiling a test app with these changes just to check ?

@adbridge
Copy link
Contributor

adbridge commented May 4, 2017

/morph test

@mbed-bot
Copy link

mbed-bot commented May 4, 2017

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 153

All builds and test passed!

@screamerbg
Copy link
Contributor Author

@adbridge Good point! Here is a snippet of all files in the tree sorted by length (longest are last):

mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32F4\TARGET_STM32F429xI\TARGET_DISCO_F429ZI\USBHALHost_DISCOF429ZI.h
mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32F4\TARGET_STM32F429xI\TARGET_NUCLEO_F429ZI\USBHALHost_STM_TARGET.h
mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32F4\TARGET_STM32F439xI\TARGET_NUCLEO_F439ZI\USBHALHost_STM_TARGET.h
mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32F4\TARGET_STM32F446xE\TARGET_NUCLEO_F446RE\USBHALHost_STM_TARGET.h
mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32F4\TARGET_STM32F446xE\TARGET_NUCLEO_F446ZE\USBHALHost_STM_TARGET.h
mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32F7\TARGET_STM32F746xG\TARGET_NUCLEO_F746ZG\USBHALHost_STM_TARGET.h
mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32F7\TARGET_STM32F756xG\TARGET_NUCLEO_F756ZG\USBHALHost_STM_TARGET.h
mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32F7\TARGET_STM32F767xI\TARGET_NUCLEO_F767ZI\USBHALHost_STM_TARGET.h
mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32L4\TARGET_STM32L476xG\TARGET_DISCO_L476VG\USBHALHost_DISCOL476VG.h
mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32L4\TARGET_STM32L476xG\TARGET_NUCLEO_L476RG\USBHALHost_STM_TARGET.h
mbed-os\features\unsupported\USBDevice\USBDevice\TARGET_STM\TARGET_STM32L4\TARGET_STM32L486xG\TARGET_NUCLEO_L486RG\USBHALHost_STM_TARGET.h
mbed-os\targets\TARGET_Silicon_Labs\TARGET_SL_RAIL\efr32-rf-driver\rail\TOOLCHAIN_GCC_ARM\TARGET_EFR32MG12\librail_efr32xg12_gcc_release.a
mbed-os\features\FEATURE_BLE\targets\TARGET_NORDIC\TARGET_MCU_NRF51822\sdk\source\softdevice\common\softdevice_handler\softdevice_handler.c
mbed-os\features\FEATURE_BLE\targets\TARGET_NORDIC\TARGET_MCU_NRF51822\sdk\source\softdevice\common\softdevice_handler\softdevice_handler.h
mbed-os\features\FEATURE_UVISOR\targets\TARGET_UVISOR_SUPPORTED\TARGET_EFM32\TARGET_RELEASE\TARGET_M3\libconfiguration_efm32_cortex_m3_p1.a
mbed-os\features\FEATURE_UVISOR\targets\TARGET_UVISOR_SUPPORTED\TARGET_EFM32\TARGET_RELEASE\TARGET_M4\libconfiguration_efm32_cortex_m4_p1.a
mbed-os\features\nanostack\FEATURE_NANOSTACK\coap-service\test\coap-service\unittest\coap_connection_handler\test_coap_connection_handler.c
mbed-os\features\nanostack\FEATURE_NANOSTACK\coap-service\test\coap-service\unittest\coap_connection_handler\test_coap_connection_handler.h
mbed-os\features\nanostack\FEATURE_NANOSTACK_FULL\TOOLCHAIN_GCC\TARGET_RTOS_M4_M7\libnanostack_arm-none-eabi-gcc_Cortex-M3_nanostack_full.a
mbed-os\features\nanostack\FEATURE_LOWPAN_BORDER_ROUTER\TOOLCHAIN_ARM\TARGET_RTOS_M4_M7\libnanostack_armcc_Cortex-M3_lowpan_border_router.ar
mbed-os\features\nanostack\FEATURE_LOWPAN_BORDER_ROUTER\TOOLCHAIN_IAR\TARGET_RTOS_M4_M7\libnanostack_iccarm_Cortex-M3_lowpan_border_router.a
mbed-os\features\nanostack\FEATURE_NANOSTACK\coap-service\test\coap-service\unittest\coap_connection_handler\coap_connection_handlertest.cpp
mbed-os\features\nanostack\FEATURE_THREAD_BORDER_ROUTER\TOOLCHAIN_ARM\TARGET_RTOS_M4_M7\libnanostack_armcc_Cortex-M3_thread_border_router.ar
mbed-os\features\nanostack\FEATURE_THREAD_BORDER_ROUTER\TOOLCHAIN_IAR\TARGET_RTOS_M4_M7\libnanostack_iccarm_Cortex-M3_thread_border_router.a
mbed-os\features\nanostack\FEATURE_ETHERNET_HOST\TOOLCHAIN_GCC\TARGET_LIKE_CORTEX_M0\libnanostack_arm-none-eabi-gcc_Cortex-M0_ethernet_host.a
mbed-os\features\nanostack\FEATURE_LOWPAN_ROUTER\TOOLCHAIN_GCC\TARGET_LIKE_CORTEX_M0\libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_router.a
mbed-os\features\nanostack\FEATURE_THREAD_ROUTER\TOOLCHAIN_GCC\TARGET_LIKE_CORTEX_M0\libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_router.a
mbed-os\features\nanostack\FEATURE_LOWPAN_BORDER_ROUTER\TOOLCHAIN_GCC\TARGET_M3\libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_border_router.a
mbed-os\features\nanostack\FEATURE_NANOSTACK_FULL\TOOLCHAIN_GCC\TARGET_LIKE_CORTEX_M0\libnanostack_arm-none-eabi-gcc_Cortex-M0_nanostack_full.a
mbed-os\features\nanostack\FEATURE_THREAD_BORDER_ROUTER\TOOLCHAIN_GCC\TARGET_M3\libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_border_router.a
mbed-os\features\FEATURE_BLE\targets\TARGET_NORDIC\TARGET_MCU_NRF51822\sdk\source\libraries\bootloader_dfu\hci_transport\hci_mem_pool_internal.h
mbed-os\features\FEATURE_BLE\targets\TARGET_NORDIC\TARGET_MCU_NRF51822\sdk\source\softdevice\common\softdevice_handler\ant_stack_handler_types.h
mbed-os\features\FEATURE_BLE\targets\TARGET_NORDIC\TARGET_MCU_NRF51822\sdk\source\softdevice\common\softdevice_handler\ble_stack_handler_types.h
mbed-os\features\nanostack\FEATURE_LOWPAN_BORDER_ROUTER\TOOLCHAIN_ARM\TARGET_LIKE_CORTEX_M0\libnanostack_armcc_Cortex-M0_lowpan_border_router.ar
mbed-os\features\nanostack\FEATURE_LOWPAN_BORDER_ROUTER\TOOLCHAIN_IAR\TARGET_LIKE_CORTEX_M0\libnanostack_iccarm_Cortex-M0_lowpan_border_router.a
mbed-os\features\nanostack\FEATURE_THREAD_BORDER_ROUTER\TOOLCHAIN_ARM\TARGET_LIKE_CORTEX_M0\libnanostack_armcc_Cortex-M0_thread_border_router.ar
mbed-os\features\nanostack\FEATURE_THREAD_BORDER_ROUTER\TOOLCHAIN_IAR\TARGET_LIKE_CORTEX_M0\libnanostack_iccarm_Cortex-M0_thread_border_router.a
mbed-os\targets\TARGET_Silicon_Labs\TARGET_SL_RAIL\efr32-rf-driver\rail\TOOLCHAIN_GCC_ARM\TARGET_EFR32MG1\ieee802154_efr32xg1_configurator_out.h
mbed-os\features\FEATURE_BLE\targets\TARGET_NORDIC\TARGET_MCU_NRF51822\sdk\source\softdevice\common\softdevice_handler\softdevice_handler_appsh.c
mbed-os\features\FEATURE_BLE\targets\TARGET_NORDIC\TARGET_MCU_NRF51822\sdk\source\softdevice\common\softdevice_handler\softdevice_handler_appsh.h
mbed-os\features\nanostack\FEATURE_THREAD_END_DEVICE\TOOLCHAIN_GCC\TARGET_RTOS_M4_M7\libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_end_device.a
mbed-os\targets\TARGET_Silicon_Labs\TARGET_SL_RAIL\efr32-rf-driver\rail\TOOLCHAIN_GCC_ARM\TARGET_EFR32MG12\ieee802154_efr32xg12_configurator_out.h
mbed-os\features\nanostack\FEATURE_THREAD_END_DEVICE\TOOLCHAIN_GCC\TARGET_LIKE_CORTEX_M0\libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_end_device.a
mbed-os\targets\TARGET_Silicon_Labs\TARGET_SL_RAIL\efr32-rf-driver\rail\TOOLCHAIN_GCC_ARM\TARGET_EFR32MG1\ieee802154_subg_efr32xg1_configurator_out.c
mbed-os\targets\TARGET_Silicon_Labs\TARGET_SL_RAIL\efr32-rf-driver\rail\TOOLCHAIN_GCC_ARM\TARGET_EFR32MG1\ieee802154_subg_efr32xg1_configurator_out.h
mbed-os\features\FEATURE_UVISOR\targets\TARGET_UVISOR_SUPPORTED\TARGET_MCU_K64F\TARGET_DEBUG\TARGET_M4\libconfiguration_kinetis_cortex_m4_0x1fff0000.a
mbed-os\features\FEATURE_UVISOR\targets\TARGET_UVISOR_SUPPORTED\TARGET_STM32F4\TARGET_DEBUG\TARGET_M4\libconfiguration_stm32_cortex_m4_0x10000000_0x0.a
mbed-os\features\nanostack\FEATURE_LOWPAN_BORDER_ROUTER\TOOLCHAIN_GCC\TARGET_RTOS_M4_M7\libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_border_router.a
mbed-os\features\nanostack\FEATURE_THREAD_BORDER_ROUTER\TOOLCHAIN_GCC\TARGET_RTOS_M4_M7\libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_border_router.a
mbed-os\features\FEATURE_UVISOR\targets\TARGET_UVISOR_SUPPORTED\TARGET_MCU_K64F\TARGET_RELEASE\TARGET_M4\libconfiguration_kinetis_cortex_m4_0x1fff0000.a
mbed-os\features\FEATURE_UVISOR\targets\TARGET_UVISOR_SUPPORTED\TARGET_STM32F4\TARGET_RELEASE\TARGET_M4\libconfiguration_stm32_cortex_m4_0x10000000_0x0.a
mbed-os\features\nanostack\FEATURE_LOWPAN_BORDER_ROUTER\TOOLCHAIN_GCC\TARGET_LIKE_CORTEX_M0\libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_border_router.a
mbed-os\features\nanostack\FEATURE_THREAD_BORDER_ROUTER\TOOLCHAIN_GCC\TARGET_LIKE_CORTEX_M0\libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_border_router.a
mbed-os\features\FEATURE_UVISOR\targets\TARGET_UVISOR_SUPPORTED\TARGET_ARM_BEETLE_SOC\TARGET_DEBUG\TARGET_M3\libconfiguration_beetle_cortex_m3_0x20000000_0x140.a
mbed-os\features\FEATURE_UVISOR\targets\TARGET_UVISOR_SUPPORTED\TARGET_ARM_BEETLE_SOC\TARGET_RELEASE\TARGET_M3\libconfiguration_beetle_cortex_m3_0x20000000_0x140.a

In other words, there are files with longer filepath under UVISOR and nanostack

@adbridge
Copy link
Contributor

adbridge commented May 5, 2017

@screamerbg Thanks for checking , ok LGTM

@adbridge adbridge self-requested a review May 5, 2017 12:49
@adustm
Copy link
Member

adustm commented May 5, 2017

@adbridge someone at ARM should take the action of reducing directory names. It's been several times that we are mentioning the issue. Don't you agree (with the idea or with the fact that it should be done by Arm people or anything else.... ?) ?

@sg-
Copy link
Contributor

sg- commented May 5, 2017

@adbridge someone at ARM should take the action of reducing directory names. It's been several times that we are mentioning the issue. Don't you agree (with the idea or with the fact that it should be done by Arm people or anything else.... ?) ?

This is an option but its very disruptive for ongoing work. I'd suggest its done just before a release branch is created.

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.

6 participants