Storing constants in program memory not working?

General discussion on mikroPascal PRO for AVR.
Post Reply
Author
Message
kerrtronics
Posts: 2
Joined: 30 Dec 2019 21:06

Storing constants in program memory not working?

#1 Post by kerrtronics » 30 Dec 2019 21:21

HI,

I'm trying to store some constants in program memory using the memory specifier "code" as described in the compiler help but it doesn't seem to be working.

Here is my code:

Code: Select all

const
     MAGIC   = $55; code;
     VERSION = '1.0'; code;
     DATE    = '2019-12-27'; code;
When I compile my code I don't see these in program memory. How would I store these in program memory?

Thanks,
Mark

hammers
Posts: 2
Joined: 17 Jul 2020 08:49

Re: Storing constants in program memory not working?

#2 Post by hammers » 17 Jul 2020 18:38

kerrtronics wrote:
30 Dec 2019 21:21
HI,

I'm trying to store some constants in program memory using the memory specifier "code" as described in the compiler help but it doesn't seem to be working.
Here is my code:

Code: Select all

const
     MAGIC   = $55; code;
     VERSION = '1.0'; code;
     DATE    = '2019-12-27'; code;
When I compile my code I don't see these in program memory. How would I store these in program memory?
Thanks,
Mark
Anyone? Did anyone get a solution for this?

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Storing constants in program memory not working?

#3 Post by filip » 21 Jul 2020 14:14

Hi,

The compiler will ignore constants if they are not used in the code, so you must use them in code in order to see them in program memory.

Regards,
Filip.

Post Reply

Return to “mikroPascal PRO for AVR General”