Skip to content

Commit f2d57f5

Browse files
committed
corrects SAML CHIPID information in Devices.h and merge in changes from 1.6.1-arduino
1 parent cb98fb6 commit f2d57f5

File tree

7 files changed

+41
-27
lines changed

7 files changed

+41
-27
lines changed

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Version
55
#
6-
VERSION=1.6.1-arduino-mattairtech-1
6+
VERSION=1.7.0-mattairtech-1
77
WXVERSION=3.0
88

99
#
@@ -133,6 +133,14 @@ WXVERSION=2.8
133133

134134
endif
135135

136+
ifeq (${OS},FreeBSD)
137+
138+
# This is only needed for bossash, but we can't add it to BOSSASH_LIBS here
139+
# because that one is redefined later.
140+
COMMON_SRCS+=PosixSerialPort.cpp BSDPortFactory.cpp
141+
142+
endif
143+
136144
#
137145
# Object files
138146
#

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
BOSSA 1.6.1-arduino-mattairtech-1
1+
BOSSA 1.6.1-arduino-mattairtech-2
22
-------------------------------
33

4+
1.6.1-arduino-mattairtech-2 corrects SAML CHIPID information in Devices.h.
5+
46
This version of BOSSA is a fork of BOSSA 1.6.1-arduino.
57
It adds support for more M0+ chips, the SAML and SAMC:
68

@@ -14,7 +16,6 @@ It adds support for more M0+ chips, the SAML and SAMC:
1416
* ATSAML21J18B
1517
* ATSAML21J17B
1618
* ATSAML21J16B
17-
1819
* ATSAMC21E18A
1920
* ATSAMC21E17A
2021
* ATSAMC21E16A

src/Devices.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176

177177
/* SAML21 */
178178
#define ATSAML21J18B_NAME "ATSAML21J18B"
179-
#define ATSAML21J18B_CHIPID (0x10810000ul) // DIE & REV bitfields masked in Samba::chipId()
179+
#define ATSAML21J18B_CHIPID (0x1081000Ful) // DIE & REV bitfields masked in Samba::chipId()
180180
#define ATSAML21J18B_FLASH_BASE (0x00000000ul + ATSAML_BOOTLOADER_SIZE)
181181
#define ATSAML21J18B_FLASH_PAGE_SIZE (64ul)
182182
#define ATSAML21J18B_FLASH_PAGES (4096ul)
@@ -187,7 +187,7 @@
187187
#define ATSAML21J18B_NVMCTRL_BASE (0x41004000ul)
188188

189189
#define ATSAML21J17B_NAME "ATSAML21J17B"
190-
#define ATSAML21J17B_CHIPID (0x10810001ul) // DIE & REV bitfields masked in Samba::chipId()
190+
#define ATSAML21J17B_CHIPID (0x10810010ul) // DIE & REV bitfields masked in Samba::chipId()
191191
#define ATSAML21J17B_FLASH_BASE (0x00000000ul + ATSAML_BOOTLOADER_SIZE)
192192
#define ATSAML21J17B_FLASH_PAGE_SIZE (64ul)
193193
#define ATSAML21J17B_FLASH_PAGES (2048ul)
@@ -198,7 +198,7 @@
198198
#define ATSAML21J17B_NVMCTRL_BASE (0x41004000ul)
199199

200200
#define ATSAML21J16B_NAME "ATSAML21J16B"
201-
#define ATSAML21J16B_CHIPID (0x10810002ul) // DIE & REV bitfields masked in Samba::chipId()
201+
#define ATSAML21J16B_CHIPID (0x10810011ul) // DIE & REV bitfields masked in Samba::chipId()
202202
#define ATSAML21J16B_FLASH_BASE (0x00000000ul + ATSAML_BOOTLOADER_SIZE)
203203
#define ATSAML21J16B_FLASH_PAGE_SIZE (64ul)
204204
#define ATSAML21J16B_FLASH_PAGES (1024ul)
@@ -209,7 +209,7 @@
209209
#define ATSAML21J16B_NVMCTRL_BASE (0x41004000ul)
210210

