@@ -4,7 +4,7 @@ In the Web Browser, we can get Real-Time Logs from NuttX Devices (Web Serial API
4
4
5
5
What if we could Analyse the NuttX Logs in Real-Time? And show the results in the Web Browser?
6
6
7
- Like for [ Stack Traces ] ( https://gist.github.com/lupyuen/a715e4e77c011d610d0b418e97f8bf5d#file-nuttx-tcc-app-log-L168-L224 ) , [ ELF Loader Log] ( https://gist.github.com/lupyuen/a715e4e77c011d610d0b418e97f8bf5d#file-nuttx-tcc-app-log-L1-L167 ) , [ Memory Manager Log] ( https://docs.google.com/spreadsheets/d/1g0-O2qdgjwNfSIxfayNzpUN8mmMyWFmRf2dMyQ9a8JI/edit#gid=0 ) (malloc / free)?
7
+ Like for [ Stack Dumps ] ( https://gist.github.com/lupyuen/a715e4e77c011d610d0b418e97f8bf5d#file-nuttx-tcc-app-log-L168-L224 ) , [ ELF Loader Log] ( https://gist.github.com/lupyuen/a715e4e77c011d610d0b418e97f8bf5d#file-nuttx-tcc-app-log-L1-L167 ) , [ Memory Manager Log] ( https://docs.google.com/spreadsheets/d/1g0-O2qdgjwNfSIxfayNzpUN8mmMyWFmRf2dMyQ9a8JI/edit#gid=0 ) (malloc / free)?
8
8
9
9
Let's do it with PureScript, since Functional Languages are better for Parsing Text.
10
10
@@ -174,6 +174,34 @@ main = render =<< withConsole do
174
174
printResults
175
175
```
176
176
177
+ # Parse NuttX Stack Dump with PureScript
178
+
179
+ Let' s parse the [NuttX Stack Dump](https://gist.github.com/lupyuen/a715e4e77c011d610d0b418e97f8bf5d#file-nuttx-tcc-app-log-L168-L224)...
180
+
181
+ ` ` ` text
182
+ [ 6.242000] riscv_exception: EXCEPTION: Instruction page fault. MCAUSE: 000000000000000c, EPC: 000000008000ad8a, MTVAL: 000000008000ad8a
183
+ [ 6.242000] riscv_exception: PANIC!!! Exception = 000000000000000c
184
+ [ 6.242000] _assert: Current Version: NuttX 12.4.0 f8b0b06b978 Jan 29 2024 01:16:20 risc-v
185
+ [ 6.242000] _assert: Assertion failed panic: at file: common/riscv_exception.c:85 task: /system/bin/init process: /system/bin/init 0xc000001a
186
+ [ 6.242000] up_dump_register: EPC: 000000008000ad8a
187
+ [ 6.242000] up_dump_register: A0: 0000000000000000 A1: 00000000c0202010 A2: 0000000000000001 A3: 00000000c0202010
188
+ [ 6.242000] up_dump_register: A4: 00000000c0000000 A5: 0000000000000000 A6: 0000000000000000 A7: 0000000000000000
189
+ [ 6.242000] up_dump_register: T0: 0000000000000000 T1: 0000000000000000 T2: 0000000000000000 T3: 0000000000000000
190
+ [ 6.242000] up_dump_register: T4: 0000000000000000 T5: 0000000000000000 T6: 0000000000000000
191
+ [ 6.242000] up_dump_register: S0: 0000000000000000 S1: 0000000000000000 S2: 0000000000000000 S3: 0000000000000000
192
+ [ 6.242000] up_dump_register: S4: 0000000000000000 S5: 0000000000000000 S6: 0000000000000000 S7: 0000000000000000
193
+ [ 6.242000] up_dump_register: S8: 0000000000000000 S9: 0000000000000000 S10: 0000000000000000 S11: 0000000000000000
194
+ [ 6.242000] up_dump_register: SP: 00000000c0202800 FP: 0000000000000000 TP: 0000000000000000 RA: 000000008000ad8a
195
+ [ 6.242000] dump_stack: User Stack:
196
+ [ 6.242000] dump_stack: base: 0xc0202040
197
+ [ 6.242000] dump_stack: size: 00003008
198
+ [ 6.242000] dump_stack: sp: 0xc0202800
199
+ [ 6.242000] stack_dump: 0xc02027e0: c0202010 00000000 00000001 00000000 00000000 00000000 8000ad8a 00000000
200
+ [ 6.242000] stack_dump: 0xc0202800: 00000000 00000000 0007e7f0 00000000 c0200208 00000000 c02001e8 00000000
201
+ ` ` `
202
+
203
+ TODO: Spot interesting addresses like 8000ad8a, c0202010
204
+
177
205
# Compile PureScript to JavaScript in Web Browser
178
206
179
207
Here' s how we compile PureScript to JavaScript inside our Web Browser...
0 commit comments