GithubHelp home page GithubHelp logo

vectorgrp / xcplite Goto Github PK

View Code? Open in Web Editor NEW
147.0 18.0 82.0 3.44 MB

Simple implementation of the ASAM XCP on Ethernet (UDP) protocol

License: MIT License

C 90.37% CMake 1.37% C++ 8.27%
xcp a2l canape vector-informatik asam canoe mcd calibration-tool asap mdf

xcplite's People

Contributors

fabianrees avatar frederich avatar kecmic avatar keithathaide-zf avatar rainerz avatar tardyp avatar truecarfield avatar truecarfield1 avatar vlorian-de avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xcplite's Issues

XCPLite runs on the simulink model

Hello Rainer Zaiser

Thank you for yourwork and i have run the XPClite V4 on the ubuntu.
If i want to use my ecu model ,i should replace the ecu.c or ecupp.cpp, it is right?
And i think i can use the sfunction and TLC to compile your XCPLite in the simulink, and simulink model can use the XCPlite( to suppot the model working on the ROS and use the CANAPE to calibrate and measure)

Request for clarification

Hello,

I just found this repository and while the whole thing is released under MIT license,
the individual files do not have license information.

For example, what is the supposed status of vxlapi.h?
It clearly states Vector Informatik copyright, no issue there, but what about the license?
Or A2L.c, there is no copyright or license for this file.

Why does XcpSetDaqListMode overwrites flags to be mode?

I have a question about the function XcpSetDaqListMode in xcpLite.c in commit 0870237 (most recent commit in master). It has this line DaqListFlags(daq) = mode;, which overwrites the flags to be mode.

From the XCP specification (only have version 1.1 in hand), the mode in SET_DAQ_LIST_MODE is bit mask of ALTERNATING, DIRECTION, TIMESTAMP, PID_OFF. The line DaqListFlags(daq) = mode; will clear the bits like DAQ_FLAG_SELECTED and DAQ_FLAG_RUNNING when receiving a SET_DAQ_LIST_MODE command. Is this a bug? Thanks for reply.

CPP_Demo memory dump

In CPP_Demo project, there is something problem which could cause memory dump as below:

 // Create 10 different SigGen signal generator task instances with calibration parameters and dynamic addressing
// The constructor of SigGen will create an instance amd an associated XCP event
SigGen* sigGen[10];
for (int i = 0; i <= 9; i++) {
    std::string* s = new std::string("SigGen"); s->append(std::to_string(i+1));
    sigGen[i] = new SigGen((char*)s->c_str(), 2000, 100.0-i*5, 0.0, i*M_PI/15.0, 2.0);
}

// Create A2L description for class SigGen, use any instance to do this, function cant be static
sigGen[0]->a2lCreateTypedef();


// Create virtual instances of pMinSigGen and pMaxSigGen 
minSigGenEvent = new XcpDynObject("pMinSigGen", SigGen);
maxSigGenEvent = new XcpDynObject("pMaxSigGen", SigGen);

Create virtual instances of pMinSigGen and pMaxSigGen could be done before Create 10 different SigGen signal generator task instances.

It should be like this

// Create virtual instances of pMinSigGen and pMaxSigGen 
minSigGenEvent = new XcpDynObject("pMinSigGen", SigGen);
maxSigGenEvent = new XcpDynObject("pMaxSigGen", SigGen);

// Create 10 different SigGen signal generator task instances with calibration parameters and dynamic addressing
// The constructor of SigGen will create an instance amd an associated XCP event
SigGen* sigGen[10];
for (int i = 0; i <= 9; i++) {
    std::string* s = new std::string("SigGen"); s->append(std::to_string(i+1));
    sigGen[i] = new SigGen((char*)s->c_str(), 2000, 100.0-i*5, 0.0, i*M_PI/15.0, 2.0);
}

// Create A2L description for class SigGen, use any instance to do this, function cant be static
sigGen[0]->a2lCreateTypedef();

