Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Using PROGMEM and DMAMEM in a shared project (Read 671 times)
brownca
Newbies
*
Offline


Posts: 3
Joined: May 18th, 2023
Using PROGMEM and DMAMEM in a shared project
Apr 1st, 2024 at 5:26pm
Print Post  
I have a large project and have hit the RAM1 limit of the Teensy 4.0 that I run the code on.

I'd like to use the PROGMEM or DMAMEM keywords to move some low-priority data into Flash or DMA (RAM2) memory, however, the code is in a shared project (for unit testing purposes).

Can anyone tell me if it's possible to do this?

Here's my project architecture

Main (.ino)       Tests
              \       /
              Shared

I need to access the const data from both top-level projects (Main and Test) but I want the data to be in RAM2 ideally when running on the teensy.

I just get an intellisense error: "Identifier DMAMEM not recognised", which makes perfect sense as the Shared code has no knowledge of Teensy.

Any help or other suggestions are greatly appreciated.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12166
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Using PROGMEM and DMAMEM in a shared project
Reply #1 - Apr 2nd, 2024 at 12:37pm
Print Post  
For shared projects, Visual Studio automatically inherits the intellisense of the "start up project". 

The start up project is the project shown with a bold name in the solution explorer. 

This article might be worth review

https://forum.pjrc.com/index.php?threads/questions-about-progmem-and-teensy-4-1....

  
Back to top
IP Logged
 
brownca
Newbies
*
Offline


Posts: 3
Joined: May 18th, 2023
Re: Using PROGMEM and DMAMEM in a shared project
Reply #2 - Sep 30th, 2024 at 3:47pm
Print Post  
After messing around trying to get this working, I gave up and instead overcame my mem issues by changing some data types and reducing the amount of const data. This bought me some time.

However, as the project continued to grow, I've come back to the issue.

The good news is it is now resolved.

My problems were due to having certain std methods that were reading from a different c++ library than the Ardiuno project used.

So, I removed the references to std and added this include to the header files where I wanted to use PROGMEM.

Code (C++)
Select All
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#endif
 


Then I added the following above each data declaration:

Code (C++)
Select All
#if defined(ARDUINO) && ARDUINO >= 100
PROGMEM
#endif
const DataType myData[n] { ... }
 


There seems to be no issue using const and PROGMEM as I feared.

Both my main Arduino project and my GTest projects compile successfully using the same shared project.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint