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

drivers/note: move the note formatting code from trace_dump into noteram_drivers.c #10124

Merged
merged 7 commits into from
Aug 11, 2023

Conversation

Gary-Hobson
Copy link
Contributor

Summary

This PR moves the note formatting code from trace_dump into noteram and simplifies the noteram code.

Details:
Change 1: move trace_dump to noteram_driver.c
Change 2: replace the spaces in the name in tcb, there cannot be spaces in the thread name in atrace format
Change 3: remove task_context and get_taskname related code, we don't need it anymore
Change 4: simplify the logic of ringbuffer in noteram

Impact

The data returned by reading the /dev/note device is no longer binary data, but a formatted string, and it will only return one note record each time it is read

Testing

self-test + internal CI

@Gary-Hobson Gary-Hobson changed the title Noteram drivers/note: moves the note formatting code from trace_dump into noteram_drivers.c Aug 9, 2023
@Gary-Hobson Gary-Hobson changed the title drivers/note: moves the note formatting code from trace_dump into noteram_drivers.c drivers/note: move the note formatting code from trace_dump into noteram_drivers.c Aug 9, 2023
@acassis
Copy link
Contributor

acassis commented Aug 10, 2023

Please fix this error in the nuttx-apps:

====================================================================================
Configuration/Tool: esp32-devkitc/watcher
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Building NuttX...
In file included from wdt.c:38:
Error: task_mn.h:74:35: error: 'struct noteram_get_taskname_s' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
   74 | void task_mn_get_task_name(struct noteram_get_taskname_s *task);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [/github/workspace/sources/apps/Application.mk:171: wdt.c.github.workspace.sources.apps.examples.watcher.o] Error 1
In file included from task_mn.c:37:
Error: task_mn.h:74:35: error: 'struct noteram_get_taskname_s' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
   74 | void task_mn_get_task_name(struct noteram_get_taskname_s *task);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
task_mn.c: In function 'task_mn_print_tasks_status':
Error: task_mn.c:65:33: error: storage size of 'task' isn't known
   65 |   struct noteram_get_taskname_s task;
      |                                 ^~~~
Error: task_mn.c:86:25: error: 'NOTERAM_GETTASKNAME' undeclared (first use in this function); did you mean 'NOTERAM_GETMODE'?
   86 |           ioctl(notefd, NOTERAM_GETTASKNAME, (unsigned long)&task);
      |                         ^~~~~~~~~~~~~~~~~~~
      |                         NOTERAM_GETMODE
task_mn.c:86:25: note: each undeclared identifier is reported only once for each function it appears in
Error: task_mn.c:65:33: error: unused variable 'task' [-Werror=unused-variable]
   65 |   struct noteram_get_taskname_s task;
      |                                 ^~~~
task_mn.c: At top level:
Error: task_mn.c:244:35: error: 'struct noteram_get_taskname_s' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
  244 | void task_mn_get_task_name(struct noteram_get_taskname_s *task)
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
Error: task_mn.c:244:6: error: conflicting types for 'task_mn_get_task_name'; have 'void(struct noteram_get_taskname_s *)'
  244 | void task_mn_get_task_name(struct noteram_get_taskname_s *task)
      |      ^~~~~~~~~~~~~~~~~~~~~
task_mn.h:74:6: note: previous declaration of 'task_mn_get_task_name' with type 'void(struct noteram_get_taskname_s *)'
   74 | void task_mn_get_task_name(struct noteram_get_taskname_s *task);
      |      ^~~~~~~~~~~~~~~~~~~~~
task_mn.c: In function 'task_mn_get_task_name':
Error: task_mn.c:255:17: error: 'NOTERAM_GETTASKNAME' undeclared (first use in this function); did you mean 'NOTERAM_GETMODE'?
  255 |   ioctl(notefd, NOTERAM_GETTASKNAME, (unsigned long)task);
      |                 ^~~~~~~~~~~~~~~~~~~
      |                 NOTERAM_GETMODE
task_mn.c: In function 'task_mn_subscribe':
Error: task_mn.c:261:33: error: storage size of 'task' isn't known
  261 |   struct noteram_get_taskname_s task;
      |                                 ^~~~
Error: task_mn.c:261:33: error: unused variable 'task' [-Werror=unused-variable]
task_mn.c: In function 'task_mn_unsubscribe':
Error: task_mn.c:281:33: error: storage size of 'task' isn't known
  281 |   struct noteram_get_taskname_s task;
      |                                 ^~~~
Error: task_mn.c:281:33: error: unused variable 'task' [-Werror=unused-variable]
cc1: all warnings being treated as errors
make[3]: *** [/github/workspace/sources/apps/Application.mk:171: task_mn.c.github.workspace.sources.apps.examples.watcher.o] Error 1
In file included from watcher_main.c:34:
Error: task_mn.h:74:35: error: 'struct noteram_get_taskname_s' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
   74 | void task_mn_get_task_name(struct noteram_get_taskname_s *task);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [/github/workspace/sources/apps/Application.mk:231: watcher_main.c.github.workspace.sources.apps.examples.watcher.o] Error 1
make[3]: Target 'all' not remade because of errors.
make[2]: *** [Makefile:53: /github/workspace/sources/apps/examples/watcher_all] Error 2
make[2]: Target '/github/workspace/sources/apps/libapps.a' not remade because of errors.
make[1]: *** [Makefile:47: all] Error 2
make: *** [tools/LibTargets.mk:232: /github/workspace/sources/apps/libapps.a] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 370: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  Normalize esp32-devkitc/watcher

syscall cannot be called in syscall, if this happens, it should be fixed (interruption is similar)

Signed-off-by: yinshengkai <[email protected]>
Signed-off-by: yinshengkai <[email protected]>
@Gary-Hobson
Copy link
Contributor Author

Please fix this error in the nuttx-apps:

I've already fixed the error in the nuttx-apps:apache/nuttx-apps#1942

@xiaoxiang781216 xiaoxiang781216 merged commit 67cb1d1 into apache:master Aug 11, 2023
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants