Skip to content
This repository was archived by the owner on Dec 6, 2018. It is now read-only.

Commit 43cef80

Browse files
committed
ke02: Fix UART config code generation issue. See, #365
1 parent ea95e2d commit 43cef80

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

platform/ke02/templates/uart_cfg.in.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ cfg = json.load(open(JSON_CFG))
2020
cfg = cfg['platform']
2121
2222
# UART device alias, used internally by bypass console driver
23-
template_console_dev = 'static constexpr uart_channel console_channel = uart_channel::ch%d;'
23+
template_console_dev = '''static constexpr uart_channel UART{CHANNEL_INDEX}_channel = uart_channel::ch{CHANNEL_INDEX};
24+
using UART{CHANNEL_INDEX}_driver = uart<UART{CHANNEL_INDEX}_channel>;
25+
using platform_console = UART{CHANNEL_INDEX}_driver;'''
2426
2527
# Gets string representation of UART theCore enum.
2628
def get_uart_enum(uart_cfg):
@@ -47,9 +49,11 @@ for uart_cfg in uart_cfgs:
4749
# Avoid using begin and end comment section tokens
4850
cog.outl(('\n%s* ' + uart_cfg['comment'] + ' *%s') % ('/', '/'))
4951
50-
cog.outl(template_console_dev % get_uart_enum(uart_cfg))
51-
cog.outl('using platform_console = uart<console_channel>;')
52+
cog.outl(template_console_dev.format(CHANNEL_INDEX = get_uart_enum(uart_cfg)))
5253
54+
if 'alias' in uart_cfg:
55+
cog.outl('using {ALIAS_NAME} = UART{CHANNEL_INDEX}_driver;'.format(ALIAS_NAME = uart_cfg['alias'],
56+
CHANNEL_INDEX = get_uart_enum(uart_cfg)))
5357
]]]*/
5458
//[[[end]]]
5559

0 commit comments

Comments
 (0)