noteram_driver.c:noteram_dump_printf function replaced with lib_bsprintf.
open CONFIG_DRIVERS_NOTE_STRIP_FORMAT:
OUT:
NuttShell (NSH) NuttX-12.3.0
nsh> hello
nsh> trace dump
loop_task-1 [0] 0.001728177: sched_wakeup_new: comm=loop_task pid=1 target_cpu=0
Idle_Task-0 [0] 0.001745633: sched_wakeup_new: comm=Idle_Task pid=0 target_cpu=0
hpwork-2 [0] 0.001791495: sched_wakeup_new: comm=hpwork pid=2 target_cpu=0
nsh_main-3 [0] 0.001814164: sched_wakeup_new: comm=nsh_main pid=3 target_cpu=0
hello-4 [0] 2.583795447: sched_wakeup_new: comm=hello pid=4 target_cpu=0
hello-4 [0] 2.583843399: tracing_mark_write:
###### start long args test!!!
hello-4 [0] 2.583844088: tracing_mark_write: 0x48ebe0 97 19299 22155 4294967217 4294957304 4294945141 92.999900 9299.929993 92999299929992 18446743074409621624 61 254 429495799 hello-4 [0] 2.583845991: tracing_mark_write: 0x48ec20 qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvb>�/�L�p�J hello-4 [0] 2.583847105: tracing_mark_write:
###### start long args test!!!
trace-5 [0] 2.928625413: sched_wakeup_new: comm=trace pid=5 target_cpu=0
nsh>
close CONFIG_DRIVERS_NOTE_STRIP_FORMAT:
NuttShell (NSH) NuttX-12.3.0
nsh> hello
nsh> trace dump
loop_task-1 [0] 0.001607506: sched_wakeup_new: comm=loop_task pid=1 target_cpu=0
Idle_Task-0 [0] 0.001624549: sched_wakeup_new: comm=Idle_Task pid=0 target_cpu=0
hpwork-2 [0] 0.001666256: sched_wakeup_new: comm=hpwork pid=2 target_cpu=0
nsh_main-3 [0] 0.001688556: sched_wakeup_new: comm=nsh_main pid=3 target_cpu=0
hello-4 [0] 3.812630763: sched_wakeup_new: comm=hello pid=4 target_cpu=0
hello-4 [0] 0.370899272: tracing_mark_write:
###### start NOTE_STRIP_FORMAT test!!!
hello-4 [0] 0.370900260: tracing_mark_write: uint8_t[97]:[97]
hello-4 [0] 0.370900735: tracing_mark_write: uint16_t[19299]:[19299]
hello-4 [0] 0.370901155: tracing_mark_write: uint32_t[22155]:[22155]
hello-4 [0] 0.370901715: tracing_mark_write: float[92.9999]:[92.999900]
hello-4 [0] 0.370902196: tracing_mark_write: double[9299.929992999299]:[9299.929993]
hello-4 [0] 0.370902978: tracing_mark_write: char[][qweretyuiopasdfghjklzxcvbnm]:[qweretyuiopasdfghjklzxcvbnm]
hello-4 [0] 0.370904061: tracing_mark_write: uint64_t[92999299929992]:[92999299929992]
hello-4 [0] 0.370904554: tracing_mark_write: unsigned char[254]:[254]
hello-4 [0] 0.370904999: tracing_mark_write: unsigned short int[9299]:[9299]
hello-4 [0] 0.370905435: tracing_mark_write: unsigned int[9299992]:[9299992]
hello-4 [0] 0.370905876: tracing_mark_write: unsigned long[929992992]:[929992992]
hello-4 [0] 0.370906402: tracing_mark_write: unsigned long long[9299929924]:[9299929924]
hello-4 [0] 0.370906822: tracing_mark_write:
###### end test!!!
hello-4 [0] 0.370908999: tracing_mark_write:
###### start long args test!!!
hello-4 [0] 0.370909770: tracing_mark_write: 97 19299 22155 97 19299 22155 92.999900 9299.929993 92999299929992 92999299929992 254 254 9299 9299
hello-4 [0] 0.370927340: tracing_mark_write: qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweret>��+�c� hello-4 [0] 0.370928037: tracing_mark_write:
###### start long args test!!!
trace-5 [0] 4.173395106: sched_wakeup_new: comm=trace pid=5 target_cpu=0
nsh>
test SRC:
\#include <nuttx/config.h>
\#include <nuttx/streams.h>
\#include <stdio.h>
\#include <syslog.h>
\#define TOSTR(str) #str
\#define TONNAME(name) TOSTR(name)
\#define v_uint8_t 97
\#define v_uint16_t 19299
\#define v_uint32_t 22155
\#define v_int8_t -79
\#define v_int16_t -9992
\#define v_int32_t -22155
\#define v_float 92.9999
\#define v_double 9299.929992999299
\#define v_char_arr qweretyuiopasdfghjklzxcvbnm
\#define v_uint64_t 92999299929992
\#define v_int64_t -999299929992
\#define v_char 61
\#define v_u_char 254
\#define v_s_int -9299
\#define v_u_s_int 9299
\#define v_int -9299991
\#define v_u_int 9299992
\#define v_long -929992991
\#define v_u_long 929992992
\#define v_l_l -929992993
\#define v_u_l_l 9299929924
\#define v_size_t 29299
\#define v_l_double -9299.9299929912122464755474
int main(int argc, FAR char *argv[])
{
\#ifdef CONFIG_DRIVERS_NOTE_STRIP_FORMAT
sched_note_printf(0, "\n ###### start long args test!!! \n");
sched_note_printf(0, "%u %u %u %d %d %d %f %f %lu %ld %d %u %d %u",
v_uint8_t, v_uint16_t, v_uint32_t, v_int8_t, v_int16_t,
v_int32_t, v_float, v_double, v_uint64_t, v_int64_t,
v_char, v_u_char, v_s_int, v_u_s_int);
sched_note_printf(0, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s",
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr));
sched_note_printf(0, "\n ###### start long args test!!! \n");
\#else
sched_note_printf(0, "\n ###### start NOTE_STRIP_FORMAT test!!! \n");
sched_note_printf(0, " uint8_t["TONNAME(v_uint8_t)"]:[%u]", v_uint8_t);
sched_note_printf(0, " uint16_t["TONNAME(v_uint16_t)"]:[%u]", v_uint16_t);
sched_note_printf(0, " uint32_t["TONNAME(v_uint32_t)"]:[%u]", v_uint32_t);
sched_note_printf(0, " float["TONNAME(v_float)"]:[%f]", v_float);
sched_note_printf(0, " double["TONNAME(v_double)"]:[%f]", v_double);
sched_note_printf(0, " char[]["TONNAME(v_char_arr)"]:[%.32s]", TONNAME(v_char_arr));
sched_note_printf(0, " uint64_t["TONNAME(v_uint64_t)"]:[%lu]", v_uint64_t);
sched_note_printf(0, " unsigned char["TONNAME(v_u_char)"]:[%u]", v_u_char);
sched_note_printf(0, "unsigned short int["TONNAME(v_u_s_int)"]:[%u]", v_u_s_int);
sched_note_printf(0, " unsigned int["TONNAME(v_u_int)"]:[%u]", v_u_int);
sched_note_printf(0, " unsigned long["TONNAME(v_u_long)"]:[%lu]", (unsigned long)v_u_long);
sched_note_printf(0, "unsigned long long["TONNAME(v_u_l_l)"]:[%llu]", (unsigned long long)v_u_l_l);
sched_note_printf(0, "\n ###### end test!!! \n");
sched_note_printf(0, "\n ###### start long args test!!! \n");
sched_note_printf(0, "%u %u %u %d %d %d %f %f %lu %ld %d %u %d %u",
v_uint8_t, v_uint16_t, v_uint32_t, v_uint8_t, v_uint16_t,
v_uint32_t, v_float, v_double, v_uint64_t, v_uint64_t,
v_u_char, v_u_char, v_u_s_int, v_u_s_int);
sched_note_printf(0, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s",
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr),
TONNAME(v_char_arr), TONNAME(v_char_arr));
sched_note_printf(0, "\n ###### start long args test!!! \n");
\#endif // !CONFIG_DRIVERS_NOTE_STRIP_FORMAT
return 0;
}
drivers/note/noteram_driver.c
Signed-off-by: likun17 <likun17@xiaomi.com>