Enable TLS and 256/64 mode

This commit is contained in:
Sergey Lyubka 2023-12-27 22:45:02 +00:00
parent 4b3884a49d
commit 93bcde0176
4 changed files with 8 additions and 15 deletions

View File

@ -23,7 +23,7 @@ firmware.bin: firmware.elf
$(PREFIX)-objcopy -O binary $< $@
$(PREFIX)-size --format=berkeley $<
firmware.elf: $(SOURCES) link.ld hal.h mongoose_custom.h Makefile
firmware.elf: $(SOURCES) hal.h mongoose_custom.h Makefile
$(PREFIX)-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
flash: firmware.bin

View File

@ -85,7 +85,7 @@ int main(void) {
const char *sizes[] = {"128/192", "96/224", "64/256", "32/288"};
uint32_t mode = (FLASH->OBR >> 8) & 3U;
MG_INFO(("RAM/FLASH configuration: %s", sizes[mode]));
// if (mode != 3) set_ram_size(3), mg_device_reset();
if (mode != 2) set_ram_size(2);
// Initialise Mongoose network stack
ethernet_init(); // Initialise ethernet pins
@ -107,7 +107,7 @@ int main(void) {
MG_INFO(("Initialising application..."));
mg_http_listen(&mgr, "http://0.0.0.0:8000", fn, NULL);
//web_init(&mgr);
web_init(&mgr);
MG_INFO(("Starting event loop"));
for (;;) {

View File

@ -4,6 +4,7 @@
#define MG_ARCH MG_ARCH_NEWLIB
#define MG_OTA MG_OTA_FLASH
#define MG_DEVICE MG_DEVICE_CH32V307
#define MG_TLS MG_TLS_BUILTIN
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_CUSTOM_MILLIS 1

View File

@ -1,21 +1,13 @@
ENTRY( _start );
__stack_size = 2048;
__stack_size = 4096;
PROVIDE( _stack_size = __stack_size );
MEMORY {
/* CH32V30x_D8C - CH32V307VC-CH32V307WC-CH32V307RC
CH32V30x_D8 - CH32V303VC-CH32V303RC
FLASH + RAM supports the following configuration
FLASH-192K + RAM-128K
FLASH-224K + RAM-96K
FLASH-256K + RAM-64K
FLASH-288K + RAM-32K
*/
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 288K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
/* Possible configurations: 192/128, 224/96, 256/64, 288/32 */
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256k
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64k
}
SECTIONS {
.init : {
_sinit = .;