PacktPublishing / Hands-On-RTOS-with-Microcontrollers

Hands-On RTOS with Microcontrollers, published by Packt
MIT License
180 stars 89 forks source link

SystemView capture initial code (p. 164) #15

Open relayman357 opened 1 year ago

relayman357 commented 1 year ago

Hi Brian,

Really enjoying your book. The image on p. 164 shows the SystemView capture of the startup of the Chapter 7 code example. I can't figure out how to make SystemView capture that - I can only connect and capture AFTER things are running.

How do we set SystemView to catch startup code?

thank you! russ

brian-amos-embedded commented 1 year ago

Hi Russ,

It can be tricky to get System View to capture data during startup, try the following:

  1. Open both Ozone and System View
  2. In Ozone, connect to the target device and stop at main
  3. In System View, start recording
  4. In Ozone, start execution
relayman357 commented 1 year ago

Hi Brian,

Thank you. I followed your instructions but when I click the play button back in Ozone I get "The target stopped in HardFault exception state." No data gets recorded in SystemView but the "Recorder starting 1%" popup does go away.

If I follow your instructions except I skip 3., the program executes fine in Ozone.

There is some conflict that I can't identify when using both Ozone & SystemView together at startup. Per SEGGER and Jim's suggestion I added Project.SetRTT(0); to the .jdebug file but still no dice.

I appreciate your help, thanks.

russ

p.s. I can connect with SystemView fine if I cut the program loose to run first (play button instead of trying to step through in Ozone). But, that means I capture nothing at startup.

relayman357 commented 1 year ago

This seems to be where the crash happens (from Ozone)

image

relayman357 commented 1 year ago

Another symptom, not sure if related - I never see the Printf messages in the Ozone Terminal window. I just tested again with the Chapter 7 failed build and it fails (as expected), but no message to Terminal. I do see messages in the SystemView terminal window when it is running.

image

From my Chapter_7.jdebug file:

void OnProjectLoad (void) {
  //
  // Dialog-generated settings
  //
  Project.SetTraceSource ("SWO");
  Project.SetDevice ("STM32F767ZI");
  Project.SetHostIF ("USB", "");
  Project.SetTargetIF ("JTAG");
  Project.SetTIFSpeed ("50 MHz");
  Project.AddSvdFile ("C:\ST\STM32CubeIDE_1.12.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.productdb.debug_2.0.500.202302211408\resources\cmsis\STMicroelectronics_CMSIS_SVD\STM32F767.svd");
  Project.SetOSPlugin("FreeRTOSPlugin_CM7");

  Project.SetRTT(0);
  //
  // User settings
  //
  File.Open ("C:\projects\packBookRTOS\Chapter_7\FailedStartupBuild\Chapter_7_FailedStartupBuild.elf");
}