Skip to content

Instantly share code, notes, and snippets.

@thibthibaut
Last active February 4, 2020 14:08
Show Gist options
  • Save thibthibaut/fe8337e7404ce3acaa29b4028f0b671e to your computer and use it in GitHub Desktop.
Save thibthibaut/fe8337e7404ce3acaa29b4028f0b671e to your computer and use it in GitHub Desktop.
/* All code goes to .text (flash) */
/* This goes into .rodata (flash) */
const uint8_t weights[10] = {0xFA, 0xB0, 0x32, 0x1C, 0x12, 0xDA, 0x7B, 0x01, 0x42, 0xCA};
/* This goes into .data (stored in flash and copied to ram at startup) */
float values[3] = {0.15, 0.20, 0.55};
/* This goes to .bss (will be 0-init in ram) */
int buffer[100];
int mutliply_array(int* array, const int nbr_elem, int mut){
int temp_array[100] = {0}; // This goes into stack (ram)
int* other_temp_stuff = (int*) malloc(nbr_elem * sizeof(int) ); // this goes into heap (ram)
for(int i = 0; i < nbr_elem; i++){
// do stuff
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment