Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first PT2000 source commit #291

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 43 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,54 @@
"version": "0.2.0",
"configurations": [
{
"name": "Debug GDI GD32",
"name": "Debug GDI-4 GD32",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceFolder}/GDI4-ch/firmware",
"executable": "${workspaceFolder}/GDI4-ch/firmware/build/gdi4.elf",
"cwd": "${workspaceFolder}/GDI-4ch/firmware",
"executable": "${workspaceFolder}/GDI-4ch/firmware/build/gdi4.elf",
"device": "STM32F103CB",
"v1": false,
"svdFile": "${workspaceFolder}/GDI4-ch/firmware/STM32F103xx.svd",
"servertype": "openocd",
"svdFile": "${workspaceFolder}/GDI-4ch/firmware/STM32F103xx.svd",
//"servertype": "openocd",
"servertype": "jlink",
"serverpath": "C:/Program Files/SEGGER/JLink/JLinkGDBServerCL.exe",
"interface": "swd",
"configFiles": ["interface/stlink.cfg", "target/stm32f1x.cfg"],
"runToMain": true,
//"runToMain": true,
},
{
"name": "Debug GDI-6 GD32",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceFolder}/GDI-6ch/firmware",
"executable": "${workspaceFolder}/GDI-6ch/firmware/build/gdi6.elf",
"device": "STM32F103CB",
"v1": false,
"svdFile": "${workspaceFolder}/GDI-6ch/firmware/STM32F103xx.svd",
//"servertype": "openocd",
"servertype": "jlink",
"serverpath": "C:/Program Files/SEGGER/JLink/JLinkGDBServerCL.exe",
"interface": "swd",
"configFiles": ["interface/stlink.cfg", "target/stm32f1x.cfg"],
//"runToMain": true,
} {
"name": "Debug GDI-6 STLINK",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceFolder}/GDI-6ch/firmware",
"executable": "${workspaceFolder}/GDI-6ch/firmware/build/gdi6.elf",
"device": "STM32F103CB",
"v1": false,
"svdFile": "${workspaceFolder}/GDI-6ch/firmware/STM32F103xx.svd",
//"servertype": "openocd",
"servertype": "stlink",
"serverpath": "C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.win32_2.1.400.202404281720/tools/bin/ST-LINK_gdbserver.exe",
//"serverArgs": [
//"-cp C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.400.202404281720/tools/bin",
//"-d"], // swd
"interface": "swd",
//"configFiles": ["interface/stlink.cfg", "target/stm32f1x.cfg"],
//"runToMain": true,
}
]
}
26 changes: 18 additions & 8 deletions GDI-6ch/firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -fsingle-precision-constant
USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 -fsingle-precision-constant
endif

# C specific options here (added to USE_OPT).
Expand All @@ -15,7 +15,7 @@ endif

# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti -fno-exceptions -ffast-math -funsafe-math-optimizations -fno-threadsafe-statics -fno-use-cxa-atexit
USE_CPPOPT = -fno-rtti -fno-exceptions -ffast-math -funsafe-math-optimizations -fno-threadsafe-statics -fno-use-cxa-atexit -std=c++17
endif

# Enable this if you want the linker to remove unused code and data.
Expand Down Expand Up @@ -83,7 +83,7 @@ endif
#

# Define project name here
PROJECT = gdi4
PROJECT = gdi6

# Target settings.
MCU = cortex-m3
Expand All @@ -100,6 +100,9 @@ ifeq ("$(wildcard $(CHIBIOS)/os/license/license.mk)","")
$(error Please run 'git submodule update --init --recursive' before trying to build!)
endif

# Configure libfirmware Paths/Includes
RUSEFI_LIB = ../../ext/libfirmware

# Licensing files.
include $(CHIBIOS)/os/license/license.mk
# Startup files.
Expand All @@ -115,25 +118,30 @@ include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Auto-build files in ./source recursively.
include $(CHIBIOS)/tools/mk/autobuild.mk
# Other files (optional).
include $(CHIBIOS)/os/hal/lib/complex/mfs/hal_mfs.mk
include $(CHIBIOS)/os/hal/lib/streams/streams.mk

# Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32F103xB.ld
#LDSCRIPT= $(STARTUPLD)/STM32F103xB.ld
LDSCRIPT= gdi.ld

# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(ALLCSRC) \
mc33816_data.c
$(RUSEFI_LIB_C) \
PT2000_LoadData.c


# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC = $(ALLCPPSRC) \
$(RUSEFI_LIB_CPP) \
uart.cpp \
mc33816_control.cpp \
persistence.cpp \
pt2000.cpp \
can.cpp \
fault.cpp \
main.cpp
main.cpp

