Skip to content

Commit

Permalink
Now able build by MinGW. All warnings were fixed. (#584)
Browse files Browse the repository at this point in the history
* fix wrong libusb extract command

* update libusb to 1.0.21 under windows

* fix few -Wformat warnings

* add usleep realisation for win32

* Get rid of unused defines in mimgw.h

* fix format warning for mingw

* Add prefix SEMIXOST_ to semihost defines.
Fix redefine warnings of mingw.
  • Loading branch information
slyshykO authored and xor-gate committed Apr 7, 2017
1 parent eb03b7c commit 3d24377
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/gdbserver/gdb-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ int serve(stlink_t *sl, st_state_t *st) {

reply = calloc(8 * 16 + 1, 1);
for(int i = 0; i < 16; i++)
sprintf(&reply[i * 8], "%08x", htonl(regp.r[i]));
sprintf(&reply[i * 8], "%08x", (uint32_t)htonl(regp.r[i]));

break;

Expand Down
20 changes: 10 additions & 10 deletions src/gdbserver/semihosting.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) {
DLOG("Do semihosting R0=0x%08x R1=0x%08x\n", r0, r1);

switch (r0) {
case SYS_OPEN:
case SEMIHOST_SYS_OPEN:
{
uint32_t args[3];
uint32_t name_address;
Expand Down Expand Up @@ -220,7 +220,7 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) {
free(name);
break;
}
case SYS_CLOSE:
case SEMIHOST_SYS_CLOSE:
{
uint32_t args[1];
int fd;
Expand All @@ -242,7 +242,7 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) {
DLOG("Semihosting: return %d\n", *ret);
break;
}
case SYS_WRITE:
case SEMIHOST_SYS_WRITE:
{
uint32_t args[3];
uint32_t buffer_address;
Expand Down Expand Up @@ -300,7 +300,7 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) {
free(buffer);
break;
}
case SYS_READ:
case SEMIHOST_SYS_READ:
{
uint32_t args[3];
uint32_t buffer_address;
Expand Down Expand Up @@ -358,13 +358,13 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) {
free(buffer);
break;
}
case SYS_ERRNO:
case SEMIHOST_SYS_ERRNO:
{
*ret = (uint32_t)saved_errno;
DLOG("Semihosting: Errno return %d\n", *ret);
break;
}
case SYS_REMOVE:
case SEMIHOST_SYS_REMOVE:
{
uint32_t args[2];
uint32_t name_address;
Expand Down Expand Up @@ -418,7 +418,7 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) {
free(name);
break;
}
case SYS_SEEK:
case SEMIHOST_SYS_SEEK:
{
uint32_t args[2];
int fd;
Expand Down Expand Up @@ -446,7 +446,7 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) {
DLOG("Semihosting: return %d\n", *ret);
break;
}
case SYS_WRITEC:
case SEMIHOST_SYS_WRITEC:
{
uint8_t c;
if (mem_read_u8(sl, r1, &c) == 0) {
Expand All @@ -457,13 +457,13 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) {
}
break;
}
case SYS_READC:
case SEMIHOST_SYS_READC:
{
uint8_t c = getchar();
*ret = c;
break;
}
case SYS_WRITE0:
case SEMIHOST_SYS_WRITE0:
{
uint8_t buf[WRITE0_BUFFER_SIZE];

Expand Down
50 changes: 25 additions & 25 deletions src/gdbserver/semihosting.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@

#include <stlink.h>

#define SYS_OPEN 0x01
#define SYS_CLOSE 0x02
#define SYS_WRITEC 0x03
#define SYS_WRITE0 0x04
#define SYS_WRITE 0x05
#define SYS_READ 0x06
#define SYS_READC 0x07
#define SYS_ISERROR 0x08
#define SYS_ISTTY 0x09
#define SYS_SEEK 0x0A

#define SYS_FLEN 0x0C
#define SYS_TMPNAM 0x0D
#define SYS_REMOVE 0x0E
#define SYS_RENAME 0x0E
#define SYS_CLOCK 0x10
#define SYS_TIME 0x11

#define SYS_ERRNO 0x13

#define SYS_GET_CMD 0x15
#define SYS_HEAPINFO 0x16

#define SYS_ELAPSED 0x30
#define SYS_TICKFREQ 0x31
#define SEMIHOST_SYS_OPEN 0x01
#define SEMIHOST_SYS_CLOSE 0x02
#define SEMIHOST_SYS_WRITEC 0x03
#define SEMIHOST_SYS_WRITE0 0x04
#define SEMIHOST_SYS_WRITE 0x05
#define SEMIHOST_SYS_READ 0x06
#define SEMIHOST_SYS_READC 0x07
#define SEMIHOST_SYS_ISERROR 0x08
#define SEMIHOST_SYS_ISTTY 0x09
#define SEMIHOST_SYS_SEEK 0x0A

#define SEMIHOST_SYS_FLEN 0x0C
#define SEMIHOST_SYS_TMPNAM 0x0D
#define SEMIHOST_SYS_REMOVE 0x0E
#define SEMIHOST_SYS_RENAME 0x0E
#define SEMIHOST_SYS_CLOCK 0x10
#define SEMIHOST_SYS_TIME 0x11

#define SEMIHOST_SYS_ERRNO 0x13

#define SEMIHOST_SYS_GET_CMD 0x15
#define SEMIHOST_SYS_HEAPINFO 0x16

#define SEMIHOST_SYS_ELAPSED 0x30
#define SEMIHOST_SYS_TICKFREQ 0x31

int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret);

Expand Down

0 comments on commit 3d24377

Please sign in to comment.