Home > other >  Compile time tip Could not get 12 consecutive bytes in internal RAM for area OSEG
Compile time tip Could not get 12 consecutive bytes in internal RAM for area OSEG

Time:09-20

To describe the environment:
Single-chip microcomputer is used STC15W4K56S
Development environment using the CodeBlock + SDCC

Engineering used in the tiniux RTOS
Implementation of the function is through the PWM dimming light fault effect

Before because I have been engaged in the upper layer application software development, contact with embedded development soon, appear this kind of problem is Google a lot of information, has yet to solve the problem,
Not sure now is limited hardware resources, lead to can't achieve very low possibility (feel)
Poor posture or programming (no embedded foundation, higher probability)
Tell a great god, genuflect is begged Teamviewer QQ TIM BBS guidance are available,

Points without enough thought to add I drink two cups of Starbucks VX please god

Attention to the position of the comments posted code
 

Void FLRandomFlashing ()
{
FLRandomFlashingParm_t __xdata p;
FLRandomFlashingParm_t __xdata * __xdata parm=& amp; p;

PWM_Config (convertPin (parm - & gt; Pin));
PWM_Set (convertPin (parm - & gt; Pin), the parm - & gt; StartPWM);

Srand (TL0);
U32 durationCounter=0;
Under-16 PWM=the parm - & gt; StartPWM;
Under-16 PWMRange=(parm - & gt; PWMUpperLimit) - (parm - & gt; PWMLowerLimit) + 1;

U32 randomFlashingFragmentDuration;
Under-16 randomPWM;
U32 changeTimes;
Int16_t increment;

While (durationCounter<(parm - & gt; TotalDuration))
{
RandomFlashingFragmentDuration=((u32 rand ())) % (parm - & gt; FlashingFragmentDurationUpperLimit + 1);
DurationCounter +=randomFlashingFragmentDuration;
If (durationCounter>=(parm - & gt; TotalDuration))
{
RandomFlashingFragmentDuration -=durationCounter - (parm - & gt; TotalDuration);
RandomPWM=the parm - & gt; EndPWM;
}
The else
{
RandomPWM=rand () % PWMRange) + (parm - & gt; PWMLowerLimit);
}
ChangeTimes==ceilf (randomFlashingFragmentDuration/10);
Increment=(int16_t) ceilf ((int16_t) (randomPWM - PWM))/(int16_t) changeTimes;

While (1)//you can compile by? !
//for (u32 I=0; i{
PWM +=increment;
If (PWM> 10000)
{
PWM=10000;
}
PWM_Set (convertPin (parm - & gt; Pin), PWM);
OSTaskSleep (OSM2T (10));
}
}
}


Posted. Mem file is as follows:
Internal RAM layout:
0 1 2 3 4 5 6 7 8 9 A B C D E F
0 x00: | | | | | 0 0 0 0 0 | | | 0 0 0 | a | a | a | a | a | a | a | a |
0 x10: | a | a | a | a | d | d | d | d | d | d | d | d | d | d | g | |
0 x20: | | | | | | B B B B B B | | | | | | B B B B B B | | | | | B B B B
0 x30: | | | | | | b b b b b b | | | | | b c c c c | | | | | | c c c c c
0 x40: | | | | c c c c | | | | | c c c c c | e | | | | | | e e e e e e |
0 x50: | | | | | | e e e e e e | | | | | e e e e e | | | | | | e e e e e
0 x60: | | | | | | e e e e e e | e | | | | | | e e e e e e | | | | f f f
0 x70: | | | | | | Q Q Q f f Q | | | | | | I I I I I I | | | | | I I I I
0 x80: | | | | | | I I I I I I | | | | | | I I I I I I | | | | | I I I I
0 x90: | | | | | | I I I I I I | | | | | | I I I I I I | | | | | I I I I
0 xa0: | | | | | | I I I I I I I | | | | | | | I I I I I I I | | | S | I
0 xb0: | S | S | S | S | S | S | S | S | S | S | S | S | S | S | S | S |
0 xc0: | S | S | S | S | S | S | S | S | S | S | S | S | S | S | S | S |
0 xd0: | S | S | S | S | S | S | S | S | S | S | S | S | S | S | S | S |
0 xe0-0xfc: | S | S | S | S | S | S | S | S | S | S | S | S | S | S | S | S |
0 xf0: | S | S | S | S | S | S | S | S | S | S | S | S | S | S | S | S |
0-3: Reg Banks, T: Bit regs, a to z: Data, B: Bits, Q: Overlay, I: iData, S: Stack, a: Absolute

ERROR: Couldn 't get 18 bytes allocated in internal RAM for area OSEG.
Stack starts at: 0 xaf xae (sp set to 0) with 81 bytes available.
The largest spare internal RAM space starts at 0 x1f with 1 byte available.

Other memory:
The Name Start End Size Max
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
PAGED EXT. RAM 0, 256
EXTERNAL RAM x0001 0 0 x0663 1635 3840
ROM/EPROM/FLASH x0000 0 0 x6f80 28545 57344

CodePudding user response:

No one points back to your own

CodePudding user response:

Use super memory
Single-chip computer memory is nervous, be careful when you use the
STC15W4K56S temporarily didn't find information, don't know if it's internal xdata, if any, it is ok to move the part of the data to the xdata
You now also is within the 128 bytes used 18 bytes
  • Related