The SigGen class will generate a thread which could use minSigGenEvent/maxSigGenEvent(points to objects). In some situations minSigGenEvent/maxSigGenEvent will be initialized before the threads use minSigGenEvent/maxSigGenEvent . But it not always works and cause the memory dump.
Wish it helps.

Memory access violation

Dear Mr Zaiser,

First of all thank you so much for making publicly available this very nice implementation of the XCP protocol.

I'm a developer mostly using the Mathworks / dSpace toolchain combining Simulink for modelling and code-generation with ControlDesk for debugging and visualisation.

The code compiled without any issues on my Windows 64bit machine.

Using a demo version of CANape I was also able to visualize the different measurements and instances of the XCP objects.

However, when connecting with the ControlDesk client from dSpace, XCP Slave application crashes with a memory access violation on line 754 of src/xcpLite.c

            memcpy((uint8_t*)d, &base[OdtEntryAddr(e)], n);

I'm no expert at all in writing or understanding this type of C++ software but after a few days of trial-and-error debugging I was able to find a workaround for the issue:

            uint8_t addr = OdtEntryAddr(e);
            uint8_t *src = &base[addr];
            memcpy((uint8_t*)d, src, n);

I cannot explain why this piece of code, which as far as I can see is identical to the original, does work, and the original does not, but it seems to solve the issue.

Would you be able to shed some light on this issue?

Thank you very much for your time and effort

Kind regards

Christophe

Segmentation Fault using local variables..

Hi,

I tried using local variables for creating parameter in a2l and while running it gave segmentation fault.
So I want to ask, can we use local variables for creating parameters, or only global variables are valid for using in create parameter.

I am very new to this xcp stuff. Any help will be appreciated.

No function to create physical calibration parameter

Hi Vector group,

I found that you only provided with below 4 calibration related creation functions:
image
But I can't find them offering physical meanings to calibration parameters (factor and offset).
So if we want to see calibration parameters with physical value showing on CANape, how should we realize it?

Can we modify the function to be like below to make it work?
void A2lCreatePhysParameter_(const char* name, int size, uint32_t addr, const char* comment, double factor, double offset, const char* unit, double min, double max) {
      const char *conv = "NO";
      if (factor != 0.0 || offset != 0.0) {
            fprintf(gA2lFile, "/begin COMPU_METHOD %s_COMPU_METHOD "" LINEAR "%%6.3" "%s" COEFFS_LINEAR %g %g /end COMPU_METHOD\n", name, unit!=NULL?unit:"", factor, offset);
            conv = name;
            gA2lConversions++;
      }
      fprintf(gA2lFile, "/begin CHARACTERISTIC %s "%s" VALUE 0x%X %s 0 %s_COMPU_METHOD %g %g PHYS_UNIT "%s" /end CHARACTERISTIC\n",
            name, comment, addr, getParType(size), conv, min, max, unit);
      gA2lParameters++;
}

Look forward to some reply. Thanks

Possibility using virtual address

Currently I'm trying to use virtual address (e.g. 0x0, 0x1, 0x2, ...) for measurement signals in A2L.
For example I have 3 signals out1, out2, out3 defined as following:

/begin MEASUREMENT out1 "" FLOAT64_IEEE NO_COMPU_METHOD 0 0 -1E12 1E12 ECU_ADDRESS 0x0
  /begin IF_DATA XCP /begin DAQ_EVENT FIXED_EVENT_LIST EVENT 0x0 /end DAQ_EVENT /end IF_DATA
/end MEASUREMENT
/begin MEASUREMENT out2 "" SLONG NO_COMPU_METHOD 0 0 -2147483648 2147483647 ECU_ADDRESS 0x1
  /begin IF_DATA XCP /begin DAQ_EVENT FIXED_EVENT_LIST EVENT 0x0 /end DAQ_EVENT /end IF_DATA
/end MEASUREMENT
/begin MEASUREMENT out3 "" UWORD NO_COMPU_METHOD 0 0 0 65535 ECU_ADDRESS 0x2
  /begin IF_DATA XCP /begin DAQ_EVENT FIXED_EVENT_LIST EVENT 0x0 /end DAQ_EVENT /end IF_DATA
