Author Topic: A simple MCS51 project wizard  (Read 14421 times)

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
A simple MCS51 project wizard
« on: July 08, 2011, 12:22:21 pm »
I tried to implement a simple mcs51 project wizard for the mcs51 architecture using sdcc but I have some problems I need help with. I attached the current files as a zip file in case anyone needs to have a look. Here is a summary of what I've done:

1- I modified the 'common_functions.script' file to include 'sdcc' specific options.
2- I created the 'wizard.script' and 'wizard.xrc' files with simple .png files made on the fly.
3- I modified the 'config.script' file to include my template.

The wizard creates the project files with correct settings corresponding 'debug' and 'release' targets but I couldn't manage to make the assembler assemble the .asm file created.  I tried changing the output directory and the object file output directory to the source directory with no luck. I guess there is something with how cb passes directories to the compiler or about some missing settings I failed to implement in the wizard. Here is what I get when I try to build the project. Any help?

Code: [Select]
sdcc.exe -mmcs51 -Wall --model-small  --debug    -IC:\GNU\SDCC\include  -c main.c -o obj\Debug\main.rel
sdas Assembler V02.00 + NoICE + SDCC mods + Flat24  (Intel 8051)
Usage: [-Options] file
Usage: [-Options] outfile file1 [file2 file3 ...]
  -d   Decimal listing
  -q   Octal   listing
  -x   Hex     listing (default)
  -j   Add line number and debug information to file
  -g   Undefined symbols made global
  -a   All user symbols made global
  -l   Create list   output file1[lst]
  -o   Create object output file1[rel]
  -s   Create symbol output file1[sym]
  -c   Generate sdcdb debug information
  -p   Disable listing pagination
  -w   Wide listing format for symbol table
  -z   Enable case sensitivity for symbols
  -f   Flag relocatable references by  `   in listing file
  -ff  Flag relocatable references by mode in listing file
  -I   Add the named directory to the include file
       search path.  This option may be used more than once.
       Directories are searched in the order given.
removing
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)

P.S: I tried not to use tabs and I apologize if I missed any. Thnx...

Edit: Here is the simple code I'm trying to build.

Code: [Select]
#include <mcs51/8051.h>

void main(void)
{

    // Insert code

    while(1)
    P0^=0x01;

//    return;
}
« Last Edit: July 08, 2011, 12:28:49 pm by scarphin »

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: A simple MCS51 project wizard
« Reply #1 on: July 16, 2011, 02:10:31 pm »
After a little debugging I realized the problem resides with the '-Wall' command line option. Somehow this option stops the compilation process at the assembly phase. I've posted about this on the sdcc forum and disabled the warning messages in the wizard. As of now it's a working template attached for ur consideration. Thnx...

Offline pebri86

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: A simple MCS51 project wizard
« Reply #2 on: July 28, 2011, 07:30:44 am »
thank you...this's really what i looking for...

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: A simple MCS51 project wizard
« Reply #3 on: October 25, 2011, 06:26:49 pm »
I added the patch and the '.png' files zipped in one.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12006
    • Travis build status
Re: A simple MCS51 project wizard
« Reply #4 on: October 26, 2011, 09:35:48 am »
There is a typo:
Code: [Select]
@@ -509,7 +518,7 @@

             local pf = prj.AddFile(tgtidx, the_file);
             GetProjectManager().RebuildTree(); // make sure our view is current
 
-            // if the file was added successfully, (...)
+            // if the file was added succesfully, (...)
             if (!IsNull(pf))
             {
                 // add to this file the rest of the selected targets...

And an unrelated change:
Code: [Select]
@@ -35,7 +35,8 @@

     RegisterWizard(wizProject,     _T("gtk"),          _T("GTK+ project"),          _T("GUI"));
     RegisterWizard(wizProject,     _T("irrlicht"),     _T("Irrlicht project"),      _T("2D/3D Graphics"));
     RegisterWizard(wizProject,     _T("lf"),           _T("Lightfeather project"),  _T("2D/3D Graphics"));
-    RegisterWizard(wizProject,     _T("matlab_csf"),   _T("Matlab project"),        _T("Console"));
+    if (PLATFORM == PLATFORM_MSW)
+        RegisterWizard(wizProject, _T("matlab_csf"),   _T("Matlab project"),        _T("Console"));
     RegisterWizard(wizProject,     _T("opengl"),       _T("OpenGL project"),        _T("2D/3D Graphics"));
     RegisterWizard(wizProject,     _T("ogre"),         _T("Ogre project"),          _T("2D/3D Graphics"));
     RegisterWizard(wizProject,     _T("plugins"),      _T("Code::Blocks plugin"),   _T("Code::Blocks"));

And commented code, which has to be removed/fixed:
Code: [Select]
+//  WarningsOn(project, Wizard.GetCompilerID());

Also does this work on Linux? Is this platform programmable on Linux?
If yes, this line should be made cross platform:
Code: [Select]
+    pb_hex = _T("cmd /c \"packihx <$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).ihx >$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).hex\"");

I've not run the wizard, so I can't tell if it works.
Also can you explain why you're changing the common script?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: A simple MCS51 project wizard
« Reply #5 on: October 26, 2011, 10:05:26 am »
There is a typo:
Sry for the typo, I'll correct it.

And an unrelated change:
I didn't mess with the 'matlab' project, I must have done something wrong while creating the patch.

And commented code, which has to be removed/fixed:
Code: [Select]
+//  WarningsOn(project, Wizard.GetCompilerID());
Commented code is for a bug in SDCC (I guess). When all warnings are turned on, compilation stops at the assemble phase. So I commented the code to try it with a newer SDCC version (which hasn't come out yet). I don't know what to do with it, it may be removed as currently it's not needed.

Also can you explain why you're changing the common script?
I've added the missing entries for SDCC compiler. Is there something I should know about changing it?

Edit: Btw did I make the patch correct with the '.png' files?
« Last Edit: October 26, 2011, 10:07:56 am by scarphin »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12006
    • Travis build status
Re: A simple MCS51 project wizard
« Reply #6 on: October 26, 2011, 10:21:12 am »
The png's are OK, I suppose, I've not tried it. Just looked at it.

What about the Linux stuff?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: A simple MCS51 project wizard
« Reply #7 on: October 26, 2011, 10:31:28 am »
Sry I forgot to reply to it. SDCC works on linux too so it's a bug u've found. ;) I'll modify it for both platforms but someone needs to check that on linux.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: A simple MCS51 project wizard
« Reply #8 on: October 26, 2011, 10:54:42 am »
Ok, I've created a new patch.

The typo and the unrelated 'matlab' change occurred because the files I edited belonged to an old svn version. Someone corrected/changed them in the current svn version so my patch tried to revert them back. ;D It's fixed now. Also removed the commented line and made the windows only part cross platform (needs testing on linux though).

Attached with the '.png' files.

Edit: Also submitted to the patch tracker.
« Last Edit: October 26, 2011, 11:48:16 am by scarphin »