27
27
from argparse import RawTextHelpFormatter
28
28
import subprocess
29
29
30
- GENPINMAP_VERSION = "1.20.3 "
30
+ GENPINMAP_VERSION = "1.20.4 "
31
31
32
32
ADD_DEVICE_IF = 0
33
33
ADD_GPIO_PINMAP = 0
@@ -240,25 +240,10 @@ def get_gpio_af_num_stm32f1(pintofind, iptofind):
240
240
) in myc .childNodes :
241
241
if mygpioaf != "" :
242
242
mygpioaf += " "
243
- mygpioaf += mygpioaflist .data .replace (
244
- "__HAL_" , ""
245
- ).replace (
246
- "_REMAP" , ""
247
- )
243
+ mygpioaf += mygpioaflist .data .replace ("__HAL_" , "" )
248
244
if mygpioaf == "" :
249
245
mygpioaf = "AFIO_NONE"
250
- return mygpioaf .replace ("AFIO_NONE" , "0" )\
251
- .replace ("AFIO_SPI1_ENABLE" , "1" )\
252
- .replace ("AFIO_I2C1_ENABLE" , "2" )\
253
- .replace ("AFIO_USART1_ENABLE" , "3" )\
254
- .replace ("AFIO_USART3_PARTIAL" , "5" )\
255
- .replace ("AFIO_TIM1_PARTIAL" , "6" )\
256
- .replace ("AFIO_TIM3_PARTIAL" , "7" )\
257
- .replace ("AFIO_TIM2_ENABLE" , "8" )\
258
- .replace ("AFIO_TIM2_PARTIAL_1" , "8" )\
259
- .replace ("AFIO_TIM2_PARTIAL_2" , "8" )\
260
- .replace ("AFIO_TIM3_ENABLE" , "9" )\
261
- .replace ("AFIO_CAN1_2" , "10" )
246
+ return mygpioaf
262
247
263
248
def store_pin (pin , name , functionality ):
264
249
# store pin I/O
@@ -395,6 +380,9 @@ def store_sys(pin, name, signal):
395
380
396
381
397
382
def make_cmakelist ():
383
+ global TARGET_NAME
384
+ if TARGET_NAME == "" :
385
+ TARGET_NAME = "xxx"
398
386
mbed_target = "mbed-" + TARGET_NAME .replace ("_" , "-" ).lower ()
399
387
mbed_family = "mbed-" + TARGET_SUBFAMILY .lower ()
400
388
@@ -534,7 +522,10 @@ def print_footer():
534
522
535
523
for EachLED in sorted (StandardLED ):
536
524
led_label = " // %s" % EachLED
537
- out_h_file .write ("#define LED%i %-5s %s\n " % (name_counter , re .sub (r'(P.)' , r'\1_' , StandardLED [EachLED ]), led_label ))
525
+ commented_line = ""
526
+ if "TODO" in led_label :
527
+ commented_line = "// "
528
+ out_h_file .write ("%s#define LED%i %-5s %s\n " % (commented_line , name_counter , re .sub (r'(P.)' , r'\1_' , StandardLED [EachLED ]), led_label ))
538
529
name_counter += 1
539
530
540
531
name_counter = 1
@@ -544,7 +535,10 @@ def print_footer():
544
535
button_label = ""
545
536
if EachBUTTON in PinLabel :
546
537
button_label = " // %s" % PinLabel [EachBUTTON ]
547
- out_h_file .write ("#define BUTTON%i %-5s %s\n " % (name_counter , re .sub (r'(P.)' , r'\1_' , EachBUTTON ).split ('/' )[0 ].split ('-' )[0 ], button_label ))
538
+ commented_line = ""
539
+ if "TODO" in button_label :
540
+ commented_line = "// "
541
+ out_h_file .write ("%s#define BUTTON%i %-5s %s\n " % (commented_line , name_counter , re .sub (r'(P.)' , r'\1_' , EachBUTTON ).split ('/' )[0 ].split ('-' )[0 ], button_label ))
548
542
name_counter += 1
549
543
550
544
line_to_write = ("""
@@ -1594,7 +1588,7 @@ def parse_board_file(file_name):
1594
1588
1595
1589
parser .add_argument ("-g" , "--gpio" , help = "Add GPIO PinMap table" , action = "store_true" )
1596
1590
parser .add_argument ("-n" , "--nopull" , help = "Avoid STM32_open_pin_data git pull" , action = "store_true" )
1597
- parser .add_argument ("-f" , "--flat" , help = "All targets stored in targets_custom /TARGET_STM/" , action = "store_true" )
1591
+ parser .add_argument ("-f" , "--flat" , help = "All targets stored in TARGET_CUSTOM /TARGET_STM/" , action = "store_true" )
1598
1592
parser .add_argument ("-d" , "--debug" , help = "Few debug info in console" , action = "store_true" )
1599
1593
1600
1594
args = parser .parse_args ()
@@ -1846,7 +1840,10 @@ def parse_board_file(file_name):
1846
1840
if args .mcu :
1847
1841
m = re .match ("(STM32[\w]{7})" , EachTargetName )
1848
1842
if m :
1849
- out_path = os .path .join (cur_dir , 'targets_custom' , 'TARGET_STM' , 'TARGET_%s' % TARGET_FAMILY , 'TARGET_%s' % TARGET_SUBFAMILY , 'TARGET_%s' % m .group (0 ))
1843
+ if FLAT_DIRECTORY == 0 :
1844
+ out_path = os .path .join (cur_dir , 'TARGET_CUSTOM' , 'TARGET_STM' , 'TARGET_%s' % TARGET_FAMILY , 'TARGET_%s' % TARGET_SUBFAMILY , 'TARGET_%s' % m .group (0 ))
1845
+ else :
1846
+ out_path = os .path .join (cur_dir , 'TARGET_CUSTOM' , 'TARGET_%s' % m .group (0 ))
1850
1847
if EachTargetName .endswith ('A' ):
1851
1848
out_path += "_A"
1852
1849
elif EachTargetName .endswith ('P' ):
@@ -1865,9 +1862,9 @@ def parse_board_file(file_name):
1865
1862
else :
1866
1863
if EachTargetName == MCU_USERNAME :
1867
1864
if FLAT_DIRECTORY == 0 :
1868
- out_path = os .path .join (cur_dir , 'targets_custom ' , 'TARGET_STM' , 'TARGET_%s' % TARGET_FAMILY , 'TARGET_%s' % TARGET_SUBFAMILY , 'TARGET_%s' % TARGET_NAME )
1865
+ out_path = os .path .join (cur_dir , 'TARGET_CUSTOM ' , 'TARGET_STM' , 'TARGET_%s' % TARGET_FAMILY , 'TARGET_%s' % TARGET_SUBFAMILY , 'TARGET_%s' % TARGET_NAME )
1869
1866
else :
1870
- out_path = os .path .join (cur_dir , 'targets_custom' , 'TARGET_STM ' , 'TARGET_%s' % TARGET_NAME )
1867
+ out_path = os .path .join (cur_dir , 'TARGET_CUSTOM ' , 'TARGET_%s' % TARGET_NAME )
1871
1868
else :
1872
1869
continue
1873
1870
@@ -1891,6 +1888,7 @@ def parse_board_file(file_name):
1891
1888
cmake_file = open (cmake_filename , 'w' )
1892
1889
1893
1890
#open input file
1891
+ DUAL_PAD = False
1894
1892
try :
1895
1893
xml_mcu = parse (input_file_name )
1896
1894
except :
0 commit comments