Ignored values in chconf.h Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Ondrej
Posts: 3
Joined: Mon Nov 13, 2017 9:10 am

Ignored values in chconf.h

Postby Ondrej » Mon Nov 13, 2017 10:15 am

Hi,
I am using chibios 17.6.0 and GCC 6.3.
I imported demo project for STM32F4-discovery (C:\ChibiStudio\chibios176\demos\STM32\RT-STM32F407-DISCOVERY). When I expand macro chThdSleepMilliseconds in main.c, it shows that constant CH_CFG_ST_FREQUENCY has the value of 1000. But actual value of CH_CFG_ST_FREQUENCY defined in chconf.h is 10000. The value 1000 is taken from file /os/rt/templates/chconf.h

When I change the value in chconf.h and click Build (the hammer icon) it rebuilds all source files. When I change the value in /os/rt/templates/chconf.h it rebuilds nothing. It looks like the compiler uses the right file (the one that is located in project directory).

I tried to verify it in debugger. I was using STM32F4-DISCOVERY board. I changed the CH_CFG_ST_FREQUENCY value to 100000. In main.c I defined the global variable systime_t tim; Right after chSysInit(); i tried to evaluate tim = US2ST(100); After stepping over this line, the variable tim has the value of 0. It should have the value of ((100 * 100000) + 999999) / 1000000 = 10,999999 = 10
Expanding macro US2ST in debugger still shows value of 1000 for the constant CH_CFG_ST_FREQUENCY. But even for the value 1000 it should give the result 1,0999999 = 1.

Am I missing something?

Ondrej

Ondrej
Posts: 3
Joined: Mon Nov 13, 2017 9:10 am

Re: Ignored values in chconf.h

Postby Ondrej » Mon Nov 13, 2017 10:39 am

After some more digging I found out, that the variable tim is updated later (i.e. after executing next subroutine call). I don't understand why. However, it has the right value of 10.

It looks like the only bug is displaying wrong value in macro expansion. And navigation to wrong file, when I use F3 (Open declaration). After 2 times of F3 (US2ST - F3, CH_CFG_ST_FREQUENCY - F3) the editor opens wrong file chconf.h located in /os/rt/templates/chconf.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Ignored values in chconf.h  Topic is solved

Postby Giovanni » Mon Nov 13, 2017 10:51 am

Hi,

It is possible that Eclipse is making confusion because there are several chconf.h in its paths, try reindexing the project.

Giovanni

Ondrej
Posts: 3
Joined: Mon Nov 13, 2017 9:10 am

Re: Ignored values in chconf.h

Postby Ondrej » Mon Nov 13, 2017 11:43 am

Thank You very much, it helped.

Ondrej


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 15 guests