Просмотр исходного кода

增加外设配置,编译通过但无法通过ST-Link仿真,暂时放弃,改用stvd

Deyauo 11 месяцев назад
Родитель
Сommit
5b1a6ef647

BIN
Debug/Exe/tail_light_stm8.out


+ 255 - 142
Debug/List/tail_light_stm8.map

@@ -1,6 +1,6 @@
 ###############################################################################
 #
-# IAR ELF Linker V3.10.1.201 for STM8                     21/Sep/2024  18:25:25
+# IAR ELF Linker V3.10.1.201 for STM8                     22/Sep/2024  14:13:18
 # Copyright 2010-2017 IAR Systems AB.
 #
 #    Output file  =  
@@ -8,8 +8,9 @@
 #    Map file     =  
 #        C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\List\tail_light_stm8.map
 #    Command line =  
-#        -f C:\Users\hero\AppData\Local\Temp\EW7041.tmp
-#        (C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\Obj\main.o
+#        -f C:\Users\hero\AppData\Local\Temp\EWF99C.tmp
+#        (C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\Obj\hw_init.o
+#        C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\Obj\main.o
 #        C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\Obj\stm8s_adc1.o
 #        C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\Obj\stm8s_awu.o
 #        C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\Obj\stm8s_beep.o
@@ -33,7 +34,7 @@
 #        --map
 #        C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\List\tail_light_stm8.map
 #        --config "C:\Program Files (x86)\IAR Systems\Embedded Workbench
-#        8.0\stm8\config\lnkstm8s003f3.icf" --config_def _CSTACK_SIZE=0x100
+#        8.0\stm8\config\lnkstm8s103f3.icf" --config_def _CSTACK_SIZE=0x100
 #        --config_def _HEAP_SIZE=0x100 --entry __iar_program_start --debug_lib)
 #
 ###############################################################################
@@ -74,55 +75,98 @@ do not initialize {
    rw section .eeprom.noinit, rw section .far.noinit, rw section .huge.noinit,
    rw section .near.noinit, rw section .tiny.noinit, rw section .vregs };
 
-  Section          Kind      Address   Size  Object
-  -------          ----      -------   ----  ------
-"A0":                                   0xc
-  .vregs           uninit   0x000000    0xc  vregs.o [4]
-                          - 0x00000c    0xc
+  Section          Kind      Address    Size  Object
+  -------          ----      -------    ----  ------
+"A0":                                   0x10
+  .vregs           uninit   0x000000    0x10  vregs.o [4]
+                          - 0x000010    0x10
 
-"A1":                                 0x100
-  CSTACK                    0x000300  0x100  <Block>
-    CSTACK         uninit   0x000300  0x100  <Block tail>
-                          - 0x000400  0x100
+"A1":                                  0x100
+  CSTACK                    0x000300   0x100  <Block>
+    CSTACK         uninit   0x000300   0x100  <Block tail>
+                          - 0x000400   0x100
 
-"A2":                                  0x80
-  INTVEC                    0x008000   0x80  <Block>
-    .intvec        const    0x008000   0x80  interrupt.o [4]
-                          - 0x008080   0x80
+"A2":                                   0x80
+  INTVEC                    0x008000    0x80  <Block>
+    .intvec        const    0x008000    0x80  interrupt.o [4]
+                          - 0x008080    0x80
 
-"P3-P5":                               0x7b
-  .near_func.text  ro code  0x008080   0x18  vreg_util.o [4]
-  .near_func.text  ro code  0x008098   0x14  init.o [4]
-  .near_func.text  ro code  0x0080ac   0x14  __dbg_xxexit.o [3]
-  .near_func.text  ro code  0x0080c0   0x13  cstartup.o [4]
-  .near_func.text  ro code  0x0080d3    0x5  cexit.o [4]
-  .near_func.text  ro code  0x0080d8    0x3  interrupt.o [4]
-  .near_func.text  ro code  0x0080db    0x3  low_level_init.o [4]
-  .near_func.text  ro code  0x0080de    0x3  exit.o [4]
-  .near_func.text  ro code  0x0080e1    0x3  unhandled_exception.o [4]
-  .near_func.text  ro code  0x0080e4    0x2  main.o [1]
-  .near_func.text  ro code  0x0080e6    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080e7    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080e8    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080e9    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080ea    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080eb    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080ec    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080ed    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080ee    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080ef    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080f0    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080f1    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080f2    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080f3    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080f4    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080f5    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080f6    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080f7    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080f8    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080f9    0x1  stm8s_it.o [1]
-  .near_func.text  ro code  0x0080fa    0x1  __dbg_break.o [3]
-                          - 0x0080fb   0x7b
+"P3-P5":                              0x12d8
+  .near_func.text  ro code  0x008080   0x19e  hw_init.o [1]
+  .near_func.text  ro code  0x00821e   0x19a  stm8s_adc1.o [1]
+  .near_func.text  ro code  0x0083b8   0x147  stm8s_tim1.o [1]
+  .near_func.text  ro code  0x0084ff   0x110  stm8s_gpio.o [1]
+  .near_func.text  ro code  0x00860f    0xfc  stm8s_adc1.o [1]
+  .near_func.text  ro code  0x00870b    0xd1  stm8s_exti.o [1]
+  .near_func.text  ro code  0x0087dc    0xbe  stm8s_adc1.o [1]
+  .near_func.text  ro code  0x00889a    0xac  stm8s_tim2.o [1]
+  .near_func.text  ro code  0x008946    0xac  stm8s_tim2.o [1]
+  .near_func.text  ro code  0x0089f2    0xac  stm8s_tim2.o [1]
+  .near_func.text  ro code  0x008a9e    0x99  stm8s_tim1.o [1]
+  .near_func.text  ro code  0x008b37    0x8b  stm8s_clk.o [1]
+  .near_func.text  ro code  0x008bc2    0x8a  vreg_util.o [4]
+  .near_func.text  ro code  0x008c4c    0x60  stm8s_tim1.o [1]
+  .near_func.text  ro code  0x008cac    0x5b  stm8s_adc1.o [1]
+  .near_func.text  ro code  0x008d07    0x59  stm8s_adc1.o [1]
+  .near_func.text  ro code  0x008d60    0x59  stm8s_tim2.o [1]
+  .near_func.text  ro code  0x008db9    0x55  stm8s_adc1.o [1]
+  .near_func.text  ro code  0x008e0e    0x51  stm8s_tim4.o [1]
+  .near_func.text  ro code  0x008e5f    0x50  stm8s_tim4.o [1]
+  .near.rodata     const    0x008eaf    0x48  stm8s_adc1.o [1]
+  .near.rodata     const    0x008ef7    0x48  stm8s_exti.o [1]
+  .near.rodata     const    0x008f3f    0x48  stm8s_gpio.o [1]
+  .near.rodata     const    0x008f87    0x48  stm8s_tim1.o [1]
+  .near.rodata     const    0x008fcf    0x48  stm8s_tim2.o [1]
+  .near.rodata     const    0x009017    0x48  stm8s_tim4.o [1]
+  .near.rodata     const    0x00905f    0x47  stm8s_clk.o [1]
+  .near_func.text  ro code  0x0090a6    0x36  stm8s_clk.o [1]
+  .near_func.text  ro code  0x0090dc    0x31  stm8s_adc1.o [1]
+  .near_func.text  ro code  0x00910d    0x2f  stm8s_clk.o [1]
+  .near_func.text  ro code  0x00913c    0x2f  stm8s_tim1.o [1]
+  .near_func.text  ro code  0x00916b    0x2f  stm8s_tim2.o [1]
+  .near_func.text  ro code  0x00919a    0x2f  stm8s_tim2.o [1]
+  .near_func.text  ro code  0x0091c9    0x2f  stm8s_tim2.o [1]
+  .near_func.text  ro code  0x0091f8    0x2f  stm8s_tim2.o [1]
+  .near_func.text  ro code  0x009227    0x2f  stm8s_tim2.o [1]
+  .near_func.text  ro code  0x009256    0x2f  stm8s_tim4.o [1]
+  .near_func.text  ro code  0x009285    0x24  stm8s_tim4.o [1]
+  .near_func.text  ro code  0x0092a9    0x19  stm8s_tim4.o [1]
+  .near_func.text  ro code  0x0092c2    0x14  stm8s_gpio.o [1]
+  .near_func.text  ro code  0x0092d6    0x14  init.o [4]
+  .near_func.text  ro code  0x0092ea    0x14  __dbg_xxexit.o [3]
+  .near_func.text  ro code  0x0092fe    0x13  cstartup.o [4]
+  .near_func.text  ro code  0x009311     0xc  stm8s_tim2.o [1]
+  .near_func.text  ro code  0x00931d     0x8  short.o [4]
+  .near_func.text  ro code  0x009325     0x6  char.o [4]
+  .near_func.text  ro code  0x00932b     0x5  main.o [1]
+  .near_func.text  ro code  0x009330     0x5  cexit.o [4]
+  .near_func.text  ro code  0x009335     0x3  interrupt.o [4]
+  .near_func.text  ro code  0x009338     0x3  low_level_init.o [4]
+  .near_func.text  ro code  0x00933b     0x3  exit.o [4]
+  .near_func.text  ro code  0x00933e     0x3  unhandled_exception.o [4]
+  .near_func.text  ro code  0x009341     0x2  main.o [1]
+  .near_func.text  ro code  0x009343     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009344     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009345     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009346     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009347     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009348     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009349     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x00934a     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x00934b     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x00934c     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x00934d     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x00934e     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x00934f     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009350     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009351     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009352     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009353     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009354     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009355     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009356     0x1  stm8s_it.o [1]
+  .near_func.text  ro code  0x009357     0x1  __dbg_break.o [3]
+                          - 0x009358  0x12d8
 
 
 
