Skip to content

Commit

Permalink
Merge pull request #16 from SPRESENSE/release-v1.3.200
Browse files Browse the repository at this point in the history
Merge develop into new-master for v1.3.200 release
  • Loading branch information
SPRESENSE authored Apr 1, 2022
2 parents d9c5968 + 3e1d6ea commit abb7e6a
Show file tree
Hide file tree
Showing 26 changed files with 766 additions and 14 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Change Log

# v1.3.200

(日本語の説明文は英語の後に記載しています。)

## Summary

* Feature improvements are available

## Improved features

* The following minor problems have been corrected.

* Fix a problem in which some parameters were not reflected when Makefile was edited manually.

* Fix an unintentional ".vscode/include not found" warning.

------------------------

(Below is in Japanese)

## 概要

* 機能改善を行いました。

## 改善された機能

* 下記の軽微な不具合を修正しました。

* Makefileを手動で編集した際に一部パラメータが反映されない問題を修正しました。

* ".vscode/includeが見つかりません" という意図しない警告が表示されないように修正しました。

# v1.3.100

(日本語の説明文は英語の後に記載しています。)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publisher": "sony-spresense",
"displayName": "Spresense VSCode IDE",
"description": "Spresense Extension for VSCode",
"version": "1.3.100",
"version": "1.3.200",
"license": "MIT",
"author": {
"name": "Sony Semiconductor Solutions"
Expand Down
6 changes: 6 additions & 0 deletions resources/makefiles/application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
# THIS FILE IS AUTO GENERATED. DO NOT MODIFY #
############################################################################

# Local flags
LOCAL_CFLAGS := $(CFLAGS)
LOCAL_CXXFLAGS := $(CXXFLAGS)

ifeq ($(SDK_VERSION_MAJ),1)
# SDK 1.x.x series
-include $(TOPDIR)/Make.defs
Expand Down Expand Up @@ -83,7 +87,9 @@ CSRCS += $(filter-out $(MAINSRC),$(wildcard *.c) $(wildcard */*.c))
CXXSRCS += $(wildcard *.cpp) $(wildcard */*.cpp) $(wildcard *.cxx) $(wildcard */*.cxx)

CFLAGS += $(foreach inc,$(wildcard ../*/include),-I$(inc))
CFLAGS += $(LOCAL_CFLAGS)
CXXFLAGS += $(foreach inc,$(wildcard ../*/include),-I$(inc))
CXXFLAGS += $(LOCAL_CXXFLAGS)

PROGNAME = $(APPNAME)$(EXEEXT)

Expand Down
9 changes: 9 additions & 0 deletions resources/makefiles/worker.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
############################################################################
# THIS FILE IS AUTO GENERATED. DO NOT MODIFY #
############################################################################

# SPRESENSE_IDE_VERSION := 1.1.0

# Local flags
LOCAL_CELFFLAGS := $(CELFFLAGS)

-include $(TOPDIR)/Make.defs
-include $(SDKDIR)/Make.defs

Expand All @@ -17,6 +25,7 @@ DBG = $(APPDIR)/$(WORKER_FOLDER_NAME)/$(WORKER_NAME).debug
CELFFLAGS += -Og
CELFFLAGS += -I$(APPDIR)
CELFFLAGS += -I$(WORKER_DIR)
CELFFLAGS += $(LOCAL_CELFFLAGS)

CSRCS += $(wildcard *.c) $(wildcard */*.c)

Expand Down
2 changes: 2 additions & 0 deletions resources/ver1/appfiles/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIGURED_APPS += __app_name__

30 changes: 30 additions & 0 deletions resources/ver1/appfiles/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Application makefile

# Command name (Public function 'int <APPNAME>_main(void)' required)
APPNAME =

# Application execute priority (Range: 0 ~ 255, Default: 100)
PRIORITY =

# Application stack memory size (Default: 2048)
STACKSIZE =

# Main source code
MAINSRC =

# Additional C source files (*.c)
CSRCS =

# Additional C++ source files (*.cxx)
CXXSRCS =

# Additional assembler source files (*.S)
ASRCS =

# C compiler flags
CFLAGS =

# C++ compiler flags
CXXFLAGS =

include $(SPRESENSE_HOME)/.vscode/application.mk
7 changes: 7 additions & 0 deletions resources/ver1/appfiles/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <sdk/config.h>
#include <stdio.h>

int __app_name___main(int argc, char *argv[])
{
return 0;
}
2 changes: 2 additions & 0 deletions resources/ver1/workerfiles/app/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIGURED_APPS += __app_name__

30 changes: 30 additions & 0 deletions resources/ver1/workerfiles/app/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Application makefile

# Command name (Public function 'int <APPNAME>_main(void)' required)
APPNAME =

# Application execute priority (Range: 0 ~ 255, Default: 100)
PRIORITY =

# Application stack memory size (Default: 2048)
STACKSIZE =

# Main source code
MAINSRC =

# Additional C source files (*.c)
CSRCS =

# Additional C++ source files (*.cxx)
CXXSRCS =

# Additional assembler source files (*.S)
ASRCS =

# C compiler flags
CFLAGS =

# C++ compiler flags
CXXFLAGS =

include $(SPRESENSE_HOME)/.vscode/application.mk
161 changes: 161 additions & 0 deletions resources/ver1/workerfiles/app/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
#include <sdk/config.h>
#include <stdio.h>
#include <string.h>

#include <asmp/asmp.h>
#include <asmp/mptask.h>
#include <asmp/mpshm.h>
#include <asmp/mpmq.h>
#include <asmp/mpmutex.h>

/* Include worker header */
#include "__worker_name__.h"

/* Worker ELF path */
#define WORKER_FILE "/mnt/spif/__worker_name__"

#define message(format, ...) printf(format, ##__VA_ARGS__)
#define err(format, ...) fprintf(stderr, format, ##__VA_ARGS__)

int __app_name___main(int argc, char *argv[])
{
mptask_t mptask;
mpmutex_t mutex;
mpshm_t shm;
mpmq_t mq;
uint32_t msgdata;
int data = 0x1234;
int ret, wret;
char *buf;

/* Initialize MP task */

ret = mptask_init(&mptask, WORKER_FILE);
if (ret != 0)
{
err("mptask_init() failure. %d\n", ret);
return ret;
}

ret = mptask_assign(&mptask);
if (ret != 0)
{
err("mptask_assign() failure. %d\n", ret);
return ret;
}

/* Initialize MP mutex and bind it to MP task */

ret = mpmutex_init(&mutex, __WORKER_NAME__KEY_MUTEX);
if (ret < 0)
{
err("mpmutex_init() failure. %d\n", ret);
return ret;
}
ret = mptask_bindobj(&mptask, &mutex);
if (ret < 0)
{
err("mptask_bindobj(mutex) failure. %d\n", ret);
return ret;
}

/* Initialize MP message queue with assigned CPU ID, and bind it to MP task */

ret = mpmq_init(&mq, __WORKER_NAME__KEY_MQ, mptask_getcpuid(&mptask));
if (ret < 0)
{
err("mpmq_init() failure. %d\n", ret);
return ret;
}
ret = mptask_bindobj(&mptask, &mq);
if (ret < 0)
{
err("mptask_bindobj(mq) failure. %d\n", ret);
return ret;
}

/* Initialize MP shared memory and bind it to MP task */

ret = mpshm_init(&shm, __WORKER_NAME__KEY_SHM, 1024);
if (ret < 0)
{
err("mpshm_init() failure. %d\n", ret);
return ret;
}
ret = mptask_bindobj(&mptask, &shm);
if (ret < 0)
{
err("mptask_binobj(shm) failure. %d\n", ret);
return ret;
}

/* Map shared memory to virtual space */

buf = mpshm_attach(&shm, 0);
if (!buf)
{
err("mpshm_attach() failure.\n");
return ret;
}
message("attached at %08x\n", (uintptr_t)buf);
memset(buf, 0, 1024);

/* Run worker */

ret = mptask_exec(&mptask);
if (ret < 0)
{
err("mptask_exec() failure. %d\n", ret);
return ret;
}

/* Send command to worker */
ret = mpmq_send(&mq, MSG_ID___WORKER_NAME__, (uint32_t) &data);
if (ret < 0)
{
err("mpmq_send() failure. %d\n", ret);
return ret;
}

/* Wait for worker message */

ret = mpmq_receive(&mq, &msgdata);
if (ret < 0)
{
err("mpmq_recieve() failure. %d\n", ret);
return ret;
}
message("Worker response: ID = %d, data = %x\n",
ret, *((int *)msgdata));

/* Show worker copied data */

/* Lock mutex for synchronize with worker after it's started */

mpmutex_lock(&mutex);

message("Worker said: %s\n", buf);

mpmutex_unlock(&mutex);

/* Destroy worker */

wret = -1;
ret = mptask_destroy(&mptask, false, &wret);
if (ret < 0)
{
err("mptask_destroy() failure. %d\n", ret);
return ret;
}

message("Worker exit status = %d\n", wret);

/* Finalize all of MP objects */

mpshm_detach(&shm);
mpshm_destroy(&shm);
mpmutex_destroy(&mutex);
mpmq_destroy(&mq);

return 0;
}
1 change: 1 addition & 0 deletions resources/ver1/workerfiles/worker/.worker
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NAME=__app_name__
12 changes: 12 additions & 0 deletions resources/ver1/workerfiles/worker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Worker makefile

# Additional C source files (*.c)
CSRCS =

# Additional assembler source files (*.S)
ASRCS =

# C compiler flags
CELFFLAGS =

include $(SPRESENSE_HOME)/.vscode/worker.mk
7 changes: 7 additions & 0 deletions resources/ver1/workerfiles/worker/header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* MP object keys. Must be synchronized with supervisor. */

#define __APP_NAME__KEY_SHM 1
#define __APP_NAME__KEY_MQ 2
#define __APP_NAME__KEY_MUTEX 3

#define MSG_ID___APP_NAME__ 1
Loading

0 comments on commit abb7e6a

Please sign in to comment.