File tree Expand file tree Collapse file tree 4 files changed +28
-8
lines changed Expand file tree Collapse file tree 4 files changed +28
-8
lines changed Original file line number Diff line number Diff line change @@ -153,8 +153,15 @@ WXVERSION=2.8
153
153
154
154
endif
155
155
156
+ #
157
+ # FreeBSD rules. Tested on 12.1.
158
+ #
156
159
ifeq (${OS},FreeBSD)
157
160
161
+ # Readline and Wxwidgets are installed under /usr/local on Freebsd
162
+ COMMON_CXXFLAGS =-I/usr/local/include
163
+ COMMON_LDFLAGS =-L/usr/local/lib
164
+
158
165
# This is only needed for bossash, but we can't add it to BOSSASH_LIBS here
159
166
# because that one is redefined later.
160
167
COMMON_SRCS+ =PosixSerialPort.cpp BSDPortFactory.cpp
Original file line number Diff line number Diff line change @@ -279,10 +279,12 @@ BossaWindow::OnSerial(wxCommandEvent& event)
279
279
Samba& samba = wxGetApp ().samba ;
280
280
281
281
wxString port = _portComboBox->GetString (event.GetSelection ());
282
+ errno = 0 ;
283
+
282
284
if (!samba.connect (portFactory.create (std::string (port.mb_str ()))))
283
285
{
284
286
Disconnected ();
285
- Error (wxString::Format (_ (" Could not connect to device on %s" ), port.c_str ()));
287
+ Error (wxString::Format (_ (" Could not connect to device on %s: %s " ), port.c_str (), strerror (errno )));
286
288
return ;
287
289
}
288
290
Original file line number Diff line number Diff line change @@ -276,7 +276,23 @@ EefcFlash::writePage(uint32_t page)
276
276
_wordCopy.setDstAddr (_addr + page * _size);
277
277
_wordCopy.setSrcAddr (_onBufferA ? _pageBufferA : _pageBufferB);
278
278
_onBufferA = !_onBufferA;
279
- waitFSR ();
279
+ // Some chip families have page restrictions on calling EEFC_FCMD_EWP on all pages
280
+ // e.g. 16K boundary on SAM4S
281
+ // Print a warning indicating that the flash must be erased first
282
+ try
283
+ {
284
+ waitFSR ();
285
+ }
286
+ catch (FlashCmdError& exc)
287
+ {
288
+ if (page > 0 )
289
+ {
290
+ printf (" \n NOTE: Some chip families may not support auto-erase on all flash regions.\n " );
291
+ printf (" Try erasing the flash first (bossash), or erasing at the same time (bossac)." );
292
+ fflush (stdout);
293
+ }
294
+ throw ;
295
+ }
280
296
_wordCopy.runv ();
281
297
if (_planes == 2 && page >= _pages / 2 )
282
298
writeFCR1 (_eraseAuto ? EEFC_FCMD_EWP : EEFC_FCMD_WP, page - _pages / 2 );
Original file line number Diff line number Diff line change 32
32
#include < stdio.h>
33
33
#include < unistd.h>
34
34
#include < fcntl.h>
35
- #include < errno.h>
36
35
#include < termios.h>
37
- #include < errno.h>
38
36
#include < sys/ioctl.h>
39
37
40
38
#include < string>
@@ -290,10 +288,7 @@ PosixSerialPort::put(int c)
290
288
void
291
289
PosixSerialPort::flush ()
292
290
{
293
- // There isn't a reliable way to flush on a file descriptor
294
- // so we just wait it out. One millisecond is the USB poll
295
- // interval so that should cover it.
296
- usleep (1000 );
291
+ tcdrain (_devfd);
297
292
}
298
293
299
294
bool
You can’t perform that action at this time.
0 commit comments