@@ -133,10 +177,18 @@ do not initialize {
     Module                 ro code  ro data  rw data
     ------                 -------  -------  -------
 C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\Obj: [1]
-    main.o                       2
+    hw_init.o                  414
+    main.o                       7
+    stm8s_adc1.o             1 166       72
+    stm8s_clk.o                240       71
+    stm8s_exti.o               209       72
+    stm8s_gpio.o               292       72
     stm8s_it.o                  20
+    stm8s_tim1.o               623       72
+    stm8s_tim2.o               852       72
+    stm8s_tim4.o               269       72
     ------------------------------------------------
-    Total:                      22
+    Total:                   4 092      503
 
 command line: [2]
     ------------------------------------------------
@@ -150,115 +202,176 @@ dbgstm8smd.a: [3]
 
 dlstm8smn.a: [4]
     cexit.o                      5
+    char.o                       6
     cstartup.o                  19
     exit.o                       3
     init.o                      20
     interrupt.o                  3      128
     low_level_init.o             3
+    short.o                      8
     unhandled_exception.o        3
-    vreg_util.o                 24
-    vregs.o                                       12
+    vreg_util.o                138
+    vregs.o                                       16
     ------------------------------------------------
-    Total:                      80      128       12
+    Total:                     208      128       16
 
     Linker created                               256
 ----------------------------------------------------
-    Grand Total:               123      128      268
+    Grand Total:             4 321      631      272
 
 
 *******************************************************************************
 *** ENTRY LIST
 ***
 
-Entry                     Address  Size  Type      Object
------                     -------  ----  ----      ------
-?b0                      0x000000        Data  Gb  vregs.o [4]
-?b1                      0x000001        Data  Gb  vregs.o [4]
-?b10                     0x00000a        Data  Gb  vregs.o [4]
-?b11                     0x00000b        Data  Gb  vregs.o [4]
-?b2                      0x000002        Data  Gb  vregs.o [4]
-?b3                      0x000003        Data  Gb  vregs.o [4]
-?b4                      0x000004        Data  Gb  vregs.o [4]
-?b5                      0x000005        Data  Gb  vregs.o [4]
-?b6                      0x000006        Data  Gb  vregs.o [4]
-?b7                      0x000007        Data  Gb  vregs.o [4]
-?b8                      0x000008        Data  Gb  vregs.o [4]
-?b9                      0x000009        Data  Gb  vregs.o [4]
-?e0                      0x000001        Data  Gb  vregs.o [4]
-?e1                      0x000005        Data  Gb  vregs.o [4]
-?e2                      0x000009        Data  Gb  vregs.o [4]
-?l0                      0x000000        Data  Gb  vregs.o [4]
-?l1                      0x000004        Data  Gb  vregs.o [4]
-?l2                      0x000008        Data  Gb  vregs.o [4]
-?push_w4                 0x008080        Code  Gb  vreg_util.o [4]
-?w0                      0x000000        Data  Gb  vregs.o [4]
-?w1                      0x000002        Data  Gb  vregs.o [4]
-?w2                      0x000004        Data  Gb  vregs.o [4]
-?w3                      0x000006        Data  Gb  vregs.o [4]
-?w4                      0x000008        Data  Gb  vregs.o [4]
-?w5                      0x00000a        Data  Gb  vregs.o [4]
-ADC1_IRQHandler          0x0080f7   0x1  Code  Gb  stm8s_it.o [1]
-AWU_IRQHandler           0x0080e8   0x1  Code  Gb  stm8s_it.o [1]
-CLK_IRQHandler           0x0080e9   0x1  Code  Gb  stm8s_it.o [1]
-CSTACK$$Base             0x000300         --   Gb  - Linker created -
-CSTACK$$Limit            0x000400         --   Gb  - Linker created -
-EEPROM_EEC_IRQHandler    0x0080f9   0x1  Code  Gb  stm8s_it.o [1]
-EXTI_PORTA_IRQHandler    0x0080ea   0x1  Code  Gb  stm8s_it.o [1]
-EXTI_PORTB_IRQHandler    0x0080eb   0x1  Code  Gb  stm8s_it.o [1]
-EXTI_PORTC_IRQHandler    0x0080ec   0x1  Code  Gb  stm8s_it.o [1]
-EXTI_PORTD_IRQHandler    0x0080ed   0x1  Code  Gb  stm8s_it.o [1]
-EXTI_PORTE_IRQHandler    0x0080ee   0x1  Code  Gb  stm8s_it.o [1]
-I2C_IRQHandler           0x0080f6   0x1  Code  Gb  stm8s_it.o [1]
-INTVEC$$Base             0x008000         --   Gb  - Linker created -
-INTVEC$$Limit            0x008080         --   Gb  - Linker created -
-Region$$Table$$Base    0x00000000         --   Gb  - Linker created -
-Region$$Table$$Limit   0x00000000         --   Gb  - Linker created -
-SPI_IRQHandler           0x0080ef   0x1  Code  Gb  stm8s_it.o [1]
+Entry                     Address   Size  Type      Object
+-----                     -------   ----  ----      ------
+?b0                      0x000000         Data  Gb  vregs.o [4]
+?b1                      0x000001         Data  Gb  vregs.o [4]
+?b10                     0x00000a         Data  Gb  vregs.o [4]
+?b11                     0x00000b         Data  Gb  vregs.o [4]
+?b12                     0x00000c         Data  Gb  vregs.o [4]
+?b13                     0x00000d         Data  Gb  vregs.o [4]
+?b14                     0x00000e         Data  Gb  vregs.o [4]
+?b15                     0x00000f         Data  Gb  vregs.o [4]
+?b2                      0x000002         Data  Gb  vregs.o [4]
+?b3                      0x000003         Data  Gb  vregs.o [4]
+?b4                      0x000004         Data  Gb  vregs.o [4]
+?b5                      0x000005         Data  Gb  vregs.o [4]
+?b6                      0x000006         Data  Gb  vregs.o [4]
+?b7                      0x000007         Data  Gb  vregs.o [4]
+?b8                      0x000008         Data  Gb  vregs.o [4]
+?b9                      0x000009         Data  Gb  vregs.o [4]
+?e0                      0x000001         Data  Gb  vregs.o [4]
+?e1                      0x000005         Data  Gb  vregs.o [4]
+?e2                      0x000009         Data  Gb  vregs.o [4]
+?e3                      0x00000d         Data  Gb  vregs.o [4]
+?epilogue_l2             0x008c3d         Code  Gb  vreg_util.o [4]
+?epilogue_l2_l3          0x008c3a         Code  Gb  vreg_util.o [4]
+?epilogue_l2_w6          0x008c41         Code  Gb  vreg_util.o [4]
+?epilogue_w4             0x008c48         Code  Gb  vreg_util.o [4]
+?l0                      0x000000         Data  Gb  vregs.o [4]
+?l1                      0x000004         Data  Gb  vregs.o [4]
+?l2                      0x000008         Data  Gb  vregs.o [4]
+?l3                      0x00000c         Data  Gb  vregs.o [4]
+?pop_l2                  0x008c1c         Code  Gb  vreg_util.o [4]
+?pop_l3                  0x008c27         Code  Gb  vreg_util.o [4]
+?pop_w4                  0x008bdf         Code  Gb  vreg_util.o [4]
+?pop_w6                  0x008be6         Code  Gb  vreg_util.o [4]
+?push_l2                 0x008bf5         Code  Gb  vreg_util.o [4]
+?push_l3                 0x008bfa         Code  Gb  vreg_util.o [4]
+?push_w4                 0x008bc2         Code  Gb  vreg_util.o [4]
+?push_w6                 0x008bc7         Code  Gb  vreg_util.o [4]
+?sll16_x_x_a             0x00931d         Code  Gb  short.o [4]
+?sll8_a_a_5              0x009326         Code  Gb  char.o [4]
+?sll8_a_a_6              0x009325         Code  Gb  char.o [4]
+?w0                      0x000000         Data  Gb  vregs.o [4]
+?w1                      0x000002         Data  Gb  vregs.o [4]
+?w2                      0x000004         Data  Gb  vregs.o [4]
+?w3                      0x000006         Data  Gb  vregs.o [4]
+?w4                      0x000008         Data  Gb  vregs.o [4]
+?w5                      0x00000a         Data  Gb  vregs.o [4]
+?w6                      0x00000c         Data  Gb  vregs.o [4]
+?w7                      0x00000e         Data  Gb  vregs.o [4]
+ADC1_ConversionConfig    0x0087dc   0xbe  Code  Gb  stm8s_adc1.o [1]
+ADC1_DeInit              0x0090dc   0x31  Code  Gb  stm8s_adc1.o [1]
+ADC1_ExternalTriggerConfig
+                         0x008d07   0x59  Code  Gb  stm8s_adc1.o [1]
+ADC1_IRQHandler          0x009354    0x1  Code  Gb  stm8s_it.o [1]
+ADC1_ITConfig            0x008cac   0x5b  Code  Gb  stm8s_adc1.o [1]
+ADC1_Init                0x00821e  0x19a  Code  Gb  stm8s_adc1.o [1]
+ADC1_PrescalerConfig     0x008db9   0x55  Code  Gb  stm8s_adc1.o [1]
+ADC1_SchmittTriggerConfig
+                         0x00860f   0xfc  Code  Gb  stm8s_adc1.o [1]
+AWU_IRQHandler           0x009345    0x1  Code  Gb  stm8s_it.o [1]
+CLK_DeInit               0x0090a6   0x36  Code  Gb  stm8s_clk.o [1]
+CLK_HSICmd               0x00910d   0x2f  Code  Gb  stm8s_clk.o [1]
+CLK_IRQHandler           0x009346    0x1  Code  Gb  stm8s_it.o [1]
+CLK_SYSCLKConfig         0x008b37   0x8b  Code  Gb  stm8s_clk.o [1]
+CSTACK$$Base             0x000300          --   Gb  - Linker created -
+CSTACK$$Limit            0x000400          --   Gb  - Linker created -
+EEPROM_EEC_IRQHandler    0x009356    0x1  Code  Gb  stm8s_it.o [1]
+EXTI_PORTA_IRQHandler    0x009347    0x1  Code  Gb  stm8s_it.o [1]
+EXTI_PORTB_IRQHandler    0x009348    0x1  Code  Gb  stm8s_it.o [1]
+EXTI_PORTC_IRQHandler    0x009349    0x1  Code  Gb  stm8s_it.o [1]
+EXTI_PORTD_IRQHandler    0x00934a    0x1  Code  Gb  stm8s_it.o [1]
+EXTI_PORTE_IRQHandler    0x00934b    0x1  Code  Gb  stm8s_it.o [1]
+EXTI_SetExtIntSensitivity
+                         0x00870b   0xd1  Code  Gb  stm8s_exti.o [1]
+GPIO_DeInit              0x0092c2   0x14  Code  Gb  stm8s_gpio.o [1]
+GPIO_Init                0x0084ff  0x110  Code  Gb  stm8s_gpio.o [1]
+HW_Init                  0x008080  0x19e  Code  Gb  hw_init.o [1]
+I2C_IRQHandler           0x009353    0x1  Code  Gb  stm8s_it.o [1]
+INTVEC$$Base             0x008000          --   Gb  - Linker created -
+INTVEC$$Limit            0x008080          --   Gb  - Linker created -
+Region$$Table$$Base    0x00000000          --   Gb  - Linker created -
+Region$$Table$$Limit   0x00000000          --   Gb  - Linker created -
+SPI_IRQHandler           0x00934c    0x1  Code  Gb  stm8s_it.o [1]
 TIM1_CAP_COM_IRQHandler
-                         0x0080f1   0x1  Code  Gb  stm8s_it.o [1]
+                         0x00934e    0x1  Code  Gb  stm8s_it.o [1]
+TIM1_Cmd                 0x00913c   0x2f  Code  Gb  stm8s_tim1.o [1]
+TIM1_DeInit              0x008a9e   0x99  Code  Gb  stm8s_tim1.o [1]
+TIM1_OC1Init             0x0083b8  0x147  Code  Gb  stm8s_tim1.o [1]
+TIM1_TimeBaseInit        0x008c4c   0x60  Code  Gb  stm8s_tim1.o [1]
 TIM1_UPD_OVF_TRG_BRK_IRQHandler
-                         0x0080f0   0x1  Code  Gb  stm8s_it.o [1]
+                         0x00934d    0x1  Code  Gb  stm8s_it.o [1]
+TIM2_ARRPreloadConfig    0x00919a   0x2f  Code  Gb  stm8s_tim2.o [1]
 TIM2_CAP_COM_IRQHandler
-                         0x0080f3   0x1  Code  Gb  stm8s_it.o [1]
+                         0x009350    0x1  Code  Gb  stm8s_it.o [1]
+TIM2_Cmd                 0x00916b   0x2f  Code  Gb  stm8s_tim2.o [1]
+TIM2_DeInit              0x008d60   0x59  Code  Gb  stm8s_tim2.o [1]
+TIM2_OC1Init             0x00889a   0xac  Code  Gb  stm8s_tim2.o [1]
+TIM2_OC1PreloadConfig    0x0091c9   0x2f  Code  Gb  stm8s_tim2.o [1]
+TIM2_OC2Init             0x008946   0xac  Code  Gb  stm8s_tim2.o [1]
+TIM2_OC2PreloadConfig    0x0091f8   0x2f  Code  Gb  stm8s_tim2.o [1]
+TIM2_OC3Init             0x0089f2   0xac  Code  Gb  stm8s_tim2.o [1]
+TIM2_OC3PreloadConfig    0x009227   0x2f  Code  Gb  stm8s_tim2.o [1]
+TIM2_TimeBaseInit        0x009311    0xc  Code  Gb  stm8s_tim2.o [1]
 TIM2_UPD_OVF_BRK_IRQHandler
-                         0x0080f2   0x1  Code  Gb  stm8s_it.o [1]
+                         0x00934f    0x1  Code  Gb  stm8s_it.o [1]
+TIM4_ClearFlag           0x009285   0x24  Code  Gb  stm8s_tim4.o [1]
+TIM4_Cmd                 0x009256   0x2f  Code  Gb  stm8s_tim4.o [1]
+TIM4_DeInit              0x0092a9   0x19  Code  Gb  stm8s_tim4.o [1]
+TIM4_ITConfig            0x008e5f   0x50  Code  Gb  stm8s_tim4.o [1]
+TIM4_TimeBaseInit        0x008e0e   0x51  Code  Gb  stm8s_tim4.o [1]
 TIM4_UPD_OVF_IRQHandler
-                         0x0080f8   0x1  Code  Gb  stm8s_it.o [1]
-TLI_IRQHandler           0x0080e7   0x1  Code  Gb  stm8s_it.o [1]
-TRAP_IRQHandler          0x0080e6   0x1  Code  Gb  stm8s_it.o [1]
-UART1_RX_IRQHandler      0x0080f5   0x1  Code  Gb  stm8s_it.o [1]
-UART1_TX_IRQHandler      0x0080f4   0x1  Code  Gb  stm8s_it.o [1]
-__DebugBreak             0x0080fa   0x1  Code  Gb  __dbg_break.o [3]
-__exit                   0x0080ac  0x14  Code  Gb  __dbg_xxexit.o [3]
-__iar_data_init2         0x008098  0x14  Code  Gb  init.o [4]
-__iar_program_start      0x0080c0        Code  Gb  cstartup.o [4]
+                         0x009355    0x1  Code  Gb  stm8s_it.o [1]
+TLI_IRQHandler           0x009344    0x1  Code  Gb  stm8s_it.o [1]
+TRAP_IRQHandler          0x009343    0x1  Code  Gb  stm8s_it.o [1]
+UART1_RX_IRQHandler      0x009352    0x1  Code  Gb  stm8s_it.o [1]
+UART1_TX_IRQHandler      0x009351    0x1  Code  Gb  stm8s_it.o [1]
+__DebugBreak             0x009357    0x1  Code  Gb  __dbg_break.o [3]
+__exit                   0x0092ea   0x14  Code  Gb  __dbg_xxexit.o [3]
+__iar_data_init2         0x0092d6   0x14  Code  Gb  init.o [4]
+__iar_program_start      0x0092fe         Code  Gb  cstartup.o [4]
 __iar_unhandled_exception
-                         0x0080e1        Code  Gb  unhandled_exception.o [4]
-__intvec                 0x008000        Data  Gb  interrupt.o [4]
-__low_level_init         0x0080db   0x3  Code  Gb  low_level_init.o [4]
-_exit                    0x0080d3        Code  Gb  cexit.o [4]
-_interrupt_1             0x0080e6        Code  Gb  stm8s_it.o [1]
-_interrupt_12            0x0080ef        Code  Gb  stm8s_it.o [1]
-_interrupt_13            0x0080f0        Code  Gb  stm8s_it.o [1]
-_interrupt_14            0x0080f1        Code  Gb  stm8s_it.o [1]
-_interrupt_15            0x0080f2        Code  Gb  stm8s_it.o [1]
-_interrupt_16            0x0080f3        Code  Gb  stm8s_it.o [1]
-_interrupt_19            0x0080f4        Code  Gb  stm8s_it.o [1]
-_interrupt_2             0x0080e7        Code  Gb  stm8s_it.o [1]
-_interrupt_20            0x0080f5        Code  Gb  stm8s_it.o [1]
-_interrupt_21            0x0080f6        Code  Gb  stm8s_it.o [1]
-_interrupt_24            0x0080f7        Code  Gb  stm8s_it.o [1]
-_interrupt_25            0x0080f8        Code  Gb  stm8s_it.o [1]
-_interrupt_26            0x0080f9        Code  Gb  stm8s_it.o [1]
-_interrupt_3             0x0080e8        Code  Gb  stm8s_it.o [1]
-_interrupt_4             0x0080e9        Code  Gb  stm8s_it.o [1]
-_interrupt_5             0x0080ea        Code  Gb  stm8s_it.o [1]
-_interrupt_6             0x0080eb        Code  Gb  stm8s_it.o [1]
-_interrupt_7             0x0080ec        Code  Gb  stm8s_it.o [1]
-_interrupt_8             0x0080ed        Code  Gb  stm8s_it.o [1]
-_interrupt_9             0x0080ee        Code  Gb  stm8s_it.o [1]
-exit                     0x0080de   0x3  Code  Gb  exit.o [4]
-main                     0x0080e4   0x2  Code  Gb  main.o [1]
+                         0x00933e         Code  Gb  unhandled_exception.o [4]
+__intvec                 0x008000         Data  Gb  interrupt.o [4]
+__low_level_init         0x009338    0x3  Code  Gb  low_level_init.o [4]
+_exit                    0x009330         Code  Gb  cexit.o [4]
+_interrupt_1             0x009343         Code  Gb  stm8s_it.o [1]
+_interrupt_12            0x00934c         Code  Gb  stm8s_it.o [1]
+_interrupt_13            0x00934d         Code  Gb  stm8s_it.o [1]
+_interrupt_14            0x00934e         Code  Gb  stm8s_it.o [1]
+_interrupt_15            0x00934f         Code  Gb  stm8s_it.o [1]
+_interrupt_16            0x009350         Code  Gb  stm8s_it.o [1]
+_interrupt_19            0x009351         Code  Gb  stm8s_it.o [1]
+_interrupt_2             0x009344         Code  Gb  stm8s_it.o [1]
+_interrupt_20            0x009352         Code  Gb  stm8s_it.o [1]
+_interrupt_21            0x009353         Code  Gb  stm8s_it.o [1]
+_interrupt_24            0x009354         Code  Gb  stm8s_it.o [1]
+_interrupt_25            0x009355         Code  Gb  stm8s_it.o [1]
+_interrupt_26            0x009356         Code  Gb  stm8s_it.o [1]
+_interrupt_3             0x009345         Code  Gb  stm8s_it.o [1]
+_interrupt_4             0x009346         Code  Gb  stm8s_it.o [1]
+_interrupt_5             0x009347         Code  Gb  stm8s_it.o [1]
+_interrupt_6             0x009348         Code  Gb  stm8s_it.o [1]
+_interrupt_7             0x009349         Code  Gb  stm8s_it.o [1]
+_interrupt_8             0x00934a         Code  Gb  stm8s_it.o [1]
+_interrupt_9             0x00934b         Code  Gb  stm8s_it.o [1]
+assert_failed            0x009341    0x2  Code  Gb  main.o [1]
+exit                     0x00933b    0x3  Code  Gb  exit.o [4]
+main                     0x00932b    0x5  Code  Gb  main.o [1]
 
 
 [1] = C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\Obj
@@ -266,9 +379,9 @@ main                     0x0080e4   0x2  Code  Gb  main.o [1]
 [3] = dbgstm8smd.a
 [4] = dlstm8smn.a
 
-  123 bytes of readonly  code memory
-  128 bytes of readonly  data memory
-  268 bytes of readwrite data memory
+  4 321 bytes of readonly  code memory
+    631 bytes of readonly  data memory
+    272 bytes of readwrite data memory
 
 Errors: none
 Warnings: none

+ 2 - 2
settings/tail_light_stm8.Debug.driver.xcl

@@ -1,10 +1,10 @@
 "-p" 
 
-"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\stm8\config\ddf\iostm8s003f3.ddf" 
+"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\stm8\config\ddf\iostm8s103f3.ddf" 
 
 "--mcuname" 
 
-"STM8S003F3" 
+"STM8S103F3P" 
 
 
 

+ 1 - 1
settings/tail_light_stm8.dbgdt

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
 <Project>
     <WindowStorage />
 </Project>

+ 11 - 0
settings/tail_light_stm8.dnx

@@ -48,6 +48,17 @@
         <FreqHi>0</FreqHi>
         <MultiCoreRunAll>1</MultiCoreRunAll>
     </Simulator>
+    <DebugChecksum>
+        <Checksum>2300248723</Checksum>
+    </DebugChecksum>
+    <RecentFlashDownload>
+        <Path>C:\Users\hero\Desktop\Taillight_Code\stm8_prj\Code\Debug\Exe\tail_light_stm8.out</Path>
+    </RecentFlashDownload>
+    <LogFile>
+        <LoggingEnabled>_ 0</LoggingEnabled>
+        <LogFile>_ ""</LogFile>
+        <Category>_ 0</Category>
+    </LogFile>
     <Breakpoints>
         <Count>0</Count>
     </Breakpoints>

Разница между файлами не показана из-за своего большого размера
+ 17 - 15
settings/tail_light_stm8.wsdt


+ 325 - 285
tail_light_stm8.dep

@@ -1,179 +1,184 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project>
     <fileVersion>2</fileVersion>
-    <fileChecksum>2229333399</fileChecksum>
+    <fileChecksum>3543697016</fileChecksum>
     <configuration>
         <name>Debug</name>
         <outputs>
-            <file>$PROJ_DIR$\lib\src\stm8s_i2c.c</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_adc1.c</file>
             <file>$PROJ_DIR$\lib\src\stm8s_uart1.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_uart3.c</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_i2c.c</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_tim2.c</file>
             <file>$PROJ_DIR$\lib\src\stm8s_beep.c</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_clk.c</file>
             <file>$PROJ_DIR$\lib\src\stm8s_exti.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_wwdg.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_tim1.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_adc2.c</file>
             <file>$PROJ_DIR$\lib\src\stm8s_awu.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_tim3.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_uart2.c</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_spi.c</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_tim1.c</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_itc.c</file>
             <file>$PROJ_DIR$\lib\src\stm8s_iwdg.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_tim2.c</file>
             <file>$PROJ_DIR$\lib\src\stm8s_gpio.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_tim5.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_uart4.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_can.c</file>
             <file>$PROJ_DIR$\lib\src\stm8s_rst.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_spi.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_adc1.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_clk.c</file>
             <file>$PROJ_DIR$\lib\src\stm8s_tim4.c</file>
             <file>$PROJ_DIR$\lib\src\stm8s_flash.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_itc.c</file>
-            <file>$PROJ_DIR$\lib\src\stm8s_tim6.c</file>
+            <file>$PROJ_DIR$\usr\src\stm8s_it.c</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_adc1.pbi</file>
+            <file>$PROJ_DIR$\Debug\Exe\tail_light_stm8.out</file>
+            <file>$PROJ_DIR$\main.c</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_flash.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_itc.pbi</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_uart2.c</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_beep.pbi</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_wwdg.c</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_tim6.c</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_uart3.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_adc1.pbi</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_uart4.c</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_can.c</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_uart1.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_beep.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_iwdg.pbi</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_tim3.c</file>
+            <file>$PROJ_DIR$\usr\src\hw_init.c</file>
+            <file>$PROJ_DIR$\Debug\Obj\tail_light_stm8.pbd</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_exti.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_rst.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_gpio.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_spi.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_i2c.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_awu.pbi</file>
-            <file>$PROJ_DIR$\main.c</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_uart2.o</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_wwdg.o</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_adc2.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_can.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_i2c.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_itc.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_iwdg.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_rst.pbi</file>
+            <file>$PROJ_DIR$\usr\src\main.c</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_awu.pbi</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_uart4.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_can.pbi</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_clk.pbi</file>
-            <file>$TOOLKIT_DIR$\config\lnkstm8s003f3.icf</file>
-            <file>$PROJ_DIR$\Debug\Exe\tail_light_stm8.out</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim5.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\tail_light_stm8.pbd</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_gpio.pbi</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_tim6.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\main.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\main.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart1.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart2.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim3.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim4.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim6.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim5.o</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_adc2.c</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_exti.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim1.o</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_rst.h</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_tim5.c</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s.h</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_tim1.h</file>
+            <file>$TOOLKIT_DIR$\inc\c\intrinsics.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_spi.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim5.pbi</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_tim1.pbi</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_tim2.pbi</file>
-            <file>$PROJ_DIR$\usr\src\stm8s_it.c</file>
-            <file>$PROJ_DIR$\usr\src\main.c</file>
             <file>$PROJ_DIR$\lib\inc\stm8s_itc.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_beep.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_gpio.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_tim1.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_exti.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart1.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_clk.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\main.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_spi.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim2.o</file>
             <file>$PROJ_DIR$\usr\inc\stm8s_conf.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_rst.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_tim4.h</file>
-            <file>$TOOLKIT_DIR$\inc\c\intrinsics.h</file>
+            <file>$PROJ_DIR$\lib\src\stm8s_uart3.c</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_rst.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim3.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim5.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_clk.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\main.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim3.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart2.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim4.pbi</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_tim4.h</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_gpio.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim6.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_itc.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim1.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim2.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_spi.o</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_adc1.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_adc2.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim4.o</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_beep.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_it.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_wwdg.pbi</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_exti.o</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_tim2.h</file>
+            <file>$PROJ_DIR$\usr\inc\stm8s_it.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_itc.o</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_iwdg.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_awu.o</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_beep.o</file>
+            <file>$TOOLKIT_DIR$\lib\dbgstm8smd.a</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_awu.__cstat.et</file>
+            <file>$TOOLKIT_DIR$\lib\dlstm8smn.a</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart4.pbi</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_can.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_flash.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_exti.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_adc2.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart3.pbi</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_i2c.o</file>
-            <file>$TOOLKIT_DIR$\lib\dbgstm8smd.a</file>
-            <file>$PROJ_DIR$\Debug\List\tail_light_stm8.map</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_flash.h</file>
             <file>$PROJ_DIR$\lib\inc\stm8s_clk.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_awu.h</file>
-            <file>$TOOLKIT_DIR$\lib\dlstm8smn.a</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_beep.__cstat.et</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_flash.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_gpio.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_flash.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim4.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_adc2.o</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_i2c.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_itc.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_iwdg.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_adc2.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_awu.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_adc1.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_can.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_exti.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_clk.__cstat.et</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_it.o</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_it.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart3.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart4.pbi</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_wwdg.pbi</file>
-            <file>$PROJ_DIR$\usr\inc\stm8s_it.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_tim2.h</file>
             <file>$PROJ_DIR$\lib\inc\stm8s_iwdg.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_wwdg.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_spi.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_i2c.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_adc1.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_tim5.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_tim6.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_uart1.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_tim3.h</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart1.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart2.__cstat.et</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_gpio.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_exti.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_clk.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_awu.o</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_flash.h</file>
+            <file>$PROJ_DIR$\Debug\List\tail_light_stm8.map</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_can.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_beep.__cstat.et</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_can.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim3.__cstat.et</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_tim5.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_iwdg.__cstat.et</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_wwdg.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\main.__cstat.et</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_uart4.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_it.__cstat.et</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_spi.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_it.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim6.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\main.__cstat.et</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_tim2.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim3.__cstat.et</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_uart4.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart1.__cstat.et</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_uart1.h</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_tim4.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim1.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_gpio.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_uart2.__cstat.et</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_rst.__cstat.et</file>
-            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim6.__cstat.et</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_tim5.h</file>
             <file>$PROJ_DIR$\Debug\Obj\stm8s_uart3.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_tim1.__cstat.et</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_tim3.h</file>
             <file>$PROJ_DIR$\lib\inc\stm8s_adc2.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_can.h</file>
             <file>$PROJ_DIR$\lib\inc\stm8s_uart2.h</file>
             <file>$PROJ_DIR$\lib\inc\stm8s_uart3.h</file>
-            <file>$PROJ_DIR$\lib\inc\stm8s_uart4.h</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_adc1.h</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_wwdg.h</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_tim6.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_itc.__cstat.et</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_awu.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\stm8s_adc1.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Obj\hw_init.pbi</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_i2c.h</file>
+            <file>$PROJ_DIR$\usr\inc\hw_init.h</file>
+            <file>$PROJ_DIR$\lib\inc\stm8s_spi.h</file>
+            <file>$PROJ_DIR$\Debug\Obj\hw_init.o</file>
+            <file>$PROJ_DIR$\Debug\Obj\hw_init.__cstat.et</file>
+            <file>$PROJ_DIR$\Debug\Exe\tail_light_stm8.hex</file>
+            <file>$TOOLKIT_DIR$\config\lnkstm8s103f3.icf</file>
         </outputs>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_i2c.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_adc1.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 89</file>
+                    <file> 76</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 99</file>
+                    <file> 140</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 36</file>
+                    <file> 17</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 118 63 66 119 94 61 93 65 92 62 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 135 54 67 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 61 63 67 66 62 68 65 60 64 69 94 93 92 118 115 117 114 116</file>
+                    <file> 52 77 54 102 74 67 135 50 61 55 123 56 139 94 106 142 101 144 81 136</file>
                 </tool>
             </inputs>
         </file>
@@ -182,173 +187,173 @@
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 29</file>
+                    <file> 28</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 124</file>
+                    <file> 122</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 52</file>
+                    <file> 62</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 122 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 116 69</file>
+                    <file> 123 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 114 63 92 94 115 69 93 118 117 116 66 61 65 62 60 67 64 68 122</file>
+                    <file> 61 135 123 54 67 50 55 77 102 52 74 56 139 94 106 142 101 144 81 136</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_uart3.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_i2c.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 27</file>
+                    <file> 93</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 138</file>
+                    <file> 99</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 110</file>
+                    <file> 36</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 142 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 142 54 67 135 139 77 94 50 106 102 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 66 68 63 62 61 67 65 60 64 69 94 93 92 118 115 117 114 116 142</file>
+                    <file> 139 136 54 101 56 106 81 94 142 144 67 135 77 50 102 61 52 55 74 123</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_beep.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_tim2.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 85</file>
+                    <file> 66</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 96</file>
+                    <file> 120</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 30</file>
+                    <file> 60</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 61 63 66 119 94 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 81 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 62 63 66 68 61 67 65 60 64 69 94 93 92 118 115 117 114 116</file>
+                    <file> 54 77 52 102 74 67 135 50 61 55 123 81 56 139 94 106 142 101 144 136</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_exti.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_beep.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 88</file>
+                    <file> 85</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 106</file>
+                    <file> 109</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 32</file>
+                    <file> 22</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 65 63 66 119 94 61 93 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 77 54 67 135 139 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 92 63 114 94 115 69 93 118 117 116 66 61 65 62 60 67 64 68</file>
+                    <file> 106 54 56 81 139 101 136 94 142 144 67 135 77 50 102 61 52 55 74 123</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_wwdg.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_clk.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 40</file>
+                    <file> 63</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 127</file>
+                    <file> 104</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 112</file>
+                    <file> 44</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 116 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 69</file>
+                    <file> 94 54 67 135 139 77 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 67 61 66 62 68 63 65 60 64 69 94 93 92 118 115 117 114 116</file>
+                    <file> 101 139 136 54 56 106 81 94 142 144 67 135 77 50 102 61 52 55 74 123</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_tim1.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_exti.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 77</file>
+                    <file> 80</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 135</file>
+                    <file> 103</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 56</file>
+                    <file> 32</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 64 63 66 119 94 61 93 65 92 62 118 60 115 67 117 114 68 122 116 69</file>
+                    <file> 50 54 67 135 139 77 94 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 63 60 65 64 66 61 62 67 68 69 94 93 92 118 115 117 114 116</file>
+                    <file> 50 67 55 135 61 123 54 77 102 52 74 56 139 94 106 142 101 144 81 136</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_adc2.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_awu.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 81</file>
+                    <file> 105</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 102</file>
+                    <file> 87</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
@@ -358,88 +363,92 @@
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 139 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 139 54 67 135 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 62 63 66 68 61 67 65 60 64 69 94 93 92 118 115 117 114 116 139</file>
+                    <file> 74 54 102 77 52 67 135 50 61 55 123 56 139 94 106 142 101 144 81 136</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_awu.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_spi.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 84</file>
+                    <file> 65</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 103</file>
+                    <file> 116</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 37</file>
+                    <file> 57</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 94 63 66 119 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 144 54 67 135 139 77 94 50 106 102 142 61 101 52 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 116 63 69 118 93 117 94 92 115 114 66 61 65 62 60 67 64 68</file>
+                    <file> 101 139 136 56 106 81 94 142 144 54 67 135 77 50 102 61 52 55 74 123</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_tim3.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_tim1.c</name>
             <outputs>
+                <tool>
+                    <name>ICCSTM8</name>
+                    <file> 51</file>
+                </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 133</file>
+                    <file> 130</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 54</file>
+                    <file> 59</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 123 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 55 54 67 135 139 77 94 50 106 102 142 61 101 52 144 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 60 63 65 64 66 61 62 67 68 69 94 93 92 118 115 117 114 116 123</file>
+                    <file> 54 74 102 77 52 67 135 50 61 55 123 56 139 94 106 142 101 144 81 136</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_uart2.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_itc.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 39</file>
+                    <file> 83</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 125</file>
+                    <file> 138</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 53</file>
+                    <file> 37</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 141 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 61 54 67 135 139 77 94 50 106 102 142 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 62 66 68 61 67 63 65 60 64 69 94 93 92 118 115 117 114 116 141</file>
+                    <file> 52 54 77 102 74 67 135 50 61 55 123 56 139 94 106 142 101 144 81 136</file>
                 </tool>
             </inputs>
         </file>
@@ -448,496 +457,527 @@
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 83</file>
+                    <file> 84</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 101</file>
+                    <file> 113</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 31</file>
+                    <file> 38</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 115 63 66 119 94 61 93 65 92 62 118 60 67 117 64 114 68 122 116 69</file>
+                    <file> 101 54 67 135 139 77 94 50 106 102 142 61 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 63 65 64 60 66 61 62 67 68 69 94 93 92 118 115 117 114 116</file>
+                    <file> 94 144 142 54 56 139 106 101 81 136 67 135 77 50 102 61 52 55 74 123</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_tim2.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_gpio.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 78</file>
+                    <file> 75</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 132</file>
+                    <file> 125</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 57</file>
+                    <file> 45</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 114 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 68 122 116 69</file>
+                    <file> 102 54 67 135 139 77 94 50 106 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 65 63 64 60 66 61 62 67 68 114 69 94 93 92 118 115 117 116</file>
+                    <file> 77 52 54 102 74 67 135 50 61 55 123 56 139 94 106 142 101 144 81 136</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_gpio.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_rst.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 74</file>
+                    <file> 69</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 98</file>
+                    <file> 127</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 34</file>
+                    <file> 39</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 62 63 66 119 94 61 93 65 92 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 52 54 67 135 139 77 94 50 106 102 142 61 101 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 93 117 63 69 118 116 94 92 115 114 66 61 65 62 60 67 64 68</file>
+                    <file> 144 94 142 56 139 106 101 81 136 54 67 135 77 50 102 61 52 55 74 123</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_tim5.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_tim4.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 72</file>
+                    <file> 97</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 126</file>
+                    <file> 124</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 47</file>
+                    <file> 73</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 120 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 74 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 116 69 118 63 93 117 94 92 115 114 120 66 61 65 62 60 67 64 68</file>
+                    <file> 56 81 106 54 139 101 136 94 142 144 67 135 77 50 102 61 52 55 74 123</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_uart4.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_flash.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 43</file>
+                    <file> 96</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 129</file>
+                    <file> 95</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 111</file>
+                    <file> 20</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 143 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 106 54 67 135 139 77 94 50 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 63 115 94 92 114 69 93 118 117 116 66 61 65 62 60 67 64 68 143</file>
+                    <file> 101 139 136 56 106 81 94 142 144 54 67 135 77 50 102 61 52 55 74 123</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_can.c</name>
+            <name>$PROJ_DIR$\usr\src\stm8s_it.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 86</file>
+                    <file> 100</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 105</file>
+                    <file> 117</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 42</file>
+                    <file> 78</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 140 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 82 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 116 69 118 93 117 63 94 92 115 114 140 66 61 65 62 60 67 64 68</file>
+                    <file> 101 54 139 136 56 106 81 94 142 144 67 135 77 50 102 61 52 55 74 123 82</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_rst.c</name>
+            <name>$PROJ_DIR$\Debug\Exe\tail_light_stm8.out</name>
+            <outputs>
+                <tool>
+                    <name>OBJCOPY</name>
+                    <file> 147</file>
+                </tool>
+                <tool>
+                    <name>ILINK</name>
+                    <file> 107</file>
+                </tool>
+            </outputs>
+            <inputs>
+                <tool>
+                    <name>ILINK</name>
+                    <file> 148 145 64 76 105 85 63 80 96 75 93 100 83 84 69 65 51 66 97 28 34 88 86</file>
+                </tool>
+            </inputs>
+        </file>
+        <file>
+            <name>$PROJ_DIR$\main.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
+                    <file> 64</file>
+                </tool>
+                <tool>
+                    <name>BICOMP</name>
                     <file> 70</file>
                 </tool>
+            </outputs>
+        </file>
+        <file>
+            <name>$PROJ_DIR$\lib\src\stm8s_uart2.c</name>
+            <outputs>
+                <tool>
+                    <name>ICCSTM8</name>
+                    <file> 33</file>
+                </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 136</file>
+                    <file> 126</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 33</file>
+                    <file> 72</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 67 63 66 119 94 61 93 65 92 62 118 60 115 117 64 114 68 122 116 69</file>
+                    <file> 133 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 64 65 63 60 66 61 62 67 68 69 94 93 92 118 115 117 114 116</file>
+                    <file> 102 67 74 77 52 54 50 61 55 56 139 94 106 142 101 144 81 136 133</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_spi.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_wwdg.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 79</file>
+                    <file> 34</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 131</file>
+                    <file> 114</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 35</file>
+                    <file> 79</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 117 63 66 119 94 61 93 65 92 62 118 60 115 67 64 114 68 122 116 69</file>
+                    <file> 136 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 67 61 63 66 62 68 65 60 64 69 94 93 92 118 115 117 114 116</file>
+                    <file> 54 101 139 136 56 106 81 94 142 144 67 135 77 50 102 61 52 55 74 123</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_adc1.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_tim6.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 80</file>
+                    <file> 47</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 104</file>
+                    <file> 118</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 28</file>
+                    <file> 46</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 119 63 66 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 137 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 63 65 64 60 66 61 62 67 68 69 94 93 92 118 115 117 114 116 119</file>
+                    <file> 102 54 67 74 77 52 50 61 55 56 139 94 106 142 101 144 81 136 137</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_clk.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_uart4.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 73</file>
+                    <file> 42</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 107</file>
+                    <file> 115</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 44</file>
+                    <file> 89</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 93 63 66 119 94 61 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 121 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 67 63 61 66 62 68 65 60 64 69 94 93 92 118 115 117 114 116</file>
+                    <file> 54 101 139 106 81 56 94 142 144 136 67 77 50 102 61 52 55 74 121</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_tim4.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_can.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 82</file>
+                    <file> 90</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 134</file>
+                    <file> 108</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 55</file>
+                    <file> 43</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 68 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 122 116 69</file>
+                    <file> 110 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 66 68 62 63 61 67 65 60 64 69 94 93 92 118 115 117 114 116</file>
+                    <file> 136 56 142 94 144 54 139 106 101 81 110 67 77 50 102 61 52 55 74</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_flash.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_tim3.c</name>
             <outputs>
-                <tool>
-                    <name>ICCSTM8</name>
-                    <file> 87</file>
-                </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 97</file>
+                    <file> 111</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 25</file>
+                    <file> 71</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 92 63 66 119 94 61 93 65 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 131 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 63 64 65 60 66 61 62 67 68 69 94 93 92 118 115 117 114 116</file>
+                    <file> 61 54 50 55 67 77 102 52 74 56 139 94 106 142 101 144 81 136 131</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_itc.c</name>
+            <name>$PROJ_DIR$\usr\src\hw_init.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 76</file>
+                    <file> 145</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 100</file>
+                    <file> 146</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 26</file>
+                    <file> 141</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 60 63 66 119 94 61 93 65 92 62 118 115 67 117 64 114 68 122 116 69</file>
+                    <file> 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 63 118 69 116 93 117 94 92 115 114 66 61 65 62 60 67 64 68</file>
+                    <file> 61 135 123 67 50 55 54 77 102 52 74 56 139 94 106 142 101 144 81 136</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\lib\src\stm8s_tim6.c</name>
+            <name>$PROJ_DIR$\usr\src\main.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 75</file>
+                    <file> 64</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 137</file>
+                    <file> 119</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 49</file>
+                    <file> 70</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 121 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56 143</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 62 63 66 68 61 67 65 60 64 69 94 93 92 118 115 117 114 116 121</file>
+                    <file> 94 144 142 54 56 139 106 101 81 136 143 67 135 77 50 102 61 52 55 74 123</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\main.c</name>
+            <name>[ROOT_NODE]</name>
             <outputs>
                 <tool>
-                    <name>ICCSTM8</name>
-                    <file> 50</file>
-                </tool>
-                <tool>
-                    <name>BICOMP</name>
-                    <file> 51</file>
+                    <name>ILINK</name>
+                    <file> 18 107</file>
                 </tool>
             </outputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\Debug\Exe\tail_light_stm8.out</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_adc2.c</name>
             <outputs>
                 <tool>
-                    <name>ILINK</name>
+                    <name>ICCSTM8</name>
+                    <file> 98</file>
+                </tool>
+                <tool>
+                    <name>__cstat</name>
                     <file> 91</file>
                 </tool>
+                <tool>
+                    <name>BICOMP</name>
+                    <file> 35</file>
+                </tool>
             </outputs>
             <inputs>
                 <tool>
-                    <name>ILINK</name>
-                    <file> 45 50 80 84 85 73 88 87 74 89 108 76 83 70 79 77 78 82 29 40 95 90</file>
+                    <name>ICCSTM8</name>
+                    <file> 132 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
-            </inputs>
-        </file>
-        <file>
-            <name>[ROOT_NODE]</name>
-            <outputs>
                 <tool>
-                    <name>ILINK</name>
-                    <file> 46 91</file>
+                    <name>BICOMP</name>
+                    <file> 102 54 67 74 77 52 50 61 55 56 139 94 106 142 101 144 81 136 132</file>
                 </tool>
-            </outputs>
+            </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\usr\src\stm8s_it.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_tim5.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 108</file>
+                    <file> 48</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 130</file>
+                    <file> 112</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 109</file>
+                    <file> 58</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 113 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 128 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 63 60 65 64 66 61 62 67 68 69 94 93 92 118 115 117 114 116 113</file>
+                    <file> 136 56 142 54 94 144 139 106 101 81 128 67 77 50 102 61 52 55 74</file>
                 </tool>
             </inputs>
         </file>
         <file>
-            <name>$PROJ_DIR$\usr\src\main.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_uart3.c</name>
             <outputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 50</file>
+                    <file> 25</file>
                 </tool>
                 <tool>
                     <name>__cstat</name>
-                    <file> 128</file>
+                    <file> 129</file>
                 </tool>
                 <tool>
                     <name>BICOMP</name>
-                    <file> 51</file>
+                    <file> 92</file>
                 </tool>
             </outputs>
             <inputs>
                 <tool>
                     <name>ICCSTM8</name>
-                    <file> 63 66 119 94 61 93 65 92 62 118 60 115 67 117 64 114 68 122 116 69</file>
+                    <file> 134 54 67 135 139 77 94 50 106 102 142 61 101 52 144 55 81 74 123 136 56</file>
+                </tool>
+                <tool>
+                    <name>BICOMP</name>
+                    <file> 67 74 54 102 77 52 50 61 55 56 139 94 106 142 101 144 81 136 134</file>
                 </tool>
             </inputs>
         </file>
         <forcedrebuild>
-            <name>$PROJ_DIR$\lib\src\stm8s_uart3.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_uart2.c</name>
             <tool>ICCSTM8</tool>
         </forcedrebuild>
         <forcedrebuild>
-            <name>$PROJ_DIR$\lib\src\stm8s_adc2.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_tim6.c</name>
             <tool>ICCSTM8</tool>
         </forcedrebuild>
         <forcedrebuild>
-            <name>$PROJ_DIR$\lib\src\stm8s_tim3.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_uart4.c</name>
             <tool>ICCSTM8</tool>
         </forcedrebuild>
         <forcedrebuild>
-            <name>$PROJ_DIR$\lib\src\stm8s_uart2.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_can.c</name>
             <tool>ICCSTM8</tool>
         </forcedrebuild>
         <forcedrebuild>
-            <name>$PROJ_DIR$\lib\src\stm8s_tim5.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_tim3.c</name>
             <tool>ICCSTM8</tool>
         </forcedrebuild>
         <forcedrebuild>
-            <name>$PROJ_DIR$\lib\src\stm8s_uart4.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_adc2.c</name>
             <tool>ICCSTM8</tool>
         </forcedrebuild>
         <forcedrebuild>
-            <name>$PROJ_DIR$\lib\src\stm8s_can.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_tim5.c</name>
             <tool>ICCSTM8</tool>
         </forcedrebuild>
         <forcedrebuild>
-            <name>$PROJ_DIR$\lib\src\stm8s_tim6.c</name>
+            <name>$PROJ_DIR$\lib\src\stm8s_uart3.c</name>
             <tool>ICCSTM8</tool>
         </forcedrebuild>
     </configuration>

+ 9 - 6
tail_light_stm8.ewp

@@ -16,7 +16,7 @@
                 <debug>1</debug>
                 <option>
                     <name>GenDeviceSelectMenu</name>
-                    <state>STM8S003F3	STM8S003F3</state>
+                    <state>STM8S103F3P	STM8S103F3P</state>
                 </option>
                 <option>
                     <name>GenCodeModel</name>
@@ -188,7 +188,7 @@
                 </option>
                 <option>
                     <name>CCDefines</name>
-                    <state>STM8S003</state>
+                    <state>STM8S103</state>
                 </option>
                 <option>
                     <name>CCPreprocFile</name>
@@ -480,7 +480,7 @@
                 <option>
                     <name>OOCOutputFormat</name>
                     <version>2</version>
-                    <state>0</state>
+                    <state>1</state>
                 </option>
                 <option>
                     <name>OCOutputOverride</name>
@@ -488,7 +488,7 @@
                 </option>
                 <option>
                     <name>OOCOutputFile</name>
-                    <state>tail_light_stm8.srec</state>
+                    <state>tail_light_stm8.hex</state>
                 </option>
                 <option>
                     <name>OOCCommandLineProducer</name>
@@ -496,7 +496,7 @@
                 </option>
                 <option>
                     <name>OOCObjCopyEnable</name>
-                    <state>0</state>
+                    <state>1</state>
                 </option>
             </data>
         </settings>
@@ -607,7 +607,7 @@
                 </option>
                 <option>
                     <name>IlinkIcfFile</name>
-                    <state>$TOOLKIT_DIR$\config\lnkstm8s003f3.icf</state>
+                    <state>$TOOLKIT_DIR$\config\lnkstm8s103f3.icf</state>
                 </option>
                 <option>
                     <name>IlinkIcfFileSlave</name>
@@ -1660,6 +1660,9 @@
     </group>
     <group>
         <name>USR</name>
+        <file>
+            <name>$PROJ_DIR$\usr\src\hw_init.c</name>
+        </file>
         <file>
             <name>$PROJ_DIR$\usr\src\main.c</name>
         </file>

+ 3 - 0
tail_light_stm8.ewt

@@ -2153,6 +2153,9 @@
     </group>
     <group>
         <name>USR</name>
+        <file>
+            <name>$PROJ_DIR$\usr\src\hw_init.c</name>
+        </file>
         <file>
             <name>$PROJ_DIR$\usr\src\main.c</name>
         </file>

+ 8 - 0
usr/inc/hw_init.h

@@ -0,0 +1,8 @@
+#ifndef __HW_INIT_H
+#define __HW_INIT_H
+
+#include "stm8s.h"
+
+void HW_Init(void);
+
+#endif

+ 72 - 0
usr/src/hw_init.c

@@ -0,0 +1,72 @@
+#include "stm8s.h"
+
+void HW_Init(void)
+{
+  //时钟设置
+  CLK_DeInit();                        
+  CLK_HSICmd(ENABLE); //配置内部高速时钟  
+  CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV1); //内核1分频
+  CLK_SYSCLKConfig(CLK_PRESCALER_HSIDIV8); //时钟8分频
+
+  //GPIO
+  GPIO_DeInit(GPIOD);
+  GPIO_Init(GPIOD, GPIO_PIN_4, GPIO_MODE_IN_FL_IT); //PD4 KEY
+  EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOD, EXTI_SENSITIVITY_FALL_ONLY);
+  GPIO_DeInit(GPIOC);
+  GPIO_Init(GPIOC, GPIO_PIN_3, GPIO_MODE_IN_PU_IT); //PC3 INT2
+  EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOC, EXTI_SENSITIVITY_FALL_ONLY);
+  GPIO_Init(GPIOC, GPIO_PIN_7, GPIO_MODE_IN_PU_IT); //PC7 INT7
+  EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOC, EXTI_SENSITIVITY_FALL_ONLY);
+  GPIO_DeInit(GPIOB);
+  GPIO_Init(GPIOB, GPIO_PIN_4, GPIO_MODE_OUT_OD_HIZ_FAST); //SCL
+  GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_OUT_OD_HIZ_FAST); //SDA
+  
+  //TIM4
+  TIM4_DeInit();
+  TIM4_TimeBaseInit(TIM4_PRESCALER_8, 255); //1ms
+  TIM4_ClearFlag(TIM4_FLAG_UPDATE);
+  TIM4_ITConfig(TIM4_IT_UPDATE, ENABLE);
+  TIM4_Cmd(ENABLE);
+  
+  //TIM1
+  TIM1_DeInit();
+  TIM1_TimeBaseInit(0, TIM1_COUNTERMODE_UP, 999, 0);
+  TIM1_OC1Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE, TIM1_OUTPUTNSTATE_DISABLE,
+               800, TIM1_OCPOLARITY_HIGH, TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_RESET,
+               TIM1_OCNIDLESTATE_SET);  //PWM1模式,输出使能,不互补,占空比800, 输出极性高,空闲低电平
+  TIM1_Cmd(ENABLE);
+  
+  //TIM2
+  TIM2_DeInit();
+  TIM2_TimeBaseInit(TIM2_PRESCALER_1, 999);
+  TIM2_OC1Init(TIM2_OCMODE_PWM1, TIM2_OUTPUTSTATE_ENABLE, 200, TIM2_OCPOLARITY_LOW);
+  TIM2_OC1PreloadConfig(ENABLE);
+  TIM2_OC2Init(TIM2_OCMODE_PWM1, TIM2_OUTPUTSTATE_ENABLE, 200, TIM2_OCPOLARITY_LOW);
+  TIM2_OC2PreloadConfig(ENABLE);       
+  TIM2_OC3Init(TIM2_OCMODE_PWM1, TIM2_OUTPUTSTATE_ENABLE, 200, TIM2_OCPOLARITY_LOW);
+  TIM2_OC3PreloadConfig(ENABLE);
+  TIM2_ARRPreloadConfig(ENABLE);
+  TIM2_Cmd(ENABLE);
+  
+  //ADC
+  GPIO_Init(GPIOD, GPIO_PIN_5, GPIO_MODE_IN_FL_NO_IT); //Light_in,ch5
+  GPIO_Init(GPIOD, GPIO_PIN_6, GPIO_MODE_IN_FL_NO_IT); //Vin,ch6
+  GPIO_Init(GPIOC, GPIO_PIN_4, GPIO_MODE_IN_FL_NO_IT); //Chg_in,ch2
+  ADC1_DeInit();
+  ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS, ADC1_CHANNEL_2, ADC1_PRESSEL_FCPU_D2, \
+            ADC1_EXTTRIG_TIM, DISABLE, ADC1_ALIGN_RIGHT, ADC1_SCHMITTTRIG_CHANNEL5,\
+            DISABLE);
+  ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS, ADC1_CHANNEL_5, ADC1_PRESSEL_FCPU_D2, \
+            ADC1_EXTTRIG_TIM, DISABLE, ADC1_ALIGN_RIGHT, ADC1_SCHMITTTRIG_CHANNEL5,\
+            DISABLE);
+  ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS, ADC1_CHANNEL_6, ADC1_PRESSEL_FCPU_D2, \
+            ADC1_EXTTRIG_TIM, DISABLE, ADC1_ALIGN_RIGHT, ADC1_SCHMITTTRIG_CHANNEL6,\
+            DISABLE);
+  ADC1_ITConfig(ADC1_IT_AWS2, ENABLE);
+  ADC1_ITConfig(ADC1_IT_AWS5, ENABLE);
+  ADC1_ITConfig(ADC1_IT_AWS6, ENABLE);
+
+  /* Enable general interrupts */  
+  enableInterrupts();
+}
+

+ 9 - 0
usr/src/main.c

@@ -28,13 +28,22 @@
 
 /* Includes ------------------------------------------------------------------*/
 #include "stm8s.h"
+#include "hw_init.h"
 
 /* Private defines -----------------------------------------------------------*/
+    
+    
 /* Private function prototypes -----------------------------------------------*/
+    
+    
 /* Private functions ---------------------------------------------------------*/
+    
 
 void main(void)
 {
+  /* Ó²¼þ³õʼ»¯ */
+  HW_Init();
+  
   /* Infinite loop */
   while (1)
   {

Некоторые файлы не были показаны из-за большого количества измененных файлов