embeded/Cortex-M4 Ti2018. 1. 4. 14:35

일단.. 사용중인 보드가 UART0가 아닌 UART1을 외부용으로 쓰고 있어서 손을 봐야 했는데

bl_config.h 에서 얘가 원본이고

#define UART_ENABLE_UPDATE

#define UART_AUTOBAUD

//#define UART_FIXED_BAUDRATE     115200

#define UART_CLOCK_ENABLE         SYSCTL_RCGCUART_R0

#define UARTx_BASE                UART0_BASE

#define UART_RXPIN_CLOCK_ENABLE   SYSCTL_RCGCGPIO_R0

#define UART_RXPIN_BASE         GPIO_PORTA_BASE

#define UART_RXPIN_PCTL         0x1

#define UART_RXPIN_POS          0

#define UART_TXPIN_CLOCK_ENABLE SYSCTL_RCGCGPIO_R0

#define UART_TXPIN_BASE         GPIO_PORTA_BASE

#define UART_TXPIN_PCTL         0x1

#define UART_TXPIN_POS          1


UART1을 쓰려고 한다면 요렇게 6개를 손을 봐주어야 한다.

#define UART_ENABLE_UPDATE

//#define UART_AUTOBAUD

#define UART_FIXED_BAUDRATE     38400

#define UART_CLOCK_ENABLE         SYSCTL_RCGCUART_R1

#define UARTx_BASE                UART1_BASE

#define UART_RXPIN_CLOCK_ENABLE   SYSCTL_RCGCGPIO_R1

#define UART_RXPIN_BASE         GPIO_PORTB_BASE

#define UART_RXPIN_PCTL         0x1

#define UART_RXPIN_POS          0

#define UART_TXPIN_CLOCK_ENABLE SYSCTL_RCGCGPIO_R1

#define UART_TXPIN_BASE         GPIO_PORTB_BASE

#define UART_TXPIN_PCTL         0x1

#define UART_TXPIN_POS          1


그리고 PORTB의 2번 핀이 485 TXEN으로 했는데

좀 더 테스트를 해봐야겠지만, 38400 에서는 문제없이 PC와 1m 이내 선으로 연결해서는 문제없이 업데이트 된다.

(57600 까지는 성공적인듯.. 115k는 줄여줘도 안되네.. rs485 특성으로 보임)

(Autobaud는 작동을 못하네.. rs485 특성일려나?)

void

UARTSend(const uint8_t *pui8Data, uint32_t ui32Size)

{

    //

    // Transmit the number of bytes requested on the UART port.

    //

    GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_2, GPIO_PIN_2);

    Delay(10);

    while(ui32Size--)

    {

        //

        // Make sure that the transmit FIFO is not full.

        //

        while((HWREG(UARTx_BASE + UART_O_FR) & UART_FR_TXFF))

        {

        }


        //

        // Send out the next byte.

        //

        HWREG(UARTx_BASE + UART_O_DR) = *pui8Data++;

    }


    //

    // Wait until the UART is done transmitting.

    //

    UARTFlush();

    GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_2, 0);

    Delay(10);


LM Flash 에서는 UART로 하고 귀차니즘으로 인해(...)

Autobaud 대신 38400 으로 고정을 했는데


Program탭에서 Program Address Offset만 0x00001000 으로 바꾸어 주면 된다.

LR_IROM 0x00001000 0x00040000

