C development and patching for P01/P59

User avatar
antus
Site Admin
Posts: 8237
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: C development and patching for P01/P59

Post by antus »

personly I think the gnu c compiler is the most industry standard option. thats how we compiled the pcmhammer kernel. but like gampy said the code output is somewhat bloated (for any c compiler, considering the size of the pcm). and the setup time to define the hardware in header files is real. the advantage to using gnu c (gcc) or gnu assembler (gas) and linker (ld) is they'll still be around in the future too. gnu toolchain can convert binary/srec etc too. c++ builder isnt the right tool for this. maybe get the gnu 68k toolchain and compile the pcmhammer kernel and prove your build works then go from there.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
bubba2533
Posts: 498
Joined: Wed Apr 11, 2018 8:50 am
cars: 03 Chevy S10 Turbo V6

Re: C development and patching for P01/P59

Post by bubba2533 »

Ok, trying to do what you suggested and I'm stuck already.

Code: Select all

C:\Users\bubba2533\Documents\GitHub\PcmHacks\Kernels>make clean                                                             
rm -f *.bin *.o *.elf *.asm                                                                                             
process_begin: CreateProcess(NULL, rm -f *.bin *.o *.elf *.asm, ...) failed.                                            
make (e=2): The system cannot find the file specified.                                                                  
make: *** [clean] Error 2            
Sorry I'm such a beginner at this.
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
User avatar
Gampy
Posts: 2331
Joined: Sat Dec 15, 2018 7:38 am

Re: C development and patching for P01/P59

Post by Gampy »

Not to worry, plenty of help available.

The build process is slightly complicated so it is all wrapped in a Batch file (.cmd file).

Do you have GNU m68k installed in,
c:\SysGCC\m68k-elf
You want to use Build.cmd
The .cmd is important.
C:\Users\bubba2533\Documents\GitHub\PcmHacks\Kernels>Build.cmd
To Clean the Kernel project use Clean.bat
C:\Users\bubba2533\Documents\GitHub\PcmHacks\Kernels>Clean
-Enjoy
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
bubba2533
Posts: 498
Joined: Wed Apr 11, 2018 8:50 am
cars: 03 Chevy S10 Turbo V6

Re: C development and patching for P01/P59

Post by bubba2533 »

Gampy wrote:Not to worry, plenty of help available.

The build process is slightly complicated so it is all wrapped in a Batch file (.cmd file).

Do you have GNU m68k installed in,
c:\SysGCC\m68k-elf
Yes

Here is what I got with those commands:

Code: Select all

C:\Users\bubba2533\Documents\GitHub\PcmHacks\Kernels>Clean
  Deleting common-readwrite.o
  Deleting common.o
  Deleting crc.o
  Deleting flash-amd.o
  Deleting flash-intel.o
  Deleting main.o
  Deleting write-kernel.o
  Deleting kernel.disassembly
  Deleting kernel.bin
  Deleting kernel.elf
C:\Users\bubba2533\Documents\GitHub\PcmHacks\Kernels>Build.cmd
..\Apps\PcmHammer\bin\debug
The system cannot find the path specified.
        0 file(s) copied.
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
User avatar
Gampy
Posts: 2331
Joined: Sat Dec 15, 2018 7:38 am

Re: C development and patching for P01/P59

Post by Gampy »

That error is due to the fact that PCMHammer project is not built ... No problem, we can work around that very simply.

Add a "-c" to the Build.cmd command line.
C:\Users\bubba2533\Documents\GitHub\PcmHacks\Kernels>Build.cmd -c
The kernel is actually built at that point and it's just failing to copy the resulting kernel.bin to the PCMHammer build directory.
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
bubba2533
Posts: 498
Joined: Wed Apr 11, 2018 8:50 am
cars: 03 Chevy S10 Turbo V6

Re: C development and patching for P01/P59

Post by bubba2533 »

Yay! no errors!
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
User avatar
Gampy
Posts: 2331
Joined: Sat Dec 15, 2018 7:38 am

Re: C development and patching for P01/P59

Post by Gampy »

Awesome ...

I have modified Build.cmd and Clean.bat for you, please replace your existing ones with these.

What I have done is,
Fix Clean.bat so it will remove ".i" files ...
Added a "-t" option to Build.cmd so you can have it "save-temps" therefore you can look at the intermediate ASM ... it's the same as "-S" without halting the process.
clean.bat.txt
(172 Bytes) Downloaded 128 times
Build.cmd.txt
(4.78 KiB) Downloaded 154 times
Obviously you need to remove the .txt extension when saving ...

You'll want to have a look at the .s files in kernel directory after running Build.cmd.

FYI, Build.cmd has simple Help ... use -h as the last command line option.
Examples:
Build.cmd -h
will show the default option settings.
Build.cmd -c -d -t -h
will show the current option settings.
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
bubba2533
Posts: 498
Joined: Wed Apr 11, 2018 8:50 am
cars: 03 Chevy S10 Turbo V6

Re: C development and patching for P01/P59

Post by bubba2533 »

Awesome thanks. Now I just have to learn C++ :shock:
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
User avatar
Gampy
Posts: 2331
Joined: Sat Dec 15, 2018 7:38 am

Re: C development and patching for P01/P59

Post by Gampy »

I'm sure this is subjective to ones opinion ... However I would loose the ++ and stick to pure C.

I suspect the ++ will bloat the assembly a bit more, though I must admit age and oxygen deprivation has made me forget the results of testing long past ... :cry:

Sure would be nice if Godbolt added m68k to Compiler Explorer, that would be the cats meow ...
I was going to email him about it and never did, I suspect it would be extremely simple for one that has the tools setup and knows the addition process.
Intelligence is in the details!

It is easier not to learn bad habits, then it is to break them!

If I was here to win a popularity contest, their would be no point, so I wouldn't be here!
bubba2533
Posts: 498
Joined: Wed Apr 11, 2018 8:50 am
cars: 03 Chevy S10 Turbo V6

Re: C development and patching for P01/P59

Post by bubba2533 »

I'm not sure I really know the difference as of yet. But I already own this book since I was planning on trying to learn some C++ so I figured I already have it.
LS1 Boost OS V3 Here. For feature suggestions post in here Development Thread. Support future development ->Patreon.
Post Reply