From 29b031d04d25b5972ad58ee9c7b53a02b4803442 Mon Sep 17 00:00:00 2001 From: Marco Accame Date: Mon, 17 Apr 2023 17:50:39 +0200 Subject: [PATCH] Alignment of the application framework for the `amcbldc` and `amc2c` boards (#367) --- .../amc2c/application/bin/.placeholder.txt | 1 + .../application/cfg/amc2c-template-appl.sct | 12 + .../cfg/stm32hal.h7.startup.amc.CM4.s | 621 ++++ .../application/proj/amc2c-appl-can.uvoptx | 1225 ++++++++ .../application/proj/amc2c-appl-can.uvprojx | 1739 +++++++++++ .../amc2c/application/src/amc2c-main2.cpp | 31 + .../embot_app_board_amc2c_info.cpp | 180 ++ .../embot_app_board_amc2c_info.h | 31 + .../embot_app_board_amc2c_mbd.demo.cpp | 59 + .../embot_app_board_amc2c_mbd.h | 30 + .../embot_app_board_amc2c_theCANagentCORE.cpp | 281 ++ .../embot_app_board_amc2c_theCANagentCORE.h | 69 + .../board/amc2c/bsp/embot_hw_bsp_amc2c.cpp | 97 +- .../examples/embot-os/src/main-basic.cpp | 6 +- .../proj/amcbldc-application2.uvoptx | 1669 +++++++++++ .../proj/amcbldc-application2.uvprojx | 2559 +++++++++++++++++ .../amcbldc/application/src/amcbldc-main2.cpp | 81 + .../embot_app_board_amcbldc_MBD.cpp | 55 + .../embot_app_board_amcbldc_MBD.demo.cpp | 55 + .../embot_app_board_amcbldc_MBD.h | 30 + .../embot_app_board_amcbldc_info.cpp | 79 + .../embot_app_board_amcbldc_info.h | 32 + .../embot_app_board_amcbldc_theMBD.cpp | 639 ++++ .../embot_app_board_amcbldc_theMBD.h | 55 + .../embot/app/bldc/embot_app_bldc_COMM.h | 64 + .../bldc/embot_app_bldc_theApplication.cpp | 213 ++ .../app/bldc/embot_app_bldc_theApplication.h | 151 + .../embot/app/bldc/embot_app_bldc_theCOMM.cpp | 353 +++ .../embot/app/bldc/embot_app_bldc_theCOMM.h | 84 + .../embot/app/bldc/embot_app_bldc_theCTRL.cpp | 254 ++ .../embot/app/bldc/embot_app_bldc_theCTRL.h | 84 + .../app/bldc/embot_app_bldc_theMSGbroker.cpp | 361 +++ .../app/bldc/embot_app_bldc_theMSGbroker.h | 72 + .../app/embot_app_application_CANagentCORE.h | 84 + .../embot_app_application_theCANagentCORE.cpp | 260 ++ .../embot_app_application_theCANagentCORE.h | 69 + ...mbot_app_application_theCANparserBasic.cpp | 2 - ...embot_app_application_theCANparserCORE.cpp | 330 +++ .../embot_app_application_theCANparserCORE.h | 60 + .../embot/app/embot_app_theApplication.h | 4 +- .../embot/app/embot_app_theCANboardInfo.cpp | 14 +- .../embot/app/embot_app_theCANboardInfo.h | 38 +- .../skeleton/embot_app_skeleton_os_basic.h | 2 +- emBODY/eBcode/arch-arm/embot/hw/embot_hw.cpp | 28 +- emBODY/eBcode/arch-arm/embot/hw/embot_hw.h | 13 +- .../eBcode/arch-arm/embot/hw/embot_hw_flash.h | 10 +- .../eBcode/arch-arm/embot/hw/embot_hw_types.h | 15 +- emBODY/eBcode/arch-arm/embot/os/embot_os.cpp | 2 +- emBODY/eBcode/arch-arm/embot/os/embot_os.h | 10 +- .../arch-arm/embot/os/embot_os_Thread.h | 7 +- .../arch-arm/embot/prot/can/embot_prot_can.h | 42 +- 51 files changed, 12148 insertions(+), 114 deletions(-) create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/bin/.placeholder.txt create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/cfg/amc2c-template-appl.sct create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/cfg/stm32hal.h7.startup.amc.CM4.s create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvoptx create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvprojx create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/src/amc2c-main2.cpp create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_info.cpp create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_info.h create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.demo.cpp create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.h create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_theCANagentCORE.cpp create mode 100644 emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_theCANagentCORE.h create mode 100644 emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvoptx create mode 100644 emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvprojx create mode 100644 emBODY/eBcode/arch-arm/board/amcbldc/application/src/amcbldc-main2.cpp create mode 100644 emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.cpp create mode 100644 emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.demo.cpp create mode 100644 emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.h create mode 100644 emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_info.cpp create mode 100644 emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_info.h create mode 100644 emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.cpp create mode 100644 emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.h create mode 100644 emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_COMM.h create mode 100644 emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theApplication.cpp create mode 100644 emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theApplication.h create mode 100644 emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCOMM.cpp create mode 100644 emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCOMM.h create mode 100644 emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCTRL.cpp create mode 100644 emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCTRL.h create mode 100644 emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theMSGbroker.cpp create mode 100644 emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theMSGbroker.h create mode 100644 emBODY/eBcode/arch-arm/embot/app/embot_app_application_CANagentCORE.h create mode 100644 emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANagentCORE.cpp create mode 100644 emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANagentCORE.h create mode 100644 emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserCORE.cpp create mode 100644 emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserCORE.h diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/bin/.placeholder.txt b/emBODY/eBcode/arch-arm/board/amc2c/application/bin/.placeholder.txt new file mode 100644 index 0000000000..b0eb8200ba --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/bin/.placeholder.txt @@ -0,0 +1 @@ +.placeholder diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/cfg/amc2c-template-appl.sct b/emBODY/eBcode/arch-arm/board/amc2c/application/cfg/amc2c-template-appl.sct new file mode 100644 index 0000000000..34c8df018e --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/cfg/amc2c-template-appl.sct @@ -0,0 +1,12 @@ + + +LR_IROM1 0x08100000 0x00100000 { ; load region size_region + ER_IROM1 0x08100000 0x00100000 { ; load address = execution address + *.o (RESET, +First) + *(InRoot$$Sections) + .ANY (+RO) + } + RW_IRAM1 0x10000000 0x00048000{ ; RW data + .ANY (+RW +ZI) + } +} diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/cfg/stm32hal.h7.startup.amc.CM4.s b/emBODY/eBcode/arch-arm/board/amc2c/application/cfg/stm32hal.h7.startup.amc.CM4.s new file mode 100644 index 0000000000..b3a6dea97d --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/cfg/stm32hal.h7.startup.amc.CM4.s @@ -0,0 +1,621 @@ +;******************** (C) COPYRIGHT 2019 STMicroelectronics ******************** +;* File Name : startup_stm32h745xx.s +;* @author MCD Application Team +;* Description : STM32H7xx devices vector table for MDK-ARM toolchain. +;* This module performs: +;* - Set the initial SP +;* - Set the initial PC == Reset_Handler +;* - Set the vector table entries with the exceptions ISR address +;* - Branches to __main in the C library (which eventually +;* calls main()). +;* After Reset the Cortex-M processor is in Thread mode, +;* priority is Privileged, and the Stack is set to Main. +;* <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +;* @attention +;* +;* Copyright (c) 2019 STMicroelectronics. +;* All rights reserved. +;* +;* This software component is licensed by ST under BSD 3-Clause license, +;* the "License"; You may not use this file except in compliance with the +;* License. You may obtain a copy of the License at: +;* opensource.org/licenses/BSD-3-Clause +;* +;****************************************************************************** + +; Amount of memory (in bytes) allocated for Stack +; Tailor this value to your application needs +; Stack Configuration +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; + +Stack_Size EQU 0x800 + + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp + + +; Heap Configuration +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; + +Heap_Size EQU 0x8000 + + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit + + PRESERVE8 + THUMB + + +; Vector Table Mapped to Address 0 at Reset + AREA RESET, DATA, READONLY + EXPORT __Vectors + EXPORT __Vectors_End + EXPORT __Vectors_Size + +__Vectors DCD __initial_sp ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NMI_Handler ; NMI Handler + DCD HardFault_Handler ; Hard Fault Handler + DCD MemManage_Handler ; MPU Fault Handler + DCD BusFault_Handler ; Bus Fault Handler + DCD UsageFault_Handler ; Usage Fault Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler ; SVCall Handler + DCD DebugMon_Handler ; Debug Monitor Handler + DCD 0 ; Reserved + DCD PendSV_Handler ; PendSV Handler + DCD SysTick_Handler ; SysTick Handler + + ; External Interrupts + DCD WWDG_IRQHandler ; Window WatchDog interrupt ( wwdg1_it, wwdg2_it) + DCD PVD_AVD_IRQHandler ; PVD/AVD through EXTI Line detection + DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line + DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line + DCD FLASH_IRQHandler ; FLASH + DCD RCC_IRQHandler ; RCC + DCD EXTI0_IRQHandler ; EXTI Line0 + DCD EXTI1_IRQHandler ; EXTI Line1 + DCD EXTI2_IRQHandler ; EXTI Line2 + DCD EXTI3_IRQHandler ; EXTI Line3 + DCD EXTI4_IRQHandler ; EXTI Line4 + DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 + DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 + DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 + DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 + DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 + DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 + DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 + DCD ADC_IRQHandler ; ADC1, ADC2 + DCD FDCAN1_IT0_IRQHandler ; FDCAN1 interrupt line 0 + DCD FDCAN2_IT0_IRQHandler ; FDCAN2 interrupt line 0 + DCD FDCAN1_IT1_IRQHandler ; FDCAN1 interrupt line 1 + DCD FDCAN2_IT1_IRQHandler ; FDCAN2 interrupt line 1 + DCD EXTI9_5_IRQHandler ; External Line[9:5]s + DCD TIM1_BRK_IRQHandler ; TIM1 Break interrupt + DCD TIM1_UP_IRQHandler ; TIM1 Update Interrupt + DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation Interrupt + DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare + DCD TIM2_IRQHandler ; TIM2 + DCD TIM3_IRQHandler ; TIM3 + DCD TIM4_IRQHandler ; TIM4 + DCD I2C1_EV_IRQHandler ; I2C1 Event + DCD I2C1_ER_IRQHandler ; I2C1 Error + DCD I2C2_EV_IRQHandler ; I2C2 Event + DCD I2C2_ER_IRQHandler ; I2C2 Error + DCD SPI1_IRQHandler ; SPI1 + DCD SPI2_IRQHandler ; SPI2 + DCD USART1_IRQHandler ; USART1 + DCD USART2_IRQHandler ; USART2 + DCD USART3_IRQHandler ; USART3 + DCD EXTI15_10_IRQHandler ; External Line[15:10] + DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line + DCD 0 ; Reserved + DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break Interrupt and TIM12 global interrupt + DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update Interrupt and TIM13 global interrupt + DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation Interrupt and TIM14 global interrupt + DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare Interrupt + DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 + DCD FMC_IRQHandler ; FMC + DCD SDMMC1_IRQHandler ; SDMMC1 + DCD TIM5_IRQHandler ; TIM5 + DCD SPI3_IRQHandler ; SPI3 + DCD UART4_IRQHandler ; UART4 + DCD UART5_IRQHandler ; UART5 + DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors + DCD TIM7_IRQHandler ; TIM7 + DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 + DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 + DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 + DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 + DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 + DCD ETH_IRQHandler ; Ethernet + DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line + DCD FDCAN_CAL_IRQHandler ; FDCAN calibration unit interrupt + DCD CM7_SEV_IRQHandler ; CM7 Send event interrupt for CM4 + DCD CM4_SEV_IRQHandler ; CM4 Send event interrupt for CM7 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 + DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 + DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 + DCD USART6_IRQHandler ; USART6 + DCD I2C3_EV_IRQHandler ; I2C3 event + DCD I2C3_ER_IRQHandler ; I2C3 error + DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out + DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In + DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI + DCD OTG_HS_IRQHandler ; USB OTG HS + DCD DCMI_IRQHandler ; DCMI + DCD 0 ; Reserved + DCD RNG_IRQHandler ; Rng + DCD FPU_IRQHandler ; FPU + DCD UART7_IRQHandler ; UART7 + DCD UART8_IRQHandler ; UART8 + DCD SPI4_IRQHandler ; SPI4 + DCD SPI5_IRQHandler ; SPI5 + DCD SPI6_IRQHandler ; SPI6 + DCD SAI1_IRQHandler ; SAI1 + DCD LTDC_IRQHandler ; LTDC + DCD LTDC_ER_IRQHandler ; LTDC error + DCD DMA2D_IRQHandler ; DMA2D + DCD SAI2_IRQHandler ; SAI2 + DCD QUADSPI_IRQHandler ; QUADSPI + DCD LPTIM1_IRQHandler ; LPTIM1 + DCD CEC_IRQHandler ; HDMI_CEC + DCD I2C4_EV_IRQHandler ; I2C4 Event + DCD I2C4_ER_IRQHandler ; I2C4 Error + DCD SPDIF_RX_IRQHandler ; SPDIF_RX + DCD OTG_FS_EP1_OUT_IRQHandler ; USB OTG FS End Point 1 Out + DCD OTG_FS_EP1_IN_IRQHandler ; USB OTG FS End Point 1 In + DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI + DCD OTG_FS_IRQHandler ; USB OTG FS + DCD DMAMUX1_OVR_IRQHandler ; DMAMUX1 Overrun interrupt + DCD HRTIM1_Master_IRQHandler ; HRTIM Master Timer global Interrupts + DCD HRTIM1_TIMA_IRQHandler ; HRTIM Timer A global Interrupt + DCD HRTIM1_TIMB_IRQHandler ; HRTIM Timer B global Interrupt + DCD HRTIM1_TIMC_IRQHandler ; HRTIM Timer C global Interrupt + DCD HRTIM1_TIMD_IRQHandler ; HRTIM Timer D global Interrupt + DCD HRTIM1_TIME_IRQHandler ; HRTIM Timer E global Interrupt + DCD HRTIM1_FLT_IRQHandler ; HRTIM Fault global Interrupt + DCD DFSDM1_FLT0_IRQHandler ; DFSDM Filter0 Interrupt + DCD DFSDM1_FLT1_IRQHandler ; DFSDM Filter1 Interrupt + DCD DFSDM1_FLT2_IRQHandler ; DFSDM Filter2 Interrupt + DCD DFSDM1_FLT3_IRQHandler ; DFSDM Filter3 Interrupt + DCD SAI3_IRQHandler ; SAI3 global Interrupt + DCD SWPMI1_IRQHandler ; Serial Wire Interface 1 global interrupt + DCD TIM15_IRQHandler ; TIM15 global Interrupt + DCD TIM16_IRQHandler ; TIM16 global Interrupt + DCD TIM17_IRQHandler ; TIM17 global Interrupt + DCD MDIOS_WKUP_IRQHandler ; MDIOS Wakeup Interrupt + DCD MDIOS_IRQHandler ; MDIOS global Interrupt + DCD JPEG_IRQHandler ; JPEG global Interrupt + DCD MDMA_IRQHandler ; MDMA global Interrupt + DCD 0 ; Reserved + DCD SDMMC2_IRQHandler ; SDMMC2 global Interrupt + DCD HSEM1_IRQHandler ; HSEM1 global Interrupt + DCD HSEM2_IRQHandler ; HSEM2 global Interrupt + DCD ADC3_IRQHandler ; ADC3 global Interrupt + DCD DMAMUX2_OVR_IRQHandler ; DMAMUX Overrun interrupt + DCD BDMA_Channel0_IRQHandler ; BDMA Channel 0 global Interrupt + DCD BDMA_Channel1_IRQHandler ; BDMA Channel 1 global Interrupt + DCD BDMA_Channel2_IRQHandler ; BDMA Channel 2 global Interrupt + DCD BDMA_Channel3_IRQHandler ; BDMA Channel 3 global Interrupt + DCD BDMA_Channel4_IRQHandler ; BDMA Channel 4 global Interrupt + DCD BDMA_Channel5_IRQHandler ; BDMA Channel 5 global Interrupt + DCD BDMA_Channel6_IRQHandler ; BDMA Channel 6 global Interrupt + DCD BDMA_Channel7_IRQHandler ; BDMA Channel 7 global Interrupt + DCD COMP1_IRQHandler ; COMP1 global Interrupt + DCD LPTIM2_IRQHandler ; LP TIM2 global interrupt + DCD LPTIM3_IRQHandler ; LP TIM3 global interrupt + DCD LPTIM4_IRQHandler ; LP TIM4 global interrupt + DCD LPTIM5_IRQHandler ; LP TIM5 global interrupt + DCD LPUART1_IRQHandler ; LP UART1 interrupt + DCD WWDG_RST_IRQHandler ; Window Watchdog reset interrupt (exti_d2_wwdg_it, exti_d1_wwdg_it) + DCD CRS_IRQHandler ; Clock Recovery Global Interrupt + DCD ECC_IRQHandler ; ECC diagnostic Global Interrupt + DCD SAI4_IRQHandler ; SAI4 global interrupt + DCD 0 ; Reserved + DCD HOLD_CORE_IRQHandler ; Hold core interrupt + DCD WAKEUP_PIN_IRQHandler ; Interrupt for all 6 wake-up pins + + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + + AREA |.text|, CODE, READONLY + +; Reset handler +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT SystemInit + IMPORT __main + + LDR R0, =SystemInit + BLX R0 + LDR R0, =__main + BX R0 + ENDP + +; Dummy Exception Handlers (infinite loops which can be modified) + +NMI_Handler PROC + EXPORT NMI_Handler [WEAK] + B . + ENDP +HardFault_Handler\ + PROC + EXPORT HardFault_Handler [WEAK] + B . + ENDP +MemManage_Handler\ + PROC + EXPORT MemManage_Handler [WEAK] + B . + ENDP +BusFault_Handler\ + PROC + EXPORT BusFault_Handler [WEAK] + B . + ENDP +UsageFault_Handler\ + PROC + EXPORT UsageFault_Handler [WEAK] + B . + ENDP +SVC_Handler PROC + EXPORT SVC_Handler [WEAK] + B . + ENDP +DebugMon_Handler\ + PROC + EXPORT DebugMon_Handler [WEAK] + B . + ENDP +PendSV_Handler PROC + EXPORT PendSV_Handler [WEAK] + B . + ENDP +SysTick_Handler PROC + EXPORT SysTick_Handler [WEAK] + B . + ENDP + +Default_Handler PROC + + EXPORT WWDG_IRQHandler [WEAK] + EXPORT PVD_AVD_IRQHandler [WEAK] + EXPORT TAMP_STAMP_IRQHandler [WEAK] + EXPORT RTC_WKUP_IRQHandler [WEAK] + EXPORT FLASH_IRQHandler [WEAK] + EXPORT RCC_IRQHandler [WEAK] + EXPORT EXTI0_IRQHandler [WEAK] + EXPORT EXTI1_IRQHandler [WEAK] + EXPORT EXTI2_IRQHandler [WEAK] + EXPORT EXTI3_IRQHandler [WEAK] + EXPORT EXTI4_IRQHandler [WEAK] + EXPORT DMA1_Stream0_IRQHandler [WEAK] + EXPORT DMA1_Stream1_IRQHandler [WEAK] + EXPORT DMA1_Stream2_IRQHandler [WEAK] + EXPORT DMA1_Stream3_IRQHandler [WEAK] + EXPORT DMA1_Stream4_IRQHandler [WEAK] + EXPORT DMA1_Stream5_IRQHandler [WEAK] + EXPORT DMA1_Stream6_IRQHandler [WEAK] + EXPORT DMA1_Stream7_IRQHandler [WEAK] + EXPORT ADC_IRQHandler [WEAK] + EXPORT FDCAN1_IT0_IRQHandler [WEAK] + EXPORT FDCAN2_IT0_IRQHandler [WEAK] + EXPORT FDCAN1_IT1_IRQHandler [WEAK] + EXPORT FDCAN2_IT1_IRQHandler [WEAK] + EXPORT EXTI9_5_IRQHandler [WEAK] + EXPORT TIM1_BRK_IRQHandler [WEAK] + EXPORT TIM1_UP_IRQHandler [WEAK] + EXPORT TIM1_TRG_COM_IRQHandler [WEAK] + EXPORT TIM1_CC_IRQHandler [WEAK] + EXPORT TIM2_IRQHandler [WEAK] + EXPORT TIM3_IRQHandler [WEAK] + EXPORT TIM4_IRQHandler [WEAK] + EXPORT I2C1_EV_IRQHandler [WEAK] + EXPORT I2C1_ER_IRQHandler [WEAK] + EXPORT I2C2_EV_IRQHandler [WEAK] + EXPORT I2C2_ER_IRQHandler [WEAK] + EXPORT SPI1_IRQHandler [WEAK] + EXPORT SPI2_IRQHandler [WEAK] + EXPORT USART1_IRQHandler [WEAK] + EXPORT USART2_IRQHandler [WEAK] + EXPORT USART3_IRQHandler [WEAK] + EXPORT EXTI15_10_IRQHandler [WEAK] + EXPORT RTC_Alarm_IRQHandler [WEAK] + EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] + EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] + EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] + EXPORT TIM8_CC_IRQHandler [WEAK] + EXPORT DMA1_Stream7_IRQHandler [WEAK] + EXPORT FMC_IRQHandler [WEAK] + EXPORT SDMMC1_IRQHandler [WEAK] + EXPORT TIM5_IRQHandler [WEAK] + EXPORT SPI3_IRQHandler [WEAK] + EXPORT UART4_IRQHandler [WEAK] + EXPORT UART5_IRQHandler [WEAK] + EXPORT TIM6_DAC_IRQHandler [WEAK] + EXPORT TIM7_IRQHandler [WEAK] + EXPORT DMA2_Stream0_IRQHandler [WEAK] + EXPORT DMA2_Stream1_IRQHandler [WEAK] + EXPORT DMA2_Stream2_IRQHandler [WEAK] + EXPORT DMA2_Stream3_IRQHandler [WEAK] + EXPORT DMA2_Stream4_IRQHandler [WEAK] + EXPORT ETH_IRQHandler [WEAK] + EXPORT ETH_WKUP_IRQHandler [WEAK] + EXPORT FDCAN_CAL_IRQHandler [WEAK] + EXPORT CM7_SEV_IRQHandler [WEAK] + EXPORT CM4_SEV_IRQHandler [WEAK] + EXPORT DMA2_Stream5_IRQHandler [WEAK] + EXPORT DMA2_Stream6_IRQHandler [WEAK] + EXPORT DMA2_Stream7_IRQHandler [WEAK] + EXPORT USART6_IRQHandler [WEAK] + EXPORT I2C3_EV_IRQHandler [WEAK] + EXPORT I2C3_ER_IRQHandler [WEAK] + EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] + EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] + EXPORT OTG_HS_WKUP_IRQHandler [WEAK] + EXPORT OTG_HS_IRQHandler [WEAK] + EXPORT DCMI_IRQHandler [WEAK] + EXPORT RNG_IRQHandler [WEAK] + EXPORT FPU_IRQHandler [WEAK] + EXPORT UART7_IRQHandler [WEAK] + EXPORT UART8_IRQHandler [WEAK] + EXPORT SPI4_IRQHandler [WEAK] + EXPORT SPI5_IRQHandler [WEAK] + EXPORT SPI6_IRQHandler [WEAK] + EXPORT SAI1_IRQHandler [WEAK] + EXPORT LTDC_IRQHandler [WEAK] + EXPORT LTDC_ER_IRQHandler [WEAK] + EXPORT DMA2D_IRQHandler [WEAK] + EXPORT SAI2_IRQHandler [WEAK] + EXPORT QUADSPI_IRQHandler [WEAK] + EXPORT LPTIM1_IRQHandler [WEAK] + EXPORT CEC_IRQHandler [WEAK] + EXPORT I2C4_EV_IRQHandler [WEAK] + EXPORT I2C4_ER_IRQHandler [WEAK] + EXPORT SPDIF_RX_IRQHandler [WEAK] + EXPORT OTG_FS_EP1_OUT_IRQHandler [WEAK] + EXPORT OTG_FS_EP1_IN_IRQHandler [WEAK] + EXPORT OTG_FS_WKUP_IRQHandler [WEAK] + EXPORT OTG_FS_IRQHandler [WEAK] + EXPORT DMAMUX1_OVR_IRQHandler [WEAK] + EXPORT HRTIM1_Master_IRQHandler [WEAK] + EXPORT HRTIM1_TIMA_IRQHandler [WEAK] + EXPORT HRTIM1_TIMB_IRQHandler [WEAK] + EXPORT HRTIM1_TIMC_IRQHandler [WEAK] + EXPORT HRTIM1_TIMD_IRQHandler [WEAK] + EXPORT HRTIM1_TIME_IRQHandler [WEAK] + EXPORT HRTIM1_FLT_IRQHandler [WEAK] + EXPORT DFSDM1_FLT0_IRQHandler [WEAK] + EXPORT DFSDM1_FLT1_IRQHandler [WEAK] + EXPORT DFSDM1_FLT2_IRQHandler [WEAK] + EXPORT DFSDM1_FLT3_IRQHandler [WEAK] + EXPORT SAI3_IRQHandler [WEAK] + EXPORT SWPMI1_IRQHandler [WEAK] + EXPORT TIM15_IRQHandler [WEAK] + EXPORT TIM16_IRQHandler [WEAK] + EXPORT TIM17_IRQHandler [WEAK] + EXPORT MDIOS_WKUP_IRQHandler [WEAK] + EXPORT MDIOS_IRQHandler [WEAK] + EXPORT JPEG_IRQHandler [WEAK] + EXPORT MDMA_IRQHandler [WEAK] + EXPORT SDMMC2_IRQHandler [WEAK] + EXPORT HSEM1_IRQHandler [WEAK] + EXPORT HSEM2_IRQHandler [WEAK] + EXPORT ADC3_IRQHandler [WEAK] + EXPORT DMAMUX2_OVR_IRQHandler [WEAK] + EXPORT BDMA_Channel0_IRQHandler [WEAK] + EXPORT BDMA_Channel1_IRQHandler [WEAK] + EXPORT BDMA_Channel2_IRQHandler [WEAK] + EXPORT BDMA_Channel3_IRQHandler [WEAK] + EXPORT BDMA_Channel4_IRQHandler [WEAK] + EXPORT BDMA_Channel5_IRQHandler [WEAK] + EXPORT BDMA_Channel6_IRQHandler [WEAK] + EXPORT BDMA_Channel7_IRQHandler [WEAK] + EXPORT COMP1_IRQHandler [WEAK] + EXPORT LPTIM2_IRQHandler [WEAK] + EXPORT LPTIM3_IRQHandler [WEAK] + EXPORT LPTIM4_IRQHandler [WEAK] + EXPORT LPTIM5_IRQHandler [WEAK] + EXPORT LPUART1_IRQHandler [WEAK] + EXPORT WWDG_RST_IRQHandler [WEAK] + EXPORT CRS_IRQHandler [WEAK] + EXPORT ECC_IRQHandler [WEAK] + EXPORT SAI4_IRQHandler [WEAK] + EXPORT HOLD_CORE_IRQHandler [WEAK] + EXPORT WAKEUP_PIN_IRQHandler [WEAK] + + +WWDG_IRQHandler +PVD_AVD_IRQHandler +TAMP_STAMP_IRQHandler +RTC_WKUP_IRQHandler +FLASH_IRQHandler +RCC_IRQHandler +EXTI0_IRQHandler +EXTI1_IRQHandler +EXTI2_IRQHandler +EXTI3_IRQHandler +EXTI4_IRQHandler +DMA1_Stream0_IRQHandler +DMA1_Stream1_IRQHandler +DMA1_Stream2_IRQHandler +DMA1_Stream3_IRQHandler +DMA1_Stream4_IRQHandler +DMA1_Stream5_IRQHandler +DMA1_Stream6_IRQHandler +ADC_IRQHandler +FDCAN1_IT0_IRQHandler +FDCAN2_IT0_IRQHandler +FDCAN1_IT1_IRQHandler +FDCAN2_IT1_IRQHandler +EXTI9_5_IRQHandler +TIM1_BRK_IRQHandler +TIM1_UP_IRQHandler +TIM1_TRG_COM_IRQHandler +TIM1_CC_IRQHandler +TIM2_IRQHandler +TIM3_IRQHandler +TIM4_IRQHandler +I2C1_EV_IRQHandler +I2C1_ER_IRQHandler +I2C2_EV_IRQHandler +I2C2_ER_IRQHandler +SPI1_IRQHandler +SPI2_IRQHandler +USART1_IRQHandler +USART2_IRQHandler +USART3_IRQHandler +EXTI15_10_IRQHandler +RTC_Alarm_IRQHandler +TIM8_BRK_TIM12_IRQHandler +TIM8_UP_TIM13_IRQHandler +TIM8_TRG_COM_TIM14_IRQHandler +TIM8_CC_IRQHandler +DMA1_Stream7_IRQHandler +FMC_IRQHandler +SDMMC1_IRQHandler +TIM5_IRQHandler +SPI3_IRQHandler +UART4_IRQHandler +UART5_IRQHandler +TIM6_DAC_IRQHandler +TIM7_IRQHandler +DMA2_Stream0_IRQHandler +DMA2_Stream1_IRQHandler +DMA2_Stream2_IRQHandler +DMA2_Stream3_IRQHandler +DMA2_Stream4_IRQHandler +ETH_IRQHandler +ETH_WKUP_IRQHandler +FDCAN_CAL_IRQHandler +CM7_SEV_IRQHandler +CM4_SEV_IRQHandler +DMA2_Stream5_IRQHandler +DMA2_Stream6_IRQHandler +DMA2_Stream7_IRQHandler +USART6_IRQHandler +I2C3_EV_IRQHandler +I2C3_ER_IRQHandler +OTG_HS_EP1_OUT_IRQHandler +OTG_HS_EP1_IN_IRQHandler +OTG_HS_WKUP_IRQHandler +OTG_HS_IRQHandler +DCMI_IRQHandler +RNG_IRQHandler +FPU_IRQHandler +UART7_IRQHandler +UART8_IRQHandler +SPI4_IRQHandler +SPI5_IRQHandler +SPI6_IRQHandler +SAI1_IRQHandler +LTDC_IRQHandler +LTDC_ER_IRQHandler +DMA2D_IRQHandler +SAI2_IRQHandler +QUADSPI_IRQHandler +LPTIM1_IRQHandler +CEC_IRQHandler +I2C4_EV_IRQHandler +I2C4_ER_IRQHandler +SPDIF_RX_IRQHandler +OTG_FS_EP1_OUT_IRQHandler +OTG_FS_EP1_IN_IRQHandler +OTG_FS_WKUP_IRQHandler +OTG_FS_IRQHandler +DMAMUX1_OVR_IRQHandler +HRTIM1_Master_IRQHandler +HRTIM1_TIMA_IRQHandler +HRTIM1_TIMB_IRQHandler +HRTIM1_TIMC_IRQHandler +HRTIM1_TIMD_IRQHandler +HRTIM1_TIME_IRQHandler +HRTIM1_FLT_IRQHandler +DFSDM1_FLT0_IRQHandler +DFSDM1_FLT1_IRQHandler +DFSDM1_FLT2_IRQHandler +DFSDM1_FLT3_IRQHandler +SAI3_IRQHandler +SWPMI1_IRQHandler +TIM15_IRQHandler +TIM16_IRQHandler +TIM17_IRQHandler +MDIOS_WKUP_IRQHandler +MDIOS_IRQHandler +JPEG_IRQHandler +MDMA_IRQHandler +SDMMC2_IRQHandler +HSEM1_IRQHandler +HSEM2_IRQHandler +ADC3_IRQHandler +DMAMUX2_OVR_IRQHandler +BDMA_Channel0_IRQHandler +BDMA_Channel1_IRQHandler +BDMA_Channel2_IRQHandler +BDMA_Channel3_IRQHandler +BDMA_Channel4_IRQHandler +BDMA_Channel5_IRQHandler +BDMA_Channel6_IRQHandler +BDMA_Channel7_IRQHandler +COMP1_IRQHandler +LPTIM2_IRQHandler +LPTIM3_IRQHandler +LPTIM4_IRQHandler +LPTIM5_IRQHandler +LPUART1_IRQHandler +WWDG_RST_IRQHandler +CRS_IRQHandler +ECC_IRQHandler +SAI4_IRQHandler +HOLD_CORE_IRQHandler +WAKEUP_PIN_IRQHandler + + B . + + ENDP + + ALIGN + +;******************************************************************************* +; User Stack and Heap initialization +;******************************************************************************* + IF :DEF:__MICROLIB + + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap + +__user_initial_stackheap + + LDR R0, = Heap_Mem + LDR R1, =(Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END + +;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE***** diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvoptx b/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvoptx new file mode 100644 index 0000000000..29beeed454 --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvoptx @@ -0,0 +1,1225 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + appl-can-stlink + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\lst\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 0 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 6 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 ) -FN1 -FC8000 -FD10000000 -FF0STM32H7x_2048 -FL0200000 -FS08000000 -FP0($$Device:STM32H745IIKx$CMSIS\Flash\STM32H7x_2048.FLM) + + + 0 + ST-LINKIII-KEIL_SWO + -U002E00303137510A39383538 -O206 -SF10000 -C0 -A3 -I0 -HNlocalhost -HP7184 -P1 -N00("") -D00(00000000) -L00(0) -TO131091 -TC200000000 -TT10000000 -TP21 -TDS8010 -TDT0 -TDC1F -TIE80000001 -TIP9 -FO7 -FD10000000 -FC8000 -FN1 -FF0STM32H7x_2048.FLM -FS08000000 -FL0200000 -FP0($$Device:STM32H745IIKx$CMSIS\Flash\STM32H7x_2048.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2 + + + 0 + ARMRTXEVENTFLAGS + -L200 -Z20 -C0 -M1 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + + + 0 + 0 + 123 + 1 +
135288800
+ 0 + 0 + 0 + 0 + 0 + 1 + C:\ace\!mar\icub-firmware\emBODY\eBcode\arch-arm\board\amc2c\application\src\main-basic.cpp + + \\h7disco\../src/main-basic.cpp\123 +
+ + 1 + 0 + 115 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + C:\ace\!mar\icub-firmware\emBODY\eBcode\arch-arm\board\amc2c\application\src\main-basic.cpp + + +
+ + 2 + 0 + 113 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + C:\ace\!mar\icub-firmware\emBODY\eBcode\arch-arm\board\amc2c\application\src\main-basic.cpp + + +
+
+ + + 0 + 1 + osthread + + + 1 + 1 + tmr + + + 2 + 1 + _internals.cfg->isr_queue,0x10 + + + 3 + 1 + errormsg + + + 4 + 1 + errormsg + + + 5 + 1 + errormsg + + + 6 + 1 + pImpl + + + 7 + 1 + largestack + + + 8 + 1 + frame + + + 9 + 1 + hfdcan + + + + + 0 + 2 + osRtxInfo + + + + + 1 + 0 + 0x20003134 + 0 + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + 1 + 0 + 0 + 2 + 10000000 + +
+
+ + + appl-can-ulpro + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\lst\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 1 + + + + + + + + + + + BIN\ULP2CM3.DLL + + + + 0 + ULP2CM3 + -UAny -O206 -S8 -C0 -P00000003 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO65555 -TC200000000 -TT10000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE80000001 -TIP9 -FO7 -FD10000000 -FC8000 -FN1 -FF0STM32H7x_2048.FLM -FS08000000 -FL0200000 -FP0($$Device:STM32H745IIKx$CMSIS\Flash\STM32H7x_2048.FLM) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 ) -FN1 -FC8000 -FD10000000 -FF0STM32H7x_2048 -FL0200000 -FS08000000 -FP0($$Device:STM32H745IIKx$CMSIS\Flash\STM32H7x_2048.FLM) + + + 0 + ST-LINKIII-KEIL_SWO + -U002E00303137510A39383538 -O206 -SF10000 -C0 -A3 -I0 -HNlocalhost -HP7184 -P1 -N00("") -D00(00000000) -L00(0) -TO131091 -TC200000000 -TT10000000 -TP21 -TDS8010 -TDT0 -TDC1F -TIE80000001 -TIP9 -FO7 -FD10000000 -FC8000 -FN1 -FF0STM32H7x_2048.FLM -FS08000000 -FL0200000 -FP0($$Device:STM32H745IIKx$CMSIS\Flash\STM32H7x_2048.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2 + + + 0 + ARMRTXEVENTFLAGS + -L200 -Z20 -C0 -M1 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + + + + + + 0 + 0 + 118 + 1 +
135305896
+ 0 + 0 + 0 + 0 + 0 + 1 + C:\ace\!mar\icub-firmware\emBODY\eBcode\arch-arm\board\amcbldc\code\embot_app_amcbldc_theApplication.cpp + + \\amc2c\../../../amcbldc/code/embot_app_amcbldc_theApplication.cpp\118 +
+
+ + + 0 + 2 + osRtxInfo + + + + + 1 + 0 + 0x20003134 + 0 + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + 1 + 0 + 0 + 2 + 10000000 + +
+
+ + + main + 1 + 0 + 0 + 0 + + 1 + 1 + 8 + 0 + 0 + 0 + ..\src\amc2c-main2.cpp + amc2c-main2.cpp + 0 + 0 + + + + + embot::app::board::amc2c + 1 + 0 + 0 + 0 + + 2 + 2 + 8 + 0 + 0 + 0 + ..\src\app-board-amc2c\embot_app_board_amc2c_info.cpp + embot_app_board_amc2c_info.cpp + 0 + 0 + + + 2 + 3 + 8 + 0 + 0 + 0 + ..\src\app-board-amc2c\embot_app_board_amc2c_mbd.demo.cpp + embot_app_board_amc2c_mbd.demo.cpp + 0 + 0 + + + 2 + 4 + 8 + 0 + 0 + 0 + ..\src\app-board-amc2c\embot_app_board_amc2c_theCANagentCORE.cpp + embot_app_board_amc2c_theCANagentCORE.cpp + 0 + 0 + + + + + embot::app::bldc + 1 + 0 + 0 + 0 + + 3 + 5 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theApplication.cpp + embot_app_bldc_theApplication.cpp + 0 + 0 + + + 3 + 6 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCOMM.cpp + embot_app_bldc_theCOMM.cpp + 0 + 0 + + + 3 + 7 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCTRL.cpp + embot_app_bldc_theCTRL.cpp + 0 + 0 + + + 3 + 8 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theMSGbroker.cpp + embot_app_bldc_theMSGbroker.cpp + 0 + 0 + + + + + embot::app::application + 0 + 0 + 0 + 0 + + 4 + 9 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\embot_app_theLEDmanager.cpp + embot_app_theLEDmanager.cpp + 0 + 0 + + + 4 + 10 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\embot_app_application_theCANparserCORE.cpp + embot_app_application_theCANparserCORE.cpp + 0 + 0 + + + 4 + 11 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\embot_app_application_theCANtracer.cpp + embot_app_application_theCANtracer.cpp + 0 + 0 + + + 4 + 12 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\embot_app_scope.cpp + embot_app_scope.cpp + 0 + 0 + + + + + stm32hal + 0 + 0 + 0 + 0 + + 5 + 13 + 4 + 0 + 0 + 0 + ..\..\..\..\libs\lowlevel\stm32hal\lib\stm32hal.h7.amc2c.v1A0.lib + stm32hal.h7.amc2c.v1A0.lib + 0 + 0 + + + 5 + 14 + 2 + 0 + 0 + 0 + ..\cfg\stm32hal.h7.startup.amc.CM4.s + stm32hal.h7.startup.amc.CM4.s + 0 + 0 + + + + + rtos + 0 + 0 + 0 + 0 + + 6 + 15 + 4 + 0 + 0 + 0 + ..\..\..\..\libs\highlevel\abslayer\osal\lib\osal.cm4.dbg.lib + osal.cm4.dbg.lib + 0 + 0 + + + 6 + 16 + 1 + 0 + 0 + 0 + ..\..\..\..\libs\midware\eventviewer\src\eventviewer.c + eventviewer.c + 0 + 0 + + + + + embot::core + 0 + 0 + 0 + 0 + + 7 + 17 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core.cpp + embot_core.cpp + 0 + 0 + + + 7 + 18 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core_binary.cpp + embot_core_binary.cpp + 0 + 0 + + + + + embot::tools + 0 + 0 + 0 + 0 + + 8 + 19 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools\embot_tools.cpp + embot_tools.cpp + 0 + 0 + + + + + embot::hw + 1 + 0 + 0 + 0 + + 9 + 20 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw.cpp + embot_hw.cpp + 0 + 0 + + + 9 + 21 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_bsp.cpp + embot_hw_bsp.cpp + 0 + 0 + + + 9 + 22 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_gpio.cpp + embot_hw_gpio.cpp + 0 + 0 + + + 9 + 23 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_led.cpp + embot_hw_led.cpp + 0 + 0 + + + 9 + 24 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_sys.cpp + embot_hw_sys.cpp + 0 + 0 + + + 9 + 25 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_button.cpp + embot_hw_button.cpp + 0 + 0 + + + 9 + 26 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_can.cpp + embot_hw_can.cpp + 0 + 0 + + + 9 + 27 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_flash.cpp + embot_hw_flash.cpp + 0 + 0 + + + 9 + 28 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_spi.cpp + embot_hw_spi.cpp + 0 + 0 + + + 9 + 29 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_timer.cpp + embot_hw_timer.cpp + 0 + 0 + + + 9 + 30 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_types.cpp + embot_hw_types.cpp + 0 + 0 + + + + + embot::hw::lowlevel-0optimized + 0 + 0 + 0 + 0 + + 10 + 31 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_lowlevel.cpp + embot_hw_lowlevel.cpp + 0 + 0 + + + + + embot::hw::bsp + 0 + 0 + 0 + 0 + + 11 + 32 + 8 + 0 + 0 + 0 + ..\..\bsp\embot_hw_bsp_amc2c.cpp + embot_hw_bsp_amc2c.cpp + 0 + 0 + + + + + embot::os + 0 + 0 + 0 + 0 + + 12 + 33 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\os\embot_os.cpp + embot_os.cpp + 0 + 0 + + + 12 + 34 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\os\embot_os_Action.cpp + embot_os_Action.cpp + 0 + 0 + + + 12 + 35 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\os\embot_os_theCallbackManager.cpp + embot_os_theCallbackManager.cpp + 0 + 0 + + + 12 + 36 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\os\embot_os_theScheduler.cpp + embot_os_theScheduler.cpp + 0 + 0 + + + 12 + 37 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\os\embot_os_theTimerManager.cpp + embot_os_theTimerManager.cpp + 0 + 0 + + + 12 + 38 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\os\embot_os_Thread.cpp + embot_os_Thread.cpp + 0 + 0 + + + 12 + 39 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\os\embot_os_Timer.cpp + embot_os_Timer.cpp + 0 + 0 + + + 12 + 40 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\os\embot_os_rtos.cpp + embot_os_rtos.cpp + 0 + 0 + + + + + embot::prot::can + 0 + 0 + 0 + 0 + + 13 + 41 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\prot\can\embot_prot_can.cpp + embot_prot_can.cpp + 0 + 0 + + + 13 + 42 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\prot\can\embot_prot_can_analog_periodic.cpp + embot_prot_can_analog_periodic.cpp + 0 + 0 + + + 13 + 43 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\prot\can\embot_prot_can_analog_polling.cpp + embot_prot_can_analog_polling.cpp + 0 + 0 + + + 13 + 44 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\prot\can\embot_prot_can_bootloader.cpp + embot_prot_can_bootloader.cpp + 0 + 0 + + + 13 + 45 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\prot\can\embot_prot_can_inertial_periodic.cpp + embot_prot_can_inertial_periodic.cpp + 0 + 0 + + + 13 + 46 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\prot\can\embot_prot_can_motor_periodic.cpp + embot_prot_can_motor_periodic.cpp + 0 + 0 + + + 13 + 47 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\prot\can\embot_prot_can_motor_polling.cpp + embot_prot_can_motor_polling.cpp + 0 + 0 + + + 13 + 48 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\prot\can\embot_prot_can_skin_periodic.cpp + embot_prot_can_skin_periodic.cpp + 0 + 0 + + + + + mbd:: to be added + 1 + 0 + 0 + 0 + + +
diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvprojx b/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvprojx new file mode 100644 index 0000000000..adbb49f530 --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/proj/amc2c-appl-can.uvprojx @@ -0,0 +1,1739 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + appl-can-stlink + 0x4 + ARM-ADS + 6190000::V6.19::ARMCLANG + 1 + + + STM32H745IIKx:CM4 + STMicroelectronics + Keil.STM32H7xx_DFP.3.0.0 + http://www.keil.com/pack/ + IRAM(0x10000000,0x00048000) IROM(0x08100000,0x00100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD10000000 -FC8000 -FN1 -FF0STM32H7x_2048 -FS08000000 -FL0200000 -FP0($$Device:STM32H745IIKx$CMSIS\Flash\STM32H7x_2048.FLM)) + 0 + $$Device:STM32H745IIKx$Drivers\CMSIS\Device\ST\STM32H7xx\Include\stm32h7xx.h + + + + + + + + + + $$Device:STM32H745IIKx$CMSIS\SVD\STM32H745_CM4.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\obj\ + amc2c + 1 + 0 + 1 + 1 + 1 + .\lst\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 0 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x10000000 + 0x48000 + + + 1 + 0x8100000 + 0x100000 + + + 1 + 0x20000000 + 0x20000 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8100000 + 0x100000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x10000000 + 0x48000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 2 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 1 + 0 + 0 + 0 + 3 + 8 + 1 + 1 + 0 + 0 + 0 + + -Wno-pragma-pack -Wno-deprecated-register -DEMBOT_USE_rtos_osal + USE_STM32HAL STM32HAL_BOARD_AMC2C STM32HAL_DRIVER_V1A0 + + ..\..\..\..\libs\lowlevel\stm32hal\api;..\..\..\..\libs\highlevel\abslayer\osal\api;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core;..\..\..\..\embot\hw;..\..\..\..\embot\os;..\..\..\..\embot\app;..\..\..\..\embot\app;..\..\..\..\libs\midware\eventviewer\api;..\..\..\..\libs\highlevel\services\embenv\api;..\..\..\..\embot\prot\can;..\..\..\amcbldc\code;..\..\..\..\..\..\..\..\icub-firmware-shared\can\canProtocolLib;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools;..\..\bsp;..\..\code + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + ..\cfg\amc2c-template-appl.sct + + + --diag_suppress=L6329 + + + + + + + + main + + + amc2c-main2.cpp + 8 + ..\src\amc2c-main2.cpp + + + + + embot::app::board::amc2c + + + embot_app_board_amc2c_info.cpp + 8 + ..\src\app-board-amc2c\embot_app_board_amc2c_info.cpp + + + embot_app_board_amc2c_mbd.demo.cpp + 8 + ..\src\app-board-amc2c\embot_app_board_amc2c_mbd.demo.cpp + + + embot_app_board_amc2c_theCANagentCORE.cpp + 8 + ..\src\app-board-amc2c\embot_app_board_amc2c_theCANagentCORE.cpp + + + + + embot::app::bldc + + + embot_app_bldc_theApplication.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theApplication.cpp + + + embot_app_bldc_theCOMM.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCOMM.cpp + + + embot_app_bldc_theCTRL.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCTRL.cpp + + + embot_app_bldc_theMSGbroker.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theMSGbroker.cpp + + + + + embot::app::application + + + embot_app_theLEDmanager.cpp + 8 + ..\..\..\..\embot\app\embot_app_theLEDmanager.cpp + + + embot_app_application_theCANparserCORE.cpp + 8 + ..\..\..\..\embot\app\embot_app_application_theCANparserCORE.cpp + + + embot_app_application_theCANtracer.cpp + 8 + ..\..\..\..\embot\app\embot_app_application_theCANtracer.cpp + + + embot_app_scope.cpp + 8 + ..\..\..\..\embot\app\embot_app_scope.cpp + + + + + stm32hal + + + stm32hal.h7.amc2c.v1A0.lib + 4 + ..\..\..\..\libs\lowlevel\stm32hal\lib\stm32hal.h7.amc2c.v1A0.lib + + + stm32hal.h7.startup.amc.CM4.s + 2 + ..\cfg\stm32hal.h7.startup.amc.CM4.s + + + + + rtos + + + osal.cm4.dbg.lib + 4 + ..\..\..\..\libs\highlevel\abslayer\osal\lib\osal.cm4.dbg.lib + + + eventviewer.c + 1 + ..\..\..\..\libs\midware\eventviewer\src\eventviewer.c + + + + + embot::core + + + embot_core.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core.cpp + + + embot_core_binary.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core_binary.cpp + + + + + embot::tools + + + embot_tools.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools\embot_tools.cpp + + + + + embot::hw + + + embot_hw.cpp + 8 + ..\..\..\..\embot\hw\embot_hw.cpp + + + embot_hw_bsp.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_bsp.cpp + + + embot_hw_gpio.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_gpio.cpp + + + embot_hw_led.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_led.cpp + + + embot_hw_sys.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_sys.cpp + + + embot_hw_button.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_button.cpp + + + embot_hw_can.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_can.cpp + + + embot_hw_flash.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_flash.cpp + + + embot_hw_spi.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_spi.cpp + + + embot_hw_timer.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_timer.cpp + + + embot_hw_types.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_types.cpp + + + + + embot::hw::lowlevel-0optimized + + + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + + + + embot_hw_lowlevel.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_lowlevel.cpp + + + 2 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + + + + + + embot::hw::bsp + + + embot_hw_bsp_amc2c.cpp + 8 + ..\..\bsp\embot_hw_bsp_amc2c.cpp + + + + + embot::os + + + embot_os.cpp + 8 + ..\..\..\..\embot\os\embot_os.cpp + + + embot_os_Action.cpp + 8 + ..\..\..\..\embot\os\embot_os_Action.cpp + + + embot_os_theCallbackManager.cpp + 8 + ..\..\..\..\embot\os\embot_os_theCallbackManager.cpp + + + embot_os_theScheduler.cpp + 8 + ..\..\..\..\embot\os\embot_os_theScheduler.cpp + + + embot_os_theTimerManager.cpp + 8 + ..\..\..\..\embot\os\embot_os_theTimerManager.cpp + + + embot_os_Thread.cpp + 8 + ..\..\..\..\embot\os\embot_os_Thread.cpp + + + embot_os_Timer.cpp + 8 + ..\..\..\..\embot\os\embot_os_Timer.cpp + + + embot_os_rtos.cpp + 8 + ..\..\..\..\embot\os\embot_os_rtos.cpp + + + + + embot::prot::can + + + embot_prot_can.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can.cpp + + + embot_prot_can_analog_periodic.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_analog_periodic.cpp + + + embot_prot_can_analog_polling.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_analog_polling.cpp + + + embot_prot_can_bootloader.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_bootloader.cpp + + + embot_prot_can_inertial_periodic.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_inertial_periodic.cpp + + + embot_prot_can_motor_periodic.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_motor_periodic.cpp + + + embot_prot_can_motor_polling.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_motor_polling.cpp + + + embot_prot_can_skin_periodic.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_skin_periodic.cpp + + + + + mbd:: to be added + + + + + appl-can-ulpro + 0x4 + ARM-ADS + 6190000::V6.19::ARMCLANG + 1 + + + STM32H745IIKx:CM4 + STMicroelectronics + Keil.STM32H7xx_DFP.3.0.0 + http://www.keil.com/pack/ + IRAM(0x10000000,0x00048000) IROM(0x08100000,0x00100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD10000000 -FC8000 -FN1 -FF0STM32H7x_2048 -FS08000000 -FL0200000 -FP0($$Device:STM32H745IIKx$CMSIS\Flash\STM32H7x_2048.FLM)) + 0 + $$Device:STM32H745IIKx$Drivers\CMSIS\Device\ST\STM32H7xx\Include\stm32h7xx.h + + + + + + + + + + $$Device:STM32H745IIKx$CMSIS\SVD\STM32H745_CM4.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\obj\ + amc2c + 1 + 0 + 1 + 1 + 1 + .\lst\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 0 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x10000000 + 0x48000 + + + 1 + 0x8100000 + 0x100000 + + + 1 + 0x20000000 + 0x20000 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8100000 + 0x100000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x10000000 + 0x48000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 2 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 1 + 0 + 0 + 0 + 3 + 8 + 1 + 1 + 0 + 0 + 0 + + -Wno-pragma-pack -Wno-deprecated-register -DEMBOT_USE_rtos_osal + USE_STM32HAL STM32HAL_BOARD_AMC2C STM32HAL_DRIVER_V1A0 + + ..\..\..\..\libs\lowlevel\stm32hal\api;..\..\..\..\libs\highlevel\abslayer\osal\api;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core;..\..\..\..\embot\hw;..\..\..\..\embot\os;..\..\..\..\embot\app;..\..\..\..\embot\app;..\..\..\..\libs\midware\eventviewer\api;..\..\..\..\libs\highlevel\services\embenv\api;..\..\..\..\embot\prot\can;..\..\..\..\..\..\..\..\icub-firmware-shared\can\canProtocolLib;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools;..\..\bsp;..\..\..\..\embot\app\eth;..\..\..\..\embot\app\bldc;..\src\app-board-amc2c + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + ..\cfg\amc2c-template-appl.sct + + + --diag_suppress=L6329 + + + + + + + + main + + + amc2c-main2.cpp + 8 + ..\src\amc2c-main2.cpp + + + + + embot::app::board::amc2c + + + embot_app_board_amc2c_info.cpp + 8 + ..\src\app-board-amc2c\embot_app_board_amc2c_info.cpp + + + embot_app_board_amc2c_mbd.demo.cpp + 8 + ..\src\app-board-amc2c\embot_app_board_amc2c_mbd.demo.cpp + + + embot_app_board_amc2c_theCANagentCORE.cpp + 8 + ..\src\app-board-amc2c\embot_app_board_amc2c_theCANagentCORE.cpp + + + + + embot::app::bldc + + + embot_app_bldc_theApplication.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theApplication.cpp + + + embot_app_bldc_theCOMM.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCOMM.cpp + + + embot_app_bldc_theCTRL.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCTRL.cpp + + + embot_app_bldc_theMSGbroker.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theMSGbroker.cpp + + + + + embot::app::application + + + embot_app_theLEDmanager.cpp + 8 + ..\..\..\..\embot\app\embot_app_theLEDmanager.cpp + + + embot_app_application_theCANparserCORE.cpp + 8 + ..\..\..\..\embot\app\embot_app_application_theCANparserCORE.cpp + + + embot_app_application_theCANtracer.cpp + 8 + ..\..\..\..\embot\app\embot_app_application_theCANtracer.cpp + + + embot_app_scope.cpp + 8 + ..\..\..\..\embot\app\embot_app_scope.cpp + + + + + stm32hal + + + stm32hal.h7.amc2c.v1A0.lib + 4 + ..\..\..\..\libs\lowlevel\stm32hal\lib\stm32hal.h7.amc2c.v1A0.lib + + + stm32hal.h7.startup.amc.CM4.s + 2 + ..\cfg\stm32hal.h7.startup.amc.CM4.s + + + + + rtos + + + osal.cm4.dbg.lib + 4 + ..\..\..\..\libs\highlevel\abslayer\osal\lib\osal.cm4.dbg.lib + + + eventviewer.c + 1 + ..\..\..\..\libs\midware\eventviewer\src\eventviewer.c + + + + + embot::core + + + embot_core.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core.cpp + + + embot_core_binary.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core_binary.cpp + + + + + embot::tools + + + embot_tools.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools\embot_tools.cpp + + + + + embot::hw + + + embot_hw.cpp + 8 + ..\..\..\..\embot\hw\embot_hw.cpp + + + embot_hw_bsp.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_bsp.cpp + + + embot_hw_gpio.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_gpio.cpp + + + embot_hw_led.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_led.cpp + + + embot_hw_sys.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_sys.cpp + + + embot_hw_button.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_button.cpp + + + embot_hw_can.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_can.cpp + + + 2 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + + + + embot_hw_flash.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_flash.cpp + + + embot_hw_spi.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_spi.cpp + + + embot_hw_timer.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_timer.cpp + + + embot_hw_types.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_types.cpp + + + + + embot::hw::lowlevel-0optimized + + + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + + + + embot_hw_lowlevel.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_lowlevel.cpp + + + 2 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + + + + + + embot::hw::bsp + + + embot_hw_bsp_amc2c.cpp + 8 + ..\..\bsp\embot_hw_bsp_amc2c.cpp + + + 2 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + + + + + + embot::os + + + embot_os.cpp + 8 + ..\..\..\..\embot\os\embot_os.cpp + + + embot_os_Action.cpp + 8 + ..\..\..\..\embot\os\embot_os_Action.cpp + + + embot_os_theCallbackManager.cpp + 8 + ..\..\..\..\embot\os\embot_os_theCallbackManager.cpp + + + embot_os_theScheduler.cpp + 8 + ..\..\..\..\embot\os\embot_os_theScheduler.cpp + + + embot_os_theTimerManager.cpp + 8 + ..\..\..\..\embot\os\embot_os_theTimerManager.cpp + + + embot_os_Thread.cpp + 8 + ..\..\..\..\embot\os\embot_os_Thread.cpp + + + embot_os_Timer.cpp + 8 + ..\..\..\..\embot\os\embot_os_Timer.cpp + + + embot_os_rtos.cpp + 8 + ..\..\..\..\embot\os\embot_os_rtos.cpp + + + + + embot::prot::can + + + embot_prot_can.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can.cpp + + + embot_prot_can_analog_periodic.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_analog_periodic.cpp + + + embot_prot_can_analog_polling.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_analog_polling.cpp + + + embot_prot_can_bootloader.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_bootloader.cpp + + + embot_prot_can_inertial_periodic.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_inertial_periodic.cpp + + + embot_prot_can_motor_periodic.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_motor_periodic.cpp + + + embot_prot_can_motor_polling.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_motor_polling.cpp + + + embot_prot_can_skin_periodic.cpp + 8 + ..\..\..\..\embot\prot\can\embot_prot_can_skin_periodic.cpp + + + + + mbd:: to be added + + + + + + + + + + + + + + + amc-embot-os + 0 + 1 + + + + +
diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/src/amc2c-main2.cpp b/emBODY/eBcode/arch-arm/board/amc2c/application/src/amc2c-main2.cpp new file mode 100644 index 0000000000..0093a08c5d --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/src/amc2c-main2.cpp @@ -0,0 +1,31 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +#include "embot_app_bldc_theApplication.h" + +#include "embot_app_board_amc2c_info.h" +#include "embot_app_board_amc2c_mbd.h" + +constexpr embot::app::bldc::theApplication::Config cfg +{ + {embot::app::board::amc2c::info::getCodePartition, embot::app::board::amc2c::info::getCANgentCORE}, + {}, // systCfg: the default is typically OK + {}, // CommCfg: the default is typically OK + {embot::app::board::amc2c::mbd::Startup, embot::app::board::amc2c::mbd::OnTick} // CtrlCfg: the default stack is typically OK +}; + + +int main(void) +{ + embot::app::bldc::theApplication::getInstance().start(cfg); +} + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_info.cpp b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_info.cpp new file mode 100644 index 0000000000..d991f7f39b --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_info.cpp @@ -0,0 +1,180 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + + +#include "embot_app_board_amc2c_info.h" + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_eth.h" +#include "embot_app_board_amc2c_theCANagentCORE.h" + +// -------------------------------------------------------------------------------------------------------------------- +// - the configurable constants +// -------------------------------------------------------------------------------------------------------------------- + +namespace embot::app::board::amc2c::info { + + constexpr embot::prot::can::applicationInfo applInfo + { + embot::prot::can::versionOfAPPLICATION {100, 100, 0}, + embot::prot::can::versionOfCANPROTOCOL {2, 0} + }; + + constexpr embot::app::eth::Date date + { + 2023, embot::app::eth::Month::Apr, embot::app::eth::Day::fourteen, 16, 54 + }; + + constexpr embot::hw::FLASHpartitionID codePartition + { + embot::hw::FLASHpartitionID::eapplication01 + }; + + constexpr embot::hw::CAN canBus + { + embot::hw::CAN::two + }; + + static const char *info32 + { // 0123456789abcde0123456789abcde + "hi, i am an amc2c can" + }; + +} // embot::app::board::amc2c::info { + + +// -------------------------------------------------------------------------------------------------------------------- +// - all the rest +// -------------------------------------------------------------------------------------------------------------------- + +void force_placement_of_moduleinfo(); + +namespace embot::app::board::amc2c::info { + + embot::hw::FLASHpartitionID getCodePartition() + { + return codePartition; + } + + embot::app::application::CANagentCORE* getCANgentCORE() + { + static bool initted {false}; + if(!initted) + { + force_placement_of_moduleinfo(); + embot::app::board::amc2c::theCANagentCORE::getInstance().initialise({applInfo, canBus, info32}); + initted = true; + } + return &embot::app::board::amc2c::theCANagentCORE::getInstance(); + } + +} // namespace embot::app::board::amc2c::info { + + +// ------------------------------------------------------------------------------------------------------------------ +// - for the partition table we need to place specific infor at a given location +// ------------------------------------------------------------------------------------------------------------------ + +#include "eEsharedServices.h" + + +#define ROMADDR 0x08100000 +#define ROMSIZE 0x20000 + +#define EENV_MODULEINFO_LOADER_AT ".ARM.__at_0x08100400" + + +#define RAMADDR 0x10000000 +#define RAMSIZE 0x00048000 + +constexpr eEmoduleExtendedInfo_t s_cm4app_info_extended __attribute__((section(EENV_MODULEINFO_LOADER_AT))) = +{ + .moduleinfo = + { + .info = + { + .entity = + { + .type = ee_entity_process, + .signature = ee_procOther01, + .version = + { + .major = embot::app::board::amc2c::info::applInfo.version.major, + .minor = embot::app::board::amc2c::info::applInfo.version.minor + }, + .builddate = + { + .year = embot::app::board::amc2c::info::date.year, + .month = embot::app::board::amc2c::info::date.month, + .day = embot::app::board::amc2c::info::date.day, + .hour = embot::app::board::amc2c::info::date.hour, + .min = embot::app::board::amc2c::info::date.minute + } + }, + .rom = + { + .addr = ROMADDR, + .size = ROMSIZE + }, + .ram = + { + .addr = RAMADDR, + .size = RAMSIZE + }, + .storage = + { + .type = ee_strg_none, + .size = 0, + .addr = 0 + }, + .communication = ee_commtype_none, + .name = "eOther01" + }, + .protocols = + { + .udpprotversion = { .major = 0, .minor = 0}, + .can1protversion = { .major = 0, .minor = 0}, + .can2protversion = { .major = 0, .minor = 0}, + .gtwprotversion = { .major = 0, .minor = 0} + }, + .extra = {"EXT"} + }, + .compilationdatetime = __DATE__ " " __TIME__, + .userdefined = {0} +}; + +#include + +eEmoduleExtendedInfo_t ss {}; +void force_placement_of_moduleinfo() +{ + static volatile uint8_t used {0}; + + if(s_cm4app_info_extended.moduleinfo.info.entity.type == ee_entity_process) + { + used = 1; + } + else + { + used = 2; + } + + std::memmove(&ss, &s_cm4app_info_extended, sizeof(ss)); +} + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + + diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_info.h b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_info.h new file mode 100644 index 0000000000..090ee3099d --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_info.h @@ -0,0 +1,31 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_BOARD_AMC2C_INFO_H_ +#define __EMBOT_APP_BOARD_AMC2C_INFO_H_ + + +#include "embot_core.h" + +#include "embot_app_bldc_theApplication.h" +#include "embot_app_application_CANagentCORE.h" + +namespace embot::app::board::amc2c::info { + + embot::hw::FLASHpartitionID getCodePartition(); + embot::app::application::CANagentCORE* getCANgentCORE(); + +} // embot::app::board::amc2c::info { + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.demo.cpp b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.demo.cpp new file mode 100644 index 0000000000..ba9cfaea32 --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.demo.cpp @@ -0,0 +1,59 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_board_amc2c_mbd.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + + +namespace embot::app::board::amc2c::mbd { + + void Startup(embot::prot::can::Address adr) + { + embot::core::print("MBD is starting up on an amc2c"); + } + + void OnTick(const std::vector &input, std::vector &output) + { + static uint32_t cnt {0}; + if(0 == (cnt++ % 1)) + { +// embot::core::print("MBD is ticking on an amc2c"); + + uint8_t b0 = cnt&0xff; + uint8_t b1 = (cnt>>8)&0xff; + uint8_t b2 = (cnt>>16)&0xff; + uint8_t b3 = (cnt>>24)&0xff; + embot::prot::can::Frame fr1 {0x202, 4, {b0, b1, b2, b3, 0, 0, 0, 0}}; + output.push_back(fr1); + } + + size_t numRXframes = input.size(); + + if(numRXframes > 0) + { + // just for test: i get the first only and i send it back + embot::prot::can::Frame f = input[0]; + output.push_back(f); + } + } + +} // end of namespace + + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.h b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.h new file mode 100644 index 0000000000..b0bf56635e --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_mbd.h @@ -0,0 +1,30 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_BOARD_AMC2C_MBD_H_ +#define __EMBOT_APP_BOARD_AMC2C_MBD_H_ + + + +#include "embot_app_bldc_theApplication.h" + + +namespace embot::app::board::amc2c::mbd { + + void Startup(embot::prot::can::Address adr); + void OnTick(const std::vector &input, std::vector &output); + +} // embot::app::board::amc2c::mbd { + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_theCANagentCORE.cpp b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_theCANagentCORE.cpp new file mode 100644 index 0000000000..a4d391c013 --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_theCANagentCORE.cpp @@ -0,0 +1,281 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_board_amc2c_theCANagentCORE.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_core.h" +#include "embot_core_binary.h" + +#include + + +#include "embot_hw_sys.h" +#include "embot_hw_can.h" + +// -------------------------------------------------------------------------------------------------------------------- +// - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++ +// -------------------------------------------------------------------------------------------------------------------- + + +struct embot::app::board::amc2c::theCANagentCORE::Impl +{ + + Config _config {}; + + static const std::uint32_t validityKey = 0x8888dead; + struct StoredInfo + { // contains the basics stored inside some embot::i2h::Storage + std::uint32_t key {validityKey}; + std::uint8_t canaddress {3}; + std::uint8_t boardtype { embot::core::tointegral(embot::prot::can::Board::amcbldc) }; + std::uint8_t bootloaderVmajor {0}; + std::uint8_t bootloaderVminor {0}; + std::uint8_t info32[32] {"i am a amc2c"}; + std::uint8_t applicationVmajor {0}; + std::uint8_t applicationVminor {0}; + std::uint8_t applicationVbuild {0}; + std::uint8_t protocolVmajor {2}; + std::uint8_t protocolVminor {0}; + + std::uint8_t tobefilled[3]; // to make the size of struct ... multiple of 8. + }; + + StoredInfo _storedinfo = {0}; + + embot::prot::can::applicationInfo _applicationinfo {}; + + embot::prot::can::Board _board {embot::prot::can::Board::amcbldc}; + + + Impl() { } + + bool initialise(const Config &config); + + bool setcanaddress(const std::uint8_t adr, const std::uint16_t randominvalidmask); +}; + +bool embot::app::board::amc2c::theCANagentCORE::Impl::initialise(const Config &config) +{ + _config = config; + + // retrieve board type, version of application, can address + // we use the object theCANboardInfo which is based onto FlashStorage which manages + // the flash partition called Partition::ID::sharedstorage + + _storedinfo.applicationVmajor = _config.applicationinfo.version.major; + _storedinfo.applicationVminor = _config.applicationinfo.version.minor; + _storedinfo.applicationVbuild = _config.applicationinfo.version.build; + _storedinfo.protocolVmajor = _config.applicationinfo.protocol.major; + _storedinfo.protocolVminor = _config.applicationinfo.protocol.minor; + _storedinfo.protocolVmajor = _config.applicationinfo.protocol.major; + std::memmove(_storedinfo.info32, _config.boardinfo, sizeof(_storedinfo.info32)); + + _board = static_cast(_storedinfo.boardtype); +// _address = _storedinfo.canaddress; + _applicationinfo.version.major = _storedinfo.applicationVmajor; + _applicationinfo.version.minor = _storedinfo.applicationVminor; + _applicationinfo.version.build = _storedinfo.applicationVbuild; + _applicationinfo.protocol.major = _storedinfo.protocolVmajor; + _applicationinfo.protocol.minor = _storedinfo.protocolVminor; + + // note: we could make it even more general by using inside _config a pure interface class which + // does the job of theCANboardInfo, in such a way we just specialise this class ... but maybe later + + return true; +} + + +bool embot::app::board::amc2c::theCANagentCORE::Impl::setcanaddress(const std::uint8_t adr, const std::uint16_t randominvalidmask) +{ + + // i reinforce a reading from storage. just for safety. in here we are dealing w/ can address change and i want to be sure. + std::uint8_t canaddress = _storedinfo.canaddress; + + std::uint8_t target = adr; + + if(0xff == adr) + { + // compute a new random address. use the randoinvalid mask to filter out the undesired values. for sure 0x8001. + std::uint16_t mask = randominvalidmask; + mask |= 0x8001; + if(0xffff == mask) + { // hei, nothing is good for you. + return false; + } + + bool ok = false; + for(std::uint16_t i=0; i<250; i++) + { + target = (embot::hw::sys::random()-embot::hw::sys::minrandom()) & 0xf; + + if(false == embot::core::binary::bit::check(mask, target)) + { + ok = true; + break; + } + } + + if(!ok) + { + return false; + } + } + + // always check that is is not 0 or 0xf + if((0 == target) || (0xf == target)) + { + return false; + } + + + if(canaddress != target) + { + if(embot::hw::resOK != embot::hw::can::setfilters(_config.canbus, target)) + { + return false; + } + _storedinfo.canaddress = target; + canaddress = _storedinfo.canaddress; + } + + return (target == canaddress); +} + + +// -------------------------------------------------------------------------------------------------------------------- +// - the class +// -------------------------------------------------------------------------------------------------------------------- + + +embot::app::board::amc2c::theCANagentCORE& embot::app::board::amc2c::theCANagentCORE::getInstance() +{ + static theCANagentCORE* p = new theCANagentCORE(); + return *p; +} + +embot::app::board::amc2c::theCANagentCORE::theCANagentCORE() +{ + pImpl = std::make_unique(); +} + + +embot::app::board::amc2c::theCANagentCORE::~theCANagentCORE() { } + + +bool embot::app::board::amc2c::theCANagentCORE::initialise(const Config &config) +{ + return pImpl->initialise(config); +} + + +// its interfaces to CANagentCORE + + +const embot::prot::can::applicationInfo & embot::app::board::amc2c::theCANagentCORE::applicationinfo() const +{ + return pImpl->_applicationinfo; +} + +embot::hw::CAN embot::app::board::amc2c::theCANagentCORE::bus() const +{ + return pImpl->_config.canbus; +} + +embot::prot::can::Address embot::app::board::amc2c::theCANagentCORE::address() const +{ + return pImpl->_storedinfo.canaddress; +} + + +bool embot::app::board::amc2c::theCANagentCORE::get(const embot::prot::can::bootloader::Message_BROADCAST::Info &info, embot::prot::can::bootloader::Message_BROADCAST::ReplyInfo &replyinfo) +{ + replyinfo.board = pImpl->_board; + replyinfo.process = embot::prot::can::Process::application; + replyinfo.firmware = {pImpl->_applicationinfo.version.major, pImpl->_applicationinfo.version.minor, pImpl->_applicationinfo.version.build}; + + return true; +} + + +bool embot::app::board::amc2c::theCANagentCORE::get(const embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::Info &info, embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::ReplyInfo &replyinfo) +{ + std::memmove(replyinfo.info32, pImpl->_storedinfo.info32, sizeof(replyinfo.info32)); + + return true; +} + + +bool embot::app::board::amc2c::theCANagentCORE::get(const embot::prot::can::shared::Message_GET_VERSION::Info &info, embot::prot::can::shared::Message_GET_VERSION::ReplyInfo &replyinfo) +{ + replyinfo.board = pImpl->_board; + replyinfo.firmware = {pImpl->_applicationinfo.version.major, pImpl->_applicationinfo.version.minor, pImpl->_applicationinfo.version.build}; + replyinfo.protocol = pImpl->_applicationinfo.protocol; + + return true; +} + +bool embot::app::board::amc2c::theCANagentCORE::get(const embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::Info &info, embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::ReplyInfo &replyinfo) +{ + replyinfo.timeoflife = embot::core::now(); + + return true; +} + + +bool embot::app::board::amc2c::theCANagentCORE::set(const embot::prot::can::bootloader::Message_BOARD::Info &info) +{ +// // we just restart so we cannot reply +// embot::hw::sys::reset(); + + return false; +} + + +bool embot::app::board::amc2c::theCANagentCORE::set(const embot::prot::can::bootloader::Message_SET_ADDITIONAL_INFO2::Info &info) +{ + if(true == info.valid) + { // we have received all the 8 messages in order (important is that the one with data[1] = 0 is the first) +// embot::app::theCANboardInfo::getInstance().get(pImpl->_storedinfo); + std::memmove(pImpl->_storedinfo.info32, info.info32, sizeof(pImpl->_storedinfo.info32)); +// embot::app::theCANboardInfo::getInstance().set(pImpl->_storedinfo); + } + + return false; +} + + +bool embot::app::board::amc2c::theCANagentCORE::set(const embot::prot::can::shared::Message_SET_ID::Info &info) +{ + pImpl->setcanaddress(info.address, 0x0000); + + return false; +} + + +bool embot::app::board::amc2c::theCANagentCORE::set(const embot::prot::can::bootloader::Message_SETCANADDRESS::Info &info) +{ + pImpl->setcanaddress(info.address, info.randominvalidmask); + + return false; +} + + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_theCANagentCORE.h b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_theCANagentCORE.h new file mode 100644 index 0000000000..d7696fa7aa --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amc2c/application/src/app-board-amc2c/embot_app_board_amc2c_theCANagentCORE.h @@ -0,0 +1,69 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_BOARD_AMC2C_THECANAGENTCORE_H_ +#define __EMBOT_APP_BOARD_AMC2C_THECANAGENTCORE_H_ + +#include +#include + + +#include "embot_app_application_CANagentCORE.h" + + +namespace embot::app::board::amc2c { + + class theCANagentCORE : public embot::app::application::CANagentCORE + { + public: + static theCANagentCORE& getInstance(); + + struct Config + { + embot::prot::can::applicationInfo applicationinfo {{0,0,1}, {2,0}}; + embot::hw::CAN canbus {embot::hw::CAN::one}; + const char *boardinfo {"hello, i am an amc2c"}; + constexpr Config() = default; + constexpr Config(const embot::prot::can::applicationInfo& ai, embot::hw::CAN b, const char *bi) + : applicationinfo(ai), canbus(b), boardinfo(bi) {} + }; + + bool initialise(const Config &config); + + // interface to theCANagentCORE + const embot::prot::can::applicationInfo & applicationinfo() const override; + embot::hw::CAN bus() const override; + embot::prot::can::Address address() const override; + + bool get(const embot::prot::can::bootloader::Message_BROADCAST::Info &info, embot::prot::can::bootloader::Message_BROADCAST::ReplyInfo &replyinfo) override; + bool get(const embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::Info &info, embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::ReplyInfo &replyinfo) override; + bool get(const embot::prot::can::shared::Message_GET_VERSION::Info &info, embot::prot::can::shared::Message_GET_VERSION::ReplyInfo &replyinfo) override; + bool get(const embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::Info &info, embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::ReplyInfo &replyinfo) override; + + bool set(const embot::prot::can::bootloader::Message_BOARD::Info &info) override; + bool set(const embot::prot::can::bootloader::Message_SET_ADDITIONAL_INFO2::Info &info) override; + bool set(const embot::prot::can::shared::Message_SET_ID::Info &info) override; + bool set(const embot::prot::can::bootloader::Message_SETCANADDRESS::Info &info) override; + + private: + theCANagentCORE(); + ~theCANagentCORE(); + + private: + struct Impl; + std::unique_ptr pImpl; + }; + +} // namespace embot::app::board::amc2c { + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.cpp b/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.cpp index c814fe3520..8cb0bd7573 100644 --- a/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.cpp +++ b/emBODY/eBcode/arch-arm/board/amc2c/bsp/embot_hw_bsp_amc2c.cpp @@ -207,7 +207,7 @@ namespace embot { namespace hw { namespace button { namespace embot { namespace hw { namespace button { - #if defined(STM32HAL_BOARD_AMC) + #if defined(STM32HAL_BOARD_AMC2C) // this button is the blue one on the board constexpr PROP btn1p = { .pressed = embot::hw::gpio::State::SET, .gpio = {embot::hw::GPIO::PORT::C, embot::hw::GPIO::PIN::thirteen}, @@ -301,15 +301,15 @@ namespace embot { namespace hw { namespace can { // it has HAL_FDCAN_MODULE_ENABLED - FDCAN_HandleTypeDef hfdcan1 {}; +// FDCAN_HandleTypeDef hfdcan1 {}; FDCAN_HandleTypeDef hfdcan2 {}; - constexpr PROP can1p = { .handle = &hfdcan1 }; +// constexpr PROP can1p = { .handle = &hfdcan1 }; constexpr PROP can2p = { .handle = &hfdcan2 }; constexpr BSP thebsp { // maskofsupported - mask::pos2mask(CAN::two), // | mask::pos2mask(CAN::two), + mask::pos2mask(CAN::two), // properties {{ nullptr, &can2p @@ -317,41 +317,41 @@ namespace embot { namespace hw { namespace can { }; - void s_FDCAN1_Init(void) - { - hfdcan1.Instance = FDCAN1; - hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC; - hfdcan1.Init.Mode = FDCAN_MODE_NORMAL; - hfdcan1.Init.AutoRetransmission = ENABLE; - hfdcan1.Init.TransmitPause = ENABLE; - hfdcan1.Init.ProtocolException = DISABLE; - hfdcan1.Init.NominalPrescaler = 1; - hfdcan1.Init.NominalSyncJumpWidth = 20; - hfdcan1.Init.NominalTimeSeg1 = 79; - hfdcan1.Init.NominalTimeSeg2 = 20; - hfdcan1.Init.DataPrescaler = 1; - hfdcan1.Init.DataSyncJumpWidth = 8; - hfdcan1.Init.DataTimeSeg1 = 11; - hfdcan1.Init.DataTimeSeg2 = 8; - hfdcan1.Init.MessageRAMOffset = 0; - hfdcan1.Init.StdFiltersNbr = 1; - hfdcan1.Init.ExtFiltersNbr = 1; - hfdcan1.Init.RxFifo0ElmtsNbr = 1; - hfdcan1.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8; - hfdcan1.Init.RxFifo1ElmtsNbr = 0; - hfdcan1.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8; - hfdcan1.Init.RxBuffersNbr = 1; - hfdcan1.Init.RxBufferSize = FDCAN_DATA_BYTES_8; - hfdcan1.Init.TxEventsNbr = 0; - hfdcan1.Init.TxBuffersNbr = 1; - hfdcan1.Init.TxFifoQueueElmtsNbr = 1; - hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION; - hfdcan1.Init.TxElmtSize = FDCAN_DATA_BYTES_8; - if (HAL_FDCAN_Init(&hfdcan1) != HAL_OK) - { - Error_Handler(); - } - } +// void s_FDCAN1_Init(void) +// { +// hfdcan1.Instance = FDCAN1; +// hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC; +// hfdcan1.Init.Mode = FDCAN_MODE_NORMAL; +// hfdcan1.Init.AutoRetransmission = ENABLE; +// hfdcan1.Init.TransmitPause = ENABLE; +// hfdcan1.Init.ProtocolException = DISABLE; +// hfdcan1.Init.NominalPrescaler = 1; +// hfdcan1.Init.NominalSyncJumpWidth = 20; +// hfdcan1.Init.NominalTimeSeg1 = 79; +// hfdcan1.Init.NominalTimeSeg2 = 20; +// hfdcan1.Init.DataPrescaler = 1; +// hfdcan1.Init.DataSyncJumpWidth = 8; +// hfdcan1.Init.DataTimeSeg1 = 11; +// hfdcan1.Init.DataTimeSeg2 = 8; +// hfdcan1.Init.MessageRAMOffset = 0; +// hfdcan1.Init.StdFiltersNbr = 1; +// hfdcan1.Init.ExtFiltersNbr = 1; +// hfdcan1.Init.RxFifo0ElmtsNbr = 1; +// hfdcan1.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8; +// hfdcan1.Init.RxFifo1ElmtsNbr = 0; +// hfdcan1.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8; +// hfdcan1.Init.RxBuffersNbr = 1; +// hfdcan1.Init.RxBufferSize = FDCAN_DATA_BYTES_8; +// hfdcan1.Init.TxEventsNbr = 0; +// hfdcan1.Init.TxBuffersNbr = 1; +// hfdcan1.Init.TxFifoQueueElmtsNbr = 1; +// hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION; +// hfdcan1.Init.TxElmtSize = FDCAN_DATA_BYTES_8; +// if (HAL_FDCAN_Init(&hfdcan1) != HAL_OK) +// { +// Error_Handler(); +// } +// } void s_FDCAN2_Init(void) { @@ -427,7 +427,8 @@ namespace embot { namespace hw { namespace can { { if(h == CAN::one) { - s_FDCAN1_Init(); + // s_FDCAN1_Init(); + return; } else if(h == CAN::two) { @@ -457,20 +458,20 @@ extern "C" { // the irq handlers - void FDCAN1_IT0_IRQHandler(void) - { - HAL_FDCAN_IRQHandler(&embot::hw::can::hfdcan1); - } +// void FDCAN1_IT0_IRQHandler(void) +// { +// HAL_FDCAN_IRQHandler(&embot::hw::can::hfdcan1); +// } void FDCAN2_IT0_IRQHandler(void) { HAL_FDCAN_IRQHandler(&embot::hw::can::hfdcan2); } - void FDCAN1_IT1_IRQHandler(void) - { - HAL_FDCAN_IRQHandler(&embot::hw::can::hfdcan1); - } +// void FDCAN1_IT1_IRQHandler(void) +// { +// HAL_FDCAN_IRQHandler(&embot::hw::can::hfdcan1); +// } void FDCAN2_IT1_IRQHandler(void) { diff --git a/emBODY/eBcode/arch-arm/board/amc2c/examples/embot-os/src/main-basic.cpp b/emBODY/eBcode/arch-arm/board/amc2c/examples/embot-os/src/main-basic.cpp index ec4d0d4508..a896bb7abd 100644 --- a/emBODY/eBcode/arch-arm/board/amc2c/examples/embot-os/src/main-basic.cpp +++ b/emBODY/eBcode/arch-arm/board/amc2c/examples/embot-os/src/main-basic.cpp @@ -163,7 +163,11 @@ int main(void) constexpr embot::os::InitThread::Config initcfg = { 4*1024, initSystem, nullptr }; constexpr embot::os::IdleThread::Config idlecfg = { 2*1024, nullptr, nullptr, onIdle }; constexpr embot::core::Callback onOSerror = { }; - constexpr embot::os::Config osconfig {embot::core::time1millisec, initcfg, idlecfg, onOSerror}; + constexpr embot::os::Config osconfig + { + embot::core::time1millisec, initcfg, idlecfg, onOSerror, + embot::hw::FLASHpartitionID::eapplication01 + }; // embot::os::init() internally calls embot::hw::bsp::init() which also calls embot::core::init() embot::os::init(osconfig); diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvoptx b/emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvoptx new file mode 100644 index 0000000000..1c840cd9fa --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvoptx @@ -0,0 +1,1669 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp; *.cc; *.cxx + 0 + + + + 0 + 0 + + + + amcbldc-app + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\lst\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 0 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 1 + + + + + + + + + + + BIN\ULP2CM3.DLL + + + + 0 + ULP2CM3 + -UP0948199 -O206 -S8 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO65555 -TC168000000 -TT10000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE80000001 -TIP9 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32G47x-8x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32G474QETx$CMSIS\Flash\STM32G47x-8x_512.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L161 -Z12 -C0 -M1 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + + + + 0 + JL2CM3 + -U932000551 -O78 -S8 -ZTIFSpeedSel50000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32G47x-8x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32G474QETx$CMSIS\Flash\STM32G47x-8x_512.FLM) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32G47x-8x_512 -FS08000000 -FL080000 -FP0($$Device:STM32G474QETx$CMSIS\Flash\STM32G47x-8x_512.FLM)) + + + + + + 0 + 1 + SupervisorFSM_RX_DW + + + 1 + 1 + SupervisorFSM_RX_B + + + 2 + 1 + AMC_BLDC_Y.ConfigurationParameters_p + + + 3 + 1 + AMC_BLDC_B.RTBInsertedForAdapter_InsertedF + + + 4 + 1 + rtb_SupervisorFSM_RX_o2 + + + 5 + 1 + AMC_BLDC_Y.ConfigurationParameters_p + + + + + 1 + 0 + rtb_SupervisorFSM_RX_o2 + 0 + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + OS Support\Event Viewer + 35905 + + + + 1 + 1 + 0 + 2 + 10000000 + + + + + + amcbldc-app-motorhal2 + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\lst\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 1 + + + + + + + + + + + BIN\ULP2CM3.DLL + + + + 0 + ULP2CM3 + -UP0948199 -O206 -S12 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO65555 -TC168000000 -TT10000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE80000001 -TIP9 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32G47x-8x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32G474QETx$CMSIS\Flash\STM32G47x-8x_512.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L124 -Z14 -C0 -M1 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + + + + 0 + JL2CM3 + -U932000551 -O78 -S8 -ZTIFSpeedSel50000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32G47x-8x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32G474QETx$CMSIS\Flash\STM32G47x-8x_512.FLM) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32G47x-8x_512 -FS08000000 -FL080000 -FP0($$Device:STM32G474QETx$CMSIS\Flash\STM32G47x-8x_512.FLM)) + + + + + + 0 + 1 + config + + + + + 1 + 0 + myuID + 0 + + + + 0 + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + OS Support\Event Viewer + 35905 + + + + 1 + 1 + 0 + 2 + 50000000 + + + + + + main + 1 + 0 + 0 + 0 + + 1 + 1 + 8 + 0 + 0 + 0 + ..\src\amcbldc-main2.cpp + amcbldc-main2.cpp + 0 + 0 + + + + + embot::app::board::amcbldc + 1 + 0 + 0 + 0 + + 2 + 2 + 8 + 0 + 0 + 0 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_info.cpp + embot_app_board_amcbldc_info.cpp + 0 + 0 + + + 2 + 3 + 8 + 0 + 0 + 0 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_MBD.cpp + embot_app_board_amcbldc_MBD.cpp + 0 + 0 + + + 2 + 4 + 8 + 0 + 0 + 0 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_MBD.demo.cpp + embot_app_board_amcbldc_MBD.demo.cpp + 0 + 0 + + + 2 + 5 + 8 + 0 + 0 + 0 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_theMBD.cpp + embot_app_board_amcbldc_theMBD.cpp + 0 + 0 + + + + + embot::app::bldc + 1 + 0 + 0 + 0 + + 3 + 6 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theMSGbroker.cpp + embot_app_bldc_theMSGbroker.cpp + 0 + 0 + + + 3 + 7 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCOMM.cpp + embot_app_bldc_theCOMM.cpp + 0 + 0 + + + 3 + 8 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCTRL.cpp + embot_app_bldc_theCTRL.cpp + 0 + 0 + + + 3 + 9 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theApplication.cpp + embot_app_bldc_theApplication.cpp + 0 + 0 + + + + + embot::app::application + 1 + 0 + 0 + 0 + + 4 + 10 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\embot_app_scope.cpp + embot_app_scope.cpp + 0 + 0 + + + 4 + 11 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\app\embot_app_application_theCANtracer.cpp + embot_app_application_theCANtracer.cpp + 0 + 0 + + + 4 + 12 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\embot_app_theLEDmanager.cpp + embot_app_theLEDmanager.cpp + 0 + 0 + + + 4 + 13 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\embot_app_application_theCANagentCORE.cpp + embot_app_application_theCANagentCORE.cpp + 0 + 0 + + + 4 + 14 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\app\embot_app_application_theCANparserCORE.cpp + embot_app_application_theCANparserCORE.cpp + 0 + 0 + + + + + stm32hal + 0 + 0 + 0 + 0 + + 5 + 15 + 4 + 0 + 0 + 0 + ..\..\..\..\libs\lowlevel\stm32hal\lib\stm32hal.g4.v120.amcbldc.lib + stm32hal.g4.v120.amcbldc.lib + 0 + 0 + + + 5 + 16 + 4 + 0 + 0 + 0 + ..\..\..\..\libs\lowlevel\stm32hal\lib\stm32hal.g4.v122.amcbldc.lib + stm32hal.g4.v122.amcbldc.lib + 0 + 0 + + + 5 + 17 + 2 + 0 + 0 + 0 + ..\cfg\stm32hal.startup.amcbldc.s + stm32hal.startup.amcbldc.s + 0 + 0 + + + + + rtos + 0 + 0 + 0 + 0 + + 6 + 18 + 4 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\libs\highlevel\abslayer\osal\lib\osal.cm4.dbg.lib + osal.cm4.dbg.lib + 0 + 0 + + + 6 + 19 + 1 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\libs\midware\eventviewer\src\eventviewer.c + eventviewer.c + 0 + 0 + + + + + embot::core + 0 + 0 + 0 + 0 + + 7 + 20 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core.cpp + embot_core.cpp + 0 + 0 + + + 7 + 21 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core_binary.cpp + embot_core_binary.cpp + 0 + 0 + + + + + embot::tools + 0 + 0 + 0 + 0 + + 8 + 22 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools\embot_tools.cpp + embot_tools.cpp + 0 + 0 + + + + + embot::hw + 1 + 0 + 0 + 0 + + 9 + 23 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_flash.cpp + embot_hw_flash.cpp + 0 + 0 + + + 9 + 24 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw.cpp + embot_hw.cpp + 0 + 0 + + + 9 + 25 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_bsp.cpp + embot_hw_bsp.cpp + 0 + 0 + + + 9 + 26 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_sys.cpp + embot_hw_sys.cpp + 0 + 0 + + + 9 + 27 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_can.cpp + embot_hw_can.cpp + 0 + 0 + + + 9 + 28 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_timer.cpp + embot_hw_timer.cpp + 0 + 0 + + + 9 + 29 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_gpio.cpp + embot_hw_gpio.cpp + 0 + 0 + + + 9 + 30 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_led.cpp + embot_hw_led.cpp + 0 + 0 + + + 9 + 31 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_button.cpp + embot_hw_button.cpp + 0 + 0 + + + 9 + 32 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_types.cpp + embot_hw_types.cpp + 0 + 0 + + + 9 + 33 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_motor.cpp + embot_hw_motor.cpp + 0 + 0 + + + + + embot::hw::lowlevel-0optimized + 0 + 0 + 0 + 0 + + 10 + 34 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\hw\embot_hw_lowlevel.cpp + embot_hw_lowlevel.cpp + 0 + 0 + + + + + embot::hw::bsp + 1 + 0 + 0 + 0 + + 11 + 35 + 8 + 0 + 0 + 0 + ..\..\bsp\embot_hw_bsp_amcbldc.cpp + embot_hw_bsp_amcbldc.cpp + 0 + 0 + + + + + embot<flash stored info> + 1 + 0 + 0 + 0 + + 12 + 36 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_FlashStorage.cpp + embot_hw_FlashStorage.cpp + 0 + 0 + + + 12 + 37 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\app\embot_app_theCANboardInfo.cpp + embot_app_theCANboardInfo.cpp + 0 + 0 + + + + + embot::os + 1 + 0 + 0 + 0 + + 13 + 38 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os.cpp + embot_os.cpp + 0 + 0 + + + 13 + 39 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_Thread.cpp + embot_os_Thread.cpp + 0 + 0 + + + 13 + 40 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_theCallbackManager.cpp + embot_os_theCallbackManager.cpp + 0 + 0 + + + 13 + 41 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_theScheduler.cpp + embot_os_theScheduler.cpp + 0 + 0 + + + 13 + 42 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_theTimerManager.cpp + embot_os_theTimerManager.cpp + 0 + 0 + + + 13 + 43 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_Timer.cpp + embot_os_Timer.cpp + 0 + 0 + + + 13 + 44 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\os\embot_os_Action.cpp + embot_os_Action.cpp + 0 + 0 + + + 13 + 45 + 8 + 0 + 0 + 0 + ..\..\..\..\embot\os\embot_os_rtos.cpp + embot_os_rtos.cpp + 0 + 0 + + + + + embot::prot::can + 0 + 0 + 0 + 0 + + 14 + 46 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can.cpp + embot_prot_can.cpp + 0 + 0 + + + 14 + 47 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_inertial_periodic.cpp + embot_prot_can_inertial_periodic.cpp + 0 + 0 + + + 14 + 48 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_motor_polling.cpp + embot_prot_can_motor_polling.cpp + 0 + 0 + + + 14 + 49 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_motor_periodic.cpp + embot_prot_can_motor_periodic.cpp + 0 + 0 + + + 14 + 50 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_bootloader.cpp + embot_prot_can_bootloader.cpp + 0 + 0 + + + 14 + 51 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_analog_polling.cpp + embot_prot_can_analog_polling.cpp + 0 + 0 + + + 14 + 52 + 8 + 0 + 0 + 0 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_analog_periodic.cpp + embot_prot_can_analog_periodic.cpp + 0 + 0 + + + + + others-cmsis-math + 0 + 0 + 0 + 0 + + 15 + 53 + 4 + 0 + 0 + 0 + ..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Lib\ARM\arm_cortexM4lf_math.lib + arm_cortexM4lf_math.lib + 0 + 0 + + + + + others::motorhal + 0 + 0 + 0 + 0 + + 16 + 54 + 1 + 0 + 0 + 0 + ..\src\motorhal\motorhal_config.c + motorhal_config.c + 0 + 0 + + + 16 + 55 + 8 + 0 + 0 + 0 + ..\src\motorhal\encoder.c + encoder.c + 0 + 0 + + + 16 + 56 + 8 + 0 + 0 + 0 + ..\src\motorhal\pwm.c + pwm.c + 0 + 0 + + + 16 + 57 + 8 + 0 + 0 + 0 + ..\src\motorhal\analog.c + analog.c + 0 + 0 + + + + + others::motorhal2 + 0 + 0 + 0 + 0 + + 17 + 58 + 8 + 0 + 0 + 0 + ..\src\motorhal2\motorhal_config.c + motorhal_config.c + 0 + 0 + + + 17 + 59 + 8 + 0 + 0 + 0 + ..\src\motorhal2\encoder.c + encoder.c + 0 + 0 + + + 17 + 60 + 8 + 0 + 0 + 0 + ..\src\motorhal2\pwm.c + pwm.c + 0 + 0 + + + 17 + 61 + 8 + 0 + 0 + 0 + ..\src\motorhal2\analog.c + analog.c + 0 + 0 + + + + + mbd + 0 + 0 + 0 + 0 + + 18 + 62 + 8 + 0 + 0 + 0 + ..\src\model-based-design\sharedutils\rt_hypotf_snf.cpp + rt_hypotf_snf.cpp + 0 + 0 + + + 18 + 63 + 8 + 0 + 0 + 0 + ..\src\model-based-design\sharedutils\rt_nonfinite.cpp + rt_nonfinite.cpp + 0 + 0 + + + 18 + 64 + 8 + 0 + 0 + 0 + ..\src\model-based-design\sharedutils\rtGetInf.cpp + rtGetInf.cpp + 0 + 0 + + + 18 + 65 + 8 + 0 + 0 + 0 + ..\src\model-based-design\sharedutils\rtGetNaN.cpp + rtGetNaN.cpp + 0 + 0 + + + 18 + 66 + 8 + 0 + 0 + 0 + ..\src\model-based-design\sharedutils\rtw_enable_disable_motors.c + rtw_enable_disable_motors.c + 0 + 0 + + + 18 + 67 + 8 + 0 + 0 + 0 + ..\src\model-based-design\sharedutils\const_params.cpp + const_params.cpp + 0 + 0 + + + 18 + 68 + 8 + 0 + 0 + 0 + ..\src\model-based-design\sharedutils\uMultiWord2Double.cpp + uMultiWord2Double.cpp + 0 + 0 + + + 18 + 69 + 8 + 0 + 0 + 0 + ..\src\model-based-design\sharedutils\uMultiWordShl.cpp + uMultiWordShl.cpp + 0 + 0 + + + 18 + 70 + 8 + 0 + 0 + 0 + ..\src\model-based-design\sharedutils\rt_roundd_snf.cpp + rt_roundd_snf.cpp + 0 + 0 + + + 18 + 71 + 8 + 0 + 0 + 0 + ..\src\model-based-design\sharedutils\rtw_motor_config.c + rtw_motor_config.c + 0 + 0 + + + + + mbd::can-encoder + 0 + 0 + 0 + 0 + + 19 + 72 + 8 + 0 + 0 + 0 + ..\src\model-based-design\can-encoder\can_encoder.cpp + can_encoder.cpp + 0 + 0 + + + + + mbd::can-decoder + 0 + 0 + 0 + 0 + + 20 + 73 + 8 + 0 + 0 + 0 + ..\src\model-based-design\can-decoder\can_decoder.cpp + can_decoder.cpp + 0 + 0 + + + + + mbd::supervisor-rx + 0 + 0 + 0 + 0 + + 21 + 74 + 8 + 0 + 0 + 0 + ..\src\model-based-design\supervisor-rx\SupervisorFSM_RX.cpp + SupervisorFSM_RX.cpp + 0 + 0 + + + + + mbd::supervisor-tx + 0 + 0 + 0 + 0 + + 22 + 75 + 8 + 0 + 0 + 0 + ..\src\model-based-design\supervisor-tx\SupervisorFSM_TX.cpp + SupervisorFSM_TX.cpp + 0 + 0 + + + + + mbd::control-outer + 0 + 0 + 0 + 0 + + 23 + 76 + 8 + 0 + 0 + 0 + ..\src\model-based-design\control-outer\control_outer.cpp + control_outer.cpp + 0 + 0 + + + + + mbd::control-foc + 0 + 0 + 0 + 0 + + 24 + 77 + 8 + 0 + 0 + 0 + ..\src\model-based-design\control-foc\control_foc.cpp + control_foc.cpp + 0 + 0 + + + 24 + 78 + 8 + 0 + 0 + 0 + ..\src\model-based-design\control-foc\FOCInnerLoop.cpp + FOCInnerLoop.cpp + 0 + 0 + + + 24 + 79 + 8 + 0 + 0 + 0 + ..\src\model-based-design\control-foc\control_foc_data.cpp + control_foc_data.cpp + 0 + 0 + + + + + mdb::estimator + 0 + 0 + 0 + 0 + + 25 + 80 + 8 + 0 + 0 + 0 + ..\src\model-based-design\estimator\estimation_velocity.cpp + estimation_velocity.cpp + 0 + 0 + + + + + mbd::filter-current + 0 + 0 + 0 + 0 + + 26 + 81 + 8 + 0 + 0 + 0 + ..\src\model-based-design\filter-current\filter_current.cpp + filter_current.cpp + 0 + 0 + + + + + mbd::amc-bldc + 0 + 0 + 0 + 0 + + 27 + 82 + 8 + 0 + 0 + 0 + ..\src\model-based-design\amc-bldc\AMC_BLDC.cpp + AMC_BLDC.cpp + 0 + 0 + + + + + ::CMSIS + 0 + 0 + 0 + 1 + + +
diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvprojx b/emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvprojx new file mode 100644 index 0000000000..178956c46a --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/proj/amcbldc-application2.uvprojx @@ -0,0 +1,2559 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + amcbldc-app + 0x4 + ARM-ADS + 6190000::V6.19::ARMCLANG + 1 + + + STM32G474QETx + STMicroelectronics + Keil.STM32G4xx_DFP.1.4.0 + http://www.keil.com/pack/ + IRAM(0x20000000,0x00020000) IROM(0x08000000,0x00080000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32G47x-8x_512 -FS08000000 -FL080000 -FP0($$Device:STM32G474QETx$CMSIS\Flash\STM32G47x-8x_512.FLM)) + 0 + $$Device:STM32G474QETx$Drivers\CMSIS\Device\ST\STM32G4xx\Include\stm32g4xx.h + + + + + + + + + + $$Device:STM32G474QETx$CMSIS\SVD\STM32G474xx.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\obj\ + amcbldc + 1 + 0 + 1 + 1 + 1 + .\lst\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + cmd.exe /C copy .\Obj\amcbldc.hex ..\bin\amcbldc.hex + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 0 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 1 + 0x8000000 + 0x80000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x80000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 6 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 1 + 0 + 0 + 0 + 3 + 8 + 1 + 1 + 0 + 0 + 0 + + -Wno-pragma-pack -Wno-deprecated-register -DEMBOT_USE_rtos_osal -DEMBOT_AMCBLDC_APP05 + USE_STM32HAL STM32HAL_BOARD_AMCBLDC STM32HAL_DRIVER_V120 + + ..\..\bsp;..\..\..\..\libs\highlevel\abslayer\osal\api;..\..\..\..\libs\midware\eventviewer\api;..\..\..\..\libs\lowlevel\stm32hal\api;..\..\..\..\embot\app;..\..\..\..\embot\i2h;..\..\..\..\embot\hw;..\..\..\..\embot\os;..\..\..\..\embot;..\..\..\..\embot\app\dsp;..\..\..\..\embot\app\skeleton;..\..\..\..\embot\prot\can;..\..\..\..\..\..\..\..\icub-firmware-shared\can\canProtocolLib;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools;..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Include;..\..\..\..\libs\highlevel\abslayer\hal2\api;..\src\motorhal;..\src\model-based-design\sharedutils;..\src\model-based-design\can-decoder;..\src\model-based-design\can-raw2struct;..\src\model-based-design\supervisor-rx;..\src\model-based-design\supervisor-tx;..\src\model-based-design\can-encoder;..\src\model-based-design\control-outer;..\src\model-based-design\control-foc;..\src\model-based-design\estimator;..\src\model-based-design\amc-bldc;..\src\model-based-design\filter-current + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + .\amcbldc-application.sct + + + --diag_suppress=L6329 + + + + + + + + main + + + amcbldc-main2.cpp + 8 + ..\src\amcbldc-main2.cpp + + + + + embot::app::board::amcbldc + + + embot_app_board_amcbldc_info.cpp + 8 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_info.cpp + + + embot_app_board_amcbldc_MBD.cpp + 8 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_MBD.cpp + + + embot_app_board_amcbldc_MBD.demo.cpp + 8 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_MBD.demo.cpp + + + embot_app_board_amcbldc_theMBD.cpp + 8 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_theMBD.cpp + + + + + embot::app::bldc + + + embot_app_bldc_theMSGbroker.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theMSGbroker.cpp + + + embot_app_bldc_theCOMM.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCOMM.cpp + + + embot_app_bldc_theCTRL.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCTRL.cpp + + + embot_app_bldc_theApplication.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theApplication.cpp + + + + + embot::app::application + + + embot_app_scope.cpp + 8 + ..\..\..\..\embot\app\embot_app_scope.cpp + + + embot_app_application_theCANtracer.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\app\embot_app_application_theCANtracer.cpp + + + embot_app_theLEDmanager.cpp + 8 + ..\..\..\..\embot\app\embot_app_theLEDmanager.cpp + + + embot_app_application_theCANagentCORE.cpp + 8 + ..\..\..\..\embot\app\embot_app_application_theCANagentCORE.cpp + + + embot_app_application_theCANparserCORE.cpp + 8 + ..\..\..\..\embot\app\embot_app_application_theCANparserCORE.cpp + + + + + stm32hal + + + stm32hal.g4.v120.amcbldc.lib + 4 + ..\..\..\..\libs\lowlevel\stm32hal\lib\stm32hal.g4.v120.amcbldc.lib + + + stm32hal.g4.v122.amcbldc.lib + 4 + ..\..\..\..\libs\lowlevel\stm32hal\lib\stm32hal.g4.v122.amcbldc.lib + + + 2 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + + + stm32hal.startup.amcbldc.s + 2 + ..\cfg\stm32hal.startup.amcbldc.s + + + + + rtos + + + osal.cm4.dbg.lib + 4 + ..\..\..\..\..\..\eBcode\arch-arm\libs\highlevel\abslayer\osal\lib\osal.cm4.dbg.lib + + + eventviewer.c + 1 + ..\..\..\..\..\..\eBcode\arch-arm\libs\midware\eventviewer\src\eventviewer.c + + + + + embot::core + + + embot_core.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core.cpp + + + embot_core_binary.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core_binary.cpp + + + + + embot::tools + + + embot_tools.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools\embot_tools.cpp + + + + + embot::hw + + + embot_hw_flash.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_flash.cpp + + + embot_hw.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw.cpp + + + embot_hw_bsp.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_bsp.cpp + + + embot_hw_sys.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_sys.cpp + + + embot_hw_can.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_can.cpp + + + embot_hw_timer.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_timer.cpp + + + embot_hw_gpio.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_gpio.cpp + + + embot_hw_led.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_led.cpp + + + embot_hw_button.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_button.cpp + + + embot_hw_types.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_types.cpp + + + embot_hw_motor.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_motor.cpp + + + + + embot::hw::lowlevel-0optimized + + + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + + + + embot_hw_lowlevel.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_lowlevel.cpp + + + 2 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + + + + + + embot::hw::bsp + + + embot_hw_bsp_amcbldc.cpp + 8 + ..\..\bsp\embot_hw_bsp_amcbldc.cpp + + + + + embot<flash stored info> + + + embot_hw_FlashStorage.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_FlashStorage.cpp + + + embot_app_theCANboardInfo.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\app\embot_app_theCANboardInfo.cpp + + + + + embot::os + + + embot_os.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os.cpp + + + embot_os_Thread.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_Thread.cpp + + + embot_os_theCallbackManager.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_theCallbackManager.cpp + + + embot_os_theScheduler.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_theScheduler.cpp + + + embot_os_theTimerManager.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_theTimerManager.cpp + + + embot_os_Timer.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_Timer.cpp + + + embot_os_Action.cpp + 8 + ..\..\..\..\embot\os\embot_os_Action.cpp + + + embot_os_rtos.cpp + 8 + ..\..\..\..\embot\os\embot_os_rtos.cpp + + + + + embot::prot::can + + + embot_prot_can.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can.cpp + + + embot_prot_can_inertial_periodic.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_inertial_periodic.cpp + + + embot_prot_can_motor_polling.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_motor_polling.cpp + + + embot_prot_can_motor_periodic.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_motor_periodic.cpp + + + embot_prot_can_bootloader.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_bootloader.cpp + + + embot_prot_can_analog_polling.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_analog_polling.cpp + + + embot_prot_can_analog_periodic.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_analog_periodic.cpp + + + + + others-cmsis-math + + + arm_cortexM4lf_math.lib + 4 + ..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Lib\ARM\arm_cortexM4lf_math.lib + + + + + others::motorhal + + + motorhal_config.c + 1 + ..\src\motorhal\motorhal_config.c + + + encoder.c + 8 + ..\src\motorhal\encoder.c + + + pwm.c + 8 + ..\src\motorhal\pwm.c + + + analog.c + 8 + ..\src\motorhal\analog.c + + + + + others::motorhal2 + + + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + + + + motorhal_config.c + 8 + ..\src\motorhal2\motorhal_config.c + + + encoder.c + 8 + ..\src\motorhal2\encoder.c + + + pwm.c + 8 + ..\src\motorhal2\pwm.c + + + analog.c + 8 + ..\src\motorhal2\analog.c + + + + + mbd + + + rt_hypotf_snf.cpp + 8 + ..\src\model-based-design\sharedutils\rt_hypotf_snf.cpp + + + rt_nonfinite.cpp + 8 + ..\src\model-based-design\sharedutils\rt_nonfinite.cpp + + + rtGetInf.cpp + 8 + ..\src\model-based-design\sharedutils\rtGetInf.cpp + + + rtGetNaN.cpp + 8 + ..\src\model-based-design\sharedutils\rtGetNaN.cpp + + + rtw_enable_disable_motors.c + 8 + ..\src\model-based-design\sharedutils\rtw_enable_disable_motors.c + + + const_params.cpp + 8 + ..\src\model-based-design\sharedutils\const_params.cpp + + + uMultiWord2Double.cpp + 8 + ..\src\model-based-design\sharedutils\uMultiWord2Double.cpp + + + uMultiWordShl.cpp + 8 + ..\src\model-based-design\sharedutils\uMultiWordShl.cpp + + + rt_roundd_snf.cpp + 8 + ..\src\model-based-design\sharedutils\rt_roundd_snf.cpp + + + rtw_motor_config.c + 8 + ..\src\model-based-design\sharedutils\rtw_motor_config.c + + + + + mbd::can-encoder + + + can_encoder.cpp + 8 + ..\src\model-based-design\can-encoder\can_encoder.cpp + + + + + mbd::can-decoder + + + can_decoder.cpp + 8 + ..\src\model-based-design\can-decoder\can_decoder.cpp + + + + + mbd::supervisor-rx + + + SupervisorFSM_RX.cpp + 8 + ..\src\model-based-design\supervisor-rx\SupervisorFSM_RX.cpp + + + + + mbd::supervisor-tx + + + SupervisorFSM_TX.cpp + 8 + ..\src\model-based-design\supervisor-tx\SupervisorFSM_TX.cpp + + + + + mbd::control-outer + + + control_outer.cpp + 8 + ..\src\model-based-design\control-outer\control_outer.cpp + + + + + mbd::control-foc + + + control_foc.cpp + 8 + ..\src\model-based-design\control-foc\control_foc.cpp + + + FOCInnerLoop.cpp + 8 + ..\src\model-based-design\control-foc\FOCInnerLoop.cpp + + + control_foc_data.cpp + 8 + ..\src\model-based-design\control-foc\control_foc_data.cpp + + + + + mdb::estimator + + + estimation_velocity.cpp + 8 + ..\src\model-based-design\estimator\estimation_velocity.cpp + + + + + mbd::filter-current + + + filter_current.cpp + 8 + ..\src\model-based-design\filter-current\filter_current.cpp + + + + + mbd::amc-bldc + + + AMC_BLDC.cpp + 8 + ..\src\model-based-design\amc-bldc\AMC_BLDC.cpp + + + + + ::CMSIS + + + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + + + + + + amcbldc-app-motorhal2 + 0x4 + ARM-ADS + 6190000::V6.19::ARMCLANG + 1 + + + STM32G474QETx + STMicroelectronics + Keil.STM32G4xx_DFP.1.4.0 + http://www.keil.com/pack/ + IRAM(0x20000000,0x00020000) IROM(0x08000000,0x00080000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32G47x-8x_512 -FS08000000 -FL080000 -FP0($$Device:STM32G474QETx$CMSIS\Flash\STM32G47x-8x_512.FLM)) + 0 + $$Device:STM32G474QETx$Drivers\CMSIS\Device\ST\STM32G4xx\Include\stm32g4xx.h + + + + + + + + + + $$Device:STM32G474QETx$CMSIS\SVD\STM32G474xx.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\obj\ + amcbldc + 1 + 0 + 1 + 1 + 1 + .\lst\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + cmd.exe /C copy .\Obj\amcbldc.hex ..\bin\amcbldc.hex + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 0 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 1 + 0x8000000 + 0x80000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x80000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 6 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 1 + 0 + 0 + 0 + 3 + 8 + 1 + 1 + 0 + 0 + 0 + + -Wno-pragma-pack -Wno-deprecated-register -DEMBOT_USE_rtos_osal -DEMBOT_AMCBLDC_APP05 + USE_STM32HAL STM32HAL_BOARD_AMCBLDC STM32HAL_DRIVER_V122 + + ..\..\bsp;..\..\..\..\libs\highlevel\abslayer\osal\api;..\..\..\..\libs\midware\eventviewer\api;..\..\..\..\libs\lowlevel\stm32hal\api;..\..\..\..\embot\app;..\..\..\..\embot\i2h;..\..\..\..\embot\hw;..\..\..\..\embot\os;..\..\..\..\embot;..\..\..\..\embot\app\dsp;..\..\..\..\embot\app\skeleton;..\..\..\..\embot\prot\can;..\..\..\..\..\..\..\..\icub-firmware-shared\can\canProtocolLib;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools;..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Include;..\..\..\..\libs\highlevel\abslayer\hal2\api;..\src\motorhal2;..\src\model-based-design\sharedutils;..\src\model-based-design\can-decoder;..\src\model-based-design\can-raw2struct;..\src\model-based-design\supervisor-rx;..\src\model-based-design\supervisor-tx;..\src\model-based-design\can-encoder;..\src\model-based-design\control-outer;..\src\model-based-design\control-foc;..\src\model-based-design\estimator;..\src\model-based-design\amc-bldc;..\src\model-based-design\filter-current;..\..\..\..\embot\app\bldc;..\src\app-board-amcbldc + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + .\amcbldc-application.sct + + + --diag_suppress=L6329 + + + + + + + + main + + + amcbldc-main2.cpp + 8 + ..\src\amcbldc-main2.cpp + + + + + embot::app::board::amcbldc + + + embot_app_board_amcbldc_info.cpp + 8 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_info.cpp + + + embot_app_board_amcbldc_MBD.cpp + 8 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_MBD.cpp + + + embot_app_board_amcbldc_MBD.demo.cpp + 8 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_MBD.demo.cpp + + + 2 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + + + + embot_app_board_amcbldc_theMBD.cpp + 8 + ..\src\app-board-amcbldc\embot_app_board_amcbldc_theMBD.cpp + + + + + embot::app::bldc + + + embot_app_bldc_theMSGbroker.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theMSGbroker.cpp + + + embot_app_bldc_theCOMM.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCOMM.cpp + + + embot_app_bldc_theCTRL.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theCTRL.cpp + + + embot_app_bldc_theApplication.cpp + 8 + ..\..\..\..\embot\app\bldc\embot_app_bldc_theApplication.cpp + + + + + embot::app::application + + + embot_app_scope.cpp + 8 + ..\..\..\..\embot\app\embot_app_scope.cpp + + + embot_app_application_theCANtracer.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\app\embot_app_application_theCANtracer.cpp + + + embot_app_theLEDmanager.cpp + 8 + ..\..\..\..\embot\app\embot_app_theLEDmanager.cpp + + + embot_app_application_theCANagentCORE.cpp + 8 + ..\..\..\..\embot\app\embot_app_application_theCANagentCORE.cpp + + + embot_app_application_theCANparserCORE.cpp + 8 + ..\..\..\..\embot\app\embot_app_application_theCANparserCORE.cpp + + + + + stm32hal + + + stm32hal.g4.v120.amcbldc.lib + 4 + ..\..\..\..\libs\lowlevel\stm32hal\lib\stm32hal.g4.v120.amcbldc.lib + + + 2 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + + + stm32hal.g4.v122.amcbldc.lib + 4 + ..\..\..\..\libs\lowlevel\stm32hal\lib\stm32hal.g4.v122.amcbldc.lib + + + stm32hal.startup.amcbldc.s + 2 + ..\cfg\stm32hal.startup.amcbldc.s + + + + + rtos + + + osal.cm4.dbg.lib + 4 + ..\..\..\..\..\..\eBcode\arch-arm\libs\highlevel\abslayer\osal\lib\osal.cm4.dbg.lib + + + eventviewer.c + 1 + ..\..\..\..\..\..\eBcode\arch-arm\libs\midware\eventviewer\src\eventviewer.c + + + + + embot::core + + + embot_core.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core.cpp + + + embot_core_binary.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core\embot_core_binary.cpp + + + + + embot::tools + + + embot_tools.cpp + 8 + ..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools\embot_tools.cpp + + + + + embot::hw + + + embot_hw_flash.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_flash.cpp + + + embot_hw.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw.cpp + + + embot_hw_bsp.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_bsp.cpp + + + embot_hw_sys.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_sys.cpp + + + embot_hw_can.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_can.cpp + + + embot_hw_timer.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_timer.cpp + + + embot_hw_gpio.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_gpio.cpp + + + embot_hw_led.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_led.cpp + + + embot_hw_button.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_button.cpp + + + embot_hw_types.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_types.cpp + + + embot_hw_motor.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_motor.cpp + + + + + embot::hw::lowlevel-0optimized + + + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + + + + embot_hw_lowlevel.cpp + 8 + ..\..\..\..\embot\hw\embot_hw_lowlevel.cpp + + + 2 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + + + + + + embot::hw::bsp + + + embot_hw_bsp_amcbldc.cpp + 8 + ..\..\bsp\embot_hw_bsp_amcbldc.cpp + + + + + embot<flash stored info> + + + embot_hw_FlashStorage.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\hw\embot_hw_FlashStorage.cpp + + + embot_app_theCANboardInfo.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\app\embot_app_theCANboardInfo.cpp + + + + + embot::os + + + embot_os.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os.cpp + + + embot_os_Thread.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_Thread.cpp + + + embot_os_theCallbackManager.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_theCallbackManager.cpp + + + embot_os_theScheduler.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_theScheduler.cpp + + + embot_os_theTimerManager.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_theTimerManager.cpp + + + embot_os_Timer.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\os\embot_os_Timer.cpp + + + embot_os_Action.cpp + 8 + ..\..\..\..\embot\os\embot_os_Action.cpp + + + embot_os_rtos.cpp + 8 + ..\..\..\..\embot\os\embot_os_rtos.cpp + + + + + embot::prot::can + + + embot_prot_can.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can.cpp + + + embot_prot_can_inertial_periodic.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_inertial_periodic.cpp + + + embot_prot_can_motor_polling.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_motor_polling.cpp + + + embot_prot_can_motor_periodic.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_motor_periodic.cpp + + + embot_prot_can_bootloader.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_bootloader.cpp + + + embot_prot_can_analog_polling.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_analog_polling.cpp + + + embot_prot_can_analog_periodic.cpp + 8 + ..\..\..\..\..\..\eBcode\arch-arm\embot\prot\can\embot_prot_can_analog_periodic.cpp + + + + + others-cmsis-math + + + arm_cortexM4lf_math.lib + 4 + ..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Lib\ARM\arm_cortexM4lf_math.lib + + + + + others::motorhal + + + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + + + + motorhal_config.c + 1 + ..\src\motorhal\motorhal_config.c + + + encoder.c + 8 + ..\src\motorhal\encoder.c + + + pwm.c + 8 + ..\src\motorhal\pwm.c + + + analog.c + 8 + ..\src\motorhal\analog.c + + + + + others::motorhal2 + + + motorhal_config.c + 8 + ..\src\motorhal2\motorhal_config.c + + + encoder.c + 8 + ..\src\motorhal2\encoder.c + + + pwm.c + 8 + ..\src\motorhal2\pwm.c + + + analog.c + 8 + ..\src\motorhal2\analog.c + + + + + mbd + + + rt_hypotf_snf.cpp + 8 + ..\src\model-based-design\sharedutils\rt_hypotf_snf.cpp + + + rt_nonfinite.cpp + 8 + ..\src\model-based-design\sharedutils\rt_nonfinite.cpp + + + rtGetInf.cpp + 8 + ..\src\model-based-design\sharedutils\rtGetInf.cpp + + + rtGetNaN.cpp + 8 + ..\src\model-based-design\sharedutils\rtGetNaN.cpp + + + rtw_enable_disable_motors.c + 8 + ..\src\model-based-design\sharedutils\rtw_enable_disable_motors.c + + + const_params.cpp + 8 + ..\src\model-based-design\sharedutils\const_params.cpp + + + uMultiWord2Double.cpp + 8 + ..\src\model-based-design\sharedutils\uMultiWord2Double.cpp + + + uMultiWordShl.cpp + 8 + ..\src\model-based-design\sharedutils\uMultiWordShl.cpp + + + rt_roundd_snf.cpp + 8 + ..\src\model-based-design\sharedutils\rt_roundd_snf.cpp + + + rtw_motor_config.c + 8 + ..\src\model-based-design\sharedutils\rtw_motor_config.c + + + + + mbd::can-encoder + + + can_encoder.cpp + 8 + ..\src\model-based-design\can-encoder\can_encoder.cpp + + + + + mbd::can-decoder + + + can_decoder.cpp + 8 + ..\src\model-based-design\can-decoder\can_decoder.cpp + + + + + mbd::supervisor-rx + + + SupervisorFSM_RX.cpp + 8 + ..\src\model-based-design\supervisor-rx\SupervisorFSM_RX.cpp + + + + + mbd::supervisor-tx + + + SupervisorFSM_TX.cpp + 8 + ..\src\model-based-design\supervisor-tx\SupervisorFSM_TX.cpp + + + + + mbd::control-outer + + + control_outer.cpp + 8 + ..\src\model-based-design\control-outer\control_outer.cpp + + + + + mbd::control-foc + + + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 5 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + + + + control_foc.cpp + 8 + ..\src\model-based-design\control-foc\control_foc.cpp + + + FOCInnerLoop.cpp + 8 + ..\src\model-based-design\control-foc\FOCInnerLoop.cpp + + + control_foc_data.cpp + 8 + ..\src\model-based-design\control-foc\control_foc_data.cpp + + + + + mdb::estimator + + + estimation_velocity.cpp + 8 + ..\src\model-based-design\estimator\estimation_velocity.cpp + + + + + mbd::filter-current + + + filter_current.cpp + 8 + ..\src\model-based-design\filter-current\filter_current.cpp + + + + + mbd::amc-bldc + + + AMC_BLDC.cpp + 8 + ..\src\model-based-design\amc-bldc\AMC_BLDC.cpp + + + + + ::CMSIS + + + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + 2 + 2 + 2 + 2 + 2 + 0 + 0 + 2 + 2 + 2 + 2 + 2 + + + + + + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + amcbldc-application01 + 0 + 1 + + + + +
diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/amcbldc-main2.cpp b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/amcbldc-main2.cpp new file mode 100644 index 0000000000..5d1cab0964 --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/amcbldc-main2.cpp @@ -0,0 +1,81 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +#include "embot_app_bldc_theApplication.h" + +#include "embot_app_board_amcbldc_info.h" +#include "embot_app_board_amcbldc_mbd.h" + +constexpr embot::app::bldc::theApplication::Config cfg +{ + {embot::app::board::amcbldc::info::getCodePartition, embot::app::board::amcbldc::info::getCANgentCORE}, + {}, // systCfg: the default is typically OK + {}, // CommCfg: the default is typically OK + {embot::app::board::amcbldc::mbd::Startup, embot::app::board::amcbldc::mbd::OnTick} // CtrlCfg: the default stack is typically OK +}; + + +int main(void) +{ + embot::app::bldc::theApplication::getInstance().start(cfg); +} + + + +//#include "embot_app_amcbldc_theApplication.h" + +//constexpr embot::prot::can::applicationInfo applInfo +//{ +// embot::prot::can::versionOfAPPLICATION {2, 0, 1}, +// embot::prot::can::versionOfCANPROTOCOL {2, 0} +//}; + +//constexpr embot::hw::CAN canBus {embot::hw::CAN::one}; + +// the amcbldc board needs class theCANagentCORE derived from embot::app::application::CANagentCORE +// The class theCANagentCORE is OK for the applications of all the boards w/ bootloader underneath +// and w/ a FLASH based storage. +// It allows: the synch of application info in RW storage, the standard management of core CAN messages +// such as change of address, FW update etc. +// But this class theCANagentCORE is not OK for the amc2c which needs a different implementation because +// it will not have a bootloader underneath nor a RW storage, so it will behave differently. + +//#include "embot_app_application_theCANagentCORE.h" + +//embot::app::application::CANagentCORE* amcbldcGetCANgentCORE() +//{ +// static bool initted {false}; +// if(!initted) +// { +// embot::app::application::theCANagentCORE::getInstance().initialise({applInfo, canBus}); +// initted = true; +// } +// return &embot::app::application::theCANagentCORE::getInstance(); +//} + +// the amcbldc board needs this MC specialization, the amc2c may need a different one. let's see. +//#include "embot_app_amcbldc_MBD.h" + +//constexpr embot::app::amcbldc::theApplication::Config cfg +//{ +// {embot::hw::flash::Partition::ID::application, amcbldcGetCANgentCORE}, +// {}, // systCfg: the default is typically OK +// {}, // CommCfg: the default is typically OK +// {embot::app::amcbldc::mbd::Startup, embot::app::amcbldc::mbd::OnTick} // CtrlCfg: the default stack is typically OK +//}; +// + +//int main(void) +//{ +// embot::app::amcbldc::theApplication::getInstance().start(cfg); +//} + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.cpp b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.cpp new file mode 100644 index 0000000000..d7ab32e9fd --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.cpp @@ -0,0 +1,55 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_board_amcbldc_MBD.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + + + +namespace embot::app::board::amcbldc::mbd { + + void Startup(embot::prot::can::Address adr) + { + embot::core::print("MBD is starting up"); + } + + void OnTick(const std::vector &input, std::vector &output) + { +// static uint32_t cnt {0}; +// if(0 == (cnt++ % 3000)) +// { +// embot::core::print("MBD is ticking"); +// } +// +// size_t numRXframes = input.size(); +// +// if(numRXframes > 0) +// { +// // just for test: i get the first only and i send it back twice +// embot::prot::can::Frame f = input[0]; +// embot::prot::can::Frame fr1 {0x101, 3, {1, 2, 3, 0, 0, 0, 0, 0}}; +// output.push_back(fr1); +// output.push_back(f); +// } + } + +} // end of namespace + + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.demo.cpp b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.demo.cpp new file mode 100644 index 0000000000..c47090a64f --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.demo.cpp @@ -0,0 +1,55 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_board_amcbldc_MBD.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + + + +namespace embot::app::board::amcbldc::mbd { + + void Startup(embot::prot::can::Address adr) + { + embot::core::print("demo of MBD is starting up"); + } + + void OnTick(const std::vector &input, std::vector &output) + { + static uint32_t cnt {0}; + if(0 == (cnt++ % 3000)) + { + embot::core::print("demo of MBD is ticking"); + } + + size_t numRXframes = input.size(); + + if(numRXframes > 0) + { + // just for test: i get the first only and i send it back twice + embot::prot::can::Frame f = input[0]; + embot::prot::can::Frame fr1 {0x101, 3, {1, 2, 3, 0, 0, 0, 0, 0}}; + output.push_back(fr1); + output.push_back(f); + } + } + +} // end of namespace + + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.h b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.h new file mode 100644 index 0000000000..b8c6dea493 --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_MBD.h @@ -0,0 +1,30 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_BOARD_AMCBLDC_MBD_H_ +#define __EMBOT_APP_BOARD_AMCBLDC_MBD_H_ + + + +#include "embot_app_bldc_theApplication.h" + + +namespace embot::app::board::amcbldc::mbd { + + void Startup(embot::prot::can::Address adr); + void OnTick(const std::vector &input, std::vector &output); + + } // embot::app::board::amcbldc::mbd { + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_info.cpp b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_info.cpp new file mode 100644 index 0000000000..4dd6cfcceb --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_info.cpp @@ -0,0 +1,79 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + + +#include "embot_app_board_amcbldc_info.h" + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + + +#include "embot_app_application_theCANagentCORE.h" +#include "embot_app_bldc_theApplication.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - the configurable constants +// -------------------------------------------------------------------------------------------------------------------- + +namespace embot::app::board::amcbldc::info { + + constexpr embot::prot::can::applicationInfo applInfo + { + embot::prot::can::versionOfAPPLICATION {2, 0, 1}, + embot::prot::can::versionOfCANPROTOCOL {2, 0} + }; + + + constexpr embot::hw::FLASHpartitionID codePartition + { + embot::hw::FLASHpartitionID::application + }; + + constexpr embot::hw::CAN canBus + { + embot::hw::CAN::one + }; + +} // namespace embot::app::board::amcbldc::info { + +// -------------------------------------------------------------------------------------------------------------------- +// - all the rest +// -------------------------------------------------------------------------------------------------------------------- + + +namespace embot::app::board::amcbldc::info { + + embot::hw::FLASHpartitionID getCodePartition() + { + return codePartition; + } + + embot::app::application::CANagentCORE* getCANgentCORE() + { + static bool initted {false}; + if(!initted) + { + embot::app::application::theCANagentCORE::getInstance().initialise({applInfo, canBus}); + initted = true; + } + return &embot::app::application::theCANagentCORE::getInstance(); + } + +} // namespace embot::app::board::amcbldc::info { + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + + diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_info.h b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_info.h new file mode 100644 index 0000000000..faaf6e81b8 --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_info.h @@ -0,0 +1,32 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_BOARD_AMCBLDC_INFO_H_ +#define __EMBOT_APP_BOARD_AMCBLDC_INFO_H_ + + +#include "embot_core.h" + +#include "embot_app_bldc_theApplication.h" +#include "embot_app_application_CANagentCORE.h" + +namespace embot::app::board::amcbldc::info { + + embot::hw::FLASHpartitionID getCodePartition(); + embot::app::application::CANagentCORE* getCANgentCORE(); + +} // embot::app::board::amcbldc::info { + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.cpp b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.cpp new file mode 100644 index 0000000000..0d2b540bca --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.cpp @@ -0,0 +1,639 @@ + +/* + * Copyright (C) 2021 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_board_amcbldc_theMBD.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_hw_bsp_amcbldc.h" + + +#include "embot_hw_button.h" +#include "embot_hw_motor.h" +#include "embot_app_scope.h" +#include "embot_hw_sys.h" +#include "embot_core.h" +#include "embot_app_theLEDmanager.h" +#include + +// some protocol includes +#include "embot_prot_can_motor_polling.h" +#include "embot_prot_can_motor_periodic.h" + +// hal components +#include "motorhal_config.h" + +// mdb components +#include "AMC_BLDC.h" + +// -------------------------------------------------------------------------------------------------------------------- +// - defines +// -------------------------------------------------------------------------------------------------------------------- +//#define TEST_DURATION_FOC + + +// If the target setup is the KOLLMORGEN motor on RED LEGO platform, +// you need to enable the macro USE_KOLLMORGEN_SETUP, otherwise +// it is implied that motor on wrist mk2 is in use + +//#define EXTFAULT_enabled +#define EXTFAULT_handler_will_disable_motor + +#define EXTFAULT_enabled_polling + +#if defined(EXTFAULT_enabled) +#undef EXTFAULT_enabled_polling +#endif + +// -------------------------------------------------------------------------------------------------------------------- +// - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++ +// -------------------------------------------------------------------------------------------------------------------- + + +namespace embot::app::board::amcbldc { + +struct Measure +{ + public: + // interface + virtual void start() = 0; + virtual void stop() = 0; + + protected: + virtual ~Measure() {}; // cannot delete from interface but only from derived object +}; + +// this implementation does nothing +class MeasureDummy: public Measure +{ +public: + + struct Config + { + uint32_t nothing {0}; + Config() = default; + bool isvalid() const { return true; } + }; + + MeasureDummy() {}; + virtual ~MeasureDummy() {}; + + virtual void start() override {}; + virtual void stop() override {}; +}; + +// how to use it: +// 1. create a MeasureHisto w/ a proper MeasureHisto::Config +// 2. call start() and stop() at the beginning and at the end of the piece of code +// of which you want to measure the duration. +// the duration will be added in a histogram whose properties are in +// Config::minduration, Config::maxduration, Config::resolution +// 3. the histogram can be viewed using method MeasureHisto::report(). +// you must place a breakpoint in it and explore the volatile variables {name, beyond, vals} +// but you can also enable a print. you can use Config::name to differentiate amongst +// multiple instances of MeasureHisto +// 4. method MeasureHisto::report() can be called at any time, but if Config::reportfrequency is true, +// is is also called at the end of stop() at the rate specified by Config::reportfrequency + +struct MeasureHisto : public Measure +{ + struct Config + { + const char *name {"dummy"}; + embot::core::relTime minduration {0}; + embot::core::relTime maxduration {100*embot::core::time1microsec}; + embot::core::relTime resolution {100*embot::core::time1microsec}; + bool enablereport {true}; + uint32_t reportfrequency {10000}; + constexpr Config() = default; + constexpr Config(const char *n, embot::core::relTime min, embot::core::relTime max, + embot::core::relTime res = embot::core::time1microsec, + bool er = true, uint32_t rf = 10000) + : name(n), minduration(min), maxduration(max), resolution(res), + enablereport(er), reportfrequency(rf){} + }; + + Config config {}; + + embot::app::scope::SignalHisto *sighisto {nullptr}; + + const embot::tools::Histogram::Values * vv {nullptr}; + + // i use ram ... maybe not best solution. maybe we could also print the histo. + static constexpr size_t nvals {512}; + volatile uint64_t vals[nvals] {0}; + volatile uint64_t beyond {0}; + uint32_t counter {0}; + + MeasureHisto(const Config &cfg) + { + config = cfg; + if(nullptr == config.name) + { + config.name = "dummy"; + } + sighisto = new embot::app::scope::SignalHisto({config.minduration, config.maxduration, config.resolution}); + vv = sighisto->histogram()->getvalues(); + } + + void start() + { + sighisto->on(); + } + + void stop() + { + sighisto->off(); + + if(config.enablereport) + { + if(++counter >= config.reportfrequency) + { + counter = 0; + report(); + } + } + } + +#define PRINT_REPORT + + void report() + { + beyond = vv->beyond; + + for(int i=0; iinside.size(); i++) + { + if(i < nvals) + { + vals[i] = vv->inside[i]; + } + } + // place a breakpoint in here and inspect: beyond and vals[] + beyond = beyond; + // but you can also use embot::core::print() to collect values from the printf window + // the following code can be easily changed according to needs +#if defined(PRINT_REPORT) + std::string str = std::string("name, beyond, histo = " ) + config.name + ", " + std::to_string(beyond); + for(int v=0; v &inpframes, std::vector &outframes); + + // the code called @ 80/3 kHz (aka every 37.5 usec) inside the DMA1_Channel2_IRQHandler() + // it must be static because we use it as a callback + static void onCurrents_FOC_innerloop(void *owner, const embot::hw::motor::Currents * const currents); + + // the objects which measure the duration of the two above functions + Measure *measureFOC {nullptr}; + Measure *measureTick {nullptr}; + + // all the rest, which may or may not be required anymore + Config _config {}; + bool initted {false}; + + embot::hw::motor::Pwm pwm {0}; + embot::prot::can::motor::polling::ControlMode cm {embot::prot::can::motor::polling::ControlMode::Idle}; + bool applychanges {false}; + + embot::hw::BTN buttonEXTfault {embot::hw::BTN::one}; + static void onEXTFAULTpressedreleased(void *owner); + volatile bool EXTFAULTisPRESSED {false}; + volatile bool prevEXTFAULTisPRESSED {false}; + volatile embot::core::Time EXTFAULTpressedtime {0}; + volatile embot::core::Time EXTFAULTreleasedtime {0}; + + void onEXTFAULTpolling(); + std::vector faultvalues {}; + static constexpr size_t faultcapacity {5}; + + #ifdef PRINT_HISTO_DEBUG + void printHistogram_rxPkt(size_t cur_size); //cur_size is the currente queue size + static constexpr uint8_t numOfBins {11}; //size of queue of the CAN drive plus 1 (in case any packet is received) + uint32_t bin[numOfBins]{0}; + #endif + +}; + + + +bool embot::app::board::amcbldc::theMBD::Impl::initialise(const Config &config) +{ + if(true == initted) + { + return true; + } + + _config = config; + + embot::core::print("embot::app::board::amcbldc::theMBD::Impl::initialise()"); + + // create the measure for the foc + if(true == useDUMMYforFOC) + { + measureFOC = new MeasureDummy; + } + else + { + measureFOC = new MeasureHisto({"foc", 0, 64*embot::core::time1microsec, 1, true, 100*1000}); + } + + // create the measure for the tick + if(true == useDUMMYforTICK) + { + measureTick = new MeasureDummy; + } + else + { + measureTick = new MeasureHisto({"tick", 0, 400*embot::core::time1microsec, 1, true, 10*1000}); + } + + // init the external fault. + // we call cbkOnEXTfault.execute() when the button is pressed or released. + // in the callback we set EXTFAULTisPRESSED true or false depending on value of + // embot::hw::button::pressed(buttonEXTfault) + // we also disable the motors if true. + +#if defined(EXTFAULT_enabled) + + buttonEXTfault = embot::hw::bsp::amcbldc::EXTFAULTbutton(); + + embot::core::Callback cbkOnEXTFAULT {onEXTFAULTpressedreleased, this}; + embot::hw::button::init(buttonEXTfault, {embot::hw::button::Mode::TriggeredOnPressAndRelease, cbkOnEXTFAULT, 0}); + prevEXTFAULTisPRESSED = EXTFAULTisPRESSED = embot::hw::button::pressed(buttonEXTfault); +#elif defined(EXTFAULT_enabled_polling) + + buttonEXTfault = embot::hw::bsp::amcbldc::EXTFAULTbutton(); + + faultvalues.reserve(faultcapacity); + faultvalues.clear(); + + embot::hw::button::init(buttonEXTfault, {embot::hw::button::Mode::Polling, {}, 0}); + for(size_t i=0; i= faultcapacity) + { + faultvalues.erase(faultvalues.begin()); + } + bool pressed = embot::hw::button::pressed(buttonEXTfault); + faultvalues.push_back(pressed); + bool allpressed = std::all_of(faultvalues.cbegin(), faultvalues.cend(), [](auto v){ return v; }); + + EXTFAULTisPRESSED = allpressed; + AMC_BLDC_U.ExternalFlags_p.fault_button = EXTFAULTisPRESSED; + + if(true == EXTFAULTisPRESSED) + { + EXTFAULTpressedtime = embot::core::now(); +#if defined(EXTFAULT_handler_will_disable_motor) + embot::hw::motor::fault(embot::hw::MOTOR::one, true); +#endif + } + else + { + embot::hw::motor::fault(embot::hw::MOTOR::one, false); + EXTFAULTreleasedtime = embot::core::now(); + } + +} + +void embot::app::board::amcbldc::theMBD::Impl::onEXTFAULTpressedreleased(void *owner) +{ + Impl * impl = reinterpret_cast(owner); + if(nullptr == impl) + { + return; + } + + impl->EXTFAULTisPRESSED = embot::hw::button::pressed(impl->buttonEXTfault); + AMC_BLDC_U.ExternalFlags_p.fault_button = impl->EXTFAULTisPRESSED; + + if(true == impl->EXTFAULTisPRESSED) + { + impl->EXTFAULTpressedtime = embot::core::now(); +#if defined(EXTFAULT_handler_will_disable_motor) + embot::hw::motor::fault(embot::hw::MOTOR::one, true); +#endif + } + else + { + embot::hw::motor::fault(embot::hw::MOTOR::one, false); + impl->EXTFAULTreleasedtime = embot::core::now(); + } +} + +// Called every 1 ms +bool embot::app::board::amcbldc::theMBD::Impl::tick(const std::vector &inpframes, std::vector &outframes) +{ + + // in here... + // inpframes.size() is always <= 4. + // outputframes.size() is always = 0 + + measureTick->start(); + + onEXTFAULTpolling(); + + if(prevEXTFAULTisPRESSED != EXTFAULTisPRESSED) + { + prevEXTFAULTisPRESSED = EXTFAULTisPRESSED; + // and manage the transitions [pressed -> unpressed] or vice-versa and use also + // EXTFAULTpressedtime and / or EXTFAULTreleasedtime and + + AMC_BLDC_U.ExternalFlags_p.fault_button = EXTFAULTisPRESSED; + + if(true == EXTFAULTisPRESSED) + { + embot::app::theLEDmanager::getInstance().get(embot::hw::LED::two).on(); + } + else + { + embot::app::theLEDmanager::getInstance().get(embot::hw::LED::two).off(); + } + } + + // add any input can frame into the supervisor input queue + + size_t ninputframes = std::min(inpframes.size(), static_cast(CAN_MAX_NUM_PACKETS)); + + for(uint8_t i=0; istop(); + + + return true; +} + + +void embot::app::board::amcbldc::theMBD::Impl::onCurrents_FOC_innerloop(void *owner, const embot::hw::motor::Currents * const currents) +{ + Impl * impl = reinterpret_cast(owner); + if((nullptr == impl) || (nullptr == currents)) + { + return; + } + + impl->measureFOC->start(); + + // 1. copy currents straight away, so that we can use them + embot::hw::motor::Currents currs = *currents; + +#if defined(TEST_DURATION_FOC) + embot::hw::sys::delay(25); +#else + + // remember to manage impl->EXTFAULTisPRESSED ............ + + // retrieve the current value of the Hall sensors + embot::hw::motor::gethallstatus(embot::hw::MOTOR::one, AMC_BLDC_U.SensorsData_p.motorsensors.hallABC); + + // retrieve the current value of the encoder + embot::hw::motor::Position electricalAngle {0}; + embot::hw::motor::getencoder(embot::hw::MOTOR::one, electricalAngle); + + + static int32_T position {0}; + static int32_T electricalAngleOld = static_cast(electricalAngle); + // keep int16_t ... to manage overflow ... + int16_t delta = electricalAngle - electricalAngleOld; + electricalAngleOld = electricalAngle; + + // calculate the current joint position + position = position + delta / AMC_BLDC_Y.ConfigurationParameters_p.motorconfig.pole_pairs; + + AMC_BLDC_U.SensorsData_p.motorsensors.angle = static_cast(electricalAngle)*0.0054931640625f; // (60 interval angle) + + // convert the current from mA to A + AMC_BLDC_U.SensorsData_p.motorsensors.Iabc[0] = 0.001f*currs.u; + AMC_BLDC_U.SensorsData_p.motorsensors.Iabc[1] = 0.001f*currs.v; + AMC_BLDC_U.SensorsData_p.motorsensors.Iabc[2] = 0.001f*currs.w; + + // ----------------------------------------------------------------------------- + // FOC Step Function (~26.6 KHz) + // ----------------------------------------------------------------------------- + + AMC_BLDC_step_FOC(); + + // ----------------------------------------------------------------------------- + + AMC_BLDC_U.SensorsData_p.jointpositions.position = static_cast(position) * 0.0054931640625f; // iCubDegree -> deg + + // Set the voltages + int32_T Vabc0 = static_cast(AMC_BLDC_Y.ControlOutputs_p.Vabc[0] * 163.83F); + int32_T Vabc1 = static_cast(AMC_BLDC_Y.ControlOutputs_p.Vabc[1] * 163.83F); + int32_T Vabc2 = static_cast(AMC_BLDC_Y.ControlOutputs_p.Vabc[2] * 163.83F); + + embot::hw::motor::setpwm(embot::hw::MOTOR::one, Vabc0, Vabc1, Vabc2); + +//#define DEBUG_PARAMS +#ifdef DEBUG_PARAMS + + static char msg2[64]; + static uint32_t counter; + if(counter % 10 == 0) + { + sprintf(msg2, "%d,%d,%d,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f", \ + Vabc0, \ + Vabc1, \ + Vabc2, \ + AMC_BLDC_U.SensorsData_p.motorsensors.Iabc[0], \ + AMC_BLDC_U.SensorsData_p.motorsensors.Iabc[1], \ + AMC_BLDC_U.SensorsData_p.motorsensors.Iabc[2], \ + AMC_BLDC_U.SensorsData_p.motorsensors.angle, \ + AMC_BLDC_Y.EstimatedData_p.jointvelocities.velocity, \ + AMC_BLDC_B.Targets_n.motorcurrent.current, \ + AMC_BLDC_Y.ControlOutputs_p.Iq_fbk.current, \ + AMC_BLDC_Y.ControlOutputs_p.Vq); + +// sprintf(msg2, "%d,%d,%d,%.3f,%.3f,%.3f", \ +// Vabc0, \ +// Vabc1, \ +// Vabc2, \ +// AMC_BLDC_U.SensorsData_p.motorsensors.Iabc[0], \ +// AMC_BLDC_U.SensorsData_p.motorsensors.Iabc[1], \ +// AMC_BLDC_U.SensorsData_p.motorsensors.Iabc[2]); + embot::core::print(msg2); + counter = 0; + } + counter++; +#endif + +#endif // #if defined(TEST_DURATION_FOC) + + impl->measureFOC->stop(); +} + +#ifdef PRINT_HISTO_DEBUG +void embot::app::board::amcbldc::theMBD::Impl::printHistogram_rxPkt(size_t cur_size) +{ + if(cur_size(); +} + + +embot::app::board::amcbldc::theMBD::~theMBD() { } + + +bool embot::app::board::amcbldc::theMBD::initialise(const Config &config) +{ + return pImpl->initialise(config); +} + +bool embot::app::board::amcbldc::theMBD::tick(const std::vector &inpframes, std::vector &outframes) +{ + return pImpl->tick(inpframes, outframes); +} + + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.h b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.h new file mode 100644 index 0000000000..7ba642238b --- /dev/null +++ b/emBODY/eBcode/arch-arm/board/amcbldc/application/src/app-board-amcbldc/embot_app_board_amcbldc_theMBD.h @@ -0,0 +1,55 @@ + +/* + * Copyright (C) 2021 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef _EMBOT_APP_BOARD_AMCBLDC_THEMBD_H_ +#define _EMBOT_APP_BOARD_AMCBLDC_THEMBD_H_ + + +#include + +#include "embot_core.h" +#include "embot_prot_can.h" + +namespace embot::app::board::amcbldc { + + class theMBD + { + public: + static theMBD& getInstance(); + + struct Config + { + embot::prot::can::Address adr {1}; + constexpr Config() = default; + constexpr Config(embot::prot::can::Address a) : adr(a) {} + }; + + bool initialise(const Config &config); + bool tick(const std::vector &inpframes, std::vector &outframes); + + void on(); + void off(); + + private: + theMBD(); + ~theMBD(); + + private: + struct Impl; + std::unique_ptr pImpl; + }; + +} // namespace + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_COMM.h b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_COMM.h new file mode 100644 index 0000000000..3b93712c16 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_COMM.h @@ -0,0 +1,64 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_BLDC_COMM_H_ +#define __EMBOT_APP_BLDC_COMM_H_ + + +#include +#include +#include "embot_prot_can.h" + + + +namespace embot { namespace app { namespace bldc { + + class COMM + { + public: + + static constexpr size_t MAXcapacity {1111}; + + // transmission methods + virtual bool add(const embot::prot::can::Frame &frame) = 0; + virtual bool add(const std::vector &frames) = 0; + + // retrieval methods + virtual bool get(size_t &remaining, embot::prot::can::Frame &frame) = 0; + virtual bool get(size_t &remaining, std::vector &frames, size_t &retrieved, const size_t max2retrieve = COMM::MAXcapacity) = 0; + + public: + virtual ~COMM() {} + }; + + class dummyCOMM : public COMM + { + public: + + dummyCOMM() {} + virtual ~dummyCOMM() {} + + + // transmission methods + bool add(const embot::prot::can::Frame &frame) override { return false; } + bool add(const std::vector &frames) override { return false; } + + // retrieval methods + bool get(size_t &remaining, embot::prot::can::Frame &frame) override { return false; } + bool get(size_t &remaining, std::vector &frames, size_t &retrieved, const size_t max2retrieve = COMM::MAXcapacity) override { return false; } + }; + +}}} // namespace embot { namespace app { namespace bldc + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theApplication.cpp b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theApplication.cpp new file mode 100644 index 0000000000..e48b2e1b50 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theApplication.cpp @@ -0,0 +1,213 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_bldc_theApplication.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + + +#include "embot_core.h" + +#include + +#include "embot_os_rtos.h" +#include "embot_os_Thread.h" +#include "embot_os_Action.h" +#include "embot_os_Timer.h" + +#include "embot_os_theScheduler.h" + +#include "embot_os_theTimerManager.h" +#include "embot_os_theCallbackManager.h" +#include "embot_app_theLEDmanager.h" + +#include "embot_hw.h" +#include "embot_os.h" + +#include "embot_app_application_CANagentCORE.h" +#include "embot_app_application_theCANagentCORE.h" + +// the comm object +#include "embot_app_bldc_theCOMM.h" + +// the mc control object +#include "embot_app_bldc_theCTRL.h" + + + +// -------------------------------------------------------------------------------------------------------------------- +// - defines +// -------------------------------------------------------------------------------------------------------------------- + + +// -------------------------------------------------------------------------------------------------------------------- +// - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++ +// -------------------------------------------------------------------------------------------------------------------- + +struct embot::app::bldc::theApplication::Impl +{ + + Config _config {}; + + embot::app::application::CANagentCORE *_canagentcore {nullptr}; + + Impl() = default; + + static void onInit(embot::os::Thread *t, void* initparam); + static void onDefaultIdle(embot::os::Thread *t, void* idleparam); + static void onDefaultError(void* errparam); + static constexpr embot::core::Callback _onDefaultOSerror {onDefaultError, nullptr}; + + void justbeforeSchedulerStart(embot::os::Thread *t, void* initparam); + + [[noreturn]] void start(Config config); + +}; + + +[[noreturn]] void embot::app::bldc::theApplication::Impl::start(const Config config) +{ + + if(false == config.isvalid()) + { + for(;;); + } + + _config = config; + + embot::os::InitThread::Config initcfg + { + _config.syst.cfgInit.stacksize, + onInit, + this + }; + + embot::os::IdleThread::Config idlecfg + { + _config.syst.cfgIdle.stacksize, + (_config.syst.cfgIdle.startup != nullptr) ? _config.syst.cfgIdle.startup : nullptr, + (_config.syst.cfgIdle.param != nullptr) ? _config.syst.cfgIdle.param : nullptr, + (_config.syst.cfgIdle.onidle != nullptr) ? _config.syst.cfgIdle.onidle : onDefaultIdle + }; + + embot::os::Config osconfig + { + _config.syst.ostick, + initcfg, + idlecfg, + _config.syst.onOSerror.isvalid() ? _config.syst.onOSerror : _onDefaultOSerror, + _config.core.getcodepartition() + }; + +// embot::hw::setvectortablelocation(_config.core.getcodepartition()); + embot::os::init(osconfig); + embot::os::start(); + +} + + +void embot::app::bldc::theApplication::Impl::onInit(embot::os::Thread *t, void* initparam) +{ + Impl *impl = reinterpret_cast(initparam); + + embot::os::theTimerManager::getInstance().start({}); + embot::os::theCallbackManager::getInstance().start({}); + + static const std::initializer_list allleds = {embot::hw::LED::one, embot::hw::LED::two}; + embot::app::theLEDmanager &theleds = embot::app::theLEDmanager::getInstance(); + theleds.init(allleds); + theleds.get(embot::hw::LED::one).pulse(embot::core::time1second); + theleds.get(embot::hw::LED::two).off(); + + impl->justbeforeSchedulerStart(t, initparam); +} + + +void embot::app::bldc::theApplication::Impl::onDefaultIdle(embot::os::Thread *t, void* idleparam) +{ + static int a = 0; + a++; +} + + +void embot::app::bldc::theApplication::Impl::onDefaultError(void* errparam) +{ + static int code = 0; + embot::os::theScheduler::getInstance().getOSerror(code); + //for(;;); +} + + +void embot::app::bldc::theApplication::Impl::justbeforeSchedulerStart(embot::os::Thread *t, void* initparam) +{ + Impl *impl = reinterpret_cast(initparam); + + // we perform in here all operations formerly done by theCANboardInfo such as synch the application info etc. + impl->_canagentcore = impl->_config.core.getagentcore(); + // we start communication + embot::app::bldc::theCOMM::Config commConfig + { + embot::os::Priority::high44, + impl->_config.comm.stacksize, + 50*embot::core::time1millisec, + impl->_canagentcore, + impl->_config.comm.fifoRXcapacity, impl->_config.comm.fifoTXcapacity + }; + embot::app::bldc::theCOMM::getInstance().initialise(commConfig); + + // we start control + embot::app::bldc::theCTRL::Config ctrlConfig + { + embot::os::Priority::high45, + impl->_config.ctrl.stacksize, + 1*embot::core::time1millisec, + impl->_canagentcore, + &embot::app::bldc::theCOMM::getInstance(), + impl->_config.ctrl.ctrlStartup, + impl->_config.ctrl.ctrlTick + }; + embot::app::bldc::theCTRL::getInstance().initialise(ctrlConfig); + + // we link control w/ communication + embot::app::bldc::theCTRL::getInstance().subscribe(&embot::app::bldc::theCOMM::getInstance()); +} + +// -------------------------------------------------------------------------------------------------------------------- +// - the class +// -------------------------------------------------------------------------------------------------------------------- + +embot::app::bldc::theApplication& embot::app::bldc::theApplication::getInstance() +{ + static theApplication* p = new theApplication(); + return *p; +} + +embot::app::bldc::theApplication::theApplication() +{ + pImpl = std::make_unique(); +} + +embot::app::bldc::theApplication::~theApplication() { } + +[[noreturn]] void embot::app::bldc::theApplication::start(const Config &config) +{ + pImpl->start(config); +} + + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theApplication.h b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theApplication.h new file mode 100644 index 0000000000..552b0f1986 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theApplication.h @@ -0,0 +1,151 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_BLDC_THEAPPLICATION_H_ +#define __EMBOT_APP_BLDC_THEAPPLICATION_H_ + + +#include +#include +#include "embot_os_common.h" +#include "embot_os_thread.h" +#include "embot_hw.h" + +#include "embot_app_application_CANagentCORE.h" + +namespace embot { namespace app { namespace bldc { + + class theApplication + { + public: + + static theApplication& getInstance(); + + using getCodePartition = embot::hw::FLASHpartitionID (*)(); + using getAgentCore = embot::app::application::CANagentCORE* (*)(); + using OnStartupCTRL = void (*)(embot::prot::can::Address adr); + using OnTickCTRL = void (*)(const std::vector &input, std::vector &output); + + struct CoreCfg + { + getCodePartition getcodepartition {nullptr}; + getAgentCore getagentcore {nullptr}; + + constexpr CoreCfg() = default; + + constexpr CoreCfg(getCodePartition c, getAgentCore getag) : getcodepartition(c), getagentcore(getag) {} + + constexpr bool isvalid() const { + bool notok {(nullptr == getagentcore) || (nullptr == getcodepartition)}; + return !notok; + } + }; + + struct SystCfg + { + // in cfgInit it will be used only the stack size. the other fields will not be considered + // if cfgIdle is not specified, then an internal one is used + // if onOSerror is not specified then an internal one is used + embot::core::relTime ostick {1000*embot::core::time1microsec}; + embot::os::InitThread::Config cfgInit {6*1024, nullptr, nullptr}; + embot::os::IdleThread::Config cfgIdle {4*1024, nullptr, nullptr, nullptr}; + embot::core::Callback onOSerror {}; + + constexpr SystCfg() = default; + + constexpr SystCfg(embot::core::relTime t, const embot::os::InitThread::Config &cin, const embot::os::IdleThread::Config &cid) + : ostick(t), cfgInit(cin), cfgIdle(cid) {} + + constexpr bool isvalid() const { + bool notok = (ostick < 500) || (cfgInit.stacksize < 1024); + return !notok; + } + }; + + + struct CommCfg + { + static const uint16_t defstacksize {4*1024}; + uint16_t stacksize {defstacksize}; + uint8_t fifoRXcapacity {32}; + uint8_t fifoTXcapacity {32}; + + constexpr CommCfg() = default; + + constexpr CommCfg(uint16_t s, uint8_t r, uint8_t t) + : stacksize(s), fifoRXcapacity(r), fifoTXcapacity(t) {} + + constexpr bool isvalid() const { + bool notok = (stacksize < 1024) || (fifoRXcapacity < 4) || (fifoTXcapacity < 4); + return !notok; + } + }; + + struct CtrlCfg + { + static const uint16_t defstacksize {6*1024}; + OnStartupCTRL ctrlStartup {nullptr}; + OnTickCTRL ctrlTick {nullptr}; + uint16_t stacksize {defstacksize}; + + constexpr CtrlCfg() = default; + + constexpr CtrlCfg(OnStartupCTRL ctrls, OnTickCTRL ctrlt, uint16_t s = defstacksize) + : ctrlStartup(ctrls), ctrlTick(ctrlt), stacksize(s) {} + + constexpr bool isvalid() const { + bool notok = (stacksize < 1024); + return !notok; + } + }; + + + struct Config + { + CoreCfg core {}; + SystCfg syst {}; + CommCfg comm {}; + CtrlCfg ctrl {}; + + uint32_t tt {0}; + + constexpr Config() = default; + + constexpr Config(const CoreCfg& cc, const SystCfg& sc, const CommCfg& co, const CtrlCfg& ct) + : core(cc), syst(sc), comm(co), ctrl(ct) + {} + + constexpr bool isvalid() const { + bool ok = core.isvalid() && syst.isvalid() && comm.isvalid() && ctrl.isvalid(); + return ok; + } + + }; + + + [[noreturn]] void start(const Config &config); + + + private: + theApplication(); + ~theApplication(); + + private: + struct Impl; + std::unique_ptr pImpl; + }; + +}}} // namespace embot { namespace app { namespace bldc + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCOMM.cpp b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCOMM.cpp new file mode 100644 index 0000000000..3761ac6cf4 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCOMM.cpp @@ -0,0 +1,353 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_bldc_theCOMM.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + + +#include "embot_core.h" + +#include + +#include "embot_os_rtos.h" +#include "embot_os_Thread.h" +#include "embot_os_Action.h" + +#include "embot_hw_can.h" + +#include "embot_app_application_theCANparserCORE.h" +#include "embot_app_bldc_theMSGbroker.h" + +// -------------------------------------------------------------------------------------------------------------------- +// - defines +// -------------------------------------------------------------------------------------------------------------------- + + +// -------------------------------------------------------------------------------------------------------------------- +// - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++ +// -------------------------------------------------------------------------------------------------------------------- + + +namespace embot::app::application { + + + +} // end of namespace + +void thrCOMM(void* p) { reinterpret_cast(p)->run(); } + +struct embot::app::bldc::theCOMM::Impl +{ + static constexpr embot::os::Event evt_COMM_RXcanframe { embot::core::binary::mask::pos2mask(0) }; + static constexpr embot::os::Event evt_COMM_TXcanframes { embot::core::binary::mask::pos2mask(1) }; + + std::vector _tCOMMoutframes; + embot::hw::CAN _tCOMMcanbus {embot::hw::CAN::none}; + embot::prot::can::Address _tCOMMcanaddress {1}; + + embot::app::application::dummyCANagentCORE _dummycanagentcore {}; + + embot::os::EventThread *_t_COMM {nullptr}; + + Config _config {}; + bool _initted {false}; + + + Impl() = default; + + // for the thread tCOMM and the embot::hw::can driver + static void tCOMM_Startup(embot::os::Thread *t, void *param); + static void tCOMM_OnEvent(embot::os::Thread *t, embot::os::EventMask eventmask, void *param); + static void alertonrxframe(void *arg); + + // the initialization code + bool initialise(Config config); + // on timeout + void tCOMM_OnTimeout(embot::os::Thread *t, void *param); + + // when we have a frame in embot::hw::can to retrieve + void tCOMM_OnRXframe(embot::os::Thread *t, embot::os::EventMask eventmask, void *param, const embot::prot::can::Frame &frame, std::vector &outframes); + + // interface to COMM. it is used in this case by theCTRL + bool add(const embot::prot::can::Frame &frame); + bool add(const std::vector &frames); + bool get(size_t &remaining, embot::prot::can::Frame &frame); + bool get(size_t &remaining, std::vector &frames, size_t &retrieved, const size_t max2retrieve); +}; + + +bool embot::app::bldc::theCOMM::Impl::initialise(const Config config) +{ + if(true == _initted) + { + return true; + } + + embot::core::print("embot::app::bldc::theCOMM::Impl::initialise()"); + + if(false == config.isvalid()) + { + return false; + } + + _config = config; + + if(nullptr == _config.canagentcore) + { + _config.canagentcore = &_dummycanagentcore; + } + + // retrieve some CAN constants + _tCOMMcanbus = _config.canagentcore->bus(); + _tCOMMcanaddress = _config.canagentcore->address(); + + // the tCOMM + embot::os::EventThread::Config tCOMM_cfg + { + _config.tCOMM_stacksize, _config.priority, + tCOMM_Startup, this, + _config.tCOMM_timeout, + tCOMM_OnEvent, + "tCOMM" + }; + _t_COMM = new embot::os::EventThread; + + // init the CORE parser + embot::app::application::theCANparserCORE::getInstance().initialise({_config.canagentcore}); + + // init the the MSGbroker + embot::app::bldc::theMSGbroker::getInstance().initialise({}); + + // and subscribe the tCOMM to be triggered by the OUT direction of the MSGbroker + embot::os::Action act {embot::os::EventToThread(evt_COMM_TXcanframes, _t_COMM)}; + embot::app::bldc::theMSGbroker::getInstance().subscribe(embot::app::bldc::theMSGbroker::Direction::OUT, act); + + // and now ... start the tCOMM + _t_COMM->start(tCOMM_cfg, thrCOMM); + + + _initted = true; + return _initted; +} + +void embot::app::bldc::theCOMM::Impl::alertonrxframe(void *arg) +{ + embot::os::EventThread* evthr = reinterpret_cast(arg); + if(nullptr != evthr) + { + evthr->setEvent(evt_COMM_RXcanframe); + } +} + +void embot::app::bldc::theCOMM::Impl::tCOMM_Startup(embot::os::Thread *t, void *param) +{ + Impl *impl = reinterpret_cast(param); + + // init the can ... + embot::hw::can::Config canconfig {}; + canconfig.rxcapacity = impl->_config.tCOMMmaxINPcanframes; + canconfig.txcapacity = impl->_config.tCOMMmaxOUTcanframes; + canconfig.onrxframe = embot::core::Callback(impl->alertonrxframe, t); + embot::hw::can::init(impl->_tCOMMcanbus, canconfig); +#if defined(STM32HAL_BOARD_AMC2C) + #warning marco.accame: attenzione la amc2c non apprezza il can::setfilters +#else + embot::hw::can::setfilters(impl->_tCOMMcanbus, impl->_tCOMMcanaddress); +#endif + // pre-allocate output vector of frames + impl->_tCOMMoutframes.reserve(impl->_config.tCOMMmaxOUTcanframes); + + // and ok, enable it + embot::hw::can::enable(impl->_tCOMMcanbus); + +// // init the CORE parser +// embot::app::application::theCANparserCORE::getInstance().initialise({impl->_config.canagentcore}); +// +// // init the the MSGbroker +// embot::app::bldc::theMSGbroker::getInstance().initialise({}); +// +// // and subscribe the OUT direction to this thread +// embot::os::Action act {embot::os::EventToThread(evt_COMM_TXcanframes, t)}; +// embot::app::bldc::theMSGbroker::getInstance().subscribe(embot::app::bldc::theMSGbroker::Direction::OUT, act); +} + +void embot::app::bldc::theCOMM::Impl::tCOMM_OnTimeout(embot::os::Thread *t, void *param) +{ + +} + +#define PARSE_RX_ALLINONESHOT + +void embot::app::bldc::theCOMM::Impl::tCOMM_OnEvent(embot::os::Thread *t, embot::os::EventMask eventmask, void *param) +{ + Impl *impl = reinterpret_cast(param); + + // manage the events + if(0 == eventmask) + { + impl->tCOMM_OnTimeout(t, param); + return; + } + + if(true == embot::core::binary::mask::check(eventmask, evt_COMM_RXcanframe)) + { +#if defined(PARSE_RX_ALLINONESHOT) + // attempt to get all messages in one shot + std::uint8_t insideRXQ = embot::hw::can::inputqueuesize(impl->_tCOMMcanbus); + std::uint8_t remainingINrx = 0; + embot::hw::can::Frame hwframe {}; + for(uint8_t i=0; i_tCOMMcanbus, hwframe, remainingINrx)) + { + impl->tCOMM_OnRXframe(t, eventmask, param, {hwframe.id, hwframe.size, hwframe.data}, impl->_tCOMMoutframes); + } + } + // if any arrives since we called embot::hw::can::inputqueuesize(tCOMMcanbus) ... + if(remainingINrx > 0) + { + t->setEvent(evt_COMM_RXcanframe); + } +#else + // get all the messages, one at a time. + // we pass it through the basic parser. if not parsed we it inside the theMSGbroker + embot::hw::can::Frame hwframe; + std::uint8_t remainingINrx = 0; + if(embot::hw::resOK == embot::hw::can::get(impl->_tCOMMcanbus, hwframe, remainingINrx)) + { + impl->tCOMM_OnRXframe(t, eventmask, param, {hwframe.id, hwframe.size, hwframe.data}, impl->_tCOMMoutframes); + + if(remainingINrx > 0) + { + t->setEvent(evt_COMM_RXcanframe); + } + } +#endif + } + + if(true == embot::core::binary::mask::check(eventmask, evt_COMM_TXcanframes)) + { + // get all the messages from the theMSGbroker and put them inside the tCOMMoutframes + size_t remaining {0}; + size_t retrieved {0}; + embot::app::bldc::theMSGbroker::getInstance().rem(embot::app::bldc::theMSGbroker::Direction::OUT, remaining, impl->_tCOMMoutframes, retrieved); + } + + // finally, if we have any packet we transmit them + size_t num = impl->_tCOMMoutframes.size(); + if(num > 0) + { + for(size_t i=0; i_tCOMMcanbus, {impl->_tCOMMoutframes[i].id, impl->_tCOMMoutframes[i].size, impl->_tCOMMoutframes[i].data}); + } + embot::hw::can::transmit(impl->_tCOMMcanbus); + } + + // and now we can clear the frames to be trasmitted + impl->_tCOMMoutframes.clear(); +} + + +void embot::app::bldc::theCOMM::Impl::tCOMM_OnRXframe(embot::os::Thread *t, embot::os::EventMask eventmask, void *param, const embot::prot::can::Frame &frame, std::vector &outframes) +{ + constexpr uint8_t CANaddressMASTER {0}; + + if(true == embot::app::application::theCANparserCORE::getInstance().process(frame, outframes)) + { + } + else if(CANaddressMASTER == embot::prot::can::frame2sender(frame)) + { + #warning TODO: call theMSGbroker.add(asRX, frame, outframes) outframes MAY be filled w/ a debug message + embot::app::bldc::theMSGbroker::getInstance().add(embot::app::bldc::theMSGbroker::Direction::INP, frame); + } +} + + +bool embot::app::bldc::theCOMM::Impl::add(const embot::prot::can::Frame &frame) +{ + return embot::app::bldc::theMSGbroker::getInstance().add(embot::app::bldc::theMSGbroker::Direction::OUT, frame); +} + +bool embot::app::bldc::theCOMM::Impl::add(const std::vector &frames) +{ + return embot::app::bldc::theMSGbroker::getInstance().add(embot::app::bldc::theMSGbroker::Direction::OUT, frames); +} + +bool embot::app::bldc::theCOMM::Impl::get(size_t &remaining, embot::prot::can::Frame &frame) +{ + return embot::app::bldc::theMSGbroker::getInstance().rem(embot::app::bldc::theMSGbroker::Direction::INP, remaining, frame); +} + +bool embot::app::bldc::theCOMM::Impl::get(size_t &remaining, std::vector &frames, size_t &retrieved, const size_t max2retrieve) +{ + return embot::app::bldc::theMSGbroker::getInstance().rem(embot::app::bldc::theMSGbroker::Direction::INP, remaining, frames, retrieved, max2retrieve); +} + + +// -------------------------------------------------------------------------------------------------------------------- +// - the class +// -------------------------------------------------------------------------------------------------------------------- + +embot::app::bldc::theCOMM& embot::app::bldc::theCOMM::getInstance() +{ + static theCOMM* p = new theCOMM(); + return *p; +} + +embot::app::bldc::theCOMM::theCOMM() +{ + pImpl = std::make_unique(); +} + +embot::app::bldc::theCOMM::~theCOMM() { } + +bool embot::app::bldc::theCOMM::initialise(const Config &config) +{ + return pImpl->initialise(config); +} + +//bool embot::app::bldc::theCOMM::subscribe(Direction dir, const embot::os::Action &action) +//{ +// return pImpl->subscribe(dir, action); +//} + + + +bool embot::app::bldc::theCOMM::add(const embot::prot::can::Frame &frame) +{ + return pImpl->add(frame); +} + +bool embot::app::bldc::theCOMM::add(const std::vector &frames) +{ + return pImpl->add(frames); +} + +bool embot::app::bldc::theCOMM::get(size_t &remaining, embot::prot::can::Frame &frame) +{ + return pImpl->get(remaining, frame); +} + +bool embot::app::bldc::theCOMM::get(size_t &remaining, std::vector &frames, size_t &retrieved, const size_t max2retrieve) +{ + return pImpl->get(remaining, frames, retrieved, max2retrieve); +} + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCOMM.h b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCOMM.h new file mode 100644 index 0000000000..925e20715f --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCOMM.h @@ -0,0 +1,84 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_BLDC_THECOMM_H_ +#define __EMBOT_APP_BLDC_THECOMM_H_ + + +#include +#include +#include "embot_prot_can.h" +#include "embot_app_bldc_COMM.h" +#include "embot_app_application_CANagentCORE.h" +#include "embot_os_common.h" + +namespace embot { namespace app { namespace bldc { + + + class theCOMM : public embot::app::bldc::COMM + { + public: + + static theCOMM& getInstance(); + + struct Config + { + embot::os::Priority priority {embot::os::Priority::high44}; + uint16_t tCOMM_stacksize {4*1024}; + embot::core::relTime tCOMM_timeout {50*embot::core::time1millisec}; + embot::app::application::CANagentCORE *canagentcore {nullptr}; + uint8_t tCOMMmaxINPcanframes {32}; + uint8_t tCOMMmaxOUTcanframes {32}; + + + constexpr Config() = default; + constexpr Config(embot::os::Priority p, uint16_t st, embot::core::relTime to, embot::app::application::CANagentCORE *ca, uint8_t r, uint8_t t) + : priority(p), tCOMM_stacksize(st), tCOMM_timeout(to), canagentcore(ca), tCOMMmaxINPcanframes(r), tCOMMmaxOUTcanframes(t) + {} + constexpr bool isvalid() const { + bool notok = (tCOMM_stacksize < 1024) || (tCOMM_timeout < embot::core::time1millisec) || + // it may be nullptr ... || (nullptr == canagentcore) + (tCOMMmaxINPcanframes == 0) || (tCOMMmaxOUTcanframes == 0); + return !notok; + } + }; + + + static constexpr size_t MAXcapacity = 999; + + bool initialise(const Config &config); + + +// bool subscribe(Direction dir, const embot::os::Action &action); + + bool add(const embot::prot::can::Frame &frame) override; + bool add(const std::vector &frames) override; + + // retrieval methods + bool get(size_t &remaining, embot::prot::can::Frame &frame) override; + bool get(size_t &remaining, std::vector &frames, size_t &retrieved, const size_t max2retrieve = COMM::MAXcapacity) override; + + + private: + theCOMM(); + ~theCOMM(); + + private: + struct Impl; + std::unique_ptr pImpl; + }; + +}}} // namespace embot { namespace app { namespace bldc + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCTRL.cpp b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCTRL.cpp new file mode 100644 index 0000000000..654141c7c6 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCTRL.cpp @@ -0,0 +1,254 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_bldc_theCTRL.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + + +#include "embot_core.h" + +#include + +#include "embot_os_rtos.h" +#include "embot_os_Thread.h" +#include "embot_os_Action.h" +#include "embot_os_Timer.h" + +// -------------------------------------------------------------------------------------------------------------------- +// - defines +// -------------------------------------------------------------------------------------------------------------------- + + +// -------------------------------------------------------------------------------------------------------------------- +// - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++ +// -------------------------------------------------------------------------------------------------------------------- + + +namespace embot::app::application { + + + +} // end of namespace + + +void thrCTRL(void* p) { reinterpret_cast(p)->run(); } + +struct embot::app::bldc::theCTRL::Impl +{ + static constexpr std::uint8_t tCTRLmaxINPcanframes = 4; + static constexpr std::uint8_t tCTRLmaxOUTcanframes = 4; + + static constexpr embot::os::Event evt_CTRL_tick { embot::core::binary::mask::pos2mask(0) }; +// static constexpr embot::os::Event evt_CTRL_TXcanframes { embot::core::binary::mask::pos2mask(1) }; + + + static constexpr embot::core::relTime _tCTRL_timeout {50*embot::core::time1millisec}; + + embot::app::application::dummyCANagentCORE _dummycanagentcore {}; + embot::app::bldc::dummyCOMM _dummycomm {}; + + std::vector _tCTRLoutframes {}; + std::vector _tCTRLinpframes {}; + + embot::hw::CAN _tCTRLcanbus {embot::hw::CAN::none}; + embot::prot::can::Address _tCTRLcanaddress {1}; + + embot::os::EventThread *_t_CTRL {nullptr}; + embot::os::Timer * _tCTRL_tickTimer {nullptr}; + + Config _config {}; + bool _initted {false}; + + + Impl() = default; + + // for the thread tCTRL and the embot::hw::can driver + static void tCTRL_Startup(embot::os::Thread *t, void *param); + static void tCTRL_OnEvent(embot::os::Thread *t, embot::os::EventMask eventmask, void *param); + static void alertonrxframe(void *arg); + + // the initialization code + bool initialise(Config config); + // on timeout + void tCTRL_OnTimeout(embot::os::Thread *t, void *param); + + // when we have a frame in embot::hw::can to retrieve + void tCTRL_OnRXframe(embot::os::Thread *t, embot::os::EventMask eventmask, void *param, const embot::prot::can::Frame &frame, std::vector &outframes); + + + bool subscribe(embot::app::bldc::COMM *comm); +}; + + +bool embot::app::bldc::theCTRL::Impl::initialise(const Config config) +{ + if(true == _initted) + { + return true; + } + + embot::core::print("embot::app::bldc::theCTRL::Impl::initialise()"); + + if(false == config.isvalid()) + { + return false; + } + + _config = config; + + if(nullptr == _config.comm) + { + _config.comm = &_dummycomm; + } + + if(nullptr == _config.canagentcore) + { + _config.canagentcore = &_dummycanagentcore; + } + + // retrieve some CAN constants + _tCTRLcanbus = _config.canagentcore->bus(); + _tCTRLcanaddress = _config.canagentcore->address(); + + + // the tCOMM + embot::os::EventThread::Config tCTRL_cfg + { + _config.tCTRL_stacksize, _config.priority, + tCTRL_Startup, this, + _tCTRL_timeout, + tCTRL_OnEvent, + "tCTRL" + }; + _t_CTRL = new embot::os::EventThread; + + + // and now ... start the tCTRL + _t_CTRL->start(tCTRL_cfg, thrCTRL); + + _initted = true; + return _initted; +} + + + +void embot::app::bldc::theCTRL::Impl::tCTRL_Startup(embot::os::Thread *t, void *param) +{ + Impl *impl = reinterpret_cast(param); + + impl->_tCTRLoutframes.reserve(tCTRLmaxOUTcanframes); + impl->_tCTRLinpframes.reserve(tCTRLmaxINPcanframes); + + // start a timer which ticks the thread tCTRL + impl->_tCTRL_tickTimer = new embot::os::Timer; + embot::os::Action act(embot::os::EventToThread(evt_CTRL_tick, t)); + embot::os::Timer::Config cfg{impl->_config.tCTRL_period, act, embot::os::Timer::Mode::forever, 0}; + impl->_tCTRL_tickTimer->start(cfg); + + if(nullptr != impl->_config.onstartup) + { + impl->_config.onstartup(impl->_config.canagentcore->address()); + } + } + +void embot::app::bldc::theCTRL::Impl::tCTRL_OnTimeout(embot::os::Thread *t, void *param) +{ + +} + +void embot::app::bldc::theCTRL::Impl::tCTRL_OnEvent(embot::os::Thread *t, embot::os::EventMask eventmask, void *param) +{ + Impl *impl = reinterpret_cast(param); + + // manage the events + if(0 == eventmask) + { + impl->tCTRL_OnTimeout(t, param); + return; + } + + if(true == embot::core::binary::mask::check(eventmask, evt_CTRL_tick)) + { + // for a start get up to 4 canframes in here. + impl->_tCTRLinpframes.clear(); + impl->_tCTRLoutframes.clear(); + + size_t numRXframes {1}; + //embot::app::application::theMSGbroker::getInstance().size(embot::app::application::theMSGbroker::Direction::INP); + + if(numRXframes > 0) + { + size_t retrieved {0}; + size_t remaining {0}; + impl->_config.comm->get(remaining, impl->_tCTRLinpframes, retrieved, tCTRLmaxINPcanframes); + } + + impl->_config.ontick(impl->_tCTRLinpframes, impl->_tCTRLoutframes); + + size_t numTXframes = impl->_tCTRLoutframes.size(); + + if(numTXframes > 0) + { + impl->_config.comm->add(impl->_tCTRLoutframes); + } + } +} + + +bool embot::app::bldc::theCTRL::Impl::subscribe(embot::app::bldc::COMM *comm) +{ + bool r {nullptr != comm}; + + if(true == r) + { + _config.comm = comm; + } + + return r; +} + + +// -------------------------------------------------------------------------------------------------------------------- +// - the class +// -------------------------------------------------------------------------------------------------------------------- + +embot::app::bldc::theCTRL& embot::app::bldc::theCTRL::getInstance() +{ + static theCTRL* p = new theCTRL(); + return *p; +} + +embot::app::bldc::theCTRL::theCTRL() +{ + pImpl = std::make_unique(); +} + +embot::app::bldc::theCTRL::~theCTRL() { } + +bool embot::app::bldc::theCTRL::initialise(const Config &config) +{ + return pImpl->initialise(config); +} + +bool embot::app::bldc::theCTRL::subscribe(embot::app::bldc::COMM *comm) +{ + return pImpl->subscribe(comm); +} + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCTRL.h b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCTRL.h new file mode 100644 index 0000000000..062d7f3db4 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theCTRL.h @@ -0,0 +1,84 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_BLDC_THECTRL_H_ +#define __EMBOT_APP_BLDC_THECTRL_H_ + + +#include +#include +#include "embot_app_bldc_COMM.h" +#include "embot_app_application_theCANagentCORE.h" +#include "embot_os_common.h" + +namespace embot { namespace app { namespace bldc { + + class theCTRL + { + public: + + static theCTRL& getInstance(); + + using OnStartup = void (*)(embot::prot::can::Address adr); + using OnTick = void (*)(const std::vector &input, std::vector &output); + + struct Config + { + embot::os::Priority priority {embot::os::Priority::high44}; + uint16_t tCTRL_stacksize {6*1024}; + embot::core::relTime tCTRL_period {1*embot::core::time1millisec}; + + embot::app::application::CANagentCORE *canagentcore {nullptr}; + embot::app::bldc::COMM *comm {nullptr}; + + OnStartup onstartup {nullptr}; + OnTick ontick {nullptr}; + + + constexpr Config() = default; + constexpr Config(embot::os::Priority p, uint16_t st, embot::core::relTime pe, + embot::app::application::CANagentCORE *ca, embot::app::bldc::COMM *co, + OnStartup ost, OnTick ot) + : priority(p), tCTRL_stacksize(st), tCTRL_period(pe), + canagentcore(ca), comm(co), + onstartup(ost), ontick(ot) + {} + constexpr bool isvalid() const { + bool notok = (tCTRL_stacksize < 1024) || (tCTRL_period < 500) || + // they may be nullptr ... (nullptr == comm) || (nullptr == canagentcore) || + (nullptr == ontick); + return !notok; + } + }; + + + static constexpr size_t MAXcapacity = 999; + + bool initialise(const Config &config); + + bool subscribe(embot::app::bldc::COMM *comm); + + + private: + theCTRL(); + ~theCTRL(); + + private: + struct Impl; + std::unique_ptr pImpl; + }; + +}}} // namespace embot { namespace app { namespace bldc + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theMSGbroker.cpp b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theMSGbroker.cpp new file mode 100644 index 0000000000..8c83a679e3 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theMSGbroker.cpp @@ -0,0 +1,361 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_bldc_theMSGbroker.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + + +#include "embot_core.h" + +#include + +#include "embot_os_rtos.h" +#include "embot_os_Thread.h" +#include "embot_os_Action.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - defines +// -------------------------------------------------------------------------------------------------------------------- + + +// -------------------------------------------------------------------------------------------------------------------- +// - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++ +// -------------------------------------------------------------------------------------------------------------------- + + +namespace embot::app::bldc { + + + +} // end of namespace + + +struct embot::app::bldc::theMSGbroker::Impl +{ + Impl() = default; + + embot::os::Action _onTX {}; + embot::os::Action _onRX {}; + + Config _config {}; + bool _initted {false}; + + embot::os::rtos::mutex_t *_rxm {nullptr}; + std::vector _rxCANvector {}; + embot::os::rtos::mutex_t *_txm {nullptr}; + std::vector _txCANvector {}; + + // the initialization code + bool initialise(Config config); + + size_t size(Direction dir) const; + + bool add(Direction dir, const embot::prot::can::Frame &frame); + bool add(Direction dir, const std::vector &frames); + + bool rem(Direction dir, size_t &remaining, embot::prot::can::Frame &frame); + bool rem(Direction dir, size_t &remaining, std::vector &frames, size_t &retrieved, const size_t max2retrieve); + + bool subscribe(Direction dir, const embot::os::Action &action); +}; + + +bool embot::app::bldc::theMSGbroker::Impl::initialise(const Config config) +{ + if(true == _initted) + { + return true; + } + + embot::core::print("embot::app::bldc::theMSGbroker::Impl::initialise()"); + + if(false == config.isvalid()) + { + return false; + } + + _config = config; + + _rxm = embot::os::rtos::mutex_new(); + _txm = embot::os::rtos::mutex_new(); + _rxCANvector.reserve(_config.rxCapacity); + _txCANvector.reserve(_config.txCapacity); + + _initted = true; + return _initted; +} + + +size_t embot::app::bldc::theMSGbroker::Impl::size(Direction dir) const +{ + size_t r {0}; + + if(Direction::INP == dir) + { + embot::os::rtos::mutex_take(_rxm, embot::core::reltimeWaitForever); + r = _rxCANvector.size(); + embot::os::rtos::mutex_release(_rxm); + } + else + { + embot::os::rtos::mutex_take(_txm, embot::core::reltimeWaitForever); + r = _txCANvector.size(); + embot::os::rtos::mutex_release(_txm); + } + + return r; +} + +bool embot::app::bldc::theMSGbroker::Impl::add(Direction dir, const embot::prot::can::Frame &frame) +{ + bool r {false}; + + constexpr size_t s = 1; // surely 1 is compatible w/ capacity + + if(Direction::INP == dir) + { + embot::os::rtos::mutex_take(_rxm, embot::core::reltimeWaitForever); +#if defined(SHARED_CIRCULAR) + if((_rxCANvector.size() + s) > _config.rxCapacity) + { + _rxCANvector.erase(_rxCANvector.begin()); + } +#endif + _rxCANvector.push_back(frame); + _onRX.execute(); + r = true; + embot::os::rtos::mutex_release(_rxm); + } + else + { + embot::os::rtos::mutex_take(_txm, embot::core::reltimeWaitForever); +#if defined(SHARED_CIRCULAR) + if((_txCANvector.size() + s) > _config.txCapacity) + { + _txCANvector.erase(_txCANvector.begin()); + } +#endif + _txCANvector.push_back(frame); + _onTX.execute(); + r = true; + embot::os::rtos::mutex_release(_txm); + } + + return r; +} + +bool embot::app::bldc::theMSGbroker::Impl::add(Direction dir, const std::vector &frames) +{ + bool r {false}; + + if(true == frames.empty()) + { + return r; + } + +#if defined(SHARED_CIRCULAR) + // we limit the number of insertable frames to capacity + const size_t s = std::min(frames.size(), (Direction::INP == dir) ? _config.rxCapacity : _config.txCapacity); +#else + const size_t s = frames.size(); +#endif + + if(Direction::INP == dir) + { + embot::os::rtos::mutex_take(_rxm, embot::core::reltimeWaitForever); +#if defined(SHARED_CIRCULAR) + int toremove = s - (_config.rxCapacity - _rxCANvector.size()); + if(toremove > 0) + { + _rxCANvector.erase(_rxCANvector.begin(), _rxCANvector.begin() + toremove); + } +#endif + _rxCANvector.insert(_rxCANvector.end(), frames.begin(), frames.begin() + s); + _onRX.execute(); + r = true; + embot::os::rtos::mutex_release(_rxm); + } + else + { + embot::os::rtos::mutex_take(_txm, embot::core::reltimeWaitForever); +#if defined(SHARED_CIRCULAR) + int toremove = s - (_config.txCapacity - _txCANvector.size()); + if(toremove > 0) + { + _txCANvector.erase(_txCANvector.begin(), _txCANvector.begin() + toremove); + } +#endif + _txCANvector.insert(_txCANvector.end(), frames.begin(), frames.begin() + s); + _onTX.execute(); + r = true; + embot::os::rtos::mutex_release(_txm); + } + + return r; +} + + +bool embot::app::bldc::theMSGbroker::Impl::rem(Direction dir, size_t &remaining, embot::prot::can::Frame &frame) +{ + bool r {false}; + + remaining = 0; + embot::prot::can::Frame ff {}; + + if(Direction::INP == dir) + { + embot::os::rtos::mutex_take(_rxm, embot::core::reltimeWaitForever); + if(!_rxCANvector.empty()) + { + ff = _rxCANvector.front(); + frame = ff; + _rxCANvector.erase(_rxCANvector.begin()); + remaining = _rxCANvector.size(); + r = true; + } + embot::os::rtos::mutex_release(_rxm); + } + else + { + embot::os::rtos::mutex_take(_txm, embot::core::reltimeWaitForever); + if(!_txCANvector.empty()) + { + ff = _txCANvector.front(); + frame = ff; + _txCANvector.erase(_txCANvector.begin()); + remaining = _txCANvector.size(); + r = true; + } + embot::os::rtos::mutex_release(_txm); + } + + return r; +} + +bool embot::app::bldc::theMSGbroker::Impl::rem(Direction dir, size_t &remaining, std::vector &frames, size_t &retrieved, const size_t max2retrieve) +{ + bool r {false}; + + remaining = 0; + retrieved = 0; + + if(Direction::INP == dir) + { + embot::os::rtos::mutex_take(_rxm, embot::core::reltimeWaitForever); + retrieved = std::min(max2retrieve, _rxCANvector.size()); + if(retrieved > 0) + { + frames.assign(_rxCANvector.begin(), _rxCANvector.begin() + retrieved); + _rxCANvector.erase(_rxCANvector.begin(), _rxCANvector.begin() + retrieved); + remaining = _rxCANvector.size(); + r = true; + } + embot::os::rtos::mutex_release(_rxm); + } + else + { + embot::os::rtos::mutex_take(_txm, embot::core::reltimeWaitForever); + retrieved = std::min(max2retrieve, _txCANvector.size()); + if(retrieved > 0) + { + frames.assign(_txCANvector.begin(), _txCANvector.begin() + retrieved); + _txCANvector.erase(_txCANvector.begin(), _txCANvector.begin() + retrieved); + remaining = _txCANvector.size(); + r = true; + } + embot::os::rtos::mutex_release(_txm); + } + + return r; +} + + +bool embot::app::bldc::theMSGbroker::Impl::subscribe(Direction dir, const embot::os::Action &action) +{ + if(Direction::INP == dir) + { + embot::os::rtos::mutex_take(_rxm, embot::core::reltimeWaitForever); + _onRX = action; + embot::os::rtos::mutex_release(_rxm); + } + else + { + embot::os::rtos::mutex_take(_txm, embot::core::reltimeWaitForever); + _onTX = action; + embot::os::rtos::mutex_release(_txm); + } + + return true; +} + + +// -------------------------------------------------------------------------------------------------------------------- +// - the class +// -------------------------------------------------------------------------------------------------------------------- + +embot::app::bldc::theMSGbroker& embot::app::bldc::theMSGbroker::getInstance() +{ + static theMSGbroker* p = new theMSGbroker(); + return *p; +} + +embot::app::bldc::theMSGbroker::theMSGbroker() +{ + pImpl = std::make_unique(); +} + +embot::app::bldc::theMSGbroker::~theMSGbroker() { } + +bool embot::app::bldc::theMSGbroker::initialise(const Config &config) +{ + return pImpl->initialise(config); +} + +size_t embot::app::bldc::theMSGbroker::size(Direction dir) const +{ + return pImpl->size(dir); +} + +bool embot::app::bldc::theMSGbroker::add(Direction dir, const embot::prot::can::Frame &frame) +{ + return pImpl->add(dir, frame); +} + +bool embot::app::bldc::theMSGbroker::add(Direction dir, const std::vector &frames) +{ + return pImpl->add(dir, frames); +} + +bool embot::app::bldc::theMSGbroker::rem(Direction dir, size_t &remaining, embot::prot::can::Frame &frame) +{ + return pImpl->rem(dir, remaining, frame); +} + +bool embot::app::bldc::theMSGbroker::rem(Direction dir, size_t &remaining, std::vector &frames, size_t &retrieved, const size_t max2retrieve) +{ + return pImpl->rem(dir, remaining, frames, retrieved, max2retrieve); +} + +bool embot::app::bldc::theMSGbroker::subscribe(Direction dir, const embot::os::Action &action) +{ + return pImpl->subscribe(dir, action); +} + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theMSGbroker.h b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theMSGbroker.h new file mode 100644 index 0000000000..9edc7acb35 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/bldc/embot_app_bldc_theMSGbroker.h @@ -0,0 +1,72 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_BLDC_THEMSGBROKER_H_ +#define __EMBOT_APP_BLDC_THEMSGBROKER_H_ + + +#include +#include +#include "embot_prot_can.h" +#include "embot_os_Action.h" + + +namespace embot { namespace app { namespace bldc { + + class theMSGbroker + { + public: + + static theMSGbroker& getInstance(); + + struct Config + { + size_t rxCapacity {32}; + size_t txCapacity {32}; + constexpr Config() = default; + constexpr Config(size_t r, size_t t) : rxCapacity(r), txCapacity(t) {} + constexpr bool isvalid() const { return (rxCapacity > 0) && (txCapacity > 0); } + }; + + enum class Direction : uint8_t { INP, OUT }; + + static constexpr size_t MAXcapacity = 999; + + bool initialise(const Config &config); + + size_t size(Direction dir) const; + + + bool add(Direction dir, const embot::prot::can::Frame &frame); + bool add(Direction dir, const std::vector &frames); + + // if ::OUT, whenever someone call any add(::OUT, ) then the action is called + // the same for ::IN + bool subscribe(Direction dir, const embot::os::Action &action); + + bool rem(Direction dir, size_t &remaining, embot::prot::can::Frame &frame); + bool rem(Direction dir, size_t &remaining, std::vector &frames, size_t &retrieved, const size_t max2retrieve = theMSGbroker::MAXcapacity); + + private: + theMSGbroker(); + ~theMSGbroker(); + + private: + struct Impl; + std::unique_ptr pImpl; + }; + +}}} // namespace embot { namespace app { namespace bldc + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/embot/app/embot_app_application_CANagentCORE.h b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_CANagentCORE.h new file mode 100644 index 0000000000..b8cc0ce638 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_CANagentCORE.h @@ -0,0 +1,84 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_APPLICATION_CANAGENTCORE_H_ +#define __EMBOT_APP_APPLICATION_CANAGENTCORE_H_ + +#include +#include + +#include "embot_core.h" +#include "embot_hw_types.h" +#include "embot_prot_can.h" +#include "embot_prot_can_bootloader.h" +#include "embot_prot_can_motor_periodic.h" +#include "embot_prot_can_motor_polling.h" +#include "embot_prot_can_analog_periodic.h" +#include "embot_prot_can_analog_polling.h" + +namespace embot { namespace app { namespace application { + + + class CANagentCORE + { + public: + + virtual const embot::prot::can::applicationInfo & applicationinfo() const = 0; + virtual embot::hw::CAN bus() const = 0; + virtual embot::prot::can::Address address() const = 0; + + // interface: returns true is we need to tx a reply else false + virtual bool get(const embot::prot::can::bootloader::Message_BROADCAST::Info &info, embot::prot::can::bootloader::Message_BROADCAST::ReplyInfo &replyinfo) = 0; + virtual bool get(const embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::Info &info, embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::ReplyInfo &replyinfo) = 0; + virtual bool get(const embot::prot::can::shared::Message_GET_VERSION::Info &info, embot::prot::can::shared::Message_GET_VERSION::ReplyInfo &replyinfo) = 0; + virtual bool get(const embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::Info &info, embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::ReplyInfo &replyinfo) = 0; + + virtual bool set(const embot::prot::can::bootloader::Message_BOARD::Info &info) = 0; + virtual bool set(const embot::prot::can::bootloader::Message_SET_ADDITIONAL_INFO2::Info &info) = 0; + // for motor::polling::CMD::SET_BOARD_ID and analog::polling::CMD::SET_BOARD_ADX + virtual bool set(const embot::prot::can::shared::Message_SET_ID::Info &info) = 0; + // for the bootloader more powerful version + virtual bool set(const embot::prot::can::bootloader::Message_SETCANADDRESS::Info &info) = 0; + + public: + virtual ~CANagentCORE() {} + }; + + class dummyCANagentCORE : public CANagentCORE + { + public: + + dummyCANagentCORE() {} + virtual ~dummyCANagentCORE() {} + + static constexpr embot::prot::can::applicationInfo ai {{0, 0, 1}, {0, 1}}; + + const embot::prot::can::applicationInfo & applicationinfo() const override { return ai; } + embot::hw::CAN bus() const override { return embot::hw::CAN::one; } + embot::prot::can::Address address() const override { return 1; } + + bool get(const embot::prot::can::bootloader::Message_BROADCAST::Info &info, embot::prot::can::bootloader::Message_BROADCAST::ReplyInfo &replyinfo) override { return true; } + bool get(const embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::Info &info, embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::ReplyInfo &replyinfo) override { return true; } + bool get(const embot::prot::can::shared::Message_GET_VERSION::Info &info, embot::prot::can::shared::Message_GET_VERSION::ReplyInfo &replyinfo) override { return true; } + bool get(const embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::Info &info, embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::ReplyInfo &replyinfo) override { return true; } + + bool set(const embot::prot::can::bootloader::Message_BOARD::Info &info) override { return false; } + bool set(const embot::prot::can::bootloader::Message_SET_ADDITIONAL_INFO2::Info &info) override { return false; } + bool set(const embot::prot::can::shared::Message_SET_ID::Info &info) override { return false; } + bool set(const embot::prot::can::bootloader::Message_SETCANADDRESS::Info &info) override { return false; } + }; + + +}}} // namespace embot { namespace app { namespace application + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANagentCORE.cpp b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANagentCORE.cpp new file mode 100644 index 0000000000..c60008fd91 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANagentCORE.cpp @@ -0,0 +1,260 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_application_theCANagentCORE.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_core.h" +#include "embot_core_binary.h" + +#include + +#include "embot_app_theCANboardInfo.h" +#include "embot_hw_sys.h" +#include "embot_hw_can.h" + +// -------------------------------------------------------------------------------------------------------------------- +// - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++ +// -------------------------------------------------------------------------------------------------------------------- + + +struct embot::app::application::theCANagentCORE::Impl +{ + + Config _config {}; + + embot::app::theCANboardInfo::StoredInfo _storedinfo = {0}; + + embot::prot::can::applicationInfo _applicationinfo {}; + + + embot::prot::can::Board _board {embot::prot::can::Board::unknown}; + + Impl() { } + + + bool initialise(const Config &config); + + bool setcanaddress(const std::uint8_t adr, const std::uint16_t randominvalidmask); +}; + +bool embot::app::application::theCANagentCORE::Impl::initialise(const Config &config) +{ + _config = config; + + // retrieve board type, version of application, can address + // we use the object theCANboardInfo which is based onto FlashStorage which manages + // the flash partition called Partition::ID::sharedstorage + + if(true == embot::app::theCANboardInfo::getInstance().get(_storedinfo)) + { + _board = static_cast(_storedinfo.boardtype); +// _address = _storedinfo.canaddress; + _applicationinfo.version.major = _storedinfo.applicationVmajor; + _applicationinfo.version.minor = _storedinfo.applicationVminor; + _applicationinfo.version.build = _storedinfo.applicationVbuild; + _applicationinfo.protocol.major = _storedinfo.protocolVmajor; + _applicationinfo.protocol.minor = _storedinfo.protocolVminor; + } + + // note: we could make it even more general by using inside _config a pure interface class which + // does the job of theCANboardInfo, in such a way we just specialise this class ... but maybe later + + return true; +} + + +bool embot::app::application::theCANagentCORE::Impl::setcanaddress(const std::uint8_t adr, const std::uint16_t randominvalidmask) +{ + embot::app::theCANboardInfo &canbrdinfo = embot::app::theCANboardInfo::getInstance(); + + // i reinforce a reading from storage. just for safety. in here we are dealing w/ can address change and i want to be sure. + std::uint8_t canaddress = canbrdinfo.getCANaddress(); + + std::uint8_t target = adr; + + if(0xff == adr) + { + // compute a new random address. use the randoinvalid mask to filter out the undesired values. for sure 0x8001. + std::uint16_t mask = randominvalidmask; + mask |= 0x8001; + if(0xffff == mask) + { // hei, nothing is good for you. + return false; + } + + bool ok = false; + for(std::uint16_t i=0; i<250; i++) + { + target = (embot::hw::sys::random()-embot::hw::sys::minrandom()) & 0xf; + + if(false == embot::core::binary::bit::check(mask, target)) + { + ok = true; + break; + } + } + + if(!ok) + { + return false; + } + } + + // always check that is is not 0 or 0xf + if((0 == target) || (0xf == target)) + { + return false; + } + + + if(canaddress != target) + { + if(embot::hw::resOK != embot::hw::can::setfilters(_config.canbus, target)) + { + return false; + } + canbrdinfo.setCANaddress(target); + canaddress = canbrdinfo.getCANaddress(); + } + + return (target == canaddress); +} + + +// -------------------------------------------------------------------------------------------------------------------- +// - the class +// -------------------------------------------------------------------------------------------------------------------- + + +embot::app::application::theCANagentCORE& embot::app::application::theCANagentCORE::getInstance() +{ + static theCANagentCORE* p = new theCANagentCORE(); + return *p; +} + +embot::app::application::theCANagentCORE::theCANagentCORE() +{ + pImpl = std::make_unique(); +} + + +embot::app::application::theCANagentCORE::~theCANagentCORE() { } + + +bool embot::app::application::theCANagentCORE::initialise(const Config &config) +{ + return pImpl->initialise(config); +} + + +// its interfaces to CANagentCORE + + + +const embot::prot::can::applicationInfo & embot::app::application::theCANagentCORE::applicationinfo() const +{ + return pImpl->_applicationinfo; +} + +embot::hw::CAN embot::app::application::theCANagentCORE::bus() const +{ + return pImpl->_config.canbus; +} + +embot::prot::can::Address embot::app::application::theCANagentCORE::address() const +{ + return pImpl->_storedinfo.canaddress; +} + + +bool embot::app::application::theCANagentCORE::get(const embot::prot::can::bootloader::Message_BROADCAST::Info &info, embot::prot::can::bootloader::Message_BROADCAST::ReplyInfo &replyinfo) +{ + replyinfo.board = pImpl->_board; + replyinfo.process = embot::prot::can::Process::application; + replyinfo.firmware = {pImpl->_applicationinfo.version.major, pImpl->_applicationinfo.version.minor, pImpl->_applicationinfo.version.build}; + + return true; +} + + +bool embot::app::application::theCANagentCORE::get(const embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::Info &info, embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::ReplyInfo &replyinfo) +{ + std::memmove(replyinfo.info32, pImpl->_storedinfo.info32, sizeof(replyinfo.info32)); + + return true; +} + +bool embot::app::application::theCANagentCORE::get(const embot::prot::can::shared::Message_GET_VERSION::Info &info, embot::prot::can::shared::Message_GET_VERSION::ReplyInfo &replyinfo) +{ + replyinfo.board = pImpl->_board; + replyinfo.firmware = {pImpl->_applicationinfo.version.major, pImpl->_applicationinfo.version.minor, pImpl->_applicationinfo.version.build}; + replyinfo.protocol = pImpl->_applicationinfo.protocol; + + return true; +} + +bool embot::app::application::theCANagentCORE::get(const embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::Info &info, embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::ReplyInfo &replyinfo) +{ + replyinfo.timeoflife = embot::core::now(); + + return true; +} + + +bool embot::app::application::theCANagentCORE::set(const embot::prot::can::bootloader::Message_BOARD::Info &info) +{ + // we just restart so we cannot reply + embot::hw::sys::reset(); + + return false; +} + + +bool embot::app::application::theCANagentCORE::set(const embot::prot::can::bootloader::Message_SET_ADDITIONAL_INFO2::Info &info) +{ + if(true == info.valid) + { // we have received all the 8 messages in order (important is that the one with data[1] = 0 is the first) + embot::app::theCANboardInfo::getInstance().get(pImpl->_storedinfo); + std::memmove(pImpl->_storedinfo.info32, info.info32, sizeof(pImpl->_storedinfo.info32)); + embot::app::theCANboardInfo::getInstance().set(pImpl->_storedinfo); + } + + return false; +} + + +bool embot::app::application::theCANagentCORE::set(const embot::prot::can::shared::Message_SET_ID::Info &info) +{ + pImpl->setcanaddress(info.address, 0x0000); + + return false; +} + + +bool embot::app::application::theCANagentCORE::set(const embot::prot::can::bootloader::Message_SETCANADDRESS::Info &info) +{ + pImpl->setcanaddress(info.address, info.randominvalidmask); + + return false; +} + + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANagentCORE.h b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANagentCORE.h new file mode 100644 index 0000000000..9a75cb6459 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANagentCORE.h @@ -0,0 +1,69 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_APPLICATION_THECANAGENTCORE_H_ +#define __EMBOT_APP_APPLICATION_THECANAGENTCORE_H_ + +#include +#include + + +#include "embot_app_application_CANagentCORE.h" + + +namespace embot { namespace app { namespace application { + + + class theCANagentCORE : public CANagentCORE + { + public: + static theCANagentCORE& getInstance(); + + struct Config + { + embot::prot::can::applicationInfo applicationinfo {{0,0,1}, {2,0}}; + embot::hw::CAN canbus {embot::hw::CAN::one}; + constexpr Config() = default; + constexpr Config(const embot::prot::can::applicationInfo& ai, embot::hw::CAN b) + : applicationinfo(ai), canbus(b) {} + }; + + bool initialise(const Config &config); + + // interface to theCANagentCORE + const embot::prot::can::applicationInfo & applicationinfo() const override; + embot::hw::CAN bus() const override; + embot::prot::can::Address address() const override; + + bool get(const embot::prot::can::bootloader::Message_BROADCAST::Info &info, embot::prot::can::bootloader::Message_BROADCAST::ReplyInfo &replyinfo) override; + bool get(const embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::Info &info, embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::ReplyInfo &replyinfo) override; + bool get(const embot::prot::can::shared::Message_GET_VERSION::Info &info, embot::prot::can::shared::Message_GET_VERSION::ReplyInfo &replyinfo) override; + bool get(const embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::Info &info, embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::ReplyInfo &replyinfo) override; + + bool set(const embot::prot::can::bootloader::Message_BOARD::Info &info) override; + bool set(const embot::prot::can::bootloader::Message_SET_ADDITIONAL_INFO2::Info &info) override; + bool set(const embot::prot::can::shared::Message_SET_ID::Info &info) override; + bool set(const embot::prot::can::bootloader::Message_SETCANADDRESS::Info &info) override; + + private: + theCANagentCORE(); + ~theCANagentCORE(); + + private: + struct Impl; + std::unique_ptr pImpl; + }; + +}}} // namespace embot { namespace app { namespace application + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserBasic.cpp b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserBasic.cpp index f81e442d39..fa91d66ac4 100644 --- a/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserBasic.cpp +++ b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserBasic.cpp @@ -44,7 +44,6 @@ #include "embot_prot_can_analog_polling.h" #include "embot_app_theCANboardInfo.h" -#include "embot_app_theJumper.h" // -------------------------------------------------------------------------------------------------------------------- // - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++ @@ -422,7 +421,6 @@ embot::app::application::theCANparserBasic::theCANparserBasic() // : pImpl(new Impl) { pImpl = std::make_unique(); - embot::app::theJumper& thejumper = embot::app::theJumper::getInstance(); } diff --git a/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserCORE.cpp b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserCORE.cpp new file mode 100644 index 0000000000..b55c98dcfa --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserCORE.cpp @@ -0,0 +1,330 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + + + +// -------------------------------------------------------------------------------------------------------------------- +// - public interface +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_app_application_theCANparserCORE.h" + + +// -------------------------------------------------------------------------------------------------------------------- +// - external dependencies +// -------------------------------------------------------------------------------------------------------------------- + +#include "embot_core.h" +#include "embot_core_binary.h" + +#include + + + +// -------------------------------------------------------------------------------------------------------------------- +// - pimpl: private implementation (see scott meyers: item 22 of effective modern c++, item 31 of effective c++ +// -------------------------------------------------------------------------------------------------------------------- + + +struct embot::app::application::theCANparserCORE::Impl +{ + dummyCANagentCORE _dummyagent {}; + + Config _config {}; + + Impl() {} + + bool initialise(const Config &config); + bool process(const embot::prot::can::Frame &frame, std::vector &replies); + + bool process_bl_broadcast_appl(const embot::prot::can::Frame &frame, std::vector &replies); + bool process_bl_board_appl(const embot::prot::can::Frame &frame, std::vector &replies); + bool process_bl_getadditionalinfo(const embot::prot::can::Frame &frame, std::vector &replies); + bool process_bl_setadditionalinfo(const embot::prot::can::Frame &frame, std::vector &replies); + bool process_bl_setcanaddress(const embot::prot::can::Frame &frame, std::vector &replies); + bool process_bl_gettimeoflife(const embot::prot::can::Frame &frame, std::vector &replies); + + bool process_getfirmwareversion(const embot::prot::can::Clas cl, const std::uint8_t cm, const embot::prot::can::Frame &frame, std::vector &replies); + bool process_setid(const embot::prot::can::Clas cl, const std::uint8_t cm, const embot::prot::can::Frame &frame, std::vector &replies); +}; + +bool embot::app::application::theCANparserCORE::Impl::initialise(const Config &config) +{ + _config = config; + + if(false == _config.isvalid()) + { + _config.agent = &_dummyagent; + } + + return true; +} + +bool embot::app::application::theCANparserCORE::Impl::process(const embot::prot::can::Frame &frame, std::vector &replies) +{ + bool txframe = false; + bool recognised = false; + + embot::prot::can::Clas cls {embot::prot::can::Clas::none}; + std::uint8_t cmd {0}; + + if(false == embot::prot::can::frameis4board(frame, _config.agent->address())) + { + recognised = false; + return recognised; + } + + // now get _cls and _cmd + cls = embot::prot::can::frame2clas(frame); + cmd = embot::prot::can::frame2cmd(frame); + + switch(cls) + { + case embot::prot::can::Clas::bootloader: + { + // only CMD::BROADCAST, CMD::BOARD, CMD::SETCANADDRESS, CMD::GET_ADDITIONAL_INFO, CMD::SET_ADDITIONAL_INFO + + if(static_cast(embot::prot::can::bootloader::CMD::BOARD) == cmd) + { + txframe = process_bl_board_appl(frame, replies); + recognised = true; + } + else if(static_cast(embot::prot::can::bootloader::CMD::BROADCAST) == cmd) + { + txframe = process_bl_broadcast_appl(frame, replies); + recognised = true; + } + else if(static_cast(embot::prot::can::bootloader::CMD::SETCANADDRESS) == cmd) + { + txframe = process_bl_setcanaddress(frame, replies); + recognised = true; + } + else if(static_cast(embot::prot::can::bootloader::CMD::GET_ADDITIONAL_INFO) == cmd) + { + txframe = process_bl_getadditionalinfo(frame, replies); + recognised = true; + } + else if(static_cast(embot::prot::can::bootloader::CMD::SET_ADDITIONAL_INFO) == cmd) + { + txframe = process_bl_setadditionalinfo(frame, replies); + recognised = true; + } + else if(static_cast(embot::prot::can::bootloader::CMD::GET_TIMEOFLIFE) == cmd) + { + txframe = process_bl_gettimeoflife(frame, replies); + recognised = true; + } + + } break; + + + case embot::prot::can::Clas::pollingAnalogSensor: + { + // only embot::prot::can::analog::polling::CMD::SET_BOARD_ADX, GET_FIRMWARE_VERSION, ?? + if(static_cast(embot::prot::can::analog::polling::CMD::SET_BOARD_ADX) == cmd) + { + txframe = process_setid(cls, cmd, frame, replies); + recognised = true; + } + else if(static_cast(embot::prot::can::analog::polling::CMD::GET_FIRMWARE_VERSION) == cmd) + { + txframe = process_getfirmwareversion(cls, cmd, frame, replies); + recognised = true; + } + + } break; + + case embot::prot::can::Clas::pollingMotorControl: + { + // only embot::prot::can::mcpollCMD::SET_BOARD_ID, GET_FIRMWARE_VERSION, ?? + if(static_cast(embot::prot::can::motor::polling::CMD::SET_BOARD_ID) == cmd) + { + txframe = process_setid(cls, cmd, frame, replies); + recognised = true; + } + else if(static_cast(embot::prot::can::motor::polling::CMD::GET_FIRMWARE_VERSION) == cmd) + { + txframe = process_getfirmwareversion(cls, cmd, frame, replies); + recognised = true; + } + + } break; + + default: + { + txframe = false; + recognised = false; + } break; + } + + return recognised; +} + + +bool embot::app::application::theCANparserCORE::Impl::process_bl_broadcast_appl(const embot::prot::can::Frame &frame, std::vector &replies) +{ + embot::prot::can::bootloader::Message_BROADCAST msg {}; + embot::prot::can::bootloader::Message_BROADCAST::ReplyInfo replyinfo {}; + + msg.load(frame); + _config.agent->get(msg.info, replyinfo); + + embot::prot::can::Frame frame0 {}; + if(true == msg.reply(frame0, _config.agent->address(), replyinfo)) + { + replies.push_back(frame0); + return true; + } + + return false; +} + + +bool embot::app::application::theCANparserCORE::Impl::process_bl_board_appl(const embot::prot::can::Frame &frame, std::vector &replies) +{ + embot::prot::can::bootloader::Message_BOARD msg {}; + + msg.load(frame); + _config.agent->set(msg.info); + + // we dont reply + return false; +} + + +bool embot::app::application::theCANparserCORE::Impl::process_bl_getadditionalinfo(const embot::prot::can::Frame &frame, std::vector &replies) +{ + embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO msg {}; + embot::prot::can::bootloader::Message_GET_ADDITIONAL_INFO::ReplyInfo replyinfo {}; + + msg.load(frame); + _config.agent->get(msg.info, replyinfo); + + bool r {false}; + + std::uint8_t nreplies = msg.numberofreplies(); + embot::prot::can::Frame frame0 {}; + for(std::uint8_t i=0; iaddress(), replyinfo)) + { + replies.push_back(frame0); + r = true; + } + } + + return r; +} + + +bool embot::app::application::theCANparserCORE::Impl::process_bl_setadditionalinfo(const embot::prot::can::Frame &frame, std::vector &replies) +{ + embot::prot::can::bootloader::Message_SET_ADDITIONAL_INFO2 msg {}; + + msg.load(frame); + _config.agent->set(msg.info); + + return false; +} + + +bool embot::app::application::theCANparserCORE::Impl::process_setid(const embot::prot::can::Clas cl, const std::uint8_t cm, const embot::prot::can::Frame &frame, std::vector &replies) +{ + embot::prot::can::shared::Message_SET_ID msg {cl, cm}; + + msg.load(frame); + _config.agent->set(msg.info); + + return msg.reply(); +} + +bool embot::app::application::theCANparserCORE::Impl::process_getfirmwareversion(const embot::prot::can::Clas cl, const std::uint8_t cm, const embot::prot::can::Frame &frame, std::vector &replies) +{ + embot::prot::can::shared::Message_GET_VERSION msg {cl, cm}; + embot::prot::can::shared::Message_GET_VERSION::ReplyInfo replyinfo {}; + + msg.load(frame); + _config.agent->get(msg.info, replyinfo); + + embot::prot::can::Frame frame0 {}; + if(true == msg.reply(frame0, _config.agent->address(), replyinfo)) + { + replies.push_back(frame0); + return true; + } + + return false; +} + +bool embot::app::application::theCANparserCORE::Impl::process_bl_setcanaddress(const embot::prot::can::Frame &frame, std::vector &replies) +{ + embot::prot::can::bootloader::Message_SETCANADDRESS msg {}; + + msg.load(frame); + _config.agent->set(msg.info); + + return msg.reply(); +} + +bool embot::app::application::theCANparserCORE::Impl::process_bl_gettimeoflife(const embot::prot::can::Frame &frame, std::vector &replies) +{ + embot::prot::can::bootloader::Message_GET_TIMEOFLIFE msg {}; + embot::prot::can::bootloader::Message_GET_TIMEOFLIFE::ReplyInfo replyinfo {}; + + msg.load(frame); + _config.agent->get(msg.info, replyinfo); + + embot::prot::can::Frame frame0 {}; + if(true == msg.reply(frame0, _config.agent->address(), replyinfo)) + { + replies.push_back(frame0); + return true; + } + + return false; +} + + + +// -------------------------------------------------------------------------------------------------------------------- +// - the class +// -------------------------------------------------------------------------------------------------------------------- + + + + +embot::app::application::theCANparserCORE& embot::app::application::theCANparserCORE::getInstance() +{ + static theCANparserCORE* p = new theCANparserCORE(); + return *p; +} + +embot::app::application::theCANparserCORE::theCANparserCORE() +{ + pImpl = std::make_unique(); +} + + +embot::app::application::theCANparserCORE::~theCANparserCORE() { } + + +bool embot::app::application::theCANparserCORE::initialise(const Config &config) +{ + return pImpl->initialise(config); +} + +bool embot::app::application::theCANparserCORE::process(const embot::prot::can::Frame &frame, std::vector &replies) +{ + return pImpl->process(frame, replies); +} + + + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- + + diff --git a/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserCORE.h b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserCORE.h new file mode 100644 index 0000000000..bc29f05e51 --- /dev/null +++ b/emBODY/eBcode/arch-arm/embot/app/embot_app_application_theCANparserCORE.h @@ -0,0 +1,60 @@ + +/* + * Copyright (C) 2023 iCub Tech - Istituto Italiano di Tecnologia + * Author: Marco Accame + * email: marco.accame@iit.it +*/ + +// - include guard ---------------------------------------------------------------------------------------------------- + +#ifndef __EMBOT_APP_APPLICATION_THECANPARSERCORE_H_ +#define __EMBOT_APP_APPLICATION_THECANPARSERCORE_H_ + +#include +#include + +#include "embot_app_application_CANagentCORE.h" + +namespace embot { namespace app { namespace application { + + + class theCANparserCORE + { + public: + + static theCANparserCORE& getInstance(); + + public: + + struct Config + { + CANagentCORE* agent {nullptr}; + + constexpr Config() = default; + constexpr Config(CANagentCORE *ag) : agent(ag) {} + bool isvalid() const { return (nullptr == agent) ? false : true; } + }; + + + bool initialise(const Config &config); + + // returns true if the canframe has been recognised. if so, any reply is sent if replies.size() > 0 + bool process(const embot::prot::can::Frame &frame, std::vector &replies); + + private: + theCANparserCORE(); + ~theCANparserCORE(); + + private: + struct Impl; + std::unique_ptr pImpl; + }; + + +}}} // namespace embot { namespace app { namespace application + + +#endif // include-guard + + +// - end-of-file (leave a blank line after)---------------------------------------------------------------------------- diff --git a/emBODY/eBcode/arch-arm/embot/app/embot_app_theApplication.h b/emBODY/eBcode/arch-arm/embot/app/embot_app_theApplication.h index 4a045cc5fd..be243130a3 100644 --- a/emBODY/eBcode/arch-arm/embot/app/embot_app_theApplication.h +++ b/emBODY/eBcode/arch-arm/embot/app/embot_app_theApplication.h @@ -48,8 +48,8 @@ namespace embot { namespace app { { std::uint32_t addressofapplication {0}; bool initbsp {true}; - embot::core::relTime ticktime {0}; - embot::os::theScheduler::Behaviour behaviour {}; + embot::core::relTime ticktime {0}; + embot::os::theScheduler::Behaviour behaviour {}; Config() = default; Config(std::uint32_t _addr, bool _bsp, embot::core::relTime _tic, const embot::os::theScheduler::Behaviour &_beh) : addressofapplication(_addr), initbsp(_bsp), ticktime(_tic), behaviour(_beh) {} diff --git a/emBODY/eBcode/arch-arm/embot/app/embot_app_theCANboardInfo.cpp b/emBODY/eBcode/arch-arm/embot/app/embot_app_theCANboardInfo.cpp index 5fe30d9388..a2c5b85bd7 100644 --- a/emBODY/eBcode/arch-arm/embot/app/embot_app_theCANboardInfo.cpp +++ b/emBODY/eBcode/arch-arm/embot/app/embot_app_theCANboardInfo.cpp @@ -46,7 +46,7 @@ struct embot::app::theCANboardInfo::Impl { - std::uint8_t cachedcanaddress; + embot::prot::can::Address cachedcanaddress; embot::hw::FlashStorage *flashstorage; std::uint32_t userdataaddress; std::uint32_t addressofsharedstorage; @@ -93,12 +93,12 @@ bool embot::app::theCANboardInfo::erase() } -bool embot::app::theCANboardInfo::synch(const bootloaderInfo &info) +bool embot::app::theCANboardInfo::synch(const embot::prot::can::bootloaderInfo &info) { return synch(info.board, info.version, info.adr, info.definfo32); } -bool embot::app::theCANboardInfo::synch(embot::prot::can::Board type, embot::prot::can::versionOfBOOTLOADER version, std::uint8_t adr, const char *defInfo32) +bool embot::app::theCANboardInfo::synch(embot::prot::can::Board type, embot::prot::can::versionOfBOOTLOADER version, embot::prot::can::Address adr, const char *defInfo32) { bool ret = false; // at first we read. if what we read is not nice, then we write again @@ -140,7 +140,7 @@ bool embot::app::theCANboardInfo::synch(embot::prot::can::Board type, embot::pro return ret; } -bool embot::app::theCANboardInfo::synch(const applicationInfo &info) +bool embot::app::theCANboardInfo::synch(const embot::prot::can::applicationInfo &info) { return synch(info.version, info.protocol); } @@ -204,7 +204,7 @@ bool embot::app::theCANboardInfo::set(const StoredInfo &info) } -std::uint8_t embot::app::theCANboardInfo::getCANaddress() +embot::prot::can::Address embot::app::theCANboardInfo::getCANaddress() { StoredInfo strd = {0}; get(strd); @@ -213,7 +213,7 @@ std::uint8_t embot::app::theCANboardInfo::getCANaddress() } -std::uint8_t embot::app::theCANboardInfo::cachedCANaddress() +embot::prot::can::Address embot::app::theCANboardInfo::cachedCANaddress() { if(255 == pImpl->cachedcanaddress) { @@ -224,7 +224,7 @@ std::uint8_t embot::app::theCANboardInfo::cachedCANaddress() } -bool embot::app::theCANboardInfo::setCANaddress(std::uint8_t adr) +bool embot::app::theCANboardInfo::setCANaddress(embot::prot::can::Address adr) { StoredInfo strd = {0}; get(strd); diff --git a/emBODY/eBcode/arch-arm/embot/app/embot_app_theCANboardInfo.h b/emBODY/eBcode/arch-arm/embot/app/embot_app_theCANboardInfo.h index e89cdb1c60..a103e02e6b 100644 --- a/emBODY/eBcode/arch-arm/embot/app/embot_app_theCANboardInfo.h +++ b/emBODY/eBcode/arch-arm/embot/app/embot_app_theCANboardInfo.h @@ -53,47 +53,27 @@ namespace embot { namespace app { std::uint8_t tobefilled[3]; // to make the size of struct ... multiple of 8. }; - struct bootloaderInfo - { - embot::prot::can::Board board {embot::prot::can::Board::none}; - embot::prot::can::versionOfBOOTLOADER version {0, 0}; - std::uint8_t adr {1}; - const char * definfo32 {nullptr}; - - bootloaderInfo() = default; - constexpr bootloaderInfo(embot::prot::can::Board b, const embot::prot::can::versionOfBOOTLOADER &v, std::uint8_t a, const char *i) - : board(b), version(v), adr(a), definfo32(i) {} - }; - - - struct applicationInfo - { - embot::prot::can::versionOfAPPLICATION version {0, 0, 0}; - embot::prot::can::versionOfCANPROTOCOL protocol {0, 0}; - - applicationInfo() = default; - constexpr applicationInfo(const embot::prot::can::versionOfAPPLICATION &v, const embot::prot::can::versionOfCANPROTOCOL &p) - : version(v), protocol(p) {} - }; - + // use only to allow backward compatibility w/ all the embot can boards + using applicationInfo = embot::prot::can::applicationInfo; + using bootloaderInfo = embot::prot::can::bootloaderInfo; bool erase(); - bool synch(const bootloaderInfo &info); - bool synch(embot::prot::can::Board type, embot::prot::can::versionOfBOOTLOADER version, std::uint8_t adr, const char *defInfo32); + bool synch(const embot::prot::can::bootloaderInfo &info); + bool synch(embot::prot::can::Board type, embot::prot::can::versionOfBOOTLOADER version, embot::prot::can::Address adr, const char *defInfo32); - bool synch(const applicationInfo &info); + bool synch(const embot::prot::can::applicationInfo &info); bool synch(embot::prot::can::versionOfAPPLICATION application, embot::prot::can::versionOfCANPROTOCOL protocol); bool get(StoredInfo &info); bool set(const StoredInfo &info); - std::uint8_t getCANaddress(); - bool setCANaddress(std::uint8_t adr); + embot::prot::can::Address getCANaddress(); + bool setCANaddress(embot::prot::can::Address adr); // the cached can address is refreshed at very call of: synch(), setCANaddress(), getCANaddress(), set(). // it can be used by the application or by the various parsers to get access to teh can address without making a direct read from storage. - std::uint8_t cachedCANaddress(); + embot::prot::can::Address cachedCANaddress(); // todo: we could use two different pages for board and userspace. but we should share the buffer ... static const std::uint32_t sizeOfUserSpace = 128+256+512; diff --git a/emBODY/eBcode/arch-arm/embot/app/skeleton/embot_app_skeleton_os_basic.h b/emBODY/eBcode/arch-arm/embot/app/skeleton/embot_app_skeleton_os_basic.h index 8ff8954c52..715ab37c76 100644 --- a/emBODY/eBcode/arch-arm/embot/app/skeleton/embot_app_skeleton_os_basic.h +++ b/emBODY/eBcode/arch-arm/embot/app/skeleton/embot_app_skeleton_os_basic.h @@ -64,7 +64,7 @@ namespace embot::app::skeleton::os::basic { class CFG { public: - const SYSTEM *sys; + const SYSTEM *sys {nullptr}; CFG() = delete; constexpr CFG(const SYSTEM *s) : sys(s) {} diff --git a/emBODY/eBcode/arch-arm/embot/hw/embot_hw.cpp b/emBODY/eBcode/arch-arm/embot/hw/embot_hw.cpp index 9023e55ce1..a3110a608e 100644 --- a/emBODY/eBcode/arch-arm/embot/hw/embot_hw.cpp +++ b/emBODY/eBcode/arch-arm/embot/hw/embot_hw.cpp @@ -33,13 +33,32 @@ #include "embot_core.h" #include "embot_hw_bsp.h" - - +#include "embot_hw_sys.h" +#include "embot_hw_flash.h" using namespace std; namespace embot { namespace hw { + + void setvectortablelocation(embot::hw::FLASHpartitionID id) + { + uint32_t addressofapplication = embot::hw::flash::bsp::partition(id).address; + uint32_t defaultvectorlocation = embot::hw::flash::bsp::bank(addressofapplication).address; + if((embot::hw::flash::InvalidADDR == addressofapplication) || (embot::hw::flash::InvalidADDR == defaultvectorlocation)) + { + return; + } + if(addressofapplication > defaultvectorlocation) + { + std::uint32_t vectorlocation = addressofapplication - defaultvectorlocation; + if(0 != vectorlocation) + { + embot::hw::sys::relocatevectortable(vectorlocation); + } + } + } + static bool initted = false; @@ -56,6 +75,11 @@ namespace embot { namespace hw { return true; } + if(embot::hw::FLASHpartitionID::none != config.codepartition) + { + setvectortablelocation(config.codepartition); + } + embot::core::init({{nullptr, config.get1microtime}, {embot::hw::bsp::print}}); embot::hw::bsp::init(config); diff --git a/emBODY/eBcode/arch-arm/embot/hw/embot_hw.h b/emBODY/eBcode/arch-arm/embot/hw/embot_hw.h index b03a906732..d14cebf3be 100644 --- a/emBODY/eBcode/arch-arm/embot/hw/embot_hw.h +++ b/emBODY/eBcode/arch-arm/embot/hw/embot_hw.h @@ -31,21 +31,30 @@ // - in the actual drivers embot::gpio, embot::can, embo::i2c etc. #include "embot_core.h" +#include "embot_hw_types.h" + namespace embot { namespace hw { struct Config { embot::core::fpWorker initmicrotime {nullptr}; - embot::core::fpGetU64 get1microtime {nullptr}; + embot::core::fpGetU64 get1microtime {nullptr}; + embot::hw::FLASHpartitionID codepartition { embot::hw::FLASHpartitionID::none }; constexpr Config() = default; - constexpr Config(embot::core::fpWorker _init, embot::core::fpGetU64 _tmicro) : initmicrotime(_init), get1microtime(_tmicro) {} + constexpr Config(embot::core::fpWorker _init, embot::core::fpGetU64 _tmicro, + embot::hw::FLASHpartitionID _id = embot::hw::FLASHpartitionID::none) + : initmicrotime(_init), get1microtime(_tmicro), codepartition(_id) {} bool isvalid() const { if(nullptr != get1microtime) { return true; } else { return false; } } }; bool initialised(); + // to be called before init() in case ... config.codepartition does not contain the proper value + // and the vector table is to be relocated + void setvectortablelocation(embot::hw::FLASHpartitionID id); + // it calls the proper initialisations for the hw layer and links its to embot::core // after this call you can use the hw drivers bool init(const Config &config); diff --git a/emBODY/eBcode/arch-arm/embot/hw/embot_hw_flash.h b/emBODY/eBcode/arch-arm/embot/hw/embot_hw_flash.h index b0d20f88c8..330ba4e7f6 100644 --- a/emBODY/eBcode/arch-arm/embot/hw/embot_hw_flash.h +++ b/emBODY/eBcode/arch-arm/embot/hw/embot_hw_flash.h @@ -223,7 +223,8 @@ namespace embot { namespace hw { namespace flash { struct Bank { // this struct implements an abstract interface to the Bank - enum class ID : uint8_t { one = 0, two = 1, none = 31, maxnumberof = 2 }; + + using ID = embot::hw::FLASHbankID; Bank::ID id {Bank::ID::none}; ADDR address {InvalidADDR}; @@ -302,12 +303,7 @@ namespace embot { namespace hw { namespace flash { struct Partition { // it can have an ID so that we can easily retrieve its handle from the BSP. we can easily add IDs w/ any value - enum class ID : uint8_t { - generic = 0, // generic use. it may be inside BSP or not. - bootloader = 1, application = 2, sharedstorage = 3, applicationstorage = 4, // used for BSP of CAN-based boards - eloader = 5, eupdater = 6, eapplication00 = 7, eapplication01 = 8, // used for BSP of ETH-based boards - buffer00 = 9, buffer01 = 10, buffer02 = 11, buffer03 = 12, buffer04 = 13, // others - none = 31, maxnumberof = 14 }; + using ID = embot::hw::FLASHpartitionID; Partition::ID id {Partition::ID::none}; const Bank *owner {nullptr}; diff --git a/emBODY/eBcode/arch-arm/embot/hw/embot_hw_types.h b/emBODY/eBcode/arch-arm/embot/hw/embot_hw_types.h index af7a5873ba..00f6db913e 100644 --- a/emBODY/eBcode/arch-arm/embot/hw/embot_hw_types.h +++ b/emBODY/eBcode/arch-arm/embot/hw/embot_hw_types.h @@ -13,7 +13,6 @@ #include "embot_core.h" #include "embot_core_binary.h" -#include "embot_hw.h" namespace embot { namespace hw { @@ -42,10 +41,16 @@ namespace embot { namespace hw { enum class CAN : std::uint8_t { one = 0, two = 1, none = 31, maxnumberof = 2}; -// enum class FLASH : std::uint8_t { whole = 0, -// bootloader = 1, application = 2, sharedstorage = 3, applicationstorage = 4, // for use by can boards -// eloader = 1, eupdater = 2, eapplication00 = 3, eapplication01 = 4, // for use by eth boards -// none = 31, maxnumberof = 5 }; + enum class FLASHbankID : uint8_t { one = 0, two = 1, none = 31, maxnumberof = 2 }; + + + enum class FLASHpartitionID : uint8_t { + generic = 0, // generic use. it may be inside BSP or not. + bootloader = 1, application = 2, sharedstorage = 3, applicationstorage = 4, // used for BSP of CAN-based boards + eloader = 5, eupdater = 6, eapplication00 = 7, eapplication01 = 8, // used for BSP of ETH-based boards + buffer00 = 9, buffer01 = 10, buffer02 = 11, buffer03 = 12, buffer04 = 13, // others + none = 31, maxnumberof = 14 }; + enum class BTN : std::uint8_t { one = 0, two = 1, three = 2, four = 3, five = 4, six = 5, seven = 6, eight = 7, none = 31, maxnumberof = 8 }; diff --git a/emBODY/eBcode/arch-arm/embot/os/embot_os.cpp b/emBODY/eBcode/arch-arm/embot/os/embot_os.cpp index 7e64433eed..cca9fb5b22 100644 --- a/emBODY/eBcode/arch-arm/embot/os/embot_os.cpp +++ b/emBODY/eBcode/arch-arm/embot/os/embot_os.cpp @@ -76,7 +76,7 @@ namespace embot { namespace os { // we put hw::init() before because in its inside it also call embot::core::init() // with a pointer to embot::hw::sys::puts() so that embot::core::print() can work - embot::hw::init({nullptr, _now}); + embot::hw::init({nullptr, _now, _config.codepartition}); //embot::core::init({{nullptr, _now}}); // we dont need it _initted = true; return true; diff --git a/emBODY/eBcode/arch-arm/embot/os/embot_os.h b/emBODY/eBcode/arch-arm/embot/os/embot_os.h index 3634544582..d32eeae848 100644 --- a/emBODY/eBcode/arch-arm/embot/os/embot_os.h +++ b/emBODY/eBcode/arch-arm/embot/os/embot_os.h @@ -22,6 +22,7 @@ #define _EMBOT_OS_H_ #include "embot_core.h" +#include "embot_hw.h" #include "embot_os_common.h" #include "embot_os_Thread.h" @@ -36,11 +37,16 @@ namespace embot { namespace os { embot::os::InitThread::Config initconfig {}; embot::os::IdleThread::Config idleconfig {}; embot::core::Callback onOSerror {}; + embot::hw::FLASHpartitionID codepartition { embot::hw::FLASHpartitionID::none }; constexpr Config() = default; - constexpr Config(embot::core::Time _t, const embot::os::InitThread::Config &ini, const embot::os::IdleThread::Config &idl, const embot::core::Callback &err) - : tick(_t), initconfig(ini), idleconfig(idl), onOSerror(err) {} + constexpr Config(embot::core::Time _t, + const embot::os::InitThread::Config &ini, + const embot::os::IdleThread::Config &idl, + const embot::core::Callback &err, + embot::hw::FLASHpartitionID co = embot::hw::FLASHpartitionID::none) + : tick(_t), initconfig(ini), idleconfig(idl), onOSerror(err), codepartition(co) {} bool isvalid() const { if((0 == tick) || (false == initconfig.isvalid()) || (false == idleconfig.isvalid())) { return false; } else { return true; } } }; diff --git a/emBODY/eBcode/arch-arm/embot/os/embot_os_Thread.h b/emBODY/eBcode/arch-arm/embot/os/embot_os_Thread.h index 49574eb4f6..2abc761791 100644 --- a/emBODY/eBcode/arch-arm/embot/os/embot_os_Thread.h +++ b/emBODY/eBcode/arch-arm/embot/os/embot_os_Thread.h @@ -35,7 +35,8 @@ namespace embot { namespace os { // types used by all derived Thread classes enum class Type : std::uint8_t { undefined = 0, eventTrigger = 1, messageTrigger = 3, callbackTrigger = 4, periodicTrigger = 5, valueTrigger = 6, multieventTrigger = 7, Init = 100, Idle = 101 }; - + + using fpOnInit = void (*)(Thread *, void *); using fpStartup = void (*)(Thread *, void *); using fpOnIdle = void (*)(Thread *, void *); using fpOnEvent = void (*)(Thread *, os::EventMask, void *); @@ -55,7 +56,7 @@ namespace embot { namespace os { struct BaseConfig { - std::uint16_t stacksize {256}; // the stack used by the task. it cannot be 0. reasonable value is >= 256 + std::uint16_t stacksize {1024}; // the stack used by the task. it cannot be 0. reasonable value is >= 256 Priority priority {Priority::minimum}; // the priority with which the system executes the task. Thread::fpStartup startup {nullptr}; // this function, if not nullptr, is executed only once at start ot the task. its second argument is param void *param {nullptr}; // the optional param passed to startup() and other functions derived from BaseConfig @@ -96,7 +97,7 @@ namespace embot { namespace os { struct Config : public Thread::BaseConfig { Config() = default; - constexpr Config(std::uint16_t st, Thread::fpStartup fpst, void* pa) : BaseConfig(st, embot::os::Priority::schedInit, fpst, pa) {} + constexpr Config(std::uint16_t st, Thread::fpOnInit fpini, void* pa) : BaseConfig(st, embot::os::Priority::schedInit, fpini, pa) {} bool isvalid() const { return BaseConfig::isvalid(); diff --git a/emBODY/eBcode/arch-arm/embot/prot/can/embot_prot_can.h b/emBODY/eBcode/arch-arm/embot/prot/can/embot_prot_can.h index e3d87931c1..62f906f881 100644 --- a/emBODY/eBcode/arch-arm/embot/prot/can/embot_prot_can.h +++ b/emBODY/eBcode/arch-arm/embot/prot/can/embot_prot_can.h @@ -27,6 +27,13 @@ namespace embot { namespace prot { namespace can { // - useful types + + using Address = uint8_t; // with the limitation that we use only range [0, 15] + + constexpr Address addrBroadcast {15}; + constexpr Address addrHost {0}; + + constexpr bool isaddressvalid(Address a) { return a<=addrBroadcast; } struct Frame { @@ -39,7 +46,12 @@ namespace embot { namespace prot { namespace can { { if(nullptr != d) { std::memmove(data, d, size); } } - + constexpr Frame(std::uint32_t i, std::uint8_t s, const std::initializer_list &da) : id(i), size(std::min(s, static_cast(8))) + { + uint8_t ss = std::min(size, static_cast(da.size())); + uint8_t ndx = 0; + for(const uint8_t & v : da) { if(ndx < ss) data[ndx++] = v; } + } bool copyto(uint32_t &i, uint8_t &si, uint8_t *da) const { if(nullptr != da) @@ -89,6 +101,32 @@ namespace embot { namespace prot { namespace can { std::uint8_t minor {0}; versionOfCANPROTOCOL() = default; constexpr versionOfCANPROTOCOL(std::uint8_t ma, std::uint8_t mi) : major(ma), minor(mi) {} + }; + + + // more structured info for the process + + struct bootloaderInfo + { + embot::prot::can::Board board {embot::prot::can::Board::none}; + embot::prot::can::versionOfBOOTLOADER version {0, 0}; + embot::prot::can::Address adr {1}; + const char * definfo32 {nullptr}; + + bootloaderInfo() = default; + constexpr bootloaderInfo(embot::prot::can::Board b, const embot::prot::can::versionOfBOOTLOADER &v, embot::prot::can::Address a, const char *i) + : board(b), version(v), adr(a), definfo32(i) {} + }; + + + struct applicationInfo + { + embot::prot::can::versionOfAPPLICATION version {0, 0, 0}; + embot::prot::can::versionOfCANPROTOCOL protocol {0, 0}; + + applicationInfo() = default; + constexpr applicationInfo(const embot::prot::can::versionOfAPPLICATION &v, const embot::prot::can::versionOfCANPROTOCOL &p) + : version(v), protocol(p) {} }; @@ -287,7 +325,7 @@ namespace embot { namespace prot { namespace can { namespace analog { posDES() : type(posTYPE::angleDeciDeg), startlabel(posLABEL::zero), labelsnumberof(2) {} void reset() { type = posTYPE::angleDeciDeg; startlabel = posLABEL::zero; labelsnumberof = 2; } bool isvalid() const { if(((type == posTYPE::angleDeciDeg) || (type == posTYPE::linearDeciMilliMeter)) && (labelsnumberof>0)) { return true; } else { return false; } } - }; // it must be stored in 16 bits: 8 bits for type, 4 bits for startlabel, 4 bits for labelsnumberof + }; // it must be stored in 16 bits: 8 bits for type, 4 bits for startlabel, 4 bits for labelsnumberof using deciDeg = std::int16_t; using deciMilliMeter = std::int16_t; // +/- 32k ~= +/- 3200 mm = +/- 3.2 m