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


giving parameters into math function

If I call in C, math function `”trunc” in math library is define as:

extern double trunc _PARAMSdouble;
and in my main file call it:

int i = (int)trunc(2.5);

It works fine, no problems. But if I try to pass double passively, like:

double d = 2.5;
int i = (int)trunc(d);

It won’t work?!? In my microprocessor STM32F4 IDE it goes in debugger mode into:

Infinite_Loop:
b Infinite_Loop

and it stuck there. I also change double and try float, int, unit8_t,... no one isn’t working.
Also other math functions will work fine as I call them like this:

i = sin(1);
i = cos(1);

But, it will crashed the same, if called like this:

int a = 1;
i = sin(a);
i = cos(a);

I am running this code on microprocessor STM32F4 Discovery,IDE is Eclipse Ac6

according to this
http://en.cppreference.com/w/c/numeric/math/truncQuestion

trun returns a double not an int. the hard fault could result from the invalid type conversion from double to int.
Ints are 4 byte long (on an STM32) doubles are 8 byte long.

try to do something like that
double intput = 1.4;
double res = truc(input);

does this still result in a hardfault?


I tried, but still the same error going to Infinite_Loop. I am looking into Linker problems now. What I meant is, whenever there is a constant number in function, everything is fine, but variable has a problem. So in a case of constants, Linker must calculate values correctly, but program can’t do it?

 

Newest Forum Posts

  1. Монтаж камина с грилем в Москве - установка и барбекю by KpddomErorb, 2025-05-10 18:28
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs