From 5e004863ef3838ebcf55ab71921f45195c54a219 Mon Sep 17 00:00:00 2001 From: Peter van der Perk Date: Sun, 2 Jun 2024 11:22:17 +0200 Subject: [PATCH] Tropic: revC update Also various fixes in flash and configuration --- boards/nxp/tropic/default.px4board | 16 +- boards/nxp/tropic/init/rc.board_defaults | 5 +- boards/nxp/tropic/init/rc.board_sensors | 30 ++- .../nxp/tropic/nuttx-config/include/board.h | 14 +- boards/nxp/tropic/nuttx-config/nsh/defconfig | 10 +- .../scripts/itcm_functions_includes.ld | 119 --------- .../scripts/itcm_static_functions.ld | 119 +++++++++ .../nxp/tropic/nuttx-config/scripts/script.ld | 1 + .../nxp/tropic/src/imxrt_flexspi_nor_boot.c | 34 ++- .../nxp/tropic/src/imxrt_flexspi_nor_boot.h | 52 ++-- .../nxp/tropic/src/imxrt_flexspi_nor_flash.c | 147 ++++------- .../nxp/tropic/src/imxrt_flexspi_nor_flash.h | 242 +++++++++--------- boards/nxp/tropic/src/init.c | 51 ++-- boards/nxp/tropic/src/usb.c | 2 +- 14 files changed, 409 insertions(+), 433 deletions(-) create mode 100644 boards/nxp/tropic/nuttx-config/scripts/itcm_static_functions.ld diff --git a/boards/nxp/tropic/default.px4board b/boards/nxp/tropic/default.px4board index 4262ca34cb69..49b3d65a0d59 100644 --- a/boards/nxp/tropic/default.px4board +++ b/boards/nxp/tropic/default.px4board @@ -5,16 +5,22 @@ CONFIG_BOARD_SERIAL_GPS1="/dev/ttyS1" CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS2" CONFIG_BOARD_SERIAL_TEL2="/dev/ttyS3" CONFIG_DRIVERS_ADC_BOARD_ADC=y -CONFIG_DRIVERS_BAROMETER_DPS310=y +CONFIG_DRIVERS_BAROMETER_BMP388=y +CONFIG_DRIVERS_BAROMETER_INVENSENSE_ICP201XX=y +CONFIG_DRIVERS_BAROMETER_MS5611=y CONFIG_DRIVERS_CAMERA_CAPTURE=y CONFIG_DRIVERS_CAMERA_TRIGGER=y -CONFIG_DRIVERS_DISTANCE_SENSOR_LIGHTWARE_LASER_I2C=y +CONFIG_DRIVERS_CDCACM_AUTOSTART=y +CONFIG_COMMON_DIFFERENTIAL_PRESSURE=y +CONFIG_COMMON_DISTANCE_SENSOR=y CONFIG_DRIVERS_DSHOT=y CONFIG_DRIVERS_GPS=y CONFIG_DRIVERS_IMU_BOSCH_BMI088=y CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y +CONFIG_COMMON_INS=y CONFIG_COMMON_LIGHT=y +CONFIG_DRIVERS_LIGHTS_RGBLED_PWM=y CONFIG_COMMON_MAGNETOMETER=y CONFIG_DRIVERS_OSD_MSP_OSD=y CONFIG_DRIVERS_POWER_MONITOR_INA226=y @@ -27,12 +33,15 @@ CONFIG_COMMON_TELEMETRY=y CONFIG_DRIVERS_TONE_ALARM=y CONFIG_DRIVERS_UAVCAN=y CONFIG_BOARD_UAVCAN_INTERFACES=1 +CONFIG_COMMON_UWB=y +CONFIG_MODULES_AIRSPEED_SELECTOR=y CONFIG_MODULES_BATTERY_STATUS=y CONFIG_MODULES_CAMERA_FEEDBACK=y CONFIG_MODULES_COMMANDER=y CONFIG_MODULES_CONTROL_ALLOCATOR=y CONFIG_MODULES_DATAMAN=y CONFIG_MODULES_EKF2=y +CONFIG_MODULES_ESC_BATTERY=y CONFIG_MODULES_EVENTS=y CONFIG_MODULES_FLIGHT_MODE_MANAGER=y CONFIG_MODULES_FW_ATT_CONTROL=y @@ -61,10 +70,13 @@ CONFIG_MODULES_RC_UPDATE=y CONFIG_MODULES_ROVER_POS_CONTROL=y CONFIG_MODULES_SENSORS=y CONFIG_MODULES_TEMPERATURE_COMPENSATION=y +CONFIG_MODULES_UXRCE_DDS_CLIENT=y +CONFIG_MODULES_VTOL_ATT_CONTROL=y CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y CONFIG_SYSTEMCMDS_BSONDUMP=y CONFIG_SYSTEMCMDS_DMESG=y CONFIG_SYSTEMCMDS_DUMPFILE=y +CONFIG_SYSTEMCMDS_I2C_LAUNCHER=y CONFIG_SYSTEMCMDS_I2CDETECT=y CONFIG_SYSTEMCMDS_LED_CONTROL=y CONFIG_SYSTEMCMDS_MFT=y diff --git a/boards/nxp/tropic/init/rc.board_defaults b/boards/nxp/tropic/init/rc.board_defaults index c87952922cc3..8a49eca594a9 100644 --- a/boards/nxp/tropic/init/rc.board_defaults +++ b/boards/nxp/tropic/init/rc.board_defaults @@ -16,8 +16,8 @@ param set-default SENS_EN_INA238 0 param set-default SENS_EN_INA228 0 param set-default SENS_EN_INA226 0 -param set-default BAT1_V_DIV 10.177939394 -param set-default BAT1_A_PER_V 15.391030303 +param set-default BAT1_V_DIV 18.000000000 +param set-default BAT1_A_PER_V 38.462030303 if [ -f "/fs/microsd/ipcfg-eth0" ] then @@ -25,6 +25,7 @@ else netman update -i eth0 fi +rgbled_pwm start safety_button start if param greater -s UAVCAN_ENABLE 0 diff --git a/boards/nxp/tropic/init/rc.board_sensors b/boards/nxp/tropic/init/rc.board_sensors index 74388e03d140..88cf1adb4119 100644 --- a/boards/nxp/tropic/init/rc.board_sensors +++ b/boards/nxp/tropic/init/rc.board_sensors @@ -1,21 +1,20 @@ #!/bin/sh # -# PX4 FMUv5 specific board sensors init +# PX4 board sensors init #------------------------------------------------------------------------------ # -# UART mapping on PX4 FMU-V6XRT: +# UART mapping on Tropic: # -# LPUART1 /dev/ttyS0 CONSOLE +# LPUART5 /dev/ttyS0 CONSOLE # LPUART3 /dev/ttyS1 GPS -# LPUART4 /dev/ttyS2 TELEM1 -# LPUART5 /dev/ttyS4 GPS2 -# LPUART6 /dev/ttyS5 PX4IO -# LPUART8 /dev/ttyS6 TELEM2 -# LPUART10 /dev/ttyS7 TELEM3 -# LPUART11 /dev/ttyS8 EXT2 +# LPUART2 /dev/ttyS2 TELEM1 +# LPUART4 /dev/ttyS3 TELEM2 +# LPUART8 /dev/ttyS4 RC # #------------------------------------------------------------------------------ +set INA_CONFIGURED no + if param compare -s ADC_ADS1115_EN 1 then ads1115 start -X @@ -28,18 +27,27 @@ if param compare SENS_EN_INA226 1 then # Start Digital power monitors ina226 -X -b 1 -t 1 -k start + set INA_CONFIGURED yes fi if param compare SENS_EN_INA228 1 then # Start Digital power monitors ina228 -X -b 1 -t 1 -k start + set INA_CONFIGURED yes fi if param compare SENS_EN_INA238 1 then # Start Digital power monitors ina238 -X -b 1 -t 1 -k start + set INA_CONFIGURED yes +fi + +if [ $INA_CONFIGURED = no ] +then + # INA226, INA228, INA238 auto-start + i2c_launcher start -b 1 fi # Internal SPI bus ICM42688p @@ -60,5 +68,7 @@ ist8310 -X -b 1 -R 10 start # Disable startup of internal baros if param is set to false if param compare SENS_INT_BARO_EN 1 then - dps310 -I -b 4 start + bmp388 -I -b 4 start fi + +unset INA_CONFIGURED diff --git a/boards/nxp/tropic/nuttx-config/include/board.h b/boards/nxp/tropic/nuttx-config/include/board.h index f51ae1a96f16..40cc6cca5619 100644 --- a/boards/nxp/tropic/nuttx-config/include/board.h +++ b/boards/nxp/tropic/nuttx-config/include/board.h @@ -188,7 +188,7 @@ */ #define GPIO_ENET_INT (IOMUX_ENET_INT_DEFAULT | \ - GPIO_PORT2 | GPIO_PIN15) /* B0_15 */ + GPIO_PORT2 | GPIO_PIN15) /* B0_15 */ #define GPIO_ENET_IRQ IMXRT_IRQ_GPIO2_15 /* Ethernet Reset: GPIO_B0_14 @@ -198,22 +198,22 @@ */ #define GPIO_ENET_RST (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | \ - GPIO_PORT2 | GPIO_PIN14 | IOMUX_ENET_RST_DEFAULT) /* B0_14 */ + GPIO_PORT2 | GPIO_PIN14 | IOMUX_ENET_RST_DEFAULT) /* B0_14 */ #define GPIO_ENET_TX_DATA00 (GPIO_ENET_TX_DATA00_1| \ - IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_07 */ + IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_07 */ #define GPIO_ENET_TX_DATA01 (GPIO_ENET_TX_DATA01_1| \ - IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_08 */ + IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_08 */ #define GPIO_ENET_RX_DATA00 (GPIO_ENET_RX_DATA00_1| \ - IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_04 */ + IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_04 */ #define GPIO_ENET_RX_DATA01 (GPIO_ENET_RX_DATA01_1| \ - IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_05 */ + IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_05 */ #define GPIO_ENET_MDIO (GPIO_ENET_MDIO_1|IOMUX_ENET_MDIO_DEFAULT) /* GPIO_B1_15 */ #define GPIO_ENET_MDC (GPIO_ENET_MDC_1|IOMUX_ENET_MDC_DEFAULT) /* GPIO_B1_14 */ #define GPIO_ENET_RX_EN (GPIO_ENET_RX_EN_1|IOMUX_ENET_EN_DEFAULT) /* GPIO_B1_06 */ #define GPIO_ENET_RX_ER (GPIO_ENET_RX_ER_1|IOMUX_ENET_RXERR_DEFAULT) /* GPIO_B1_11 */ #define GPIO_ENET_TX_CLK (GPIO_ENET_REF_CLK_2|\ - IOMUX_ENET_TX_CLK_DEFAULT) /* GPIO_B1_10 */ + IOMUX_ENET_TX_CLK_DEFAULT) /* GPIO_B1_10 */ #define GPIO_ENET_TX_EN (GPIO_ENET_TX_EN_1|IOMUX_ENET_EN_DEFAULT) /* GPIO_B1_09 */ /* LED definitions ******************************************************************/ diff --git a/boards/nxp/tropic/nuttx-config/nsh/defconfig b/boards/nxp/tropic/nuttx-config/nsh/defconfig index a88cc4996fa4..fd4cb78909dc 100644 --- a/boards/nxp/tropic/nuttx-config/nsh/defconfig +++ b/boards/nxp/tropic/nuttx-config/nsh/defconfig @@ -27,6 +27,7 @@ CONFIG_ARMV7M_ITCM=y CONFIG_ARMV7M_MEMCPY=y CONFIG_ARMV7M_USEBASEPRI=y CONFIG_ARM_MPU=y +CONFIG_ARM_MPU_RESET=y CONFIG_BOARDCTL_RESET=y CONFIG_BOARD_ASSERT_RESET_VALUE=0 CONFIG_BOARD_LOOPSPERMSEC=114325 @@ -40,7 +41,10 @@ CONFIG_CDCACM_RXBUFSIZE=600 CONFIG_CDCACM_TXBUFSIZE=12000 CONFIG_CDCACM_VENDORID=0x3643 CONFIG_CDCACM_VENDORSTR="Dronecode Project, Inc." +CONFIG_DEBUG_ERROR=y +CONFIG_DEBUG_FEATURES=y CONFIG_DEBUG_HARDFAULT_ALERT=y +CONFIG_DEBUG_MEMFAULT=y CONFIG_DEBUG_SYMBOLS=y CONFIG_DEBUG_TCBINFO=y CONFIG_DEV_FIFO_SIZE=0 @@ -131,7 +135,6 @@ CONFIG_LPUART5_SERIAL_CONSOLE=y CONFIG_MEMSET_64BIT=y CONFIG_MEMSET_OPTSPEED=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD=y CONFIG_MTD_BYTE_WRITE=y @@ -163,9 +166,7 @@ CONFIG_NET_CAN_SOCK_OPTS=y CONFIG_NET_ETH_PKTSIZE=1518 CONFIG_NET_ICMP=y CONFIG_NET_ICMP_SOCKET=y -CONFIG_NET_NACTIVESOCKETS=20 CONFIG_NET_SOLINGER=y -CONFIG_NET_STATISTICS=y CONFIG_NET_TCP=y CONFIG_NET_TCPBACKLOG=y CONFIG_NET_TCP_DELAYED_ACK=y @@ -204,7 +205,7 @@ CONFIG_SCHED_INSTRUMENTATION_EXTERNAL=y CONFIG_SCHED_INSTRUMENTATION_SWITCH=y CONFIG_SCHED_LPWORK=y CONFIG_SCHED_LPWORKPRIORITY=50 -CONFIG_SCHED_LPWORKSTACKSIZE=1632 +CONFIG_SCHED_LPWORKSTACKSIZE=2032 CONFIG_SCHED_WAITPID=y CONFIG_SDIO_BLOCKSETUP=y CONFIG_SEM_PREALLOCHOLDERS=32 @@ -225,6 +226,7 @@ CONFIG_SYSTEM_CLE=y CONFIG_SYSTEM_DHCPC_RENEW=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_SYSTEM=y CONFIG_TASK_NAME_SIZE=24 CONFIG_USBDEV=y CONFIG_USBDEV_BUSPOWERED=y diff --git a/boards/nxp/tropic/nuttx-config/scripts/itcm_functions_includes.ld b/boards/nxp/tropic/nuttx-config/scripts/itcm_functions_includes.ld index d5c804a72bd6..60a76f97e1b9 100644 --- a/boards/nxp/tropic/nuttx-config/scripts/itcm_functions_includes.ld +++ b/boards/nxp/tropic/nuttx-config/scripts/itcm_functions_includes.ld @@ -1,112 +1,3 @@ -/* Static */ -*(.text.arm_ack_irq) -*(.text.arm_doirq) -*(.text.arm_svcall) -*(.text.arm_switchcontext) -*(.text.board_autoled_on) -*(.text.clock_timer) -*(.text.exception_common) -*(.text.hrt_absolute_time) -*(.text.hrt_tim_isr) -*(.text.imxrt_configwaitints) -*(.text.imxrt_dma_callback) -*(.text.imxrt_dmach_interrupt) -*(.text.imxrt_dmaterminate) -*(.text.imxrt_edma_interrupt) -*(.text.imxrt_endwait) -*(.text.imxrt_gpio3_16_31_interrupt) -*(.text.imxrt_interrupt) -*(.text.imxrt_lpi2c_isr) -*(.text.imxrt_recvdma) -*(.text.imxrt_tcd_free) -*(.text.imxrt_timerisr) -*(.text.imxrt_usbinterrupt) -*(.text.irq_dispatch) -*(.text.memcpy) -*(.text.nxsched_add_blocked) -*(.text.nxsched_add_prioritized) -*(.text.nxsched_add_readytorun) -*(.text.nxsched_get_files) -*(.text.nxsched_get_tcb) -*(.text.nxsched_merge_pending) -*(.text.nxsched_process_timer) -*(.text.nxsched_remove_blocked) -*(.text.nxsched_remove_readytorun) -*(.text.nxsched_resume_scheduler) -*(.text.nxsched_suspend_scheduler) -*(.text.nxsem_add_holder) -*(.text.nxsem_add_holder_tcb) -*(.text.nxsem_clockwait) -*(.text.nxsem_foreachholder) -*(.text.nxsem_freecount0holder) -*(.text.nxsem_freeholder) -*(.text.nxsem_post) -*(.text.nxsem_release_holder) -*(.text.nxsem_restore_baseprio) -*(.text.nxsem_tickwait) -*(.text.nxsem_timeout) -*(.text.nxsem_trywait) -*(.text.nxsem_wait) -*(.text.nxsem_wait_uninterruptible) -*(.text.nxsig_timedwait) -*(.text.sched_lock) -*(.text.sched_note_resume) -*(.text.sched_note_suspend) -*(.text.sched_unlock) -*(.text.sq_addafter) -*(.text.sq_addlast) -*(.text.sq_rem) -*(.text.sq_remafter) -*(.text.sq_remfirst) -*(.text.uart_connected) -*(.text.wd_timer) -/* Tropic tune */ -*(.text.imxrt_enet_interrupt) -*(.text.imxrt_enet_interrupt_work) -*(.text.imxrt_txdone) -*(.text.imxrt_txtimeout_work) -*(.text.imxrt_txtimeout_expiry) -*(.text.imxrt_txavail_work) -*(.text.imxrt_txavail) -*(.text.devif_poll) -*(.text.devif_poll_tcp_connections) -*(.text.tcp_poll) -*(.text.devif_poll_udp_connections) -*(.text.udp_nextconn) -*(.text.udp_poll) -*(.text.udp_ipv4_select) -*(.text.udp_callback) -*(.text.udp_datahandler) -*(.text.udp_send) -*(.text.udp_active) -*(.text.udp_ipv4_active) -*(.text.psock_udp_sendto) -*(.text.sendto_eventhandler) -*(.text.net_dataevent) -*(.text.devif_conn_event) -*(.text.devif_event_trigger) -*(.text.devif_poll_icmp) -*(.text.icmp_poll) -*(.text.devif_packet_conversion) -*(.text.imxrt_txpoll) -*(.text.imxrt_txringfull) -*(.text.arp_out) -*(.text.arp_find) -*(.text.arp_format) -*(.text.net_ipv4addr_hdrcmp) -*(.text.net_ipv4addr_copy) -*(.text.net_ipv4addr_broadcast) -*(.text.imxrt_transmit) -*(.text.wd_start) -*(.text.imxrt_dispatch) -*(.text.arp_arpin) -*(.text.ipv4_input) -*(.text.flexio_irq_handler) - - -*(.text.work_thread) -*(.text.work_queue) - /* Auto-generated */ *(.text._ZN4uORB7Manager27orb_add_internal_subscriberE6ORB_IDhPj) *(.text._ZN13MavlinkStream6updateERKy) @@ -117,11 +8,9 @@ *(.text._ZN22MulticopterRateControl3RunEv.part.0) *(.text._ZN7Mavlink9task_mainEiPPc) *(.text._ZN7sensors22VehicleAngularVelocity3RunEv) -*(.text.memset) *(.text._ZN4uORB12Subscription9subscribeEv.part.0) *(.text._ZN4uORB7Manager13orb_data_copyEPvS1_Rjb) *(.text._ZN4uORB10DeviceNode5writeEP4filePKcj) -*(.text.strcmp) *(.text._ZN4uORB10DeviceNode7publishEPK12orb_metadataPvPKv) *(.text._ZN4uORB12DeviceMaster19getDeviceNodeLockedEPK12orb_metadatah) *(.text._Z12get_orb_meta6ORB_ID) @@ -129,15 +18,12 @@ *(.text._ZN3px49WorkQueue3RunEv) *(.text._ZN9ICM42688P11ProcessGyroERKyPKN20InvenSense_ICM42688P4FIFO4DATAEh) *(.text._ZN4EKF23RunEv) -*(.text.imxrt_lpspi_exchange) -*(.text.imxrt_dmach_xfrsetup) *(.text._ZN7sensors10VehicleIMU7PublishEv) *(.text._ZN4math17WelfordMeanVectorIfLj3EE6updateERKN6matrix6VectorIfLj3EEE) *(.text._ZN7sensors10VehicleIMU10UpdateGyroEv) *(.text._ZN9ICM42688P8FIFOReadERKyh) *(.text._ZN3Ekf20controlGravityFusionERKN9estimator9imuSampleE) *(.text._ZN16PX4Accelerometer10updateFIFOER19sensor_accel_fifo_s) -*(.text.up_block_task) *(.text._ZN7sensors22VehicleAngularVelocity19CalibrateAndPublishERKyRKN6matrix7Vector3IfEES7_) *(.text._ZN4uORB12Subscription10advertisedEv) *(.text._ZNK15AttitudeControl6updateERKN6matrix10QuaternionIfEE) @@ -146,7 +32,6 @@ *(.text._ZN4uORB12Subscription6updateEPv) *(.text._ZN12PX4Gyroscope10updateFIFOER18sensor_gyro_fifo_s) *(.text._ZN7sensors10VehicleIMU3RunEv) -*(.text.up_unblock_task) *(.text.__aeabi_l2f) *(.text._ZN39ControlAllocationSequentialDesaturation23computeDesaturationGainERKN6matrix6VectorIfLj16EEES4_) *(.text.pthread_mutex_timedlock) @@ -168,16 +53,12 @@ *(.text._ZN9ICM42688P7RunImplEv) *(.text._ZN4uORB12Subscription9subscribeEv) *(.text.param_get) -*(.text._do_memcpy) *(.text._ZN7sensors22VehicleAngularVelocity21SensorSelectionUpdateERKyb) *(.text._ZN3px49WorkQueue3AddEPNS_8WorkItemE) -*(.text.wd_start) -*(.text.hrt_call_enter) *(.text._ZN4EKF220PublishLocalPositionERKy) *(.text._mav_finalize_message_chan_send) *(.text._ZN3Ekf19fixCovarianceErrorsEb) *(.text._ZN7sensors22VehicleAngularVelocity16ParametersUpdateEb) -*(.text.ioctl) *(.text._ZN6events12SendProtocol6updateERKy) *(.text._ZN6device3SPI8transferEPhS1_j) *(.text._ZN27MavlinkStreamDistanceSensor4sendEv) diff --git a/boards/nxp/tropic/nuttx-config/scripts/itcm_static_functions.ld b/boards/nxp/tropic/nuttx-config/scripts/itcm_static_functions.ld new file mode 100644 index 000000000000..8b228a22f8b7 --- /dev/null +++ b/boards/nxp/tropic/nuttx-config/scripts/itcm_static_functions.ld @@ -0,0 +1,119 @@ +/* Static */ +*(.text.arm_ack_irq) +*(.text.arm_doirq) +*(.text.arm_svcall) +*(.text.arm_switchcontext) +*(.text.board_autoled_on) +*(.text.clock_timer) +*(.text.exception_common) +*(.text.flexio_irq_handler) +*(.text.hrt_absolute_time) +*(.text.hrt_call_enter) +*(.text.hrt_tim_isr) +*(.text.imxrt_configwaitints) +*(.text.imxrt_dma_callback) +*(.text.imxrt_dmach_interrupt) +*(.text.imxrt_dmach_xfrsetup) +*(.text.imxrt_dmaterminate) +*(.text.imxrt_dispatch) +*(.text.imxrt_edma_interrupt) +*(.text.imxrt_endwait) +*(.text.imxrt_enet_interrupt) +*(.text.imxrt_enet_interrupt_work) +*(.text.imxrt_gpio3_16_31_interrupt) +*(.text.imxrt_interrupt) +*(.text.imxrt_lpi2c_isr) +*(.text.imxrt_lpspi_exchange) +*(.text.imxrt_recvdma) +*(.text.imxrt_tcd_free) +*(.text.imxrt_timerisr) +*(.text.imxrt_transmit) +*(.text.imxrt_txdone) +*(.text.imxrt_txtimeout_work) +*(.text.imxrt_txtimeout_expiry) +*(.text.imxrt_txpoll) +*(.text.imxrt_txringfull) +*(.text.imxrt_txavail_work) +*(.text.imxrt_txavail) +*(.text.imxrt_usbinterrupt) +*(.text.irq_dispatch) +*(.text.ioctl) +*(.text.memcpy) +*(.text.memset) +*(.text.nxsched_add_blocked) +*(.text.nxsched_add_prioritized) +*(.text.nxsched_add_readytorun) +*(.text.nxsched_get_files) +*(.text.nxsched_get_tcb) +*(.text.nxsched_merge_pending) +*(.text.nxsched_process_timer) +*(.text.nxsched_remove_blocked) +*(.text.nxsched_remove_readytorun) +*(.text.nxsched_resume_scheduler) +*(.text.nxsched_suspend_scheduler) +*(.text.nxsem_add_holder) +*(.text.nxsem_add_holder_tcb) +*(.text.nxsem_clockwait) +*(.text.nxsem_foreachholder) +*(.text.nxsem_freecount0holder) +*(.text.nxsem_freeholder) +*(.text.nxsem_post) +*(.text.nxsem_release_holder) +*(.text.nxsem_restore_baseprio) +*(.text.nxsem_tickwait) +*(.text.nxsem_timeout) +*(.text.nxsem_trywait) +*(.text.nxsem_wait) +*(.text.nxsem_wait_uninterruptible) +*(.text.nxsig_timedwait) +*(.text.sched_lock) +*(.text.sched_note_resume) +*(.text.sched_note_suspend) +*(.text.sched_unlock) +*(.text.strcmp) +*(.text.sq_addafter) +*(.text.sq_addlast) +*(.text.sq_rem) +*(.text.sq_remafter) +*(.text.sq_remfirst) +*(.text.uart_connected) +*(.text.up_block_task) +*(.text.up_unblock_task) +*(.text.wd_timer) +*(.text.wd_start) +*(.text.work_thread) +*(.text.work_queue) +*(.text._do_memcpy) + +/* Tropic Eth tune */ +*(.text.devif_poll) +*(.text.devif_poll_tcp_connections) +*(.text.tcp_poll) +*(.text.devif_poll_udp_connections) +*(.text.udp_nextconn) +*(.text.udp_poll) +*(.text.udp_ipv4_select) +*(.text.udp_callback) +*(.text.udp_datahandler) +*(.text.udp_send) +*(.text.udp_active) +*(.text.udp_ipv4_active) +*(.text.psock_udp_sendto) +*(.text.sendto_eventhandler) +*(.text.net_dataevent) +*(.text.devif_conn_event) +*(.text.devif_event_trigger) +*(.text.devif_poll_icmp) +*(.text.icmp_poll) +*(.text.devif_packet_conversion) +*(.text.arp_out) +*(.text.arp_find) +*(.text.arp_format) +*(.text.net_ipv4addr_hdrcmp) +*(.text.net_ipv4addr_copy) +*(.text.net_ipv4addr_broadcast) +*(.text.wd_start) +*(.text.arp_arpin) +*(.text.ipv4_input) +*(.text.work_thread) +*(.text.work_queue) diff --git a/boards/nxp/tropic/nuttx-config/scripts/script.ld b/boards/nxp/tropic/nuttx-config/scripts/script.ld index e616444a5a20..a715059912ce 100644 --- a/boards/nxp/tropic/nuttx-config/scripts/script.ld +++ b/boards/nxp/tropic/nuttx-config/scripts/script.ld @@ -67,6 +67,7 @@ SECTIONS _sitcmfuncs = ABSOLUTE(.); FILL(0xFF) . = 0x40 ; + INCLUDE "itcm_static_functions.ld" INCLUDE "itcm_functions_includes.ld" . = ALIGN(8); _eitcmfuncs = ABSOLUTE(.); diff --git a/boards/nxp/tropic/src/imxrt_flexspi_nor_boot.c b/boards/nxp/tropic/src/imxrt_flexspi_nor_boot.c index b962e4bf783c..8b8384545e3b 100644 --- a/boards/nxp/tropic/src/imxrt_flexspi_nor_boot.c +++ b/boards/nxp/tropic/src/imxrt_flexspi_nor_boot.c @@ -29,29 +29,27 @@ ****************************************************************************/ locate_data(".boot_hdr.ivt") - const struct ivt_s g_image_vector_table = - { - IVT_HEADER, /* IVT Header */ - IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ - IVT_RSVD, /* Reserved = 0 */ - (uint32_t) DCD_ADDRESS, /* Address where DCD information is +const struct ivt_s g_image_vector_table = { + IVT_HEADER, /* IVT Header */ + IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ + IVT_RSVD, /* Reserved = 0 */ + (uint32_t) DCD_ADDRESS, /* Address where DCD information is * stored */ - (uint32_t) BOOT_DATA_ADDRESS, /* Address where BOOT Data Structure + (uint32_t) BOOT_DATA_ADDRESS, /* Address where BOOT Data Structure * is stored */ - (uint32_t) IMAG_VECTOR_TABLE, /* Pointer to IVT Self (absolute + (uint32_t) IMAG_VECTOR_TABLE, /* Pointer to IVT Self (absolute * address */ - (uint32_t) CSF_ADDRESS, /* Address where CSF file is stored */ - IVT_RSVD /* Reserved = 0 */ - }; + (uint32_t) CSF_ADDRESS, /* Address where CSF file is stored */ + IVT_RSVD /* Reserved = 0 */ +}; locate_data(".boot_hdr.boot_data") - const struct boot_data_s g_boot_data = - { - IMAGE_DEST, /* boot start location */ - (IMAGE_DEST_END - IMAGE_DEST), /* size */ - PLUGIN_FLAG, /* Plugin flag */ - 0xffffffff /* empty - extra data word */ - }; +const struct boot_data_s g_boot_data = { + IMAGE_DEST, /* boot start location */ + (IMAGE_DEST_END - IMAGE_DEST), /* size */ + PLUGIN_FLAG, /* Plugin flag */ + 0xffffffff /* empty - extra data word */ +}; /**************************************************************************** * Public Functions diff --git a/boards/nxp/tropic/src/imxrt_flexspi_nor_boot.h b/boards/nxp/tropic/src/imxrt_flexspi_nor_boot.h index faf87e8bc8b4..75e6d9c463c1 100644 --- a/boards/nxp/tropic/src/imxrt_flexspi_nor_boot.h +++ b/boards/nxp/tropic/src/imxrt_flexspi_nor_boot.h @@ -41,8 +41,8 @@ #define IVT_MINOR_VERSION_MASK 0xf #define IVT_VERSION(major, minor) \ - ((((major) & IVT_MAJOR_VERSION_MASK) << IVT_MAJOR_VERSION_SHIFT) | \ - (((minor) & IVT_MINOR_VERSION_MASK) << IVT_MINOR_VERSION_SHIFT)) + ((((major) & IVT_MAJOR_VERSION_MASK) << IVT_MAJOR_VERSION_SHIFT) | \ + (((minor) & IVT_MINOR_VERSION_MASK) << IVT_MINOR_VERSION_SHIFT)) #define IVT_TAG_HEADER (0xd1) /* Image Vector Table */ #define IVT_SIZE 0x2000 @@ -68,7 +68,7 @@ #define ROM_BOOTLOADER_OCRAM_RES 0x8000 #define OCRAM_BASE (0x20200000 + ROM_BOOTLOADER_OCRAM_RES) #define OCRAM_END (OCRAM_BASE + (512 * 1024) + (256 * 1024) \ - - ROM_BOOTLOADER_OCRAM_RES) + - ROM_BOOTLOADER_OCRAM_RES) #define SCLK 1 #if defined(CONFIG_BOOT_RUNFROMFLASH) @@ -100,50 +100,48 @@ /* IVT Data */ -struct ivt_s -{ - /* Header with tag #HAB_TAG_IVT, length and HAB version fields */ +struct ivt_s { + /* Header with tag #HAB_TAG_IVT, length and HAB version fields */ - uint32_t hdr; + uint32_t hdr; - /* Absolute address of the first instr. to execute from the image */ + /* Absolute address of the first instr. to execute from the image */ - uint32_t entry; + uint32_t entry; - /* Reserved in this version of HAB: should be NULL. */ + /* Reserved in this version of HAB: should be NULL. */ - uint32_t reserved1; + uint32_t reserved1; - /* Absolute address of the image DCD: may be NULL. */ + /* Absolute address of the image DCD: may be NULL. */ - uint32_t dcd; + uint32_t dcd; - /* Absolute address of the Boot Data: may be NULL */ + /* Absolute address of the Boot Data: may be NULL */ - uint32_t boot_data; + uint32_t boot_data; - /* Absolute address of the IVT. */ + /* Absolute address of the IVT. */ - uint32_t self; + uint32_t self; - /* Absolute address of the image CSF. */ + /* Absolute address of the image CSF. */ - uint32_t csf; + uint32_t csf; - /* Reserved in this version of HAB: should be zero. */ + /* Reserved in this version of HAB: should be zero. */ - uint32_t reserved2; + uint32_t reserved2; }; /* Boot Data */ -struct boot_data_s -{ - uint32_t start; /* boot start location */ - uint32_t size; /* size */ - uint32_t plugin; /* plugin flag - 1 if downloaded application is +struct boot_data_s { + uint32_t start; /* boot start location */ + uint32_t size; /* size */ + uint32_t plugin; /* plugin flag - 1 if downloaded application is * plugin */ - uint32_t placeholder; /* placeholder to make even 0x10 size */ + uint32_t placeholder; /* placeholder to make even 0x10 size */ }; /**************************************************************************** diff --git a/boards/nxp/tropic/src/imxrt_flexspi_nor_flash.c b/boards/nxp/tropic/src/imxrt_flexspi_nor_flash.c index 872410ef2c95..f7ffe4e46db7 100644 --- a/boards/nxp/tropic/src/imxrt_flexspi_nor_flash.c +++ b/boards/nxp/tropic/src/imxrt_flexspi_nor_flash.c @@ -29,98 +29,61 @@ ****************************************************************************/ locate_data(".boot_hdr.conf") -const struct flexspi_nor_config_s g_flash_config = -{ - .mem_config = - { - .tag = FLEXSPI_CFG_BLK_TAG, - .version = FLEXSPI_CFG_BLK_VERSION, - .read_sample_clksrc = FLASH_READ_SAMPLE_CLK_LOOPBACK_FROM_SCKPAD, - .cs_hold_time = 3u, - .cs_setup_time = 3u, - .column_address_width = 0u, - .device_type = FLEXSPI_DEVICE_TYPE_SERIAL_NOR, - .sflash_pad_type = SERIAL_FLASH_4PADS, - .serial_clk_freq = FLEXSPI_SERIAL_CLKFREQ_133MHz, - .sflash_a1size = 2u * 1024u * 1024u, - .data_valid_time = - { - 0u, 0u - }, - .lookup_table = - { - /* LUTs */ - - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xeb, - RADDR_SDR, FLEXSPI_4PAD, 0x18), - FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, - READ_SDR, FLEXSPI_4PAD, 0x04), - 0x00000000, - 0x00000000, - - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, - READ_SDR, FLEXSPI_1PAD, 0x04), - 0x00000000, - 0x00000000, - 0x00000000, - - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01, STOP, FLEXSPI_1PAD, 0x0), - 0x00000000, - 0x00000000, - 0x00000000, - - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20, - RADDR_SDR, FLEXSPI_1PAD, 0x18), - 0x00000000, - 0x00000000, - 0x00000000, - - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xd8, - RADDR_SDR, FLEXSPI_1PAD, 0x18), - 0x00000000, - 0x00000000, - 0x00000000, - - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02, - RADDR_SDR, FLEXSPI_1PAD, 0x18), - FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04, - STOP, FLEXSPI_1PAD, 0x0), - 0x00000000, - 0x00000000, - - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60, STOP, FLEXSPI_1PAD, 0x0), - }, - }, - - .page_size = 256u, - .sector_size = 4u * 1024u, - .blocksize = 64u * 1024u, - .is_uniform_blocksize = false, +const struct flexspi_nor_config_s g_flash_config = { + .mem_config = + { + .tag = FLEXSPI_CFG_BLK_TAG, + .version = FLEXSPI_CFG_BLK_VERSION, + .read_sample_clksrc = FLASH_READ_SAMPLE_CLK_LOOPBACK_FROM_SCKPAD, + .cs_hold_time = 1u, + .cs_setup_time = 1u, + .column_address_width = 0u, + .device_type = FLEXSPI_DEVICE_TYPE_SERIAL_NOR, + .sflash_pad_type = SERIAL_FLASH_4PADS, + .serial_clk_freq = FLEXSPI_SERIAL_CLKFREQ_133MHz, + .sflash_a1size = 8u * 1024u * 1024u, + .data_valid_time = + { + 0u, 0u + }, + .lookup_table = + { + /* Fast Read Quad I/O */ + [0 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xeb, + RADDR_SDR, FLEXSPI_4PAD, 0x18), + [0 + 1] = FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, + READ_SDR, FLEXSPI_4PAD, 0x04), + + /* Read Status Register-1 */ + [4 * 1 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, + READ_SDR, FLEXSPI_1PAD, 0x04), + + /* Write Status Register-1 */ + [4 * 3 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01, STOP, FLEXSPI_1PAD, 0x0), + + /* Sector Erase (4KB) */ + [4 * 5 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20, + RADDR_SDR, FLEXSPI_1PAD, 0x18), + + /* Block Erase (64KB) */ + [4 * 8 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xd8, + RADDR_SDR, FLEXSPI_1PAD, 0x18), + + /* Page Program */ + [4 * 9 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02, + RADDR_SDR, FLEXSPI_1PAD, 0x18), + [4 * 9 + 1] = FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04, + STOP, FLEXSPI_1PAD, 0x0), + + /* Chip Erase */ + [4 * 11 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60, STOP, FLEXSPI_1PAD, 0x0), + }, + }, + + .page_size = 256u, + .sector_size = 4u * 1024u, + .blocksize = 64u * 1024u, + .is_uniform_blocksize = false, }; /**************************************************************************** diff --git a/boards/nxp/tropic/src/imxrt_flexspi_nor_flash.h b/boards/nxp/tropic/src/imxrt_flexspi_nor_flash.h index 9011682292c5..11904fae65d0 100644 --- a/boards/nxp/tropic/src/imxrt_flexspi_nor_flash.h +++ b/boards/nxp/tropic/src/imxrt_flexspi_nor_flash.h @@ -90,37 +90,37 @@ #define FLEXSPI_LUT_OPERAND0_MASK (0xffu) #define FLEXSPI_LUT_OPERAND0_SHIFT (0U) #define FLEXSPI_LUT_OPERAND0(x) (((uint32_t) \ - (((uint32_t)(x)) << FLEXSPI_LUT_OPERAND0_SHIFT)) & \ - FLEXSPI_LUT_OPERAND0_MASK) + (((uint32_t)(x)) << FLEXSPI_LUT_OPERAND0_SHIFT)) & \ + FLEXSPI_LUT_OPERAND0_MASK) #define FLEXSPI_LUT_NUM_PADS0_MASK (0x300u) #define FLEXSPI_LUT_NUM_PADS0_SHIFT (8u) #define FLEXSPI_LUT_NUM_PADS0(x) (((uint32_t) \ - (((uint32_t)(x)) << FLEXSPI_LUT_NUM_PADS0_SHIFT)) & \ - FLEXSPI_LUT_NUM_PADS0_MASK) + (((uint32_t)(x)) << FLEXSPI_LUT_NUM_PADS0_SHIFT)) & \ + FLEXSPI_LUT_NUM_PADS0_MASK) #define FLEXSPI_LUT_OPCODE0_MASK (0xfc00u) #define FLEXSPI_LUT_OPCODE0_SHIFT (10u) #define FLEXSPI_LUT_OPCODE0(x) (((uint32_t) \ - (((uint32_t)(x)) << FLEXSPI_LUT_OPCODE0_SHIFT)) & \ - FLEXSPI_LUT_OPCODE0_MASK) + (((uint32_t)(x)) << FLEXSPI_LUT_OPCODE0_SHIFT)) & \ + FLEXSPI_LUT_OPCODE0_MASK) #define FLEXSPI_LUT_OPERAND1_MASK (0xff0000u) #define FLEXSPI_LUT_OPERAND1_SHIFT (16U) #define FLEXSPI_LUT_OPERAND1(x) (((uint32_t) \ - (((uint32_t)(x)) << FLEXSPI_LUT_OPERAND1_SHIFT)) & \ - FLEXSPI_LUT_OPERAND1_MASK) + (((uint32_t)(x)) << FLEXSPI_LUT_OPERAND1_SHIFT)) & \ + FLEXSPI_LUT_OPERAND1_MASK) #define FLEXSPI_LUT_NUM_PADS1_MASK (0x3000000u) #define FLEXSPI_LUT_NUM_PADS1_SHIFT (24u) #define FLEXSPI_LUT_NUM_PADS1(x) (((uint32_t) \ - (((uint32_t)(x)) << FLEXSPI_LUT_NUM_PADS1_SHIFT)) & \ - FLEXSPI_LUT_NUM_PADS1_MASK) + (((uint32_t)(x)) << FLEXSPI_LUT_NUM_PADS1_SHIFT)) & \ + FLEXSPI_LUT_NUM_PADS1_MASK) #define FLEXSPI_LUT_OPCODE1_MASK (0xfc000000u) #define FLEXSPI_LUT_OPCODE1_SHIFT (26u) #define FLEXSPI_LUT_OPCODE1(x) (((uint32_t)(((uint32_t)(x)) << FLEXSPI_LUT_OPCODE1_SHIFT)) & \ - FLEXSPI_LUT_OPCODE1_MASK) + FLEXSPI_LUT_OPCODE1_MASK) #define FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) \ - (FLEXSPI_LUT_OPERAND0(op0) | FLEXSPI_LUT_NUM_PADS0(pad0) | \ - FLEXSPI_LUT_OPCODE0(cmd0) | FLEXSPI_LUT_OPERAND1(op1) | \ - FLEXSPI_LUT_NUM_PADS1(pad1) | FLEXSPI_LUT_OPCODE1(cmd1)) + (FLEXSPI_LUT_OPERAND0(op0) | FLEXSPI_LUT_NUM_PADS0(pad0) | \ + FLEXSPI_LUT_OPCODE0(cmd0) | FLEXSPI_LUT_OPERAND1(op1) | \ + FLEXSPI_LUT_NUM_PADS1(pad1) | FLEXSPI_LUT_OPCODE1(cmd1)) /* */ @@ -187,178 +187,168 @@ /* Definitions for FlexSPI Serial Clock Frequency */ -enum flexspi_serial_clkfreq_e -{ - FLEXSPI_SERIAL_CLKFREQ_30MHz = 1, - FLEXSPI_SERIAL_CLKFREQ_50MHz = 2, - FLEXSPI_SERIAL_CLKFREQ_60MHz = 3, - FLEXSPI_SERIAL_CLKFREQ_75MHz = 4, - FLEXSPI_SERIAL_CLKFREQ_80MHz = 5, - FLEXSPI_SERIAL_CLKFREQ_100MHz = 6, - FLEXSPI_SERIAL_CLKFREQ_133MHz = 7, - FLEXSPI_SERIAL_CLKFREQ_166MHz = 8, - FLEXSPI_SERIAL_CLKFREQ_200MHz = 9, +enum flexspi_serial_clkfreq_e { + FLEXSPI_SERIAL_CLKFREQ_30MHz = 1, + FLEXSPI_SERIAL_CLKFREQ_50MHz = 2, + FLEXSPI_SERIAL_CLKFREQ_60MHz = 3, + FLEXSPI_SERIAL_CLKFREQ_75MHz = 4, + FLEXSPI_SERIAL_CLKFREQ_80MHz = 5, + FLEXSPI_SERIAL_CLKFREQ_100MHz = 6, + FLEXSPI_SERIAL_CLKFREQ_120MHz = 7, + FLEXSPI_SERIAL_CLKFREQ_133MHz = 8, + FLEXSPI_SERIAL_CLKFREQ_166MHz = 9, }; /* FlexSPI clock configuration type */ -enum flexspi_serial_clockmode_e -{ - FLEXSPI_CLKMODE_SDR, - FLEXSPI_CLKMODE_DDR, +enum flexspi_serial_clockmode_e { + FLEXSPI_CLKMODE_SDR, + FLEXSPI_CLKMODE_DDR, }; /* FlexSPI Read Sample Clock Source definition */ -enum flash_read_sample_clk_e -{ - FLASH_READ_SAMPLE_CLK_LOOPBACK_INTERNELLY = 0, - FLASH_READ_SAMPLE_CLK_LOOPBACK_FROM_DQSPAD = 1, - FLASH_READ_SAMPLE_CLK_LOOPBACK_FROM_SCKPAD = 2, - FLASH_READ_SAMPLE_CLK_EXTERNALINPUT_FROM_DQSPAD = 3, +enum flash_read_sample_clk_e { + FLASH_READ_SAMPLE_CLK_LOOPBACK_INTERNELLY = 0, + FLASH_READ_SAMPLE_CLK_LOOPBACK_FROM_DQSPAD = 1, + FLASH_READ_SAMPLE_CLK_LOOPBACK_FROM_SCKPAD = 2, + FLASH_READ_SAMPLE_CLK_EXTERNALINPUT_FROM_DQSPAD = 3, }; /* Misc feature bit definitions */ -enum flash_misc_feature_e -{ - FLEXSPIMISC_OFFSET_DIFFCLKEN = 0, /* Bit for Differential clock enable */ - FLEXSPIMISC_OFFSET_CK2EN = 1, /* Bit for CK2 enable */ - FLEXSPIMISC_OFFSET_PARALLELEN = 2, /* Bit for Parallel mode enable */ +enum flash_misc_feature_e { + FLEXSPIMISC_OFFSET_DIFFCLKEN = 0, /* Bit for Differential clock enable */ + FLEXSPIMISC_OFFSET_CK2EN = 1, /* Bit for CK2 enable */ + FLEXSPIMISC_OFFSET_PARALLELEN = 2, /* Bit for Parallel mode enable */ - FLEXSPIMISC_OFFSET_WORD_ADDRESSABLE_EN = 3, /* Bit for Word Addressable + FLEXSPIMISC_OFFSET_WORD_ADDRESSABLE_EN = 3, /* Bit for Word Addressable * enable */ - FLEXSPIMISC_OFFSET_SAFECONFIG_FREQ_EN = 4, /* Bit for Safe Configuration + FLEXSPIMISC_OFFSET_SAFECONFIG_FREQ_EN = 4, /* Bit for Safe Configuration * Frequency enable */ - FLEXSPIMISC_OFFSET_PAD_SETTING_OVERRIDE_EN = 5, /* Bit for Pad setting + FLEXSPIMISC_OFFSET_PAD_SETTING_OVERRIDE_EN = 5, /* Bit for Pad setting * override enable */ - FLEXSPIMISC_OFFSET_DDR_MODE_EN = 6, /* Bit for DDR clock confiuration + FLEXSPIMISC_OFFSET_DDR_MODE_EN = 6, /* Bit for DDR clock confiuration * indication. */ }; /* Flash Type Definition */ -enum flash_flash_type_e -{ - FLEXSPI_DEVICE_TYPE_SERIAL_NOR = 1, /* Flash devices are Serial NOR */ - FLEXSPI_DEVICE_TYPE_SERIAL_NAND = 2, /* Flash devices are Serial +enum flash_flash_type_e { + FLEXSPI_DEVICE_TYPE_SERIAL_NOR = 1, /* Flash devices are Serial NOR */ + FLEXSPI_DEVICE_TYPE_SERIAL_NAND = 2, /* Flash devices are Serial * NAND */ - FLEXSPI_DEVICE_TYPE_SERIAL_RAM = 3, /* Flash devices are Serial + FLEXSPI_DEVICE_TYPE_SERIAL_RAM = 3, /* Flash devices are Serial * RAM/HyperFLASH */ - FLEXSPI_DEVICE_TYPE_MCP_NOR_NAND = 0x12, /* Flash device is MCP device, + FLEXSPI_DEVICE_TYPE_MCP_NOR_NAND = 0x12, /* Flash device is MCP device, * A1 is Serial NOR, A2 is * Serial NAND */ - FLEXSPI_DEVICE_TYPE_MCP_NOR_RAM = 0x13, /* Flash device is MCP device, + FLEXSPI_DEVICE_TYPE_MCP_NOR_RAM = 0x13, /* Flash device is MCP device, * A1 is Serial NOR, A2 is * Serial RAMs */ }; /* Flash Pad Definitions */ -enum flash_flash_pad_e -{ - SERIAL_FLASH_1PAD = 1, - SERIAL_FLASH_2PADS = 2, - SERIAL_FLASH_4PADS = 4, - SERIAL_FLASH_8PADS = 8, +enum flash_flash_pad_e { + SERIAL_FLASH_1PAD = 1, + SERIAL_FLASH_2PADS = 2, + SERIAL_FLASH_4PADS = 4, + SERIAL_FLASH_8PADS = 8, }; /* Flash Configuration Command Type */ -enum flash_config_cmd_e -{ - DEVICE_CONFIG_CMD_TYPE_GENERIC, /* Generic command, for example: +enum flash_config_cmd_e { + DEVICE_CONFIG_CMD_TYPE_GENERIC, /* Generic command, for example: * configure dummy cycles, drive * strength, etc */ - DEVICE_CONFIG_CMD_TYPE_QUADENABLE, /* Quad Enable command */ - DEVICE_CONFIG_CMD_TYPE_SPI2XPI, /* Switch from SPI to DPI/QPI/OPI mode */ - DEVICE_CONFIG_CMD_TYPE_XPI2SPI, /* Switch from DPI/QPI/OPI to SPI mode */ - DEVICE_CONFIG_CMD_TYPE_SPI2NO_CMD, /* Switch to 0-4-4/0-8-8 mode */ - DEVICE_CONFIG_CMD_TYPE_RESET, /* Reset device command */ + DEVICE_CONFIG_CMD_TYPE_QUADENABLE, /* Quad Enable command */ + DEVICE_CONFIG_CMD_TYPE_SPI2XPI, /* Switch from SPI to DPI/QPI/OPI mode */ + DEVICE_CONFIG_CMD_TYPE_XPI2SPI, /* Switch from DPI/QPI/OPI to SPI mode */ + DEVICE_CONFIG_CMD_TYPE_SPI2NO_CMD, /* Switch to 0-4-4/0-8-8 mode */ + DEVICE_CONFIG_CMD_TYPE_RESET, /* Reset device command */ }; /* FlexSPI LUT Sequence structure */ -struct flexspi_lut_seq_s -{ - uint8_t seq_num; /* Sequence Number, valid number: 1-16 */ - uint8_t seq_id; /* Sequence Index, valid number: 0-15 */ - uint16_t reserved; +struct flexspi_lut_seq_s { + uint8_t seq_num; /* Sequence Number, valid number: 1-16 */ + uint8_t seq_id; /* Sequence Index, valid number: 0-15 */ + uint16_t reserved; }; /* FlexSPI Memory Configuration Block */ -struct flexspi_mem_config_s -{ - uint32_t tag; - uint32_t version; - uint32_t reserved0; - uint8_t read_sample_clksrc; - uint8_t cs_hold_time; - uint8_t cs_setup_time; - uint8_t column_address_width; /* [0x00f-0x00f] Column Address with, +struct flexspi_mem_config_s { + uint32_t tag; + uint32_t version; + uint32_t reserved0; + uint8_t read_sample_clksrc; + uint8_t cs_hold_time; + uint8_t cs_setup_time; + uint8_t column_address_width; /* [0x00f-0x00f] Column Address with, * for HyperBus protocol, it is fixed * to 3, For Serial NAND, need to refer * to datasheet */ - uint8_t device_mode_cfg_enable; - uint8_t device_mode_type; - uint16_t wait_time_cfg_commands; - struct flexspi_lut_seq_s device_mode_seq; - uint32_t device_mode_arg; - uint8_t config_cmd_enable; - uint8_t config_mode_type[3]; - struct flexspi_lut_seq_s config_cmd_seqs[3]; - uint32_t reserved1; - uint32_t config_cmd_args[3]; - uint32_t reserved2; - uint32_t controller_misc_option; - uint8_t device_type; - uint8_t sflash_pad_type; - uint8_t serial_clk_freq; - uint8_t lut_custom_seq_enable; - uint32_t reserved3[2]; - uint32_t sflash_a1size; - uint32_t sflash_a2size; - uint32_t sflash_b1size; - uint32_t sflash_b2size; - uint32_t cspad_setting_override; - uint32_t sclkpad_setting_override; - uint32_t datapad_setting_override; - uint32_t dqspad_setting_override; - uint32_t timeout_in_ms; - uint32_t command_interval; - uint16_t data_valid_time[2]; - uint16_t busy_offset; - uint16_t busybit_polarity; - uint32_t lookup_table[64]; - struct flexspi_lut_seq_s lut_customseq[12]; - uint32_t reserved4[4]; + uint8_t device_mode_cfg_enable; + uint8_t device_mode_type; + uint16_t wait_time_cfg_commands; + struct flexspi_lut_seq_s device_mode_seq; + uint32_t device_mode_arg; + uint8_t config_cmd_enable; + uint8_t config_mode_type[3]; + struct flexspi_lut_seq_s config_cmd_seqs[3]; + uint32_t reserved1; + uint32_t config_cmd_args[3]; + uint32_t reserved2; + uint32_t controller_misc_option; + uint8_t device_type; + uint8_t sflash_pad_type; + uint8_t serial_clk_freq; + uint8_t lut_custom_seq_enable; + uint32_t reserved3[2]; + uint32_t sflash_a1size; + uint32_t sflash_a2size; + uint32_t sflash_b1size; + uint32_t sflash_b2size; + uint32_t cspad_setting_override; + uint32_t sclkpad_setting_override; + uint32_t datapad_setting_override; + uint32_t dqspad_setting_override; + uint32_t timeout_in_ms; + uint32_t command_interval; + uint16_t data_valid_time[2]; + uint16_t busy_offset; + uint16_t busybit_polarity; + uint32_t lookup_table[64]; + struct flexspi_lut_seq_s lut_customseq[12]; + uint32_t reserved4[4]; }; /* Serial NOR configuration block */ -struct flexspi_nor_config_s -{ - struct flexspi_mem_config_s mem_config; /* Common memory configuration +struct flexspi_nor_config_s { + struct flexspi_mem_config_s mem_config; /* Common memory configuration * info via FlexSPI */ - uint32_t page_size; /* Page size of Serial NOR */ - uint32_t sector_size; /* Sector size of Serial NOR */ - uint8_t ipcmd_serial_clkfreq; /* Clock frequency for IP command */ - uint8_t is_uniform_blocksize; /* Sector/Block size is the same */ - uint8_t reserved0[2]; /* Reserved for future use */ - uint8_t serial_nor_type; /* Serial NOR Flash type: 0/1/2/3 */ - uint8_t need_exit_nocmdmode; /* Need to exit NoCmd mode before other + uint32_t page_size; /* Page size of Serial NOR */ + uint32_t sector_size; /* Sector size of Serial NOR */ + uint8_t ipcmd_serial_clkfreq; /* Clock frequency for IP command */ + uint8_t is_uniform_blocksize; /* Sector/Block size is the same */ + uint8_t reserved0[2]; /* Reserved for future use */ + uint8_t serial_nor_type; /* Serial NOR Flash type: 0/1/2/3 */ + uint8_t need_exit_nocmdmode; /* Need to exit NoCmd mode before other * IP command */ - uint8_t halfclk_for_nonreadcmd; /* Half the Serial Clock for non-read + uint8_t halfclk_for_nonreadcmd; /* Half the Serial Clock for non-read * command: true/false */ - uint8_t need_restore_nocmdmode; /* Need to Restore NoCmd mode after IP + uint8_t need_restore_nocmdmode; /* Need to Restore NoCmd mode after IP * command execution */ - uint32_t blocksize; /* Block size */ - uint32_t reserve2[11]; /* Reserved for future use */ + uint32_t blocksize; /* Block size */ + uint32_t reserve2[11]; /* Reserved for future use */ }; #endif /* __BOARDS_ARM_IMXRT_TEENSY_4_SRC_IMXRT_FLEXSPI_NOR_FLASH_H */ diff --git a/boards/nxp/tropic/src/init.c b/boards/nxp/tropic/src/init.c index ac86c6a3231d..dda1ca287c65 100644 --- a/boards/nxp/tropic/src/init.c +++ b/boards/nxp/tropic/src/init.c @@ -303,39 +303,40 @@ __EXPORT void imxrt_boardinitialize(void) int imxrt_phy_boardinitialize(int intf) { #ifdef CONFIG_IMXRT_GPIO1_0_15_IRQ - /* Configure the PHY interrupt pin */ + /* Configure the PHY interrupt pin */ - printf("Configuring interrupt: %08x\n", GPIO_ENET_INT); - imxrt_config_gpio(GPIO_ENET_INT); + printf("Configuring interrupt: %08x\n", GPIO_ENET_INT); + imxrt_config_gpio(GPIO_ENET_INT); #endif - /* Configure the PHY reset pin. - * - * The #RST uses inverted logic. The initial value of zero will put the - * PHY into the reset state. - */ + /* Configure the PHY reset pin. + * + * The #RST uses inverted logic. The initial value of zero will put the + * PHY into the reset state. + */ - printf("Configuring reset: %08x\n", GPIO_ENET_RST); - imxrt_config_gpio(GPIO_ENET_RST); + printf("Configuring reset: %08x\n", GPIO_ENET_RST); + imxrt_config_gpio(GPIO_ENET_RST); - /* Take the PHY out of reset. */ + /* Take the PHY out of reset. */ - imxrt_gpio_write(GPIO_ENET_RST, true); - return OK; + imxrt_gpio_write(GPIO_ENET_RST, true); + return OK; } -void imxrt_flexio_clocking(void) { - uint32_t reg; - reg = getreg32(IMXRT_CCM_CDCDR); - reg &= ~(CCM_CDCDR_FLEXIO1_CLK_SEL_MASK | - CCM_CDCDR_FLEXIO1_CLK_PODF_MASK | - CCM_CDCDR_FLEXIO1_CLK_PRED_MASK); - reg |= CCM_CDCDR_FLEXIO1_CLK_SEL(CONFIG_FLEXIO1_CLK); - reg |= CCM_CDCDR_FLEXIO1_CLK_PODF - (CCM_PODF_FROM_DIVISOR(CONFIG_FLEXIO1_PODF_DIVIDER)); - reg |= CCM_CDCDR_FLEXIO1_CLK_PRED - (CCM_PRED_FROM_DIVISOR(CONFIG_FLEXIO1_PRED_DIVIDER)); - putreg32(reg, IMXRT_CCM_CDCDR); +void imxrt_flexio_clocking(void) +{ + uint32_t reg; + reg = getreg32(IMXRT_CCM_CDCDR); + reg &= ~(CCM_CDCDR_FLEXIO1_CLK_SEL_MASK | + CCM_CDCDR_FLEXIO1_CLK_PODF_MASK | + CCM_CDCDR_FLEXIO1_CLK_PRED_MASK); + reg |= CCM_CDCDR_FLEXIO1_CLK_SEL(CONFIG_FLEXIO1_CLK); + reg |= CCM_CDCDR_FLEXIO1_CLK_PODF + (CCM_PODF_FROM_DIVISOR(CONFIG_FLEXIO1_PODF_DIVIDER)); + reg |= CCM_CDCDR_FLEXIO1_CLK_PRED + (CCM_PRED_FROM_DIVISOR(CONFIG_FLEXIO1_PRED_DIVIDER)); + putreg32(reg, IMXRT_CCM_CDCDR); } diff --git a/boards/nxp/tropic/src/usb.c b/boards/nxp/tropic/src/usb.c index d75829655163..542c5c17a3b6 100644 --- a/boards/nxp/tropic/src/usb.c +++ b/boards/nxp/tropic/src/usb.c @@ -74,7 +74,7 @@ int imxrt_usb_initialize(void) // We abuse VBUS2 to check if system power checks VBUS gets below 4.7V putreg32(USB_ANALOG_USB_VBUS_DETECT_VBUSVALID_THRESH_4V7 | USB_ANALOG_USB_VBUS_DETECT_VBUSVALID_PWRUP_CMPS, - IMXRT_USB_ANALOG_USB2_VBUS_DETECT); + IMXRT_USB_ANALOG_USB2_VBUS_DETECT); return 0; } /************************************************************************************