突然想到  看這樣會不會有問題

想說看單晶片上能不能有環狀的Queue

和 LinkList 一樣  用指標去指

STM32 board

沒想到STM32 也能把程式存在Ram上

唯一的缺點應該就不能allocat 出來吧  ~"~

#include "stm32f10x.h"

typedef struct QueueSample
{
    char context;
    struct QueueSample *next;
}QueueSample;



int main(void)
{
    int i;
    QueueSample *head;
    QueueSample QS[10];
    for (i = 0; i < 10-1; i++)
    {
        QS[i].next = &QS[i+1];
    }
    QS[i].next = &QS[0];
    head = &QS[0];
    for (i = 0; i < 9; i++)
    {
        head->context = i + 0x48;
        head = head->next;
    }
    while (1);
}

 

 

queue

 

在Debug 模式下  確實可以把位址和資料抓出來

理論上應該是成功的...

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 ffyy99 的頭像
    ffyy99

    喜歡亂搞的世界

    ffyy99 發表在 痞客邦 留言(2) 人氣()