Skip to content

Commit

Permalink
doc: Improve markdown documents
Browse files Browse the repository at this point in the history
This includes improvement of markdown formatting as well as changes
in description itself.

Signed-off-by: Saya Sugiura <[email protected]>
  • Loading branch information
ssugiura committed Jun 27, 2019
1 parent f3a018d commit d073bf3
Show file tree
Hide file tree
Showing 6 changed files with 242 additions and 133 deletions.
41 changes: 27 additions & 14 deletions doc/dlt_cdh.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ Back to [README.md](../README.md)

## Overview

When a program crash occurs on the system the Core Dump Handler is triggered to extract relevant information from the core dump generated by the system. The handler stores this extracted information in the ECU's file system as Core Dump Handler Files. These files are transported via the link:dlt_filetransfer.html[DLT Filetransfer] mechanism. The transferred information can be combined and integrated into the developer toolchain (gdb, Release SW, etc.).
When a program crash occurs on the system, the Core Dump Handler is triggered to
extract relevant information from the core dump generated by the system. It
stores this extracted information in the ECU's file system as Core Dump Handler
Files. These files are transported via the [DLT Filetransfer](dlt_filetransfer.md)
mechanism. The transferred information can be combined and integrated into the
developer toolchain (gdb, Release SW, etc.).

![alt text](images/dlt_core_dump_handler.png "DLT CDH")

Expand All @@ -16,15 +21,18 @@ Add

`-DWITH_DLT_COREDUMPHANDLER=ON -DTARGET_CPU_NAME={i686|x86_64}`

options to cmake. The core dump handler code currently supports the i686 and x86_64 architecture.
options to cmake. The core dump handler code currently supports the i686 and
x86\_64 architecture.

### Temporary activation as replacement for default crash handler until next reboot

As *root* (not sudo) execute the following:

`echo "|/usr/local/bin/dlt-cdh %t %p %s %e" > /proc/sys/kernel/core_pattern`

NOTE: replace */usr/local/bin* with the path dlt-cdh has been installed to. This instructs the kernel to pipe a core dump as standard input to dlt-cdh together with the following parameters:
NOTE: replace */usr/local/bin* with the path dlt-cdh has been installed to. This
instructs the kernel to pipe a core dump as standard input to dlt-cdh together
with the following parameters:

- %t time of dump
- %p PID of dumped process
Expand All @@ -35,25 +43,28 @@ See

`man core`

for details
for details.

### Persistent activation as replacement for default crash handler

In */usr/lib/sysctl.d/* the file *50-coredump.conf* has to be created which is done automatically by
In */usr/lib/sysctl.d/* the file *50-coredump.conf* has to be created which is
done automatically by

`make install`

Unfortunately - at least on Fedora systems - abrt has to be removed with

`yum remove abrtd*`

because it ruthlessly overwrites our change at every boot. The core dump handler can be activated then without reboot by running
because it ruthlessly overwrites our change at every boot. The core dump handler
can be activated then without reboot by running

`sysctl -p /usr/lib/sysctl.d/50-coredump.conf`

### Configuration of link:dlt_filetransfer.html[DLT Filetransfer] for usage with dlt-cdh
### Configuration of [DLT Filetransfer](dlt_filetransfer.md) for usage with dlt-cdh

Make sure the following is set in the "Filetransfer Manager" section of */etc/dlt-system.conf*:
Make sure the following is set in the "Filetransfer Manager" section of
*/etc/dlt-system.conf*:

