Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
build/*
r
.gcc-flags.json
cscope*
.cscope*
2 changes: 1 addition & 1 deletion .mxproject

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Inc/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
#define configTICK_RATE_HZ ((TickType_t)1000)
#define configMAX_PRIORITIES ( 7 )
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
#define configTOTAL_HEAP_SIZE ((size_t)15360)
#define configTOTAL_HEAP_SIZE ((size_t)102400)
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1
Expand Down
55 changes: 55 additions & 0 deletions Inc/communication/wakaama_client/connection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*******************************************************************************
*
* Copyright (c) 2013, 2014 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* The Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* David Navarro, Intel Corporation - initial API and implementation
*
*******************************************************************************/

#ifndef __CONNECTION_H_
#define __CONNECTION_H_

#include <stdio.h>
#include "netdb.h"
#include "lwip/opt.h"
#include "lwip/arch.h"
#include "lwip/api.h"
#include "lwip/inet.h"
#include "lwip/sockets.h"
#include <liblwm2m.h>

#define LWM2M_STANDARD_PORT_STR "5683"
#define LWM2M_STANDARD_PORT 5683
#define LWM2M_DTLS_PORT_STR "5684"
#define LWM2M_DTLS_PORT 5684
#define LWM2M_BSSERVER_PORT_STR "5685"
#define LWM2M_BSSERVER_PORT 5685

typedef struct _connection_t
{
struct _connection_t * next;
int sock;
struct sockaddr_in addr;
size_t addrLen;
} connection_t;

connection_t * connection_find(connection_t * connList, struct sockaddr_storage * addr, size_t addrLen);
connection_t * connection_new_incoming(connection_t * connList, int sock, struct sockaddr * addr, size_t addrLen);
connection_t * connection_create(connection_t * connList, int sock, char * host, char * port, int addressFamily);

void connection_free(connection_t * connList);

int connection_send(connection_t *connP, uint8_t * buffer, size_t length);

int createUDPSocket(int port, int addressFamily);

#endif
19 changes: 19 additions & 0 deletions Inc/communication/wakaama_client/objects/objects.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef __OBJECTS_H
#define __OBJECTS_H

lwm2m_object_t * get_security_object();
lwm2m_object_t * get_server_object(int serverId,
const char* binding,
int lifetime,
bool storing);
lwm2m_object_t * get_object_device();
lwm2m_object_t * get_test_object();

void free_security_object();
void clean_server_object();
void free_object_device();
void free_test_object();

#define OBJ_COUNT 4

#endif
28 changes: 28 additions & 0 deletions Inc/communication/wakaama_client/wakaama.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef __WAKAAMA_H
#define __WAKAAMA_H

#include "connection.h"
#include "objects.h"
#include "communication_config.h"

typedef struct
{
lwm2m_object_t * securityObjP;
int sock;
connection_t * connList;
int addressFamily;
} client_data_t;

//WAKAAMA
static lwm2m_context_t *lwm2mContext = NULL;
static lwm2m_object_t *objArray[OBJ_COUNT];
static client_data_t data;
static int q_reset = 0;

static void print_state(lwm2m_context_t * lwm2mH);
void taskWakaama(void *socket);
void * lwm2m_connect_server(uint16_t secObjInstID,
void * userData);
void lwm2m_close_connection(void * sessionH,
void * userData);
#endif
4 changes: 2 additions & 2 deletions Inc/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
/* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
/*----- Value in opt.h for LWIP_DHCP: 0 -----*/
#define LWIP_DHCP 1
/*----- Default Value for LWIP_DNS: 0 ---*/
#define LWIP_DNS 1
/*----- Value in opt.h for MEM_ALIGNMENT: 1 -----*/
#define MEM_ALIGNMENT 4
/*----- Value in opt.h for MEMP_NUM_SYS_TIMEOUT: (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + (PPP_SUPPORT*6*MEMP_NUM_PPP_PCB) + (LWIP_IPV6 ? (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD) : 0)) -*/
#define MEMP_NUM_SYS_TIMEOUT 5
/*----- Value in opt.h for LWIP_ETHERNET: LWIP_ARP || PPPOE_SUPPORT -*/
#define LWIP_ETHERNET 1
/*----- Value in opt.h for LWIP_DNS_SECURE: (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT) -*/
Expand Down
5 changes: 4 additions & 1 deletion JtagProgrammer.ioc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ ETH.IPParameters=MediaInterface,PhyAddress
ETH.MediaInterface=ETH_MEDIA_INTERFACE_RMII
ETH.PhyAddress=0
FREERTOS.FootprintOK=true
FREERTOS.IPParameters=Tasks01,configMINIMAL_STACK_SIZE,FootprintOK
FREERTOS.IPParameters=Tasks01,configMINIMAL_STACK_SIZE,FootprintOK,configTOTAL_HEAP_SIZE
FREERTOS.Tasks01=defaultTask,0,1024,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL
FREERTOS.configMINIMAL_STACK_SIZE=128
FREERTOS.configTOTAL_HEAP_SIZE=102400
File.Version=6
KeepUserPlacement=false
LWIP.IPParameters=LWIP_DNS
LWIP.LWIP_DNS=1
LWIP.Version=v2.0.3_Cube
Mcu.Family=STM32F4
Mcu.IP0=ETH
Expand Down
79 changes: 64 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [2.30.0] date: [Sat Sep 29 11:39:00 CEST 2018]
# File automatically-generated by tool: [projectgenerator] version: [2.30.0] date: [Mon Oct 15 23:30:01 CEST 2018]
##########################################################################################################################

