This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

7.06a Code packing problems

I use Version 7.06a (downloaded today) and have problems with linker code packing. At Otpimize level 8 and above some code is missing at execution.

void Tasks_GetConfig(OBJ_TASKS this)
{
	U1 idata nLoop;

#ifdef WIN32
	// first set class type and index to identify the object
	this->nClassID	= CLSID_TASKS;
#endif

	// the next entry is the number of tasks (2 bytes)
	vm_BytecodeToNumber(&this->Count, sizeof(this->Count));

	// allocate buffer for tasks
	this->Item = Heap_calloc(RuntimeEnv.heapStatic, sizeof(this->Item[0]), this->Count);

	// loop over all Tasks
	for (nLoop = 0; nLoop < this->Count; nLoop++)
		Task_GetConfig(&this->Item[nLoop]);			// get configuration for the Task
}
In this code-fragment the source-line written in bold letters is not beeing executed (checked with simulator)! Without code packing everything is correct. At optimization level 7 the target is not being created and I get the linker error "jump target out of range".

Any ideas what's going wrong?

Thanks,
Bernhard

  • "Jump target out of range" means that your code exceeded limits set for linker (64K or less if you used device with smaller program code storage)

  • Ok, I understand - but in my case there are 2 reasons why this error shouldn't occur:

    1.)Why does this error only occur if I turn on the code-packing (which should make the resulting code smaller)?

    2.) I have a banked application with 2 64k banks where not even the half is used at the moment - there's enough memory.

    This behaviour is not clear to me :-(
    Bernhard

  • I've seen the "Jump target out of range" error at some stage. I *think* you're only seeing it with code packing turned on because some of the LCALL and LJMP instructions have been replaced with ACALL and AJMP which can only jump within 2k of the source address. I only have a vague memory of seeing this error: I think it was always generated as a result of there being some other error beforehand.

    Stefan