nsunier Posted May 4, 2008 Report Share Posted May 4, 2008 I'm currently writing an application based on the example code provided by TK.All was working like a charm until today. Sometimes, when I add some code concerning the LCD display the MIOS_GLCD_FONT seems to be corrupted. The other fonts provided in .\modules\glcd_font directory works well.I've two section in the void DISPLAY_Tick(void) function:display AIN changesdisplay DIN changesHere is my function (the DIN part is still under development):///////////////////////////////////////////////////////////////////////////// // This function is called in the mainloop when no temporary message is shown // on screen. Print the realtime messages here ///////////////////////////////////////////////////////////////////////////// void DISPLAY_Tick(void) __wparam { // do nothing if no update has been requested if( !app_flags.DISPLAY_UPDATE_REQ ) return; // clear request app_flags.DISPLAY_UPDATE_REQ = 0; switch (last_ain_func) // pot related display update { case 1: // current pot = submaster // print pot name MIOS_GLCD_FontInit(GLCD_FONT_BIG); MIOS_GLCD_GCursorSet(16,0); MIOS_LCD_PrintCString(pot_name[last_ain_pin]); // print pot value MIOS_GLCD_GCursorSet(16,4); MIOS_LCD_PrintBCD3(cur_pot_values[pot_event_map[last_ain_pin][0]]); // print pot meter value MIOS_GLCD_FontInit(GLCD_FONT_METER_ICONS_V_BIG); MIOS_GLCD_GCursorSet(0,0); MIOS_LCD_PrintChar(pot_meter[cur_pot_values[pot_event_map[last_ain_pin][0]]][0]); // set LED if (cur_pot_values[pot_event_map[last_ain_pin][0]]>1) MIOS_DOUT_PinSet(led_map[pot_event_map[last_ain_pin][0]][0], 0x01); else MIOS_DOUT_PinSet(led_map[pot_event_map[last_ain_pin][0]][0], 0x00); break; case 2: // current pot = grandmaster // print pot name MIOS_GLCD_FontInit(GLCD_FONT_BIG); MIOS_GLCD_GCursorSet(16,0); MIOS_LCD_PrintCString(pot_name[last_ain_pin]); // print pot value MIOS_GLCD_GCursorSet(16,4); MIOS_LCD_PrintBCD3(cur_pot_values[pot_event_map[last_ain_pin][0]]); // print pot meter value MIOS_GLCD_FontInit(GLCD_FONT_METER_ICONS_V_BIG); MIOS_GLCD_GCursorSet(0,0); MIOS_LCD_PrintChar(pot_meter[cur_pot_values[pot_event_map[last_ain_pin][0]]][0]); // set LED if (cur_pot_values[pot_event_map[last_ain_pin][0]]>1) MIOS_DOUT_PinSet(led_map[91][0], 0x01); else MIOS_DOUT_PinSet(led_map[91][0], 0x00); break; default: break; } last_ain_func=0; switch (last_din_func) // buton related display update { case 1: // current button = flash // print pot name MIOS_GLCD_FontInit(GLCD_FONT_BIG); MIOS_GLCD_GCursorSet(16,0); MIOS_LCD_PrintCString(but_name[last_din_pin][0]); break; default: break; } last_din_func=0; } The big arrays (like pot_event_map, ...) are defined inside Flash memory: const unsigned char pot_event_map[64][4] = { // {real channel, function, MIDI message, MIDI number} // // function: 0 - no action // 1 - submaster // 2 - grandmaster // // MIDI message: 0xb0 - control change // // Base Control defined in BL MIDI Control is equal to 70 (-> 70+...) // { 0, 1, 0xb0, 70+ 0}, // Submaster 1 { 1, 1, 0xb0, 70+ 1}, // Submaster 2 { 2, 1, 0xb0, 70+ 2}, // Submaster 3 { 3, 1, 0xb0, 70+ 3}, // Submaster 4 { 4, 1, 0xb0, 70+ 4}, // Submaster 5 { 5, 1, 0xb0, 70+ 5}, // Submaster 6 { 6, 1, 0xb0, 70+ 6}, // Submaster 7 { 7, 1, 0xb0, 70+ 7}, // Submaster 8 { 8, 1, 0xb0, 70+ 8}, // Submaster 9 { 9, 1, 0xb0, 70+ 9}, // Submaster 10 {10, 1, 0xb0, 70+10}, // Submaster 11 {11, 1, 0xb0, 70+11}, // Submaster 12 {12, 1, 0xb0, 70+12}, // Submaster 13 {13, 1, 0xb0, 70+13}, // Submaster 14 {14, 1, 0xb0, 70+14}, // Submaster 15 {15, 1, 0xb0, 70+15}, // Submaster 16 {24, 0, 0xb0, 70+ 0}, // {25, 0, 0xb0, 70+ 0}, // {26, 0, 0xb0, 70+ 0}, // {27, 0, 0xb0, 70+ 0}, // {28, 0, 0xb0, 70+ 0}, // {29, 0, 0xb0, 70+ 0}, // {30, 0, 0xb0, 70+ 0}, // {31, 0, 0xb0, 70+ 0}, // {32, 0, 0xb0, 70+ 0}, // {33, 0, 0xb0, 70+ 0}, // {34, 0, 0xb0, 70+ 0}, // {35, 0, 0xb0, 70+ 0}, // {36, 0, 0xb0, 70+ 0}, // {37, 0, 0xb0, 70+ 0}, // {38, 0, 0xb0, 70+ 0}, // {39, 0, 0xb0, 70+ 0}, // {16, 1, 0xb0, 70+16}, // Submaster 17 {17, 1, 0xb0, 70+17}, // Submaster 18 {18, 1, 0xb0, 70+18}, // Submaster 19 {19, 1, 0xb0, 70+19}, // Submaster 20 {20, 1, 0xb0, 70+20}, // Submaster 21 {21, 1, 0xb0, 70+21}, // Submaster 22 {22, 1, 0xb0, 70+22}, // Submaster 23 {23, 1, 0xb0, 70+23}, // Submaster 24 {40, 0, 0xb0, 70+ 0}, // {41, 0, 0xb0, 70+ 0}, // {42, 0, 0xb0, 70+ 0}, // {43, 0, 0xb0, 70+ 0}, // {44, 0, 0xb0, 70+ 0}, // {45, 0, 0xb0, 70+ 0}, // {46, 0, 0xb0, 70+ 0}, // {47, 0, 0xb0, 70+ 0}, // {48, 0, 0xb0, 70+ 0}, // {49, 0, 0xb0, 70+ 0}, // {50, 0, 0xb0, 70+ 0}, // {51, 0, 0xb0, 70+ 0}, // {52, 2, 0xb0, 70+24}, // Grand Master {53, 0, 0xb0, 70+ 0}, // not connected {54, 0, 0xb0, 70+ 0}, // not connected {55, 0, 0xb0, 70+ 0}, // not connected {56, 0, 0xb0, 70+ 0}, // not connected {57, 0, 0xb0, 70+ 0}, // not connected {58, 0, 0xb0, 70+ 0}, // not connected {59, 0, 0xb0, 70+ 0}, // not connected {60, 0, 0xb0, 70+ 0}, // not connected {61, 0, 0xb0, 70+ 0}, // not connected {62, 0, 0xb0, 70+ 0}, // not connected {63, 0, 0xb0, 70+ 0}, // not connected }; const unsigned char pot_name[64][8] = { // 7 caracters + '0' = 8 "Sub. 1", // Submaster 1 "Sub. 2", // Submaster 2 "Sub. 3", // Submaster 3 "Sub. 4", // Submaster 4 "Sub. 5", // Submaster 5 "Sub. 6", // Submaster 6 "Sub. 7", // Submaster 7 "Sub. 8", // Submaster 8 "Sub. 9", // Submaster 9 "Sub. 10", // Submaster 10 "Sub. 11", // Submaster 11 "Sub. 12", // Submaster 12 "Sub. 13", // Submaster 13 "Sub. 14", // Submaster 14 "Sub. 15", // Submaster 15 "Sub. 16", // Submaster 16 " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // "Sub. 17", // Submaster 17 "Sub. 18", // Submaster 18 "Sub. 19", // Submaster 19 "Sub. 20", // Submaster 20 "Sub. 21", // Submaster 21 "Sub. 22", // Submaster 22 "Sub. 23", // Submaster 23 "Sub. 24", // Submaster 24 " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // " ", // "GMaster", // Grand Master " ", // not connected " ", // not connected " ", // not connected " ", // not connected " ", // not connected " ", // not connected " ", // not connected " ", // not connected " ", // not connected " ", // not connected " ", // not connected }; const unsigned char but_event_map[96][5] = { // {real channel, function, MIDI message, MIDI number, MIDI value} // // function: 0 - no action // 1 - flash // 2 - recall preset // 3 - read and send all pot state // 4 - add/kill // // MIDI message: 0xb0 - control change // 0xc0 - program (patch) change // // Base Control defined in BL MIDI Control is equal to 70 (-> 70+...) // {0, 1, 0xb0, 70+ 0, 0x7f}, // Flash 1 {1, 1, 0xb0, 70+ 1, 0x7f}, // Flash 2 {2, 1, 0xb0, 70+ 2, 0x7f}, // Flash 3 {3, 1, 0xb0, 70+ 3, 0x7f}, // Flash 4 {4, 1, 0xb0, 70+ 4, 0x7f}, // Flash 5 {5, 1, 0xb0, 70+ 5, 0x7f}, // Flash 6 {6, 1, 0xb0, 70+ 6, 0x7f}, // Flash 7 {7, 1, 0xb0, 70+ 7, 0x7f}, // Flash 8 {9, 1, 0xb0, 70+ 9, 0x7f}, // Flash 10 {8, 1, 0xb0, 70+ 8, 0x7f}, // Flash 9 {11, 1, 0xb0, 70+11, 0x7f}, // Flash 12 {10, 1, 0xb0, 70+10, 0x7f}, // Flash 11 {13, 1, 0xb0, 70+13, 0x7f}, // Flash 14 {12, 1, 0xb0, 70+12, 0x7f}, // Flash 13 {15, 1, 0xb0, 70+15, 0x7f}, // Flash 16 {14, 1, 0xb0, 70+14, 0x7f}, // Flash 15 {24, 2, 0xc0, 0, 0}, // Recall preset 1 {25, 2, 0xc0, 1, 0}, // Recall preset 2 {26, 2, 0xc0, 2, 0}, // Recall preset 3 {27, 2, 0xc0, 3, 0}, // Recall preset 4 {28, 2, 0xc0, 4, 0}, // Recall preset 5 {29, 2, 0xc0, 5, 0}, // Recall preset 6 {30, 2, 0xc0, 6, 0}, // Recall preset 7 {31, 2, 0xc0, 7, 0}, // Recall preset 8 {33, 2, 0xc0, 9, 0}, // Recall preset 10 {32, 2, 0xc0, 8, 0}, // Recall preset 9 {35, 2, 0xc0, 11, 0}, // Recall preset 12 {34, 2, 0xc0, 10, 0}, // Recall preset 11 {37, 2, 0xc0, 13, 0}, // Recall preset 14 {36, 2, 0xc0, 12, 0}, // Recall preset 13 {39, 2, 0xc0, 15, 0}, // Recall preset 16 {38, 2, 0xc0, 14, 0}, // Recall preset 15 {17, 1, 0xb0, 70+17, 0x7f}, // Flash 18 {16, 1, 0xb0, 70+16, 0x7f}, // Flash 17 {19, 1, 0xb0, 70+19, 0x7f}, // Flash 20 {18, 1, 0xb0, 70+18, 0x7f}, // Flash 19 {41, 2, 0xc0, 17, 0}, // Recall preset 18 {40, 2, 0xc0, 16, 0}, // Recall preset 17 {43, 2, 0xc0, 19, 0}, // Recall preset 20 {42, 2, 0xc0, 18, 0}, // Recall preset 19 {50, 0, 0xb0, 0, 0}, // {49, 0, 0xb0, 0, 0}, // {52, 0, 0xb0, 0, 0}, // {51, 0, 0xb0, 0, 0}, // {58, 0, 0xb0, 0, 0}, // {59, 0, 0xb0, 0, 0}, // {60, 0, 0xb0, 0, 0}, // {57, 4, 0xb0, 0, 0}, // Add / kill (solo) {65, 0, 0xb0, 0, 0}, // {64, 0, 0xb0, 0, 0}, // {67, 0, 0xb0, 0, 0}, // {66, 0, 0xb0, 0, 0}, // {69, 0, 0xb0, 0, 0}, // not connected {48, 3, 0xb0, 0, 0}, // Read and send all pot state {70, 0, 0xb0, 0, 0}, // not connected {71, 0, 0xb0, 0, 0}, // not connected {72, 0, 0xb0, 0, 0}, // not connected {73, 0, 0xb0, 0, 0}, // not connected {74, 0, 0xb0, 0, 0}, // not connected {75, 0, 0xb0, 0, 0}, // not connected {76, 0, 0xb0, 0, 0}, // not connected {77, 0, 0xb0, 0, 0}, // not connected {78, 0, 0xb0, 0, 0}, // not connected {79, 0, 0xb0, 0, 0}, // not connected {21, 1, 0xb0, 70+21, 0x7f}, // Flash 22 {20, 1, 0xb0, 70+20, 0x7f}, // Flash 21 {23, 1, 0xb0, 70+23, 0x7f}, // Flash 24 {22, 1, 0xb0, 70+22, 0x7f}, // Flash 23 {45, 2, 0xc0, 21, 0}, // Recall preset 22 {44, 2, 0xc0, 20, 0}, // Recall preset 21 {47, 2, 0xc0, 23, 0}, // Recall preset 24 {46, 2, 0xc0, 22, 0}, // Recall preset 23 {54, 0, 0xb0, 0, 0}, // {53, 0, 0xb0, 0, 0}, // {56, 0, 0xb0, 0, 0}, // {55, 0, 0xb0, 0, 0}, // {62, 0, 0xb0, 0, 0}, // {61, 0, 0xb0, 0, 0}, // {68, 0, 0xb0, 0, 0}, // {63, 0, 0xb0, 0, 0}, // {80, 0, 0xb0, 0, 0}, // not connected {81, 0, 0xb0, 0, 0}, // not connected {82, 0, 0xb0, 0, 0}, // not connected {83, 0, 0xb0, 0, 0}, // not connected {84, 0, 0xb0, 0, 0}, // not connected {85, 0, 0xb0, 0, 0}, // not connected {86, 0, 0xb0, 0, 0}, // not connected {87, 0, 0xb0, 0, 0}, // not connected {88, 0, 0xb0, 0, 0}, // not connected {89, 0, 0xb0, 0, 0}, // not connected {90, 0, 0xb0, 0, 0}, // not connected {91, 0, 0xb0, 0, 0}, // not connected {92, 0, 0xb0, 0, 0}, // not connected {93, 0, 0xb0, 0, 0}, // not connected {94, 0, 0xb0, 0, 0}, // not connected {95, 0, 0xb0, 0, 0}, // not connected }; const unsigned char but_name[96][2][9] = { // 2 rows of // 8 caracters + '0' = 9 {"Sub. 1 "," "}, // Flash 1 {"Sub. 2 "," "}, // Flash 2 {"Sub. 3 "," "}, // Flash 3 {"Sub. 4 "," "}, // Flash 4 {"Sub. 5 "," "}, // Flash 5 {"Sub. 6 "," "}, // Flash 6 {"Sub. 7 "," "}, // Flash 7 {"Sub. 8 "," "}, // Flash 8 {"Sub. 10 "," "}, // Flash 10 {"Sub. 9 "," "}, // Flash 9 {"Sub. 12 "," "}, // Flash 12 {"Sub. 11 "," "}, // Flash 11 {"Sub. 14 "," "}, // Flash 14 {"Sub. 13 "," "}, // Flash 13 {"Sub. 16 "," "}, // Flash 16 {"Sub. 15 "," "}, // Flash 15 {"Recall ","Preset 1"}, // Recall preset 1 {"Recall ","Preset 2"}, // Recall preset 2 {"Recall ","Preset 3"}, // Recall preset 3 {"Recall ","Preset 4"}, // Recall preset 4 {"Recall ","Preset 5"}, // Recall preset 5 {"Recall ","Preset 6"}, // Recall preset 6 {"Recall ","Preset 7"}, // Recall preset 7 {"Recall ","Preset 8"}, // Recall preset 8 {"Recall ","Preset10"}, // Recall preset 10 {"Recall ","Preset 9"}, // Recall preset 9 {"Recall ","Preset12"}, // Recall preset 12 {"Recall ","Preset11"}, // Recall preset 11 {"Recall ","Preset14"}, // Recall preset 14 {"Recall ","Preset13"}, // Recall preset 13 {"Recall ","Preset16"}, // Recall preset 16 {"Recall ","Preset15"}, // Recall preset 15 {"Sub. 18 "," "}, // Flash 18 {"Sub. 17 "," "}, // Flash 17 {"Sub. 20 "," "}, // Flash 20 {"Sub. 19 "," "}, // Flash 19 {"Recall ","Preset18"}, // Recall preset 18 {"Recall ","Preset17"}, // Recall preset 17 {"Recall ","Preset20"}, // Recall preset 20 {"Recall ","Preset19"}, // Recall preset 19 {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // {"Solo ON ","Solo OFF"}, // Add / kill (solo) {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // not connected {" "," "}, // Read and send all pot state {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {"Sub. 22 "," "}, // Flash 22 {"Sub. 21 "," "}, // Flash 21 {"Sub. 24 "," "}, // Flash 24 {"Sub. 23 "," "}, // Flash 23 {"Recall ","Preset22"}, // Recall preset 22 {"Recall ","Preset21"}, // Recall preset 21 {"Recall ","Preset24"}, // Recall preset 24 {"Recall ","Preset23"}, // Recall preset 23 {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected {" "," "}, // not connected };When I disable the switch(last_ain_func) or switch(last_ain_func) there isn't any problem. But when I enable both it works but it just like if the MIOS_GLCD_FONT was corrupted: the MIOS is rebooting and the © T.K. aren't visible (blank display or erratic characters). All the other parts are still working (other fonts, AIN, DIN, DOUT, MIDI send, ...). I have to reload the MIOS itself in order to get back the display.What could be the problem? Too much code inside this function? (I've tried to put this portion of code inside the void Tick(void) function: same problem). I'm very lost inside this problem. Any idea is welcome.EDITThis problem is not only due to the void DISPLAY_Tick(void) function. When I just add an if statement in the void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) function it produces the same problem.Do you think my code is too big and overwrite the memory area used for the MIOS_GLCD_FONT? I'm using a PIC18F452. How can I verify this?Best regards,nsunier Quote Link to comment Share on other sites More sharing options...
TK. Posted May 4, 2008 Report Share Posted May 4, 2008 Does your code overwrite the area between 0x7c00..0x7fff?Or did this ever happen?Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
nsunier Posted May 4, 2008 Author Report Share Posted May 4, 2008 Sorry ??? How can I verify this? Quote Link to comment Share on other sites More sharing options...
TK. Posted May 4, 2008 Report Share Posted May 4, 2008 MIOS Studio displays the address blocks during code upload. E.g.:[tt]...Sending block 00007500-000075FFReceived Checksum: 24 - OKSending block 00007600-000076FFReceived Checksum: 36 - OKSending block 00007700-000077FFReceived Checksum: 65 - OKSending block 00007800-000078FFReceived Checksum: 49 - OKSending block 00007900-000079FFReceived Checksum: 5E - OKSending block 00007A00-00007AFFReceived Checksum: 2E - OKSending block 00007B00-00007BFFReceived Checksum: 4E - OKSending block 00007C00-00007CFFReceived Checksum: 25 - OKSending block 00007D00-00007DFFReceived Checksum: 14 - OKSending block 00007E00-00007EFFReceived Checksum: 3E - OKSending block 00007F00-00007FFFReceived Checksum: 4D - OK[/tt](red marked text is the code area, which contains the graphical default font)You will also find the allocated addresses in the .lst and .map fileSo, which address range is allocated by your application?Btw.: you can "repair" the graphical default font by uploading MIOS againBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
nsunier Posted May 4, 2008 Author Report Share Posted May 4, 2008 The upload of the working application give me this log:Starting upload of project.hex Sending block 00003000-000030FF Received Checksum: 7B - OK Sending block 00003100-000031FF Received Checksum: 60 - OK Sending block 00003200-000032FF Received Checksum: 40 - OK Sending block 00003300-000033FF Received Checksum: 2F - OK Sending block 00003400-000034FF Received Checksum: 01 - OK Sending block 00003500-000035FF Received Checksum: 33 - OK Sending block 00003600-000036FF Received Checksum: 13 - OK Sending block 00003700-000037FF Received Checksum: 73 - OK Sending block 00003800-000038FF Received Checksum: 52 - OK Sending block 00003900-000039FF Received Checksum: 3A - OK Sending block 00003A00-00003AFF Received Checksum: 65 - OK Sending block 00003B00-00003BFF Received Checksum: 20 - OK Sending block 00003C00-00003CFF Received Checksum: 6D - OK Sending block 00003D00-00003DFF Received Checksum: 32 - OK Sending block 00003E00-00003EFF Received Checksum: 35 - OK Sending block 00003F00-00003FFF Received Checksum: 04 - OK Sending block 00004000-000040FF Received Checksum: 50 - OK Sending block 00004100-000041FF Received Checksum: 70 - OK Sending block 00004200-000042FF Received Checksum: 55 - OK Sending block 00004300-000043FF Received Checksum: 55 - OK Sending block 00004400-000044FF Received Checksum: 71 - OK Sending block 00004500-000045FF Received Checksum: 6B - OK Sending block 00004600-000046FF Received Checksum: 52 - OK Sending block 00004700-000047FF Received Checksum: 11 - OK Sending block 00004800-000048FF Received Checksum: 08 - OK Sending block 00004900-000049FF Received Checksum: 6E - OK Sending block 00004A00-00004AFF Received Checksum: 30 - OK Sending block 00004B00-00004BFF Received Checksum: 21 - OK Sending block 00004C00-00004CFF Received Checksum: 19 - OK Sending block 00004D00-00004DFF Received Checksum: 57 - OK Sending block 00004E00-00004EFF Received Checksum: 04 - OK Sending block 00004F00-00004FFF Received Checksum: 6A - OK Sending block 00005000-000050FF Received Checksum: 3F - OK Sending block 00005100-000051FF Received Checksum: 4D - OK Sending block 00005200-000052FF Received Checksum: 6D - OK Sending block 00005300-000053FF Received Checksum: 4E - OK Sending block 00005400-000054FF Received Checksum: 0B - OK Sending block 00005500-000055FF Received Checksum: 38 - OK Sending block 00005600-000056FF Received Checksum: 1E - OK Sending block 00005700-000057FF Received Checksum: 74 - OK Sending block 00005800-000058FF Received Checksum: 01 - OK Sending block 00005900-000059FF Received Checksum: 0C - OK Sending block 00005A00-00005AFF Received Checksum: 2A - OK Sending block 00005B00-00005BFF Received Checksum: 0A - OK Sending block 00005C00-00005CFF Received Checksum: 1A - OK Sending block 00005D00-00005DFF Received Checksum: 4D - OK Sending block 00005E00-00005EFF Received Checksum: 41 - OK Sending block 00005F00-00005FFF Received Checksum: 63 - OK Sending block 00006000-000060FF Received Checksum: 5D - OK Sending block 00006100-000061FF Received Checksum: 7F - OK Sending block 00006200-000062FF Received Checksum: 47 - OK Sending block 00006300-000063FF Received Checksum: 7A - OK Sending block 00006400-000064FF Received Checksum: 79 - OK Sending block 00006500-000065FF Received Checksum: 5C - OK Sending block 00006600-000066FF Received Checksum: 07 - OK Sending block 00006700-000067FF Received Checksum: 05 - OK Sending block 00006800-000068FF Received Checksum: 74 - OK Sending block 00006900-000069FF Received Checksum: 63 - OK Sending block 00006A00-00006AFF Received Checksum: 3B - OK Sending block 00006B00-00006BFF Received Checksum: 5C - OK Sending block 00006C00-00006CFF Received Checksum: 31 - OK Sending block 00006D00-00006DFF Received Checksum: 04 - OK Sending block 00006E00-00006EFF Received Checksum: 0E - OK Sending block 00006F00-00006FFF Received Checksum: 62 - OK Sending block 00007000-000070FF Received Checksum: 36 - OK Sending block 00007100-000071FF Received Checksum: 70 - OK Sending block 00007200-000072FF Received Checksum: 7D - OK Sending block 00007300-000073FF Received Checksum: 49 - OK Sending block 00007400-000074FF Received Checksum: 1C - OK Sending block 00007500-000075FF Received Checksum: 18 - OK Sending block 00007600-000076FF Received Checksum: 17 - OK Sending block 00007700-000077FF Received Checksum: 1A - OK Sending block 00007800-000078FF Received Checksum: 3F - OK Sending block 00007900-000079FF Received Checksum: 1E - OK Sending block 00007A00-00007AFF Received Checksum: 5F - OK Sending block 00007B00-00007BFF Received Checksum: 6E - OK Upload process complete Upper block address: 00007B00-00007BFF And the not working one (just by adding two simple if statements in the void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) function): Starting upload of project.hex Sending block 00003000-000030FF Received Checksum: 0C - OK Sending block 00003100-000031FF Received Checksum: 60 - OK Sending block 00003200-000032FF Received Checksum: 40 - OK Sending block 00003300-000033FF Received Checksum: 2F - OK Sending block 00003400-000034FF Received Checksum: 01 - OK Sending block 00003500-000035FF Received Checksum: 33 - OK Sending block 00003600-000036FF Received Checksum: 13 - OK Sending block 00003700-000037FF Received Checksum: 73 - OK Sending block 00003800-000038FF Received Checksum: 52 - OK Sending block 00003900-000039FF Received Checksum: 3A - OK Sending block 00003A00-00003AFF Received Checksum: 65 - OK Sending block 00003B00-00003BFF Received Checksum: 20 - OK Sending block 00003C00-00003CFF Received Checksum: 6D - OK Sending block 00003D00-00003DFF Received Checksum: 32 - OK Sending block 00003E00-00003EFF Received Checksum: 35 - OK Sending block 00003F00-00003FFF Received Checksum: 04 - OK Sending block 00004000-000040FF Received Checksum: 50 - OK Sending block 00004100-000041FF Received Checksum: 70 - OK Sending block 00004200-000042FF Received Checksum: 55 - OK Sending block 00004300-000043FF Received Checksum: 55 - OK Sending block 00004400-000044FF Received Checksum: 71 - OK Sending block 00004500-000045FF Received Checksum: 6B - OK Sending block 00004600-000046FF Received Checksum: 52 - OK Sending block 00004700-000047FF Received Checksum: 11 - OK Sending block 00004800-000048FF Received Checksum: 08 - OK Sending block 00004900-000049FF Received Checksum: 6E - OK Sending block 00004A00-00004AFF Received Checksum: 30 - OK Sending block 00004B00-00004BFF Received Checksum: 21 - OK Sending block 00004C00-00004CFF Received Checksum: 19 - OK Sending block 00004D00-00004DFF Received Checksum: 57 - OK Sending block 00004E00-00004EFF Received Checksum: 04 - OK Sending block 00004F00-00004FFF Received Checksum: 6A - OK Sending block 00005000-000050FF Received Checksum: 3F - OK Sending block 00005100-000051FF Received Checksum: 4D - OK Sending block 00005200-000052FF Received Checksum: 6D - OK Sending block 00005300-000053FF Received Checksum: 4E - OK Sending block 00005400-000054FF Received Checksum: 0B - OK Sending block 00005500-000055FF Received Checksum: 38 - OK Sending block 00005600-000056FF Received Checksum: 1E - OK Sending block 00005700-000057FF Received Checksum: 74 - OK Sending block 00005800-000058FF Received Checksum: 01 - OK Sending block 00005900-000059FF Received Checksum: 0C - OK Sending block 00005A00-00005AFF Received Checksum: 2A - OK Sending block 00005B00-00005BFF Received Checksum: 0A - OK Sending block 00005C00-00005CFF Received Checksum: 1A - OK Sending block 00005D00-00005DFF Received Checksum: 4D - OK Sending block 00005E00-00005EFF Received Checksum: 41 - OK Sending block 00005F00-00005FFF Received Checksum: 63 - OK Sending block 00006000-000060FF Received Checksum: 5D - OK Sending block 00006100-000061FF Received Checksum: 7F - OK Sending block 00006200-000062FF Received Checksum: 47 - OK Sending block 00006300-000063FF Received Checksum: 7A - OK Sending block 00006400-000064FF Received Checksum: 79 - OK Sending block 00006500-000065FF Received Checksum: 5C - OK Sending block 00006600-000066FF Received Checksum: 65 - OK Sending block 00006700-000067FF Received Checksum: 7D - OK Sending block 00006800-000068FF Received Checksum: 09 - OK Sending block 00006900-000069FF Received Checksum: 41 - OK Sending block 00006A00-00006AFF Received Checksum: 1B - OK Sending block 00006B00-00006BFF Received Checksum: 25 - OK Sending block 00006C00-00006CFF Received Checksum: 7F - OK Sending block 00006D00-00006DFF Received Checksum: 74 - OK Sending block 00006E00-00006EFF Received Checksum: 6E - OK Sending block 00006F00-00006FFF Received Checksum: 45 - OK Sending block 00007000-000070FF Received Checksum: 5A - OK Sending block 00007100-000071FF Received Checksum: 39 - OK Sending block 00007200-000072FF Received Checksum: 0B - OK Sending block 00007300-000073FF Received Checksum: 4A - OK Sending block 00007400-000074FF Received Checksum: 09 - OK Sending block 00007500-000075FF Received Checksum: 65 - OK Sending block 00007600-000076FF Received Checksum: 5D - OK Sending block 00007700-000077FF Received Checksum: 5C - OK Sending block 00007800-000078FF Received Checksum: 6C - OK Sending block 00007900-000079FF Received Checksum: 57 - OK Sending block 00007A00-00007AFF Received Checksum: 50 - OK Sending block 00007B00-00007BFF Received Checksum: 68 - OK Sending block 00007C00-00007CFF Received Checksum: 42 - OK Upload process completeUpper block address: 00007C00-00007CFFSo it's clearly an overwrite!! What should I do? To change my PIC?I don't understand very well what you told me about .lst and .map files. Should I post them? Which files exactly? main.lst and project.map?Best regards,nsunier Quote Link to comment Share on other sites More sharing options...
TK. Posted May 4, 2008 Report Share Posted May 4, 2008 So it's clearly an overwrite!! What should I do? To change my PIC?If you don't find a way to reduce code size, then yes: just change to a PIC18F4620, it can save you from a lot of additional programming effortI don't understand very well what you told me about .lst and .map files. Should I post them?No - you asked how to verify the allocated memory areas, I proposed three different possibilities to find this out. If the content of main.lst and project.map doesn't make sense to you, then you rely on the output of MIOS StudioBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
nsunier Posted May 5, 2008 Author Report Share Posted May 5, 2008 I've burned a PIC18F4620 with the bootloader v1.2b; loaded the MIOS.I've a problem to recompile my code for the new processor. I've changed in Makefile.orig file the following lines:PROCESSOR = p18f452 -> PROCESSOR = p18f4620OBJS = pic18f452.o mios_wrapper.o app_lcd.o main.o -> OBJS = pic18f4620.o mios_wrapper.o app_lcd.o main.oWhen I do a make I get this message:rm -rf _output/* rm -rf _output rm -rf *.cod *.map *.lst rm -rf *.hex mkdir -p _output sh ./bin/mios-sdcc -c -mpic16 -p18f4620 --fommit-frame-pointer --optimize-goto --optimize-cmp --disa ble-warning 85 --obanksel=2 -pleave-reset-vector -I./src -I ./include/c -I ./modules/glcd_font -DDE BUG_MODE=0 modules/libdev/pic18f4620.c -o _output/pic18f4620.o Processor: 18f4620 '18f4620' was not found. Valid devices are: p18f242 p18f248 p18f252 p18f258 p18f442 p18f448 p18f452 p18f458 p18f1220 p18f2220 p18f2550 p18f4331 p18f4455 p18f6520 p18f6620 p18f6680 p18f6720 p18f8520 p18f8620 p18f8680 p18f8720 make: *** [_output/pic18f4620.o] Error 1In the Makefile.orig file, there is written: LKR_FILE = $(MIOS_PATH)/etc/lkr/$(PROCESSOR).lkrIn the ./etc/lkr/ directory I can only found the p18f452.lkr fileIs there a file missing?Best regards,nsunier Quote Link to comment Share on other sites More sharing options...
stryd_one Posted May 5, 2008 Report Share Posted May 5, 2008 http://svnmios.midibox.org/trunk/etc/lkr/Not sure what you're using as a skeleton? Quote Link to comment Share on other sites More sharing options...
TK. Posted May 5, 2008 Report Share Posted May 5, 2008 It seems, that you are using an older SDCC version (you can verify this with "sdcc --version"The latest release is v2.8.0Yes, and maybe you need to add the p18f4620.lkr file to the etc/lkr directory, if it isn't in there yet (don't remember, if it was in your .zip package)Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
nsunier Posted May 5, 2008 Author Report Share Posted May 5, 2008 I've installed the latest version of SDCC (v2.8.0) instead of the old one (v2.5.0). I've added the p18f4620.lkr file to the etc/lkr directory. And I've succeeded in compiling the code.I can add a little bit of code and it still works. But after adding some extra lines, the MIOS Studio writed this message: "Sending block 00007D00-00007DFF" -> corruption of the display font. I can't understand!! In the Microchip description there is written that PIC18F4620 has twice the memory of the PIC18F452. And I haven't add twice the initial code!?PIC18F452Flash: 32 KbytesRAM: 1,536EEPROM: 256 bytesPIC18F4620Flash: 64 KbytesRAM: 3,968EEPROM: 1024 bytesWhat's going wrong?Best regards,nsunier Quote Link to comment Share on other sites More sharing options...
TK. Posted May 5, 2008 Report Share Posted May 5, 2008 The default default font location is always the same. If your application overwrites this location, the font has to be included into the project, and initialized from there.Underhttp://svnmios.midibox.org/trunk/modules/glcd_font/you will find a new font: GLCD_FONT_NORMALThis is exactly the MIOS font, which you now have to include into your projectIn order to update, download following files and copy them into the modules/glcd_font directory:glcd_font.h, glcd_font.mk, glcd_font_normal.asm, glcd_font_normal.inc, glcd_font_normal.xpmThereafter add "glcd_font_normal.o" to the OBJS variable of your MakefileThereafter initialize this font in Init() with: MIOS_GLCD_FontInit(GLCD_FONT_NORMAL); instead of MIOS_GLCD_FontInit(MIOS_GLCD_FONT); In general, you now always have to use GLCD_FONT_NORMAL instead of MIOS_GLCD_FONT - so, probably you also need to change this at other places in your code.Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
nsunier Posted May 5, 2008 Author Report Share Posted May 5, 2008 Two questions:1.In my code I just have to use GLCD_FONT_NORMAL instead of MIOS_GLCD_FONT. Ok, but what about your message: © T.K....?2.If I do that, what will be the new max available upper block address?Best regards,nsunier Quote Link to comment Share on other sites More sharing options...
TK. Posted May 5, 2008 Report Share Posted May 5, 2008 I cannot say exactly, what will happen with my copyright message. The new font should be selected before it is print... or do you see a different text?Did you already try this out, or was it just a question?Now, it doesn't matter anymore where the font is located (it will be located by the linker automatically...)The new upper address is 0xffff.Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
nsunier Posted May 5, 2008 Author Report Share Posted May 5, 2008 It's just a question.I've added the new font (and disabled all unused ones: like I was already doing). And I get this message:rm -rf _output/* rm -rf _output rm -rf *.cod *.map *.lst rm -rf *.hex mkdir -p _output sh ./bin/mios-sdcc -c -mpic16 -p18f4620 --fommit-frame-pointer --optimize-goto --optimize-cmp --disa ble-warning 85 --obanksel=2 -pleave-reset-vector -I./src -I ./include/c -I ./modules/glcd_font -DDE BUG_MODE=0 modules/libdev/pic18f4620.c -o _output/pic18f4620.o ./bin/mios-gpasm modifies _output/pic18f4620.asm, result in _output/pic18f4620__mios-gpasm-tmp.asm sh ./bin/mios-gpasm -c -p p18f4620 -I./src -I ./include/asm -I ./modules/app_lcd/ks0108 -I ./modules /glcd_font -DDEBUG_MODE=0 -DSTACK_HEAD=0x37f -DSTACK_IRQ_HEAD=0x33f -I ./modules/mios_wrapper modul es/mios_wrapper/mios_wrapper.asm -o _output/mios_wrapper.o sh ./bin/mios-gpasm -c -p p18f4620 -I./src -I ./include/asm -I ./modules/app_lcd/ks0108 -I ./modules /glcd_font -DDEBUG_MODE=0 modules/app_lcd/ks0108/app_lcd.asm -o _output/app_lcd.o sh ./bin/mios-sdcc -c -mpic16 -p18f4620 --fommit-frame-pointer --optimize-goto --optimize-cmp --disa ble-warning 85 --obanksel=2 -pleave-reset-vector -I./src -I ./include/c -I ./modules/glcd_font -DDE BUG_MODE=0 main.c -o _output/main.o ./bin/mios-gpasm modifies _output/main.asm, result in _output/main__mios-gpasm-tmp.asm sh ./bin/mios-gpasm -c -p p18f4620 -I./src -I ./include/asm -I ./modules/app_lcd/ks0108 -I ./modules /glcd_font -DDEBUG_MODE=0 modules/glcd_font/glcd_font_normal.asm -o _output/glcd_font_normal.o sh ./bin/mios-gpasm -c -p p18f4620 -I./src -I ./include/asm -I ./modules/app_lcd/ks0108 -I ./modules /glcd_font -DDEBUG_MODE=0 modules/glcd_font/glcd_font_big.asm -o _output/glcd_font_big.o sh ./bin/mios-gpasm -c -p p18f4620 -I./src -I ./include/asm -I ./modules/app_lcd/ks0108 -I ./modules /glcd_font -DDEBUG_MODE=0 modules/glcd_font/glcd_font_meter_icons_v_big.asm -o _output/glcd_font_m eter_icons_v_big.o gplink -s ./etc/lkr/p18f4620.lkr -m -o project.hex _output/pic18f4620.o _output/mios_wrapper.o _outp ut/app_lcd.o _output/main.o _output/glcd_font_normal.o _output/glcd_font_big.o _output/glcd_font_met er_icons_v_big.o error: no target memory available for section ".MIOS_EEPROM_ReadPage" make: *** [project.hex] Error 1Where is the extra available memory of the PIC18F4620?Best regards,nsunier Quote Link to comment Share on other sites More sharing options...
TK. Posted May 5, 2008 Report Share Posted May 5, 2008 Seems that there is an error in the .lkr script.Does it work, when you replace:CODEPAGE NAME=page START=0x3000 END=0x7FFFbyCODEPAGE NAME=page START=0x3000 END=0xFFFFBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
nsunier Posted May 5, 2008 Author Report Share Posted May 5, 2008 :D It works now!But... The system font used for your copyright message and for the rebooting message is corrupted. How can I modify the MIOS in order it uses the new font?Best regards,nsunier Quote Link to comment Share on other sites More sharing options...
TK. Posted May 5, 2008 Report Share Posted May 5, 2008 Fine! :)It's strange, that the wrong font is used for the copyright message, according to the code it should work. Are you sure?For the reboot message it's clear, but there is no solution, as the font is not statically assigned anymore, but under control of your application. However, since the message is only displayed after code upload, and not under normal circumstances, it should be acceptable, no?Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
nsunier Posted May 5, 2008 Author Report Share Posted May 5, 2008 The GLCD_FONT_NORMAL font is initialized in the void DISPLAY_Init(void) function. When do you display your copyright message? Before when this function is called?For the reboot message, yes it's acceptable.Best regards,nsunierEDITOups! :'( I've read too quicly your previous answer. If I put the initialization in the Init() function, it works! Quote Link to comment Share on other sites More sharing options...
TK. Posted May 5, 2008 Report Share Posted May 5, 2008 Alright, thats what I expect.Init() will be called before the copyright message (and before the LCD initialisation), whereas DISPLAY_Init() will be called after the copyright messageBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.