211211
#define ATSAML21G18B_NAME "ATSAML21G18B"
212-
#define ATSAML21G18B_CHIPID (0x10810005ul) // DIE & REV bitfields masked in Samba::chipId()
212+
#define ATSAML21G18B_CHIPID (0x10810014ul) // DIE & REV bitfields masked in Samba::chipId()
213213
#define ATSAML21G18B_FLASH_BASE (0x00000000ul + ATSAML_BOOTLOADER_SIZE)
214214
#define ATSAML21G18B_FLASH_PAGE_SIZE (64ul)
215215
#define ATSAML21G18B_FLASH_PAGES (4096ul)
@@ -220,7 +220,7 @@
220220
#define ATSAML21G18B_NVMCTRL_BASE (0x41004000ul)
221221

222222
#define ATSAML21G17B_NAME "ATSAML21G17B"
223-
#define ATSAML21G17B_CHIPID (0x10810006ul) // DIE & REV bitfields masked in Samba::chipId()
223+
#define ATSAML21G17B_CHIPID (0x10810015ul) // DIE & REV bitfields masked in Samba::chipId()
224224
#define ATSAML21G17B_FLASH_BASE (0x00000000ul + ATSAML_BOOTLOADER_SIZE)
225225
#define ATSAML21G17B_FLASH_PAGE_SIZE (64ul)
226226
#define ATSAML21G17B_FLASH_PAGES (2048ul)
@@ -231,7 +231,7 @@
231231
#define ATSAML21G17B_NVMCTRL_BASE (0x41004000ul)
232232

233233
#define ATSAML21G16B_NAME "ATSAML21G16B"
234-
#define ATSAML21G16B_CHIPID (0x10810007ul) // DIE & REV bitfields masked in Samba::chipId()
234+
#define ATSAML21G16B_CHIPID (0x10810016ul) // DIE & REV bitfields masked in Samba::chipId()
235235
#define ATSAML21G16B_FLASH_BASE (0x00000000ul + ATSAML_BOOTLOADER_SIZE)
236236
#define ATSAML21G16B_FLASH_PAGE_SIZE (64ul)
237237
#define ATSAML21G16B_FLASH_PAGES (1024ul)
@@ -242,7 +242,7 @@
242242
#define ATSAML21G16B_NVMCTRL_BASE (0x41004000ul)
243243

244244
#define ATSAML21E18B_NAME "ATSAML21E18B"
245-
#define ATSAML21E18B_CHIPID (0x1081000aul) // DIE & REV bitfields masked in Samba::chipId()
245+
#define ATSAML21E18B_CHIPID (0x10810019ul) // DIE & REV bitfields masked in Samba::chipId()
246246
#define ATSAML21E18B_FLASH_BASE (0x00000000ul + ATSAML_BOOTLOADER_SIZE)
247247
#define ATSAML21E18B_FLASH_PAGE_SIZE (64ul)
248248
#define ATSAML21E18B_FLASH_PAGES (4096ul)
@@ -253,7 +253,7 @@
253253
#define ATSAML21E18B_NVMCTRL_BASE (0x41004000ul)
254254

255255
#define ATSAML21E17B_NAME "ATSAML21E17B"
256-
#define ATSAML21E17B_CHIPID (0x1081000bul) // DIE & REV bitfields masked in Samba::chipId()
256+
#define ATSAML21E17B_CHIPID (0x1081001Aul) // DIE & REV bitfields masked in Samba::chipId()
257257
#define ATSAML21E17B_FLASH_BASE (0x00000000ul + ATSAML_BOOTLOADER_SIZE)
258258
#define ATSAML21E17B_FLASH_PAGE_SIZE (64ul)
259259
#define ATSAML21E17B_FLASH_PAGES (2048ul)
@@ -264,7 +264,7 @@
264264
#define ATSAML21E17B_NVMCTRL_BASE (0x41004000ul)
265265

266266
#define ATSAML21E16B_NAME "ATSAML21E16B"
267-
#define ATSAML21E16B_CHIPID (0x1081000cul) // DIE & REV bitfields masked in Samba::chipId()
267+
#define ATSAML21E16B_CHIPID (0x1081001Bul) // DIE & REV bitfields masked in Samba::chipId()
268268
#define ATSAML21E16B_FLASH_BASE (0x00000000ul + ATSAML_BOOTLOADER_SIZE)
269269
#define ATSAML21E16B_FLASH_PAGE_SIZE (64ul)
270270
#define ATSAML21E16B_FLASH_PAGES (1024ul)
@@ -275,7 +275,7 @@
275275
#define ATSAML21E16B_NVMCTRL_BASE (0x41004000ul)
276276