/end MEASUREMENT

In this case CANape just give me for that DAQ event one ODT entry with 8 bytes, can I somehow modify CANape settings so that it can give me one ODT entry with 8+4+2=14 bytes or three entries with their individual sizes?

Compile xcpLite under WSL

Hello,

I tried to compile the project under WSL, but got the following errors:

Error 1:

/mnt/~/XCPlite/xcpAppl.c: In function ‘vuint8 ApplXcpGetA2LFilename(char**, vuint32*, int)’:
/mnt/~/XCPlite/xcpAppl.c:230:29: error: invalid conversion from ‘vuint8*’ {aka ‘unsigned char*’} to ‘char*’ [-fpermissive]
  230 |         if (p != NULL) *p = (vuint8*)gA2LPathname;
      |                             ^~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             vuint8* {aka unsigned char*}
/mnt/~/XCPlite/xcpAppl.c:234:29: error: invalid conversion from ‘vuint8*’ {aka ‘unsigned char*’} to ‘char*’ [-fpermissive]
  234 |         if (p != NULL) *p = (vuint8*)gA2LFilename;
      |                             ^~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             vuint8* {aka unsigned char*}
make[2]: *** [CMakeFiles/xcpLite.dir/build.make:102: CMakeFiles/xcpLite.dir/xcpAppl.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/xcpLite.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

Error2:

In file included from /mnt/~/XCPlite/util.c:12:
/mnt/~/XCPlite/util.h:104:1: error: expected declaration before ‘}’ token
  104 | }
      | ^
