Skip to content

Commit 72a9529

Browse files
author
Bogdan Marinescu
committed
Added on-line defined macros to the build system
Added 3 macros defined by the on-line build system to the off-line build system: MBED_BUILD_TIMESTAMP, MBED_USERNAME and __MBED__.
1 parent ea7ee81 commit 72a9529

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

workspace_tools/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@
7373

7474
BUILD_OPTIONS = []
7575

76+
# mbed.org username
77+
MBED_ORG_USER = ""
78+
7679
##############################################################################
7780
# Test System Settings
7881
##############################################################################

workspace_tools/toolchains/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
from copy import copy
2121
from types import ListType
2222
from inspect import getmro
23+
from time import time
2324

2425
from workspace_tools.utils import run_cmd, mkdir, rel_path, ToolException, split_path
2526
from workspace_tools.patch import patch
26-
from workspace_tools.settings import BUILD_OPTIONS
27+
from workspace_tools.settings import BUILD_OPTIONS, MBED_ORG_USER
2728

2829
import workspace_tools.hooks as hooks
2930
import re
@@ -184,6 +185,7 @@ def __init__(self, target, options=None, notify=None, macros=None):
184185
self.has_config = False
185186

186187
self.build_all = False
188+
self.timestamp = time()
187189

188190
def goanna_parse_line(self, line):
189191
if "analyze" in self.options:
@@ -203,6 +205,11 @@ def get_symbols(self):
203205
# Cortex CPU symbols
204206
if self.target.core in mbedToolchain.CORTEX_SYMBOLS:
205207
self.symbols.extend(mbedToolchain.CORTEX_SYMBOLS[self.target.core])
208+
209+
# Symbols defined by the on-line build.system
210+
self.symbols.extend(['MBED_BUILD_TIMESTAMP=%s' % self.timestamp, '__MBED__=1'])
211+
if MBED_ORG_USER:
212+
self.symbols.append('MBED_USERNAME=' + MBED_ORG_USER)
206213

207214
return self.symbols
208215

0 commit comments

Comments
 (0)