Splitting Assets from Code: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
m (Fixed spelling mistake) |
m (Fixed pointer types) |
||
Line 45: | Line 45: | ||
Do this for all the assets, and you're almost done. The next step is to open a C header file (or better yet, create a new one) and to create some <code>extern</code> calls for your new segments: |
Do this for all the assets, and you're almost done. The next step is to open a C header file (or better yet, create a new one) and to create some <code>extern</code> calls for your new segments: |
||
<syntaxhighlight lang="c"> |
<syntaxhighlight lang="c"> |
||
extern |
extern u8 _spr_bearSegmentRomStart[]; |
||
extern |
extern u8 _spr_bearSegmentRomEnd[]; |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
Remember that segment name I told you that was important and had to be unique? Whatever you set your segment name to, it needs to match the <code>extern</code>'s. Meaning, if you called your segment <code>NAME</code>, then you would need to define the <code>extern</code>'s as <code>_NAMESegmentRomStart</code> and <code>_NAMESegmentRomEnd</code> respectively. |
Remember that segment name I told you that was important and had to be unique? Whatever you set your segment name to, it needs to match the <code>extern</code>'s. Meaning, if you called your segment <code>NAME</code>, then you would need to define the <code>extern</code>'s as <code>_NAMESegmentRomStart</code> and <code>_NAMESegmentRomEnd</code> respectively. |
||
Line 79: | Line 79: | ||
// Start the DMA |
// Start the DMA |
||
osPiStartDma(&dmaIoMesgBuf, OS_MESG_PRI_NORMAL, OS_READ, _spr_bearSegmentRomStart, buffer, size, &dmaMesgQ); |
osPiStartDma(&dmaIoMesgBuf, OS_MESG_PRI_NORMAL, OS_READ, (u32)_spr_bearSegmentRomStart, buffer, size, &dmaMesgQ); |
||
// Wait for the DMA to finish |
// Wait for the DMA to finish |
||
Line 120: | Line 120: | ||
A useful trick, you can <code>extern</code> the codesegment as well: |
A useful trick, you can <code>extern</code> the codesegment as well: |
||
<syntaxhighlight lang="c"> |
<syntaxhighlight lang="c"> |
||
extern |
extern u8 _codeSegmentRomStart[]; |
||
extern |
extern u8 _codeSegmentRomEnd[]; |
||
</syntaxhighlight> |
</syntaxhighlight> |
||