# List ASM source files here.
ASMSRC = $(ALLASMSRC)
Expand All @@ -142,7 +150,9 @@ ASMSRC = $(ALLASMSRC)
ASMXSRC = $(ALLXASMSRC)

# Inclusion directories.
INCDIR = $(CONFDIR) $(ALLINC)
INCDIR = $(CONFDIR) $(ALLINC) \
$(RUSEFI_LIB_INC) \
$(RUSEFI_LIB)/can

# Define C warning options here.
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
Expand Down
171 changes: 171 additions & 0 deletions GDI-6ch/firmware/PT2000_LoadData.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/*******************************************************************************
* Example Code
*
* Copyright(C) 2025 NXP Semiconductors
* NXP Semiconductors Confidential and Proprietary
*
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* NXP products. This software is supplied "AS IS" without any warranties
* of any kind, and NXP Semiconductors and its licensor disclaim any and
* all warranties, express or implied, including all implied warranties of
* merchantability, fitness for a particular purpose and non-infringement of
* intellectual property rights. NXP Semiconductors assumes no responsibility
* or liability for the use of the software, conveys no license or rights
* under any patent, copyright, mask work right, or any other intellectual
* property rights in or to any products. NXP Semiconductors reserves the
* right to make changes in the software without notification. NXP
* Semiconductors also makes no representation or warranty that such
* application will be suitable for the specified use without further testing
* or modification.
*
* IN NO EVENT WILL NXP SEMICONDUCTORS BE LIABLE, WHETHER IN CONTRACT,
* TORT, OR OTHERWISE, FOR ANY INCIDENTAL, SPECIAL, INDIRECT, CONSEQUENTIAL
* OR PUNITIVE DAMAGES, INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR ANY
* LOSS OF USE, LOSS OF TIME, INCONVENIENCE, COMMERCIAL LOSS, OR LOST
* PROFITS, SAVINGS, OR REVENUES, TO THE FULL EXTENT SUCH MAY BE DISCLAIMED
* BY LAW. NXP SEMICONDUCTOR’S TOTAL LIABILITY FOR ALL COSTS, DAMAGES,
* CLAIMS, OR LOSSES WHATSOEVER ARISING OUT OF OR IN CONNECTION WITH THE
* SOFTWARE IS LIMITED TO THE AGGREGATE AMOUNT PAID BY YOU TO NXP SEMICONDUCTORS
* IN CONNECTION WITH THE SOFTWARE TO WHICH LOSSES OR DAMAGES ARE CLAIMED.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, under NXP Semiconductors' and its
* licensor's relevant copyrights in the software, without fee, provided
* that it is used in conjunction with NXP Semiconductors devices. This
* copyright, permission, and disclaimer notice must appear in all copies
* of this code.
*******************************************************************************/

//==============================================================================
// This file contains data arrays that are used to load the code RAM, data RAM
// and registers on the PT2000.
//==============================================================================

// ECU: IDE Project
// Project: rusefi

#include "PT2000_LoadData.h"

// Data to be loaded into the Code RAM 1 memory space
unsigned short PT2000_code_RAM1[116] =
{
0x3645, 0xB475, 0x5135, 0x3159, 0x200A, 0x860B, 0x10C4, 0x2F0A, 0x2958, 0x1E87,
0xC964, 0xD52D, 0xB5C3, 0xDCB5, 0x39F9, 0x76F7, 0x2304, 0x84A7, 0x4729, 0xF6DC,
0x9E2E, 0x4F10, 0x8BE3, 0x9157, 0x9B94, 0xC8BD, 0x8C8C, 0x5B8E, 0x9338, 0x8214,
0x9D8B, 0x8D95, 0x71D3, 0xF684, 0x2A29, 0xF503, 0xD61A, 0xC3EB, 0x66FF, 0x84DA,
0x4D1D, 0x4B20, 0x5A7B, 0x5CB6, 0x3828, 0x75A0, 0x36EC, 0x8097, 0xFED6, 0x8AD2,
0x96F2, 0xACBE, 0x1F95, 0xA0DC, 0x27BD, 0x9F2C, 0x18BC, 0x7ED1, 0x1877, 0xF4AE,
0x8B74, 0x0648, 0xF114, 0x6554, 0xCE5F, 0xAE7D, 0x3D7A, 0x9067, 0x3987, 0x8D21,
0x81BE, 0x4FAC, 0x54EE, 0xFBD0, 0xB38C, 0x16EB, 0x4E72, 0x747E, 0xCC43, 0x191C,
0xA60F, 0x0B69, 0x75B2, 0xD393, 0x1205, 0x44A4, 0xFF55, 0xC8C4, 0x9C8F, 0x4CBC,
0xA329, 0x0877, 0x3657, 0x3AEB, 0xEFA1, 0xFA4C, 0x213C, 0xD0D1, 0xCDC9, 0x1405,
0x18FB, 0xCF49, 0x401A, 0xD5BC, 0x605C, 0x6A2F, 0xAB01, 0x1676, 0x2C83, 0x442D,
0x3915, 0x08EF, 0x4705, 0x883C, 0xAF0B, 0x8FCD
};