make[2]: *** [CMakeFiles/xcpLite.dir/build.make:141: CMakeFiles/xcpLite.dir/util.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/xcpLite.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

For the first Error I would propose the following fix:
if (p != NULL) *p = (char*)gA2LPathname;
if (p != NULL) *p = (char*)gA2LFilename;

For the second Error: (There is a wrong #endif that must be deleted or rather moved to the last of the line f the file):

#ifdef _LINUX

#include <termios.h>

extern int _getch();
extern int _kbhit();

#endif

//#endif // this can be removed


#ifdef __cplusplus
}  /* extern "C" */
#endif

#endif

New release version

Hello,

could you please make a new release tag (maybe V5.1) to catch up current codes in the repository? Beacuse I'm currently using my artifactory to link your code archive in the release tag, and I have found there are plenty of differences between your release tag and the code in the repository. Thank you very much!

Best regards

Bug in GET_DAQ_CLOCK_MULTICAST fixed

Fixed the GET_DAQ_CLOCK_MULTICAST problem.
High dword and low dword of timestamp swapped.
Wonder why CANape did not complain about this.
Measurement just started with some undeterministic delay.

Can XCPlite and CANape be run on the same machine?

Hello, I want to learn XCP by running XCPlite and CANape on one PC and debugging. I have set up a CANape project using the generated C_Demo.a2l. Clicking "Test connection" in CANape gives the result "Communication established". But CANape also reports all bus monitors and devices are offline, and the Online icon is disabled.

Can XCPlite and CANape be run on the same machine? Or do I need to run XCPlite and CANape on different machines, and connect them using Vector hardware? Thanks.

The determination of the XCP 1.3 DAQ start time failed error

Hi,

I am trying to integrate this XCP implementation into an android application. I could successfully connect Canape to the application over ethernet. However when I try to start measurement. It gives me the error below. What does this error mean and what should I do to handle that error?

Type Time Message
Command released -0.462s Start measurement

  • -0.456s CCSW: Clock informations
  • 0.100s 1 Recorder started with recording
    error message 0.101s CCSW: The determination of the XCP 1.3 DAQ start time failed
    Warning 0.307s Warning from recorder 'Recorder': No data recorded

Thanks

C only example needs "math.h" support for cmake

For a C only demonstration (like [1]), you need to add "math.h" support into CMAKE project file, see [2]. Otherwise compiling will end up like [0].

[0]:

Scanning dependencies of target xcpLite
[ 10%] Building C object CMakeFiles/xcpLite.dir/main.c.o
[ 20%] Building C object CMakeFiles/xcpLite.dir/ecu.c.o
[ 30%] Building C object CMakeFiles/xcpLite.dir/udpserver.c.o
[ 40%] Building C object CMakeFiles/xcpLite.dir/udp.c.o
[ 50%] Building C object CMakeFiles/xcpLite.dir/xcpAppl.c.o
[ 60%] Building C object CMakeFiles/xcpLite.dir/xcpLite.c.o
[ 70%] Building C object CMakeFiles/xcpLite.dir/A2L.c.o
[ 80%] Building C object CMakeFiles/xcpLite.dir/xcpSlave.c.o
[ 90%] Building C object CMakeFiles/xcpLite.dir/clock.c.o
[100%] Linking C executable xcpLite
CMakeFiles/xcpLite.dir/ecu.c.o: In Funktion »ecuCyclic«:
/home/brenkem/git/XCPlite/ecu.c:307: Warnung: undefinierter Verweis auf »sin«
/home/brenkem/git/XCPlite/ecu.c:308: Warnung: undefinierter Verweis auf »sin«
/home/brenkem/git/XCPlite/ecu.c:309: Warnung: undefinierter Verweis auf »sin«
/home/brenkem/git/XCPlite/ecu.c:310: Warnung: undefinierter Verweis auf »sin«
/home/brenkem/git/XCPlite/ecu.c:311: Warnung: undefinierter Verweis auf »sin«
CMakeFiles/xcpLite.dir/ecu.c.o:/home/brenkem/git/XCPlite/ecu.c:312: Warnung: weitere undefinierte Verweise auf »sin« folgen
collect2: error: ld returned 1 exit status
CMakeFiles/xcpLite.dir/build.make:302: recipe for target 'xcpLite' failed
make[2]: *** [xcpLite] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/xcpLite.dir/all' failed
make[1]: *** [CMakeFiles/xcpLite.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

[1]:

$ diff -us main.cpp main.c
--- main.cpp	2021-06-23 11:59:37.971809677 +0200
+++ main.c	2021-06-23 13:32:01.755285006 +0200
@@ -1,6 +1,6 @@
 /*----------------------------------------------------------------------------
 | File:
-|   main.cpp
+|   main.c
 |
 | Description:
 |   Demo main for XCP on Ethernet (UDP) demo
@@ -49,11 +49,10 @@
         A2lHeader();
     }
     ecuCreateA2lDescription();
-    ecuppCreateA2lDescription();
     A2lCreateParameterWithLimits(gDebugLevel, "Console output verbosity", "", 0, 4);
     A2lCreateParameterWithLimits(gFlushCycleMs, "DAQ flush cycle time, 0 = off", "", 0, 1000);
     A2lClose();
@@ -80,13 +79,13 @@
- // C++ main
+ // C main
 int main(int argc, char* argv[])
@@ -255,13 +254,9 @@
 #endif
 
     // C demo
    // Initialize ECU demo task (C) 
     ecuInit();
-        
-    // C++ demo
-    // Initialize ECU demo tasks (C++) 
-    ecuppInit();
-    
+
 
 #ifdef _LINUX
 
@@ -271,10 +266,7 @@
         createA2L(p);
     }
 
-    // Demo threads
-    pthread_t t3;
-    int a3 = 0;
-    pthread_create(&t3, NULL, ecuppTask, (void*)&a3);
+    // Demo thread
     pthread_t t2;
     int a2 = 0;
     pthread_create(&t2, NULL, ecuTask, (void*)&a2);
@@ -293,12 +285,11 @@
 
 #ifndef XCPSIM_SINGLE_THREAD_SLAVE
     pthread_cancel(t1);
 #endif
     pthread_cancel(t2);
-    pthread_cancel(t3);
 
 #endif // _LINUX
 #ifdef _WIN
@@ -312,7 +303,6 @@
 
     // Demo threads
     std::thread t2([]() { ecuTask(0); });
-    std::thread t3([]() { ecuppTask(0); });

[2]:

$ git diff CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7515d4b..91f54c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 3.1.0)
 project(xcpLite)
 
-set(SOURCES main.cpp ecupp.cpp ecu.c udpserver.c udp.c xcpAppl.c xcpLite.c A2L.c xcpSlave.c clock.c)
+set(SOURCES main.c ecu.c udpserver.c udp.c xcpAppl.c xcpLite.c A2L.c xcpSlave.c clock.c)
 set(CMAKE_BUILD_TYPE Debug)
 
 add_executable(xcpLite ${SOURCES})
@@ -9,4 +9,4 @@ add_executable(xcpLite ${SOURCES})
 set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_package(Threads REQUIRED)
 target_link_libraries(xcpLite PRIVATE Threads::Threads)
-
+target_link_libraries(xcpLite PRIVATE m)

Update CMakeLists file

Hello,
During the last changes the file util.c has been deleted and replaced with platform.c (I assume) but CMakeLists.txt file hasn't been changed accordingly. This has to be updated.
Thanks

Provide a manual

Hi,
I m new to xcp topic and found your repository. Could you provide a tutorial (pdf) how to get this run, e.g. a raspberry pi as Slave and a Windows system as Master?

XCPsim: Invalid counter in XCP transport layer header

In CANape 14, We could see the sine waveform. But there are error messages in “comments”.

error message 0.676s XCPsim: Invalid counter in XCP transport layer header: expected 22563, received 22570.
Warning 0.676s XCPsim: Received incomplete DAQ list number 0: Missing data from 1 ODT(s) (from a total of 6).

CMakeLists

CMake project generation fails on master.
udpserver.c was renamed to xcpTl.c

Build still fails due to incomplete type ‘struct dl_phdr_info’
The reason seem to be that cmake build mixes compilers and uses c++ for .cpp and cc for .c files.
The one does seem to define _GNU_SOURCE while the other don't. Uncommenting _GNU_SOURCE in the code produces redefinition warning for the compiler that already defined the _GNU_SOURCE.

Since XCPlite does seem to rely on GNU and the vscode uses GNU g++ compiler for all .c and .cpp files, I suggest enforcing that compiler in the CMakeLists.txt by adding:

set(CMAKE_C_COMPILER "g++")
set(CMAKE_CXX_COMPILER "g++")

New Release Version

Hello,

could you please make a new release tag (maybe V5.2) to catch up current codes in the repository?

Best Regards

Help

Hello,

I'm a senior computer engineering student working on my senior design project at the moment, my project requires reading some hardware through ethernet and the hardware lists xcp on udp/ip as the communication protocol.

My team has to use a raspberry pi, would this program achieve this and work on the pi? If so, how would I install it on my raspberry pi?

Also, would it be possible to use python to read the values being read from the hardware?

Thanks,

aaroniza0

Multiple instances for c++ application

Hello,

currently in the C++ implementation the xcp object is based on singleton pattern, because the C-style core code in xcpLite.c. I wonder is it possible to activate multiple xcp servers for c++ application class in one process? And implement the user defined callbacks in XcpAppl.c this way:

ApplXcpGetBaseAddr(void* obj);

thus using void* to to get access to the application class instance.
Maybe it is already planned in V6?
Thank you for your attention!

Best regards

Error when using DAQ on CPP project

Firstly, Thank about this poject. I tried both two projects: C_Demo and CPP_Demo with mesurement and calibartion at DAQ mode and polling mode

C_Demo is fine with both DAQ and polling mode. But, CPP_Demo happens "Segment fault" when using DAQ mode.

I tried them on beaglebone black board.

I hope that Could your team check this problem ?

Originally posted by @Wechs24 in #17

Compile xcpLite under Ubuntu

Hello,

I tried to compile the CMake project, but got several errors.
Could you please fix this?

I will attach later on the errors.

Thanks

Compile xcpLite under LINUX / Ubuntu 18.04

Hello.

I tried to compile the CMake project under my Ubuntu 18.04 system, but failed (see [1]).

What is the correct way to build xcpLite?

Thanks.

[1]:

$ git clone https://github.com/vectorgrp/XCPlite.git
$ mkdir build
$ cd build/
$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/brenkem/git/XCPlite/build

$ make
Scanning dependencies of target xcpLite
[  9%] Building CXX object CMakeFiles/xcpLite.dir/main.cpp.o
In file included from /home/brenkem/git/XCPlite/xcpLite.h:1641:0,
                 from /home/brenkem/git/XCPlite/main.h:137,
                 from /home/brenkem/git/XCPlite/main.cpp:15:
/home/brenkem/git/XCPlite/main.cpp: In function ‘int createA2L(const char*)’:
/home/brenkem/git/XCPlite/xcpAppl.h:42:41: error: cast from ‘vuint8* {aka unsigned char*}’ to ‘vuint32 {aka unsigned int}’ loses precision [-fpermissive]
 #define ApplXcpGetAddr(p) ((vuint32)((p)))
                                         ^
/home/brenkem/git/XCPlite/A2L.h:59:114: note: in expansion of macro ‘ApplXcpGetAddr’
 ameterWithLimits(name,comment,unit,min,max) A2lCreateParameterWithLimits_(#name,sizeof(name),ApplXcpGetAddr((vuint8*)&name),comment,unit,min,max)
                                                                                              ^~~~~~~~~~~~~~
/home/brenkem/git/XCPlite/main.cpp:53:5: note: in expansion of macro ‘A2lCreateParameterWithLimits’
     A2lCreateParameterWithLimits(gDebugLevel, "Console output verbosity", "", 0, 4);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brenkem/git/XCPlite/xcpAppl.h:42:41: error: cast from ‘vuint8* {aka unsigned char*}’ to ‘vuint32 {aka unsigned int}’ loses precision [-fpermissive]
 #define ApplXcpGetAddr(p) ((vuint32)((p)))
                                         ^
/home/brenkem/git/XCPlite/A2L.h:59:114: note: in expansion of macro ‘ApplXcpGetAddr’
 ameterWithLimits(name,comment,unit,min,max) A2lCreateParameterWithLimits_(#name,sizeof(name),ApplXcpGetAddr((vuint8*)&name),comment,unit,min,max)
                                                                                              ^~~~~~~~~~~~~~
/home/brenkem/git/XCPlite/main.cpp:54:5: note: in expansion of macro ‘A2lCreateParameterWithLimits’
     A2lCreateParameterWithLimits(gFlushCycleMs, "DAQ flush cycle time, 0 = off", "", 0, 1000);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/brenkem/git/XCPlite/main.cpp: In function ‘int main(int, char**)’:
/home/brenkem/git/XCPlite/main.cpp:186:49: warning: too many arguments for format [-Wformat-extra-args]
         else if (sscanf_s(argv[i], "-t%c", &c, 1) == 1) {
                                                 ^
CMakeFiles/xcpLite.dir/build.make:62: recipe for target 'CMakeFiles/xcpLite.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/xcpLite.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/xcpLite.dir/all' failed
make[1]: *** [CMakeFiles/xcpLite.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Heap-use-after-free in socketGetLocalAddr

Hello,

I have run a test with the V6.2 CPP_Demo under linux with address sanitizer, and got the following error:

==12==ERROR: AddressSanitizer: heap-use-after-free on address 0x61c000000b68 at pc 0x7fe7da0b5703 bp 0x7ffcafb91330 sp 0x7ffcafb91320

READ of size 8 at 0x61c000000b68 thread T0:

#0 0x7fe7da0b5702 in socketGetLocalAddr 
#1 0x7fe7da0ba3ca in XcpEthTlInit 
#2 0x7fe7da0b71f3 in XcpEthServerInit 

freed by thread T0 here:

#0 0x55891661292f in __interceptor_free
#1 0x7fe7da0b567a in socketGetLocalAddr
#2 0x7fe7da0ba3ca in XcpEthTlInit
#3 0x7fe7da0b71f3 in XcpEthServerInit

previously allocated by thread T0 here:

#0 0x558916612f26 in __interceptor_calloc 
#1 0x7fe7d92c4122  (/lib/x86_64-linux-gnu/libc.so.6+0x141122)
#2 0x7fe7d92c4c07 in getifaddrs (/lib/x86_64-linux-gnu/libc.so.6+0x141c07)
#3 0x7fe7da0b5121 in socketGetLocalAddr
#4 0x7fe7da0ba3ca in XcpEthTlInit
#5 0x7fe7da0b71f3 in XcpEthServerInit

SUMMARY: AddressSanitizer: heap-use-after-free in socketGetLocalAddr

Shadow bytes around the buggy address:
0x0c387fff8110: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff8120: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff8130: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff8140: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff8150: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c387fff8160: fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd
0x0c387fff8170: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff8180: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff8190: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff81a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c387fff81b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd

Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc

==12==ABORTING================================================================================

Looks like the function socketGetLocalAddr() tried to read memory that is already be freed.

running XCPlite on a headless system

I'm running a headless linux system that has a proces running on it that I can communicate to with the XCP protocol from an external PC, however I want to make this data available over bluetooth so i'm trying to find a way work my way around to feeding the information through to my python program thats handling the bluetooth communication.

is this package usable without a UI? Are there commands i can use to circumvent the need for the UI?

XcpCreateEvent cycleTimeNs parameter mismatch in C_Demo

Hello, I noticed an issue, but I'm not sure which part is actually wrong, so I'm reporting it here.

Based on this diff I see that you modifed what is requested in the XcpCreateEvent method

image

But in C_Demo example, what is actually sent to the function is:
gXcpEvent_EcuCyclic = XcpCreateEvent("ecuTask", ECU_TASK_CYCLE_TIME_US/CLOCK_TICKS_PER_US, 0, 0, 0);
which is actually value in ms and this incorrectly creates the unit and channel cycle time in a2l.

Now, the question is if only the demo parameter is incorrectly calculated or functionality for calculating the unit and cycleTime inside XcpCreateEvent also has to be modified?

Memory leak pthread_create

Hi,

Hello I'm currently using XCPlite to build xcp server in my Program. My CI-System has reported memory leak due to pthread_create in XcpServerInit(), i see platform.h the linux version of macro cancel_thread is pthread_cancel, but no pthread_detach to make sure releasing resources. Could you please

Timeout: No response of the request msg received

Hello, i am new to xcp, i am trying to execute cpp_demo.exe but while calibrating global parameter. i am facing below error in CANape.
tmp_e05af837-d12f-40cb-8ddb-eac22cadcbc9

After debugging i found that download command not executing and in short_upload command error part is executing, you can refer below image. what do you mean by CRC_OUT_OF_RANGE

tmp_4795ae9f-b9fa-4e87-b6a8-147bc09e8a60

Can you please help me to resolve this error. Note: I am executing this code on aarch64 architecture.

Incorrect IP address in the A2L file(XCPLite V5)

Hi
If i use the XCPLite V5 demo, i can not get the correct local ip in the A2l file ,the ip is always 127.0.0.1,but i fill in correct ip in the CANAPE and can connect to the demo. So i think there is little problem with the A2L.c, XCPLite V4 does not have the same issue.

And about the 'The determination of the XCP 1.3 DAQ start time failed error', i disabled the 'XCPTL_MULTICAST' in the 'xcptl_cfg.h' and 'XCP_ENABLE_DAQ_CLOCK_MULTICAST' in the 'xcp_cfg.h',but there is still problem here.And in the Canape17.0 , i don't find the TIME_CORRELATION_GETDAQCLOCK in the path 'DeviceManager/Protocol/Eventlist/ExpertSetting', do i need the latest version 20.0?
or i can fix bug by myself(base on V5 BUGFIX), becasue i used the V4, and i can't start measurement by using V5, i pay more attention on the V4.

New Release Version

Hello,

could you please make a new release tag (maybe V5.3) to catch up current codes in the repository?

Best Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.