Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22006

How to use variable defined in one binary into another binary in C

$
0
0

We have two cores in microcontroller. One CM0+ and another CM7. Therefore we can't build single binary (executable) output because instructions sets are different for both cores.

However, there is single structure variable which must be accessed from both cores but defined in only single binary file. Single copy of variable is required in memory because both cores writes to the same variable and use this for synchronizing and exchanging data between cores.

Example: Project CM0+ : dataExchange variable is available in CM0+ project C file.

 stc_dataexchange dataExchange; stc_dataexchange *dataExchangePtr = &dataExchange;

Project CM7: dataExchange variable is not available in this project. But we want to address it somehow.

 stc_dataexchange *dataexchangeptr = &dataExchange; //dataExchange is not available. Compilation will result in error. 

dataExchnage variable is available only in Project CM0+, Project CM7 doesn't know about this. How to initialize pointer to the address of dataExchange in CM7 project? Flash memory can be accessed by both cores.


Viewing all articles
Browse latest Browse all 22006

Trending Articles



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