Hi all,
I'm seeking about header C file for M32C/M16C internal ressources (UART's, SSC, SPI, ... etc registers definition). I guess there are some common reg and bits definition over M32C/M16C family.
Thx, Habib.
Hi all,
I'm seeking about header C file for M32C/M16C internal ressources (UART's, SSC, SPI, ... etc registers definition). I guess there are some common reg and bits definition over M32C/M16C family.
Thx, Habib.
The header C file may be availabe for some IDEs such as Codeworrior, check it. :)
tcysb http:
Le Fri, 16 Nov 2007 17:13:31 -0800, yusibin a écrit:
I have no IDE nor Codeworrior. I always use emacs and make :-) and i'm quite sure it's sufficent to build good software.
M32C/M16C register map is quite big, can you show me some header file in relation with ?
Thx, Habib.
In message , Habib Bouaziz-Viallet writes
For which compiler?
-- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Le Sun, 18 Nov 2007 12:44:42 +0000, Chris Hills a écrit:
Hi !
IIs the choice of the compiler is important ? I think not. So i'm using gcc (m32-elf-..).
Habib.
In message , Habib Bouaziz-Viallet writes
Yes.
Then you would be wrong.
-- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Somewhat. N30 has a special syntax for saying "this variable lives at this specific location in memory" that gcc doesn't support. GCC uses linker tricks to do the equivalent, although it's possible to write a perl script that converts one to the other. However, I'm attaching a simpler perl script I use to manually enter the I/O definitions myself, and a sample (r8c-1b) definitions file. Run on on the other, it creates a stand-alone .h (for C source) and a usable .S (for ASM sources).
-------------------- mkports -------------------- #!/usr/bin/perl # -*- perl -*-
open(S, ">r8c-ports.S"); open(H, ">r8c-ports.h");
print H "typedef unsigned char byte;\n\n"; print H "typedef unsigned short word;\n\n";
while () { s/\#.*//; s/[\r\n]+$//;
($name, $addr, $bits) = split(' ', $_, 3); next unless $name =~ /\S/;
$type = "byte";
if ($bits =~ /^\.HI\s*(.*)/) { $type = "word"; $bits = $1; }
if ($bits) { print S "\n"; print H "\n"; $nl = "\n"; } else { print S $nl; print H $nl; $nl = ''; } print S "$name\t= 0x$addr\n";
if ($bits) { $bitf = 0; $unspec = 0; $type = "${name}_type"; print H "typedef union {\n"; print H " struct {\n"; $sbits = ''; for $field (reverse split(' ', $bits)) { if ($field eq ":") { print H " byte unspec_$unspec:1;\n"; $unspec ++; $bitf ++; } elsif ($field =~ /(.*):(\d)/) { print H " byte $1:$2;\n"; printf S " ${name}_$1\t= 0x%02x\n", ((1
In message , DJ Delorie writes
Apart from that other compilers may also use syntax that is different to either of those.
That is why the choice of compiler needs to be known for the header files. If you did not know that should you be doing the project you are on?
-- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Le Mon, 19 Nov 2007 07:24:13 -0500, DJ Delorie a écrit:
Rrriiiight ! That is exactly what i need !
Many Thanks M. Delorie.
Le Mon, 19 Nov 2007 14:13:36 +0000, Chris Hills a écrit:
Are you really understand what i'm talking about ? 'Cause i'm far from to understand yours.
Habib
In message , Habib Bouaziz-Viallet writes
Yes I understand.
I know. That is a problem for you
-- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Not if the header is written in standard C and leaves the weird translation and manipulation to the system sensitive .c file.
-- Chuck F (cbfalconer at maineline dot net) Try the download section.
The Perl Script (Many thanks to M. DJ Delorie) works fine ! Just make ./mkport.pl < reg_m16 and magically this script build a rm16c_port.h (and also an ASM file) !!
Great Job indeed !!
Habib
Le Mon, 19 Nov 2007 16:13:52 +0000, Chris Hills a écrit:
Do you ? To say at least, your posts prove me otherwise.
My apologies M. Hills, i do not need to understand you because there's nothing to understand.
Habib.
No such thing as "standard C" when referring to header files for hardware registers. Most compiler vendors have different ways of doing them
-- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
In message , Habib Bouaziz-Viallet writes
There is not standard C for accessing hardware registers. You have already been told that two compilers do it differently . I know that most of the compiler vendors do their header files to access hardware differently.
I know I have to support 6 different compiler makes.
-- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.