Making the first PIC 18f2550 project in CODE::BLOCKS

Code::Blocks is a very nice cross platform IDE. I had been experimenting with it and have interfaced with SDCC compiler. CODE::BLOCKS automatically integrates with SDCC and it automatically fills in the necessary toolchain executables. So I will leave this part and jump directly to the steps for building the first project.

Steps for configuring the first project (I am writing my first project on PIC18f2550):

  1. Go to File -> New -> Project and select an empty project.
  2. In the wizard which opens up click Next.
  3. The next screen prompts for the Project Title. Filling in a name will automatically fill in the rest of the fields. Click Next.
  4. In the compiler option in the next screen choose Small Device C compiler and click Finish.
  5. The left pane must show now a new project without any files.
  6. Right click over the project and select Build Options from the pop up menu.
  7. In the Compiler Settings Tab,
    1. In the Compiler Flags Tab, select CPU architectures in the Categories Drop Down.
    2. Check [CPU] PIC 16-bit
    3. Click on Other options. Add the following text into it: -p18f2550 -Wl -m —use-non-free —verbose -V
      1. The -p switch tells the compiler the exact pic name
      2. -Wl -m is used to pass a switch to the Linker to generate the .map file in the output. This is a useful file normally suppressed by SDCC.
      3. –use-non-free is required to use the PIC header files as it is not covered under GNU license
      4. –verbose -V asks SDCC to be verbose and this helps in debugging the build
  8. Now create the first program or use any available program from the Internet and add the file to the project by right clicking the project.
  9. Clicking on build should build it and the bin folder inside the project directory should contain a hex file under the current build configuration (Debug/Release).
  10. If the hex file is not produced read the verbose output for any syntax error or missing libraries.
  11. SDCC looks for the default libraries libsdcc.lib, crt0i.o and libdevpic<picid>.lib at its default locations. If the libraries are not present in its default location you can manually specify the path in the Build Options (obtained by right clicking the project) and setting the linker search directories.




0



0

Share with others:

Read Similar Tags:

Like what you read?

Consider providing a review for the post or the website by clickling Submit Review below.

Comments

Leave a Reply

Only people in my network can comment.
Strong Testimonials form submission spinner.

Required

What is your full name?
What do you think about the Blog?
Write the Title with the current blog name when writing a testimonial for this blog instead of the entire website
What is your email address?
Do you have a profile page you want to link to?