Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


You are viewing a reply to Very strange .bss RAM overflow  

Very strange .bss RAM overflow



Hello!

Thanks for the reply, I’ll try to answer as good as possible.

The function HighDensSequentialRead reads on the I2C bus and writes in the char array eecpy. I’m sending the pointer to that function.

#define AdrGradScale 0x08
void HighDensSequentialRead(unsigned short address, unsigned char* data, unsigned short numbytes)
{
	unsigned char reg_data [] = {  ((unsigned char)((address&0xFF00)>>8)) , ((unsigned char)(address&0xFF)) };

	HAL_I2C_Master_Sequential_Transmit_IT(&hi2c1,EEPROM_ADR,reg_data,2,I2C_FIRST_FRAME); //write(ControlByte)
	while (HAL_I2C_GetState(&hi2c1) != HAL_I2C_STATE_READY);
	HAL_I2C_Master_Sequential_Receive_IT(&hi2c1,EEPROM_ADR,data,numbytes,I2C_FIRST_AND_LAST_FRAME );
	while (HAL_I2C_GetState(&hi2c1) != HAL_I2C_STATE_READY);

	return;
}

void IR_Sensor_Read(void)
{
	unsigned short gradScale;
    unsigned char eecpy[ 8 ] = "";

	HighDensSequentialRead((unsigned short)AdrGradScale,eecpy,sizeof(char)*2);
	gradScale = ((0x00 (double left arrow)  8) | eecpy[0]); 
    return;
}


This seems to be related to something regarding the array, since I can define a float both local and global without any problem.

Shift left (double arrow) will not format in the code parser..?

B.R/

France

Hi,

Which variable do you convert to global and how (and also why, but thta has nothing to do with your .bss overflow...)

Bernard (Ac6)

PS: Regarding the double lower-than sign, the simpler (although not ideal) is to put a space inbetween both lower-than signs.

BTW, gradScale = eecpy[0]; would be largely enough and, by definition, sizeof(char) == 1...

The overflow error occurs when

unsigned short gradScale;

is defined globally, or rather at the top of the file. It’s not per definition defined with the keyword GLOBAL.

I’ve been programming C before and of course I know it’s my blame but I just can’t find out what it is.

France

Hi,

I really don’t understand what can cause this problem. Could you compile your program once with gradScale defined localy and once with it defined globally (with absolutely no other change) and post, in attachments, the two output.map files that are generated in the Debug directory?

Bernard (Ac6)

Sorry, should have replied instead of writing a new post... Don’t know if you get a notification on that.

Hello!

So much has happened the last days, I had to go back a long way in the repository. A good thing with your inputs gave was that I think that I know the solution to the problem.

When the linker fails and put out overflow by Jesus Christ many bytes I have many other defined global variables in the file, but they are unused (I’m porting generic code given by the supplier). To me with my limited C knowledge I never thought that the compiler would allocate the memory for them also as soon as I moved one used global variable there. If I comment out all other globals it works.
To be clear here, the other unused globals are still there when I declare gradScale local but then it works and the compiler doesn’t allocate memory for them.
Still strange though...

I’ll attach both .c files (heavily commented) and the linker map files both for working and non-working scenarios.