// Data to be loaded into the Code RAM 2 memory space
unsigned short PT2000_code_RAM2[62] =
{
0x3643, 0xB476, 0x5135, 0x3159, 0x200A, 0x840B, 0x12C4, 0x2F0A, 0x3868, 0x1E87,
0xD874, 0xD52D, 0xB5DB, 0xDCB5, 0x39F9, 0x76F7, 0x2304, 0x84A7, 0x4729, 0xF6DC,
0x9E2E, 0x4F10, 0x8BE3, 0x9157, 0x9B94, 0xC8BD, 0x8C8C, 0x5B8E, 0x9338, 0x820C,
0x9D8B, 0x8D95, 0x71D3, 0xF684, 0x2A29, 0xF503, 0xD61A, 0xC3EB, 0x66FF, 0x84DA,
0x4D1D, 0x4B20, 0x5A7B, 0x5CB6, 0x3828, 0x75A0, 0x36F4, 0x8097, 0xFED6, 0x8AD2,
0x96F2, 0xACBE, 0x1F95, 0xA0DC, 0x27BD, 0x9F2C, 0x18BC, 0x7ED1, 0x1465, 0xF8D0,
0x33FB, 0xB9A9
};

// Data to be loaded into the Code RAM 3 memory space
unsigned short PT2000_code_RAM3[43] =
{
0x3647, 0xB47F, 0x51B1, 0x3159, 0x200A, 0x852A, 0x3D25, 0x8D10, 0x8606, 0xB456,
0x8F79, 0xCE44, 0x00C2, 0x58C3, 0x6595, 0xE89E, 0x2B45, 0x1211, 0xB860, 0xF7F6,
0xFC33, 0x4F0C, 0x8A62, 0x9CAF, 0x9A45, 0x4333, 0x8D09, 0xEC00, 0x41DE, 0x3652,
0x99EA, 0x8345, 0x759D, 0x4297, 0xD69B, 0xF515, 0x639E, 0xC3AC, 0x237F, 0x8500,
0x4C9E, 0x3B9B, 0x4139
};

// Data to be loaded into the Data RAM memory space
unsigned short PT2000_data_RAM[192] =
{
0x008D, 0x006D, 0x003A, 0x003C, 0x1068, 0x003C, 0x0168, 0xEA60, 0x0960, 0x0258,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x008D, 0x006D, 0x003A, 0x003C, 0x1068, 0x003C,
0x0168, 0xEA60, 0x0960, 0x0258, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00C1, 0x00BF,
0x0040, 0x001D, 0x0000, 0x0046, 0x0037, 0x003C, 0xEA60, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000
};

// Data to be loaded into the Main register memory space
unsigned short PT2000_main_config[32] =
{
0x0003, 0x0000, 0x0008, 0xE81F, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x001D,
0x0000, 0x0000, 0x0000, 0x0000, 0xBF3F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000
};

// Data to be loaded into the CH1 register memory space
unsigned short PT2000_ch1_config[20] =
{
0x0000, 0x0025, 0x0014, 0x0C03, 0x0000, 0x0001, 0x0001, 0x0074, 0x3B52, 0xA28B,
0x0000, 0x003A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000

};

// Data to be loaded into the CH2 register memory space
unsigned short PT2000_ch2_config[20] =
{
0x0000, 0x000C, 0x0070, 0x0030, 0x0000, 0x0002, 0x0002, 0x003E, 0x9F7E, 0x4EEC,
0x0000, 0x003A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0000

};

// Data to be loaded into the CH3 register memory space
unsigned short PT2000_ch3_config[20] =
{
0x0000, 0x0003, 0x000C, 0x0080, 0x0000, 0x0000, 0x0000, 0x002B, 0x6F0D, 0x3DFF,
0x0000, 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0004, 0x0000

};

