Search in Pinguino World !!

Friday, February 27, 2009

Pinguino with CodeBlocks............

Pinguino can be used with CodeBlocks. To do this, you need to install SDCC and GPUTILS. CodeBlocks recognize if SDCC is installed.
First you must download the CodeBlocks model for Pinguino.
Then you have to configure CodeBlocks to work with SDCC.

Create a new empty project in the same folder than the CodeBlocks model,
Go to the Settings menu/Compiler and debugger and choose SDCC in the Selected compiler panel,
Click the compiler settings tab and Compiler flags tab and select:
  • Be verbose
  • [CPU] PIC 16 bits
  • ouput intel hex
Select the Other Options panel and type:
  • --optimize-goto --denable-peeps --obanksel=9 --opt-code-size --optimize-cmp --optimize-df
Then all the general settings for the compiler are OK. You must now configure the specific options for Pinguino.
Select the Project/Build Options menu,
Click on the Compiler Settings tab and Other Options tab,
type -p18f2550 in the field.
Click now on the Linker Settings panel.
In the Other Linker Options field, type:
--no-crt -Wl-s18f2550.lkr,-m
In the Link Libraries field, click on add and select this files:
libpuf.lib wich is in the project folder,
libc18f.lib wich is in the /usr/share/sdcc/lib/pic16 folder ( Linux )
libio18f2550.lib
wich is in the /usr/share/sdcc/lib/pic16 folder ( Linux )

Now you can click on the Build button and an hex file should be generated.
All the code must be written in the application_main() in main.c

To upload the code to the PIC, you can use the Python downloader wich can be downloaded here.

I hope to propose some models of applications.

5 comments:

Unknown said...

Bonjour,
J'ai bien suivi la procédure de configuration de code::blocks, j'ai récupéré le modèle, créé un projet contenant le fichier main.c. J'ai lancé un build mais je ne récupère qu'un .asm, pas de .hex.
Dans la procédure de configuration y aurait-il un paramétrage à faire pour gputils.
A noter que j'ai déjà utilisé sans problème context + sdcc + gputils autour de votre carte 18f252.
Cordialement
André Gentric

Jean-Pierre MANDON said...

Bonjour André

Je vais tester sous windows pour vous dire. La description qui est faite ici a été testée sous Linux. Il me semble me rappeler qu'il y a un problème avec Gplink sous windows.

A suivre.......

Jean-Pierre MANDON said...

Le problème vient bien de gplink qui ne supporte pas les chemins contenant des espaces.
Créez un dossier c:\codeblocks\libpic et copier dedans le contenu de c:\program files\sdcc\lib\pic16
Dans le menu Project/build options de codeblocks selectionnez l'onglet Linker settings et supprimer les bibliotheques libc18f et libio18f2550.
Ajoutez maintenant ces bibliotheques en les cherchant dans c:\codeblocks\libpic
le projet se compile normalement.

A+
Jean-Pierre

Unknown said...

Bonjour,
Merci pour les indications d'installation de Gplink. Elles sont été insuffisantes, de ce fait j'ai persévéré. En interprétant les messages successifs de "Build log" j'ai trouvé qu'il fallait faire pour libpuf.lib ce que vous avez proposé pour libc18f et libio18f2550 et en plus donner le chemin complet de 18f2550.lkr dans l'option de linker --no-crt -Wl-s18f2550.lkr,-m. J'ai donc copié 18f2550.lkr dans C:\codeblocks\libpic pour éviter les espaces dans le chemin à spécifier.
J'ai installé codeblocks sous ubuntu et là aussi il a fallu indiquer le chemin complet de 18f2550.lkr dans l'option linker pour obtenir effectivement les éléments de conversion .asm vers .hex . Par contre le pb des espaces dans le chemin ne s'est pas posé comme pour Windows.
Maintenant je vais me lancer dans un petit exemple. Les votres seront aussi les bienvenus ... !
Cordialement
André

Unknown said...

Bonjour,

Ici aussi: sous Kubuntu, suivi de la procédure scrupuleusement (trop?) et pourtant je me heurte à une compilation peu concluante:

Build Log:
"sunkbd - Release" uses an invalid compiler. Skipping...
Nothing to be done.

Debugger:
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Release
Aborted