Rename bootable image to 1284BOOT.BIN, add globals.c
[17_m1284p_BTLD_WIZNET_HTTPD_FTPD_FATFS_SDCARD]
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" description="" id="de.innot.avreclipse.configuration.app.release.1296246863" name="Release" parent="de.innot.avreclipse.configuration.app.release" postannouncebuildStep="Build FIRMWARE.BIN file" postbuildStep="avr-objcopy -R .eeprom -O binary ${BuildArtifactFileName} FIRMWARE.BIN">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" description="" id="de.innot.avreclipse.configuration.app.release.1296246863" name="Release" parent="de.innot.avreclipse.configuration.app.release" postannouncebuildStep="Build 1284BOOT.BIN file" postbuildStep="avr-objcopy -R .eeprom -O binary ${BuildArtifactFileName} 1284BOOT.BIN">
|
||||
<folderInfo id="de.innot.avreclipse.configuration.app.release.1296246863." name="/" resourcePath="">
|
||||
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.release.1035343131" name="AVR-GCC Toolchain" superClass="de.innot.avreclipse.toolchain.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release.1677804441" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release"/>
|
||||
|
||||
@@ -735,11 +735,11 @@ uint8_t ftpd_run(uint8_t * dbuf)
|
||||
size = SPRINTF(dbuf, "226 Successfully transferred \"%s\"\r\n", ftp.filename);
|
||||
send(CTRL_SOCK, dbuf, size);
|
||||
#ifdef BOOT_EN
|
||||
if (strcasestr_P((const char *)ftp.filename, PSTR("FIRMWARE.BIN")))
|
||||
if (strcasestr_P((const char *)ftp.filename, PSTR("1284BOOT.BIN")))
|
||||
{
|
||||
//Found event "FIRMWARE.BIN" upload to SD from FTPD, rise signal to running BootLoader (via WDT reset)
|
||||
//Found event "1284BOOT.BIN" upload to SD from FTPD, rise signal to running BootLoader (via WDT reset)
|
||||
#ifdef BOOT_DEBUG
|
||||
PRINTF("\r\n\r\n>>Catch <FIRMWARE.BIN> upload event, so run BOOTLOADER\r\n");
|
||||
PRINTF("\r\n\r\n>>Catch <1284BOOT.BIN> upload event, so run BOOTLOADER\r\n");
|
||||
#endif
|
||||
sig_reset_board = 1;
|
||||
}
|
||||
|
||||
26
17_m1284p_BTLD_WIZNET_HTTPD_FTPD_FATFS_SDCARD/globals.c
Normal file
26
17_m1284p_BTLD_WIZNET_HTTPD_FTPD_FATFS_SDCARD/globals.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* globals.c
|
||||
*
|
||||
* Created on: 07 февр. 2019 г.
|
||||
* Author: maxx
|
||||
*/
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef IP_WORK
|
||||
//NIC metrics for WORK PC
|
||||
wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address
|
||||
.ip = {192, 168, 0, 199}, // IP address
|
||||
.sn = {255, 255, 255, 0}, // Subnet mask
|
||||
.dns = {8,8,8,8}, // DNS address (google dns)
|
||||
.gw = {192, 168, 0, 1}, // Gateway address
|
||||
.dhcp = NETINFO_STATIC}; //Static IP configuration
|
||||
#else
|
||||
//NIC metrics for another PC (second IP configuration)
|
||||
wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address
|
||||
.ip = {192, 168, 1, 199}, // IP address
|
||||
.sn = {255, 255, 255, 0}, // Subnet mask
|
||||
.dns = {8,8,8,8}, // DNS address (google dns)
|
||||
.gw = {192, 168, 1, 1}, // Gateway address
|
||||
.dhcp = NETINFO_STATIC}; //Static IP configuration
|
||||
#endif
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
#include "ff.h"
|
||||
#include "diskio.h"
|
||||
#include "integer.h"
|
||||
|
||||
#include "Ethernet/socket.h"
|
||||
#include "Ethernet/wizchip_conf.h"
|
||||
#include "Internet/httpServer_avr/httpParser.h"
|
||||
FATFS Fatfs; //File system object for each logical drive. >= 2
|
||||
//static FIL File; //File object. there are _FS_LOCK file objects available, >= 2
|
||||
@@ -58,7 +61,7 @@ FATFS Fatfs; //File system object for each logical drive. >= 2
|
||||
|
||||
#define SPRINTF(__S, FORMAT, args...) sprintf_P(__S, PSTR(FORMAT),##args)
|
||||
|
||||
//#define IP_WORK
|
||||
#define IP_WORK
|
||||
|
||||
extern unsigned long millis(void);
|
||||
extern int freeRam (void);
|
||||
@@ -84,4 +87,12 @@ extern const char str_prog_name[] PROGMEM;
|
||||
#ifdef BOOT_EN
|
||||
extern volatile unsigned char sig_reset_board; // Flag to reset board
|
||||
#endif
|
||||
|
||||
extern wiz_NetInfo netInfo;
|
||||
|
||||
//#define _MAIN_DEBUG_ //Not used here
|
||||
|
||||
#define CHK_RAM_LEAKAGE
|
||||
#define CHK_UPTIME
|
||||
|
||||
#endif /* GLOBALS_H_ */
|
||||
|
||||
@@ -23,37 +23,16 @@
|
||||
#include "Internet/httpServer_avr/httpServer.h"
|
||||
#include "Internet/FTPServer_avr/ftpd.h"
|
||||
|
||||
#define _MAIN_DEBUG_
|
||||
|
||||
#define CHK_RAM_LEAKAGE
|
||||
#define CHK_UPTIME
|
||||
|
||||
#ifdef IP_WORK
|
||||
//NIC metrics for WORK PC
|
||||
wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address
|
||||
.ip = {192, 168, 0, 199}, // IP address
|
||||
.sn = {255, 255, 255, 0}, // Subnet mask
|
||||
.dns = {8,8,8,8}, // DNS address (google dns)
|
||||
.gw = {192, 168, 0, 1}, // Gateway address
|
||||
.dhcp = NETINFO_STATIC}; //Static IP configuration
|
||||
#else
|
||||
//NIC metrics for another PC (second IP configuration)
|
||||
wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address
|
||||
.ip = {192, 168, 1, 199}, // IP address
|
||||
.sn = {255, 255, 255, 0}, // Subnet mask
|
||||
.dns = {8,8,8,8}, // DNS address (google dns)
|
||||
.gw = {192, 168, 1, 1}, // Gateway address
|
||||
.dhcp = NETINFO_STATIC}; //Static IP configuration
|
||||
#endif
|
||||
|
||||
uint8_t gFTPBUF[_MAX_SS_FTPD]; //512 bytes
|
||||
|
||||
/*
|
||||
* (17) Combine together (16) + abilities to enter BootLoader (reset with WDT),
|
||||
* when occur event upload via FTPD to SD file with name <FIRMWARE.BIN> (see STOR_CMD into <ftpd.c>)
|
||||
* when occur event upload via FTPD to SD file with name <1284BOOT.BIN> (see STOR_CMD into <ftpd.c>)
|
||||
* TODO:
|
||||
* OK (v1.2)
|
||||
* OK (v1.2a) Some minor changes, added key <BOOT_DEBUG>
|
||||
* OK (v1.2b) Some minor changes
|
||||
* OK (v1.2d) Changed bootable image to 1284BOOT.BIN
|
||||
* Notes.
|
||||
* Works in pair with BootLoader project: <bootloader_zevero_sd_m1284p_make>
|
||||
* Also see </bootloader_zevero_sd_m1284p_make/m1284p_zevero_sd_m1284p_fuses.txt> to set correct fuses
|
||||
@@ -161,7 +140,7 @@ volatile unsigned char sig_reset_board; // Flag to reset board
|
||||
//*********Program metrics
|
||||
const char compile_date[] PROGMEM = __DATE__; // Mmm dd yyyy - Дата компиляции
|
||||
const char compile_time[] PROGMEM = __TIME__; // hh:mm:ss - Время компиляции
|
||||
const char str_prog_name[] PROGMEM = "\r\nAtMega1284p v1.2c BootLoaded HTTPD and FTPD servers && FATFS SDCARD WIZNET_5500 ETHERNET 16/01/2019\r\n"; // Program name
|
||||
const char str_prog_name[] PROGMEM = "\r\nAtMega1284p v1.2d BootLoaded HTTPD and FTPD servers && FATFS SDCARD WIZNET_5500 ETHERNET 07/02/2019\r\n"; // Program name
|
||||
|
||||
#if defined(__AVR_ATmega128__)
|
||||
const char PROGMEM str_mcu[] = "ATmega128"; //CPU is m128
|
||||
@@ -672,10 +651,10 @@ int main()
|
||||
fatfs_head_file("index.htm");
|
||||
|
||||
#ifdef BOOT_EN
|
||||
//Delete <FIRMWARE.BIN> for BootLoader working properly
|
||||
fatfs_delete("FIRMWARE.BIN");
|
||||
//Delete <1284BOOT.BIN> for BootLoader working properly
|
||||
fatfs_delete("1284BOOT.BIN");
|
||||
//Test message
|
||||
PRINTF("\r\n++Test message from new code #10\r\n");
|
||||
PRINTF("\r\n++Test message from new code #11\r\n");
|
||||
#endif
|
||||
|
||||
//Wizchip WIZ5500 Ethernet initialize
|
||||
|
||||
Reference in New Issue
Block a user