S12 Out of allocation space in segment RAM BLOCK0 SEG

From MotoHawk
Jump to navigationJump to search

An Out of allocation space in segment RAM BLOCK0 SEG error is issued by the linker when there is insufficient memory to allocate the memory requested by a section. For an S12 this often occurs because too much RAM has been allocated by the application.

So how to fix this?

It could be that the application is simply too big, but if this is not the case then there are a few things to investigate.

Check Stack Allocation

Check how much RAM has been allocated to task stacks by the model. Often this is set too high for an S12. Sometimes this is because the model originally targeted a more powerful target such as an MPC5xxx, which uses a PowerPC based core and requires more stack. The S12 family has very little RAM, but only a few registers. Consequently its execution context is very small when compared to a CPU family like the MPC5xxx. An S12 task may only require 256 bytes of stack where as an MPC5xxx may require a few kBytes of stack.

If there are S12 tasks that have been allocated many kBytes of stack then the linker error may be because too much memory has been allocated to task stack. Try another build after first reducing the stack sizes to 512 bytes.

Ultimately the application is responsible for appropriate stack sizing, but this initial reduction may allow the model to build.

MatLab Optimization - Default parameter behavior

It is possible that MatLab's configuration (CTRL+E) has the Code Generation/Optimization Default parameter behavior set to "tunable". This will result in a large block of memory being allocated in RAM to allow tuning. The S12 can not afford this allocation. Set the configuration to "inline".