[bsp][nxp] add cherryusb config for mcxa156 (#10041)

[bsp][nxp] add cherryusb config for mcxa156 and add ci.attachconfig
This commit is contained in:
hydevcode
2025-02-26 20:23:49 +08:00
committed by GitHub
parent 7086f4c809
commit 6d8d8884de
8 changed files with 323 additions and 5 deletions
@@ -0,0 +1,11 @@
scons.args: &scons
scons_arg:
- '--strict'
# ------ component CI ------
component.cherryusb_cdc:
kconfig:
- CONFIG_RT_USING_CHERRYUSB=y
- CONFIG_RT_CHERRYUSB_DEVICE=y
- CONFIG_RT_CHERRYUSB_DEVICE_KINETIS_MCX=y
- CONFIG_RT_CHERRYUSB_DEVICE_CDC_ACM=y
- CONFIG_RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM=y
@@ -17,4 +17,9 @@ CPPDEFINES = ['DEBUG', 'CPU_MCXA156VLL']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group')
@@ -0,0 +1,15 @@
from building import *
cwd = GetCurrentDir()
# add the general drivers.
src = Glob('*.c')
CPPPATH = [cwd]
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group')
@@ -0,0 +1,16 @@
from building import *
import os
cwd = GetCurrentDir()
group = []
src = Glob('*.c')
CPPPATH = [cwd]
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
group = group + SConscript(os.path.join(d, 'SConscript'))
group = group + DefineGroup('cherryusb-port', src, depend = ['RT_CHERRYUSB_DEVICE'], CPPPATH = CPPPATH)
Return('group')
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-01-17 Supperthomas first version
* 2025-02-25 hydevcode
*/
#include <rtthread.h>
#include <board.h>
#ifdef RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM
/* Register the EMAC device */
static int rt_hw_stm32_cherryusb_cdc_init(void)
{
extern void cdc_acm_init(uint8_t busid, uintptr_t reg_base);
cdc_acm_init(0, 0x400A4000u);
return 0;
}
INIT_COMPONENT_EXPORT(rt_hw_stm32_cherryusb_cdc_init);
#endif
File diff suppressed because it is too large Load Diff
@@ -10,7 +10,7 @@ Modify USB_NOCACHE_RAM_SECTION
#define USB_NOCACHE_RAM_SECTION __attribute__((section(".NonCacheable")))
```
- MCXC444/MCXA153 (device only)
- MCXC444/MCXA153/MCXA156 (device only)
- MCXN947
### MM32
@@ -32,6 +32,13 @@ void USB_ClockInit(void)
CLOCK_EnableClock(kCLOCK_Usb0Fs);
CLOCK_EnableUsbfsClock();
}
#elif defined(MCXA156_H_)
#define USBD_IRQ USB0_IRQHandler
void USB_ClockInit(void)
{
RESET_PeripheralReset(kUSB0_RST_SHIFT_RSTn);
CLOCK_EnableUsbfsClock();
}
#else
#error "Unsupported MCU with Kinetis IP"
#endif
@@ -49,15 +56,14 @@ void usb_dc_low_level_init(uint8_t busid)
uint8_t irqNumber;
uint8_t usbDeviceKhciIrq[] = USB_IRQS;
irqNumber = usbDeviceKhciIrq[0];
irqNumber = usbDeviceKhciIrq[0];
/* Install isr, set priority, and enable IRQ. */
NVIC_SetPriority((IRQn_Type)irqNumber, 3);
EnableIRQ((IRQn_Type)irqNumber);
USB_OTG_DEV->USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
while (USB_OTG_DEV->USBTRC0 & USB_USBTRC0_USBRESET_MASK)
;
while (USB_OTG_DEV->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
USB_OTG_DEV->USBTRC0 |= USB_USBTRC0_VREGIN_STS(1); /* software must set this bit to 1 */
USB_OTG_DEV->USBCTRL = 0;
@@ -67,7 +73,11 @@ void usb_dc_low_level_init(uint8_t busid)
void usb_dc_low_level_deinit(uint8_t busid)
{
USB_OTG_DEV->CONTROL &= ~USB_CONTROL_DPPULLUPNONOTG_MASK;
DisableIRQ((IRQn_Type)USB0_FS_IRQn);
#if defined(MCXN947_CM33_CORE0_H_)
DisableIRQ((IRQn_Type)USB0_FS_IRQn);
#else
DisableIRQ((IRQn_Type)USB0_IRQn);
#endif
}
void usbd_kinetis_delay_ms(uint8_t ms)