View previous topic :: View next topic |
Author |
Message |
drolleman
Joined: 03 Feb 2011 Posts: 116
|
Memory not available at requested location: |
Posted: Fri Mar 03, 2023 9:42 pm |
|
|
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? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
drolleman
Joined: 03 Feb 2011 Posts: 116
|
|
Posted: Sat Mar 04, 2023 11:23 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Sat Mar 04, 2023 11:40 am |
|
|
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!!!! |
|
![](templates/subSilver/images/spacer.gif) |
drolleman
Joined: 03 Feb 2011 Posts: 116
|
|
Posted: Sat Mar 04, 2023 12:37 pm |
|
|
that would be very helpful |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19358
|
|
Posted: Sun Mar 05, 2023 4:14 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Mon Mar 06, 2023 8:53 am |
|
|
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!!!! |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19358
|
|
Posted: Mon Mar 06, 2023 10:40 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
drolleman
Joined: 03 Feb 2011 Posts: 116
|
|
Posted: Wed Mar 08, 2023 3:01 pm |
|
|
thank you for the info |
|
![](templates/subSilver/images/spacer.gif) |
|