I am developing an application on a custom STM32f7 that hosts a web server. My task is to update the application from this web server: by selecting a .bin file and clicking on a simple button. The objective is to write this file in the memory and then to trigger the bootloader which will move the vector table and perform the necessary init. Everything is functional except the part of writing the file in the memory. I develop this part in javascript and I want to send a succession of POST requests since on the c processing side, I can't receive very large data. My file has more than 20000 lines of this type: 1111 2222 3333 4444 5555 6666 7777 8888\n 1111 2222 3333 4444 5555 6666 7777 8888\n ...
When my data are example values that I enter manually between "..." I can send as many POST requests as I want (see in the for loop the line in comment). But in my case I want to send 30 lines by 30 lines of data. I manage to send this data but after a random time (it may be after 20 or 200 requests sent), the requests are not sent and my web server freezes. My code is not very clear, I post you the function on which I meet my problem. To submit my form successively with a data "hidden" I use setInterval().
function cut(){
document.getElementById('mydata_file').value = "";
pas = pas + 30;
for (let k = pas; k < pas+30; k++) {
tab[k] = fich.slice(0+k*41, 41+k*41);
document.getElementById('mydata_file').value += tab[k];
//document.getElementById('mydata_file').value += "AAAA ";
}
}
function send_form(){
document.getElementById("myForm").submit();
}
The program is almost functional, do you have any suggestions for me ?