Trouble porting HCS08 project from Classic CodeWarrior to CodeWarrior for Microcontroller V10.6

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Trouble porting HCS08 project from Classic CodeWarrior to CodeWarrior for Microcontroller V10.6

764件の閲覧回数
greglapin
Contributor I

I ported a project using an MC9S08GT60A processor from CodeWarrior V6.3 to CodeWarrior V10.6

I followed the guidance in AN4727 and my new project compiled with the same 3 warnings and 2 infos as the old.

The converted project mostly runs the same as the one built with the classic tools, with one major difference:

I am trying to allocate 49 bytes of space in the RAM during runtime.  The malloc() call in the new project returns a pointer to address 0x6374, in the flash memory space (in the old project it worked perfectly well). 

The memory maps from both projects are relatively similar, with the .bss, .common, HEAP_SEGMENT, and .stack in similar locations, all in the RAM space (0x100 to 0x1069).

Is there a setting that I missed in the new project that tells malloc() where to allocate space?

Thanks,

Greg

ラベル(1)
0 件の賞賛
返信
2 返答(返信)

604件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Greg,

you didn't mention what exact warning and info message, so I can't say if your problem is because of heap allocation.

anyway, The heap is defined in the library file alloc. c, and the size of the heap is specified in libdefs. h by the LIBDEF_HEAPSIZE define. The default size is 2000, but you can modify it as needed.

how to:

  1. open the lib project in the folder: \lib\hc12c\hc12_lib.mcp
  2. open the heap.c file and the libdefs.h,
  3. in the libdefs.h file change the value of LIBDEF_HEAPSIZE (line 193).
  4. Rebuild the libraries

Now with the lib you can use the malloc function for your application.

Refer to the heap.c file. All heap is allocated in the HEAP_SEGMENT with a pragma.

So if you want you can place exactly where you want the heap.

Else it will be placed in the DEFAUFT_RAM.

Be careful it will work only after you rebuild the lib.

hope this helps!

Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

604件の閲覧回数
greglapin
Contributor I

Thank you for your reply, Jennie.

There were no errors or additional warnings or info statements that affected the heap (there were the same 3 warnings and 2 info statements in both the Codewarrior 6.3 build and the CWMCU 10.6 build, none of which were related to the heap).

If I ran out of heap space, I would expect the malloc() call to return a NULL pointer.  It did not.  It returned an actual address, but that address was not in the RAM, it was in the Flash space.

0 件の賞賛
返信