# ------------------------------------------------
Expand All @@ -13,7 +13,7 @@
######################################
# target
######################################
TARGET = JtagProgrammer
TARGET = RemoteProgrammer


######################################
Expand Down Expand Up @@ -160,12 +160,55 @@ Src/ethernetif.c \
Src/stm32f4xx_it.c \
Src/stm32f4xx_hal_msp.c \
Src/communication/dbgu.c \
Src/communication/term_io.c
Src/communication/term_io.c \
Src/communication/wakaama_client/wakaama.c

# ASM sources
ASM_SOURCES = \
startup_stm32f429xx.s

#######################################
# Wakaama
######################################

WAKAAMA_SOURCES = \
Middlewares/Third_Party/wakaama/liblwm2m.c \
Middlewares/Third_Party/wakaama/wakaama_utils.c \
Middlewares/Third_Party/wakaama/uri.c \
Middlewares/Third_Party/wakaama/objects.c \
Middlewares/Third_Party/wakaama/tlv.c \
Middlewares/Third_Party/wakaama/data.c \
Middlewares/Third_Party/wakaama/wakaama_list.c \
Middlewares/Third_Party/wakaama/packet.c \
Middlewares/Third_Party/wakaama/transaction.c \
Middlewares/Third_Party/wakaama/registration.c \
Middlewares/Third_Party/wakaama/bootstrap.c \
Middlewares/Third_Party/wakaama/management.c \
Middlewares/Third_Party/wakaama/observe.c \
Middlewares/Third_Party/wakaama/json.c \
Middlewares/Third_Party/wakaama/discover.c \
Middlewares/Third_Party/wakaama/block1.c \
Middlewares/Third_Party/wakaama/er-coap-13/er-coap-13.c

WAKAAMA_CUSTOM = \
Src/communication/wakaama_client/platform/platform.c \
Src/communication/wakaama_client/connection.c \
Src/communication/wakaama_client/objects/object_device.c \
Src/communication/wakaama_client/objects/object_security.c \
Src/communication/wakaama_client/objects/object_server.c \
Src/communication/wakaama_client/objects/test_object.c


WAKAAMA_INC = \
-IMiddlewares/Third_Party/wakaama \
-IMiddlewares/Third_Party/wakaama/er-coap-13 \


WAKAAMA_SYMBOL = -DLWM2M_LITTLE_ENDIAN
WAKAAMA_SYMBOL += -DLWM2M_CLIENT_MODE
#WAKAAMA_SYMBOL += -DLWM2M_MEMORY_TRACE
#WAKAAMA_SYMBOL += -DCOAPLOG # download logs
#WAKAAMA_SYMBOL += -DLWM2M_WITH_LOGS # LOGS

#######################################
# binaries
Expand All @@ -186,7 +229,7 @@ SZ = $(PREFIX)size
endif
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S

#######################################
# CFLAGS
#######################################
Expand All @@ -204,7 +247,7 @@ MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)

# macros for gcc
# AS defines
AS_DEFS =
AS_DEFS =

# C defines
C_DEFS = \
Expand Down Expand Up @@ -240,13 +283,19 @@ C_INCLUDES = \
-IMiddlewares/Third_Party/LwIP/src/include/posix/sys \
-IMiddlewares/Third_Party/LwIP/system/arch \
-IDrivers/CMSIS/Include \
-IInc/communication
-IInc/communication \
-IInc/communication/wakaama_client \
-IInc/communication/wakaama_client/objects \
-Iconfig

C_INCLUDES += $(WAKAAMA_INC)

C_SOURCES += $(WAKAAMA_SOURCES) $(WAKAAMA_CUSTOM)

# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections

CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) $(WAKAAMA_SYMBOL) -Wall -fdata-sections -ffunction-sections

ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
Expand All @@ -264,8 +313,8 @@ CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
LDSCRIPT = STM32F429ZITx_FLASH.ld

# libraries
LIBS = -lc -lm -lnosys
LIBDIR =
LIBS = -lc -lm -lnosys
LIBDIR =
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections

# default action: build all
Expand All @@ -282,7 +331,7 @@ vpath %.c $(sort $(dir $(C_SOURCES)))
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))

$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@

$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
Expand All @@ -294,19 +343,19 @@ $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile

$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(HEX) $< $@

$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(BIN) $< $@
$(BIN) $< $@

$(BUILD_DIR):
mkdir $@
mkdir $@

#######################################
# clean up
#######################################
clean:
-rm -fR $(BUILD_DIR)

#######################################
# dependencies
#######################################
Expand Down
Loading