Skip to content

Commit be535f2

Browse files
Merge pull request #390 from janjongboom/atmel-saml21
Add support for XPLAINED PRO SAML21 board
2 parents 6a50921 + 8fbab1c commit be535f2

File tree

5 files changed

+30
-3
lines changed

5 files changed

+30
-3
lines changed

mbed_lstools/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@
3636

3737
from .main import mbedls_main
3838
from .main import create
39+

mbed_lstools/darwin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
DEBUG = logging.DEBUG
2929
del logging
3030

31-
mbed_volume_name_match = re.compile(r'\b(mbed|SEGGER MSD)\b', re.I)
31+
mbed_volume_name_match = re.compile(r'\b(mbed|SEGGER MSD|ATMEL EDBG Media)\b', re.I)
3232

3333
def _find_TTY(obj):
3434
''' Find the first tty (AKA IODialinDevice) that we can find in the

mbed_lstools/lstools_base.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class MbedLsToolsBase(object):
7272
VENDOR_ID_DEVICE_TYPE_MAP = {
7373
'0483': 'stlink',
7474
'0d28': 'daplink',
75-
'1366': 'jlink'
75+
'1366': 'jlink',
76+
'03eb': 'atmel'
7677
}
7778

7879
def __init__(self, list_unmounted=False, **kwargs):
@@ -230,6 +231,9 @@ def _update_device_from_fs(self, device, read_details_txt):
230231
if device.get('device_type') == 'jlink':
231232
self._update_device_details_jlink(device, read_details_txt)
232233

234+
if device.get('device_type') == 'atmel':
235+
self._update_device_details_atmel(device, read_details_txt)
236+
233237
except (OSError, IOError) as e:
234238
logger.warning(
235239
'Marking device with mount point "%s" as unmounted due to the '
@@ -332,6 +336,25 @@ def _update_device_from_htm(self, device):
332336
device['target_id'] = device['target_id_usb_id']
333337
device['target_id_mbed_htm'] = htm_target_id
334338

339+
def _update_device_details_atmel(self, device, _):
340+
""" Updates the Atmel device information based on files from its 'mount_point'
341+
@param device Dictionary containing device information
342+
@param read_details_txt A boolean controlling the presense of the
343+
output dict attributes read from other files present on the 'mount_point'
344+
"""
345+
346+
# Atmel uses a system similar to DAPLink, but there's no details.txt with a target ID
347+
# to identify device we can use the serial, which is ATMLXXXXYYYYYYY
348+
# where XXXX is the board identifier.
349+
# This can be verified by looking at readme.htm, which also uses the board ID to redirect to platform page
350+
351+
device['target_id'] = device['target_id_usb_id'][4:8]
352+
platform_data = self.plat_db.get(device['target_id'],
353+
device_type='atmel',
354+
verbose_data=True)
355+
356+
device.update(platform_data or {"platform_name": None})
357+
335358
def mock_manufacture_id(self, mid, platform_name, oper='+'):
336359
"""! Replace (or add if manufacture id doesn't exist) entry in self.manufacture_ids
337360
@param oper '+' add new mock / override existing entry

mbed_lstools/platform_database.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@
324324
u'platform_name': u'KL43Z',
325325
u'jlink_device_name': u'MKL43Z256xxx4'
326326
}
327+
},
328+
u'atmel': {
329+
u'2241': 'SAML21J18A'
327330
}
328331
}
329332

mbed_lstools/windows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939

4040
MAX_COMPOSITE_DEVICE_SUBDEVICES = 5
41-
MBED_STORAGE_DEVICE_VENDOR_STRINGS = ['ven_mbed', 'ven_segger', 'ven_arm_v2m', 'ven_nxp']
41+
MBED_STORAGE_DEVICE_VENDOR_STRINGS = ['ven_mbed', 'ven_segger', 'ven_arm_v2m', 'ven_nxp', 'ven_atmel']
4242

4343

4444
def _get_values_with_numeric_keys(reg_key):

0 commit comments

Comments
 (0)