This commit is contained in:
andrea
2025-12-24 19:37:12 +01:00
parent 3cb8b7d505
commit a300a1f44d
20 changed files with 43962 additions and 33639 deletions

View File

@@ -12,3 +12,4 @@
*** SESSION dic 08, 2025 11:52:34.203 ------------------------------------------
*** SESSION dic 08, 2025 13:49:44.543 ------------------------------------------
*** SESSION dic 24, 2025 16:22:32.878 ------------------------------------------
*** SESSION dic 24, 2025 18:17:23.377 ------------------------------------------

View File

@@ -1,4 +1,4 @@
16:34:44 **** Incremental Build of configuration Debug for project AUTOM10 ****
19:34:52 **** Incremental Build of configuration Debug for project AUTOM10 ****
make -j12 all
arm-none-eabi-gcc "../Core/Src/cdc_int.c" -mcpu=cortex-m3 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F103xB -c -I../Core/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I../USB_DEVICE/App -I../USB_DEVICE/Target -I../Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Core/Src/cdc_int.d" -MT"Core/Src/cdc_int.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Core/Src/cdc_int.o"
arm-none-eabi-gcc -o "AUTOM10.elf" @"objects.list" -mcpu=cortex-m3 -T"C:\progetti\AUTOM\workspace\AUTOM10\STM32F103C8TX_FLASH.ld" --specs=nosys.specs -Wl,-Map="AUTOM10.map" -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
@@ -7,11 +7,11 @@ Finished building target: AUTOM10.elf
arm-none-eabi-size AUTOM10.elf
arm-none-eabi-objdump -h -S AUTOM10.elf > "AUTOM10.list"
text data bss dec hex filename
48788 464 7248 56500 dcb4 AUTOM10.elf
48792 464 7248 56504 dcb8 AUTOM10.elf
Finished building: default.size.stdout
Finished building: AUTOM10.list
16:34:45 Build Finished. 0 errors, 0 warnings. (took 806ms)
19:34:58 Build Finished. 0 errors, 0 warnings. (took 5s.556ms)

View File

@@ -33,3 +33,17 @@ Finished building: default.size.stdout
Finished building: AUTOM10.list
19:34:52 **** Incremental Build of configuration Debug for project AUTOM10 ****
make -j12 all
arm-none-eabi-gcc "../Core/Src/cdc_int.c" -mcpu=cortex-m3 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F103xB -c -I../Core/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I../USB_DEVICE/App -I../USB_DEVICE/Target -I../Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Core/Src/cdc_int.d" -MT"Core/Src/cdc_int.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Core/Src/cdc_int.o"
arm-none-eabi-gcc -o "AUTOM10.elf" @"objects.list" -mcpu=cortex-m3 -T"C:\progetti\AUTOM\workspace\AUTOM10\STM32F103C8TX_FLASH.ld" --specs=nosys.specs -Wl,-Map="AUTOM10.map" -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
Finished building target: AUTOM10.elf
arm-none-eabi-size AUTOM10.elf
arm-none-eabi-objdump -h -S AUTOM10.elf > "AUTOM10.list"
text data bss dec hex filename
48792 464 7248 56504 dcb8 AUTOM10.elf
Finished building: default.size.stdout
Finished building: AUTOM10.list

View File

