Create New ROM Segment

Below you can find the memory segment of a LCF. Notice that the segment internal_flash has been edited and its length has been reduced by 0x10000 from its original size. This memory space is taken to create the new segment. In the following listing the new segment is called myrom, it will be located next to segment internal_flash and its length is going to be 0x10000. You can calculate the address where segment code ends by adding its length plus the origin address.

Edit your LCF as shown in the following listing. Ensure you edit ROM target lcf.

Listing 1. Memory Segment of LCF
MEMORY
{

  resetvector:             org = 0x00000000,  len = 0x00000008

  init:			                   org = 0x00000010,  len = 0x0000FFF0

  exception_handlers_p0:   org = 0x00010000,  len = 0x00010000

  internal_flash:          org = 0x00030000,  len = 0x001C0000

  myrom:                   org = 0x00220000,  len = 0x00010000

  internal_ram:            org = 0x40000000,  len = 0x0007C000

  heap  :                  org = 0x4007C000,  len = 0x00002000 /* z7_0 Heap start location */

  stack :                  org = 0x4007E000,  len = 0x00002000 /* z7_0 Start location for 
Stack */

}