网页flash抓取器 7.0(信捷PLC编程软件XDPProgcc详述详述的数据结构和算法 )
优采云 发布时间: 2022-02-05 02:20网页flash抓取器 7.0(信捷PLC编程软件XDPProgcc详述详述的数据结构和算法
)
新捷PLC编程软件XDPPro收录arm-none-eabi的gcc程序。测试中使用的模型的SOC是ST的Cortex-M7。C语言编程的自由度非常高,如果你有能力接管编译过程,各种高级数据结构就是锦上添花。
初步测试了GCC的调用过程。从捕获的信息来看,用户手册中没有详细说明的魔术操作在源代码中一目了然。
如果用C语言来开发实用的数据结构和算法,这个小PLC的应用场景还是很多的。毕竟有1MB的程序空间,要填满也不是一件容易的事。附上gcc调用参数及文件核心内容:源码 -> *.c -> *.i
//XDPPro v3.7.4b, PLC XL5E-16
//调用记录arm-none-eabi-*.exe
2021-11-20 23:32:57.655
C:\XDPPro\TOOL\XD\bin\arm-none-eabi-gcc.exe
-save-temps //保留临时文件,在*-gcc.exe同层文件夹中:FUNC1.i FUNC1.s
..\..\..\tmp\PrjFuncB\FUNC1.c
-mthumb
-mcpu=cortex-m7
-mfloat-abi=hard
-mfpu=fpv5-sp-d16
-nostartfiles
-o ..\..\..\tmp\PrjFuncB\FUNC1.o
-I ..\inc
-c
-fsigned-char
-g
-ffunction-sections
-mlittle-endian
2021-11-20 23:33:03.871
C:\XDPPro\TOOL\XD\bin\arm-none-eabi-ld.exe
-T ..\..\..\tmp\PrjFuncB\stm32_flash.ld
-Map=..\..\..\tmp\PrjFuncB\xd.map
-s
-o ..\..\..\tmp\PrjFuncB\xd.out
..\..\..\tmp\PrjFuncB\Ladder1.o
..\..\..\tmp\PrjFuncB\FUNC1.o
..\..\..\tmp\PrjFuncB\sysRegAddr.o
..\..\..\tmp\PrjFuncB\sysFuncAddr.o
-L ..\lib\M7
-lm
-lgcc
-lc
2021-11-20 23:33:04.257
C:\XDPPro\TOOL\XD\bin\arm-none-eabi-objdump.exe
-s
-D
-marm ..\..\..\tmp\PrjFuncB\xd.out
2021-11-20 23:33:07.555
C:\XDPPro\TOOL\XD\bin\arm-none-eabi-ld.exe
-T ..\..\..\tmp\PrjFuncB\stm32_flash.ld
-Map=..\..\..\tmp\PrjFuncB\xd.map
-s
-o ..\..\..\tmp\PrjFuncB\xd.out
..\..\..\tmp\PrjFuncB\TGLadder1.o
-L ..\lib\M7
-lm
-lgcc
-lc
2021-11-20 23:33:07.930
C:\XDPPro\TOOL\XD\bin\arm-none-eabi-objdump.exe
-s
-D
-marm ..\..\..\tmp\PrjFuncB\xd.out
//end_//调用记录
//file:源文件_FUNC1
/*************************************************************************
FunctionBlockName: FUNC1
Version: 1.0.0
Author: thj
UpdateTime: 2021-11-14 16:39:43
Comment:
abcd
12345678
**************************************************************************/
#define thj_FUNC1
void FUNC1(WORD W, BIT B)
{
#define SysRegAddr_HD_D_HM_M
unsigned long* p0 = (unsigned long*)&D[0];
(*p0)++;
#define pD4_Float (( float * ) &D[4])
* pD4_Float = 1.2345;
//* ( ( float * ) &D[4] ) = 1.2345;
strcpy((char*)&D[20], "a一二b1234"); //GB18030
*((wchar_t*)&D[30]) = L'\x1234';
*((double*)&D[40]) = sqrt(2);
*((double*)&D[50]) = 1122334455.0;
}
//end_源文件
//file:FUNC1.c
#define ARM_M7
#include "funcb.h"
#define thj_FUNC1
void FUNC1(WORD W, BIT B)
{
asm("PUSH {R0}");
asm("MRS R0,CONTROL");
asm("ORR R0,R0,#0x1");
asm("MSR CONTROL,R0");
asm("POP {R0}");
short NeedCompileSysRegAddr;
extern short __HD;
short* HD = (short*)&__HD;
char* B_HD = (char*)&__HD;
extern short __D;
short* D = (short*)&__D;
char* B_D = (char*)&__D;
extern char __HM;
INT32U HM = (INT32U)&__HM;
extern char __M;
INT32U M = (INT32U)&__M;
unsigned long* p0 = (unsigned long*)&D[0];
(*p0)++;
#define pD4_Float (( float * ) &D[4])
* pD4_Float = 1.234;
strcpy((char*)&D[20], "a一二b1234");
*((wchar_t*)&D[30]) = L'\x1234';
*((double*)&D[40]) = sqrt(2);
*((double*)&D[50]) = 1122334455.0;
asm("svc 0x01");
}
//end_FUNC1.c
//file:FUNC1.i
void FUNC1_i(INT16S* W, INT32U B)
{
asm("PUSH {R0}");
asm("MRS R0,CONTROL");
asm("ORR R0,R0,#0x1");
asm("MSR CONTROL,R0");
asm("POP {R0}");
#define SysRegAddr_HD_D_HM_M
short NeedCompileSysRegAddr;
extern short __HD;
short* HD = (short*)&__HD;
char* B_HD = (char*)&__HD;
extern short __D;
short* D = (short*)&__D;
char* B_D = (char*)&__D;
extern char __HM;
INT32U HM = (INT32U)&__HM;
extern char __M;
INT32U M = (INT32U)&__M;
//end_define
unsigned long* p0 = (unsigned long*)&D[0];
(*p0)++;
*((float*)&D[4]) = 1.234;
strcpy((char*)&D[20], "a一二b1234");
*((wchar_t*)&D[30]) = L'\x1234';
*((double*)&D[40]) = sqrt(2);
*((double*)&D[50]) = 1122334455.0;
asm("svc 0x01");
}
//end_FUNC1.i