2019-11-27 11:07 AM
Im using an F4 and modified my code to support an analog input using CubeMX. It messed up my project directory so i copied the new adc files to my unharmed project. I now get an "Error[Lp015]: section placement failure: overcommitted content in [0x802'0000-0x803'ffff]" and "Error while running Linker".
Part of the code in the auto generated adc.c file is a function called MX_ADC1_Init();
If i call this function i get the above error. If it is commented out, it builds successfully. If i call that function but comment everything out it builds successfully. If I incrementally add things in until i get the error then it fails within the HAL_ADC_Init() function (which is within the MX_ADC1_Init() function). Within the HAL_ADC_Init() function it fails when I uncomment hadc->Lock = HAL_UNLOCKED;
The code below shows the hadc->Lock = HAL_UNLOCKED as uncommented. Has anyone seen this before? What could cause it? How do I fix it?
Edit: worth noting is that many other unlock statements work correctly (ie: huart->Lock = HAL_UNLOCK, htim->Lock = ..., heth, hspi, hi2c, hrng, etc.)
HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc)
{
HAL_StatusTypeDef tmp_hal_status = HAL_OK;
//
// /* Check ADC handle */
if(hadc == NULL)
{
return HAL_ERROR;
}
//
// /* Check the parameters */
assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
assert_param(IS_ADC_CLOCKPRESCALER(hadc->Init.ClockPrescaler));
assert_param(IS_ADC_RESOLUTION(hadc->Init.Resolution));
assert_param(IS_FUNCTIONAL_STATE(hadc->Init.ScanConvMode));
assert_param(IS_FUNCTIONAL_STATE(hadc->Init.ContinuousConvMode));
assert_param(IS_ADC_EXT_TRIG(hadc->Init.ExternalTrigConv));
assert_param(IS_ADC_DATA_ALIGN(hadc->Init.DataAlign));
assert_param(IS_ADC_REGULAR_LENGTH(hadc->Init.NbrOfConversion));
assert_param(IS_FUNCTIONAL_STATE(hadc->Init.DMAContinuousRequests));
assert_param(IS_ADC_EOCSelection(hadc->Init.EOCSelection));
assert_param(IS_FUNCTIONAL_STATE(hadc->Init.DiscontinuousConvMode));
//
if(hadc->Init.ExternalTrigConv != ADC_SOFTWARE_START)
{
assert_param(IS_ADC_EXT_TRIG_EDGE(hadc->Init.ExternalTrigConvEdge));
}
//
if(hadc->State == HAL_ADC_STATE_RESET)
{
// /* Initialize ADC error code */
ADC_CLEAR_ERRORCODE(hadc);
//
// /* Allocate lock resource and initialize it */
hadc->Lock = HAL_UNLOCKED; //THIS IS THE FAILURE POINT!!!!!!!!!!!!
//
// /* Init the low level hardware */
// HAL_ADC_MspInit(hadc);
}
//
// /* Configuration of ADC parameters if previous preliminary actions are */
// /* correctly completed. */
// if (HAL_IS_BIT_CLR(hadc->State, HAL_ADC_STATE_ERROR_INTERNAL))
// {
// /* Set ADC state */
// ADC_STATE_CLR_SET(hadc->State,
// HAL_ADC_STATE_REG_BUSY | HAL_ADC_STATE_INJ_BUSY,
// HAL_ADC_STATE_BUSY_INTERNAL);
//
// /* Set ADC parameters */
// ADC_Init(hadc);
//
// /* Set ADC error code to none */
// ADC_CLEAR_ERRORCODE(hadc);
//
// /* Set the ADC state */
// ADC_STATE_CLR_SET(hadc->State,
// HAL_ADC_STATE_BUSY_INTERNAL,
// HAL_ADC_STATE_READY);
// }
// else
// {
// tmp_hal_status = HAL_ERROR;
// }
//
// /* Release Lock */
// __HAL_UNLOCK(hadc);
/* Return function status */
return tmp_hal_status;
}
2019-11-27 04:25 PM
> overcommitted content in [0x802'0000-0x803'ffff]"
So, is the program just growing more than 128K?
-- pa
2019-11-27 10:49 PM
I agree - ssupposedly your code size grew beyond Flash size.
Check the linker map file, to see which objects seize that much space.
2019-11-28 10:37 AM
AMap - a nice tool to look at *.map files.
2019-11-28 11:37 AM
Atollic and Cube IDE have a similar tool, the Build Analyzer.
Open it after successful build. For best results, check "generate list file" in post-build outputs.
-- pa