File tree Expand file tree Collapse file tree 6 files changed +39
-272
lines changed Expand file tree Collapse file tree 6 files changed +39
-272
lines changed Original file line number Diff line number Diff line change @@ -197,16 +197,45 @@ size_t Print::println(const Printable &x)
197197}
198198
199199extern " C" {
200+ #if defined (__LOG_TRACE_IO_)
201+ /* *
202+ * By writing OpenAMP trace (log) buffer here, the Linux host can access
203+ * to the content by the following command:
204+ * $ cat /sys/kernel/debug/remoteproc/remoteproc0/trace0
205+ * Ceveats - When the buffer overflows (2kb), the buffer is cleaned by
206+ * a null character. 2kb will be enough for core_debug() logging.
207+ */
208+ #include " virtio_config.h"
209+
210+ char system_log_buf[SYSTEM_TRACE_BUF_SZ];
211+
212+ void log_buff (uint8_t *data, uint32_t size)
213+ {
214+ static int offset = 0 ;
215+
216+ for (uint32_t i = 0 ; i < size; i++) {
217+ system_log_buf[offset++] = *(data + i);
218+ if ((offset + 1 ) >= SYSTEM_TRACE_BUF_SZ) {
219+ offset = 0 ;
220+ }
221+ }
222+ system_log_buf[offset] = ' \0 ' ;
223+ }
224+ #endif
225+
200226 __attribute__ ((weak))
201227 int _write(int file, char *ptr, int len)
202228 {
203229 switch (file) {
204230 case STDOUT_FILENO:
205231 case STDERR_FILENO:
206- #if defined(HAL_UART_MODULE_ENABLED) && !defined(HAL_UART_MODULE_ONLY)
207232 /* Used for core_debug() */
233+ #if defined (__LOG_TRACE_IO_)
234+ log_buff ((uint8_t *)ptr, (uint32_t )len);
235+ #elif defined(HAL_UART_MODULE_ENABLED) && !defined(HAL_UART_MODULE_ONLY)
208236 uart_debug_write ((uint8_t *)ptr, (uint32_t )len);
209237#endif
238+ break ;
210239 case STDIN_FILENO:
211240 break ;
212241 default :
Original file line number Diff line number Diff line change 2727#if defined (VIRTIOCON)
2828#include " Stream.h"
2929#include " openamp.h"
30- #include " openamp_log.h"
3130#include " wiring.h"
3231#include " virtio_buffer.h"
3332
Original file line number Diff line number Diff line change @@ -30,10 +30,6 @@ extern "C" {
3030#endif
3131
3232/* Includes ------------------------------------------------------------------*/
33- #if defined (__LOG_TRACE_IO_ ) || defined(__LOG_UART_IO_ )
34- #include "openamp_log.h"
35- #endif
36-
3733/* ########################## Mailbox Interface Selection ############################## */
3834/**
3935 * @brief This is the list of Mailbox interface to be used in the OpenAMP MW
@@ -138,29 +134,6 @@ extern int __OPENAMP_region_end__[]; /* defined by linker script */
138134#define VRING0_ID 0 /* VRING0 ID (master to remote) fixed to 0 for linux compatibility*/
139135#define VRING1_ID 1 /* VRING1 ID (remote to master) fixed to 1 for linux compatibility */
140136
141- /**
142- * @}
143- */
144-
145- /** @defgroup OPENAMP_CONF_Exported_Macros OPENAMP_CONF_Exported_Macros
146- * @brief Aliases.
147- * @{
148- */
149-
150- /* DEBUG macros */
151-
152- #if defined (__LOG_TRACE_IO_ ) || defined(__LOG_UART_IO_ )
153- #define OPENAMP_log_dbg log_dbg
154- #define OPENAMP_log_info log_info
155- #define OPENAMP_log_warn log_warn
156- #define OPENAMP_log_err log_err
157- #else
158- #define OPENAMP_log_dbg (...)
159- #define OPENAMP_log_info (...)
160- #define OPENAMP_log_warn (...)
161- #define OPENAMP_log_err (...)
162- #endif
163-
164137/**
165138 * @}
166139 */
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11#ifndef __VIRTIO_CONFIG_H
22#define __VIRTIO_CONFIG_H
33
4+ // Size of buffer of each vring buffers
45#ifdef RPMSG_BUFFER_SIZE
5- #error "RPMSG_BUFFER_SIZE is already defined"
6+ #error "RPMSG_BUFFER_SIZE should be aligned with the kernel definition."
7+ #error "Reference: https://elixir.bootlin.com/linux/v5.5.2/source/drivers/rpmsg/virtio_rpmsg_bus.c#L137"
68#else
79#define RPMSG_BUFFER_SIZE (512)
810#endif
911
1012// Size of the vqueue message in the buffer
1113#define RPMSG_VRING_HEADER_SIZE 16
1214
15+ #if defined (__LOG_TRACE_IO_ )
16+ // OpenAMP trace (log) buffer configuration. See rsc_table.c and Print.cpp
17+ #define SYSTEM_TRACE_BUF_SZ 2048
18+ extern char system_log_buf [SYSTEM_TRACE_BUF_SZ ]; /*!< buffer for debug traces */
19+ #endif
20+
1321#endif // __VIRTIO_CONFIG_H
You can’t perform that action at this time.
0 commit comments