quarta-feira, 8 de junho de 2011

Ainda o XDS no Linux...

Se quiserem usar o XMD a partir do XPS para controlar o debug e execução dos programas no Microblaze, é importante igualmente instalar o xterm, que é usado pela plataforma...
Simplesmente:
yum install xterm.i686

quarta-feira, 4 de maio de 2011

Como instalar o Xilinx Design Suite no Fedora 14 - passo-a-passo

É um passo-a-passo feito com bastante esforço e trabalho, mas tem funcionado adequadamente...
Instalar o Design Suite no Linux é uma atividade "interessante", visto que, aparentemente, ele não foi feitto pensando no Linux mesmo... (o que é bem curioso - sim, eu sei que ele é focado para o RH Enterprise).
De qualquer maneira, seguem os passos para aqueles que queiram tentar.

OBS: o difícil mesmo é fazer a placa ser "reconhecida" para gravação pelo Impact de forma consistente no S.O.

PASSOS PARA INSTALAÇÃO DO XILINX (FUNCIONAL)
USANDO UM FEDORA 14 CLEAN INSTALADO NO MODO SOFTWARE DEVELOPMENT SOMENTE COM OS PACOTES DEFAULT....

Passo 1) ALTERAR ARQUIVOS PARA PERMITIR O USO DO SISTEMA COM LOGIN COMO ROOT
a. logar com o usuário normal
b) abrir um terminal
c) mudar para superusuário (su)
d) editar os seguintes arquivos (pode usar o gedit ou vi)
d.1) vi /etc/pam.d/gdm
comente essa linha
#auth       required    pam_succeed_if.so user != root quiet
d.2) vi /etc/pam.d/gdm-password
comente essa linha
#auth       required    pam_succeed_if.so user != root quiet
Passo 2) LOGAR COMO ROOT DIRETO NO SISTEMA...
Passo 3) INSTALAR O OPENMOTIF... CONECTE-SE AO RMPFIND.NET
3.1) baixe a libXp-1.0.0-15.fc12.i686.rpm
3.2) baixe a openmotif-2.3.3-1.fc14.i686.rpm
3.3) instale a libxp usando rpm -Uvh libXp-1.0.0-15.fc12.i686.rpm
3.4) instale a openmotif usando rpm -Uvh openmotif-2.3.3-1.fc14.i686.rpm
Passo 4) coloque os arquivos de instalação da xilinx em um local apropriado
Passo 5) navegue até o diretório raiz da xilinx (onde você colocou os arquivos), usando o terminal (comando cd)
Passo 6) mude os direitos de execução dos scripts dando o seguinte comando
find . -type f -exec chmod 755 '{}' \;
Passo 7) desabilite o SELinux (System->Administration->SELinux Management)
7.1) coloque as opções System Defaul Enforcing Mode em DISABLED
e Current Enforcing Mode em Permissive
Passo 8) execute o instalador da xilinx a partir do diretório raiz dos arquivos
./xsetup
Passo 9) LEMBRE-SE DE SELECIONAR A INSTALAÇÃO DOS DRIVERS TAMBÉM...
Passo 10) Após a instalação com sucesso é necessário editar os scripts de configuração
a) vá até o diretório raiz da instalação do Xilinx... algo como
/opt/Xilinx/12.3/ISE_DS/settings32.sh
b) dê o seguinte comando vi settings32.sh e comente as seguintes linhas:
   #if [ "$XIL_SCRIPT_LOC_TMP_UNI" != "" ]; then
   #   XIL_SCRIPT_LOC_TMP_UNI=`readlink -f ${XIL_SCRIPT_LOC_TMP_UNI}`
   #   if [ $? == 0 ]; then
   #      XIL_SCRIPT_LOC=${XIL_SCRIPT_LOC_TMP_UNI}
   #   fi
   #fi