```
...
Expand All @@ -65,26 +76,28 @@ FiletransferDirectory = /var/core

### Generation of core dump

When a crash happens the kernel invokes dlt-cdh and passes it the core dump as standard input. dlt-cdh does the following tasks:
When a crash happens the kernel invokes dlt-cdh and passes it the core dump as
standard input. dlt-cdh does the following tasks:

- check if enough disk space available
- create target directories if not existing:
- /var/core
- /var/core_tmp
- /tmp/.core_locks
- clean /var/core_tmp
- /var/core\_tmp
- /tmp/.core\_locks
- clean /var/core\_tmp
- retrieve context data mainly from /proc fs of the crashed process to a temporary context file in text format
- initialise core dump
- read ELF headers and notes to temporary core dump output file
- move context file and core dump to /var/core
- create id which identifies the crash

After the files have been moved to /var/core the [File Transfer](dlt_filetransfer.md) mechanism ensures that they are sent to connected clients.
After the files have been moved to /var/core the [DLT Filetransfer](dlt_filetransfer.md)
mechanism ensures that they are sent to connected clients.

## AUTHOR

Lutz Helwing <Lutz_Helwing (at) mentor (dot) com>

## COPYRIGHT

Copyright (C) 2011 - 2015 BMW AG. License MPL-2.0: Mozilla Public License version 2.0 <http://mozilla.org/MPL/2.0/>.
Copyright (C) 2011 - 2015 BMW AG. License MPL-2.0: Mozilla Public License version 2.0 <http://mozilla.org/MPL/2.0/>.
22 changes: 15 additions & 7 deletions doc/dlt_extended_network_trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,31 @@ Back to [README.md](../README.md)

## Introduction

The extended network trace allows the user to send or truncate network trace messages that are larger than the normal maximum size of a DLT message.
The extended network trace allows the user to send or truncate network trace
messages that are larger than the normal maximum size of a DLT message.

## Protocol

When truncation of messages is allowed, the truncated messages will be wrapped into a special message which indicates that a network trace message was truncated and what was the original size of the message.
When truncation of messages is allowed, the truncated messages will be wrapped
into a special message which indicates that a network trace message was
truncated and what was the original size of the message.

Segmented messages are sent in multiple packages. The package stream is prepended with a a start message indicating which contain a unique handle for this stream, size of data to follow, count of segments to follow and segment size.
Segmented messages are sent in multiple packages. The package stream is
prepended with a start message indicating which contains a unique handle for
this stream, size of data to follow, count of segments to follow and segment
size.

Each segment contains the stream handle, segment sequence number, the data and data length.
Each segment contains the stream handle, segment sequence number, the data and
data length.

Finally after sending all the data segments, one more packet is sent to indicate the end of the stream.
Finally after sending all the data segments, one more packet is sent to indicate
the end of the stream.

## Truncated package

Truncated message can be sent using the following function:

` int dlt_user_trace_network_truncated(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload, int allow_truncate) `
` int dlt_user_trace_network_truncated(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload, int allow_truncate) `

This will send a packet in the following format:

Expand Down Expand Up @@ -88,4 +96,4 @@ Lassi Marttala <Lassi.LM.Marttala (at) partner (dot) bmw (dot) de>

## COPYRIGHT

Copyright (C) 2011 - 2015 BMW AG. License MPL-2.0: Mozilla Public License version 2.0 <http://mozilla.org/MPL/2.0/>.
Copyright (C) 2011 - 2015 BMW AG. License MPL-2.0: Mozilla Public License version 2.0 <http://mozilla.org/MPL/2.0/>.
84 changes: 52 additions & 32 deletions doc/dlt_filetransfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,27 @@ Back to [README.md](../README.md)

## Overview

DLT is a reusable open source software component for standardized logging and tracing in infotainment ECUs based on the AUTOSAR 4.0 standard.
DLT is a reusable open source software component for standardized logging and
tracing in infotainment ECUs based on the AUTOSAR 4.0 standard.

The goal of DLT is the consolidation of the existing variety of logging and tracing protocols on one format.
The goal of DLT is the consolidation of the existing variety of logging and
tracing protocols on one format.

## Introduction to DLT Filetransfer

With DLT Filetransfer it is possible store the binary data of a file to the automotive dlt log.
With DLT Filetransfer it is possible store the binary data of a file to the
automotive dlt log.

The file will be read in binary mode and put as several chunks to a DLT_INFO log. With a special plugin of the dlt viewer, you can extract the embedded files from the trace and save them.
The file will be read in binary mode and put as several chunks to a DLT\_INFO
log. With a special plugin of the dlt viewer, you can extract the embedded files
from the trace and save them.

It can be used for smaller files, e.g. HMI screenshots or little coredumps.

## Protocol

The file transfer is at least one single transaction. This transaction consist of three main types of packages:
The file transfer is at least one single transaction. This transaction consist
of three main types of packages:

- header package
- one or more data packages
Expand All @@ -45,7 +51,8 @@ FLST | Package flag

## Data Package

After the header package was sent, at least one or more data packages can be send using:
After the header package was sent, at least one or more data packages can be
sent using:

` int dlt_user_log_file_data(DltContext *fileContext,const char *filename,int packageToTransfer, int timeout) `

Expand All @@ -61,7 +68,8 @@ FLDA | Package flag

## End Package

After all data packages were sent, the end package must be sent to indicate that the filetransfer is over using:
After all data packages were sent, the end package must be sent to indicate that
the filetransfer is over using:

` int dlt_user_log_file_end(DltContext *fileContext,const char *filename,int deleteFlag) `

Expand All @@ -75,7 +83,8 @@ FLFI | Package flag

## File information

The library offers the user the possibility to log informations about a file using the following method without transferring the file itself using:
The library offers the user the possibility to log informations about a file
using the following method without transferring the file itself using:

` dlt_user_log_file_infoAbout(DltContext *fileContext, const char *filename) `

Expand Down Expand Up @@ -116,7 +125,7 @@ FLIF | Package flag
#define ERROR_PACKAGE_COUNT -800
```
If an error happens during file transfer, the library will execute the mehtod:
If an error happens during file transfer, the library will execute the method:
` void dlt_user_log_file_errorMessage(DltContext *fileContext, const char *filename, int errorCode) `
Expand All @@ -134,7 +143,8 @@ file creation date | Creation date of the file
number of packages | Counted packages which will be transferred in the data packages
FLER | Package flag
If the file doesn't exist, the conent of the error package is a little bit different:
If the file doesn't exist, the content of the error package is a little bit
different:
Value | Description
:--- | :---
Expand All @@ -155,7 +165,7 @@ There are two ways to use the filetransfer
Call
- dlt_user_log_file_complete
- dlt\_user\_log\_file\_complete
The method needs the following arguments:
Expand All @@ -164,33 +174,39 @@ The method needs the following arguments:
- deleteFlag -> Flag if the file will be deleted after transfer. 1->delete, 0->notDelete
- timeout -> Deprecated.
The order of the packages is to send at first the header, then one or more data packages (depends on the filesize) and in the end the end package.
The advantage of this method is, that you must not handle the package ordering by your own.
The order of the packages is to send at first the header, then one or more data
packages (depends on the filesize) and in the end the end package. The advantage
of this method is, that you must not handle the package ordering by your own.
Within dlt_user_log_file_complete the free space of the user buffer will be checked. If the free space of the user buffer < 50% then the
actual package won't be transferred and a timeout will be executed.
Within dlt\_user\_log\_file\_complete the free space of the user buffer will be
checked. If the free space of the user buffer < 50% then the actual package
won't be transferred and a timeout will be executed.
If the daemon crashes and the user buffer is full -> the automatic method is in an endless loop.
If the daemon crashes and the user buffer is full, the automatic method is in an
endless loop.
### Manual
Manual starting filetransfer with the following commands:
- dlt_user_log_file_head | Transfers only the header of the file
- dlt_user_log_file_data | Transfers only one single package of a file
- dlt_user_log_file_end | Tranfers only the end of the file
- dlt\_user\_log\_file\_head | Transfers only the header of the file
- dlt\_user\_log\_file\_data | Transfers only one single package of a file
- dlt\_user\_log\_file\_end | Tranfers only the end of the file
This ordering is very important, so that you can save the transferred files to hard disk on client side with a dlt viewer plugin.
The advantage of using several steps to transfer files by your own is, that you are very flexible to integrate the filetransfer
in your code.
This ordering is very important, so that you can save the transferred files to
hard disk on client side with a dlt viewer plugin. The advantage of using
several steps to transfer files by your own is, that you are very flexible to
integrate the filetransfer in your code.
An other difference to the automatic method is, that only a timeout will be done. There is no check of the user buffer.
An other difference to the automatic method is, that only a timeout will be
done. There is no check of the user buffer.
## Important for integration
You should care about blocking the main program when you intergrate filetransfer in your code.
Maybe it's useful to extract the filetransfer in an extra thread.
Another point is the filesize. The bigger the file is, the longer takes it to log the file to dlt.
You should care about blocking the main program when you intergrate filetransfer
in your code. Maybe it's useful to extract the filetransfer in an extra thread.
Another point is the filesize. The bigger the file is, the longer takes it to
log the file to dlt.
## Example dlt filetransfer
Expand All @@ -212,17 +228,21 @@ Options:

