strcmp

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
fastlink30
Posts: 42
Joined: Tue Aug 12, 2014 1:25 pm

strcmp

Post by fastlink30 »

i'm new on chibios (2.6.5) and chibistudio (preview 6) on STM32F4 discovery board

Code: Select all

void cmd_oven(BaseSequentialStream *chp, int argc, char *argv[]) {
  int value = 0;
  COMANDI_ERROR err = NEED_PARAMETERS;

  (void)argv;

  if (argc > 0) {
    if (strcmp(argv[0], "?") == 0) { <-------
......


when i debug, and debugger arrive to strcmp line, argc value become 0 and argv is resetted (before arrive to strcmp argc=1 and argv point to string).
i must include something in makefile to use this function or there are bug with this function? is problem with heap?
the #include <stdio.h>/<string.h>/<stdlib.h> at the top of the main there are.

thanks
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: strcmp

Post by Giovanni »

Hi,

Probably you are debugging with optimizations enabled, try compiling using -O0. Optimizations make variables disappear when no more needed and generally make the debug experience messy.

Giovanni
fastlink30
Posts: 42
Joined: Tue Aug 12, 2014 1:25 pm

Re: strcmp

Post by fastlink30 »

yes, i have disabled optimization and now is going well.

thanks! ciao
Post Reply