// Data to be loaded into the IO register memory space
unsigned short PT2000_io_config[73] =
{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0303, 0x0C0C, 0x3030, 0x0000, 0x8040, 0x4000, 0x0201, 0x0040,
0x3004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0555,
0x0555, 0x0050, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0707, 0x0707,
0x0707, 0x0707, 0x0707, 0x00CD, 0x0020, 0x0000, 0x0000, 0x0017, 0x0016, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0003,
0x0003, 0x000C, 0x000C, 0x0030, 0x0030, 0x0080, 0x0000, 0x0028, 0x0028, 0x0028,
0x8110, 0x23C7, 0x0100
};

// Data to be loaded into the Diag register memory space
unsigned short PT2000_diag_config[64] =
{
0x0000, 0x0000, 0x003E, 0x0000, 0x0000, 0x003E, 0x0000, 0x0000, 0x003E, 0x0000,
0x0000, 0x003E, 0x0000, 0x0000, 0x003E, 0x0000, 0x0000, 0x003E, 0x0000, 0x0000,
0x003E, 0x0000, 0x0000, 0x003E, 0x0000, 0x0000, 0x00FE, 0x0000, 0x0000, 0x00FE,
0x0000, 0x0000, 0x00FE, 0x0000, 0x0000, 0x00FE, 0x0000, 0x0000, 0x00FE, 0x0000,
0x0000, 0x00FE, 0x0000, 0x0000, 0x00FE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000
};

62 changes: 62 additions & 0 deletions GDI-6ch/firmware/PT2000_LoadData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*******************************************************************************
* Example Code
*
* Copyright(C) 2025 NXP Semiconductors
* NXP Semiconductors Confidential and Proprietary
*
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* NXP products. This software is supplied "AS IS" without any warranties
* of any kind, and NXP Semiconductors and its licensor disclaim any and
* all warranties, express or implied, including all implied warranties of
* merchantability, fitness for a particular purpose and non-infringement of
* intellectual property rights. NXP Semiconductors assumes no responsibility
* or liability for the use of the software, conveys no license or rights
* under any patent, copyright, mask work right, or any other intellectual
* property rights in or to any products. NXP Semiconductors reserves the
* right to make changes in the software without notification. NXP
* Semiconductors also makes no representation or warranty that such
* application will be suitable for the specified use without further testing
* or modification.
*
* IN NO EVENT WILL NXP SEMICONDUCTORS BE LIABLE, WHETHER IN CONTRACT,
* TORT, OR OTHERWISE, FOR ANY INCIDENTAL, SPECIAL, INDIRECT, CONSEQUENTIAL
* OR PUNITIVE DAMAGES, INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR ANY
* LOSS OF USE, LOSS OF TIME, INCONVENIENCE, COMMERCIAL LOSS, OR LOST
* PROFITS, SAVINGS, OR REVENUES, TO THE FULL EXTENT SUCH MAY BE DISCLAIMED
* BY LAW. NXP SEMICONDUCTOR’S TOTAL LIABILITY FOR ALL COSTS, DAMAGES,
* CLAIMS, OR LOSSES WHATSOEVER ARISING OUT OF OR IN CONNECTION WITH THE
* SOFTWARE IS LIMITED TO THE AGGREGATE AMOUNT PAID BY YOU TO NXP SEMICONDUCTORS
* IN CONNECTION WITH THE SOFTWARE TO WHICH LOSSES OR DAMAGES ARE CLAIMED.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, under NXP Semiconductors' and its
* licensor's relevant copyrights in the software, without fee, provided
* that it is used in conjunction with NXP Semiconductors devices. This
* copyright, permission, and disclaimer notice must appear in all copies
* of this code.
*******************************************************************************/

//==============================================================================
// This file contains data array declarations for the code RAM, data RAM and
// register arrays for the PT2000.
//==============================================================================

// ECU: IDE Project
// Project: rusefi

#ifndef PT2000_DATA_H_
#define PT2000_DATA_H_

extern unsigned short PT2000_code_RAM1[116]; // CODE RAM CH 1
extern unsigned short PT2000_code_RAM2[62]; // CODE RAM CH 2
extern unsigned short PT2000_code_RAM3[43]; // CODE RAM CH 3
extern unsigned short PT2000_data_RAM[192]; // DATA RAM
extern unsigned short PT2000_main_config[32]; // main configurations
extern unsigned short PT2000_ch1_config[20]; // CH 1 configurations
extern unsigned short PT2000_ch2_config[20]; // CH 2 configurations
extern unsigned short PT2000_ch3_config[20]; // CH 3 configurations
extern unsigned short PT2000_io_config[73]; // IO configurations
extern unsigned short PT2000_diag_config[64]; // diag configurations

#endif /* PT2000_DATA_H_ */
Loading
Loading