Tuesday, September 30, 2014
set ulimit on Mac
http://unix.stackexchange.com/questions/108174/how-to-persist-ulimit-settings-in-osx-mavericks
Install Android SDK
You are two options:
1. Install stand-alone version
1) read the Readme
Basically, you need to run $ tools/android update sdk --no-ui
2) platform-tools contains tools including ADB.
3) you need to add the /Users/Username/Development/android-sdk-macosx/platform-tools into the $PATH or you can run it locally.
2. Instal the version with Eclipse
http://developer.android.com/sdk/index.html
1. Install stand-alone version
1) read the Readme
Basically, you need to run $ tools/android update sdk --no-ui
2) platform-tools contains tools including ADB.
3) you need to add the /Users/Username/Development/android-sdk-macosx/platform-tools into the $PATH or you can run it locally.
2. Instal the version with Eclipse
http://developer.android.com/sdk/index.html
ADB errors
1. ADB error: device not found
http://stackoverflow.com/questions/21408674/adb-error-device-not-found
2. ADB error: device offline
It is because of an old version of ADB (e.g., 1.0.29). It requires 1.0.31 or greater.
http://stackoverflow.com/questions/10680417/error-device-offline
Thursday, September 25, 2014
Parameter passing inline gcc assembly error
This does not work:
static void beep(unsigned short divisor)
{
__asm__ volatile(
// set 8254 timer contol register to accept divisor
// IO port: 0x43
// 0xb6: 1011 0110
// channel2, access mode lo and hi, square wave
"movb $0xb6, %%al\n"
"out %%al, $0x43\n"
// load the divisor into ax
"mov %0, %%ax\n"
// set the low 8 bits of time2 counter
// IO port: 0x42
"out %al, $0x42\n"
// set the high 8 bits of timer2 counter
// IO port: 0x42
"movb %ah, %al\n"
"out %al, $0x42\n"
// configure Speaker IO controller Port 0x61
// save the contents of 0x61
"in $0x61, %al\n"
"movb %al, %ah\n"
// set bit 0, 1 to 1; enables the timer and NAND gate
"or $0x3, %al\n"
"out %al, $0x61\n"
// Run spin loop to delay
"mov $0x50E0, %cx\n"
"BEEP_DELAY: nop\n"
"nop\n"
"loop BEEP_DELAY\n"
// Trun off the speaker
"mov %ah, %al\n"
"out %al, $0x61"
:
:"r" (divisor)
);
}
This works:
static void beep(unsigned short divisor)
{
__asm__ volatile(
// set 8254 timer contol register to accept divisor
// IO port: 0x43
// 0xb6: 1011 0110
// channel2, access mode lo and hi, square wave
"movb $0xb6, %%al\n"
"out %%al, $0x43\n"
// load the divisor into ax
"mov %0, %%ax"
:
:"r" (divisor)
);
__asm__ volatile(
// set the low 8 bits of time2 counter
// IO port: 0x42
"out %al, $0x42\n"
// set the high 8 bits of timer2 counter
// IO port: 0x42
"movb %ah, %al\n"
"out %al, $0x42\n"
// configure Speaker IO controller Port 0x61
// save the contents of 0x61
"in $0x61, %al\n"
"movb %al, %ah\n"
// set bit 0, 1 to 1; enables the timer and NAND gate
"or $0x3, %al\n"
"out %al, $0x61\n"
// Run spin loop to delay
"mov $0x50E0, %cx\n"
"BEEP_DELAY: nop\n"
"nop\n"
"loop BEEP_DELAY\n"
// Trun off the speaker
"mov %ah, %al\n"
"out %al, $0x61\n"
);
}
static void beep(unsigned short divisor)
{
__asm__ volatile(
// set 8254 timer contol register to accept divisor
// IO port: 0x43
// 0xb6: 1011 0110
// channel2, access mode lo and hi, square wave
"movb $0xb6, %%al\n"
"out %%al, $0x43\n"
// load the divisor into ax
"mov %0, %%ax\n"
// set the low 8 bits of time2 counter
// IO port: 0x42
"out %al, $0x42\n"
// set the high 8 bits of timer2 counter
// IO port: 0x42
"movb %ah, %al\n"
"out %al, $0x42\n"
// configure Speaker IO controller Port 0x61
// save the contents of 0x61
"in $0x61, %al\n"
"movb %al, %ah\n"
// set bit 0, 1 to 1; enables the timer and NAND gate
"or $0x3, %al\n"
"out %al, $0x61\n"
// Run spin loop to delay
"mov $0x50E0, %cx\n"
"BEEP_DELAY: nop\n"
"nop\n"
"loop BEEP_DELAY\n"
// Trun off the speaker
"mov %ah, %al\n"
"out %al, $0x61"
:
:"r" (divisor)
);
}
This works:
static void beep(unsigned short divisor)
{
__asm__ volatile(
// set 8254 timer contol register to accept divisor
// IO port: 0x43
// 0xb6: 1011 0110
// channel2, access mode lo and hi, square wave
"movb $0xb6, %%al\n"
"out %%al, $0x43\n"
// load the divisor into ax
"mov %0, %%ax"
:
:"r" (divisor)
);
__asm__ volatile(
// set the low 8 bits of time2 counter
// IO port: 0x42
"out %al, $0x42\n"
// set the high 8 bits of timer2 counter
// IO port: 0x42
"movb %ah, %al\n"
"out %al, $0x42\n"
// configure Speaker IO controller Port 0x61
// save the contents of 0x61
"in $0x61, %al\n"
"movb %al, %ah\n"
// set bit 0, 1 to 1; enables the timer and NAND gate
"or $0x3, %al\n"
"out %al, $0x61\n"
// Run spin loop to delay
"mov $0x50E0, %cx\n"
"BEEP_DELAY: nop\n"
"nop\n"
"loop BEEP_DELAY\n"
// Trun off the speaker
"mov %ah, %al\n"
"out %al, $0x61\n"
);
}
Wednesday, September 24, 2014
PS2 Keyboard Info
http://www.computer-engineering.org/ps2keyboard/
http://wiki.osdev.org/PS/2_Keyboard
http://wiki.osdev.org/%228042%22_PS/2_Controller
http://wiki.osdev.org/PS/2_Keyboard
http://wiki.osdev.org/%228042%22_PS/2_Controller
Wednesday, September 17, 2014
How to install setuptools under a local python
Supposed you have a local python, which is used to built other staff. For example, buildozer will have this
src/.buildozer/android/platform/python-for-android/build/hostpython/Python-2.7.2
And this Python is missing setuptools for compiling, you need to install it under this Python.
manual download the development version of setuptools from https://pypi.python.org/pypi/setuptools#downloads
move this setuptools into the Python directory
cd into the setuptools direcotry
find the executable for this python
run ../python.exe[where your python executable is] setup.py install
this will install setuptools under the local python.
Note using easy_install setup tools only installs in your system not the local Python.
Subscribe to:
Posts (Atom)