{

    ER_IROM 0x00001000 0x00040000

    {

        *.o (RESET, +First)

        * (InRoot$$Sections, +RO)

    }


    RW_IRAM 0x20000000 0x00008000

    {

        ;* (vtable, +First)

        * (+RW, +ZI)

    }


(물론 해당 바이너리는 sct 파일에서 0x00000000을 0x00001000 으로 바꾸고 다시 컴파일 해야 한다)


coocox 라는 녀석을 사용중인데 이녀석은 0x1000이 아니라 0x1 섹터로 옵셋을 잡아주니 잘 쓴다.

옆에 써있듯 4번 섹터가 0x00001000 이니 offset을 0x04로 해주면 될것으로 보인다.

[링크 : http://www.coocox.org/book/coocox/CoFlash/GUI-Mode]

+

38400은 delay 없이도 일단 작동

57600은 delay(10) 있어야 작동


+

머지.. 부트로더 올리고 시리얼로 올린다음은 되는데 그 이후에는 안켜진다 -ㅁ-?

Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 3. 23:49

문서를 보다 보니 Active Serial / Passive Serial 이라는 단어가 나와서 검색해보니..

일단 Active/Passive는 FPGA의 기준으로 보면 될 것 같다.

Active Serial은 FPGA가 활성화 되서 master 로서 EPCS나 EPCQ를 쓰는 것이고

Passive Serial은 FPGA가 플래시에 관여하지 않고 별도의 micom이나 다른 장치를 통해 플래시를 굽는 것이다.



[링크 : https://www.altera.com/support/support-resources/support-centers/devices/cfg-index/cfg-compare.html]


The Active Serial (AS) configuration scheme is supported in the 1 bit data width (AS x1) or the 4 bit data width (AS x4). The AS x4 scheme is supported only in Stratix® V devices. AS configuration can be performed using an Altera® serial configuration (EPCS) device or quad-serial configuration (EPCQ) device. During AS configuration, the Altera FPGA acts as the configuration master and the EPCS or EPCQ device acts as the configuration slave. The FPGA outputs the clock on the DCLK pin and receives the configuration data from the EPCS or EPCQ device on the data pin(s).

[링크 : https://www.altera.com/support/support-resources/support-centers/devices/cfg-index/cfg-as.html]


Passive serial (PS) configuration can be performed using an Altera® download cable, an Altera configuration device, or an intelligent host such as a microprocessor. During PS configuration, data is transferred from a configuration device, flash memory, or other storage device to the Altera device on the DATA0 pin. This configuration data is latched into the FPGA on the rising edge of DCLK. Configuration data is transferred at a rate of one bit per clock cycle.

[링크 : https://www.altera.com/support/support-resources/support-centers/devices/cfg-index/cfg-ps.html]


[링크 : https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/ug/ug_usb_blstr.pdf]


To program a device in JTAG or Passive Serial mode:

  1. On the File menu, click Open and select the Chain Description File that contains the JTAG or Passive Serial chain you wish set up.

  2. Plug the download cable into the system that contains the devices or device to program.

  3. If necessary, select the appropriate hardware setup for the chain.

  4. If necessary, in the Mode list, select JTAG or Passive Serial.

  5. If you are using JTAG mode, and you want to automatically add devices in a device chain to the programming list, click Auto Detect.

  6. Make sure the device name(s) displayed in the Device list matches the device(s) installed in the system.

  7. If you want, turn on one or more programming options in the programming list.

  8. To start programming or other optional action, click Start.

[링크 : http://quartushelp.altera.com/15.0/mergedProjects/program/pgm/pgm_pro_prog_single_as_device.htm]

Posted by 구차니

intel ME에 이어서 새로운(?) 하드웨어 버그

커널 스페이스 메모리가 유저 스페이스로 유출될 수 있는 결함

그럼.. intel ME 외에도 다른 (ring level 관련 하드웨어 버그니까..) MMU 쪽 버그인가?

[링크 : https://en.wikipedia.org/wiki/Memory_management_unit]


[링크 : https://tgd.kr/2251697]

[링크 : http://www.hwbattle.com/bbs/board.php?bo_table=cpumbram&wr_id=96704]

    [링크 : https://www.phoronix.com/scan.php?page=article&item=linux-415-x86pti&num=1]

    [링크 : https://www.theregister.co.uk/2018/01/02/intel_cpu_design_flaw/] << 요게 가장 원본인듯?

[링크 : http://www.ddanzi.com/...document_srl=500251668]

[링크 : http://www.fmkorea.com/889083531]



+

예전에 cpu 버그로 성능하락 건이 있었던게 기억나서 찾아 보는데..

intel이 아니라 AMD였네(페넘 TLB 버그)

[링크 : http://www.bodnara.co.kr/bbs/article.html?num=64466]


+

PCID - Process Context IDentifiers

머하는 녀석인지 모르겠네.. TLB 나오는거 봐서는 페이징 관련인가?

[링크 : http://www.felixcloutier.com/x86/INVPCID.html]


+

KASLR - Kernel address space layout randomization

[링크 : https://lwn.net/Articles/569635/]

[링크 : https://en.wikipedia.org/wiki/Address_space_layout_randomization]


위의 링크 중에서 잘은 모르겠지만.. 웹 브라우저에 javascript로 뚫는 예제를 보이는데

이번 문제는 AMD cpu에서는 발생하지 않았다고 하지만.. 이거랑 연관이 있는진 모르겠...네?

[링크 : https://www.vusec.net/projects/anc/]


+

2018.01.04

어디서 본 문서인데 링크 손실.. -_ㅠ

파이프라인 길이 증대로 인해서 branch prediction을 통해 미리 연산을 하는데

분기예측시에는 권한을 고려하지 않고 연산함으로서

현재 권한에 따라 미리 계산해두기 때문에 사용자 권한임에도 불구하고

분기예측으로 인해 커널 메모리를 접근가능한 문제가 발생하고

이 헛점을 노리면 적절한 타이밍과 분기문을 이용해서 현재의 문제가 발생했다 라는 글도 있었는데

잘은 모르겠네.. MMU에 분기예측에 그럼.. 현존 x86 아키텍쳐 전체에 대한 문제로 확대되는거 아닌가?

아니.. 반대로 폰 노이만 구조의 MMU를 장착하고 파이프라인으로 처리 성능을 늘린 모든

CPU에 대해서 해당 문제가 발생할 우려가 있을 것으로 보이는데?


[링크 : http://www.coolenjoy.net/bbs/27/1852001?sfl=wr_subject%7C%7Cwr_content&stx=branch&sop=and]

Posted by 구차니
embeded/Cortex-M4 Ti2018. 1. 3. 09:18

'embeded > Cortex-M4 Ti' 카테고리의 다른 글

c99 inline과 extern  (0) 2018.04.20
tm4c1231 부트로더 + RS485  (0) 2018.01.04
keil linker 옵션 entry  (0) 2017.12.28
tivaware bootloader + qs-rgb 테스트  (0) 2017.12.28
tm4c tivaware bootloader 빌드..  (2) 2017.12.26
Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 3. 09:10

대부분이 LVTTL(3.3V로 작동해서 가능 한 듯?)


마우스 꽂아서 핑퐁 게임 ㄷㄷ

[링크 : http://www.fpga4fun.com/PongGame.html]


NTSC 콤포짓 영상 만들기

[링크 : http://excamera.com/sphinx/fpga-ntsc.html]


VGA test 패턴

[링크 : http://maximator-fpga.org/examples/]


ADV7123 비디오 DAC 이용한 예제

[링크 : https://eewiki.net/pages/viewpage.action?pageId=15925278]

1600x1200@100Hz 가능한 녀석인 듯

[링크 : https://people.ece.cornell.edu/land/courses/ece5760/DE1_SOC/ADV7123.pdf]

Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 2. 23:10

왜 빠른가 했더니 FLASH에 한번도 안쓰고

전부 SRAM에 바로 적용해서 빨랐던 거였군.. -_-


quartus 에서 File - Convert Programming Files


Programming file type을 pof나 jic로 설정해주고

아래의 input files to convert 에서 

JIC는 Flash loader에서 Add Device, SOF Data에서 Add File을 해주고


pof는 SOF Data에서 Add File을 해주면 된다.


프로그래머에서는 구울수 있는 곳이 있는데

기본 프로젝트에서는 죄다 EP4CE22 로만 굽도록 되어 있어 구워도 전부 SRAM으로만 들어가

전원을 끊었다 연결하면 이전 작동으로 돌아가도록 되어있다.


아무튼 Auto Detect 눌러서 비슷한게 나오면 Change Device로 제대로 잡아주고


Device에서 우클릭 해서 Attach Flash Deivce로

EPCS64를 추가해준다.


그러면 신기하게도 Factory default enhanced SFL image라는게 생겨나는데

굽고 나서 add file 누르면 저 이미지가 사라지고, 그러면 jtag으로 구울수가 없다..

도대체 쟤는 어떻게 선택하지?

Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 2. 22:05

데이터 시트랑 자료들 보다 보니.. IV 에는 고속 시리얼 버스 없고 PCIe도 없고

다만 LVDS는 있다고 하길래 HDMI 정도는 별도의 트랜시버 칩 없이 가능하지 않으려나?

생각했는데 역시나.. 누군가 해놓은게 있네.. ㄷㄷ


[링크 : http://sa89a.net/mp.cgi/ele/fpga_hdmi.htm]

[링크 : https://www.youtube.com/watch?v=Y9g6vpcd9ik]

[링크 : https://www.youtube.com/watch?v=hkOZifLUp8s]


+

카페자료

[링크 : http://cafe.naver.com/xinadist/21]

[링크 : http://cafe.naver.com/xinadist/22]

Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 2. 20:33

sof - sram object file

rbf - raw binary file

pof - program object file

[링크 : https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/hb/cyclone-iv/cyiv-51008.pdf]


jic - JTAG Indirect Configuation file

[링크 : http://quartushelp.altera.com/14.1/mergedProjects/reference/glossary/def_jic.htm]


A SOF file programs the FPGA fabric directly (The FPGA's SRAM cells). 

The POF file is used to program an external configuration (A FLASH/EEPROM device - not the actual FPGA). 

[링크 : http://www.alteraforum.com/forum/showthread.php?t=53811]


progammer에서는 jic로 플래시에 굽네.. pof는 어디서 쓸려나?

Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 2. 19:34

DE0-nano의 Altera Cyclone IV에 달린

EPCS64 는 8MB 인데.. 실제로 sof 파일들 보면 688KB로 나온다.

아무튼 NIOS2 예제들을 보면 용량이 조금 더 크게 나온다.

아무튼.. SOF 파일 자체에 FPGA 설정 부분과 NIOS 2 용량으로 구성이 되는것 같고

NIOS 2에서 EPCS Controller를 통해서 MICOM 내부 flash 쓰듯 쓸수 있다는 것을 봐서는

EPCS Controller 에서는 물리 주소와 논리주소로 구분하여 

NIOS 2에서 접근하도록 해주는 역활을 하는 것으로 추측된다.




0xE400이면 58368 인데.. 단위가 머냐...


[링크 : https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/ug/ug_embedded_ip.pdf]


SOPC Builder includes the EPCS device controller core, which is an interface core designed specifically to work with the EPCS device. 

[링크 :https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/hb/cfg/cyc_c51014.pdf]

[링크 : http://www.alterawiki.com/wiki/EPCS_Guide]

Posted by 구차니

'프로그램 사용 > notepad++' 카테고리의 다른 글

notepad++ for ubuntu?  (0) 2019.12.21
notepad++ 주석 삭제하기  (4) 2018.05.09
notepad++ 따옴표 자동완성 끄기  (0) 2017.12.10
notepad++ 줄순서 뒤바꾸기  (2) 2017.11.22
notepad++ XML 인덴트 적용하기  (0) 2017.07.26
Posted by 구차니