Skip to content

Instantly share code, notes, and snippets.

@JJL772
Created December 18, 2018 09:29
Show Gist options
  • Save JJL772/45e43fe678e83e9e7cf7848697a45a14 to your computer and use it in GitHub Desktop.
Save JJL772/45e43fe678e83e9e7cf7848697a45a14 to your computer and use it in GitHub Desktop.
PIC MCU Example Makefile
#
# A simple example makefile for microchip's XC8 compiler
#
#
#Compiler Options:
#
#
# -C Compile to object file
# -Dargument Define preprocessor symbol
# -E<argument> Redirect compile errors
# -Iargument Specify include path
# -L<argument> Set linker option
# -M<argument> Generate map file
# -Nargument Identifier length
# -Oargument Output file
# -P Preprocess assembler
# -Q Quiet mode
# -S Compile to assembler
# -Uargument Undefine preprocessor symbol
# -V Verbose mode
# --addrqual<=argument> Specify address space qualifier handling
# --asmlist Generate assembler listing
# --char<=argument> Default character type (defunct)
# --checksum=argument Calculate a checksum and store the result in program memory
# --chip=argument Select processor
# ! --chipinfo Chip information
# --clist Generate C listing
# --codeoffset=value Specify ROM address
# --debugger<=argument> Set debugger environment
# --dep<=argument> Dependency file options
# --double<=argument> Size of double type
# --echo Echo command line
# --emi<=argument> External memory interface mode
# --errata<=argument> Specify errata work-arounds
# --errformat<=argument> Error format
# --errors=number Maximum number of errors
# --fill=argument Specify a ROM-fill value for unused memory
# --float<=argument> Size of float type
# --getoption=argument Get advanced options
# ! --help<=argument> Help
# --lkrmac=argument Define a linker script macro
# --maxipic Maximize device
# ! --memmap=argument Display memory map
# --mode<=argument> Choose operating mode
# --msgdisable<=argument> Disable warning messages
# --msgformat<=argument> Message format
# --nodel Do not remove temporary files
# --nofallback Prevent falling back to lesser license modes
# --objdir=argument Object files directory
# --opt<=argument> Optimization options
# --outdir=argument Output directory
# --output<=argument> Output formats
# --parser<=argument> Specify parser options
## --pass1 Produce Microchip intermediate P-code
# --pre Preprocess only
# --ram=argument Specify RAM ranges
# --rom=argument Specify ROM ranges
# --runtime<=argument> Run-time options
# --scandep Scan for dependencies
# --serial=argument Insert a hexadecimal code or serial number
# --setoption=argument Set advanced options
# ! --setup<=argument> Setup the product
# --shroud Shroud (obfuscate) generated p1 files
# --stack<=argument> Specify default stack model and size
# --std<=argument> C standard support
# --strict Strict ANSI keywords
# --summary<=argument> Summary options
# --time Report compilation times
# --undefints<=argument> Program Unassigned Interrupt Vectors
# ! --ver Version information
# --warn<=argument> Warning level
# --warnformat<=argument> Warning format
#if you aren't using this chip, use --chipinfo to display a list of supported chips
chipinfo = 16lf15325
# --chip specifies the chip type
# --asmlist outputs an assembler listing
# --outdir is where the build files are placed, make sure it has no tailing slash
# --objdir is where intermediate build files are placed, make sure it has no tailing slash
# --time displays compile times after the compile is done
# --std=c99 specifies c99 as the standard. c11 is not supported
# -O specifies the output filename
# the tailing parameters are source files
compile:
picc --chip=$(chipinfo) --asmlist --outdir="bin" --objdir="intermediate" --time --std=c99 -O "text.hex" test.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment