From 4cb228ae2c047759d47f5557b18c4de4912efea1 Mon Sep 17 00:00:00 2001 From: DPRCZ Date: Thu, 24 Aug 2017 20:32:11 +0200 Subject: [PATCH 1/8] mplab compilable --- PIC16F1-USB-Bootloader.mcp | 69 ++++++++++++++ PIC16F1-USB-Bootloader.mcs | 6 ++ PIC16F1-USB-Bootloader.mcw | Bin 0 -> 25088 bytes bootloader.asm | 8 +- bootloader.hex | 69 -------------- output/bootloader.map | 182 +++++++++++++++++++++++++++++++++++++ 6 files changed, 262 insertions(+), 72 deletions(-) create mode 100644 PIC16F1-USB-Bootloader.mcp create mode 100644 PIC16F1-USB-Bootloader.mcs create mode 100644 PIC16F1-USB-Bootloader.mcw delete mode 100644 bootloader.hex create mode 100644 output/bootloader.map diff --git a/PIC16F1-USB-Bootloader.mcp b/PIC16F1-USB-Bootloader.mcp new file mode 100644 index 0000000..0e74009 --- /dev/null +++ b/PIC16F1-USB-Bootloader.mcp @@ -0,0 +1,69 @@ +[HEADER] +magic_cookie={66E99B07-E706-4689-9E80-9B2582898A13} +file_version=1.0 +device=PIC16F1455 +[PATH_INFO] +BuildDirPolicy=BuildDirIsProjectDir +dir_src= +dir_bin=C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\output +dir_tmp= +dir_sin= +dir_inc= +dir_lib= +dir_lkr= +[CAT_FILTERS] +filter_src=*.asm +filter_inc=*.h;*.inc +filter_obj=*.o +filter_lib=*.lib +filter_lkr=*.lkr +[CAT_SUBFOLDERS] +subfolder_src= +subfolder_inc= +subfolder_obj= +subfolder_lib= +subfolder_lkr= +[FILE_SUBFOLDERS] +file_000=. +file_001=. +file_002=. +file_003=. +file_004=. +file_005=. +[GENERATED_FILES] +file_000=no +file_001=no +file_002=no +file_003=no +file_004=no +file_005=no +[OTHER_FILES] +file_000=no +file_001=no +file_002=no +file_003=no +file_004=no +file_005=no +[FILE_INFO] +file_000=bootloader.asm +file_001=bdt.inc +file_002=log_macros.inc +file_003=macros.inc +file_004=protocol_constants.inc +file_005=usb.inc +[SUITE_INFO] +suite_guid={6B3DAA78-59C1-46DD-B6AA-DBDAE4E06484} +suite_state=generate-absolute-code +[TOOL_SETTINGS] +TS{DD2213A8-6310-47B1-8376-9430CDFC013F}= +TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}=/o"$(BINDIR_)$(TARGETBASE).cof" /M"$(BINDIR_)$(TARGETBASE).map" /W +TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}= +[INSTRUMENTED_TRACE] +enable=0 +transport=0 +format=0 +[CUSTOM_BUILD] +Pre-Build= +Pre-BuildEnabled=1 +Post-Build= +Post-BuildEnabled=1 diff --git a/PIC16F1-USB-Bootloader.mcs b/PIC16F1-USB-Bootloader.mcs new file mode 100644 index 0000000..b8b99a5 --- /dev/null +++ b/PIC16F1-USB-Bootloader.mcs @@ -0,0 +1,6 @@ +[Header] +MagicCookie={0b13fe8c-dfe0-40eb-8900-6712719559a7} +Version=1.0 +[TOOL_LOC_STAMPS] +tool_loc{49D3CA3F-D9A3-4518-9943-226A347E8CC7}=C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe +tool_loc{96C98149-AA1B-4CF9-B967-FAE79CAB663C}=C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe diff --git a/PIC16F1-USB-Bootloader.mcw b/PIC16F1-USB-Bootloader.mcw new file mode 100644 index 0000000000000000000000000000000000000000..c0c7e60321af1627d89dc919c0808dfe5bcb24be GIT binary patch literal 25088 zcmeHPYiv}<6`oxi;s?bG*u?92n+=5oO1$9KSm30@k6mLb>|ObRBC<5Q!4Ol7y@K5? zEn9WfRw|MBfs`NcqiWr#t>{Z6A|g*I$&ac?MXg2BDoQGFt2Dx?`;giqry{uDH}{Uc zez4p%k)o>SSZ8PE%$Yee-#usUT>m(uzg;o*gXe1gsOHdiRitiCm8zvVau@1kO&+D( zsIYx=YHG?7Dut@h{}2KnVXb_|e1^p+mw@jAmw@ZQrQip_<=|!DPl1<%E5L98wF0~n zy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a/bootloader.asm b/bootloader.asm index 43314e2..f8adfef 100644 --- a/bootloader.asm +++ b/bootloader.asm @@ -189,7 +189,8 @@ _bootloader_interrupt banksel UIR bcf UIR,URSTIF ; clear the flag ; service transactions -_utrans banksel UIR +_utrans + banksel UIR btfss UIR,TRNIF goto _usdone movfw USTAT ; stash the status in a temp register @@ -201,7 +202,8 @@ _utrans banksel UIR call usb_service_ep0 ; handle the control message goto _utrans ; clear USB interrupt -_usdone banksel PIR2 +_usdone + banksel PIR2 bcf PIR2,USBIF retfie _ucdc call usb_service_cdc ; USTAT value is still in FSR1H @@ -726,7 +728,7 @@ app_is_present clrf FSR0L movlw (high APP_ENTRY_POINT)|0x80 ; need to set high bit to indicate program memory movwf FSR0H - moviw FSR0 + moviw 0[FSR0] incw ; if W was 0xFF, it'll be 0 now return ; Z flag will be unset if app code is present diff --git a/bootloader.hex b/bootloader.hex deleted file mode 100644 index f03673b..0000000 --- a/bootloader.hex +++ /dev/null @@ -1,69 +0,0 @@ -:020000040000FA -:1000000021009513210036293F00EF0803190A2823 -:100010008231042A3D00101C12286521210012158E -:100020003D0010103D00901D1E280F088700901104 -:1000300020007839031D21282520122820001211C4 -:100040000900C62012288B172428071988282008A1 -:100050003C39343C031D452830103808B81F301493 -:100060000630390203195B28053039020319792853 -:100070000930390203197B28083039020319812815 -:100080003D000E1220000C3054200C30A00008302F -:10009000A100A01708003D000E12200030185728BC -:1000A0009620483046204830A400A4170800A41326 -:1000B000A5010C30522802303B0203196B28033093 -:1000C0003B0203196F2801303B02031D4028A13079 -:1000D000B10012307228B330B10043307228F630CC -:1000E000B1000A30B2003E0203184B283E08B200AD -:1000F0004B28B0144B283011BA08031D3015BE2010 -:100100004B28BF303019013EB1000130B2004B28FE -:1001100030188F2896200830241F09175428B01C47 -:100120000800B0103A083D0096000800A413A5018D -:10013000B20803190800310884008130850020309E -:100140008600203087000301083C0319AD28120007 -:100150001E00A50A2508B20BA4280408B100BB3074 -:100160000402031DB628331847170800C3300402E1 -:10017000031D080033080910C00008002000D52026 -:100180000301AD01AC05AC06AC1708004030071AFE -:1001900008000719C128A9080319D528AC13DA20CB -:1001A0002000C9000130AD00AC174030A900A80103 -:1001B000A8170800043029020319EC28403029024E -:1001C00003190029013029020319E72802345230AB -:1001D0004A02031D023401004C08C8004D08860085 -:1001E0004A0887004B082300920007089100453019 -:1001F0000602031D0134143095002E21151101341F -:10020000480886002A3084002030850024302300EE -:1002100095002030870012008607930012008607A1 -:1002200094008703031917292E21910A0B299501A0 -:100230008608031D033415152E2195018716151404 -:100240000000000011001402031D04341100130209 -:10025000031D04349103870B1F2901345530960088 -:10026000AA3096009514000000000800FC309900A8 -:1002700051301A05513C031D3829542103194629D0 -:1002800020008C1D462921009517002A2700903058 -:100290009B0065213D008E01210012150B173D00CA -:1002A0008E158E1D50292328840182308500003F41 -:1002B000013E080020003330B30054210319080028 -:1002C000022281312000B3000800210012113D00FC -:1002D000930190019B019C019D019E019F0197014B -:1002E00014309100093092008401203085006A307A -:1002F000870000301A00870B7A295A213D000E171B -:1003000096010E120E13901D882990113521832914 -:10031000163098001E3099001A309A0020001830CC -:10032000A2002030A6002A30AA002930AE002030DA -:0A033000A300A700AB00AF004528B2 -:0E03420012340134003402340234003400342A -:10035000083450341D34EE34EE34013400340034AB -:10036000003401340134093402344334003402349B -:10037000013400348034113409340434003400343E -:10038000013402340234013400340534243400349E -:100390001034013404342434023402340534243457 -:1003A000063400340134053424340134003401347B -:1003B0000734053482340334083400347F3409347C -:1003C00004340134003402340A340034003400347C -:1003D00007340534813402344034003400340734A7 -:1003E0000534013402344034003400340A34033418 -:1003F000303400343034003430340034313400349C -:020000040001F9 -:02000E008C0F55 -:02001000CE1F01 -:00000001FF diff --git a/output/bootloader.map b/output/bootloader.map new file mode 100644 index 0000000..71e9a1f --- /dev/null +++ b/output/bootloader.map @@ -0,0 +1,182 @@ +MPLINK 4.49, Linker +Linker Map File - Created Thu Aug 24 20:30:33 2017 + + Section Info + Section Type Address Location Size(Bytes) + --------- --------- --------- --------- --------- + .org_0 code 0x000000 program 0x000000 + .org_1 code 0x000000 program 0x000008 + .org_2 code 0x000004 program 0x000332 + .org_3 code 0x0001a1 program 0x0000be +.config_8007_BOOTLOADER.O code 0x008007 program 0x000002 +.config_8008_BOOTLOADER.O code 0x008008 program 0x000002 + + + + Program Memory Usage + Start End + --------- --------- + 0x000000 0x00019c + 0x0001a1 0x0001ff + 0x008007 0x008008 + 510 out of 8199 program addresses used, program memory utilization is 6% + + + + Symbols - Sorted by Name + Name Address Location Storage File + --------- --------- --------- --------- --------- +ABSTRACT_CONTROL_MANAGEMENT_FUNC 0x0001ca program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +CALL_MANAGEMENT_FUNCTIONAL_DESCR 0x0001d3 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + CONFIGURATION_0_CONSTANT 0x0001bf program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + CONFIGURATION_1_CONSTANT 0x0001c0 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + CONFIGURATION_DESCRIPTOR 0x0001b3 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + DEVICE_DESCRIPTOR 0x0001a1 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ENDPOINT_DESCRIPTOR_1_IN 0x0001e8 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +ENDPOINT_DESCRIPTOR_1_OUT 0x0001ef program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ENDPOINT_DESCRIPTOR_2_IN 0x0001d8 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +HEADER_FUNCTIONAL_DESCRIPTOR 0x0001c5 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + INTERFACE_DESCRIPTOR_0 0x0001bc program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + INTERFACE_DESCRIPTOR_1 0x0001df program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + INTERRUPT_VECT 0x000004 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + RESET_VECT 0x000000 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +SERIAL_NUMBER_STRING_DESCRIPTOR 0x0001f6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +UNION_FUNCTIONAL_DESCRIPTOR 0x0001ce program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _armbfs 0x000052 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bcdone 0x0000ad program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bcopy 0x0000a4 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_erase 0x0000fb program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_interrupt 0x00000a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_main 0x000146 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_reset 0x0000e7 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_set_params 0x0000ec program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_write 0x000100 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_config_bmattributes 0x0000af program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_config_bmaxpower 0x0000b6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_pending_address 0x00008f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _config_descriptor 0x00006b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _cread 0x000050 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _cwrite 0x000057 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _device_descriptor 0x000067 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _initep 0x000188 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _loop 0x000024 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _ramclr 0x00017a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_set_data_in_count_from_w 0x000072 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _string_descriptor 0x00006f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _tflush 0x000183 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _ucdc 0x000021 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_attach 0x00014a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_complete 0x00004b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_in 0x000088 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_invalid 0x000040 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_setup 0x00002c program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_get_configuration 0x000081 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_get_descriptor 0x00005b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_set_address 0x000079 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_set_configuration 0x00007b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usben 0x000150 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usdone 0x00001e program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _utrans 0x000012 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _vloop 0x00011f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wcksum 0x000117 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wdone 0x0000fe program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wloop 0x00010b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wosc 0x000138 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + app_is_present 0x000154 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_in_with_flags 0x000054 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_out 0x000045 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_out_with_flags 0x000046 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep1_in 0x0000c1 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep1_out 0x0000d5 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + bootloader_exec_cmd 0x0000da program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + bootloader_main_loop 0x000023 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + bootloader_start 0x000136 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + cdc_init 0x0000be program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ep0_read_in 0x000096 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + flash_unlock 0x00012e program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + get_app_power_config 0x00015a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ret 0x000135 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + usb_init 0x000165 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + usb_service_cdc 0x0000c6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + usb_service_ep0 0x000025 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + + + + Symbols - Sorted by Address + Name Address Location Storage File + --------- --------- --------- --------- --------- + RESET_VECT 0x000000 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + INTERRUPT_VECT 0x000004 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_interrupt 0x00000a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _utrans 0x000012 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usdone 0x00001e program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _ucdc 0x000021 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + bootloader_main_loop 0x000023 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _loop 0x000024 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + usb_service_ep0 0x000025 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_setup 0x00002c program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_invalid 0x000040 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_out 0x000045 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_out_with_flags 0x000046 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_complete 0x00004b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _cread 0x000050 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _armbfs 0x000052 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_in_with_flags 0x000054 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _cwrite 0x000057 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_get_descriptor 0x00005b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _device_descriptor 0x000067 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _config_descriptor 0x00006b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _string_descriptor 0x00006f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_set_data_in_count_from_w 0x000072 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_set_address 0x000079 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_set_configuration 0x00007b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_get_configuration 0x000081 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_in 0x000088 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_pending_address 0x00008f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ep0_read_in 0x000096 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bcopy 0x0000a4 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bcdone 0x0000ad program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_config_bmattributes 0x0000af program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_config_bmaxpower 0x0000b6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + cdc_init 0x0000be program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep1_in 0x0000c1 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + usb_service_cdc 0x0000c6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep1_out 0x0000d5 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + bootloader_exec_cmd 0x0000da program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_reset 0x0000e7 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_set_params 0x0000ec program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_erase 0x0000fb program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wdone 0x0000fe program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_write 0x000100 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wloop 0x00010b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wcksum 0x000117 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _vloop 0x00011f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + flash_unlock 0x00012e program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ret 0x000135 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + bootloader_start 0x000136 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wosc 0x000138 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_main 0x000146 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_attach 0x00014a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usben 0x000150 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + app_is_present 0x000154 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + get_app_power_config 0x00015a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + usb_init 0x000165 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _ramclr 0x00017a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _tflush 0x000183 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _initep 0x000188 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + DEVICE_DESCRIPTOR 0x0001a1 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + CONFIGURATION_DESCRIPTOR 0x0001b3 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + INTERFACE_DESCRIPTOR_0 0x0001bc program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + CONFIGURATION_0_CONSTANT 0x0001bf program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + CONFIGURATION_1_CONSTANT 0x0001c0 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +HEADER_FUNCTIONAL_DESCRIPTOR 0x0001c5 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +ABSTRACT_CONTROL_MANAGEMENT_FUNC 0x0001ca program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +UNION_FUNCTIONAL_DESCRIPTOR 0x0001ce program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +CALL_MANAGEMENT_FUNCTIONAL_DESCR 0x0001d3 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ENDPOINT_DESCRIPTOR_2_IN 0x0001d8 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + INTERFACE_DESCRIPTOR_1 0x0001df program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ENDPOINT_DESCRIPTOR_1_IN 0x0001e8 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +ENDPOINT_DESCRIPTOR_1_OUT 0x0001ef program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +SERIAL_NUMBER_STRING_DESCRIPTOR 0x0001f6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + + From 8cd96c6bb9c1fa1c8da3ff96b9e0b00f132d640a Mon Sep 17 00:00:00 2001 From: DPRCZ Date: Thu, 24 Aug 2017 20:41:40 +0200 Subject: [PATCH 2/8] Works with Windows 10 now --- PIC16F1-USB-Bootloader.mcw | Bin 25088 -> 25600 bytes bootloader.asm | 8 +- output/bootloader.map | 204 ++++++++++++++++++------------------- 3 files changed, 108 insertions(+), 104 deletions(-) diff --git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v#nu9TJmGO1L@9+z)as)c_ zN6wi?#y@ssT6KpFh}x;k+G*T4eHZFw;+}E80(gtM2LXq0XUAL`JASz28R)Ak{o=m; z*if$ve_n~R3kH1N#>Dc`Vf8n+_^bU)Ow#Be7V_KPh44>qdVe?GAa=Qgem4LMm%`E) zSB-xb@DKh->&(=|Rb&3p<&l|j$~=;Gb$eVb$(Jsf3)JG}LZgU@N$F`hhd z&fH&d<$klz17oVSbQ=2ccU$F{zwwI0WJM*QM-AR%5X1(o$Bub#7~>)I>Odevice? bsf USB_STATE,IS_CONTROL_WRITE ; if so, this is a control write @@ -346,8 +349,9 @@ _set_data_in_count_from_w movwf EP0_DATA_IN_COUNT ; the count needs to be set to the minimum of the descriptor's length (in W) ; and the requested length - subwf BANKED_EP0OUT_BUF+wLengthL,w ; just ignore high byte... - bc _usb_ctrl_complete ; if W <= f, no need to adjust + tstf BANKED_EP0OUT_BUF+wLengthH ; test high byte... + bnz _usb_ctrl_complete ; use length of descriptor + movfw BANKED_EP0OUT_BUF+wLengthL movwf EP0_DATA_IN_COUNT goto _usb_ctrl_complete diff --git a/output/bootloader.map b/output/bootloader.map index 71e9a1f..bb1e07e 100644 --- a/output/bootloader.map +++ b/output/bootloader.map @@ -1,12 +1,12 @@ MPLINK 4.49, Linker -Linker Map File - Created Thu Aug 24 20:30:33 2017 +Linker Map File - Created Thu Aug 24 20:40:28 2017 Section Info Section Type Address Location Size(Bytes) --------- --------- --------- --------- --------- .org_0 code 0x000000 program 0x000000 .org_1 code 0x000000 program 0x000008 - .org_2 code 0x000004 program 0x000332 + .org_2 code 0x000004 program 0x000336 .org_3 code 0x0001a1 program 0x0000be .config_8007_BOOTLOADER.O code 0x008007 program 0x000002 .config_8008_BOOTLOADER.O code 0x008008 program 0x000002 @@ -16,10 +16,10 @@ Linker Map File - Created Thu Aug 24 20:30:33 2017 Program Memory Usage Start End --------- --------- - 0x000000 0x00019c + 0x000000 0x00019e 0x0001a1 0x0001ff 0x008007 0x008008 - 510 out of 8199 program addresses used, program memory utilization is 6% + 512 out of 8199 program addresses used, program memory utilization is 6% @@ -42,62 +42,62 @@ HEADER_FUNCTIONAL_DESCRIPTOR 0x0001c5 program static C:\Users\User\Docu RESET_VECT 0x000000 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm SERIAL_NUMBER_STRING_DESCRIPTOR 0x0001f6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm UNION_FUNCTIONAL_DESCRIPTOR 0x0001ce program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _armbfs 0x000052 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bcdone 0x0000ad program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bcopy 0x0000a4 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bootloader_erase 0x0000fb program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _armbfs 0x000054 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bcdone 0x0000af program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bcopy 0x0000a6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_erase 0x0000fd program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm _bootloader_interrupt 0x00000a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bootloader_main 0x000146 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bootloader_reset 0x0000e7 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bootloader_set_params 0x0000ec program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bootloader_write 0x000100 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm -_check_for_config_bmattributes 0x0000af program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm -_check_for_config_bmaxpower 0x0000b6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm -_check_for_pending_address 0x00008f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _config_descriptor 0x00006b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _cread 0x000050 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _cwrite 0x000057 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _device_descriptor 0x000067 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _initep 0x000188 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_main 0x000148 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_reset 0x0000e9 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_set_params 0x0000ee program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_write 0x000102 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_config_bmattributes 0x0000b1 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_config_bmaxpower 0x0000b8 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_pending_address 0x000091 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _config_descriptor 0x00006d program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _cread 0x000052 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _cwrite 0x000059 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _device_descriptor 0x000069 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _initep 0x00018a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm _loop 0x000024 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _ramclr 0x00017a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm -_set_data_in_count_from_w 0x000072 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _string_descriptor 0x00006f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _tflush 0x000183 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _ramclr 0x00017c program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_set_data_in_count_from_w 0x000074 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _string_descriptor 0x000071 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _tflush 0x000185 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm _ucdc 0x000021 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_attach 0x00014a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_ctrl_complete 0x00004b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_ctrl_in 0x000088 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_ctrl_invalid 0x000040 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_attach 0x00014c program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_complete 0x00004d program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_in 0x00008a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_invalid 0x000042 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm _usb_ctrl_setup 0x00002c program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_get_configuration 0x000081 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_get_descriptor 0x00005b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_set_address 0x000079 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_set_configuration 0x00007b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usben 0x000150 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_get_configuration 0x000083 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_get_descriptor 0x00005d program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_set_address 0x00007b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_set_configuration 0x00007d program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usben 0x000152 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm _usdone 0x00001e program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm _utrans 0x000012 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _vloop 0x00011f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _wcksum 0x000117 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _wdone 0x0000fe program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _wloop 0x00010b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _wosc 0x000138 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - app_is_present 0x000154 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - arm_ep0_in_with_flags 0x000054 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - arm_ep0_out 0x000045 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - arm_ep0_out_with_flags 0x000046 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - arm_ep1_in 0x0000c1 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - arm_ep1_out 0x0000d5 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - bootloader_exec_cmd 0x0000da program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _vloop 0x000121 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wcksum 0x000119 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wdone 0x000100 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wloop 0x00010d program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wosc 0x00013a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + app_is_present 0x000156 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_in_with_flags 0x000056 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_out 0x000047 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_out_with_flags 0x000048 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep1_in 0x0000c3 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep1_out 0x0000d7 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + bootloader_exec_cmd 0x0000dc program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm bootloader_main_loop 0x000023 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - bootloader_start 0x000136 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - cdc_init 0x0000be program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - ep0_read_in 0x000096 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - flash_unlock 0x00012e program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - get_app_power_config 0x00015a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - ret 0x000135 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - usb_init 0x000165 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - usb_service_cdc 0x0000c6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + bootloader_start 0x000138 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + cdc_init 0x0000c0 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ep0_read_in 0x000098 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + flash_unlock 0x000130 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + get_app_power_config 0x00015c program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ret 0x000137 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + usb_init 0x000167 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + usb_service_cdc 0x0000c8 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm usb_service_ep0 0x000025 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm @@ -115,55 +115,55 @@ _set_data_in_count_from_w 0x000072 program static C:\Users\User\Documen _loop 0x000024 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm usb_service_ep0 0x000025 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm _usb_ctrl_setup 0x00002c program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_ctrl_invalid 0x000040 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - arm_ep0_out 0x000045 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - arm_ep0_out_with_flags 0x000046 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_ctrl_complete 0x00004b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _cread 0x000050 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _armbfs 0x000052 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - arm_ep0_in_with_flags 0x000054 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _cwrite 0x000057 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_get_descriptor 0x00005b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _device_descriptor 0x000067 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _config_descriptor 0x00006b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _string_descriptor 0x00006f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm -_set_data_in_count_from_w 0x000072 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_set_address 0x000079 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_set_configuration 0x00007b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_get_configuration 0x000081 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_ctrl_in 0x000088 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm -_check_for_pending_address 0x00008f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - ep0_read_in 0x000096 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bcopy 0x0000a4 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bcdone 0x0000ad program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm -_check_for_config_bmattributes 0x0000af program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm -_check_for_config_bmaxpower 0x0000b6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - cdc_init 0x0000be program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - arm_ep1_in 0x0000c1 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - usb_service_cdc 0x0000c6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - arm_ep1_out 0x0000d5 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - bootloader_exec_cmd 0x0000da program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bootloader_reset 0x0000e7 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bootloader_set_params 0x0000ec program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bootloader_erase 0x0000fb program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _wdone 0x0000fe program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bootloader_write 0x000100 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _wloop 0x00010b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _wcksum 0x000117 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _vloop 0x00011f program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - flash_unlock 0x00012e program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - ret 0x000135 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - bootloader_start 0x000136 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _wosc 0x000138 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _bootloader_main 0x000146 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usb_attach 0x00014a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _usben 0x000150 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - app_is_present 0x000154 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - get_app_power_config 0x00015a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - usb_init 0x000165 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _ramclr 0x00017a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _tflush 0x000183 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm - _initep 0x000188 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_invalid 0x000042 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_out 0x000047 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_out_with_flags 0x000048 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_complete 0x00004d program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _cread 0x000052 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _armbfs 0x000054 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep0_in_with_flags 0x000056 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _cwrite 0x000059 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_get_descriptor 0x00005d program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _device_descriptor 0x000069 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _config_descriptor 0x00006d program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _string_descriptor 0x000071 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_set_data_in_count_from_w 0x000074 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_set_address 0x00007b program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_set_configuration 0x00007d program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_get_configuration 0x000083 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_ctrl_in 0x00008a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_pending_address 0x000091 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ep0_read_in 0x000098 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bcopy 0x0000a6 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bcdone 0x0000af program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_config_bmattributes 0x0000b1 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm +_check_for_config_bmaxpower 0x0000b8 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + cdc_init 0x0000c0 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep1_in 0x0000c3 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + usb_service_cdc 0x0000c8 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + arm_ep1_out 0x0000d7 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + bootloader_exec_cmd 0x0000dc program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_reset 0x0000e9 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_set_params 0x0000ee program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_erase 0x0000fd program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wdone 0x000100 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_write 0x000102 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wloop 0x00010d program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wcksum 0x000119 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _vloop 0x000121 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + flash_unlock 0x000130 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + ret 0x000137 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + bootloader_start 0x000138 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _wosc 0x00013a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _bootloader_main 0x000148 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usb_attach 0x00014c program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _usben 0x000152 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + app_is_present 0x000156 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + get_app_power_config 0x00015c program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + usb_init 0x000167 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _ramclr 0x00017c program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _tflush 0x000185 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm + _initep 0x00018a program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm DEVICE_DESCRIPTOR 0x0001a1 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm CONFIGURATION_DESCRIPTOR 0x0001b3 program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm INTERFACE_DESCRIPTOR_0 0x0001bc program static C:\Users\User\Documents\GitHub\PIC16F1-USB-Bootloader\bootloader.asm From f42df63691e2a49a5494a7ca71f31fcec396d741 Mon Sep 17 00:00:00 2001 From: DPRCZ Date: Thu, 24 Aug 2017 21:08:55 +0200 Subject: [PATCH 3/8] xc8 jumps --- PIC16F1-USB-Bootloader.mcw | Bin 25600 -> 25600 bytes bootloader.asm | 14 ++++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/PIC16F1-USB-Bootloader.mcw b/PIC16F1-USB-Bootloader.mcw index 761aa69580a47114a2feac10f6d41e6bca6093bf..d959535d066b335848979838d2c92cfc222963a5 100644 GIT binary patch delta 286 zcmZoT!PszuaYGIZ>jM`1FrLkYEU%gQr?40@#OO+ui!sEO0@;)K6LKft;7DNZVv(C{ z&Dqbypg#EwX9hD!%ACuPaqZ+xuF1>+-vlQA=eo+o&^Y-Tw-S)r{ENGoljX1l$W+nK zF1!xAjKg?jFEfJa&4p2`85uby%f`4fvQAEo31(tgGI>{w3eyI@$q!;gJURY~vIa0f zK*Ewk{2=y@?~)83fLP>*B*UDuHKn&X4a*rpN`Uep>JCtxqkJ#_f`y0pQ$PYhz&hDB z)}BdV$>h3NJxP$l*RMotK(scqGlL*dH^?H!$(Dl3e4fk<41GWm9(D!>3zp5_V!7A= DH4{`H delta 285 zcmZoT!PszuaYGIZ>xU+V2^^aXSza^qA7c?@h|!fQ7h{Mm1+pjeC*)4P!I8ksz#=}` znzNsYLx1ua&J1RdlsT6nW9#HhuF1>_SNJFY=eo+2P(Jw@w-S)r{ENGobMjk$;mr-A zPh5B#){0KxkiEJxP$l*RMotK(scqGlL*dH^?H!$(Dl3e2=2048 - pagesel APP_ENTRY_POINT - endif + +; banksel ANSELA ;enable analog function on pin +; bsf ANSELA,ANSA3 + + movlp high APP_ENTRY_POINT ; attempt to appease certain user apps goto APP_ENTRY_POINT ; Not entering application code: initialize the USB interface and wait for commands. From b94df812e2d867608fc69797cb5fe8201d4af143 Mon Sep 17 00:00:00 2001 From: DPRCZ Date: Thu, 24 Aug 2017 21:22:24 +0200 Subject: [PATCH 4/8] Add switch for APP_POWER_CONFIG --- PIC16F1-USB-Bootloader.mcw | Bin 25600 -> 26112 bytes bootloader.asm | 8 +++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PIC16F1-USB-Bootloader.mcw b/PIC16F1-USB-Bootloader.mcw index d959535d066b335848979838d2c92cfc222963a5..497a3a931eb7bb6a14fd9904a9211fa071543122 100644 GIT binary patch delta 1325 zcmdT?Ur19?82`@Mj%=fLoK0z^v`|7xhqu(UX-=neg0|@j@m&};Y*{d%Pdh8|dhzUtwesaouhVE~`_$b1QXhbw2jv<;6KE%e| zo~*E0>TJU!<7#Ut6zvKLpQV`JG#>`FYR_a5XgbD%$IgpYOU(3`6$`KR((YhuHv5VW zWNu_!KmllnnL&C1G_hhGHA%w}n?h2_v$pGuxyLn+U99ul#3ZieXA4@|+Iu}Mk?uUK zAJQi-=o4bb@rjP+C8r9$(@lADtT5BI^UmDKTt~SzIdRh=nnw9J7ffF5}cs7px(izg+O(OY6n_0u7?Ib#I+kd2~MCRNZD rz_|u$5gt4_js-znJnh}?j}Z7Dk8lr!E%su&Uq$1;TtzZ}Fim~~Va`;4 delta 905 zcmZoT!`N_wal-+o%}1DQ7$+vMOk&C5d%$8J#v^-~k(q&k!GUjc6-ydOT7i*^4JhDW zT2fG2GKs@%vIB<<{}dKOh8SI`axsS3QXqS>d{XY@8ypGDT`Y2wtvM?tOmzPL-_Mlz zx#hDY0}}%SlRFD5!XXlKW-x;^m~$C2uHBr;)y&EoASE?{WAaD-enzIrjROCL zQc{azoc#SmeEc0SB=LrnSKA;E>I|G9S%j9pdJ3?XvS%79_n8XOK`pj4g zGVg$Hj3CHfFq=n*HG@}&RY8`qbccP6po|b>Dabt_^(SIt1U2Mi1VL=&*d>K)-b*t0 z1JyAkO=gN$;fWFa?*>r}6flZc3uIWipC5!De2`=S=~bxM%g?cNKinU3APa%OfFqFs zWPih=WG02>`}vtUV+29s=<4|=uZ)*=bGWFV01VAX7G^a}jFY93whZ;4u%RR Date: Thu, 24 Aug 2017 23:56:55 +0200 Subject: [PATCH 5/8] Debug --- PIC16F1-USB-Bootloader.mcp | 2 +- PIC16F1-USB-Bootloader.mcw | Bin 26112 -> 930304 bytes bootloader.asm | 179 ++++++++++++++++++------------------ output/bootloader.map | 182 ------------------------------------- 4 files changed, 90 insertions(+), 273 deletions(-) delete mode 100644 output/bootloader.map diff --git a/PIC16F1-USB-Bootloader.mcp b/PIC16F1-USB-Bootloader.mcp index 0e74009..1a98e0a 100644 --- a/PIC16F1-USB-Bootloader.mcp +++ b/PIC16F1-USB-Bootloader.mcp @@ -56,7 +56,7 @@ suite_guid={6B3DAA78-59C1-46DD-B6AA-DBDAE4E06484} suite_state=generate-absolute-code [TOOL_SETTINGS] TS{DD2213A8-6310-47B1-8376-9430CDFC013F}= -TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}=/o"$(BINDIR_)$(TARGETBASE).cof" /M"$(BINDIR_)$(TARGETBASE).map" /W +TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}=/m"$(BINDIR_)$(TARGETBASE).map" /w /o"$(BINDIR_)$(TARGETBASE).cof" TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}= [INSTRUMENTED_TRACE] enable=0 diff --git a/PIC16F1-USB-Bootloader.mcw b/PIC16F1-USB-Bootloader.mcw index 497a3a931eb7bb6a14fd9904a9211fa071543122..ca40a755857f86b8e3b18eb8ef10770bbc258f96 100644 GIT binary patch delta 8474 zcmeI%XOt90*eKxHL|Vdh+D77`Zj+-h&4Z{wFGhLZQl3p(@pQk?Pc-CNEKo+Pusw)S)i*s2>U?gn7+S7qI=*XLNqBC81i>`E|J3T_>L!q96Ui9W| z`p}nt^k)DA8N@pzF_?+bonw}^JhL!=a`))-Q5i0zd@|ImXwE+Iq2|5C;XJLogb$@k zjH;ZXUARK(O5sA$X`_zs%^7Z)Hg^GgKP(aIV88W|t*#BbmLoK1Y|GBoqhlU!3vW+d zp!kq~+l8LE*{pX@jZSD(Ai0&HrhT|&yZ__tRP}m}P~AqQ`-JnR$&wWGSkQ`%kxI?fl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m;N!xJD!{F5v*^Ff5XYn{upAhynV{j#@qqBVbO5BsldjMTXgV2~~!e z-kW%3mNIiLiDO(mLBV< zK4gZgk{fxwPj+&--11L1d@=`;TtX-22@Is-b!byzS?Vu;y{ON)>-DccwBeR?BKj>p z4_7E#Zc+ohSc@h^Dk`bwI7TfFU*l{iqW7c5$h$}{|7~;98238tc;G3;|4tApyU|tbOp=Q*-OoQ+%Aieg5}rt z>iu@`QJxx|mnkqAt{2AUaWY&aT$gbr>}V-rE-9ol>7vHwWnNFv&HkWpY`fw9yY9r2 zDUjsv5u`q+E)#A{PRk?Y+Q9+(R6H38a_^o7V4% diff --git a/bootloader.asm b/bootloader.asm index 6d1eff3..df8033e 100644 --- a/bootloader.asm +++ b/bootloader.asm @@ -49,9 +49,14 @@ ; With logging enabled, the bootloader will not fit in 512 words. ; Use this only for debugging! ; For more info, see log_macros.inc and log.asm. -LOGGING_ENABLED equ 0 - +LOGGING_ENABLED equ 0 +; Overdrive data in descriptor by app +ENABLE_POWER_CONFIG equ 0 +; Bootloader switch definition RA3 +USE_RA3_SWITCH equ 0 +; Bootloader switch definition RC3 (external pull-up need for this pin) +USE_RC3_SWITCH equ 1 radix dec list n=0,st=off @@ -100,6 +105,7 @@ ALL_DESCS_TOTAL_LEN equ DEVICE_DESC_LEN+CONFIG_DESC_TOTAL_LEN+SERIAL_NUM_DESC_LE EP0_BUF_SIZE equ 8 ; endpoint 0 buffer size EP1_OUT_BUF_SIZE equ 64 ; endpoint 1 OUT (CDC data) buffer size EP1_IN_BUF_SIZE equ 1 ; endpoint 1 IN (CDC data) buffer size (only need 1 byte to return status codes) +EP2_IN_BUF_SIZE equ 1 ; endpoint 2 IN (CDC data) buffer size ; Since we're only using 5 endpoints, use the BDT area for buffers, ; and use the 4 bytes normally occupied by the EP2 OUT buffer descriptor for variables. @@ -122,6 +128,9 @@ BANKED_EP1IN_BUF equ BANKED_EP0IN_BUF+EP0_BUF_SIZE+EXTRA_VARS_LEN EP1OUT_BUF equ EP1IN_BUF+EP1_IN_BUF_SIZE ; only use 1 byte for EP1 IN BANKED_EP1OUT_BUF equ BANKED_EP1IN_BUF+EP1_IN_BUF_SIZE +EP2IN_BUF equ EP1OUT_BUF+EP1_OUT_BUF_SIZE ; only use 1 byte for EP2 IN +BANKED_EP2IN_BUF equ BANKED_EP1OUT_BUF+EP1_OUT_BUF_SIZE + ; High byte of all endpoint buffers. EPBUF_ADRH equ (EP0OUT_BUF>>8) if ((EP0IN_BUF>>8) != (EP0OUT_BUF>>8)) || ((EP1OUT_BUF>>8) != (EP0OUT_BUF>>8)) || ((EP1IN_BUF>>8) != (EP0OUT_BUF>>8)) @@ -153,81 +162,18 @@ DEVICE_CONFIGURED equ 2 ; the device is configured org 0x0000 RESET_VECT ; Enable weak pull-ups +#if USE_RA3_SWITCH banksel OPTION_REG bcf OPTION_REG,NOT_WPUEN +#endif banksel OSCCON goto bootloader_start ; to be continued further down in the file org 0x0004 INTERRUPT_VECT -; check the high byte of the return address (at the top of the stack) - banksel TOSH - if LOGGING_ENABLED -; for 4k-word mode: if TOSH < 0x10, we're in the bootloader -; if TOSH >= 0x10, jump to the application interrupt handler - movlw high BOOTLOADER_SIZE - subwf TOSH,w - bnc _bootloader_interrupt - else -; for 512-word mode: if TOSH == 0, we're in the bootloader -; if TOSH != 0, jump to the application interrupt handler - tstf TOSH - bz _bootloader_interrupt - endif - movlp high APP_INTERRUPT ; XC8 *expects* this goto APP_INTERRUPT -; executing from the bootloader? it's a USB interrupt -_bootloader_interrupt - banksel UIR -; reset? - btfss UIR,URSTIF - goto _utrans ; not a reset? just start servicing transactions - call usb_init ; if so, reset the USB interface (clears interrupts) - banksel PIE2 - bsf PIE2,USBIE ; reenable USB interrupts - banksel UIR - bcf UIR,URSTIF ; clear the flag -; service transactions -_utrans - banksel UIR - btfss UIR,TRNIF - goto _usdone - movfw USTAT ; stash the status in a temp register - movwf FSR1H - bcf UIR,TRNIF ; clear flag and advance USTAT fifo - banksel BANKED_EP0OUT_STAT - andlw b'01111000' ; check endpoint number - bnz _ucdc ; if not endpoint 0, it's a CDC message - call usb_service_ep0 ; handle the control message - goto _utrans -; clear USB interrupt -_usdone - banksel PIR2 - bcf PIR2,USBIF - retfie -_ucdc call usb_service_cdc ; USTAT value is still in FSR1H - goto _utrans - - - -;;; Idle loop. In bootloader mode, the MCU just spins here, and all USB -;;; communication is interrupt-driven. -;;; This snippet is deliberately located within the first 256 words of program -;;; memory, so we can easily check in the interrupt handler if the interrupt -;;; occurred while executing application code or bootloader code. -;;; (TOSH will be 0x00 when executing bootloader code, i.e. this snippet) -bootloader_main_loop - bsf INTCON,GIE ; enable interrupts -_loop - if LOGGING_ENABLED -; Print any pending characters in the log - call log_service - endif - goto _loop - - ;;; Handles a control transfer on endpoint 0. ;;; arguments: expects USTAT value in FSR1H @@ -443,7 +389,7 @@ _bcopy sublw EP0_BUF_SIZE ; have we filled the buffer? _bcdone movfw FSR0L movwf EP0_DATA_IN_PTR -#ifdef ENABLE_POWER_CONFIG +#if ENABLE_POWER_CONFIG ; if we're sending the configuration descriptor, we need to inject the app's ; values for bus power/self power and max current consumption _check_for_config_bmattributes @@ -502,6 +448,7 @@ usb_service_cdc bz arm_ep1_out ; (just ignore them and rearm the OUT buffer) bcf BANKED_EP1IN_STAT,UOWN call bootloader_exec_cmd ; execute command; status returned in W + banksel BANKED_EP1IN_BUF movwf BANKED_EP1IN_BUF ; copy status to IN buffer movlw 1 @@ -678,9 +625,18 @@ _wosc movlw (1< Date: Fri, 25 Aug 2017 00:02:07 +0200 Subject: [PATCH 6/8] Tipo --- PIC16F1-USB-Bootloader.mcw | Bin 930304 -> 930304 bytes bootloader.asm | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/PIC16F1-USB-Bootloader.mcw b/PIC16F1-USB-Bootloader.mcw index ca40a755857f86b8e3b18eb8ef10770bbc258f96..0a81779288ee78f5934ea12affc429298830c5f5 100644 GIT binary patch delta 951 zcmZWoZAcSw82{hx_NEgj>fEgcqN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W}71w z8)7OxS{P%y-~C!wqc7#LgJ66ka@GwXu&!cQ%xRCUya@tH-7qKzG6!IK8C()-o6-*#X5LeUF zwk&N4(Gu244;wrF3-ZxcA+(5Dths>wGg?gqNn8fCmed)l50&z6#aLSy{<9{6<*Q4k zM+-Jv0hNU?zMmu`hFhn8=-f&hN_M}3G34kg828&Z2hjij70}$3)I&_XH$Gw6dX`)> zy(QKhF5wU?JRdhM#>|O8p5n-f&dtZn#dC~mNuYg`?^|4onQsI-h5{W7f<device? From 2b1afd650dffe1352e8e77860c385cbf80a6b57b Mon Sep 17 00:00:00 2001 From: DPRCZ Date: Sun, 27 Aug 2017 18:21:31 +0200 Subject: [PATCH 7/8] Length of request descriptor is random. :-( --- bootloader.asm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bootloader.asm b/bootloader.asm index 2b5e138..94b0ac0 100644 --- a/bootloader.asm +++ b/bootloader.asm @@ -296,9 +296,11 @@ _set_data_in_count_from_w movwf EP0_DATA_IN_COUNT ; the count needs to be set to the minimum of the descriptor's length (in W) ; and the requested length - tstf BANKED_EP0OUT_BUF+wLengthH ; test high byte... - bnz _usb_ctrl_complete ; use length of descriptor + tstf BANKED_EP0OUT_BUF+wLengthH ; test high byte... + bnz _usb_ctrl_complete ; use length of descriptor + subwf BANKED_EP0OUT_BUF+wLengthL,w + bc _usb_ctrl_complete ; if W <= f, no need to adjust movfw BANKED_EP0OUT_BUF+wLengthL movwf EP0_DATA_IN_COUNT goto _usb_ctrl_complete From ec2b80072467d811776b34b8ef16e7f0f3729046 Mon Sep 17 00:00:00 2001 From: DPRCZ Date: Mon, 28 Aug 2017 19:47:22 +0200 Subject: [PATCH 8/8] win32 console app --- win32/COPYING.txt | 339 ++++++++++++++++++++++++++++++++++ win32/USBSERNT.INF | 51 +++++ win32/clean.bat | 3 + win32/compile.bat | 6 + win32/make-mingw | 18 ++ win32/sp.c | 91 +++++++++ win32/sp.h | 19 ++ win32/usb16f1prog.c | 419 ++++++++++++++++++++++++++++++++++++++++++ win32/usb16f1prog.dsp | 108 +++++++++++ win32/usb16f1prog.dsw | 29 +++ win32/usb16f1prog.exe | Bin 0 -> 11776 bytes 11 files changed, 1083 insertions(+) create mode 100644 win32/COPYING.txt create mode 100644 win32/USBSERNT.INF create mode 100644 win32/clean.bat create mode 100644 win32/compile.bat create mode 100644 win32/make-mingw create mode 100644 win32/sp.c create mode 100644 win32/sp.h create mode 100644 win32/usb16f1prog.c create mode 100644 win32/usb16f1prog.dsp create mode 100644 win32/usb16f1prog.dsw create mode 100644 win32/usb16f1prog.exe diff --git a/win32/COPYING.txt b/win32/COPYING.txt new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/win32/COPYING.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/win32/USBSERNT.INF b/win32/USBSERNT.INF new file mode 100644 index 0000000..8ba1dc9 --- /dev/null +++ b/win32/USBSERNT.INF @@ -0,0 +1,51 @@ +; Windows 2000 and XP setup File for CDC + +[Version] +Signature="$Windows NT$" +Class=Ports +ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} +Provider=%MICROSOFT% +DriverVer=10/15/1999,5.0.2153.1 + +[Manufacturer] +%MICROSOFT%=Device + + +[Device] +%USB_CDC%=Reader, USB\VID_1D50&PID_EEEE + +[Reader_Install.NTx86] +;Windows2000 + +[DestinationDirs] +DefaultDestDir=12 +Reader.NT.Copy=12 + +[Reader.NT] +CopyFiles=Reader.NT.Copy +AddReg=Reader.NT.AddReg + +[Reader.NT.Copy] +;usbser.sys + +[Reader.NT.AddReg] +HKR,,DevLoader,,*ntkern +HKR,,NTMPDriver,,usbser.sys +HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" + +[Reader.NT.Services] +AddService = usbser, 0x00000002, Service_Inst + +[Service_Inst] +DisplayName = %Serial.SvcDesc% +ServiceType = 1 ; SERVICE_KERNEL_DRIVER +StartType = 3 ; SERVICE_DEMAND_START +ErrorControl = 1 ; SERVICE_ERROR_NORMAL +ServiceBinary = %12%\usbser.sys +LoadOrderGroup = Base + +[Strings] +MICROSOFT = "Microsoft, Inc." +USB_CDC = "CDC USB to UART" +Serial.SvcDesc = "USB Serial emulation driver" + diff --git a/win32/clean.bat b/win32/clean.bat new file mode 100644 index 0000000..be1878a --- /dev/null +++ b/win32/clean.bat @@ -0,0 +1,3 @@ +@echo off +if exist *.o del *.o +if exist *.exe del *.exe diff --git a/win32/compile.bat b/win32/compile.bat new file mode 100644 index 0000000..6790182 --- /dev/null +++ b/win32/compile.bat @@ -0,0 +1,6 @@ +@echo ************************** +@echo *** Use MinGW compiler *** +@echo ************************** +@set PATH=c:\mingw\bin;d:\mingw\bin;%PATH% +@set CC=gcc +mingw32-make.exe -f make-mingw diff --git a/win32/make-mingw b/win32/make-mingw new file mode 100644 index 0000000..5df24d4 --- /dev/null +++ b/win32/make-mingw @@ -0,0 +1,18 @@ +CC = gcc +SVNVERS = $(shell svnversion) +CFLAGS = -Wall -g -O -DMINGW32 -Ilibusb-win32 -Ihidapi -DSVNVERSION='"$(SVNVERS)"' +LDFLAGS = -s + + + +PROG_OBJS = usb16f1prog.o sp.o + +all: usb16f1prog.exe + +usb16f1prog.exe:$(PROG_OBJS) + $(CC) $(LDFLAGS) -o $@ $(PROG_OBJS) $(LIBS) + + +### +#pic32prog.o: pic32prog.c target.h localize.h +#target.o: target.c target.h adapter.h localize.h pic32.h diff --git a/win32/sp.c b/win32/sp.c new file mode 100644 index 0000000..1b718ce --- /dev/null +++ b/win32/sp.c @@ -0,0 +1,91 @@ +#include "windows.h" + + +HANDLE sp_open(LPSTR ComPort, DWORD BitRate, DWORD ReadTimeOut) +{ + HANDLE hComm; + DCB dcb = {0}; + COMMTIMEOUTS CommTmOut = {0}; + + // Get a handle to the port. + hComm = CreateFile(ComPort, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + 0); + if (hComm == INVALID_HANDLE_VALUE) + return INVALID_HANDLE_VALUE; + +/* + // Get the current state of the port + FillMemory(&dcb, sizeof(dcb), 0); + + + + if (!GetCommState(hComm, &dcb)) + { + return INVALID_HANDLE_VALUE; + } + else + { + dcb.BaudRate = BitRate; + dcb.Parity = NOPARITY; + dcb.StopBits = ONESTOPBIT; + dcb.fDtrControl = DTR_CONTROL_DISABLE; + dcb.fRtsControl = RTS_CONTROL_DISABLE; + dcb.fOutX = FALSE; + dcb.fInX = FALSE; + dcb.fOutxCtsFlow = FALSE; + dcb.fOutxDsrFlow = FALSE; + dcb.ByteSize = 8; + } + + if (!SetCommState(hComm, &dcb)) + return INVALID_HANDLE_VALUE; + +*/ + // Set the timeout conditions + if (!GetCommTimeouts(hComm, &CommTmOut)) + { + return INVALID_HANDLE_VALUE; + } + else + { + CommTmOut.ReadIntervalTimeout = 110; + CommTmOut.ReadTotalTimeoutMultiplier = 0; + CommTmOut.ReadTotalTimeoutConstant = 100; + CommTmOut.WriteTotalTimeoutMultiplier = 0; + CommTmOut.WriteTotalTimeoutConstant = 100; + } + + if (!SetCommTimeouts(hComm, &CommTmOut)) + return INVALID_HANDLE_VALUE; + + PurgeComm(hComm,PURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|PURGE_RXCLEAR); + + return hComm; +} + +INT sp_close(HANDLE hComPort) +{ + return CloseHandle(hComPort); +} + +int sp_write(HANDLE hComPort, unsigned char *Data, unsigned short Len) +{ + DWORD BytesWritten; + + if (!WriteFile(hComPort, Data, Len, &BytesWritten, NULL)) return -1; + return BytesWritten; +} + +int sp_read(HANDLE hComPort, unsigned char *Data, unsigned short Len) +{ + DWORD BytesRead; + + if (!ReadFile(hComPort, Data, Len, &BytesRead, NULL)) return -1; + return BytesRead; +} + diff --git a/win32/sp.h b/win32/sp.h new file mode 100644 index 0000000..1c32c4c --- /dev/null +++ b/win32/sp.h @@ -0,0 +1,19 @@ +#ifndef __SP_H +#define __SP_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +HANDLE sp_open(LPSTR ComPort, DWORD BitRate, DWORD ReadTimeOut); +INT sp_close(HANDLE hComPort); +int sp_write(HANDLE hComPort, unsigned char *Data, unsigned short Len); +int sp_read(HANDLE hComPort, unsigned char *Data, unsigned short Len); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/win32/usb16f1prog.c b/win32/usb16f1prog.c new file mode 100644 index 0000000..155a94d --- /dev/null +++ b/win32/usb16f1prog.c @@ -0,0 +1,419 @@ +// +// usb16f1prog +// Copyright (c) 2017, David Pribyl +// v1.0, 28.8.2017 +// +// This file is distributed under the terms of the GNU +// General Public License (GPL). See the accompanying file "COPYING" +// for more details. +// +// Uploads firmware to a PIC16F1xxx microcontroller programmed with +// Matt Sarnoff's USB bootloader. +// +// Accepts 16-bit Intel HEX files as input. +// Can only be used to write to program memory; the bootloader does not support +// writing the configuration words or user ID words, so values at those +// addresses in the input file are ignored. +// +// The programming protocol is very simplistic. There are three requests, +// distinguished by their length: Set Parameters (4 bytes), Write (64 bytes), +// and Reset (1 byte). After a Set Parameters or Write command, the host (e.g. +// this script) must wait for a 1-byte status response. If the response byte is +// 0x01, the operation succeeded. Otherwise, the host should abort. (See below +// for possible error values.) +// +// Set Parameters is 4 bytes long: +// - addressLowByte +// - addressHighByte +// - expectedChecksum +// - shouldErase +// addressLowByte/HighByte is the 16-bit word address, aligned to a 32-word +// boundary, where data should be written. +// expectedChecksum is the 8-bit checksum of the 32 words to be written at the +// specified address. (This is the 2's complement of the byte-wise sum mod 256 +// of the upcoming 32 words.) +// If the shouldErase byte is 0x45 ('E'), the flash row at that address is +// erased. An erase is mandatory before a Write command. +// +// Write is 64 bytes long: +// - dataWord0LowByte +// - dataWord0HighByte +// ... +// - dataWord31LowByte +// - dataWord31HighByte +// In other words, exactly 32 words, little-endian. If less than 32 words are +// to be written, the sequence should be padded out with 0x3FFF (0xFF, 0x3F). +// The device may return an error if the checksum of the data does not match +// the value sent in the last Set Parameters command, or if the values in flash +// do not match the supplied data after the write. (The latter may happen if you +// attempt to write to an address outside the device's ROM space, or to the +// bootloader region.) +// +// Reset is 1 byte long. If it is 0x52 ('R'), the device is reset, and no status +// is returned. + +#include +#include +#include +#include +#include "sp.h" + + +//#define TEST 1 + +#define HE_EOF -1 /* unexpected EOF */ +#define HE_DEX -2 /* hex digit required */ +#define HE_CEX -3 /* missing ':' */ +#define HE_CHK -4 /* checksum error */ +//#define HE_IGN 1 /* warning that some records were ignored */ + +#define STATUS_OK 1 +#define STATUS_INVALID_COMMAND 2 +#define STATUS_INVALID_CHECKSUM 3 +#define STATUS_VERIFY_FAILED 4 + +#define BCMD_ERASE 0x45 +#define BCMD_RESET 0x52 + + +#define MAXPROG 8192*2 + + +unsigned char progmem[MAXPROG]; + +static int check; +static int fail; + +/*****************************************************************************************/ +static unsigned hexdigit(FILE *fp) +{ + int c; + + if ( fail ) + return 0; + + if ( (c=getc(fp)) == EOF ) { + fail = HE_EOF; /* unexpected EOF */ + return 0; + } + + c -= c>'9'? 'A'-10: '0'; + if ( c<0 || c>0xF ) + fail = HE_DEX; /* hex digit expected */ + return c; +} + +/*****************************************************************************************/ + +static unsigned hexbyte(FILE *fp) +{ + unsigned b; + + b = hexdigit(fp); + b = (b<<4) + hexdigit(fp); + check += b; + return b; +} + +/*****************************************************************************************/ + +static unsigned hexword(FILE *fp) +{ + unsigned w; + + w = hexbyte(fp); + w = (w<<8) + hexbyte(fp); + return w; +} + +/*****************************************************************************************/ + +#define HEXBYTE() hexbyte(fp); if (fail) return fail +#define HEXWORD() hexword(fp); if (fail) return fail + + +/*****************************************************************************************/ + +int loadhex(FILE *fp) +{ + int address; + int adrhi=0; + int type; + int linelen; + int i; + unsigned char b; + + fail = 0; + + memset(progmem,0xff,MAXPROG); + + type = 0; + while ( type != 1 ) { + if ( getc(fp) != ':' ) return HE_CEX; /* expected ':' */ + check = 0; + linelen = HEXBYTE(); + address = HEXWORD(); + type = HEXBYTE(); + + if (type==0) { //Data + if (adrhi==0) { //progmem + for ( i=0; i>8)&0xFF; + Buff[2]=checksum; + Buff[3]=BCMD_ERASE; + +#if TEST + Sleep(10); + Back=0; +#else + ret=sp_write(hComPort,Buff,sizeof(Buff)); + + if (ret==sizeof(Buff)) { + ret=sp_read(hComPort,&Status,1); + if (ret==1) { + if (Status==STATUS_OK) Back=0; + else device_error(Status); + + } + } +#endif + return Back; +} + + +int device_write(HANDLE hComPort, unsigned char * Row) { + unsigned char Buff[64]; + unsigned char Status; + int Back=1; //Error + int i,ret; + + + for(i=0;i<64;i+=2) { + Buff[i]=Row[i]; + Buff[i+1]=Row[i+1]&0x3F; + + } +#if TEST + Sleep(50); + Back=0; +#else + ret=sp_write(hComPort,Buff,sizeof(Buff)); + + if (ret==sizeof(Buff)) { //64 + ret=sp_read(hComPort,&Status,1); + if (ret==1) { + if (Status==STATUS_OK) Back=0; + else device_error(Status); + + } + } +#endif + return Back; +} + +int device_reset(HANDLE hComPort) { + unsigned char Cmd; + int Back=1; //Error + int ret; + + Cmd=BCMD_RESET; + ret=sp_write(hComPort,&Cmd,1); + + if (ret==1) Back=0; + + return Back; +} + + + +/*****************************************************************************************/ +unsigned char ProgLine[64+3]; + +void PrepareProgressLine(void) { + ProgLine[0]='['; + memset(ProgLine+1,'B',4); + memset(ProgLine+1+4,'-',64-4); + ProgLine[65]=']'; + ProgLine[66]=0; + +} +void ShowProgressLine(int Addr,char Action) { + int Pos=Addr/(32*4); + ProgLine[Pos+1]=Action; + printf("\r %s",ProgLine); +} + +int main(int argc, char *argv[]) { + + int ret=-1; + FILE *fp; + int startaddr=0; + int endaddr=0; + int i; + HANDLE ComPort; + + if (argc > 2) { + printf ("usb16f1prog:\n"); + + printf (" Loading hex file ...\n"); + fp=fopen(argv[2],"r"); + if (fp!=NULL) { + ret=loadhex(fp); + fclose(fp); + } + + if (ret!=0) { + printf("\nError - unable to read '%s' file\n",argv[2]); + + } else { //Analize progmem + for (i=0;i2 + printf ("\nUsage:\n"); + printf (" usb16f1prog com1 file.hex\n"); + printf (" com1 .. bootloader serial port\n"); + printf (" file.hex .. program to write\n"); + printf ("\n"); + } + return 0; +} + + + diff --git a/win32/usb16f1prog.dsp b/win32/usb16f1prog.dsp new file mode 100644 index 0000000..0a3e8a9e --- /dev/null +++ b/win32/usb16f1prog.dsp @@ -0,0 +1,108 @@ +# Microsoft Developer Studio Project File - Name="usb16f1prog" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=usb16f1prog - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "usb16f1prog.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "usb16f1prog.mak" CFG="usb16f1prog - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "usb16f1prog - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "usb16f1prog - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "usb16f1prog - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x405 /d "NDEBUG" +# ADD RSC /l 0x405 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "usb16f1prog - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x405 /d "_DEBUG" +# ADD RSC /l 0x405 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "usb16f1prog - Win32 Release" +# Name "usb16f1prog - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\sp.c +# End Source File +# Begin Source File + +SOURCE=.\usb16f1prog.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\sp.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/win32/usb16f1prog.dsw b/win32/usb16f1prog.dsw new file mode 100644 index 0000000..dbbedbc --- /dev/null +++ b/win32/usb16f1prog.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "usb16f1prog"=.\usb16f1prog.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/win32/usb16f1prog.exe b/win32/usb16f1prog.exe new file mode 100644 index 0000000000000000000000000000000000000000..fbfecd1f0a2df0914bccc58925ff8e41a31e0bd5 GIT binary patch literal 11776 zcmeHN4{%iVo&W92i!5Quh7vF>L7#Q8h%uLVv;vZIL$Zh%+L#dGE^4yLzQF2cH}1X{ zz(Y*#Wr61-c6-*Fo}<$S?Ny!54W1N1rgq6fLcDrL>zwpBl`480H`Q1jNQ39Q&-eG< zhQPtibgnaE)8pmu|M}GgcK($w=Ci%i zU%6_(qvn;X)@}^Oq>gB0L)70cwfe*1h$6MfQdA8~!LU^QoqDM~5|B%0&dl@JrfYqS z)i|7NN!|DVGVARGbLY%(2y@w7P!<7JFc$g>Z~>qUK+#cKu;O;0N%8aN1m5Tr{*dv! z7?UhnQXm~XHnKW<7~46iY?1z;_b_8c7f?6}yH8($o+Xtk@@55{g@t%gK$PowaW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