Solved! Go to Solution.
You didn't rebuilt the library. Changing LBDEF_xx is not enough. To rebuild the library, you should open library project file and make it. This should rebuild all libraries. To rebuild just ansiis.lib, change target combo box from all libraries to "C no float HCS08", then make.
Default library project file path is this:
"c:\Program Files\Freescale\CodeWarrior for Microcontrollers V6.2\lib\hc08c\hc08_lib.mcp"
Hello Danielito,
The default heap size (2000 Bytes) is probably too big for this MCU. Reduce the heap size (LIBDEF_HEAPSIZE) in libdefs.hand rebuild the library.
Then you shold be able to allocate heap in RAM.
See also this thread.
Stanish
Hi Stanish: I tried without success. I send the file PWM4 where the function insert () in MCUinit.c. The problem occurs when you enable the allocation nuevo=(pNodo)malloc(sizeof (NODETYPE));
any suggestion is welcomeThanks
Danielito,
Seems in your case the problem is caused by the fact you've splitted the RAM into two seqments.
SEGMENTS Z_RAM = READ_WRITE 0x0060 TO 0x00FF; RAM = READ_WRITE 0x0100 TO 0x015F; RAM2 = READ_WRITE 0x0160 TO 0x025F; ... PLACEMENT DEFAULT_RAM INTO RAM; DINAMICA, INTO RAM2;
RAM size -> 96 Bytes
RAM2 size -> 256 Bytes
Since Stack and Heap are both placed into DEFAULT_RAM by default there is not enough space.
According to the .prm file stack size is set to 0x50 = 80 Bytes -> there are remaining 16 bytes for variables + Heap.
I'd suggest you to set bigger "RAM" memory segment plus you can allocate heap into RAM2:
PLACEMENT DEFAULT_RAM INTO RAM; DINAMICA,HEAP_SEGMENT INTO RAM2;
Stanish
Hi Stanish: i do
RAM = READ_WRITE 0x0100 TO 0x024F;RAM2 = READ_WRITE 0x0250 TO 0x025F;
and the problems continue.
whit variable “nuevo” assigned whit malloc() in MCUinit.c
in projec.map appears:
.bss 12 R/W 0x100 0x10B RAM
and the error:
Link Error : L1102: Out of allocation space in segment RAM at address 0x10C
no variable “nuevo”assigned in MCUinit.c:
.bss 8 R/W 0x100 0x107 RAM.common 6 R/W 0x108 0x10D RAM.stack 80 R/W 0x10E 0x15D RAM
and not problems in RAM.
What can i do?
thank you
Danielito,
I've used your project (see .prm below) :
SEGMENTS ... RAM = READ_WRITE 0x0100 TO 0x024F; RAM2 = READ_WRITE 0x0250 TO 0x025F;...PLACEMENT DEFAULT_RAM INTO RAM; DINAMICA INTO RAM2; ... STACKSIZE 0x50
stacksize: 80 Bytes
heap size: 80 Bytes
And I can link the app. without any linker error. See the snippet from the map file below:
*********************************************************************************************SECTION-ALLOCATION SECTIONSection Name Size Type From To Segment---------------------------------------------------------------------------------------------DINAMICA 1 R/W 0x250 0x250 RAM2....bss 12 R/W 0x100 0x10B RAMHEAP_SEGMENT 80 R/W 0x10C 0x15B RAM.common 8 R/W 0x15C 0x163 RAM.stack 80 R/W 0x164 0x1B3 RAM.... nuevo 162 2 2 1 .common
Stanish
Hi Stanish: because I still have problems sending you 3 file: 1) Project(whitout nuevo).map: this file does not assign the variable nuevo within MCUinit.c when I compile with my CW (whitout problems in the segmentation) 2) Project(with nuevo).map: : this file assign the variable nuevo within MCUinit.c when I compile with my CW (with problems in the segmentation) 3) PWM4.mcp whitout the variable nuevo assigned within MCUinit.c and the changes in the file .prm we observe. If you can compiler PWM4 with your compiler and have no problems, them problems may be in the configuration of the heap in the my CW compiler or the problems is in the compiler of CW..., because if you see the file Project(whitout nuevo), errors appears in several sections relating to HEAP.
Danielito,
I don't think it's a compiler issue.
I suspect you haven't rebuilt ansi libraries or didn't modify heap size properly. Your "libbdef.h" and "ansiis.lib" are not included in .zip file so i cannot check it.
But according to "project(with nuevo).map" heap size is still 2000 Bytes.
MODULE: -- HEAP.C.o (ansiis.lib) --- PROCEDURES: _heapcrash_ 0'Error 16 22 0 .text VARIABLES: _heap_ 0'Error 7D0 2000 0 HEAP_SEGMENT
I'd suggest you to double check if LIBDEF_HEAPSIZE (libdefs.h) is reduced to fit S08QG8 RAM (e.g 80 Bytes)
and Rebuild the Libraries project which update all the ansi*.lib (files). In your case you are using "ansiis.lib" so the cration date of this file should change after rebuid.
Follow these instructions to rebuild your library correctly.
Stanish
Hi Stanish: the problem was that I not pressed F7 to rebuild the *. lib hc08_lib.mcp project. Now, I wonder if there is a FAQ of the forum can guide me in the reconstruction or construction of library files from source files.
Thanks for your guidance
Danielito
Hi, Stanish: still not resolved the problems with HEAP. I did several times what you suggested to not avail.
In file libdefh.h:
#define LIBDEF_HEAPSIZE 100
In file Project.map appears:
MODULE: -- HEAP.C.o (ansiis.lib) -- - PROCEDURES: _heapcrash_ 0'Error 16 22 0 .text - VARIABLES: _heap_ 0'Error 7D0 2000 0 HEAP_SEGMENT
I send attached:1)project.map (this update at 18-10-09) 2)ansiis.lib (this file not update. I can not open. CW´s message is: Codewarrior cannot open files of this type.) 3)CW screen image.
Where I continue?
Thank you
You didn't rebuilt the library. Changing LBDEF_xx is not enough. To rebuild the library, you should open library project file and make it. This should rebuild all libraries. To rebuild just ansiis.lib, change target combo box from all libraries to "C no float HCS08", then make.
Default library project file path is this:
"c:\Program Files\Freescale\CodeWarrior for Microcontrollers V6.2\lib\hc08c\hc08_lib.mcp"
what I needed was to know how a library is rebuilt. Thanks to your messages and reference ppoi (FAQ 3404) succeeded. I wonder now how llibrary was built from a source file.
Thanks Kef and Stanish