/* * klb_config.c configuration file for KLBasic AVR target * * Building this file in AVRStudio4 or similar AVR GCC tool chain * creates a .eep file for configuring a target KLBasic board. * Use of this configuration EEPROM file requires using version * 0.8 or later of the KLBasic AVR code. * * After compiling this program with AVRStudio4, transfer ONLY * the klb_config.eep file to your target; do NOT transfer the * .hex file, as this will overwrite your KLBasic executable. * * After writing the .eep file to your target, reset your target. * The target should reboot and use the values you enter below for * F_CPU and console baud rate. */ #include #include /* * Modify the following #defines to reflect your target hardware. * TARGET_FCPU should define the crystal frequency of your target, * expressed in Hertz. TARGET_BAUD should define the baud rate of * the serial port connected to your user console (usually, the first * UART in your MCU). */ #define TARGET_FCPU 20000000 /* target crystal freq in hertz */ #define TARGET_BAUD 57600 /* target console baud rate */ /* * Macros for creating a table of NV system values in EEPROM. * * These macros store a value in EEPROM as MSB first, which is the * same format used by KLBasic's eep32() and eep16() functions. This * allows you to update the NV system values from within a KLB program * and have the system behave properly on the next reboot. */ #define NVSYSVALUE_16(w) (((w>>8) & 0xff)), (w & 0xff) #define NVSYSVALUE_32(x) NVSYSVALUE_16((x>>16)), NVSYSVALUE_16(x) /* * EEPROM table of NV system values. This is an example of an EEPROM * table that can be used to set up the target. * * To be consistent with the way KLBasic writes multi-byte values to * EEPROM, multi-byte data in this table must always be written MSB first! */ const unsigned char eesysvalues[] EEMEM = { NVSYSVALUE_32(TARGET_FCPU), NVSYSVALUE_32(TARGET_BAUD), NVSYSVALUE_32((TARGET_FCPU + TARGET_BAUD)) // calc 32-bit checksum of all values saved }; /* * The following dummy function is not used. It is only needed to allow * the AVRStudio4 build to complete. * * After building this project, you will need to move the *.eep file ONLY * into your target device. When you then reboot the target device, it * will launch KLBasic using the target F_CPU and target baud rate you * defined above. */ int main(void) { return 0; }