Hello,
This is more of an architecture question. The particle P1 has a flash size of 1MB and a RAM of 128KB. While executing the code, I believe that most of the code gets executed straight from the flash starting at address 0x00000000. The instructions which can be modified are fetched to the RAM and are executed from there. Is this correct?
If I want to declare a static char array of size 300KB, does this get processed from the flash during runtime or will it be copied to the RAM and will crash my P1 due to insufficient space on RAM(being 128KB only)?
I agree with @bko. A initialized const array will live in flash while an initialized static array will live in both flash (initialization values) and RAM. Making vars static is not the same as const as it defines the scope of the variable, not whether it can change or not.
/usr/local/gcc-arm-embedded/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld: /workspace/target/workspace.elf section .text' will not fit in region APP_FLASH'
/usr/local/gcc-arm-embedded/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld: region `APP_FLASH' overflowed by 75176 bytes
I want to sent this entire firmware image over UART.
@dheerajdake, though the STM32F205 has 1MB of flash, only 128KB or so is available to the use. Most is used by the Particle system firmware. For larger data, you may want to consider an external flash device.
@dheerajdake, the web IDE numbers are incorrect and reflect the values for an older Spark Core. The Photon has approx. 128KB of flash and 60-80KB of RAM available for the user. Compiling using the Particle CLI produces the correct usage values.
This is from the stringImage.h generated by an application. The host bootloader API takes an argument of type const char *bootloadImagePtr[] which should match with const char *firmware[].