Dfinitski / N7DDC-ATU-100-mini-and-extended-boards

316 stars 142 forks source link

Compiling for ATU-100 ext board #89

Closed nv1o closed 2 years ago

nv1o commented 2 years ago

David, I am trying to compile an edited main.c file, version 3.2. I downloaded MikroC PRO for PIC, ver 7.6.0. I want to create a new hex file for the pic, but it's not working for me and I'm don't know how to get it done. I tried creating a new project, but I'm not sure which files to include. I've tried them all, but am getting errors like "Undeclared identifier 'ADC_Get_Sample' in expression in the main.h file, when I execute Build. What are the steps to accomplish this? Will I end up with the hex file to program the pic with?

73, Craig NV1O

Dfinitski commented 2 years ago

Hi. You have to turn on the ADC library in the library manager and also couple other libraries. You will see. Open the library manager at right.

nv1o commented 2 years ago

Spasibo! I will give it a try. MikroC - eto li russkaya kompaniya?

nv1o commented 2 years ago

David, I got it to compile without errors. How do I now generate the hex firmware file for the pic? It generated an ATU100 hex file, but it is very small, 1k. The MikroC programming module, does not recognize my Pickit 3 programmer, so I can't program the pic and save the hex file from there. NV1O

Dfinitski commented 2 years ago

That is the Poland's company. Hex is generated. See the project folder, same name as the project

nv1o commented 2 years ago

Yes, I looked there, but only found the 1K hex file. It generated many other files, .c.ini, .cfg, .cp, .dbg, etc. Here is the hex file: :020000000C28CA :1000060012001E00F003031D0328F103031D03283D :020016000800E0 :020018000C28B2 :020000040001F9 :04000E00E23F331684 :00000001FF

In addition to main.c, I only added the .h files from the #include statements. I'll retry with all the files from the Github website.

nv1o commented 2 years ago

That didn't work, so I redid the build with just the main.c and the 3 .h files and got these errors: 1 355 Redefinition of 'main [ATU.c] '. 'main' already defined in 'main.c' ATU.c 0 102 Finished (with errors): 15 Feb 2022, 12:38:11 ATU.mcppi

Dfinitski commented 2 years ago

Probably your MikroE is not activated. That is not free software .

Dfinitski commented 2 years ago

Probably your MikroE is not activated. That is not free software .

nv1o commented 2 years ago

No, it's not activated. Strange it doesn't give a disclaimer on the screen. OK, I'll see what I can do. Спасибо Craig

nv1o commented 2 years ago

Got the activation code in, but same 'main already defined' error. Спасибо за помощь. I am ready to give up on it.

73, Craig

Dfinitski commented 2 years ago

You have declared main function second time. ATU.c I don't know what is this. Is this your written file ?

nv1o commented 2 years ago

ATU.c is a very small file that MikroC produces when I run build. This is what's in the file: void main() {

} I don't know what it's for, but if I exclude it from the build, I don't get the second function error. I do get the following report:

0 1 mikroCPIC1618.exe -MSF -DBG -pP16F1938 -DL -O11111114 -fo8 -N"C:\ATU100\Projects\ATU100.mcppi" -EH"C:\ATU100\atu_100_fw_00.ihex" -SP"C:\Mikroelektronica\mikroC PRO for PIC\Defs\" -SP"C:\Mikroelektronica\mikroC PRO for PIC\Uses\P16_Enh\" -SP"C:\ATU100\Projects\" -SP"C:\ATU100\" -IP"C:\ATU100\" "main.c" "oled_control.c" "pic_init.c" "backup.mcl" "main.mcl" "oled_control.mcl" "pic_init.mcl" "Lib_Math.mcl" "__Lib_MathDouble.mcl" "Lib_System.mcl" "Lib_Delays.mcl" "__Lib_CType.mcl" "Lib_CString.mcl" "Lib_CStdlib.mcl" "__Lib_CMath.mcl" "Lib_MemManager.mcl" "Lib_Conversions.mcl" "__Lib_Sprinti.mcl" "Lib_Sprintl.mcl" "Lib_Time.mcl" "__Lib_Trigonometry.mcl" "Lib_Button.mcl" "Lib_Keypad4x4.mcl" "__Lib_Manchester.mcl" "Lib_OneWire.mcl" "Lib_PS2.mcl" "__Lib_Sound.mcl" "Lib_SoftI2C.mcl" "Lib_SoftSPI.mcl" "__Lib_SoftUART.mcl" "Lib_ADC.mcl" "Lib_EEPROM.mcl" "Lib_FLASH_rwe.mcl" "Lib_I2C_c34.mcl" "Lib_PWM_c216b0a4.mcl" "Lib_SPI_c345.mcl" "Lib_UART_c67.mcl" "Lib_PortExpander.mcl" "Lib_CANSPI.mcl" "Lib_CF.mcl" "__Lib_GlcdFonts.mcl" "Lib_Glcd.mcl" "Lib_LcdConsts.mcl" "__Lib_Lcd.mcl" "Lib_RS485.mcl" "Lib_S1D13700.mcl" "__Lib_T6963C.mcl" "Lib_SPIGlcd.mcl" "Lib_SPILcd.mcl" "__Lib_SPILcd8.mcl" "Lib_SPIT6963C.mcl" "Lib_EthEnc28j60.mcl" "__Lib_EthEnc24j600.mcl" "Lib_TouchPanel.mcl"
0 1139 Available RAM: 1016 [bytes], Available ROM: 16384 [bytes]
0 122 Compilation Started oled_control.h 3 393 'Soft_I2C_Scl' Identifier redefined oled_control.h 4 402 ; expected, but 'at' found oled_control.h 4 393 'Soft_I2C_Sda' Identifier redefined oled_control.h 4 371 Specifier needed oled_control.h 4 396 Invalid declarator expected'(' or identifier oled_control.h 5 402 ; expected, but 'at' found oled_control.h 5 393 'Soft_I2C_Scl_Direction' Identifier redefined oled_control.h 5 371 Specifier needed oled_control.h 5 396 Invalid declarator expected'(' or identifier oled_control.h 5 393 '' Identifier redefined oled_control.h 6 402 ; expected, but 'at' found oled_control.h 6 393 'Soft_I2C_Sda_Direction' Identifier redefined oled_control.h 6 312 Internal error '' oled_control.h 0 102 Finished (with errors): 17 Feb 2022, 11:28:07 ATU100.mcppi