277277
#define ATSAML21E15B_NAME "ATSAML21E15B"
278-
#define ATSAML21E15B_CHIPID (0x1081000dul) // DIE & REV bitfields masked in Samba::chipId()
278+
#define ATSAML21E15B_CHIPID (0x1081001Cul) // DIE & REV bitfields masked in Samba::chipId()
279279
#define ATSAML21E15B_FLASH_BASE (0x00000000ul + ATSAML_BOOTLOADER_SIZE)
280280
#define ATSAML21E15B_FLASH_PAGE_SIZE (64ul)
281281
#define ATSAML21E15B_FLASH_PAGES (512ul)
@@ -452,8 +452,8 @@
452452
#define ATSAMD11C14A_STACK_ADDR (0x20001000ul)
453453
#define ATSAMD11C14A_NVMCTRL_BASE (0x41004000ul)
454454

455-
/* SAMDR1 */
456-
#define ATSAMR21E18A_NAME "ATSAMDR1E18A"
455+
/* SAMR21 */
456+
#define ATSAMR21E18A_NAME "ATSAMR21E18A"
457457
#define ATSAMR21E18A_CHIPID (0x1001001cul) // DIE & REV bitfields masked in Samba::chipId()
458458
#define ATSAMR21E18A_FLASH_BASE (0x00000000ul + ATSAMR_BOOTLOADER_SIZE)
459459
#define ATSAMR21E18A_FLASH_PAGE_SIZE (64ul)

src/Flasher.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ Flasher::write(const char* filename)
120120
// ...otherwise go with the legacy slow method
121121

122122
uint8_t buffer[pageSize];
123+
const uint32_t divisor = (numPages / 10) ? (numPages / 10) : 1;
123124
while ((fbytes = fread(buffer, 1, pageSize, infile)) > 0)
124125
{
125-
// print once every 10%
126-
if ((pageNum % (numPages/10)) == 0)
126+
if ((pageNum % divisor) == 0)
127127
progressBar(pageNum, numPages);
128128

129129
_flash->loadBuffer(buffer, fbytes);
@@ -221,11 +221,11 @@ Flasher::verify(const char* filename)
221221
throw FileSizeError();
222222

223223
printf("Verify %ld bytes of flash\n", fsize);
224-
224+
225+
const uint32_t divisor = (numPages / 10) ? (numPages / 10) : 1;
225226
while ((fbytes = fread(bufferA, 1, pageSize, infile)) > 0)
226227
{
227-
// print once every 10%
228-
if ((pageNum % (numPages/10)) == 0)
228+
if ((pageNum % divisor) == 0)
229229
progressBar(pageNum, numPages);
230230

231231
_flash->readPage(pageNum, bufferB);

src/PortFactory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ typedef LinuxPortFactory PortFactory;
5656
#elif defined(__APPLE__)
5757
#include "OSXPortFactory.h"
5858
typedef OSXPortFactory PortFactory;
59-
#elif defined(__OpenBSD__)
59+
#elif defined(__OpenBSD__) || defined(__FreeBSD__)
6060
// This is likely to work (but not tested) for the other BSDs as well
6161
#include "BSDPortFactory.h"
6262
typedef BSDPortFactory PortFactory;

src/PosixSerialPort.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,17 @@ PosixSerialPort::open(int baud,
6565
{
6666
struct termios options;
6767
speed_t speed;
68-
std::string dev("/dev/");
69-
70-
dev += _name;
71-
_devfd = ::open(dev.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
68+
// Try opening port assuming _name is full path. If it fails
69+
// try "/dev/" + _name
70+
_devfd = ::open(_name.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
7271
if (_devfd == -1)
73-
return false;
72+
{
73+
std::string dev("/dev/");
74+
dev += _name;
75+
_devfd = ::open(dev.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
76+
if (_devfd == -1)
77+
return false;
78+
}
7479

7580
if (tcgetattr(_devfd, &options) == -1)
7681
{

src/Samba.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Samba::init()
7272
uint8_t cmd[3];
7373
uint32_t cid;
7474

75-
_port->timeout(TIMEOUT_QUICK);
75+
_port->timeout(TIMEOUT_NORMAL);
7676

7777
// Allows Arduino auto-reset
7878
usleep(500000);

0 commit comments

Comments
 (0)