|
|
View previous topic :: View next topic |
Author |
Message |
allenhuffman
Joined: 17 Jun 2019 Posts: 580 Location: Des Moines, Iowa, USA
|
getenv("PROGRAM_MEMORY") and values returned. |
Posted: Thu Dec 19, 2024 11:10 am |
|
|
I am trying to remove some hard-coded #define values, and noticed something:
According to the PIC24FJ64GA002 datasheet:
https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/39881e.pdf
This is a part with 64K Program Memory and 8K SRAM.
getenv("PROGRAM_MEMORY") is described as:
Quote: | Returns the size of memory for code (in words) |
But on this part, I print and show it as:
Code: | PROGRAM_MEMORY : 0xabfc (44028) |
With each PIC24 address representing 2-bytes, I would have expected this to either return 0x10000 (64K) or, if using PIC values of "words", 0x8000 (32K).
But I am unsure why I am getting back 42K...
Something obvious, I assume?
[/url] _________________ 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. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Thu Dec 19, 2024 12:44 pm |
|
|
Remember a PIC24/30/33 has three bytes existing out of every four.
Microchip are actually quite 'naughty' on this. If you look at the memory
map, it lists addresses running to 0xABFE, with the note '22K instructions'.
Now 0xABFE is 44030, is the value you are getting (one word address below).
This value taken in words, is the 22K given as the number of instructions,
but the instructions largely take 3 bytes not 2.
So the value CCS give is the maximum usable word address in the memory
range. |
|
|
|
|
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
|