Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


gprof gnu profiling tools ?

Hi everyone,

Beeing designing an industrial project based upon stm32f407VGT MCU I am interested in creating a poor man’s profiling function counting the frequency of calls to selected functions.

But before re-inventing the wheel told myself  : ” maybe someone allready did that for stm32workbench ?”

Is there any way, using stm32workbench, to be profiling function calls on target ?

I found that on the web :

http://mcuoneclipse.com/2015/08/11/sneak-preview-profiling-bare-metal-microcontroller-applications-with-gnu-gprof/Question

Is there an allready integrated to stm32workbench method for profiling ?

Thank you all :-)

for what i now on grof it si untrusive profiling mean you must frist build with prodfiling option
then you run that code
while runing a “large file” with timing get created
That is what gprof then analyee
that is commonly not suported by mcu toolset soem maye by putign the info in ram on the target
I can’t say for gcc that is used with ac6 and bare metal arm embededd
Actulaay i’m curious to know if it is suported how to get it working

if you look for a single functionratehr fix timing then simply instrument the code
rename the original function create a wraper func than will record timer before and after call in a small cicurlar buffer
for instance
org_foo(.....)
{...}

uint32_t t8;
int n=0;
foo(...){
uint32_t t0,tf;
t0 = DWT->CYCCNT;
org_foo(....)
tf = DWT->CYCCNT;
tn=tf-t0;
n=(n+1)%8;
}

If you place cycle counter record in the function itself then you will not get cycles related to argument passing , function prolog /epilog , call and return cost.

Without instrumenting set a break point befor the call and check the DWT->CYCCNT; step over check again and diff
compare to instrumented code you may get some minor difference due to debuggerr .


Thank you diabolo38,

I will try your method, and share with everyone if I find another way to set profiling


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