PDA

View Full Version : How to recompile Calendar.nrx?



nuukiaworld
19-02-2006, 09:07 PM
I tried to recompile the official calendar.nrx from the script sources package but the resulting script does not work; it crashes the phone immediately when starting the app.

Comparing the nrx files shows that the original code uses _call_via_r3 function but the recompiled one does not. What is the reason for this? Do I have an incorrect setting in my SDK installation (or is this a beta feature)?
***** calendar.nrx
if symbol("own_get_font")~="VAR" then own_get_font=locate("own_get_font")
if symbol("_call_via_r3")~="VAR" then _call_via_r3=locate("_call_via_r3")
if symbol("ntoa2")~="VAR" then ntoa2=locate("ntoa2")
***** ..\OMAT\CALENDAR\CALENDAR.NRX
if symbol("own_get_font")~="VAR" then own_get_font=locate("own_get_font")
if symbol("ntoa2")~="VAR" then ntoa2=locate("ntoa2")
*****

***** calendar.nrx
setbl __calendar_o_1__+606 own_get_font
setbl __calendar_o_1__+636 _call_via_r3
setbl __calendar_o_1__+734 __calendar_o_1__+136
***** ..\OMAT\CALENDAR\CALENDAR.NRX
setbl __calendar_o_1__+606 own_get_font
setbl __calendar_o_1__+636 __calendar_o_1__+2124
setbl __calendar_o_1__+734 __calendar_o_1__+136
*****

***** calendar.nrx
setbl __calendar_o_1__+770 __calendar_o_1__
setbl __calendar_o_1__+788 _call_via_r3
setbl __calendar_o_1__+806 __calendar_o_1__
***** ..\OMAT\CALENDAR\CALENDAR.NRX
setbl __calendar_o_1__+770 __calendar_o_1__
setbl __calendar_o_1__+788 __calendar_o_1__+2124
setbl __calendar_o_1__+806 __calendar_o_1__
*****

***** calendar.nrx
setbl __calendar_o_1__+1086 own_draw_box
setbl __calendar_o_1__+1140 _call_via_r3
setbl __calendar_o_1__+1146 freegfx_end
***** ..\OMAT\CALENDAR\CALENDAR.NRX
setbl __calendar_o_1__+1086 own_draw_box
setbl __calendar_o_1__+1140 __calendar_o_1__+2124
setbl __calendar_o_1__+1146 freegfx_end
*****

joci2000
19-02-2006, 10:52 PM
Hi I've just now tried this and it's worked for me.

it said for me: make: Nothing to be done for `all'. So it worked, and doesn't change anything.

First i opened project from ..\sources\.core\applications\calendar\calendar.vhw

after i pressed F5 and simply doesn't change anything. previous time you had problem with antivirus software. may be this time also :roll:

nuukiaworld
20-02-2006, 07:52 AM
make: Nothing to be done for `all'.Yes, but 'make' checks only the timestamps of the object files, so in this case it actually does nothing because the directory contains also the up-to-date object files.

However, if you modify something in all C files so that the files will be really recompiled -- or simply select 'Build' to force complete recompiling --, the resulting nrx is different than the one included in the scripts package. :-?

McAfee has been killed since then, so this time it should not be the problem... :rolleyes: I guess that I have a simple config problem in my SDK...

Edit: I'll compare the my compiler settings with the settings included in asm files found in the distribution this evening. May be I found a simple reason for the issue. Hold on...

