Updated Swordfish Device Files and Libraries

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
Jerry Messina
Swordfish Developer
Posts: 1265
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Updated Swordfish Device Files and Libraries

Post by Jerry Messina » Sat Jul 28, 2018 2:50 pm

I've updated a number of files including support for the K40 and Q10 families, as well as general updates to the device files and system libraries.
You can find the downloads at the top of the wiki page http://www.sfcompiler.co.uk/wiki/pmwiki ... er.Modules

Here are some of the highlights:

Code: Select all

Swordfish Device file and Library Updates 7_28_2018

device files
	- generated using SystemConvert_v144 and mpasmx v5.77 (8bit_device.info V1.40)
		mpasmx 5.77 is from mplabx 4.10-5.00 
	- includes K40 and Q10 family support (no other fixes required)
	- new definitions:
		#const _nvmcon	// used to identify EEPROM/NVM control types
		  #const _nvmcon = $00    // eeprom uses EECON1 (std)
		  #const _nvmcon = $01    // eeprom uses NVMCON1 (K40)
		  #const _nvmcon = $02    // eeprom uses NVMCON0/NVMCON1 (Q10)

		#const _ipen	// used to locate IPEN flag
          #const _ipen = $00      // IPEN located in RCON
		  #const _ipen = $01      // IPEN located in INTCON

		#const _wdt_type	// used to identify WDT config type
          #const _wdt_type = 0	  // WDT(WDT)     = [OFF, ON] (18F4520 SF default device)
          #const _wdt_type = 1    // WDTEN(WDTEN) = [OFF, ON] (18F14K50)
          #const _wdt_type = 2    // WDTEN(WDTEN) = [OFF, NOSLP, SWON, ON] (18FxxK22)
          #const _wdt_type = 3    // WDTEN(WDTEN) = [OFF, NOSLP, ON, SWDTDIS] (18FxxK80)
          #const _wdt_type = 4    // WDTE(WDTE)   = [OFF, SWDTEN, NSLEEP, ON] (18FxxK40, Q10)

system.bas (sf system library)
	- v1.8
	- add support for #const _wdt_type = 4 (WDTE, K40)
	- add #option SYSTEM_CONFIG_WDT to control setting 'config WDTxx'
	- change #define SF_SYSTEM_VERSION = 18
eeprom.bas (sf system library)
	- v1.6
	- add support for new device file '#const _nvmcon'
	- add support for K40 and Q10 families
	- add intr GIE save/disable/restore code around writebyte
	- add refresh() routine

usart.bas/usart2.bas (sf system library)
	- v1.7
	- add #options to define usart IO pins 
		#option USART_TX
		#option USART_RX
		includes support for 18F1x20, 1x30, 1xK22, 1xK50 and all PPS devices
	- add support for K40 and Q10 families (intr definitions)
	- fix baudrate constants
	- add open(), close()
	- add #option USART_CLEAR_OERR for automatic OERR handling
	- add #option USART_STARTUP_INITIO for pon pin initialization

I2C.bas, I2C2.bas (sf system library)
	- v1.2
	- add #options to define IO pins
  		#option I2C_SCL
  		#option I2C_SDA
		includes support for 1xK22, xxK50, J53, and others

SPI.bas, SPI2.bas (sf system library)
	- v1.2
	- add #options to define IO pins
  		#option SPI_SCK
  		#option SPI_SDI
  		#option SPI_SDO
  		#option SPI_SS
		includes support for 1xK22, xxK50 and all PPS devices
	- add open()/close()
	- add transfer()
	- add #option SPI_TRANSFER_END to select between BF and SSPIF

	- v1.6
	- added 18F2220, 18F2320, 18F4220, 18F4320
	- added 18FxxK90, 18FxxJ94/J99
	- added 18FxxQ10

	- v2.4
	- added 18FxxQ10

	- v1.7
	- add Q10 (supported by mplabx only)
	- add _trap(), _trap_ret(), and _halt()

	- v1.5
	- fixes for some K40 parts
	- add support for 24Q10,25Q10 (PPS_V6_1)
	- add prelim support for 26Q10,27Q10,45Q10,46Q10,47Q10 (PPS_V6_2)

	- v1.5
	- SF startup register init for bootloaders, etc
		automatically add code to the SF startup initializer list
	- v1.3
	- add support for Q10 family  (#const _wdt_type = 4)
	- add #option WDT_CONFIG to set default wdt config setting
	- v1.2
	- add support for K40, Q10 (#const _nvmcon)
	- add #options
		#option USERID_SIZE
		#option USERID_INIT
	- misc fixes

copy following folders from the zip file to Swordfish install/user folders 
NOTE: this will overwrite the contents, so make a backup copy first if desired
	Library (or UserLibrary)
	Samples (optional)
	Tools (optional)
	MPLABX (optional)
Because of wiki file size restrictions I had to split it into a number of downloads (especially the device files), so hopefully everything's still there!
You can also get the above as a single 8MB zip file from my dropbox at SF_dev_lib_update_7_28_18.zip

Many of the system libraries have been updated to allow you to specify the peripheral IO pins using #options so they can now be used with devices that use PPS for the peripherals.
It also includes updates for some of the standard parts that have oddball pins assignments.

There are some simple examples for some of the modules (basically to make sure they compile) and if anything's not clear just drop a note.

I tried to make the changes backwards compatible with any existing code, but if I screwed that up let me know. Also, I didn't compile every possible permutation so there's bound to be some stuff I missed.

Registered User
Registered User
Posts: 167
Joined: Sat Oct 09, 2010 1:39 pm
Location: United Kingdom

Re: Updated Swordfish Device Files and Libraries

Post by bitfogav » Sun Jul 29, 2018 8:17 pm

This is great!! thank you Jerry for all you're continued support and posting this :)

User avatar
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: Updated Swordfish Device Files and Libraries

Post by Coccoliso » Mon Jul 30, 2018 6:54 am

Great !! :D

Post Reply