## Testing dlt filetransfer

When you call "sudo make install", some automatic tests will be installed. Start the test using the following command from bash:
When you call "sudo make install", some automatic tests will be installed. Start
the test using the following command from bash:

` dlt-test-filetransfer `

It's important that the dlt-filetransfer example files are installed in /usr/share/dlt-filetransfer which will be done automatically by using "sudo make install".
It's important that the dlt-filetransfer example files are installed in
/usr/share/dlt-filetransfer which will be done automatically by using
"sudo make install". If not, use -t and -i options to specify the path to a text
file and an image file.
- testFile1Run1: Test the file transfer with the condition that the transferred file is smaller as the file transfer buffer using dlt_user_log_file_complete.
- testFile1Run1: Test the file transfer with the condition that the transferred file is smaller as the file transfer buffer using dlt\_user\_log\_file\_complete.
- testFile1Run2: Test the file transfer with the condition that the transferred file is smaller as the file transfer buffer using single package transfer
- testFile2Run1: Test the file transfer with the condition that the transferred file is bigger as the file transfer buffer using dlt_user_log_file_complete.
- testFile2Run1: Test the file transfer with the condition that the transferred file is bigger as the file transfer buffer using dlt\_user\_log\_file\_complete.
- testFile2Run2: Test the file transfer with the condition that the transferred file is bigger as the file transfer buffer using single package transfer
- testFile3Run1: Test the file transfer with the condition that the transferred file does not exist using dlt_user_log_file_complete.
- testFile3Run1: Test the file transfer with the condition that the transferred file does not exist using dlt\_user\_log\_file\_complete.
- testFile3Run2: Test the file transfer with the condition that the transferred file does not exist using single package transfer
- testFile3Run3: Test which logs some information about the file.
Expand All @@ -232,4 +252,4 @@ Christian Muck <Christian (dot) Muck (at) bmw (dot) de>
## COPYRIGHT
Copyright (C) 2012 - 2015 BMW AG. License MPL-2.0: Mozilla Public License version 2.0 <http://mozilla.org/MPL/2.0/>.
Copyright (C) 2012 - 2015 BMW AG. License MPL-2.0: Mozilla Public License version 2.0 <http://mozilla.org/MPL/2.0/>.
Loading

0 comments on commit d073bf3

Please sign in to comment.