* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS ' AS IS '
* this license is void and will automatically terminate your rights under Redistribution and use of this software other than as permitted under * microprocessor devices manufactured by or for STMicroelectronics. * software, must execute solely and exclusively on microcontroller or This software, including modifications and/or derivative works of this * derived from this software without specific written permission. * contributors to this software may be used to endorse or promote products Neither the name of STMicroelectronics nor the names of other * and/or other materials provided with the distribution. * this list of conditions and the following disclaimer in the documentation Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer.
Redistribution of source code must retain the above copyright notice, * modification, are permitted, provided that the following conditions are met: * Redistribution and use in source and binary forms, with or without * Copyright (c) 2017 STMicroelectronics International N.V. * Description : This file provides code for the MSP Initialization Może pomożecie mi się z tym uporać :) Projekt w Atollic TrueStudio :) A co do tego to wydawało mi sie ze z calbackiem można tak działaćīT_project_freeRTOS.7z > stm32f4xx_hal_msp.c So this means that if I use the _attribute_ with section, the variable is treated like an initialized variable.Dziekuje za odpowiedzi :) zdaje sobie sprawę że używanie DMA tutaj jest na wyrost ale bawiłem się wszystkimi opcjami i na DMA skończyłem :) Co do makr ST to się nazywa CMSIS freeRTOS dokładnie i chyba jest nawet na stronie freeRTOSa ale i tak wrzucam spakowany projekt. You can force a variable to be initialized with the `-fno-common’ flag or the `nocommon’ attribute.” The linker requires each object be defined once, with the exception that uninitialized variables tentatively go in the `common’ (or `bss’) section and can be multiply “defined”. ” You may only use the `section’ attribute with a fully initialized global definition because of the way linkers work. And after googling and searching, I have found this ( ): So I started to dig more into how the _attribute_ section topic. I was hoping that maybe ‘printsize’ is just wrong, but when I checked the two S19 files produced, there is indeed FLASH memory allocated for this ? :Ĥ KByte of Zeros for initialization data Section Attribute and Data Initialization Really surprising, unexpected and bad as it increases the FLASH footprint for no reason. So even as I have *not* initialized that variable, the linker creates a 4 KByte array of zeros in FLASH to initialize it :-(. I would have expected that it would end up in the bss area, but it does not. Wow! The data size increased by 4K! Remember: that 4 KByte gets added to the FLASH for the initialization data. Then the sizes reported is: text data bss dec hex filenameĢ1016 4384 3584 28984 7138 FRDM-K20_CDC.elf I’m using here a section attribute to allocate the variable in a named section, see “ Defining Variables at Absolute Addresses with gcc“. Static unsigned char myBuffer _attribute_((section (".m_data_20000000"))) The interesting thing is when I add this to my application (and of course reference/use it): Not Initialized Data with Section _attribute_ So my FLASH size is 21004+288 bytes, and my RAM needs are 280+3584 bytes. My current appliation for a Freescale K20 gives me with printsize: text data bss dec hex filename
Then this will add 4 bytes to the data section (initialized data), plus there will be 4 bytes allocated in FLASH for the initialization data (0x12345678). Uint32_t globInitializedVar = 0x12345678
Will add 4 bytes to the bss section (uninitialized data). I recommend to read my post about “ text, data and bss: Code and Data Size Explained“. To Initialize or Not, That’s the Question: bss and data