But this simple code took a lot of RAM and flash memory:
Sketch uses 15072 bytes (2%) of program storage space. Maximum is 524288 bytes.
Global variables use 3152 bytes (4%) of dynamic memory, leaving 62384 bytes for local variables. Maximum is 65536 bytes.
My question now, is there a better way to get more less memory use ?
I donât know what bootloader exactly is burned inside the CPU, but in the Arduino IDE I program it with Serial and not with STM32duino.
Is this usage of memory I get in Arduino IDE because of the bootloader ?
Is there a better platform to get less memory usage with the same programming method which is with the Serial connection and not with the ST-LINK programmer because I donât have one ?
I tried to open a new project but I get there errors:
main.cpp
mbed-os-example-blinky-baremetal
âmbed.hâ file not foundclang(pp_file_not_found)[6, 10]
Unknown type name 'DigitalOutâclang(unknown_typename)[9, 1]
Unknown type name 'LED1âclang(unknown_typename)[9, 17]
Use of undeclared identifier 'MBED_MAJOR_VERSIONâclang(undeclared_var_use)[13, 84]
Use of undeclared identifier 'MBED_MINOR_VERSIONâclang(undeclared_var_use)[13, 104]
Use of undeclared identifier 'MBED_PATCH_VERSIONâclang(undeclared_var_use)[13, 124]
Use of undeclared identifier 'thread_sleep_forâclang(undeclared_var_use)[18, 9]
I think I have to install the whole Keil environment in the computer.
I compiled the program offline for the STM32F103VE target using the GCC_ARM toolchain with the following results:
Total Static RAM memory (data + bss): 1376(+1376) bytes
Total Flash memory (text + data): 17368(+17368) bytes
In case you use the online compiler ( see this for more info) or install the ARM Mbed Studio IDE then youâll build you program with the ARM toolchain which is a more optimised tool and produces a program requiring less RAM and flash memory.
OK, I get it, so even if the program is small; like, Blinky, it would take a relatively a fair amount of RAM and program space.
Comparing that with what I get in Arduino IDE, there is not much of a difference.
++ I can program the board in Arduino IDE with Serial connection, but I couldnât find any platform until now that allow me to program the board with the same RS-232 serial connection.
I installed uVision V5, itâs a nice IDE but I think it requires external programmers to program target boards.
Also, the old online compiler didnât work for me as it directs me to a page of many boards, which I guess that I should have purchased one of them.
But I got back to the https://studio.keil.arm.com/ I found the problem which didnât allow me to compile the code in the first time, which is because I didnât choose a correct supported Target hardware.
Then I chose one which didnât have the exclamation mark the code compiled but I couldnât get the size of the flash and RAM.
I have another question:
Is there a way to compile a program in keil studio, uVision, CubeMX or any other IDEs other than Arduino IDE, and then after compiling the code. I can get the final file which should be burned in the microcontroller; like, HEX file in Arduino and Microchip platforms. And then upload the file to the chip with Serial flash programmers; like, Flash Loader Demonstrator ?
Each cortex ARM microcontroller is equipped with a bootloader which is built into the chip during the production. So as explained here you can program your chip over a UART port with an USB to TTL UART converter if you like so. An alternative to the ST-LINK utility is the newer STM32CubeProgrammer available also on Mac and Linux. Of course a programmer is a more convenient piece of hardware and usually it enables also to debug your program.