Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorWiz committed Jun 8, 2020
1 parent 191df7e commit 698108d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ These are Firmware projects (source code) based on Eclipse IDE for C/C++ Develop


## Revision History
v1.2.2
- Change prevbuf from pointer array to 2D array
- Change dump from pointer to array

v1.2.1
- AT Command RSP Buffer Size 20 -> 50

Expand Down
4 changes: 2 additions & 2 deletions WIZ550SR_App/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-64176530888550216" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="402660648990340329" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-29922407930635858" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="416194765060439135" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
14 changes: 5 additions & 9 deletions WIZ550SR_App/src/ATcmd/atcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const struct at_command g_cmd_table[] =
};

static int8_t termbuf[ATCMD_BUF_SIZE];
static int8_t *prevbuf[PREVBUF_MAX_NUM];
static int8_t prevbuf[PREVBUF_MAX_NUM][ATCMD_BUF_SIZE];
static uint8_t previdx = 0, prevcnt = 0;
static int16_t prevlen = 0;

Expand All @@ -131,7 +131,7 @@ void atc_init()
int8_t i;

memset(termbuf, 0, ATCMD_BUF_SIZE);
for(i=0; i<PREVBUF_MAX_NUM; i++) prevbuf[i] = NULL;
for(i=0; i<PREVBUF_MAX_NUM; i++) strcpy((char*)prevbuf[i],"\0");
atci.sendsock = VAL_NONE;
atci.echo = VAL_DISABLE;
atci.poll = POLL_MODE_SEMI;
Expand Down Expand Up @@ -227,22 +227,17 @@ static void cmd_set_prev(uint8_t buflen)
idx = (previdx + PREVBUF_MAX_NUM - prevcnt) % PREVBUF_MAX_NUM; // oldest index
if(prevbuf[idx]) {
prevlen -= strlen((char*)prevbuf[idx]) + 1;
free(prevbuf[idx]);
prevbuf[idx] = NULL;
strcpy((char*)prevbuf[previdx],"\0");
prevcnt--;
} else CRITICAL_ERR("ring buf 1");
}

prevbuf[previdx] = malloc(buflen+1);

while(prevcnt && prevbuf[previdx] == NULL) {
idx = (previdx + PREVBUF_MAX_NUM - prevcnt) % PREVBUF_MAX_NUM; // oldest index
if(prevbuf[idx]) {
prevlen -= strlen((char*)prevbuf[idx]) + 1;
free(prevbuf[idx]);
prevbuf[idx] = NULL;
strcpy((char*)prevbuf[previdx],"\0");
prevcnt--;
prevbuf[previdx] = malloc(buflen+1);
} else CRITICAL_ERR("ring buf 2");
}

Expand Down Expand Up @@ -641,6 +636,7 @@ static void hdl_nopen(void)
CHK_ARG_LEN(atci.tcmd.arg5, 0, 5);
type = atci.tcmd.arg1[0];
CMD_CLEAR();
delay_ms(5);
act_nopen_a(type, SrcPort, dip, DstPort);
}
else CRITICAL_ERRA("wrong sign(%d)", atci.tcmd.sign);
Expand Down
5 changes: 3 additions & 2 deletions WIZ550SR_App/src/ATcmd/cmdrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,9 @@ void act_nsock(int8_t sock)

if(sock < ATC_SOCK_NUM_START)
{
int8_t *dump, i, type, cnt_con=0, cnt_notcon=0;
int8_t i, type, cnt_con=0, cnt_notcon=0;
uint16_t dump_idx = 0;
static char dump[50]={'\0',};

//DBG("NSOCK-start");
for(i=ATC_SOCK_NUM_START; i<=ATC_SOCK_NUM_END; i++) {
Expand All @@ -760,7 +761,7 @@ void act_nsock(int8_t sock)
cmd_resp_dump(VAL_NONE, NULL);
return;
}
dump = malloc((36*cnt_con)+(16*cnt_notcon)+1); //DBGA("DUMP BUF(%d),C(%d),N(%d)", (36*cnt_con)+(14*cnt_notcon)+1, cnt_con, cnt_notcon);
//DBGA("DUMP BUF(%d),C(%d),N(%d)", (36*cnt_con)+(14*cnt_notcon)+1, cnt_con, cnt_notcon);
if(dump == NULL) {
cmd_resp(RET_NO_FREEMEM, VAL_NONE);
return;
Expand Down
2 changes: 1 addition & 1 deletion WIZ550SR_App/src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define MAJOR_VER 1
#define MINOR_VER 2
#define MAINTENANCE_VER 1
#define MAINTENANCE_VER 2

#define SOCK_DATA 0
#define SOCK_TFTP 1
Expand Down

0 comments on commit 698108d

Please sign in to comment.