Permalink
Browse files

MCHP Bootloader support (0x800). Thanks to iLLNESS!

  • Loading branch information...
1 parent 2849e83 commit fadab8c25becee5c76f6e6d3e979ae956d0eb06d @Noltari committed Nov 6, 2010
Showing with 30 additions and 14 deletions.
  1. +21 −11 Makefile
  2. +5 −1 main.c
  3. +4 −2 usb_desc.h
View
32 Makefile
@@ -1,7 +1,8 @@
CCS_COMPILER = ccsc
CCS_SOURCE = main.c
CCS_FLAGS_NBL = +FH +Y9 -L -A -E -M -P -J -D
-CCS_FLAGS_WBL = $(CCS_FLAGS_NBL) +GWBOOTLOADER="true"
+CCS_FLAGS_WBLHID = $(CCS_FLAGS_NBL) +GWBOOTLOADERHID="true"
+CCS_FLAGS_WBLMCHP = $(CCS_FLAGS_NBL) +GWBOOTLOADERMCHP="true"
CCS_FLAGS_LEDS = +GLEDR1="PIN_B4" +GLEDR2="PIN_B1" +GLEDR3="PIN_C0" +GLEDG1="PIN_B5" +GLEDG2="PIN_C1"
ZIP = zip -r
BUILD_DIR = build
@@ -35,30 +36,39 @@ all:
#Make custom Payloads.
$(foreach fw_pic, $(FIRMWARES_PIC3), $(foreach pl_pic, $(PAYLOADS_PIC), ($(B2HTARGET_PIC) $(PAYLOAD_DIR)/$(pl_pic)_$(fw_pic).bin $(PAYLOAD_DIR)/$(pl_pic)_pic_$(fw_pic).h $(pl_pic)_$(fw_pic)); ))
- #HEX with bootloader.
- $(foreach fw_pic, $(FIRMWARES_PIC3), $(foreach pl_pic, $(PAYLOADS_PIC), ($(CCS_COMPILER) $(CCS_FLAGS_WBL) $(CCS_FLAGS_LEDS) +GFW$(fw_pic)="true" +GPAYLOAD="$(pl_pic)" $(CCS_SOURCE)); ))
+ #HEX with HID Bootloader.
+ $(foreach fw_pic, $(FIRMWARES_PIC3), $(foreach pl_pic, $(PAYLOADS_PIC), ($(CCS_COMPILER) $(CCS_FLAGS_WBLHID) $(CCS_FLAGS_LEDS) +GFW$(fw_pic)="true" +GPAYLOAD="$(pl_pic)" $(CCS_SOURCE)); echo "HID Bootloader -> Firmware: $(fw_pic) | Payload: $(pl_pic)";))
- #HEX without bootloader.
- $(foreach fw_pic, $(FIRMWARES_PIC3), $(foreach pl_pic, $(PAYLOADS_PIC), ($(CCS_COMPILER) $(CCS_FLAGS_NBL) $(CCS_FLAGS_LEDS) +GFW$(fw_pic)="true" +GPAYLOAD="$(pl_pic)" $(CCS_SOURCE)); ))
+ #HEX with MCHP Bootloader.
+ $(foreach fw_pic, $(FIRMWARES_PIC3), $(foreach pl_pic, $(PAYLOADS_PIC), ($(CCS_COMPILER) $(CCS_FLAGS_WBLMCHP) $(CCS_FLAGS_LEDS) +GFW$(fw_pic)="true" +GPAYLOAD="$(pl_pic)" $(CCS_SOURCE)); echo "MCHP Bootloader -> Firmware: $(fw_pic) | Payload: $(pl_pic)";))
+
+ #HEX without Bootloader.
+ $(foreach fw_pic, $(FIRMWARES_PIC3), $(foreach pl_pic, $(PAYLOADS_PIC), ($(CCS_COMPILER) $(CCS_FLAGS_NBL) $(CCS_FLAGS_LEDS) +GFW$(fw_pic)="true" +GPAYLOAD="$(pl_pic)" $(CCS_SOURCE)); echo "No Bootloader -> Firmware: $(fw_pic) | Payload: $(pl_pic)";))
#Create build structure.
mkdir $(BUILD_DIR)
mkdir $(BUILD_DIR)/DEF
- mkdir $(BUILD_DIR)/DEF/wBTL
+ mkdir $(BUILD_DIR)/DEF/wBTL_HID
+ mkdir $(BUILD_DIR)/DEF/wBTL_MCHP
mkdir $(BUILD_DIR)/DEF/nBTL
mkdir $(BUILD_DIR)/DEV
- mkdir $(BUILD_DIR)/DEV/wBTL
+ mkdir $(BUILD_DIR)/DEV/wBTL_HID
+ mkdir $(BUILD_DIR)/DEV/wBTL_MCHP
mkdir $(BUILD_DIR)/DEV/nBTL
mkdir $(BUILD_DIR)/NUS
- mkdir $(BUILD_DIR)/NUS/wBTL
+ mkdir $(BUILD_DIR)/NUS/wBTL_HID
+ mkdir $(BUILD_DIR)/NUS/wBTL_MCHP
mkdir $(BUILD_DIR)/NUS/nBTL
#Move each payload to its directory.
- mv *_DEFAULT_PAYLOAD_*_wBTL.hex $(BUILD_DIR)/DEF/wBTL
+ mv *_DEFAULT_PAYLOAD_*_wBTL_HID.hex $(BUILD_DIR)/DEF/wBTL_HID
+ mv *_DEFAULT_PAYLOAD_*_wBTL_MCHP.hex $(BUILD_DIR)/DEF/wBTL_MCHP
mv *_DEFAULT_PAYLOAD_*_nBTL.hex $(BUILD_DIR)/DEF/nBTL
- mv *_PAYLOAD_DEV_*_wBTL.hex $(BUILD_DIR)/DEV/wBTL
+ mv *_PAYLOAD_DEV_*_wBTL_HID.hex $(BUILD_DIR)/DEV/wBTL_HID
+ mv *_PAYLOAD_DEV_*_wBTL_MCHP.hex $(BUILD_DIR)/DEV/wBTL_MCHP
mv *_PAYLOAD_DEV_*_nBTL.hex $(BUILD_DIR)/DEV/nBTL
- mv *_PAYLOAD_NO_UNAUTH_SYSCALL_*_wBTL.hex $(BUILD_DIR)/NUS/wBTL
+ mv *_PAYLOAD_NO_UNAUTH_SYSCALL_*_wBTL_HID.hex $(BUILD_DIR)/NUS/wBTL_HID
+ mv *_PAYLOAD_NO_UNAUTH_SYSCALL_*_wBTL_MCHP.hex $(BUILD_DIR)/NUS/wBTL_MCHP
mv *_PAYLOAD_NO_UNAUTH_SYSCALL_*_nBTL.hex $(BUILD_DIR)/NUS/nBTL
#Zip all HEX.
View
6 main.c
@@ -7,10 +7,14 @@
/////////////////////////
// Bootloader Memory Space
// USB HID Bootloader
-#if defined (WBOOTLOADER)
+#if defined (WBOOTLOADERHID)
#define CODE_START 0x1000
#build(reset=CODE_START, interrupt=CODE_START+0x08)
#org 0, CODE_START-1 {}
+#elif defined (WBOOTLOADERMCHP)
+ #define CODE_START 0x800
+ #build(reset=CODE_START, interrupt=CODE_START+0x08)
+ #org 0, CODE_START-1 {}
#endif
/////////////////////////
View
6 usb_desc.h
@@ -34,8 +34,10 @@
#error Firmware not defined
#endif
-#if defined (WBOOTLOADER)
- #define BOOTLOADER_EXPORT wBTL
+#if defined (WBOOTLOADERHID)
+ #define BOOTLOADER_EXPORT wBTL_HID
+#elif defined (WBOOTLOADERMCHP)
+ #define BOOTLOADER_EXPORT wBTL_MCHP
#else
#define BOOTLOADER_EXPORT nBTL
#endif

0 comments on commit fadab8c

Please sign in to comment.