Jump to content
Sign in to follow this  
igor

CC3200 and pgmspace.h/PROGMEM?

Recommended Posts

In the Energia port for the CC3200, will there be an avr/pgmspace.h replacement to help manage access to the program memory?  If it is not already in the works, would such a thing be workable?

 

As I understand it, the CC3200 stores program in an external memory, and loads it into RAM for execution.

The AVR has two memory spaces (program and data), and on Arduino, avr/pgmspace.h defines various macros, etc. for using data in program space.

 

Seems like it might be possible to create a pgmspace.h (and accompanying library) which would allow use of data stored in the CC3200 external memory in a way compatible with some Arduino libraries.

Just a thought at this point, I have not studied the CC3200 architecture, and my familiarity with pgmspace.h is mostly in finding ways to work around it when porting AVR Arduino libraries to ARM.

 

(Got started thinking about this because I was thinking it would be nice if Energia included a 

avr/pgmspace.h for MSP430 and for Tiva, similar to what TeensyDuino does.

http://forum.stellarisiti.com/topic/1983-howto-porting-libraries-some-help-needed/?p=7660 )

Share this post


Link to post
Share on other sites

I was just working on this. Right now it is solved by adding the macro's to Energia.h as per patch below but it might be good to stick a dummy avr/pgmspace.h in Energia somewhere.

--- a/hardware/msp430/cores/msp430/Energia.h
+++ b/hardware/msp430/cores/msp430/Energia.h
@@ -12,6 +12,13 @@
 extern "C"{
 #endif
 
+#define PSTR
+#define PROGMEM
+#define pgm_read_byte(x) (*x)
+#define pgm_read_dword(x) (*x)
+#define strcat_P strcat
+#define strlen_P strlen
+
 #define NOT_A_PORT 0
 #define NOT_A_PIN 0
 #define NOT_ON_TIMER 0

Share this post


Link to post
Share on other sites

Thanks.  Couple of thoughts on the patch - in pgm_read_byte(x), should the replacement have parenthesis around x?

Would it be prudent to check to be sure PROGMEM, etc. not already defined?

(I expect that if the user already had a patch for dealing with PROGMEM it would usually be after Energia.h, so it is their problem to protect from duplicate definitions, but not sure if that will always be the case.)

e.g. as below:

 

 extern "C"{
 #endif

#ifndef PSTR 
+#define PSTR
#endif
#ifndef PROGMEM
+#define PROGMEM
#endif

// Add similar checks/protection to other progmem macros
+#define pgm_read_byte(x) (*(x))
+#define pgm_read_dword(x) (*(x))
+#define strcat_P strcat
+#define strlen_P strlen
+
 #define NOT_A_PORT 0
 #define NOT_A_PIN 0
 #define NOT_ON_TIMER 0

 

Is there anything interesting/different that would be better on the CC3200?

Share this post


Link to post
Share on other sites

I have interfaced accelerometer sensor using energia but not able to program the temperature sensor on CC3200 launchpad but not able to connect the compiler shows the following error

 

 C:\Program Files\energia-0101E0013\hardware\cc3200\libraries\Adafruit_TMP006\Adafruit_Sensor.cpp:2:26: fatal error: avr/pgmspace.h: No such file or directory

compilation terminated. 
 
but this was solved wen i copied the adafruit library but again a new error 
C:\Program Files\energia-0101E0013\hardware\cc3200\libraries\Wire\utility\twi.c:25:20: fatal error: avr/io.h: No such file or directory
compilation terminated.
 
i am not able to solve it not getting any clue for it 
please guide!!!!
 

Share this post


Link to post
Share on other sites

 

I have interfaced accelerometer sensor using energia but not able to program the temperature sensor on CC3200 launchpad but not able to connect the compiler shows the following error

 

 C:\Program Files\energia-0101E0013\hardware\cc3200\libraries\Adafruit_TMP006\Adafruit_Sensor.cpp:2:26: fatal error: avr/pgmspace.h: No such file or directory

compilation terminated. 
 
but this was solved wen i copied the adafruit library but again a new error 
C:\Program Files\energia-0101E0013\hardware\cc3200\libraries\Wire\utility\twi.c:25:20: fatal error: avr/io.h: No such file or directory
compilation terminated.
 
i am not able to solve it not getting any clue for it 
please guide!!!!
 

 

 

I don't know the answer but I have come across other posts in the forum before about similar issues re temperature sensor... buried within this post (2 or more pages) may be some guidance...

 

http://forum.43oh.com/topic/5839-new-energia-release-0101e0013-09052014/

http://forum.43oh.com/topic/5839-new-energia-release-0101e0013-09052014/page-2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...