Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


You are viewing a reply to gprof gnu profiling tools ?  

gprof gnu profiling tools ?

i have folowed the “mcu on eclipse” instruction and with a few minor change i get it to work

basicaly what i did and changed
get all proiling subfolder from github source
in gmon.c


change the symbol used to “bound” the code “text” section

if (!already_setup) {
    extern char _etext; /* end of text/code symbol, defined by linker */
    //MS the __etext is _etext on st ld file
    already_setup = 1;
    //MS 0x410 is not suitale for stm32f4 let use Reset_Handler that is just after isr table and low level init
    extern char Reset_Handler;
    monstartup((uint32_t)&Reset_Handler, (uint32_t)&_etext);
  }


in profile.c use a specific timer at 1KHz for prolining instead os systick (systick cant be cusotmized in cubemx project)
not ethat this timer get setup and started in main not best thing :-(

void TIM7_IRQHandler(void) {
  //void OSA_SysTick_Handler(void);
  static size_t pc, idx;

  //OSA_SysTick_Handler(); /* call normal Kinetis SDK SysTick handler */
  if (prof.state==PROFILE_ON) {
    pc = ((uint32_t*)(__builtin_frame_address(0)))[14]; /* get SP and use it to get the return address from stack */
    if (pc >= prof.lowpc && pc < prof.highpc) {
      idx = PROFIDX (pc, prof.lowpc, prof.scale);
      prof.counter[idx]++;
    }
  }
  //MS re-arm the specific profiler timer
  __HAL_TIM_CLEAR_IT(&htim7, TIM_IT_UPDATE);
}


customize the system_stm32f4xx.c to init the profiling
best option would be to add “prof init” as part of the “lib init array” so that no files changes would be required

void SystemInit(void)
{
	void _monInit(void);
	_monInit();
// ...


bad point is that semithosting “relative path” wan’t let create a file in the project
So rigth now i had to force “gmon.out” to obsolute path where write is ok but’s that very user specific :-(

void _mcleanup(void) {
	static const char gmon_out[] = "c:\\tmp\\gmon.out";


you can folow http://www.openstm32.org/forumthread164Question to get semihosting working and news on the file path