xc8 compiler setting to speed up pic18f program download

It can take some time for the PICkit2 to download program machine code on to the PIC18f4620. This is because the program occupies the entire program memory available.

By using the --ROM switch on the xc8 compiler you can force your code to occupy a smaller memory space and therefore reduce the time taken to program your PIC via the PICkit2.

As an example “xc8 --chip=18f4620 --ROM=0-fff” will force the code to occupy the first 4096 bytes of program flash memory. This is just 6.25% of the 64kB available. A word of caution though – if your code becomes too large this might not be enough space to house the machine code on your PIC. 4kB should be adequate for most robosumo code.

If you are using the robosumo_files.zip bundle to compile and program your PIC18f4620 then you will have to change the build.bat file to set up the --ROM switch for the xc8 compiler. You need to replace lines 15 and 16 with the following


IF "%NEWEST%"=="%cfile%" (ECHO ..\xc8_compiler\bin\xc8 --chip=18F4620 --ROM=0-fff %cfile%
..\xc8_compiler\bin\xc8 --chip=18F4620 --ROM=0-fff %cfile%

Alternatively download the updated build.bat batch file and replace the old one with this one.

Advertisements

About dadorran

I'm a lecturer in DIT, Dublin, Ireland teaching signal processing, programming and micro controllers
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s