|
|
View previous topic :: View next topic |
Author |
Message |
allenhuffman
Joined: 17 Jun 2019 Posts: 589 Location: Des Moines, Iowa, USA
|
Weird CCS compiler thing: getenv("CONFIGURATION_ADDRESS |
Posted: Thu Dec 19, 2024 11:18 am |
|
|
Here is a fun one -- discussing it with CCS currently:
These work just fine (DEBUG_PRINTF is printf):
Code: |
#include <inttypes.h> for the PRIx32 stuff:
DEBUG_PRINTF ("PROGRAM_MEMORY : 0x%" PRIx32 " (%lu)\r\n",
getenv("PROGRAM_MEMORY"), getenv("PROGRAM_MEMORY"));
|
But when I tried do use the other one, it won't build:
Code: |
DEBUG_PRINTF ("CONFIGURATION_ADDR. : 0x%" PRIx32 " (%lu)\r\n",
getenv("CONFIGURATION_ADDRESS"), getenv("CONFIGURATION_ADDRESS"));
|
Some experimenting led me to loading it in to a variable and then printing the variable, and that worked. But, oddly, this also works:
Code: |
int x = getenv("CONFIGURATION_ADDRESS");
DEBUG_PRINTF ("CONFIGURATION_ADDR. : 0x%" PRIx32 " (%lu)\r\n",
getenv("CONFIGURATION_ADDRESS"), getenv("CONFIGURATION_ADDRESS"));
|
Though that gives me an un-used variable warning.
Just odd. Thought I'd pass this along and see if anyone else has run into it.
(And it started with just %x and %u, on a 64K part, but CCS thought it might need %lx and %lu, and then I made the change using the inttypes.h stuff.
(If you aren't familiar with inttypes.h -- I wasn't either. I only learned of it recently: https://subethasoftware.com/2024/09/30/printf-portability-problems-persist-possibly/ _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 589 Location: Des Moines, Iowa, USA
|
|
Posted: Sat Jan 04, 2025 6:23 pm |
|
|
CCS support said the wrong values could be fixed by editing the database the compiler uses. I suppose for now it means go by the data sheet and hope it is correct ;-) _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|