@@ -0,0 +1,208 @@
#include <string.h>
#include <stdbool.h>
#include "usb_device.h"
#include "usbd_cdc_if.h"
#include "cdc_int.h"
#include "stm32f1xx_hal.h"
#include "eeprom.h"
#include "pwm.h"
extern TIM_HandleTypeDef htim1;
extern TIM_HandleTypeDef htim2;
extern TIM_HandleTypeDef htim3;
extern TIM_HandleTypeDef htim4;
extern const uint16_t EE_VirtAddrs[];
extern uint8_t pulsanti;
extern uint16_t ch4 ;
extern uint16_t ch5 ;
extern uint16_t ch6 ;
extern uint16_t ch7 ;
extern uint16_t ch8 ;
bool toHex(char c1,char c2,char c3,char c4,uint16_t* retval){
if((c1>='0')&&(c1<='9')){
c1-='0';
}else if((c1>='a')&&(c1<='f')){
c1=(c1-'a')+10;
}else return false;
if((c2>='0')&&(c2<='9')){
c2-='0';
}else if((c2>='a')&&(c2<='f')){
c2=(c2-'a')+10;
}else return false;
if((c3>='0')&&(c3<='9')){
c3-='0';
}else if((c3>='a')&&(c3<='f')){
c3=(c3-'a')+10;
}else return false;
if((c4>='0')&&(c4<='9')){
c4-='0';
}else if((c4>='a')&&(c4<='f')){
c4=(c4-'a')+10;
}else return false;
*retval=c1;
*retval*=16;
*retval+=c2;
*retval*=16;
*retval+=c3;
*retval*=16;
*retval+=c4;
return true;
}
void manageCDC(void){
static uint8_t rxbuf[100];
static uint8_t rxidx=0;
unsigned char s[100];
uint8_t mot,dir,dm,m,c,d,u;
uint16_t val;
uint16_t st;
uint16_t eeadd;
uint8_t i;
if (CDC_Available()) {
int rx = CDC_ReadByte();
if (rx < 0) return;
//uint8_t out = (uint8_t)c;
//if (out >= 'a' && out <= 'z') out -= 32; // to upper
rxbuf[rxidx]=rx;
while (CDC_Transmit_FS(&rxbuf[rxidx], 1) == USBD_BUSY);//echo
if((rx==0x0d)||(rx==0x0a)){
if(rxidx){
switch(rxbuf[0]){
case 'i':
sprintf((char*)s,"\ninfo");
while (CDC_Transmit_FS(s, 5) == USBD_BUSY);
sprintf((char*)s,"\npwm %d%d%d%d%d%d%d%d",IsPwmRunning(timMot1,FWMot1),IsPwmRunning(timMot1,BWMot1),IsPwmRunning(timMot2,FWMot2),IsPwmRunning(timMot2,BWMot2),IsPwmRunning(timMot3,FWMot3),IsPwmRunning(timMot3,BWMot3),IsPwmRunning(timMot4,FWMot4),IsPwmRunning(timMot4,BWMot4));
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
sprintf((char*)s,"\n0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx",(uint32_t)__HAL_TIM_GET_COMPARE(timMot1,FWMot1),(uint32_t)__HAL_TIM_GET_COMPARE(timMot1,BWMot1),(uint32_t)__HAL_TIM_GET_COMPARE(timMot2,FWMot2),(uint32_t)__HAL_TIM_GET_COMPARE(timMot2,BWMot2),(uint32_t)__HAL_TIM_GET_COMPARE(timMot3,FWMot3),(uint32_t)__HAL_TIM_GET_COMPARE(timMot3,BWMot3),(uint32_t)__HAL_TIM_GET_COMPARE(timMot4,FWMot4),(uint32_t)__HAL_TIM_GET_COMPARE(timMot4,BWMot4));
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
sprintf((char*)s,"\nP=0x%x ch4=%05d ch5=%05d ch6=%05d ch7=%05d ch8=%05d",pulsanti,ch4,ch5,ch6,ch7,ch8);
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
break;
case 'I':
sprintf((char*)s,"\nID000000");
while (CDC_Transmit_FS(s, 9) == USBD_BUSY);
break;
case 'm':
if(rxidx==8){
if((rxbuf[1]>='1')&&(rxbuf[1]<='4')){
mot=rxbuf[1]-='0';
if(rxbuf[2]=='f'){
dir=FW;
}else if(rxbuf[2]=='b'){
dir=BW;
}else{
sprintf((char*)s,"\n?mnsvvvvv s=f|b");//m nmotore senso valore
while (CDC_Transmit_FS(s, 16) == USBD_BUSY);
break;
}
if(((rxbuf[3]>='0')&&(rxbuf[3]<='9'))&&((rxbuf[4]>='0')&&(rxbuf[4]<='9'))&&((rxbuf[5]>='0')&&(rxbuf[5]<='9'))&&((rxbuf[6]>='0')&&(rxbuf[6]<='9'))&&((rxbuf[7]>='0')&&(rxbuf[7]<='9'))){
dm=rxbuf[3]-='0';
m=rxbuf[4]-='0';
c=rxbuf[5]-='0';
d=rxbuf[6]-='0';
u=rxbuf[7]-='0';
val=dm;
val*=10;
val+=m;
val*=10;
val+=c;
val*=10;
val+=d;
val*=10;
val+=u;
SetMot(mot,dir,val);
}else{
sprintf((char*)s,"\n?mnsvvvvv 00000>=vvvvv<=99999");//m nmotore senso valore
while (CDC_Transmit_FS(s, 19) == USBD_BUSY);
}
}else{
sprintf((char*)s,"\n?mnsvvvvv 1>=m<=4");//m nmotore senso valore
while (CDC_Transmit_FS(s, 19) == USBD_BUSY);
}
}else{
sprintf((char*)s,"\n?mnsvvvvv");//m nmotore senso valore
while (CDC_Transmit_FS(s, 10) == USBD_BUSY);
}
break;
case 'e':
if(rxidx>1){
if(rxbuf[1]=='r'){
if(rxidx==4){
if(toHex('0','0',rxbuf[2],rxbuf[3],&eeadd)){
st=EEW_Read(eeadd, &val);
if (st == EE_OK){
sprintf((char*)s,"\nee 0x%02x=0x%04x",eeadd,val);
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}else{
sprintf((char*)s,"\nee read error %d",st);
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}
}else{
sprintf((char*)s,"\n?eraa hex values");
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}
}else{
sprintf((char*)s,"\n?eraa");
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}
}else if(rxbuf[1]=='w'){
if(rxidx==8){
if(toHex('0','0',rxbuf[2],rxbuf[3],&eeadd)){
if(toHex(rxbuf[4],rxbuf[5],rxbuf[6],rxbuf[7],&val)){
st=EEW_Write(eeadd, val);
if (st == EE_OK)sprintf((char*)s,"\ndone 0x%02x=0x%04x",eeadd,val);
else sprintf((char*)s,"\nee write error %d", st);
}else sprintf((char*)s,"\n?ewaavvvv hex values");
}else sprintf((char*)s,"\n?ewaa hex values");
}else sprintf((char*)s,"\n?ewaavvvv");
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}else if(rxbuf[1]=='d'){
if(rxidx==2){
for(i=0;i<32;i++){
if((i%4)==0){
sprintf((char*)s,"\n");
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}
st=EEW_Read(i, &val);
if (st == EE_OK){
sprintf((char*)s,"0x%02x=0x%04x ",i,val);
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}else{
sprintf((char*)s,"rderr %d ",st);
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}
}
}else{
sprintf((char*)s,"\n?ed");
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}
}else{
sprintf((char*)s,"\n?er|w|d");
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}
}else{
sprintf((char*)s,"\n?eraa | ewaavvvv");
while (CDC_Transmit_FS(s, strlen((char*)s)) == USBD_BUSY);
}
break;
default:
sprintf((char*)s,"\n?");
while (CDC_Transmit_FS(s, 2) == USBD_BUSY);
break;
}
}
rxidx=0;
}else rxidx++;
// tiny spin or yield
}
}

