incorrect device file '_maxram' settings
Moderators: David Barker, Jerry Messina
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
incorrect device file '_maxram' settings
I just started using the 87K22, and happened to notice that the '_maxram' setting in the device file seems to be incorrect.
The device file has '#variable _maxram = $0F60', but the 87K22 has SFRs located at $0F16-$0F5F, so this should probably be '#variable _maxram = $0F16'
I had a look at some of the other files, and noticed that for many parts that have ram up in banks E00 and F00, the _maxram setting doesn't match up to the device. There's quite a number of these (including the 25K80, 26J11, and 26K22 to name a few), and in some cases there could actually be more ram allotted (which is no big deal), but in others (like the 87K22) the setting is too large and would let you incorrectly overrun the SFR locations.
I have the most up to date files from MPASM 5.43, and tried using both swordfish.includes.exe and SystemConvert.exe with similar results.
I was going to try and fix this, but since there are so many of them I thought that it best to add the changes to SystemConvert's DEFAULT.INI file and regenerate them instead of just changing each device .BAS file. For the life of me I can't find this number anywhere in the various Microchip files. The closest thing I found was some settings in the xml MPLAB IDE\Device\*.PIC files that describe the ram bank usage.
Before I do that, does that sound reasonable, and is there any easier way to find out what the correct setting is short of sifting thru all the datasheets?
The device file has '#variable _maxram = $0F60', but the 87K22 has SFRs located at $0F16-$0F5F, so this should probably be '#variable _maxram = $0F16'
I had a look at some of the other files, and noticed that for many parts that have ram up in banks E00 and F00, the _maxram setting doesn't match up to the device. There's quite a number of these (including the 25K80, 26J11, and 26K22 to name a few), and in some cases there could actually be more ram allotted (which is no big deal), but in others (like the 87K22) the setting is too large and would let you incorrectly overrun the SFR locations.
I have the most up to date files from MPASM 5.43, and tried using both swordfish.includes.exe and SystemConvert.exe with similar results.
I was going to try and fix this, but since there are so many of them I thought that it best to add the changes to SystemConvert's DEFAULT.INI file and regenerate them instead of just changing each device .BAS file. For the life of me I can't find this number anywhere in the various Microchip files. The closest thing I found was some settings in the xml MPLAB IDE\Device\*.PIC files that describe the ram bank usage.
Before I do that, does that sound reasonable, and is there any easier way to find out what the correct setting is short of sifting thru all the datasheets?
- Senacharim
- Posts: 139
- Joined: Tue Aug 10, 2010 5:19 pm
- Location: Ventura, CA
Jerry,
I am with you and I have search the MPLAB files to no avail to find the data that gets generated by David’s system convert program.
Not sure which files David uses to generate his *.bas files, it would be nice to know however.
It looks like the *.dev files are used for the "// special function registers..." definitions, cannot say where the "// system header..." comes from.
But since the info is provided by Microchip it seems their files are incorrect.
The first thing I check when I start a program is to check the *.bas file with the data sheet to see if it is correct and make changes as necessary.
It is bad form on Microchip behalf, that these files do not match the data sheet. Some of the information does seem to be correct in Microchip's *. lkr files though.
I am quite sure I have not told you anything you do not already know just figured I say it for other people.
It was nice to know about the default.ini file. I had to do a search on SF forum to find out how to use it, thanks for the information.
Keith
I am with you and I have search the MPLAB files to no avail to find the data that gets generated by David’s system convert program.
Not sure which files David uses to generate his *.bas files, it would be nice to know however.
It looks like the *.dev files are used for the "// special function registers..." definitions, cannot say where the "// system header..." comes from.
But since the info is provided by Microchip it seems their files are incorrect.
The first thing I check when I start a program is to check the *.bas file with the data sheet to see if it is correct and make changes as necessary.
It is bad form on Microchip behalf, that these files do not match the data sheet. Some of the information does seem to be correct in Microchip's *. lkr files though.
I am quite sure I have not told you anything you do not already know just figured I say it for other people.
It was nice to know about the default.ini file. I had to do a search on SF forum to find out how to use it, thanks for the information.
Keith
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Keith,
Thanks for the heads up. Don't know how, but I completely missed looking in the .lkr files. That's got all of the ram allocation info in it in a much easier form than the xml file.
You're right...the few I've checked so far appear to be correct, so I guess David tries to figure it out using some other file/method.
If I manage to get time, I'll try and generate a DEFAULT.INI with the corrections in it and post it here.
Thanks for the heads up. Don't know how, but I completely missed looking in the .lkr files. That's got all of the ram allocation info in it in a much easier form than the xml file.
You're right...the few I've checked so far appear to be correct, so I guess David tries to figure it out using some other file/method.
If I manage to get time, I'll try and generate a DEFAULT.INI with the corrections in it and post it here.
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
I seem to recall the generator uses the number of RAM banks * 256 (I think, I don't have the program in front of me right now). I do still have problems with microchip chip device files not matching datasheets. Editing the default file is one workaround but if anyone has a more bullet proof idea, please do let me know.
David,
Could you tell me which Microchip files you get this information from.
I am just curious.
Keith
Could you tell me which Microchip files you get this information from.
Code: Select all
{
****************************************************************
* Name : 18F26K22 *
* Author : David John Barker *
* Notice : Copyright (c) 2012 Mecanique *
* : All Rights Reserved *
* Date : 1/10/2012 *
****************************************************************
}
module SystemTypes
// system header...
#const _core = $0012 // processor core
#const _ram_banks = $0F // 15 RAM bank(s) used
#variable _maxaccess = $60 // access ram is 96 bytes
#variable _maxram = $0F00 // 3840 bytes of user RAM
#variable _maxrom = $010000 // 64 KB of program ROM
#const _eeprom = $0400 // 1024 bytes of EEPROM
#const _eeprom_start = $F00000 // EEPROM start address
#const _ports = $03 // 3 available ports
#const _ccp = $02 // 2 CCP module(s) available
#const _eccp = $03 // 3 ECCP module(s) available
#const _mssp = $02 // 2 MSSP module(s) available
#const _usart = $02 // 2 USART(s) available
#const _adc = $0D // 13 ADC channels available
#const _adres = $0A // 10 bit ADC resolution
#const _comparator = $02 // 2 comparator(s) available
#const _psp = $00 // Parallel Slave Port (PSP) is NOT supported
#const _can = $00 // onboard CAN is NOT supported
#const _usb = $00 // USB is NOT supported
#const _ethernet = $00 // onboard Ethernet is NOT supported
#const _flash_write = $01 // FLASH has write capability
Keith
- Senacharim
- Posts: 139
- Joined: Tue Aug 10, 2010 5:19 pm
- Location: Ventura, CA
Maybe you have different *.inc files that I do, but mine do not show any of the info I posted above.
Yes most of the information in the *.bas file after "module SystemTypes " comes from the *.inc files I believe.
But information I was asking for is what files contain the information listed in the "module SystemTypes "
Example are ram banks, maxacces, maxram, and how many ccp's, ports, uarts, adc's, usb and such. My include files from MC do not have that information.
I was just wondering how David got that information.
Keith
Yes most of the information in the *.bas file after "module SystemTypes " comes from the *.inc files I believe.
But information I was asking for is what files contain the information listed in the "module SystemTypes "
Example are ram banks, maxacces, maxram, and how many ccp's, ports, uarts, adc's, usb and such. My include files from MC do not have that information.
I was just wondering how David got that information.
Keith
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
From what I can tell, SystemConvert uses the asm *.inc and the MPLAB IDE/device/*.dev files to figure out all that it does.
There ended up being about 60 parts in question. In some cases, even the datasheet was wrong! If there was a conflict in the info, I used the linker file since that seems to be right from what I can tell.
For the USB parts I wasn't really sure of what would be best to do, so I set 'maxram' to the total device ram and 'maxram_contig' to the location of the USB BDT. If you're not using the USB peripheral, you can change 'maxram_contig' to match 'maxram' if you want, but currently it doesn't really matter... 'maxram' is the important one. For USB, the USBv14 library takes care of the rest.
Here's what I came up with. To use it, put the info into a file named DEFAULT.INI in the same directory as SystemConvert, and run it.
DEFAULT.INI:
This only changes the ram info, so all the other stuff will still be generated from the mchip files. If anyone spots something wrong with the above, please pipe up!
There ended up being about 60 parts in question. In some cases, even the datasheet was wrong! If there was a conflict in the info, I used the linker file since that seems to be right from what I can tell.
For the USB parts I wasn't really sure of what would be best to do, so I set 'maxram' to the total device ram and 'maxram_contig' to the location of the USB BDT. If you're not using the USB peripheral, you can change 'maxram_contig' to match 'maxram' if you want, but currently it doesn't really matter... 'maxram' is the important one. For USB, the USBv14 library takes care of the rest.
Here's what I came up with. To use it, put the info into a file named DEFAULT.INI in the same directory as SystemConvert, and run it.
DEFAULT.INI:
Code: Select all
[18F24J11]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=3776
[18F25J11]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=3776
[18F26J11]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=3776
[18F44J11]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=3776
[18F45J11]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=3776
[18F46J11]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=3776
[18F66J11]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=3904
[18F66J16]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=3904
[18F67J11]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=3904
[18F86J11]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=3904
[18F86J16]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=3904
[18F87J11]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=3904
[18F26J13]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3760
maxram_contig=3760
[18F27J13]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3760
maxram_contig=3760
[18F46J13]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3760
maxram_contig=3760
[18F47J13]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3760
maxram_contig=3760
[18F24J50]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=1024
[18F25J50]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=1024
[18F26J50]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=1024
[18F44J50]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=1024
[18F45J50]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=1024
[18F46J50]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=1024
[18F65J50]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=1024
[18F66J50]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=1024
[18F66J55]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=1024
[18F67J50]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=1024
[18F85J50]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=1024
[18F86J50]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=1024
[18F86J55]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=1024
[18F87J50]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3904
maxram_contig=1024
[18F26J53]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=3328
[18F27J53]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=3328
[18F46J53]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=3328
[18F47J53]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3776
maxram_contig=3328
[18F86J72]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3924
maxram_contig=3924
[18F87J72]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3924
maxram_contig=3924
[18F66J90]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3924
maxram_contig=3924
[18F67J90]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3924
maxram_contig=3924
[18F86J90]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3924
maxram_contig=3924
[18F87J90]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3924
maxram_contig=3924
[18F66J93]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3924
maxram_contig=3924
[18F67J93]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3924
maxram_contig=3924
[18F86J93]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3924
maxram_contig=3924
[18F87J93]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3924
maxram_contig=3924
[18F26K22]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3896
maxram_contig=3896
[18F46K22]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3896
maxram_contig=3896
[18F66K22]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3862
maxram_contig=3862
[18F67K22]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3862
maxram_contig=3862
[18F86K22]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3862
maxram_contig=3862
[18F87K22]
generate_model=1
ignore_default=0
ram_banks=16
maxaccess=96
maxram=3862
maxram_contig=3862
[18F25K80]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3648
maxram_contig=3648
[18F26K80]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3648
maxram_contig=3648
[18F45K80]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3648
maxram_contig=3648
[18F46K80]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3648
maxram_contig=3648
[18F65K80]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3648
maxram_contig=3648
[18F66K80]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3648
maxram_contig=3648
[18F66K90]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3828
maxram_contig=3828
[18F67K90]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3828
maxram_contig=3828
[18F86K90]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3828
maxram_contig=3828
[18F87K90]
generate_model=1
ignore_default=0
ram_banks=15
maxaccess=96
maxram=3828
maxram_contig=3828
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact: