CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Memory not available at requested location:

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
drolleman



Joined: 03 Feb 2011
Posts: 116

View user's profile Send private message

Memory not available at requested location:
PostPosted: Fri Mar 03, 2023 9:42 pm     Reply with quote

ccs 5.107
<33CH512MP206.h>

on compile the only warning
Warning#228 Memory not available at requested location:
#define SLAVE_PROGRAM_START_ADDR 0x10000

files are from the sample directory ex_ch_master.c and ex_ch_slave.c

i've got the master to work but no slave.
it returns SlaveVerify = 0
is the address too high?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 04, 2023 1:04 am     Reply with quote

This thread is about the same topic:
http://www.ccsinfo.com/forum/viewtopic.php?t=58880
drolleman



Joined: 03 Feb 2011
Posts: 116

View user's profile Send private message

PostPosted: Sat Mar 04, 2023 11:23 am     Reply with quote

thank you for the response.

i looked at that thread before i posted the new thread it didn't help. at this point all i'm trying to get running is led flashing. i believe the warning #228 should an error. according to microchips document pram starts at 0x000200. and ends at 0x00BFFE. the location at 10000 is Unimplemented and reads 0.

why would you hard code the number of bytes at 512?

when i contacted support they were questioning why you would put the slave.hex into the master. i believe ccs hasn't got 33ch completed.

when i insert #fuses CPRD=0xff80 my port d does reconfigure correctly, but when i try to flash the led nothing happens. but SlaveVerify = 0
dyeatman



Joined: 06 Sep 2003
Posts: 1912
Location: Norman, OK

View user's profile Send private message

PostPosted: Sat Mar 04, 2023 11:40 am     Reply with quote

I can verify ex_ch_master.c and ex_ch_slave.c do actually work. I used
them as the starting point for a motor control/feedback system I built about
8 months ago. I am on travel but when I get back Suunday I'll pull up the
code to see what I used to get it to work.
_________________
Google and Forum Search are some of your best tools!!!!
drolleman



Joined: 03 Feb 2011
Posts: 116

View user's profile Send private message

PostPosted: Sat Mar 04, 2023 12:37 pm     Reply with quote

that would be very helpful
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Sun Mar 05, 2023 4:14 am     Reply with quote

OK.
You are 'chasing a hare'. The warning is not the problem.

The address should be OK. Key to understand is how this all works.
The code is loaded into the _master_ code space, and then transferred to
the PRAM by the 'load_slave_program' instruction. This needs to be given
the start address in the master program memory, and the number of
instructions to copy.

Now if you look in the slave code, this is compiled 'offset', so it can be
stored at the 0x10000 address, but is compiled to run at the slave
processor's start. The address you are looking at for the PRAM, in the
data sheet, is this 'final' address, not where the data has to be put for
the transfer.

The slave code is compiled to run at the 0x200 address, but to be stored
at the 0x10000 address. This is output to the hex file, which is then
imported into the master (up to the maximum size of the PRAM), and
then the amount specified by 'SLAVE_PROGRAM_INSTRUCTIONS' is
copied into the PRAM at boot. If you change the program size, you
need to expand this value to make sure the program transfers (compile
the slave, look in the listing file at the size, and tell it to copy this rounded
to the next page). You could do a self adjusting version, by adding a
'marker' value to the end of the slave program, and having the master
code look for this and then transfer the next binary page value above this.
But probably more work than is worthwhile.

The #ORG is to ensure the master will not put any of it's own code into
the area used for this transfer, and actually 'causes' the warning. The
memory has effectively been reserved (so is not 'available'), but it is still
there, and can be used for the transfer. Perhaps CCS ought to change the
example to have:

Code:

//Sets aside Master's flash memory used to store the Slave's program.  This
//keeps the compiler from using this memory region.
#org SLAVE_PROGRAM_START_ADDR,SLAVE_PROGRAM_END_ADDR {}

//We now import the slave code into this area. To prevent this causing a
//warning, disable this warning
#IGNORE_WARNINGS 228
//Import Slave's program into Master's flash, Slave's program must be built
//before Master's program.
#import(file="ex_ch_slave.hex", HEX, range=SLAVE_PROGRAM_START_ADDR:SLAVE_PROGRAM_END_ADDR)
//Now re-enable warning.
#IGNORE_WARNINGS NONE


Which will prevent the warning.
It does work.

If you have changed your slave program, then look at the size being
copied in the master.
dyeatman



Joined: 06 Sep 2003
Posts: 1912
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Mar 06, 2023 8:53 am     Reply with quote

After digging into my archives I found that I also got the "Memory not avail"
message but the project worked with no issues.

Code:
>>> Warning 228 "C:\ccs_c\Ver5\Projects PIC2433\Dual Core Motor Control 33CH128MP508\Dave_33ch_master.c" Line 105(0,1): Memory not available at requested location


At line 105 from above I have:
Code:
#import(file="DAVE_33ch_slave.hex", HEX, range=SLAVE_PROGRAM_START_ADDR:SLAVE_PROGRAM_END_ADDR)


Here are my Slave defines:
Code:
#define SLAVE_PROGRAM_START_ADDR       0x10000  //this define should match what's in ex_ch_slave.c
#define SLAVE_PROGRAM_END_ADDR         0x18FFE
#define SLAVE_PROGRAM_INSTRUCTIONS     4096   

My slave address numbers were also adjusted for my modified slave program size ...

FWIW, I found using mailboxes rather than FIFO for message xfers between master/slave was both simpler and easier to control/monitor and worked better in my implementation.
_________________
Google and Forum Search are some of your best tools!!!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Mon Mar 06, 2023 10:40 am     Reply with quote

Yes, as I said, it does work.
Once you understand how this is being done, it 'makes sense', but they
really ought to have got rid of the message as I show.
drolleman



Joined: 03 Feb 2011
Posts: 116

View user's profile Send private message

PostPosted: Wed Mar 08, 2023 3:01 pm     Reply with quote

thank you for the info
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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