joci2000
20-02-2006, 08:03 AM
I checked it again with a little modification( i modified some lines in calendar.c, and now it runs well again with no problem.

nuukiaworld
20-02-2006, 05:44 PM
No, recompiled one still it does not work (on 6110, integrated with Nokia calendar). The phone resets immediately when selecting the calendar in the main menu. -- It is possible that recompiled one works on other types of phones (i.e. those teenager phones without built-in calendar).

I noticed that the compiler provided in SDK V2 is different than the one used to compile the scripts package. However, I cannot understand if it is the reason for the problems. See beginning of fc of calendar.s files (first is the original, second is the recompiled):
Comparing files calendar.s and ..\..\..\..\OMAT\CALENDAR\CALENDAR.S
***** calendar.s
.file "calendar.c"
@ GNU C version 4.0.2 (arm-thumb-elf)
@ compiled by GNU C version 3.4.4 (cygming special) (gdc 0.12, using dmd 0
.125).
@ GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32702
@ options passed: -fpreprocessed -mthumb -mbig-endian -mcpu=arm7tdmi
***** ..\..\..\..\OMAT\CALENDAR\CALENDAR.S
.file "calendar.c"
@ GNU C version 4.0.2 (arm-elf)
@ compiled by GNU C version 3.4.2 (mingw-special).
@ GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=65470
@ options passed: -fpreprocessed -mthumb -mbig-endian -mcpu=arm7tdmi
*****

***** calendar.s
mov r2, #0 @,
bl _call_via_r3 @ temp.98
.L81:
***** ..\..\..\..\OMAT\CALENDAR\CALENDAR.S
mov r2, #0 @,
bl .L135 @
.L81:
*****The original build uses _call_via_r3 and my build uses .L135, and they are really different:

_call_via_r3: (library function used by the original build)
push { r0 }
mov r0, #1
orr r3, r0
pop { r0 }
bx r0, r3

.L135: (local function used by the rebuilt code)
bx r3Why the recompiled one does not use the _call_via_r3? Trying to match the complier settings did not help. :cry:

joci2000
20-02-2006, 07:12 PM
Does the original calendar script work on your 6110? it should.

So you try to modificate the calendar script but it cannot be compiled correctly.

i can make a try with your new calendar c (if you send it to me :roll: ) if you want and after we can compare the results. and we will know (may be) what is the problem with it.

I haven't changed anything in vham. So it is with original settings.

nuukiaworld
20-02-2006, 08:56 PM
Does the original calendar script work on your 6110? it should. So you try to modificate the calendar script but it cannot be compiled correctly.Yes, the original works without any problems (but only if I don't recompile it). -- Actually I haven't done any modifications yet, I am just trying to recompile it without any changes (to make sure that I can recompile it, before modding).

The contents of the my calendar folder after rebuiling of my computer is attached below. Could you send your folder contents after rebuilding, or could you compare yours to this?

joci2000
20-02-2006, 10:23 PM
okay i found it.

it almost similar to yours it remove call_via_r3 function :(

so may be Yak forgot to update it :roll:

yak
21-02-2006, 12:37 AM
Before the SDK V2 was available I've used some 3.x.x version of GCC which generated _call_via_rx calls when some function had to be called by a function pointer.

In SDK V2 I decided to use newest GCC 4.0.2. After some tests I've found out that it doesn't use _call_via_rx anymore.

The basic problem was that NokiX's pointers to functions are not ARM compilant. In ARM, even pointers (with bit 0 cleared) point to 32bit ARM functions and odd pointers (with bit 0 set) point to 16bit THUMB functions (most common in Nokia FW). In NokiX we use simple even pointers to 16bit THUMB functions.

The effect of this was that functions pointers passed to _call_via_rx were always even and the called function was always THUMB. So, _call_via_rx simply set the bit 0 and everything worked (beacause we don't use 32bit mode at all).

Now (in GCC 4.0.2), when no _call_via_rx was used (but a simple BX instruction) the processor jumped to THUMB function but switched to ARM mode and most commonly hanged.

So, the GCC included in my SDK V2 is modified. The modification is simple, it creates calls to _call_via_rx like the 3.x.x version did.

So, maybe somehow you got the unmodified version of GCC. Or this is some PATH problem.

Regards
[Yak]

PS: The gcc version distributed in SDK is the same as used for scripts compilation, checked it a minute ago. The generated assembly file begins with:

@ GNU C version 4.0.2 (arm-thumb-elf)
@ compiled by GNU C version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125).

nuukiaworld
21-02-2006, 08:32 AM
The gcc version distributed in SDK is the same as used for scripts compilation, checked it a minute ago. The generated assembly file begins with:

@ GNU C version 4.0.2 (arm-thumb-elf)
@ compiled by GNU C version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125).I just a minute ago redownloaded the SDK package from the NokiX site onto another computer completely clean of NokiX, and the calendar.c compilation result is the same: no _call_via_rx calls.

File search does not found any occurences of "cygming special" in the SDK package, instead of it, texts "mingw-special" and "3.4.2" is found in CC1.EXE (and these wrong texts occur in the assembly file headers in my compilations instead of "3.4.4 (cygming special)", too). Strange... :-?

I am ashamed of being this kind of helpless idiot... :(

yak
21-02-2006, 06:37 PM
I'M SORRY!!!

nuukiaworld, I've just checked it also on another computer and it seems that there is a wrong cc1.exe in the SDK! And my SDK on my PC seems to call the one I have in my cygwin installation where I've compiled the GCC :(.

This means that even if I put the correct one there, there will still be a danger, that wron one will be called if someone has a cygwin with GCC for arm target installed on the system.

Maybe someone know how does the GCC search for cc1.exe?

Regards
[Yak]

PS: nuukiaworld, you are in no way a "helpless idiot"!!! How dare you say that? :D

nuukiaworld
21-02-2006, 10:05 PM
@yak: "Helpless" in sense of these cygwin things, so I cannot help in these path problems in GCC... :-( We all have been lucky that function pointers are not used very often, that's why everybody have used SDK V2 so far without any visible problems.

Calendar.c has only three calls through function pointers, so I am able to fix them manually in the linked nrx.

Week numbers are used in my work every day, and browsing them with my phone is an excellent feature. However, Calendar's current version lacked possibility use the ISO 8601 week numbering. So, now I have fixed this for myself... :D

This modded version adds setting "First week of year: Starts Jan 1 / First 4-day wk. / First full week". So by selecting "First day of week: Monday" and "First week of year: First 4-day wk." you will have an ISO 8601 compliant calendar with you in every meeting! 8) Thanks Yak!

yak
21-02-2006, 10:55 PM
Great! I wanted to add this feature but always when I got to my PC, the number of things I had to do didn't allowed me to do it :\.

Right now I'm recompiling the GCC with a bit changed compile options. I've also changed the version string from "4.0.2" to "4.0.2 (NokiX)" so we will be able to recognise the modified version by it. When it is done I will upload a fix to my site.

-- ADDED --

OK, the SDK (GCC) update is available for download. The gnu-as (assembler) was also updated from version 2.16 to 2.16.1.

http://nokix.pasjagsm.pl/download/NokiX_sdk_update1.zip (5.5MB)

I'm not releasing the updated full package beacause soon there will be a new version of SDK with new VisualHAM 2.6 which is being developed by me right now.

nuukiaworld
22-02-2006, 07:56 AM
Thanks for the update, I'll try it out in the evening. :) It was rather frustrating to edit the linked object in the nrx...

I'll also noticed a leap year problem in my calendar above, it shows wrong week number e.g. on week 53/2008 if week start is Sunday and 4-day first week is used. Fixing it will be a good test for the fixed SDK.

Edit:
The new SDK works well... and here is the calendar with fixed week numbers. It also displays the current day on the second row in the beginning (and after pressing #). This helps seeing the relative position of current day, e.g. compared to the previous week.

yak
23-02-2006, 10:29 PM
Ok, I will take a look. It will probably be included as official script.

-- ADDED --

Yep, I've added Polish strings and I'll release this version as official soon. Thanks again m8 for contributing.

nuukiaworld
28-03-2006, 10:20 AM
At least my NSE-3 patched with calendar.nrx suffers from the following:

Canceling the Subject dialog in Make note/Remider leaves the alphanumeric input mode on. As the result, the number keys in the calendar view do not work correctly anymore.

I don't have an unpatched phone currently available so I don't know if this happens with the unpatched Nokia calendar, too.

LoMaster
28-03-2006, 01:43 PM
2 nuukiaworld

There is no such problem on my 3310 (if I understood the problem correctly). Here is what I do:

"Make a note" -> got to "Remind about" dialog -> either input somethind or not -> exit to previous menu by pressing "C" -> exit to main calendar screen by pressing "C" -> numeric keys work (2, 4, 6, 8 navigate, 5 shows current day's note(s) ).

nuukiaworld
28-03-2006, 02:32 PM
I think that that on 6110 calendar.nrx uses different patching scheme that 3310. On 6110 the patching mode is "Calendar was integrated with Nokia Calendar function". I believe that this problem occurs only when calendar.nrx is used in this particular mode.

The way to reproduce the problem is: (calendar view on display) - [Options] - "Make note" - [Select] - "Reminder" - [OK] - (Subject dialog displayed) - [Back] - (returned directly back to the calendar view). After this, pressing e.g. 8 does not move the cursor in the calendar but returns the phone to standby mode with letter "T" entered as the phone number.

(It is a minor issue indeed, and I am not going to dig into the code to see where the problem is – in Nokia's calendar code or in calendar.nrx. :roll: )