Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
picsimlab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
picsimlab
Commits
cd528a00
Commit
cd528a00
authored
Aug 07, 2020
by
lcgamboa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chg: new boards support to cross compile to windows !minor
parent
93fd9618
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
118 additions
and
76 deletions
+118
-76
src/Makefile
src/Makefile
+3
-1
src/Makefile.Common
src/Makefile.Common
+2
-1
src/Makefile.X11
src/Makefile.X11
+4
-3
src/Makefile.cross
src/Makefile.cross
+3
-2
src/Makefile.cross_32
src/Makefile.cross_32
+4
-2
src/Makefile.static
src/Makefile.static
+3
-1
src/boards/board_Blue_Pill.cc
src/boards/board_Blue_Pill.cc
+2
-2
src/boards/board_qemu_stm32.cc
src/boards/board_qemu_stm32.cc
+82
-58
src/boards/board_qemu_stm32.h
src/boards/board_qemu_stm32.h
+5
-0
src/boards/board_uCboard.cc
src/boards/board_uCboard.cc
+2
-2
src/boards/board_ucsim.cc
src/boards/board_ucsim.cc
+1
-1
src/boards/board_ucsim.h
src/boards/board_ucsim.h
+4
-0
src/devices/mplabxd.cc
src/devices/mplabxd.cc
+3
-3
No files found.
src/Makefile
View file @
cd528a00
...
...
@@ -18,8 +18,10 @@ override CFLAGS+= -D_VERSION_=\"$(VERSION)\" -Wall -O2 -D_SHARE_=\"${sharedir}\"
override
CFLAGS
+=
-DEXT_BROWSER
#override CFLAGS+=-fsanitize=address
ELIBS_
=
$(
addsuffix
.a ,
$(ELIBS)
)
LIBS
=
`
lxrad-config
--libs
`
-lpicsim
-lsimavr
-lelf
LIBS
+=
$(ELIBS)
LIBS
+=
$(ELIBS
_
)
#LIBS= ../../picsim/src/libpicsim_dbg.a ../../LXRAD_WX/libteste/liblxrad.a ../../simavr/simavr/obj-x86_64-linux-gnu/libsimavr.a\
-lopenal
`wx-config
--libs`
`wx-config
--libs
stc`
...
...
src/Makefile.Common
View file @
cd528a00
...
...
@@ -25,7 +25,8 @@ OBJS_EXP = boards/board_MPLAB_Xpress.o boards/board_Curiosity.o boards/board_x.
exp
:
OBJS+=$(OBJS_EXP)
exp
:
EFLAGS=-D_EXPERIMENTAL_
exp
:
ELIBS= ../../ucsim-0.6/picsimlab/libucsim.a
#static libraries without suffix
exp
:
ELIBS= ../../ucsim-0.6/picsimlab/libucsim
exp
:
$(OBJS_EXP) all
...
...
src/Makefile.X11
View file @
cd528a00
...
...
@@ -20,9 +20,10 @@ override CFLAGS += -DEXT_BROWSER -D_VERSION_=\"${VERSION}\" -Wall -ggdb -D_SHARE
#override CFLAGS+= -D_NOTHREAD
#override CFLAGS+=-fsanitize=address
#LIBS = `lxrad_X11-config --libs` -lpicsim -lsimavr -lelf -lminizip
LIBS
=
`
lxrad_X11-config
--libs
`
../../picsim/src/libpicsim_dbg.a ../../simavr/simavr/obj-x86_64-linux-gnu/libsimavr.a
-lelf
-lminizip
LIBS
+=
$(ELIBS)
ELIBS_
=
$(
addsuffix
.a ,
$(ELIBS)
)
#LIBS = $(ELIBS_) `lxrad_X11-config --libs` -lpicsim -lsimavr -lelf -lminizip
LIBS
=
$(ELIBS_)
`
lxrad_X11-config
--libs
`
../../picsim/src/libpicsim_dbg.a ../../simavr/simavr/obj-x86_64-linux-gnu/libsimavr.a
-lelf
-lminizip
#lxrad automatic generated block end, don't edit above!
...
...
src/Makefile.cross
View file @
cd528a00
...
...
@@ -8,9 +8,10 @@ override CFLAGS+= -DEXT_BROWSER
override
CFLAGS
+=
-I
../dev_w64/lib/wx/include/x86_64-w64-mingw32-msw-unicode-3.1
-I
../dev_w64/include/wx-3.1
-D_FILE_OFFSET_BITS
=
64
-DWXUSINGDLL
-D__WXMSW__
#CFLAGS+=`x86_64-w64-mingw32-msw-unicode-3.1 --cxxflags`
LIBS
=
-llxrad
-lOpenAL32
-lpicsim
-lsimavr
-lws2_32
-L
../dev_w64/lib
ELIBS_
=
$(
addsuffix
.aw ,
$(ELIBS)
)
LIBS
=
$(ELIBS_)
-llxrad
-lOpenAL32
-lpicsim
-lsimavr
-lws2_32
-L
../dev_w64/lib
LIBS
+=
-Wl
,--subsystem,windows
-mwindows
-lwx_mswu_xrc-3
.1-x86_64-w64-mingw32
-lwx_mswu_html-3
.1-x86_64-w64-mingw32
-lwx_mswu_qa-3
.1-x86_64-w64-mingw32
-lwx_mswu_core-3
.1-x86_64-w64-mingw32
-lwx_baseu_xml-3
.1-x86_64-w64-mingw32
-lwx_baseu_net-3
.1-x86_64-w64-mingw32
-lwx_baseu-3
.1-x86_64-w64-mingw32
LIBS
+=
$(ELIBS)
#LIBS+=`x86_64-w64-mingw32-msw-unicode-3.1 --libs`
...
...
src/Makefile.cross_32
View file @
cd528a00
...
...
@@ -9,9 +9,11 @@ override CFLAGS+= -I../dev_w32/lib/wx/include/i686-w64-mingw32-msw-unicode-3.1 -
#CFLAGS +=`i686-w64-mingw32-msw-unicode-3.1 --cxxflags`
LIBS
=
-llxrad
-lOpenAL32
-lpicsim
-lsimavr
-lws2_32
-L
../dev_w32/lib
ELIBS_
=
$(
addsuffix
.aw32 ,
$(ELIBS)
)
LIBS
=
$(ELIBS_)
-llxrad
-lOpenAL32
-lpicsim
-lsimavr
-lws2_32
-L
../dev_w32/lib
LIBS
+=
-Wl
,--subsystem,windows
-mwindows
-lwx_mswu_xrc-3
.1-i686-w64-mingw32
-lwx_mswu_html-3
.1-i686-w64-mingw32
-lwx_mswu_qa-3
.1-i686-w64-mingw32
-lwx_mswu_core-3
.1-i686-w64-mingw32
-lwx_baseu_xml-3
.1-i686-w64-mingw32
-lwx_baseu_net-3
.1-i686-w64-mingw32
-lwx_baseu-3
.1-i686-w64-mingw32
LIBS
+=
$(ELIBS)
#LIBS+=`i686-w64-mingw32-msw-unicode-3.1 --libs`
all
:
$(OBJS)
...
...
src/Makefile.static
View file @
cd528a00
...
...
@@ -18,10 +18,12 @@ override CFLAGS += -D_VERSION_=\"$(VERSION)\" -Wall -O2 -D_SHARE_=\"${sharedir}\
override
CFLAGS
+=
-DEXT_BROWSER
#override CFLAGS+=-fsanitize=address
ELIBS_
=
$(
addsuffix
.a ,
$(ELIBS)
)
LIBS
=
../../picsim/src/libpicsim.a ../../lxrad/lib/liblxrad.a
\
../../simavr/simavr/obj-x86_64-linux-gnu/libsimavr.a
\
-lopenal
`
wx-config
--libs
`
`
wx-config
--libs
stc
`
LIBS
+=
$(ELIBS)
LIBS
+=
$(ELIBS
_
)
#lxrad automatic generated block end, don't edit above!
...
...
src/boards/board_Blue_Pill.cc
View file @
cd528a00
...
...
@@ -96,7 +96,7 @@ cboard_Blue_Pill::Reset(void)
#ifndef _WIN_
if
(
serialfd
[
0
]
>
0
)
#else
if
(
serial
[
0
].
serialfd
!=
INVALID_HANDLE_VALUE
)
if
(
serial
fd
[
0
]
!=
INVALID_HANDLE_VALUE
)
#endif
Window1
.
statusbar1
.
SetField
(
2
,
lxT
(
"Serial: "
)
+
String
::
FromAscii
(
SERIALDEVICE
)
+
lxT
(
":"
)
+
itoa
(
serialbaud
)
+
lxT
(
"("
)
+
...
...
@@ -118,7 +118,7 @@ cboard_Blue_Pill::RefreshStatus(void)
#ifndef _WIN_
if
(
serialfd
[
0
]
>
0
)
#else
if
(
pic
.
serial
[
0
].
serialfd
!=
INVALID_HANDLE_VALUE
)
if
(
serialfd
[
0
]
!=
INVALID_HANDLE_VALUE
)
#endif
Window1
.
statusbar1
.
SetField
(
2
,
lxT
(
"Serial: "
)
+
String
::
FromAscii
(
SERIALDEVICE
)
+
lxT
(
":"
)
+
itoa
(
serialbaud
)
+
lxT
(
"("
)
+
...
...
src/boards/board_qemu_stm32.cc
View file @
cd528a00
...
...
@@ -36,12 +36,12 @@ void setnblock(int sock_descriptor);
#include<sys/un.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include <lxrad/lxutils.h>
#define INVALID_HANDLE_VALUE -1;
#else
#include<winsock2.h>
#include<ws2tcpip.h>
WORD
wVersionRequested
=
2
;
WSADATA
wsaData
;
#define SHUT_RDWR SD_BOTH
#define _TCP_
#endif
board_qemu_stm32
::
board_qemu_stm32
(
void
)
...
...
@@ -60,7 +60,7 @@ int
board_qemu_stm32
::
MInit
(
const
char
*
processor
,
const
char
*
fname
,
float
freq
)
{
struct
sockaddr_in
servm
;
#ifdef _TCP_
#ifdef _TCP_
struct
sockaddr_in
serv
,
cli
;
#else
struct
sockaddr_un
serv
,
cli
;
...
...
@@ -82,10 +82,10 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq)
pins_reset
();
serialfd
[
0
]
=
-
1
;
serialfd
[
1
]
=
-
1
;
serialfd
[
2
]
=
-
1
;
serialfd
[
3
]
=
-
1
;
serialfd
[
0
]
=
INVALID_HANDLE_VALUE
;
serialfd
[
1
]
=
INVALID_HANDLE_VALUE
;
serialfd
[
2
]
=
INVALID_HANDLE_VALUE
;
serialfd
[
3
]
=
INVALID_HANDLE_VALUE
;
#ifdef _TCP_
if
((
listenfd
=
socket
(
PF_INET
,
SOCK_STREAM
,
0
))
<
0
)
...
...
@@ -107,13 +107,12 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq)
{
printf
(
"socket error : %s
\n
"
,
strerror
(
errno
));
exit
(
1
);
};
//unlink("/tmp/.picsimlab_qemu");
}
memset
(
&
serv
,
0
,
sizeof
(
serv
));
serv
.
sun_family
=
AF_UNIX
;
serv
.
sun_path
[
0
]
=
0
;
strncpy
(
serv
.
sun_path
+
1
,
"picsimlab_qemu"
,
sizeof
(
serv
.
sun_path
)
-
2
);
serv
.
sun_path
[
0
]
=
0
;
strncpy
(
serv
.
sun_path
+
1
,
"picsimlab_qemu"
,
sizeof
(
serv
.
sun_path
)
-
2
);
#endif
if
(
bind
(
listenfd
,
(
sockaddr
*
)
&
serv
,
sizeof
(
serv
))
<
0
)
...
...
@@ -130,7 +129,7 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq)
//change .hex to .bin
strncpy
(
fname_
,
fname
,
299
);
fname_
[
strlen
(
fname_
)
-
3
]
=
0
;
fname_
[
strlen
(
fname_
)
-
3
]
=
0
;
strncat
(
fname_
,
"bin"
,
299
);
if
(
!
lxFileExists
(
fname_
))
...
...
@@ -151,20 +150,39 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq)
}
}
snprintf
(
cmd
,
499
,
"cd %s; ./qemu-system-arm -M stm32-f103c8-picsimlab -pflash %s -serial %s -qmp tcp:localhost:2500,server,nowait &"
,
"/home/gamboa/projetos/qemu_stm32/arm-softmmu/"
,
fname_
,
"/dev/tnt2"
//verify if qemu executable exists
#ifdef _WIN_
if
(
!
lxFileExists
(
Window1
.
GetSharePath
()
+
lxT
(
"/../qemu-stm32.exe"
)))
#else
if
((
!
lxFileExists
(
"/usr/bin/qemu-stm32"
))
&&
(
!
lxFileExists
(
"/usr/local/bin/qemu-stm32"
)))
#endif
{
Message
(
"qemu-stm32 not found!"
);
close
(
listenfd
);
return
-
1
;
}
#ifdef _WIN_
snprintf
(
cmd
,
499
,
"qemu-stm32 -M stm32-f103c8-picsimlab -qmp tcp:localhost:2500,server,nowait -pflash
\"
%s
\"
"
,
fname_
);
#else
snprintf
(
cmd
,
499
,
"qemu-stm32 -M stm32-f103c8-picsimlab -serial %s -qmp tcp:localhost:2500,server,nowait -pflash
\"
%s
\"
"
,
SERIALDEVICE
,
fname_
);
#endif
printf
(
"%s
\n
"
,
(
const
char
*
)
cmd
);
printf
(
"%s
\n
"
,
(
const
char
*
)
cmd
);
#ifdef _WIN_
lxExecute
(
Window1
.
GetSharePath
()
+
lxT
(
"/../"
)
+
cmd
);
#else
lxExecute
(
cmd
,
lxEXEC_MAKE_GROUP_LEADER
);
#endif
system
(
cmd
);
clilen
=
sizeof
(
cli
);
if
(
(
sockfd
=
accept
(
listenfd
,
(
sockaddr
*
)
&
cli
,
&
clilen
))
<
0
)
(
sockfd
=
accept
(
listenfd
,
(
sockaddr
*
)
&
cli
,
&
clilen
))
<
0
)
{
printf
(
"accept error : %s
\n
"
,
strerror
(
errno
));
exit
(
1
);
...
...
@@ -202,14 +220,15 @@ board_qemu_stm32::MInit(const char * processor, const char * fname, float freq)
buff
[
n
]
=
0
;
printf
(
"%s"
,
buff
);
connected
=
1
;
qemu_cmd
(
"qmp_capabilities"
);
connected
=
1
;
Window1
.
menu1_File_LoadHex
.
SetText
(
"Load Bin"
);
Window1
.
menu1_File_SaveHex
.
SetEnable
(
0
);
Window1
.
filedialog1
.
SetFileName
(
lxT
(
"untitled.bin"
));
Window1
.
filedialog1
.
SetFilter
(
lxT
(
"Bin Files (*.bin)|*.bin;*.BIN"
));
Window1
.
filedialog1
.
SetFileName
(
lxT
(
"untitled.bin"
));
Window1
.
filedialog1
.
SetFilter
(
lxT
(
"Bin Files (*.bin)|*.bin;*.BIN"
));
return
0
;
//ret;
}
...
...
@@ -226,9 +245,15 @@ board_qemu_stm32::MEnd(void)
Window1
.
menu1_File_LoadHex
.
SetText
(
"Load Hex"
);
Window1
.
menu1_File_SaveHex
.
SetEnable
(
1
);
Window1
.
filedialog1
.
SetFileName
(
lxT
(
"untitled.hex"
));
Window1
.
filedialog1
.
SetFilter
(
lxT
(
"Hex Files (*.hex)|*.hex;*.HEX"
));
sleep
(
1
);
Window1
.
filedialog1
.
SetFileName
(
lxT
(
"untitled.hex"
));
Window1
.
filedialog1
.
SetFilter
(
lxT
(
"Hex Files (*.hex)|*.hex;*.HEX"
));
//Wait for qemu shutdown
#ifdef _WIN_
Sleep
(
1000
);
#else
sleep
(
1
);
#endif
}
void
...
...
@@ -262,9 +287,7 @@ board_qemu_stm32::CpuInitialized(void)
void
board_qemu_stm32
::
DebugLoop
(
void
)
{
}
}
String
board_qemu_stm32
::
MGetPinName
(
int
pin
)
...
...
@@ -429,7 +452,7 @@ board_qemu_stm32::MDumpMemory(const char * fname)
//change .hex to .bin
strncpy
(
fname_
,
fname
,
299
);
fname_
[
strlen
(
fname_
)
-
3
]
=
0
;
fname_
[
strlen
(
fname_
)
-
3
]
=
0
;
strncat
(
fname_
,
"bin"
,
299
);
qemu_cmd
(
"stop"
);
...
...
@@ -444,7 +467,6 @@ board_qemu_stm32::DebugInit(int dtyppe) //argument not used in picm only mplabx
return
0
;
//!mplabxd_init (this, Window1.Get_debug_port ()) - 1;
}
int
board_qemu_stm32
::
MGetPinCount
(
void
)
{
...
...
@@ -478,9 +500,9 @@ board_qemu_stm32::MSetPin(int pin, unsigned char value)
{
unsigned
char
val
=
(
0x7F
&
pin
);
if
(
value
)
val
|=
0x80
;
if
(
send
(
sockfd
,
&
val
,
1
,
0
)
!=
1
)
if
(
value
)
val
|=
0x80
;
if
(
send
(
sockfd
,
(
const
char
*
)
&
val
,
1
,
0
)
!=
1
)
{
printf
(
"send error : %s
\n
"
,
strerror
(
errno
));
exit
(
1
);
...
...
@@ -505,7 +527,6 @@ board_qemu_stm32::MGetPin(int pin)
return
0
;
//get_pin (pin);
}
void
board_qemu_stm32
::
MReset
(
int
flags
)
{
...
...
@@ -515,7 +536,6 @@ board_qemu_stm32::MReset(int flags)
}
}
const
picpin
*
board_qemu_stm32
::
MGetPinsValues
(
void
)
{
...
...
@@ -542,7 +562,6 @@ board_qemu_stm32::MStepResume(void) {
//if (pic.s2 == 1)step ();
}
int
board_qemu_stm32
::
qemu_cmd
(
const
char
*
cmd
,
int
raw
)
{
...
...
@@ -551,6 +570,7 @@ board_qemu_stm32::qemu_cmd(const char * cmd, int raw)
char
buffout
[
400
];
unsigned
int
size
;
if
(
!
connected
)
return
-
1
;
/*
//clear messages
if ((n = recv (sockmon, buffout, 399, 0)) < 0)
...
...
@@ -579,7 +599,11 @@ board_qemu_stm32::qemu_cmd(const char * cmd, int raw)
exit
(
1
);
}
#ifdef _WIN_
Sleep
(
1
);
#else
usleep
(
1000
);
#endif
if
((
n
=
recv
(
sockmon
,
buffout
,
399
,
0
))
<
0
)
{
...
...
src/boards/board_qemu_stm32.h
View file @
cd528a00
...
...
@@ -57,7 +57,12 @@ class board_qemu_stm32: virtual public board
void
pins_reset
(
void
);
protected:
int
qemu_cmd
(
const
char
*
cmd
,
int
raw
=
0
);
#ifdef _WIN_
HANDLE
serialfd
[
4
];
#else
int
serialfd
[
4
];
#endif
int
procid
;
picpin
pins
[
256
];
unsigned
int
serialbaud
;
float
serialexbaud
;
...
...
src/boards/board_uCboard.cc
View file @
cd528a00
...
...
@@ -100,7 +100,7 @@ cboard_uCboard::Reset(void)
#ifndef _WIN_
if
(
serialfd
>
0
)
#else
if
(
serial
[
0
].
serial
fd
!=
INVALID_HANDLE_VALUE
)
if
(
serialfd
!=
INVALID_HANDLE_VALUE
)
#endif
Window1
.
statusbar1
.
SetField
(
2
,
lxT
(
"Serial: "
)
+
String
::
FromAscii
(
SERIALDEVICE
)
+
lxT
(
":"
)
+
itoa
(
serialbaud
)
+
lxT
(
"("
)
+
...
...
@@ -122,7 +122,7 @@ cboard_uCboard::RefreshStatus(void)
#ifndef _WIN_
if
(
serialfd
>
0
)
#else
if
(
pic
.
serial
[
0
].
serialfd
!=
INVALID_HANDLE_VALUE
)
if
(
serialfd
!=
INVALID_HANDLE_VALUE
)
#endif
Window1
.
statusbar1
.
SetField
(
2
,
lxT
(
"Serial: "
)
+
String
::
FromAscii
(
SERIALDEVICE
)
+
lxT
(
":"
)
+
itoa
(
serialbaud
)
+
lxT
(
"("
)
+
...
...
src/boards/board_ucsim.cc
View file @
cd528a00
...
...
@@ -51,7 +51,7 @@ static const char pinnames[3][40][10] = {
"P1.0"
,
"P1.1"
,
"P1.2"
,
"P1.3"
,
"P1.4"
,
"P1.5"
,
"P1.6"
,
"P1.7"
,
"P2.0"
,
"P2.1"
,
"P2.2"
,
"P2.3"
,
"P2.4"
,
"P2.5"
,
"P2.6"
,
"P2.7"
,
"P3.0"
,
"P3.1"
,
"P3.2"
,
"P3.3"
,
"P3.4"
,
"P3.5"
,
"P3.6"
,
"P3.7"
,
"
VCC"
,
"GND"
,
"RST"
,
"XTAL1"
,
"XTAL2"
,
"NC"
,
"NC"
,
"N
C"
}
"
RST"
,
"INT1"
,
"INT2"
,
"INT3"
,
"INT5"
,
"INT7"
,
"GND"
,
"VC
C"
}
};
...
...
src/boards/board_ucsim.h
View file @
cd528a00
...
...
@@ -60,7 +60,11 @@ class board_ucsim: virtual public board
unsigned
int
serialbaud
;
float
serialexbaud
;
float
freq
;
#ifdef _WIN_
HANDLE
serialfd
;
#else
int
serialfd
;
#endif
int
procid
;
};
...
...
src/devices/mplabxd.cc
View file @
cd528a00
...
...
@@ -46,8 +46,8 @@
#include <fcntl.h>
#else
#include<winsock.h>
WORD
wVersionRequested
=
2
;
WSADATA
wsaData
;
static
WORD
wVersionRequested
=
2
;
static
WSADATA
wsaData
;
#ifndef MSG_WAITALL
#define MSG_WAITALL (1 << 3)
#endif
...
...
@@ -100,7 +100,7 @@ initialize_socket(void)
if
(
wsaData
.
wVersion
!=
wVersionRequested
)
{
fprintf
(
stderr
,
"
\n
Wrong version
\n
"
);
return
1
;
return
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment