Merge branch 'main' into MQTT

This commit is contained in:
RobinVdB8
2023-11-13 15:49:45 +01:00
17 changed files with 3936 additions and 3292 deletions

View File

@@ -94,9 +94,9 @@
<fileInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1923792012.2015795402" name="test_data.h" rcbsApplicability="disable" resourcePath="Core/Inc/test_data.h" toolsToInvoke=""/>
<sourceEntries>
<entry excluding="Inc/fsdata_custom.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="LWIP"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
</sourceEntries>
</configuration>
</storageModule>

View File

@@ -95,4 +95,13 @@ void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t co
*/
void lcd_draw_bmp(const void* p_src, uint32_t x_pos, uint32_t y_pos, uint32_t x_size, uint32_t y_size, uint32_t color_mode);
/**
* @brief Clear LCD screen
* Clears the whole LCD screen to the desired color
*
*@param[in] color Color to which the LCD should be cleared
*/
void lcd_clear(uint32_t color);
#endif /* INC_LCD_API_H_ */

View File

@@ -95,3 +95,7 @@ void lcd_draw_bmp(const void* p_src, uint32_t x_pos, uint32_t y_pos, uint32_t x_
LOG_INFO(TAG, "DMA2D poll");
HAL_DMA2D_PollForTransfer(&hDma2dHandler2, 10);
}
void lcd_clear(uint32_t color){
BSP_LCD_Clear(color);
}

File diff suppressed because it is too large Load Diff

View File

@@ -23,9 +23,10 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#define LOGGER_LEVEL_ALL
#include "../../Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_qspi.h"
#include "../../Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.h"
#include "log.h"
#include "llfs.h"
#include "../../Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.h"
#include "lcd_api.h"
/* USER CODE END Includes */
@@ -113,155 +114,20 @@ int main(void)
MX_LWIP_Init();
MX_QUADSPI_Init();
/* USER CODE BEGIN 2 */
/* Initialize QSPI */
BSP_QSPI_Init();
BSP_QSPI_MemoryMappedMode();
WRITE_REG(QUADSPI->LPTR, 0xFFF);
/* Initialize the LCD */
lcd_init(true);
/* Initialize the filesystem */
llfs_init();
FILE *f = fopen("test.txt", "rw");
if (f == NULL) {
LOG_INFO(TAG, "File not found test.txt");
return 1;
} else {
LOG_INFO(TAG, "File found test.txt");
}
// Test POSIX file operations
// fgetc
int c;
printf("Printing file:\n");
while ((c = fgetc(f)) != EOF) {
printf("%c", c);
}
LOG_INFO(TAG, "File printed");
// fseek
fseek(f, 0, SEEK_SET);
LOG_INFO(TAG, "File seeked to start");
// ftell
long pos = ftell(f);
LOG_INFO(TAG, "File position: %d", pos);
// fread
char buf[100];
size_t bytes_read = fread(buf, 1, 100, f);
LOG_INFO(TAG, "Read %d bytes from file", bytes_read);
printf("Read from file:\n");
for (int i = 0; i < bytes_read; i++) {
printf("%c", buf[i]);
}
// Rewind the file
LOG_INFO(TAG, "Before File rewinded, pos: %d", ftell(f));
rewind(f);
LOG_INFO(TAG, "File rewinded, pos: %d", ftell(f));
// Get the file size fstat
struct stat st;
fstat(fileno(f), &st);
LOG_INFO(TAG, "File size: %d", st.st_size);
// Get a list of all files with the .bmp extension
llfs_file_t file_list[10];
size_t num_files = llfs_file_list(file_list, 10, "*.bmp");
LOG_INFO(TAG, "Found %d files with the .bmp extension", num_files);
for (int i = 0; i < num_files; i++) {
LOG_INFO(TAG, "File %d: %s", i, file_list[i].name);
}
// Get a list of files with .txt or .html
num_files = llfs_file_list(file_list, 10, "*.txt");
LOG_INFO(TAG, "Found %d files with the .txt or .html extension", num_files);
for (int i = 0; i < num_files; i++) {
LOG_INFO(TAG, "File %d: %s", i, file_list[i].name);
}
// Loop over all files using the iterator
LOG_INFO(TAG, "Looping over all files, using the iterator");
void *mem = NULL;
llfs_file_t *file;
while ((file = llfs_next_file(&mem, NULL)) != NULL) {
LOG_INFO(TAG, "File: %s", file->name);
}
// Loop over all files with the .bmp extension using the iterator
LOG_INFO(TAG, "Looping over all files with the .bmp extension, using the iterator");
mem = NULL;
while ((file = llfs_next_file(&mem, "*.bmp")) != NULL) {
LOG_INFO(TAG, "File: %s", file->name);
}
// Get the number of files in the filesystem
size_t num_files_in_fs = llfs_file_count();
LOG_INFO(TAG, "Number of files in the filesystem: %d", num_files_in_fs);
fclose(f);
// Try opening multiple files
LOG_INFO(TAG, "Opening an closing multiple files");
FILE * f1 = fopen("test.txt", "rw");
if (f1 == NULL) {
LOG_INFO(TAG, "File not found f1");
return 1;
} else {
LOG_INFO(TAG, "File found f1");
}
// Get the fileno
int fd = fileno(f1);
LOG_INFO(TAG, "File descriptor f1: %d", fd);
FILE * f2 = fopen("test.txt", "rw");
if (f2 == NULL) {
LOG_INFO(TAG, "File not found f2");
return 1;
} else {
LOG_INFO(TAG, "File found f2");
}
// Get the fileno
fd = fileno(f2);
LOG_INFO(TAG, "File descriptorf2: %d", fd);
LOG_INFO(TAG, "Closing f1");
fclose(f1);
FILE * f3 = fopen("test.txt", "rw");
if (f3 == NULL) {
LOG_INFO(TAG, "File not found f3");
return 1;
} else {
LOG_INFO(TAG, "File found f3");
}
// Get the fileno
fd = fileno(f3);
LOG_INFO(TAG, "File descriptor f3: %d", fd);
LOG_INFO(TAG, "Closing f2");
fclose(f2);
LOG_INFO(TAG, "Closing f3");
fclose(f3);
// Try opening a file multiple times, until it fails
int i = 0;
LOG_INFO(TAG, "Opening a file multiple times, until it fails");
while (1) {
f = fopen("test.txt", "rw");
LOG_INFO(TAG, "File descriptor: %d", fileno(f));
if (f == NULL) {
LOG_INFO(TAG, "File not found test.txt");
break;
} else {
LOG_INFO(TAG, "File found test.txt");
}
i++;
}
LOG_INFO(TAG, "File opened %d times", i);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)

