diff --git a/Makefile b/Makefile index ff6ecd4..6f318b7 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,16 @@ -SRC_FILE = firmware -MCU = t2313 -PROGRAMMER = usbtiny +SRC_FILE = firmware +MCU = t2313 +PROGRAMMER = usbtiny +BUILD_DIR = build -build: - avrasm2 -fI -W+ie $(SRC_FILE).asm -l $(SRC_FILE).lss +all: build_dir + avrasm2 -fI -W+ie $(SRC_FILE).asm -o ./$(BUILD_DIR)/$(SRC_FILE).hex -l ./$(BUILD_DIR)/$(SRC_FILE).lss flash: - avrdude -c $(PROGRAMMER) -p $(MCU) -U flash:w:$(SRC_FILE).hex:i \ No newline at end of file + avrdude -c $(PROGRAMMER) -p $(MCU) -U flash:w:./$(BUILD_DIR)/$(SRC_FILE).hex:i + +clean: + rm -f $(BUILD_DIR)/* + +build_dir: + mkdir -p ${BUILD_DIR} \ No newline at end of file diff --git a/build/firmware.hex b/build/firmware.hex new file mode 100644 index 0000000..89bdf3f --- /dev/null +++ b/build/firmware.hex @@ -0,0 +1,27 @@ +:020000020000FC +:0200000049C0F5 +:020016003CC0EC +:10001A0000C04F935F935FB74091670045300CF47F +:10002A0003C0442740936700403041F49398949862 +:10003A009598929A009166007ED05DD0413041F445 +:10004A00929894989598939A0091650074D053D099 +:10005A00423041F4929893989598949A009164004A +:10006A006AD049D0433041F4929893989498959ADB +:10007A000091630060D03FD04395409367005FBF13 +:10008A005F914F911895019618950FED0DBF0CE7EA +:10009A0001BB01EC07BB0CE108BB00E20BBF0CE1A2 +:1000AA0000BD02E000BF05E003BF09E106BF01E0B1 +:1000BA0009BF11241092670080E090E0789425D05F +:1000CA004FD040D03FD03ED03DD03CD03BD0F7CFF0 +:1000DA00EE24FF1841E1001F111F4A9509F4089503 +:1000EA00EE1CFF1CE21AF30A20F4E20EF31E8894B7 +:1000FA00F2CF0894F0CF0FB800E40EB90BE10DB9B6 +:10010A00769BFDCFC09AC098089554E0A3E6B0E06C +:10011A0080936100909362000091610010916200E7 +:10012A002AE030E0D5DFED9200936100109362007F +:10013A005A9591F70895ECE7F1E01127E00FF11FC6 +:10014A00049008950F931F930FEF1FEF1A95000065 +:10015A0000000000D9F70A95C1F71F910F91089581 +:10016A000F931F9300E412B3102712BB1F910F9134 +:0E017A000895C0F9A4B0999282F880909C007C +:00000001FF diff --git a/build/firmware.lss b/build/firmware.lss new file mode 100644 index 0000000..f1d9c0c --- /dev/null +++ b/build/firmware.lss @@ -0,0 +1,1157 @@ + +AVRASM ver. 2.2.7 firmware.asm Mon Apr 24 00:59:18 2023 + +firmware.asm(14): Including file 'tn2313Adef.inc' +firmware.asm(191): Including file 'div16u.asm' +div16u.asm(22): warning: Register r16 already defined by the .DEF directive +firmware.asm(191): 'div16u.asm' included form here +div16u.asm(23): warning: Register r17 already defined by the .DEF directive +firmware.asm(191): 'div16u.asm' included form here +div16u.asm(24): warning: Register r16 already defined by the .DEF directive +firmware.asm(191): 'div16u.asm' included form here +div16u.asm(25): warning: Register r17 already defined by the .DEF directive +firmware.asm(191): 'div16u.asm' included form here +firmware.asm(192): Including file 'usi.asm' +firmware.asm(14): Including file 'tn2313Adef.inc' +firmware.asm(191): Including file 'div16u.asm' +firmware.asm(192): Including file 'usi.asm' + + + ; Project name: thermostat + ; Description: Electronic thermostat on AVR Microcontroller + ; Source code: https://github.com/sergeyyarkov/attiny2313a_thermostat + ; Device: ATtiny2313A + ; Device Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/doc8246.pdf + ; Package: SOIC-20W_7.5x12.8mm_P1.27mm + ; Assembler: AVR macro assembler 2.2.7 + ; Clock frequency: 8 MHz External Crystal Oscillator + ; Fuses: lfuse: 0xCF, hfuse: 0x9F, efuse: 0xFF, lock: 0xFF + ; + ; Written by Sergey Yarkov 22.01.2023 + + .INCLUDE "tn2313Adef.inc" + + ;***** Created: 2011-02-09 12:04 ******* Source: ATtiny2313A.xml ********* + ;************************************************************************* + ;* A P P L I C A T I O N N O T E F O R T H E A V R F A M I L Y + ;* + ;* Number : AVR000 + ;* File Name : "tn2313Adef.inc" + ;* Title : Register/Bit Definitions for the ATtiny2313A + ;* Date : 2011-02-09 + ;* Version : 2.35 + ;* Support E-mail : avr@atmel.com + ;* Target MCU : ATtiny2313A + ;* + ;* DESCRIPTION + ;* When including this file in the assembly program file, all I/O register + ;* names and I/O register bit names appearing in the data book can be used. + ;* In addition, the six registers forming the three data pointers X, Y and + ;* Z have been assigned names XL - ZH. Highest RAM address for Internal + ;* SRAM is also defined + ;* + ;* The Register names are represented by their hexadecimal address. + ;* + ;* The Register Bit names are represented by their bit number (0-7). + ;* + ;* Please observe the difference in using the bit names with instructions + ;* such as "sbr"/"cbr" (set/clear bit in register) and "sbrs"/"sbrc" + ;* (skip if bit in register set/cleared). The following example illustrates + ;* this: + ;* + ;* in r16,PORTB ;read PORTB latch + ;* sbr r16,(1< USI Wire Mode + ; USICS1 <--------------> USI Clock Source Select + ; USICLK <--------------> USI Clock Strobe + ; USITC <--------------> USI Toggle Clock (Enable clock generation) +000083 e10b ldi TEMP_REG_A, (1< USI Clock Source Select ; USICLK <--------------> USI Clock Strobe ; USITC <--------------> USI Toggle Clock (Enable clock generation) -00006f e10b ldi TEMP_REG_A, (1< USI Clock Source Select 15: ; USICLK <--------------> USI Clock Strobe 16: ; USITC <--------------> USI Toggle Clock (Enable clock generation) - 17: 00006E E10B ldi TEMP_REG_A, (1< Warning 004: Number of bytes on line is odd, added 00 to fit program memory! + File: /home/sergeyyarkov/Documents/Projects/Firmwares/AVR/attiny2313a_thermostat/firmware.asm, Line: 273 + Source line: .DB 0b10011100 ; ° + 0000B8 009C + 274: + 275: ; **** СЕГМЕНТ EEPROM ******************************************** + 276: ; .ESEG + 277: ; INFO: .DB "AVR Thermostat. Written by Sergey Yarkov 22.01.2023" List of symbols: Type nDef nUsed Decimalval Hexval Name T 1 1 89 59 ATTINY2313A L 1 0 96 60 MCU_STATE - L 1 0 97 61 NUMBER + L 1 1 97 61 SRAM_TEMP_1 L 1 6 99 63 DIGITS L 1 4 103 67 CURRENT_DIGIT L 1 2 14 0E TIMER0_COMPA_VECT - L 1 2 19 13 RESET_DIGIT_IDX - L 1 2 22 16 _INDICATE_1 - L 1 2 31 1F _INDICATE_2 - L 1 2 41 29 _INDICATE_3 - L 1 2 51 33 _INDICATE_4 - L 1 2 61 3D _INDICATE_EXIT - L 1 2 65 41 RESET_VECT - L 1 0 67 43 MCU_INIT - L 1 2 88 58 DIV16U - L 1 4 91 5B D16U_1 - L 1 2 96 60 D16U_2 - L 1 2 105 69 D16U_3 - L 1 8 107 6B USI_TRANSMIT - L 1 2 111 6F _USI_TRANSMIT_LOOP - L 1 4 117 75 LOOP - L 1 0 117 75 GET_DIGITS - L 1 2 125 7D DIV_LOOP - L 1 8 147 93 DISPLAY_DECODER - L 1 10 154 9A DELAY - L 1 2 157 9D _DELAY_1 - L 1 2 158 9E _DELAY_2 - L 1 2 168 A8 TOGGLE_POWER_LED - L 1 4 177 B1 DISPLAY_SYMBOLS + L 1 2 20 14 RESET_DIGIT_IDX + L 1 2 23 17 _INDICATE_1 + L 1 2 33 21 _INDICATE_2 + L 1 2 43 2B _INDICATE_3 + L 1 2 53 35 _INDICATE_4 + L 1 2 63 3F _INDICATE_EXIT + L 1 2 68 44 RESET_VECT + L 1 0 70 46 MCU_INIT + L 1 2 90 5A LOOP + L 1 2 95 5F DIV16U + L 1 4 98 62 D16U_1 + L 1 2 103 67 D16U_2 + L 1 2 112 70 D16U_3 + L 1 8 114 72 USI_TRANSMIT + L 1 2 118 76 _USI_TRANSMIT_LOOP + L 1 2 124 7C DISPLAY_UPD_DIGITS + L 1 2 131 83 DIV_LOOP + L 1 8 146 92 DISPLAY_DECODER + L 1 2 153 99 DELAY + L 1 2 156 9C _L_1 + L 1 2 157 9D _DEC_1 + L 1 2 170 AA TOGGLE_POWER_LED + L 1 4 179 B3 DISPLAY_SYMBOLS R 1 11 16 10 TEMP_REG_A R 1 2 17 11 TEMP_REG_B + R 1 2 22 16 DISP_NUM_L + R 1 1 23 17 DISP_NUM_H R 1 5 14 0E DREM16UL R 1 5 15 0F DREM16UH R 1 1 16 10 DRES16UL @@ -417,12 +460,12 @@ Type nDef nUsed Decimalval Hexval Name R 1 2 20 14 DCNT16U C 1 0 23 17 NOW_Y C 1 0 4 04 NOW_M - C 1 0 20 14 NOW_D - C 1 0 45036 AFEC NOW_I + C 1 0 23 17 NOW_D + C 1 0 45039 AFEF NOW_I C 1 5 2 02 DIGIT_1_PIN - C 1 4 3 03 DIGIT_2_PIN - C 1 4 4 04 DIGIT_3_PIN - C 1 4 5 05 DIGIT_4_PIN + C 1 5 3 03 DIGIT_2_PIN + C 1 5 4 04 DIGIT_3_PIN + C 1 5 5 05 DIGIT_4_PIN C 1 2 6 06 LED_POWER_PIN C 1 3 0 00 USI_LATCH_PIN C 1 1 6 06 USI_DO_PIN @@ -430,15 +473,18 @@ Type nDef nUsed Decimalval Hexval Name C 1 0 1 01 MCU_STATE_DEFAULT C 1 0 2 02 MCU_STATE_PROGRAM C 1 0 3 03 MCU_STATE_ERROR - C 1 2 279 0117 DISPLAY_NUMBER - C 1 6 96 60 DIVIDEND_ADDR + C 1 6 97 61 DIVIDEND C 1 2 10 0A DIVISOR - No macros. -Program : 165 words. -Constants : 5 words. -Total program memory: 170 words. +List of macros: +nLines nUsed nParams Name + 2 6 3 OUTI + 2 1 1 DISPLAY_LOAD + +Program : 167 words. +Constants : 6 words. +Total program memory: 173 words. Eeprom space : 0 bytes. Data segment : 8 bytes. Compilation completed, no errors. -Compilation ended 20.04.2023, 00:25:25 +Compilation ended 23.04.2023, 20:09:24 diff --git a/firmware.pro b/firmware.pro index e8be24f..80291f8 100644 --- a/firmware.pro +++ b/firmware.pro @@ -1,7 +1,7 @@ /avr_sim_project_file /home/sergeyyarkov/Documents/Projects/Firmwares/AVR/attiny2313a_thermostat/firmware.asm mainasm=firmware.asm -file=firmware.lst,122,33,48 +file=firmware.lst,349,62,73 file=firmware.asm,1,1,1 file=div16u.asm,1,1,1 file=usi.asm,1,1,1