Passo 11) execute o script de configuração usando:
source /opt/Xilinx/12.3/ISE_DS/settings32.sh
Passo 12) instale o pacote unrar
rpm -Uvh unrar-3.9.9-1.fc13.i686.rpm
Passo 13) Descompacte a licença de uso do software
a) vá até o diretório EcHoS dentro da pasta de instalação da xilinx
b) dê o seguinte comando:
 unrar e echos-readme.rar
c) O arquivo de licença é o arquivo license.lic
Passo 14) Inicie o gerenciador de licenças da Xilinx
a) vá até o diretório /opt/Xilinx/12.3/ISE_DS/common/bin/lin
b) execute o comando ./xlcm
Passo 15) Instale a licença da Xilinx que foi descompactada
a) escolha a opção Manage Xilinx Licenses
b) clique em Copy License
c) navegue até o diretório onde você descompactou a licença e clique sobre ela
d) pressione Open
e) deve surgir uma mensagem dizendo que a instalação da licença ocorreu com sucesso
f) feche o gerenciador de licenças...
Passo 16) teste se o ambiente irá executar rodando o comando xps
Isso deve iniciar o Plataform Studio....
Passo 17) feche o Plataform Studio...
a) execute o ise - comando ise
b) crie um projeto exemplo e conecte a placa ao sistema - se estiver rodando uma máquina virtual, certifique-se de que a mesma tenha conectado a placa spartan...
c) verifique se a programação da placa irá ou não ocorre com sucesso
Passo 18) Caso apareça uma mensagem declarando que o cabo não foi encontrado, proceda adiante
Passo 19) Instale o pacote fxload e outros pacotes necessários
rpm -Uvh glibc-headers-2.13-1.i686.rpm glibc-common-2-13-1.i686.rpm glibc-2.13-1.i686.rpm glibc-devel-2.13-1.i686.rpm
rpm -Uvh glibc-headers-2.13-1.i686.rpm glibc-common-2-13-1.i686.rpm glibc-2.13-1.i686.rpm glibc-devel-2.13-1.i686.rpm
rpm -Uvh libusb-0.1.12-23.fc14.i686.rpm
rpm -Uvh libusb-devel-0.1.12-23.fc14.i686.rpm
rpm -Uvh libusb1-devel-doc-1.0.8-1.fc14.noarch.rpm libusb1-devel-1.0.8.1.fc14.i686.rpm
rpm -Uvh libusb-devel-0.1.12-23.fc14.i686.rpm
rpm -Uvh libusb-static-0.1.12-23.fc14.i686.rpm
rpm -Uvh libusb1-static-1.0.8-1.fc14.i686.rpm
rpm -Uvh libusb-devel-0.1.12-23.fc14.i686.rpm
rpm -Uvh glibc-devel-2.13-1.i686.rpm glibc-headers-2.13-1.i686.rpm
rpm -Uvh fxload-2002_04_11-9.fc12.i686.rpm
Passo 20) Copie o arquivo  /opt/Xilinx/12.3/ISE_DS/common/bin/lin/xusbdfwu.rules para /etc/udev/rules.d/xusbdfwu.rules
use o comando cp /opt/Xilinx/12.3/ISE_DS/common/bin/lin/xusbdfwu.rules /etc/udev/rules.d/xusbdfwu.rules
Passo 21) Copiar os arquivos do diretório /opt/Xilinx/12.3/ISE_DS/common/bin/lin/xusb*.hex para /usr/share
cp /opt/Xilinx/12.3/ISE_DS/common/bin/lin/xusb*.hex /usr/share
Passo 22) Mate o processo do udev
a) ps ax | grep udev
b) kill numerodoprocesso
c) Restart o udev /sbin/start_udev
d) tente usar o Impact... deve estar funcionando...
Passo 23) Se necessário, recrie o symlink para a libusb
a) se já existir o arquivo, remova...
rm libusb.so
b) crie o symlink
ln -s libusb-1.0.so libusb.so
Passo 24) se a máquina for 64 bits, também pode ser útil criar o seguinte symlink
a) vá para a pasta /usr/lib64
b) crie o symlink ln -s libusb-1.0.so libusb.so
Passo 25) como comando final (pelos testes que foram feitos), dê o seguinte comando no terminal
sed -i -e 's/TEMPNODE/tempnode/' -e 's/SYSFS/ATTRS/g' -e 's/BUS/SUBSYSTEMS/' /etc/udev/rules.d/xusbdfwu.rules