View File

@@ -93,8 +93,6 @@
#define LWIP_HTTPD_SSI 1
/*----- Default Value for LWIP_HTTPD_SSI_RAW: 0 ---*/
#define LWIP_HTTPD_SSI_RAW 1
/*----- Default Value for LWIP_HTTPD_SUPPORT_POST: 0 ---*/
#define LWIP_HTTPD_SUPPORT_POST 1
/*----- Default Value for LWIP_HTTPD_CUSTOM_FILES: 0 ---*/
#define LWIP_HTTPD_CUSTOM_FILES 1
/*----- Value in opt.h for HTTPD_USE_CUSTOM_FSDATA: 0 -----*/

View File

@@ -46,6 +46,7 @@ MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
QSPI (xrw) : ORIGIN = 0x90000000, LENGTH = 16M
}
/* Sections */
@@ -182,4 +183,9 @@ SECTIONS
}
.ARM.attributes 0 : { *(.ARM.attributes) }
.ext_qspi_flash :
{
*(.ext_qspi_flash)
} >QSPI
}

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.st.stm32cube.ide.mcu.debug.launch.launchConfigurationType">
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.access_port_id" value="0"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_live_expr" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_swv" value="false"/>
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.formatVersion" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.enabled" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.value" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{&quot;fItems&quot;:[{&quot;fIsFromMainTab&quot;:true,&quot;fPath&quot;:&quot;Debug/project.elf&quot;,&quot;fProjectName&quot;:&quot;project&quot;,&quot;fPerformBuild&quot;:true,&quot;fDownload&quot;:true,&quot;fLoadSymbols&quot;:true}]}"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.remoteCommand" value="target remote"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startServer" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.divby0" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.unaligned" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="16000000"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_allow_halt" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_signal_halt" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_external_loader" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_logging" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_max_halt_delay" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader" value="N25Q128A_STM32F746G-DISCO, 0x90000000, NOR_FLASH, N25Q128A_STM32F746G-DISCO.stldr"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader_init" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="D:\school\2023-2024\Webservices and Applications YT6258\Labo\Synthese-opdracht\2023-Webservices_And_Applications\project\Debug\st-link_gdbserver_log.txt"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="disable"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkenable_rtos" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{&quot;fVersion&quot;:1,&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Software system reset&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Software system reset&quot;,&quot;fLaunchAttribute&quot;:&quot;system_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Hardware reset&quot;,&quot;fLaunchAttribute&quot;:&quot;hardware_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset hardware\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Core reset&quot;,&quot;fLaunchAttribute&quot;:&quot;core_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset core\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;no_reset&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[&quot;-g&quot;]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true}]}"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.enableRtosProxy" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyCustomProperties" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriver" value="threadx"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriverAuto" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriverPort" value="cortex_m0"/>
<intAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyPort" value="60000"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDeviceId" value="com.st.stm32cube.ide.mcu.debug.stlink"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/project.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="project"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1923792012"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/project"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="com.st.stm32cube.ide.mcu.debug.launch.HardwareDebugProcessFactory"/>
</launchConfiguration>

View File

@@ -43,7 +43,7 @@ LWIP.LWIP_HTTPD_CGI_SSI=1
LWIP.LWIP_HTTPD_CUSTOM_FILES=1
LWIP.LWIP_HTTPD_SSI=1
LWIP.LWIP_HTTPD_SSI_RAW=1
LWIP.LWIP_HTTPD_SUPPORT_POST=1
LWIP.LWIP_HTTPD_SUPPORT_POST=0
LWIP.LWIP_IGMP=1
LWIP.LWIP_TFTP=1
LWIP.MEMP_MEM_MALLOC=1