Workbench debug build + SerialLogHandler not showing all logs while monitoring


#1

Hi,

I’m attempting to debug some COAP calls made from the device-os on a P1. After a bit of digging I discovered that by doing the following I should be able to see the deviceOS logging:

  1. Set up Workbench targeting deviceOS@1.4.0 for P1
  2. Particle: Compile application for debug (local)
  3. Put P1 in DFU-mode
  4. run particle flash my-app.bin --usb
  5. Reset device
  6. Watch output with particle serial monitor

I’m starting my test with the most basic firmware before I try my own

SerialLogHandler handler(LOG_LEVEL_ALL);

void setup() {
}

void loop() {
}

When I watch the output from the logger, I only see messages coming through about the data going through hal. If I manually log things in my program, those will work though.

This isn’t the actual message – it’s similar to this though. I’m not by my hardware right now

[hal] TRACE: sent bytes 2 
[hal] TRACE: received bytes 16 

These logs fire any time data is sent/received by the device but I’m not seeing anything else.


I have a few questions

  1. What am I doing wrong? Why aren’t all the logs showing up?
  2. Is there any way to build the system parts in as a debug build through Workbench? My main application hasn’t been ported from ParticleDev

Cheers!


#2

It looks like you need to flash the system parts of the DeviceOS. You compiled in debug, which is the correct step to take, but then you only flashed the empty application.

Once you flash system-part1.bin and system-part2.bin, then you will see all the logs from the device.


#3

i’m curious if you see different results doing the following:

  1. clean all the things: run the Particle: Clean application for debug (local) and just to extra-sure Particle: Clean application & DeviceOS (local) tasks
  2. flash using the local compiler: run the Particle: Flash application for debug (local) task
  3. fire up the serial monitor: run the Paricle: Serial Monitor command

to run a task, click “Terminal > Run Task…” from VSCode’s main menu, then select the task

to run a command, press cmd+shift+p (ctrl+shift+p on windows & linux), then type the command name in to filter and click an item to run it.

also, in case you haven’t seen them already Workbench docs are here: https://docs.particle.io/workbench/

edit: what @zfields said re: flashing system parts - the above mentioned task will do that for you :+1:


#4

I was under the impression that Particle: Compile application for debug (local) would make a monolithic build?

When I ran particle serial inspect it only shows a single bootloader module which I am assuming is the monolithic build.


#5

Thanks, I’ll try this when I get home. I did try cleaning the debug application but I’ll try everything.

I’ve read through the documentation (the tutorial seems to have the most info) but it’s not very clear on what each type of build means.

What exactly do these two do and where are the generated artifacts?

  • Particle: Compile application for debug (local)
  • Particle: Compile application & Device OS (local)

For the “Compile application for debug (local)” I was under the impression that it makes a single binary that includes bootloader + system parts + app.


#6

Yup, that’s right. I was too excited to answer. :smiley:

Let me try and reproduce this, and I’ll offer a more thoughtful answer. :+1:


#7

I got a bit further here and actually got the deviceOS logs to start working for my P1.

Calls to DEBUG are being logged over serial in the monolith version.

I started looking through the system firmware and see that two years ago there was a commit to start removing some of the logging code to make the build size for Photon/P1 smaller.

So a couple of questions here

  1. Is particle planning on migrating the DEBUG calls to the new logging framework? I think we get the same level of optimizations that way
  2. Is there any way to override the LOG_COMPILE_TIME_LEVEL without hacking the build script?