This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with _global_reg()

Hi guys,

I use a _global_reg var in my program to avoid save/load:

_global_var uint32_t finished_pixels;

this variable is updated in ADC interrupt.

In main, I have following code:

register uint32_t processed_pixels = 0;

finished_pixels = 0;     // Initial global reg

while (processed_pixels >= finished_pixels)

{

     // Process new pixel

     ...

}

But the armcc will optimize all code in while loop, i.e, "// Process new pixel" section.

I tried "volatile _global_var uint32_t finished_pixels;", but the compiler says it has no effect and the same thing happens;

Now I use "volatile register uint32_t processed_pixels = 0;" to avoid the trap, but it looks ugly.

Is that a compile bug?

Any bettrer solutions?

Thanks a lot!

Parents
  • Hi peter,

    Thanks for your help.

    I use a STM32F302CBT6@72MHZ in my research. As I mentioned in the reply to daith, I have to save instruction to process one pixel within 23 instructions.

    Mybe I should use a STM32F2 chip, but now, the F2 family doesn't have ADC with more than 4Msps@12bit resolution.

    Anyway, experiments take me a lot of fun.

Reply
  • Hi peter,

    Thanks for your help.

    I use a STM32F302CBT6@72MHZ in my research. As I mentioned in the reply to daith, I have to save instruction to process one pixel within 23 instructions.

    Mybe I should use a STM32F2 chip, but now, the F2 family doesn't have ADC with more than 4Msps@12bit resolution.

    Anyway, experiments take me a lot of fun.

Children
No data