OBS: sim... eu sei que não é correto fazer tudo como root.. mas nesse caso acabou sendo mais fácil.. tente fazer 20 usuários instalarem esse negócio tendo pouco conhecimento de Linux.... acabou sendo bem mais fácil...

quinta-feira, 28 de abril de 2011

How to build LOG4CXX and link it statically in Visual Studio 2010

As it is so hard to properly find this information (and it would have saved me about a day of frustrating work), here is how I did solved the problem (I guess...):

STEP 1) TO COMPILE LIB4CXX AS A STATIC LIBRARY....

1) Just open the log4cxx project/solution already sent with the downloaded source files....
2) Go the log4cxx project, and open its properties dialog...
3) Select Configuration Properties->General and set Configuration Type to Static Library (.lib)
4) Go to Configuration Properties->Preprocessor and add to Preprocessor Definitions the following (LOG4CXX_STATIC) ---> this is the only thing that I read everywhere, but it is not enough...
5) Go to Configuration Properties->Code Generation and set RunTime Library to Multi-threaded Debug (/MTd) --> with you want a release (without debug option), you have to change this option... I do not know if it is really necessary, but aldo DO SET the same property for apr, apr_util and xml...
6) Build log4cxx
7) My result is a file named log4cxx.lib with about 37MB of space... (I have seen another option of the lib with only 15MB... why? I REALLY do not know...)

STEP 2) HOW TO USE LIB4CXX AS A STATIC LIBRARY

If you usually program in C++ for Linux as I do, this is quite interesting (and I feel like really stupid after discovering it): you have to list all (I mean ALL) static libraries need for log4cxx.lib... this is just not necessary for g++, as it has all libs in one place (usually) and is quite capable of searching for those dependency libraries.... but guess what... VC++ does not do that...
So...
1) First of all... you project has to match the log4cxx version.. that means, if you use a /MTd definition while building the lib, you do have to use the same option with your project... So, go to Configuration Properties->Code Generation and set RunTime Library to Multi-threaded Debug (/MTd) or any other option you want (in the case of a static lib, only /MT...)
2) Second of all, as it is found in some messages, you do have to add LOG4CXX_STATIC to Preprocessor Definitions of your project also...
3) This was my error.... you do have to explicit all paths and libs you use, so add the path to log4cxx.lib (obvious), but also to apr-1.lib, aprutil-1.lib, xml.lib...
4) Add all libs you need (Linker->Input->Additional Dependencies) and DO ADD the following: WS2_32.Lib, MsWSock.Lib, AdvAPI32.Lib, odbc32.lib (this is already said in the list)... AND ALSO ADD log4cxx.lib - this is what you want, after all, but also add the apr, apr_util and xml static libraries... in my case: apr-1.lib, aprutil-1.lib, xml.lib
Build your project, and it should work... (if I did not forgot anything else...).

I will try to elaborate this a little, but I guess something like that should be inserted in log4cxx wiki...

If you want an easier solution (yesterday I got this, but I was not happy with the fact that I was unable to do it myself):
http://www.dreamcubes.com/b2/software-development/28/log4cxx-for-win32-with-vs2005/

Also, I guess it should be said: if you want to debug you project, you need a debug log4cxx.lib version, if you want to release it, you need a release version of the lib, and so on...
Also, as the lib uses a lot of C++, a lib version for VS2003 will not work in VS2008, cause there is a lot of changes from STL from VS2003 to VS2008.... you do need to compile it using the same compile version... (as I searched in the web, this is true for most of the static libraries at least with VC++).

If I said anything or a lot of things that is wrong, please correct me :) :)