diff --git a/examples/CC3200/Makefile.build b/examples/CC3200/Makefile.build index c3d07cdd..9aaae3fa 100644 --- a/examples/CC3200/Makefile.build +++ b/examples/CC3200/Makefile.build @@ -40,7 +40,9 @@ MONGOOSE_FEATURES = \ -DMG_MAX_HTTP_SEND_MBUF=1024 \ -DMG_NO_BSD_SOCKETS -SDK_FLAGS = -DTARGET_IS_CC3200 -DUSE_FREERTOS -DSL_PLATFORM_MULTI_THREADED +SDK_FLAGS = -DUSE_FREERTOS -DSL_PLATFORM_MULTI_THREADED +# -DTARGET_IS_CC3200 would reduce code size by using functions in ROM +# but then the code won't work on pre-release chips (XCC3200HZ). CFLAGS += -Os -Wall -Werror \ $(SDK_FLAGS) -DCS_PLATFORM=4 -DCC3200_FS_SLFS \ @@ -92,7 +94,7 @@ CC3200_PLATFORM_SRCS = cc3200_fs.c cc3200_fs_slfs.c cc3200_libc.c cc3200_socket. VPATH += $(COMMON_PATH)/platforms/cc3200 FREERTOS_SRCS = timers.c list.c queue.c tasks.c port.c heap_3.c osi_freertos.c -DRIVER_SRCS = cpu.c gpio_if.c i2c_if.c interrupt.c pin.c prcm.c spi.c uart.c udma.c utils.c +DRIVER_SRCS = cpu.c gpio.c gpio_if.c i2c.c i2c_if.c interrupt.c pin.c prcm.c spi.c uart.c udma.c utils.c SL_SRCS = socket.c wlan.c driver.c device.c netapp.c netcfg.c cc_pal.c fs.c SDK_SRCS = startup_gcc.c $(FREERTOS_SRCS) $(DRIVER_SRCS) $(SL_SRCS) IPATH += $(SDK_PATH) $(SDK_PATH)/inc $(SDK_PATH)/driverlib \ diff --git a/examples/CC3200/cc3200_example.ld b/examples/CC3200/cc3200_example.ld index 1271b065..87dd371a 100644 --- a/examples/CC3200/cc3200_example.ld +++ b/examples/CC3200/cc3200_example.ld @@ -41,8 +41,10 @@ HEAP_SIZE = 0xB000; MEMORY { - /* SRAM size of 240KB for cc3200 ES 1.33 device onward */ - SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 0x3C000 + /* SRAM size of 240KB (0x3C000) for cc3200 ES 1.33 device onward, + * 176KB (0x2C000) for XCC3200HZ (pre-release device). + * We use the latter for maximum compatibility. */ + SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 0x2C000 } SECTIONS diff --git a/examples/CC3200/main.c b/examples/CC3200/main.c index 673902b2..d67475b6 100644 --- a/examples/CC3200/main.c +++ b/examples/CC3200/main.c @@ -91,16 +91,20 @@ static void ev_handler(struct mg_connection *nc, int ev, void *p) { switch (ev) { case MG_EV_ACCEPT: { char addr[32]; - mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr), - MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT); + mg_conn_addr_to_str( + nc, addr, sizeof(addr), + MG_SOCK_STRINGIFY_REMOTE | MG_SOCK_STRINGIFY_IP | + MG_SOCK_STRINGIFY_PORT); LOG(LL_INFO, ("%p conn from %s", nc, addr)); break; } case MG_EV_HTTP_REQUEST: { char addr[32]; struct http_message *hm = (struct http_message *) p; - mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr), - MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT); + mg_conn_addr_to_str( + nc, addr, sizeof(addr), + MG_SOCK_STRINGIFY_REMOTE | MG_SOCK_STRINGIFY_IP | + MG_SOCK_STRINGIFY_PORT); LOG(LL_INFO, ("HTTP request from %s: %.*s %.*s", addr, (int) hm->method.len, hm->method.p, (int) hm->uri.len, hm->uri.p));