<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Schreiben in memory map?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche ein vorhandenes Programm (geschrieben in C) unter C++ zu kompilieren. Doch leider meldet der Kompiler immer</p>
<blockquote>
<p>error: pointer of type `void *' used in arithmetic</p>
</blockquote>
<p>für die letzte Zeile des u.a. Source-Codes</p>
<pre><code class="language-cpp">void * map_base; 
map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd_mem, PIOB_BASE  &amp; ~MAP_MASK);
if(map_base == (void *) -1){
    	printf(&quot;Couldn't get Map-Address.\n&quot;);
	exit(1);
}
printf(&quot;Memory mapped at address %p.\n&quot;, map_base);
fflush(stdout);

// Configure the registers

*((unsigned long *) (map_base + (PIOB_PER &amp; MAP_MASK))) = PIO_B27; //enable io
</code></pre>
<p>Wie beschreibe ich unter C++ die Speicherzelle in der Mmap korrekt?<br />
Auch nach langem Suchen habe ich leider zu diesem Thema nichts finden können.<br />
Kennt jemand die Lösung</p>
<p>Danke und Grüsse<br />
Ulli</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/161468/schreiben-in-memory-map</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 21:41:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/161468.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 06 Oct 2006 20:06:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Schreiben in memory map? on Fri, 06 Oct 2006 20:06:30 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche ein vorhandenes Programm (geschrieben in C) unter C++ zu kompilieren. Doch leider meldet der Kompiler immer</p>
<blockquote>
<p>error: pointer of type `void *' used in arithmetic</p>
</blockquote>
<p>für die letzte Zeile des u.a. Source-Codes</p>
<pre><code class="language-cpp">void * map_base; 
map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd_mem, PIOB_BASE  &amp; ~MAP_MASK);
if(map_base == (void *) -1){
    	printf(&quot;Couldn't get Map-Address.\n&quot;);
	exit(1);
}
printf(&quot;Memory mapped at address %p.\n&quot;, map_base);
fflush(stdout);

// Configure the registers

*((unsigned long *) (map_base + (PIOB_PER &amp; MAP_MASK))) = PIO_B27; //enable io
</code></pre>
<p>Wie beschreibe ich unter C++ die Speicherzelle in der Mmap korrekt?<br />
Auch nach langem Suchen habe ich leider zu diesem Thema nichts finden können.<br />
Kennt jemand die Lösung</p>
<p>Danke und Grüsse<br />
Ulli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150819</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150819</guid><dc:creator><![CDATA[ulli G]]></dc:creator><pubDate>Fri, 06 Oct 2006 20:06:30 GMT</pubDate></item><item><title><![CDATA[Reply to Schreiben in memory map? on Fri, 06 Oct 2006 20:37:55 GMT]]></title><description><![CDATA[<p>ulli G schrieb:</p>
<blockquote>
<pre><code class="language-cpp">*((unsigned long *) (map_base + (PIOB_PER &amp; MAP_MASK))) = PIO_B27; //enable io
</code></pre>
</blockquote>
<p>versuch mal so:</p>
<pre><code class="language-cpp">*((unsigned long *)map_base + (PIOB_PER &amp; MAP_MASK)) = PIO_B27; //enable io
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1150840</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150840</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Fri, 06 Oct 2006 20:37:55 GMT</pubDate></item><item><title><![CDATA[Reply to Schreiben in memory map? on Sun, 08 Oct 2006 12:44:25 GMT]]></title><description><![CDATA[<p>net schrieb:</p>
<blockquote>
<p>versuch mal so:</p>
<pre><code class="language-cpp">*((unsigned long *)map_base + (PIOB_PER &amp; MAP_MASK)) = PIO_B27; //enable io
</code></pre>
</blockquote>
<p>Hurra,</p>
<p>das hat zumindest beim kompilieren geholfen,<br />
doch leider gibt's jetzt einen Laufzeitfehler &quot;segmentation fault&quot; bei der Ausführung der Zeile.</p>
<p>Unter C läuft das Programm auf der gleichen Hardware durch.</p>
<p>Noch eine Idee?</p>
<p>Gruss<br />
Ulli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1151403</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1151403</guid><dc:creator><![CDATA[ulli G]]></dc:creator><pubDate>Sun, 08 Oct 2006 12:44:25 GMT</pubDate></item><item><title><![CDATA[Reply to Schreiben in memory map? on Sun, 08 Oct 2006 13:17:41 GMT]]></title><description><![CDATA[<p>Caste den map_base pointer zu einem unsigned char* dann führe die Arithmetik durch und dann caste ihn erst zu unsigned long*</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1151418</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1151418</guid><dc:creator><![CDATA[lolz]]></dc:creator><pubDate>Sun, 08 Oct 2006 13:17:41 GMT</pubDate></item><item><title><![CDATA[Reply to Schreiben in memory map? on Sun, 08 Oct 2006 13:19:19 GMT]]></title><description><![CDATA[<p>Also so:</p>
<pre><code class="language-cpp">*((unsigned long *) ((unsigned char*)map_base + (PIOB_PER &amp; MAP_MASK))) = PIO_B27; //enable io
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1151420</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1151420</guid><dc:creator><![CDATA[lolz]]></dc:creator><pubDate>Sun, 08 Oct 2006 13:19:19 GMT</pubDate></item><item><title><![CDATA[Reply to Schreiben in memory map? on Mon, 09 Oct 2006 18:55:29 GMT]]></title><description><![CDATA[<p>lolz schrieb:</p>
<blockquote>
<p>Also so:</p>
<pre><code class="language-cpp">*((unsigned long *) ((unsigned char*)map_base + (PIOB_PER &amp; MAP_MASK))) = PIO_B27; //enable io
</code></pre>
</blockquote>
<p>... jetzt funktionierts!</p>
<p>Suuuuuuuper!!!</p>
<p>Gruss<br />
Ulli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1151770</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1151770</guid><dc:creator><![CDATA[ulli G]]></dc:creator><pubDate>Mon, 09 Oct 2006 18:55:29 GMT</pubDate></item><item><title><![CDATA[Reply to Schreiben in memory map? on Mon, 09 Oct 2006 20:02:36 GMT]]></title><description><![CDATA[<p>Das war mir klar <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f576.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--sunglasses"
      title=":sunglasses:"
      alt="🕶"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1151809</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1151809</guid><dc:creator><![CDATA[lolz]]></dc:creator><pubDate>Mon, 09 Oct 2006 20:02:36 GMT</pubDate></item></channel></rss>