Example program for the BSDInterface
Dependencies: BSDInterface NetworkSocketAPI
Fork of HelloLWIPInterface by
Revision 50:6566cd992ac6, committed 2016-02-28
- Comitter:
- Christopher Haster
- Date:
- Sun Feb 28 11:27:32 2016 -0600
- Parent:
- 49:e1689f3f04f3
- Child:
- 51:cb2cd5e94138
- Commit message:
- Fixed name collision with global symbols
Changed in this revision
Makefile | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Makefile Sat Feb 27 21:03:02 2016 -0600 +++ b/Makefile Sun Feb 28 11:27:32 2016 -0600 @@ -19,14 +19,7 @@ OBJDUMP = $(GCC_BIN)objdump SIZE = $(GCC_BIN)size -ifeq ($(HARDFP),1) - FLOAT_ABI = hard -else - FLOAT_ABI = softfp -endif - - -CC_FLAGS = -c -g -fno-common -fmessage-length=0 -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP +CC_FLAGS = -c -g -Wall -MMD -MP -m32 ifeq ($(DEBUG), 1) @@ -52,10 +45,10 @@ $(CC) $(CPU) -c -x assembler-with-cpp -o $@ $< .c.o: - $(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $< + $(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $< .cpp.o: - $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $< + $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $<
--- a/main.cpp Sat Feb 27 21:03:02 2016 -0600 +++ b/main.cpp Sun Feb 28 11:27:32 2016 -0600 @@ -19,7 +19,7 @@ #include <stdio.h> BSDInterface iface; -TCPSocket socket(&iface); +TCPSocket sock(&iface); int main() { @@ -30,14 +30,14 @@ printf("IP Address is: %s\r\n", (ip) ? ip : "No IP"); printf("MAC Address is: %s\r\n", (mac) ? mac : "No MAC"); - socket.open("time-a.nist.gov", 37); - printf("time-a.nist.gov resolved to: %s\r\n", socket.getIPAddress()); + sock.open("time-a.nist.gov", 37); + printf("time-a.nist.gov resolved to: %s\r\n", sock.getIPAddress()); - char recieved[100] = {0}; + unsigned char recieved[100] = {0}; int32_t size = 0; - size = socket.recv(recieved, sizeof(recieved)); + size = sock.recv(recieved, sizeof(recieved)); - socket.close(); + sock.close(); printf("Recieved: %d bytes, %02x%02x%02x%02x\r\n", size, recieved[0], recieved[1], recieved[2], recieved[3]);