View File

@@ -425,7 +425,7 @@
<tags>org.eclipse.cdt.ui.editor.CEditor</tags>
</children>
<children xsi:type="basic:Part" xmi:id="_euNkYNK9EfCeq-D7gPUMUQ" elementId="org.eclipse.e4.ui.compatibility.editor" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor" label="cdc_int.c" iconURI="platform:/plugin/org.eclipse.cdt.ui/icons/obj16/c_file_obj.gif" closeable="true">
<persistedState key="memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xD;&#xA;&lt;editor id=&quot;org.eclipse.cdt.ui.editor.CEditor&quot; name=&quot;cdc_int.c&quot; partName=&quot;cdc_int.c&quot; title=&quot;cdc_int.c&quot; tooltip=&quot;AUTOM10/Core/Src/cdc_int.c&quot;>&#xD;&#xA;&lt;input factoryID=&quot;org.eclipse.ui.part.FileEditorInputFactory&quot; path=&quot;/AUTOM10/Core/Src/cdc_int.c&quot;/>&#xD;&#xA;&lt;editorState selectionHorizontalPixel=&quot;0&quot; selectionLength=&quot;0&quot; selectionOffset=&quot;2940&quot; selectionTopPixel=&quot;1398&quot;/>&#xD;&#xA;&lt;/editor>"/>
<persistedState key="memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xD;&#xA;&lt;editor id=&quot;org.eclipse.cdt.ui.editor.CEditor&quot; name=&quot;cdc_int.c&quot; partName=&quot;cdc_int.c&quot; title=&quot;cdc_int.c&quot; tooltip=&quot;AUTOM10/Core/Src/cdc_int.c&quot;>&#xD;&#xA;&lt;input factoryID=&quot;org.eclipse.ui.part.FileEditorInputFactory&quot; path=&quot;/AUTOM10/Core/Src/cdc_int.c&quot;/>&#xD;&#xA;&lt;editorState selectionHorizontalPixel=&quot;0&quot; selectionLength=&quot;0&quot; selectionOffset=&quot;6299&quot; selectionTopPixel=&quot;3050&quot;/>&#xD;&#xA;&lt;/editor>"/>
<tags>Editor</tags>
<tags>removeOnHide</tags>
<tags>org.eclipse.cdt.ui.editor.CEditor</tags>
@@ -789,7 +789,7 @@
</children>
<children xsi:type="menu:ToolBar" xmi:id="_XpF-sIOTEfC0sr97s2D3dw" elementId="org.eclipse.ui.workbench.file">
<tags>Draggable</tags>
<children xsi:type="menu:HandledToolItem" xmi:id="_XtlGkODcEfCC4rD2e1XaSQ" elementId="print" visible="false" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/print_edit.png" tooltip="Print" command="_XET3E4OTEfC0sr97s2D3dw"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_af2moODsEfCu5_cqHrL4NQ" elementId="print" visible="false" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/print_edit.png" tooltip="Print" command="_XET3E4OTEfC0sr97s2D3dw"/>
</children>
<children xsi:type="menu:ToolBar" xmi:id="_XpF-sYOTEfC0sr97s2D3dw" elementId="group.edit" toBeRendered="false">
<tags>toolbarSeparator</tags>
@@ -797,8 +797,8 @@
</children>
<children xsi:type="menu:ToolBar" xmi:id="_XpF-s4OTEfC0sr97s2D3dw" elementId="org.eclipse.ui.workbench.edit">
<tags>Draggable</tags>
<children xsi:type="menu:HandledToolItem" xmi:id="_XtltoODcEfCC4rD2e1XaSQ" elementId="undo" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/undo_edit.png" tooltip="Undo" enabled="false" command="_XET3AYOTEfC0sr97s2D3dw"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_XtltoeDcEfCC4rD2e1XaSQ" elementId="redo" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/redo_edit.png" tooltip="Redo" enabled="false" command="_XEVsOIOTEfC0sr97s2D3dw"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_af30wODsEfCu5_cqHrL4NQ" elementId="undo" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/undo_edit.png" tooltip="Undo" enabled="false" command="_XET3AYOTEfC0sr97s2D3dw"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_af30weDsEfCu5_cqHrL4NQ" elementId="redo" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/redo_edit.png" tooltip="Redo" enabled="false" command="_XEVsOIOTEfC0sr97s2D3dw"/>
</children>
<children xsi:type="menu:ToolBar" xmi:id="_XpF-tIOTEfC0sr97s2D3dw" elementId="additions" toBeRendered="false">
<tags>toolbarSeparator</tags>
@@ -822,7 +822,7 @@
</children>
<children xsi:type="menu:ToolBar" xmi:id="_XpF-uIOTEfC0sr97s2D3dw" elementId="org.eclipse.ui.workbench.navigate">
<tags>Draggable</tags>
<children xsi:type="menu:HandledToolItem" xmi:id="_XtmUtODcEfCC4rD2e1XaSQ" elementId="org.eclipse.ui.window.pinEditor" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/pin_editor.png" tooltip="Pin Editor" enabled="false" type="Check" command="_XET2t4OTEfC0sr97s2D3dw"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_af4b1eDsEfCu5_cqHrL4NQ" elementId="org.eclipse.ui.window.pinEditor" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/pin_editor.png" tooltip="Pin Editor" enabled="false" type="Check" command="_XET2t4OTEfC0sr97s2D3dw"/>
</children>
<children xsi:type="menu:ToolBar" xmi:id="_XpF-uYOTEfC0sr97s2D3dw" elementId="group.editor" toBeRendered="false">
<tags>toolbarSeparator</tags>
@@ -2363,7 +2363,7 @@
<addons xmi:id="_XDZQtoOTEfC0sr97s2D3dw" elementId="MinMax Addon" contributorURI="platform:/plugin/org.eclipse.ui.workbench" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon"/>
<addons xmi:id="_XDZQt4OTEfC0sr97s2D3dw" elementId="org.eclipse.ui.workbench.addon.0" contributorURI="platform:/plugin/org.eclipse.ui.workbench" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
<addons xmi:id="_XDpvUIOTEfC0sr97s2D3dw" elementId="SplitterAddon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.splitteraddon.SplitterAddon"/>
<addons xmi:id="_XX-C8eDcEfCC4rD2e1XaSQ" elementId="org.eclipse.ui.ide.addon.0" contributionURI="bundleclass://org.eclipse.ui.ide/org.eclipse.ui.internal.ide.addons.SaveAllDirtyPartsAddon"/>
<addons xmi:id="_IYS0IKimEeS11vbz3f9ezw" elementId="org.eclipse.ui.ide.addon.0" contributorURI="platform:/plugin/org.eclipse.ui.ide" contributionURI="bundleclass://org.eclipse.ui.ide/org.eclipse.ui.internal.ide.addons.SaveAllDirtyPartsAddon"/>
<addons xmi:id="_dz0JgGOlEeSMMaPQU2nlzw" elementId="org.eclipse.ui.ide.application.addon.0" contributorURI="platform:/plugin/org.eclipse.ui.ide.application" contributionURI="bundleclass://org.eclipse.ui.ide.application/org.eclipse.ui.internal.ide.application.addons.ModelCleanupAddon"/>
<categories xmi:id="_XENI8IOTEfC0sr97s2D3dw" elementId="org.eclipse.team.ui.category.team" name="Version control (Team)" description="Actions that apply when working with a version control system"/>
<categories xmi:id="_XENI8YOTEfC0sr97s2D3dw" elementId="org.eclipse.ui.category.views" name="Views" description="Commands for opening views"/>