Quantcast
Viewing all articles
Browse latest Browse all 17527

Compiler/PROCESSOR-SDK-AM437X: Memory corruption because of a global structure

Part Number:PROCESSOR-SDK-AM437X

Tool/software: TI C/C++ Compiler

I am using TI compiler to compile C program to run on PRU.

When I define a new variable within any function other than main(), it allocates it the memory address where some other variable is already present, hence leading to data corruption.

It is actually allocating memory where some global structure is already present

Following is the definition of global structure:

volatile __near struct TamagawaInterface TamagawaInterface __attribute__((
cregister("PRU_DMEM_0_1", near), peripheral));

Below is the screenshot of the problem

Image may be NSFW.
Clik here to view.

here the local variables crc and len are located within some function other than main, and for some reason have been allocated memory address where TamagawaInterface structure is already present, hence leading to data corruption,

What would be the correct way to solve this issue?

Thanks in advance!


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>