I'm not sure, but the problem may be from not knowing exactly which files to include in the build from the github site. The report above was produced with ALL the files from the 1938_EXT_board_sources_V_3.2 folder. Which files do I include?

73, nv1o

davidhay45 commented 2 years ago

MikroC expects to find the initial start routine, main() in a file with "name of the project".C. So I guess that your project is called ATU? To fix this issue simply edit ATU.C and rename the main() routine to be something else, for example main_x(). That will probably fix the "Redefinition of 'main [ATU.c] '. 'main' already defined in 'main.c' " error. However, this system is not really the place to learn how to use MikroC. David N7DDC has been very generous in making this project open source, we (me included) should not be asking questions like this. Just my opinion of course.

nv1o commented 2 years ago

Well, no matter. It just surprises me how many people take exception to others' questions about things they don't understand in these kinds of forums. Yes, David has been gracious to try and help me and I am grateful for that. I just can't understand why I am getting all these errors. I did edit the ATU.c file and it did get rid of the extra function declaration error, but it's still not working. I will quit posting and just give up on this.

Dfinitski commented 2 years ago

Hi. My project is not named ATU and does not have any ATU.c file. You can see all the files right here, on Github. Give me a link where you see ATU.c file.

Dfinitski commented 2 years ago

Probably you have changed some thing in settings

nv1o commented 2 years ago

Давид, хочу сказать большое Вам спасибо за помощь. Мне жалко, что я мало понимаю об этом. Кстати, мне очень нравится тунер! Прекрасно работает. Сейчас по-антлиский. The kit I ordered had ver. 3.2 installed, but both the code and EEPROM were protected, so I used pickit3 to reprogram with your hex file and I was able to figure out how to make my oled display work again from your documentaion file. So now, it is all unprotected and I can change parameters when I want to. I saved off a new hex file and all is good. So now I want to try building the hex file from your source files to see if I can get it to work, so that I would be able to make minor programming changes in the future. I'm just not having any success to compile it. I did not change any settings, except to rename the default project to ATU instead of MyProject. That is how ATU.c got created by MikroC. What I am asking is what do I need to do in MikroC to get your source files to compile properly? Do I just create a new project, add files and libraries and do the build, or are there other steps to take? If this is too complex to work out in the forum, let me know and I will put it away for now. If you are willing and would prefer to communicate via email, you can get my email address from my QRZ page.

С уважением, Craig NV1O

And apologies to DavidHay for me giving it one more try.

Dfinitski commented 2 years ago

I got you. Don't rename the project, compile it as is. Turn on in the library manager Button, ADC, EEPROM, Conversion libraries .

nv1o commented 2 years ago

Спасибо! And which files do I add to the build besides main.c and the include files?

davidhay45 commented 2 years ago

Just add the .c files. The .h are dealt with by the include statements. So main.c, pic_init.c and oled_control.c are all you need. If any other .c file is seen in project manager you can remove it. And as David N7DDC says just tick the four libraries he mentions.

nv1o commented 2 years ago

Holy cow! It finally worked! Thank you thank you! I thought I had tried that scenario already, but hadn't modified the myproject.c to eliminate the redundant define error. I was getting ready to re-download the files, in case I had a corruption. My career was in computer hardware, not software, although I did a fair amount of hobbyist programming in BASIC in the early days and recently wrote a python project to interface to a Kenwood 2m/440 tranceiver because the display went bad. Many thanks to both of you for the help! I figured the build would be simple and straight forward, but just didn't know the exact formula. Oh, and I figured out how to attach the ihex file also, to include it in the final build. Excellent!

73, NV1O